Change the tables to schemas.

This commit is contained in:
Mark Crane
2013-04-11 16:56:30 +00:00
parent 18319f51e5
commit bdb31f17bd
14 changed files with 401 additions and 418 deletions
+12 -8
View File
@@ -72,8 +72,9 @@
//schema details //schema details
$y = 0; //table array index $y = 0; //table array index
$z = 0; //field array index $z = 0; //field array index
$apps[$x]['db'][$y]['table']['text'] = 'v_schema_data'; $apps[$x]['db'][$y]['table'] = 'v_schema_data';
$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_data'; //$apps[$x]['db'][$y]['table']['text'] = 'v_schema_data';
//$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_data';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'virtual_table_data_id'; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'virtual_table_data_id';
@@ -175,8 +176,9 @@
$y = 1; //table array index $y = 1; //table array index
$z = 0; //field array index $z = 0; //field array index
$apps[$x]['db'][$y]['table']['text'] = 'v_schema_name_values'; $apps[$x]['db'][$y]['table'] = 'v_schema_name_values';
$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_name_values'; //$apps[$x]['db'][$y]['table']['text'] = 'v_schema_name_values';
//$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_name_values';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'virtual_table_data_types_name_value_id'; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'virtual_table_data_types_name_value_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
@@ -251,8 +253,9 @@
$y = 2; //table array index $y = 2; //table array index
$z = 0; //field array index $z = 0; //field array index
$apps[$x]['db'][$y]['table']['text'] = 'v_schema_fields'; $apps[$x]['db'][$y]['table'] = 'v_schema_fields';
$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_fields'; //$apps[$x]['db'][$y]['table']['text'] = 'v_schema_fields';
//$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_fields';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'schema_field_id'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'schema_field_id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'virtual_table_field_id'; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'virtual_table_field_id';
@@ -356,8 +359,9 @@
$y = 3; //table array index $y = 3; //table array index
$z = 0; //field array index $z = 0; //field array index
$apps[$x]['db'][$y]['table']['text'] = 'v_schemas'; $apps[$x]['db'][$y]['table'] = 'v_schemas';
$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_tables'; //$apps[$x]['db'][$y]['table']['text'] = 'v_schemas';
//$apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_tables';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'virtual_table_id'; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'virtual_table_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
+13 -13
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_data_delete')) { if (permission_exists('schema_delete')) {
//access granted //access granted
} }
else { else {
@@ -37,45 +37,45 @@ else {
if (count($_GET)>0) { if (count($_GET)>0) {
//declare variable(s) //declare variable(s)
$table_parent_id = ''; $schema_parent_id = '';
//get the http get and set them as php variables //get the http get and set them as php variables
$data_row_uuid = check_str($_GET["data_row_uuid"]); $data_row_uuid = check_str($_GET["data_row_uuid"]);
$data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]); $data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]);
$table_uuid = check_str($_GET["table_uuid"]); $schema_uuid = check_str($_GET["schema_uuid"]);
//show the results and redirect //show the results and redirect
require_once "includes/header.php"; require_once "includes/header.php";
//get the table_parent_id from the child table //get the schema_parent_id from the child table
if (strlen($table_parent_id) == 0) { if (strlen($schema_parent_id) == 0) {
$sql = "select * from v_tables "; $sql = "select * from v_schemas ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
$table_parent_id = $row["table_parent_id"]; $schema_parent_id = $row["schema_parent_id"];
} }
} }
//delete the child data //delete the child data
$sql = "delete from v_table_data "; $sql = "delete from v_schema_data ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and data_parent_row_uuid = '$data_row_uuid' "; $sql .= "and data_parent_row_uuid = '$data_row_uuid' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
//delete the data //delete the data
$sql = "delete from v_table_data "; $sql = "delete from v_schema_data ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and data_row_uuid = '$data_row_uuid' "; $sql .= "and data_row_uuid = '$data_row_uuid' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
//mark the the item as deleted and who deleted it //mark the the item as deleted and who deleted it
//$sql = "update v_table_data set "; //$sql = "update v_schema_data set ";
//$sql .= "data_del_date = now(), "; //$sql .= "data_del_date = now(), ";
//$sql .= "data_del_user = '".$_SESSION["username"]."' "; //$sql .= "data_del_user = '".$_SESSION["username"]."' ";
//$sql .= "where domain_uuid = '$domain_uuid' "; //$sql .= "where domain_uuid = '$domain_uuid' ";
@@ -86,10 +86,10 @@ if (count($_GET)>0) {
//set the meta redirect //set the meta redirect
if (strlen($data_parent_row_uuid) == 0) { if (strlen($data_parent_row_uuid) == 0) {
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_data_view.php?id=$table_uuid&data_row_uuid=$data_row_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_data_view.php?id=$schema_uuid&data_row_uuid=$data_row_uuid\">\n";
} }
else { else {
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_data_edit.php?table_uuid=$table_parent_id&data_row_uuid=$data_parent_row_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid\">\n";
} }
//show a message to the user before the redirect //show a message to the user before the redirect
+87 -89
View File
@@ -26,7 +26,7 @@
include "root.php"; include "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_data_add') || permission_exists('tables_data_edit')) { if (permission_exists('schema_data_add') || permission_exists('schema_data_edit')) {
//access granted //access granted
} }
else { else {
@@ -36,7 +36,7 @@ else {
//set http get variables to php variables //set http get variables to php variables
$search_all = check_str($_GET["search_all"]); $search_all = check_str($_GET["search_all"]);
$table_uuid = check_str($_GET["table_uuid"]); $schema_uuid = check_str($_GET["schema_uuid"]);
if (strlen($_GET["data_row_uuid"])>0) { //update if (strlen($_GET["data_row_uuid"])>0) { //update
$data_row_uuid = check_str($_GET["data_row_uuid"]); $data_row_uuid = check_str($_GET["data_row_uuid"]);
$action = "update"; $action = "update";
@@ -50,45 +50,44 @@ else {
} }
} }
if (strlen($_GET["id"]) > 0) { if (strlen($_GET["id"]) > 0) {
$table_uuid = check_str($_GET["id"]); $schema_uuid = check_str($_GET["id"]);
} }
if (strlen($_GET["data_parent_row_uuid"])>0) { if (strlen($_GET["data_parent_row_uuid"])>0) {
$data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]); $data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]);
} }
//get table information //get schema information
$sql = ""; $sql = "select * from v_schemas ";
$sql .= "select * from v_tables ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
$table_category = $row["table_category"]; $schema_category = $row["schema_category"];
$table_label = $row["table_label"]; $schema_label = $row["schema_label"];
$table_name = $row["table_name"]; $schema_name = $row["schema_name"];
$table_auth = $row["table_auth"]; $schema_auth = $row["schema_auth"];
$table_captcha = $row["table_captcha"]; $schema_captcha = $row["schema_captcha"];
$table_parent_id = $row["table_parent_id"]; $schema_parent_id = $row["schema_parent_id"];
$table_description = $row["table_description"]; $schema_description = $row["schema_description"];
break; //limit to 1 row break; //limit to 1 row
} }
unset ($prep_statement); unset ($prep_statement);
//process the data submitted to by the html form //process the data submitted to by the html form
if (count($_POST)>0) { //add if (count($_POST)>0) { //add
$table_uuid = check_str($_POST["table_uuid"]); $schema_uuid = check_str($_POST["schema_uuid"]);
$table_name = check_str($_POST["table_name"]); $schema_name = check_str($_POST["schema_name"]);
$rcount = check_str($_POST["rcount"]); $rcount = check_str($_POST["rcount"]);
//get the field information //get the field information
$db_field_name_array = array(); $db_field_name_array = array();
$db_value_array = array(); $db_value_array = array();
$db_names .= "<tr>\n"; $db_names .= "<tr>\n";
$sql = "select * from v_table_fields "; $sql = "select * from v_schema_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "order by field_order asc "; $sql .= "order by field_order asc ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
@@ -126,9 +125,9 @@ else {
$unique_temp_id = md5('7k3j2m'.date('r')); //used to find the first item $unique_temp_id = md5('7k3j2m'.date('r')); //used to find the first item
$data_row_uuid = $unique_temp_id; $data_row_uuid = $unique_temp_id;
} }
$sql = "select field_type, field_name from v_table_fields "; $sql = "select field_type, field_name from v_schema_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "and field_name = '$field_name' "; $sql .= "and field_name = '$field_name' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
@@ -183,24 +182,24 @@ else {
//} //}
} //end if file or image } //end if file or image
if ($action == "add" && permission_exists('table_data_add')) { if ($action == "add" && permission_exists('schema_data_add')) {
//get a unique id for the data_row_uuid //get a unique id for the data_row_uuid
if ($i==1) { if ($i==1) {
$data_row_uuid = uuid(); $data_row_uuid = uuid();
} }
//insert the field data //insert the field data
$sql = "insert into v_table_data "; $sql = "insert into v_schema_data ";
$sql .= "("; $sql .= "(";
$sql .= "table_data_uuid, "; $sql .= "schema_data_uuid, ";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "data_row_uuid, "; $sql .= "data_row_uuid, ";
if(strlen($data_parent_row_uuid)>0) { if(strlen($data_parent_row_uuid)>0) {
$sql .= "data_parent_row_uuid, "; $sql .= "data_parent_row_uuid, ";
} }
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
if (strlen($table_parent_id) > 0) { if (strlen($schema_parent_id) > 0) {
$sql .= "table_parent_id, "; $sql .= "schema_parent_id, ";
} }
$sql .= "field_name, "; $sql .= "field_name, ";
$sql .= "data_field_value, "; $sql .= "data_field_value, ";
@@ -215,9 +214,9 @@ else {
if(strlen($data_parent_row_uuid)>0) { if(strlen($data_parent_row_uuid)>0) {
$sql .= "'$data_parent_row_uuid', "; $sql .= "'$data_parent_row_uuid', ";
} }
$sql .= "'$table_uuid', "; $sql .= "'$schema_uuid', ";
if (strlen($table_parent_id) > 0) { if (strlen($schema_parent_id) > 0) {
$sql .= "'$table_parent_id', "; $sql .= "'$schema_parent_id', ";
} }
$sql .= "'$field_name', "; $sql .= "'$field_name', ";
switch ($name_array[$field_name]['field_type']) { switch ($name_array[$field_name]['field_type']) {
@@ -248,10 +247,10 @@ else {
unset($sql); unset($sql);
} //end action add } //end action add
if ($action == "update" && permission_exists('tables_data_edit')) { if ($action == "update" && permission_exists('schema_data_edit')) {
$data_row_uuid = $_POST["data_row_uuid"]; $data_row_uuid = $_POST["data_row_uuid"];
$sql_update = "update v_table_data set "; $sql_update = "update v_schema_data set ";
switch ($name_array[$field_name]['field_type']) { switch ($name_array[$field_name]['field_type']) {
case "phone": case "phone":
$tmp_phone = preg_replace('{\D}', '', $data_field_value); $tmp_phone = preg_replace('{\D}', '', $data_field_value);
@@ -273,9 +272,9 @@ else {
$sql_update .= "data_field_value = '$data_field_value' "; $sql_update .= "data_field_value = '$data_field_value' ";
} }
$sql_update .= "where domain_uuid = '$domain_uuid' "; $sql_update .= "where domain_uuid = '$domain_uuid' ";
$sql_update .= "and table_uuid = '$table_uuid' "; $sql_update .= "and schema_uuid = '$schema_uuid' ";
if (strlen($table_parent_id) > 0) { if (strlen($schema_parent_id) > 0) {
$sql_update .= "and table_parent_id = '$table_parent_id' "; $sql_update .= "and schema_parent_id = '$schema_parent_id' ";
} }
$sql_update .= "and data_row_uuid = '$data_row_uuid' "; $sql_update .= "and data_row_uuid = '$data_row_uuid' ";
if(strlen($data_parent_row_uuid)>0) { if(strlen($data_parent_row_uuid)>0) {
@@ -289,15 +288,15 @@ else {
} }
else { else {
//no value to update so insert new value //no value to update so insert new value
$sql = "insert into v_table_data "; $sql = "insert into v_schema_data ";
$sql .= "("; $sql .= "(";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "data_row_uuid, "; $sql .= "data_row_uuid, ";
if(strlen($data_parent_row_uuid)>0) { if(strlen($data_parent_row_uuid)>0) {
$sql .= "data_parent_row_uuid, "; $sql .= "data_parent_row_uuid, ";
} }
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
$sql .= "table_parent_id, "; $sql .= "schema_parent_id, ";
$sql .= "field_name, "; $sql .= "field_name, ";
$sql .= "data_field_value, "; $sql .= "data_field_value, ";
$sql .= "data_add_user, "; $sql .= "data_add_user, ";
@@ -310,8 +309,8 @@ else {
if(strlen($data_parent_row_uuid)>0) { if(strlen($data_parent_row_uuid)>0) {
$sql .= "'$data_parent_row_uuid', "; $sql .= "'$data_parent_row_uuid', ";
} }
$sql .= "'$table_uuid', "; $sql .= "'$schema_uuid', ";
$sql .= "'$table_parent_id', "; $sql .= "'$schema_parent_id', ";
$sql .= "'$field_name', "; $sql .= "'$field_name', ";
switch ($name_array[$field_name]['field_type']) { switch ($name_array[$field_name]['field_type']) {
case "phone": case "phone":
@@ -350,10 +349,10 @@ else {
//set the meta redirect //set the meta redirect
if (strlen($data_parent_row_uuid) == 0) { if (strlen($data_parent_row_uuid) == 0) {
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_data_edit.php?id=$table_uuid&data_row_uuid=$data_row_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_data_edit.php?id=$schema_uuid&data_row_uuid=$data_row_uuid\">\n";
} }
else { else {
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_data_edit.php?table_uuid=$table_parent_id&data_row_uuid=$data_parent_row_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid\">\n";
} }
//show a message to the user before the redirect //show a message to the user before the redirect
@@ -372,19 +371,19 @@ else {
if ($action == "update") { if ($action == "update") {
//get the field values //get the field values
$sql = ""; $sql = "";
$sql .= "select * from v_table_data "; $sql .= "select * from v_schema_data ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
if (strlen($search_all) == 0) { if (strlen($search_all) == 0) {
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
if (strlen($data_parent_row_uuid) > 0) { if (strlen($data_parent_row_uuid) > 0) {
$sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
} }
} }
else { else {
$sql .= "and data_row_uuid in ("; $sql .= "and data_row_uuid in (";
$sql .= "select data_row_uuid from v_table_data \n"; $sql .= "select data_row_uuid from v_schema_data \n";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
if (strlen($data_parent_row_uuid) > 0) { if (strlen($data_parent_row_uuid) > 0) {
$sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
} }
@@ -476,11 +475,11 @@ else {
//begin creating the content //begin creating the content
echo "<br />"; echo "<br />";
//get the title and description of the table //get the title and description of the schema
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td width='50%' valign='top' nowrap='nowrap'>\n"; echo " <td width='50%' valign='top' nowrap='nowrap'>\n";
echo " <b>$table_label \n"; echo " <b>$schema_label \n";
if ($action == "add") { if ($action == "add") {
echo " Add\n"; echo " Add\n";
} }
@@ -489,12 +488,12 @@ else {
} }
echo " </b>\n"; echo " </b>\n";
echo " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n"; echo " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n";
if ($action == "update" && permission_exists('tables_data_edit')) { if ($action == "update" && permission_exists('schema_data_edit')) {
echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='table_data_edit.php?table_uuid=$table_uuid'\" value='Add'>\n"; echo " <input type='button' class='btn' name='' alt='add' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid'\" value='Add'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Do you really want to delete this?')){window.location='table_data_delete.php?id=".$table_uuid."&?data_row_uuid=".$data_row_uuid."&data_parent_row_uuid=$data_parent_row_uuid';}\" value='Delete'>\n"; //echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Do you really want to delete this?')){window.location='schema_delete.php?id=".$schema_uuid."&?data_row_uuid=".$data_row_uuid."&data_parent_row_uuid=$data_parent_row_uuid';}\" value='Delete'>\n";
} }
echo " <br />\n"; echo " <br />\n";
echo " $table_description\n"; echo " $schema_description\n";
echo " <br />\n"; echo " <br />\n";
echo " <br />\n"; echo " <br />\n";
echo " </td>\n"; echo " </td>\n";
@@ -502,32 +501,32 @@ else {
if (strlen($data_parent_row_uuid) == 0) { if (strlen($data_parent_row_uuid) == 0) {
echo "<td align='center' valign='top' nowrap='nowrap'>\n"; echo "<td align='center' valign='top' nowrap='nowrap'>\n";
if ($action == "update" && permission_exists('tables_data_edit')) { if ($action == "update" && permission_exists('schema_data_edit')) {
//echo " <input type='button' class='btn' name='' alt='first' onclick=\"window.location='table_data_edit.php?table_uuid=$table_uuid&data_row_uuid=".$first_data_row_uuid."'\" value='First'>\n"; //echo " <input type='button' class='btn' name='' alt='first' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid&data_row_uuid=".$first_data_row_uuid."'\" value='First'>\n";
if (strlen($previous_data_row_uuid) == 0) { if (strlen($previous_data_row_uuid) == 0) {
echo " <input type='button' class='btn' name='' alt='prev' disabled='disabled' value='Prev'>\n"; echo " <input type='button' class='btn' name='' alt='prev' disabled='disabled' value='Prev'>\n";
} }
else { else {
echo " <input type='button' class='btn' name='' alt='prev' onclick=\"window.location='table_data_edit.php?table_uuid=$table_uuid&data_row_uuid=".$previous_data_row_uuid."&search_all=$search_all&n=".($n-1)."'\" value='Prev ".$previous_record_id."'>\n"; echo " <input type='button' class='btn' name='' alt='prev' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid&data_row_uuid=".$previous_data_row_uuid."&search_all=$search_all&n=".($n-1)."'\" value='Prev ".$previous_record_id."'>\n";
} }
echo " <input type='button' class='btn' name='' alt='prev' value='".$record_number_array[$data_row_uuid]." of $total_records'>\n"; echo " <input type='button' class='btn' name='' alt='prev' value='".$record_number_array[$data_row_uuid]." of $total_records'>\n";
if (strlen($next_data_row_uuid) == 0) { if (strlen($next_data_row_uuid) == 0) {
echo " <input type='button' class='btn' name='' alt='next' disabled='disabled' value='Next'>\n"; echo " <input type='button' class='btn' name='' alt='next' disabled='disabled' value='Next'>\n";
} }
else { else {
echo " <input type='button' class='btn' name='' alt='next' onclick=\"window.location='table_data_edit.php?table_uuid=$table_uuid&data_row_uuid=".$next_data_row_uuid."&search_all=$search_all&n=".($n+1)."'\" value='Next ".$next_record_id."'>\n"; echo " <input type='button' class='btn' name='' alt='next' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid&data_row_uuid=".$next_data_row_uuid."&search_all=$search_all&n=".($n+1)."'\" value='Next ".$next_record_id."'>\n";
} }
//echo " <input type='button' class='btn' name='' alt='last' onclick=\"window.location='table_data_edit.php?table_uuid=$table_uuid&data_row_uuid=".$last_data_row_uuid."'\" value='Last'>\n"; //echo " <input type='button' class='btn' name='' alt='last' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_uuid&data_row_uuid=".$last_data_row_uuid."'\" value='Last'>\n";
} }
echo " &nbsp;&nbsp;&nbsp;"; echo " &nbsp;&nbsp;&nbsp;";
echo " &nbsp;&nbsp;&nbsp;"; echo " &nbsp;&nbsp;&nbsp;";
echo " &nbsp;&nbsp;&nbsp;"; echo " &nbsp;&nbsp;&nbsp;";
echo "</td>\n"; echo "</td>\n";
echo "<form method='GET' name='frm_search' action='table_data_edit.php'>\n"; echo "<form method='GET' name='frm_search' action='schema_data_edit.php'>\n";
echo "<td width='45%' align='right' valign='top' nowrap='nowrap'>\n"; echo "<td width='45%' align='right' valign='top' nowrap='nowrap'>\n";
echo " <input type='hidden' name='table_uuid' value='$table_uuid'>\n"; echo " <input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
//echo " <input type='hidden' name='id' value='$table_uuid'>\n"; //echo " <input type='hidden' name='id' value='$schema_uuid'>\n";
//echo " <input type='hidden' name='data_parent_row_uuid' value='$data_parent_row_uuid'>\n"; //echo " <input type='hidden' name='data_parent_row_uuid' value='$data_parent_row_uuid'>\n";
//echo " <input type='hidden' name='data_row_uuid' value='$first_data_row_uuid'>\n"; //echo " <input type='hidden' name='data_row_uuid' value='$first_data_row_uuid'>\n";
echo " <input class='formfld' type='text' name='search_all' value='$search_all'>\n"; echo " <input class='formfld' type='text' name='search_all' value='$search_all'>\n";
@@ -535,14 +534,14 @@ else {
echo "</td>\n"; echo "</td>\n";
echo "</form>\n"; echo "</form>\n";
echo "<td width='5%' align='right' valign='top' nowrap='nowrap'>\n"; echo "<td width='5%' align='right' valign='top' nowrap='nowrap'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='table_data_view.php?id=$table_uuid'\" value='Back'>\n"; echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='schema_data_view.php?id=$schema_uuid'\" value='Back'>\n";
echo "</td>\n"; echo "</td>\n";
} }
else { else {
echo " <td width='50%' align='right'>\n"; echo " <td width='50%' align='right'>\n";
//echo " <input type='button' class='btn' name='' alt='prev' onclick=\"window.location='table_data_edit.php?table_uuid=$table_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='Prev'>\n"; //echo " <input type='button' class='btn' name='' alt='prev' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='Prev'>\n";
//echo " <input type='button' class='btn' name='' alt='next' onclick=\"window.location='table_data_edit.php?table_uuid=$table_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='Next'>\n"; //echo " <input type='button' class='btn' name='' alt='next' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='Next'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='table_data_edit.php?table_uuid=$table_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='Back'>\n"; echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='schema_data_edit.php?schema_uuid=$schema_parent_id&data_row_uuid=$data_parent_row_uuid'\" value='Back'>\n";
echo " </td>\n"; echo " </td>\n";
} }
echo " </tr>\n"; echo " </tr>\n";
@@ -553,12 +552,12 @@ else {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='10'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='10'>\n";
//determine if a file should be uploaded //determine if a file should be uploaded
$sql = "SELECT * FROM v_table_fields "; $sql = "SELECT * FROM v_schema_fields ";
$sql .= "where domain_uuid = '$domain_uuid ' "; $sql .= "where domain_uuid = '$domain_uuid ' ";
$sql .= "and table_uuid = '$table_uuid ' "; $sql .= "and schema_uuid = '$schema_uuid ' ";
$sql .= "and field_type = 'uploadimage' "; $sql .= "and field_type = 'uploadimage' ";
$sql .= "or domain_uuid = '$domain_uuid ' "; $sql .= "or domain_uuid = '$domain_uuid ' ";
$sql .= "and table_uuid = '$table_uuid ' "; $sql .= "and schema_uuid = '$schema_uuid ' ";
$sql .= "and field_type = 'upload_file' "; $sql .= "and field_type = 'upload_file' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
@@ -570,11 +569,10 @@ else {
echo "<form method='post' name='frm' action=''>\n"; echo "<form method='post' name='frm' action=''>\n";
} }
//get the table fields and then display them //get the fields and then display them
$sql = ""; $sql = "select * from v_schema_fields ";
$sql .= "select * from v_table_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "order by field_column asc, field_order asc "; $sql .= "order by field_column asc, field_order asc ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
@@ -582,7 +580,7 @@ else {
$result_count = count($result); $result_count = count($result);
echo "<input type='hidden' name='rcount' value='$result_count'>\n"; echo "<input type='hidden' name='rcount' value='$result_count'>\n";
echo "<input type='hidden' name='table_uuid' value='$table_uuid'>\n"; echo "<input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
if ($result_count == 0) { //no results if ($result_count == 0) { //no results
echo "<tr><td class='vncell'>&nbsp;</td></tr>\n"; echo "<tr><td class='vncell'>&nbsp;</td></tr>\n";
@@ -590,13 +588,13 @@ else {
else { //received results else { //received results
$x=1; $x=1;
$field_column_previous = ''; $field_column_previous = '';
$column_table_cell_status = ''; $column_schema_cell_status = '';
foreach($result as $row) { foreach($result as $row) {
//handle more than one column //handle more than one column
$field_column = $row[field_column]; $field_column = $row[field_column];
//echo "<!--[column: $field_column]-->\n"; //echo "<!--[column: $field_column]-->\n";
if ($field_column != $field_column_previous) { if ($field_column != $field_column_previous) {
$column_table_cell_status = 'open'; $column_schema_cell_status = 'open';
//do the following except for the first time through the loop //do the following except for the first time through the loop
if ($x != 1) { if ($x != 1) {
//close the table //close the table
@@ -740,9 +738,9 @@ else {
echo "<input type='hidden' name=\"".$x."field_name\" value=\"".$row['field_name']."\">\n"; echo "<input type='hidden' name=\"".$x."field_name\" value=\"".$row['field_name']."\">\n";
$sqlselect = "SELECT data_types_name, data_types_value "; $sqlselect = "SELECT data_types_name, data_types_value ";
$sqlselect .= "FROM v_table_name_values "; $sqlselect .= "FROM v_schema_name_values ";
$sqlselect .= "where domain_uuid = '".$domain_uuid."' "; $sqlselect .= "where domain_uuid = '".$domain_uuid."' ";
$sqlselect .= "and table_field_uuid = '".$row[table_field_uuid]."' "; $sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' ";
$prep_statement_2 = $db->prepare($sqlselect); $prep_statement_2 = $db->prepare($sqlselect);
$prep_statement_2->execute(); $prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED); $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
@@ -766,9 +764,9 @@ else {
echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n"; echo "<input type='hidden' name='".$x."field_name' value='".$row['field_name']."'>\n";
$sqlselect = "SELECT data_types_name, data_types_value "; $sqlselect = "SELECT data_types_name, data_types_value ";
$sqlselect .= "FROM v_table_name_values "; $sqlselect .= "FROM v_schema_name_values ";
$sqlselect .= "where domain_uuid = '".$domain_uuid."' "; $sqlselect .= "where domain_uuid = '".$domain_uuid."' ";
$sqlselect .= "and table_field_uuid = '".$row[table_field_uuid]."' "; $sqlselect .= "and schema_field_uuid = '".$row["schema_field_uuid"]."' ";
$prep_statement_2 = $db->prepare($sqlselect); $prep_statement_2 = $db->prepare($sqlselect);
$prep_statement_2->execute(); $prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED); $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
@@ -928,17 +926,17 @@ else {
} //end foreach } //end foreach
unset($sql, $result, $row_count); unset($sql, $result, $row_count);
if ($column_table_cell_status == 'open') { if ($column_schema_cell_status == 'open') {
$column_table_cell_status = 'closed'; $column_schema_cell_status = 'closed';
} }
} //end if results } //end if results
echo " <tr>\n"; echo " <tr>\n";
echo " <td colspan='999' align='right'>\n"; echo " <td colspan='999' align='right'>\n";
if ($action == "add" && permission_exists('table_data_add')) { if ($action == "add" && permission_exists('schema_data_add')) {
echo " <input type='submit' class='btn' name='submit' value='save'>\n"; echo " <input type='submit' class='btn' name='submit' value='save'>\n";
} }
if ($action == "update" && permission_exists('tables_data_edit')) { if ($action == "update" && permission_exists('schema_data_edit')) {
echo " <input type='hidden' name='data_row_uuid' value='$data_row_uuid'>\n"; echo " <input type='hidden' name='data_row_uuid' value='$data_row_uuid'>\n";
echo " <input type='submit' tabindex='9999999' class='btn' name='submit' value='Save'>\n"; echo " <input type='submit' tabindex='9999999' class='btn' name='submit' value='Save'>\n";
} }
@@ -950,11 +948,11 @@ else {
echo " </tr>\n"; echo " </tr>\n";
echo "</form>\n"; echo "</form>\n";
if ($action == "update" && permission_exists('tables_data_edit')) { if ($action == "update" && permission_exists('schema_data_edit')) {
//get the child table_uuid and use it to show the list of data //get the child schema_uuid and use it to show the list of data
$sql = "select * from v_tables "; $sql = "select * from v_schemas ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_parent_id = '$table_uuid' "; $sql .= "and schema_parent_id = '$schema_uuid' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@@ -962,15 +960,15 @@ else {
echo "<tr class='border'>\n"; echo "<tr class='border'>\n";
echo " <td colspan='999' align=\"left\">\n"; echo " <td colspan='999' align=\"left\">\n";
echo " <br>"; echo " <br>";
$_GET["id"] = $row["table_uuid"]; $_GET["id"] = $row["schema_uuid"];
$table_label = $row["table_label"]; $schema_label = $row["schema_label"];
$_GET["data_parent_row_uuid"] = $data_row_uuid; $_GET["data_parent_row_uuid"] = $data_row_uuid;
//show button //show button
//echo "<input type='button' class='btn' name='' alt='".$table_label."' onclick=\"window.location='table_data_view.php?id=".$row["table_uuid"]."&data_parent_row_uuid=".$data_row_uuid."'\" value='".$table_label."'>\n"; //echo "<input type='button' class='btn' name='' alt='".$schema_label."' onclick=\"window.location='schema_data_view.php?id=".$row["schema_uuid"]."&data_parent_row_uuid=".$data_row_uuid."'\" value='".$schema_label."'>\n";
//show list //show list
require_once "table_data_view.php"; require_once "schema_data_view.php";
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
} }
+41 -42
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_data_view')) { if (permission_exists('schema_data_view')) {
//access granted //access granted
} }
else { else {
@@ -35,7 +35,7 @@ else {
} }
if (strlen($_GET["id"]) > 0) { if (strlen($_GET["id"]) > 0) {
$table_uuid = check_str($_GET["id"]); $schema_uuid = check_str($_GET["id"]);
if (strlen($_GET["data_parent_row_uuid"])>0) { if (strlen($_GET["data_parent_row_uuid"])>0) {
$data_parent_row_uuid = $_GET["data_parent_row_uuid"]; $data_parent_row_uuid = $_GET["data_parent_row_uuid"];
} }
@@ -54,22 +54,21 @@ if (strlen($_GET["id"]) > 0) {
//show the header //show the header
require_once "includes/header.php"; require_once "includes/header.php";
//get the information about the table by using the id //get the information about the schema by using the id
$sql = ""; $sql = "select * from v_schemas ";
$sql .= "select * from v_tables ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as &$row) { foreach ($result as &$row) {
$table_category = $row["table_category"]; $schema_category = $row["schema_category"];
$table_label = $row["table_label"]; $schema_label = $row["schema_label"];
$table_name = $row["table_name"]; $schema_name = $row["schema_name"];
$table_auth = $row["table_auth"]; $schema_auth = $row["schema_auth"];
$table_captcha = $row["table_captcha"]; $schema_captcha = $row["schema_captcha"];
$table_parent_uuid = $row["table_parent_uuid"]; $schema_parent_uuid = $row["schema_parent_uuid"];
$table_description = $row["table_description"]; $schema_description = $row["schema_description"];
break; //limit to 1 row break; //limit to 1 row
} }
unset ($prep_statement); unset ($prep_statement);
@@ -78,9 +77,9 @@ if (strlen($_GET["id"]) > 0) {
$db_field_name_array = array(); $db_field_name_array = array();
$db_value_array = array(); $db_value_array = array();
$db_names .= "<tr>\n"; $db_names .= "<tr>\n";
$sql = "select * from v_table_fields "; $sql = "select * from v_schema_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "order by field_order asc "; $sql .= "order by field_order asc ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
@@ -112,19 +111,19 @@ if (strlen($_GET["id"]) > 0) {
//get the data //get the data
$sql = ""; $sql = "";
$sql .= "select * from v_table_data "; $sql .= "select * from v_schema_data ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
if (strlen($search_all) == 0) { if (strlen($search_all) == 0) {
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
if (strlen($data_parent_row_uuid) > 0) { if (strlen($data_parent_row_uuid) > 0) {
$sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
} }
} }
else { else {
$sql .= "and data_row_uuid in ("; $sql .= "and data_row_uuid in (";
$sql .= "select data_row_uuid from v_table_data \n"; $sql .= "select data_row_uuid from v_schema_data \n";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
if (strlen($data_parent_row_uuid) == 0) { if (strlen($data_parent_row_uuid) == 0) {
$tmp_digits = preg_replace('{\D}', '', $search_all); $tmp_digits = preg_replace('{\D}', '', $search_all);
if (is_numeric($tmp_digits) && strlen($tmp_digits) > 5) { if (is_numeric($tmp_digits) && strlen($tmp_digits) > 5) {
@@ -155,9 +154,9 @@ if (strlen($_GET["id"]) > 0) {
//restructure the data by setting it the value_array //restructure the data by setting it the value_array
$value_array[$data_row_uuid][$field_name] = $row[data_field_value]; $value_array[$data_row_uuid][$field_name] = $row[data_field_value];
$value_array[$data_row_uuid]['table_uuid'] = $row[table_uuid]; $value_array[$data_row_uuid]['schema_uuid'] = $row["schema_uuid"];
$value_array[$data_row_uuid]['data_row_uuid'] = $row[data_row_uuid]; $value_array[$data_row_uuid]['data_row_uuid'] = $row[data_row_uuid];
$value_array[$data_row_uuid]['table_parent_uuid'] = $row[table_parent_uuid]; $value_array[$data_row_uuid]['schema_parent_uuid'] = $row[schema_parent_uuid];
$value_array[$data_row_uuid]['data_parent_row_uuid'] = $row[data_parent_row_uuid]; $value_array[$data_row_uuid]['data_parent_row_uuid'] = $row[data_parent_row_uuid];
} }
$num_rows = count($value_array); $num_rows = count($value_array);
@@ -175,9 +174,9 @@ if (strlen($_GET["id"]) > 0) {
$sql = "CREATE TABLE memory_table "; $sql = "CREATE TABLE memory_table ";
$sql .= "("; $sql .= "(";
$sql .= "'id' INTEGER PRIMARY KEY, "; $sql .= "'id' INTEGER PRIMARY KEY, ";
$sql .= "'table_uuid' TEXT, "; $sql .= "'schema_uuid' TEXT, ";
$sql .= "'data_row_uuid' TEXT, "; $sql .= "'data_row_uuid' TEXT, ";
$sql .= "'table_parent_uuid' TEXT, "; $sql .= "'schema_parent_uuid' TEXT, ";
$sql .= "'data_parent_row_uuid' TEXT, "; $sql .= "'data_parent_row_uuid' TEXT, ";
foreach($result_names as $row) { foreach($result_names as $row) {
if ($row["field_type"] != "label") { if ($row["field_type"] != "label") {
@@ -207,9 +206,9 @@ if (strlen($_GET["id"]) > 0) {
//insert the data into the memory table //insert the data into the memory table
$sql = "insert into memory_table "; $sql = "insert into memory_table ";
$sql .= "("; $sql .= "(";
$sql .= "'table_uuid', "; $sql .= "'schema_uuid', ";
$sql .= "'data_row_uuid', "; $sql .= "'data_row_uuid', ";
$sql .= "'table_parent_uuid', "; $sql .= "'schema_parent_uuid', ";
$sql .= "'data_parent_row_uuid', "; $sql .= "'data_parent_row_uuid', ";
//foreach($array as $key => $value) { //foreach($array as $key => $value) {
// $sql .= "'$key', "; // $sql .= "'$key', ";
@@ -221,9 +220,9 @@ if (strlen($_GET["id"]) > 0) {
$sql .= ")"; $sql .= ")";
$sql .= "values "; $sql .= "values ";
$sql .= "("; $sql .= "(";
$sql .= "'".$array['table_uuid']."', "; $sql .= "'".$array['schema_uuid']."', ";
$sql .= "'".$array['data_row_uuid']."', "; $sql .= "'".$array['data_row_uuid']."', ";
$sql .= "'".$array['table_parent_uuid']."', "; $sql .= "'".$array['schema_parent_uuid']."', ";
$sql .= "'".$array['data_parent_row_uuid']."', "; $sql .= "'".$array['data_parent_row_uuid']."', ";
//foreach($array as $key => $value) { //foreach($array as $key => $value) {
// $sql .= "'$value', "; // $sql .= "'$value', ";
@@ -247,15 +246,15 @@ if (strlen($_GET["id"]) > 0) {
echo "<br />\n"; echo "<br />\n";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n"; echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td align='left' valign='top'><strong>$table_label</strong><br>\n"; echo " <td align='left' valign='top'><strong>$schema_label</strong><br>\n";
echo " $table_description\n"; echo " $schema_description\n";
echo " </td>\n"; echo " </td>\n";
echo " <td align='right' valign='top'>\n"; echo " <td align='right' valign='top'>\n";
if (strlen($data_parent_row_uuid) == 0) { if (strlen($data_parent_row_uuid) == 0) {
$search_all = str_replace("''", "'", $search_all); $search_all = str_replace("''", "'", $search_all);
echo "<form method='GET' name='frm_search' action=''>\n"; echo "<form method='GET' name='frm_search' action=''>\n";
echo " <input class='formfld' type='text' name='search_all' value=\"$search_all\">\n"; echo " <input class='formfld' type='text' name='search_all' value=\"$search_all\">\n";
echo " <input type='hidden' name='id' value='$table_uuid'>\n"; echo " <input type='hidden' name='id' value='$schema_uuid'>\n";
echo " <input type='hidden' name='data_parent_row_uuid' value='$data_parent_row_uuid'>\n"; echo " <input type='hidden' name='data_parent_row_uuid' value='$data_parent_row_uuid'>\n";
echo " <input class='btn' type='submit' name='submit' value='Search All'>\n"; echo " <input class='btn' type='submit' name='submit' value='Search All'>\n";
echo "</form>\n"; echo "</form>\n";
@@ -271,11 +270,11 @@ if (strlen($_GET["id"]) > 0) {
$param = ""; $param = "";
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
if (strlen($table_parent_uuid) > 0) { if (strlen($schema_parent_uuid) > 0) {
$param = "&id=$table_parent_uuid&data_row_uuid=$data_row_uuid"; $param = "&id=$schema_parent_uuid&data_row_uuid=$data_row_uuid";
} }
else { else {
$param = "&id=$table_uuid&data_row_uuid=$data_row_uuid"; $param = "&id=$schema_uuid&data_row_uuid=$data_row_uuid";
} }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@@ -301,8 +300,8 @@ if (strlen($_GET["id"]) > 0) {
} }
} }
echo "<td align='right' width='42'>\n"; echo "<td align='right' width='42'>\n";
if (permission_exists('table_data_add')) { if (permission_exists('schema_data_add')) {
echo " <a href='table_data_edit.php?table_uuid=".$table_uuid."&data_parent_row_uuid=$data_parent_row_uuid' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_data_edit.php?schema_uuid=".$schema_uuid."&data_parent_row_uuid=$data_parent_row_uuid' alt='add'>$v_link_label_add</a>\n";
} }
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -354,16 +353,16 @@ if (strlen($_GET["id"]) > 0) {
} }
echo "<td valign='top' align='right' nowrap='nowrap'>\n"; echo "<td valign='top' align='right' nowrap='nowrap'>\n";
if (permission_exists('tables_data_edit')) { if (permission_exists('schema_data_edit')) {
if (strlen($data_parent_row_uuid) == 0) { if (strlen($data_parent_row_uuid) == 0) {
echo " <a href='table_data_edit.php?table_uuid=".$row[table_uuid]."&data_parent_row_uuid=$data_parent_row_uuid&data_row_uuid=".$row['data_row_uuid']."&search_all=$search_all' alt='edit'>$v_link_label_edit</a>\n"; echo " <a href='schema_data_edit.php?schema_uuid=".$row["schema_uuid"]."&data_parent_row_uuid=$data_parent_row_uuid&data_row_uuid=".$row['data_row_uuid']."&search_all=$search_all' alt='edit'>$v_link_label_edit</a>\n";
} }
else { else {
echo " <a href='table_data_edit.php?table_uuid=".$row[table_uuid]."&data_parent_row_uuid=$data_parent_row_uuid&data_row_uuid=".$row['data_row_uuid']."' alt='edit'>$v_link_label_edit</a>\n"; echo " <a href='schema_data_edit.php?schema_uuid=".$row["schema_uuid"]."&data_parent_row_uuid=$data_parent_row_uuid&data_row_uuid=".$row['data_row_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
} }
} }
if (permission_exists('table_data_delete')) { if (permission_exists('schema_delete')) {
echo" <a href='table_data_delete.php?data_row_uuid=".$row['data_row_uuid']."&data_parent_row_uuid=$data_parent_row_uuid&table_uuid=".$table_uuid."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n"; echo" <a href='schema_delete.php?data_row_uuid=".$row['data_row_uuid']."&data_parent_row_uuid=$data_parent_row_uuid&schema_uuid=".$schema_uuid."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
} }
echo "</td>\n"; echo "</td>\n";
@@ -379,8 +378,8 @@ if (strlen($_GET["id"]) > 0) {
echo " <td width='33.3%' nowrap>&nbsp;</td>\n"; echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n"; echo " <td width='33.3%' align='right'>\n";
if (permission_exists('table_data_add')) { if (permission_exists('schema_data_add')) {
echo " <a href='table_data_edit.php?table_uuid=".$table_uuid."&data_parent_row_uuid=$data_parent_row_uuid' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_data_edit.php?schema_uuid=".$schema_uuid."&data_parent_row_uuid=$data_parent_row_uuid' alt='add'>$v_link_label_add</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
+5 -6
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_delete')) { if (permission_exists('schema_delete')) {
//access granted //access granted
} }
else { else {
@@ -42,18 +42,17 @@ else {
//show the header //show the header
require_once "includes/header.php"; require_once "includes/header.php";
if (strlen($id)>0) { if (strlen($id) > 0) {
$sql = ""; $sql = "delete from v_schemas ";
$sql .= "delete from v_tables ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$id' "; $sql .= "and schema_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
unset($sql); unset($sql);
} }
//redirect the user //redirect the user
echo "<meta http-equiv=\"refresh\" content=\"2;url=tables.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schemas.php\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Delete Complete\n"; echo "Delete Complete\n";
echo "</div>\n"; echo "</div>\n";
+90 -95
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('tables_add') || permission_exists('table_edit')) { if (permission_exists('schema_add') || permission_exists('schema_edit')) {
//access granted //access granted
} }
else { else {
@@ -37,7 +37,7 @@ else {
//action add or update //action add or update
if (isset($_REQUEST["id"])) { if (isset($_REQUEST["id"])) {
$action = "update"; $action = "update";
$table_uuid = check_str($_REQUEST["id"]); $schema_uuid = check_str($_REQUEST["id"]);
} }
else { else {
$action = "add"; $action = "add";
@@ -45,33 +45,33 @@ else {
//get the http post variables //get the http post variables
if (count($_POST)>0) { if (count($_POST)>0) {
$table_category = check_str($_POST["table_category"]); $schema_category = check_str($_POST["schema_category"]);
$table_category_other = check_str($_POST["table_category_other"]); $schema_category_other = check_str($_POST["schema_category_other"]);
if (strlen($table_category_other) > 0) { $table_category = $table_category_other; } if (strlen($schema_category_other) > 0) { $schema_category = $schema_category_other; }
$table_label = check_str($_POST["table_label"]); $schema_label = check_str($_POST["schema_label"]);
$table_name = check_str($_POST["table_name"]); $schema_name = check_str($_POST["schema_name"]);
$table_auth = check_str($_POST["table_auth"]); $schema_auth = check_str($_POST["schema_auth"]);
$table_captcha = check_str($_POST["table_captcha"]); $schema_captcha = check_str($_POST["schema_captcha"]);
$table_parent_uuid = check_str($_POST["table_parent_uuid"]); $schema_parent_uuid = check_str($_POST["schema_parent_uuid"]);
$table_description = check_str($_POST["table_description"]); $schema_description = check_str($_POST["schema_description"]);
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; $msg = '';
if ($action == "update") { if ($action == "update") {
$table_uuid = check_str($_POST["table_uuid"]); $schema_uuid = check_str($_POST["schema_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; } if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
//if (strlen($table_category) == 0) { $msg .= "Please provide: Table Category<br>\n"; } //if (strlen($schema_category) == 0) { $msg .= "Please provide: Schema Category<br>\n"; }
//if (strlen($table_label) == 0) { $msg .= "Please provide: Label<br>\n"; } //if (strlen($schema_label) == 0) { $msg .= "Please provide: Label<br>\n"; }
if (strlen($table_name) == 0) { $msg .= "Please provide: Table Name<br>\n"; } if (strlen($schema_name) == 0) { $msg .= "Please provide: Schema Name<br>\n"; }
//if (strlen($table_auth) == 0) { $msg .= "Please provide: Authentication<br>\n"; } //if (strlen($schema_auth) == 0) { $msg .= "Please provide: Authentication<br>\n"; }
//if (strlen($table_captcha) == 0) { $msg .= "Please provide: Captcha<br>\n"; } //if (strlen($schema_captcha) == 0) { $msg .= "Please provide: Captcha<br>\n"; }
//if (strlen($table_parent_uuid) == 0) { $msg .= "Please provide: Parent Table<br>\n"; } //if (strlen($schema_parent_uuid) == 0) { $msg .= "Please provide: Parent Schema<br>\n"; }
//if (strlen($table_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (strlen($schema_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php"; require_once "includes/header.php";
require_once "includes/persistformvar.php"; require_once "includes/persistformvar.php";
@@ -88,41 +88,41 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
if ($action == "add") { if ($action == "add") {
$table_uuid = uuid(); $schema_uuid = uuid();
$sql = "insert into v_tables "; $sql = "insert into v_schemas ";
$sql .= "("; $sql .= "(";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
$sql .= "table_category, "; $sql .= "schema_category, ";
$sql .= "table_label, "; $sql .= "schema_label, ";
$sql .= "table_name, "; $sql .= "schema_name, ";
$sql .= "table_auth, "; $sql .= "schema_auth, ";
$sql .= "table_captcha, "; $sql .= "schema_captcha, ";
$sql .= "table_parent_uuid, "; $sql .= "schema_parent_uuid, ";
$sql .= "table_description "; $sql .= "schema_description ";
$sql .= ")"; $sql .= ")";
$sql .= "values "; $sql .= "values ";
$sql .= "("; $sql .= "(";
$sql .= "'$domain_uuid', "; $sql .= "'$domain_uuid', ";
$sql .= "'$table_uuid', "; $sql .= "'$schema_uuid', ";
$sql .= "'$table_category', "; $sql .= "'$schema_category', ";
$sql .= "'$table_label', "; $sql .= "'$schema_label', ";
$sql .= "'$table_name', "; $sql .= "'$schema_name', ";
$sql .= "'$table_auth', "; $sql .= "'$schema_auth', ";
$sql .= "'$table_captcha', "; $sql .= "'$schema_captcha', ";
if (strlen($table_parent_uuid) == 0) { if (strlen($schema_parent_uuid) == 0) {
$sql .= "null, "; $sql .= "null, ";
} }
else { else {
$sql .= "'$table_parent_uuid', "; $sql .= "'$schema_parent_uuid', ";
} }
$sql .= "'$table_description' "; $sql .= "'$schema_description' ";
$sql .= ")"; $sql .= ")";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=tables.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schemas.php\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Add Complete\n"; echo "Add Complete\n";
echo "</div>\n"; echo "</div>\n";
@@ -131,26 +131,26 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
} //if ($action == "add") } //if ($action == "add")
if ($action == "update") { if ($action == "update") {
$sql = "update v_tables set "; $sql = "update v_schemas set ";
$sql .= "domain_uuid = '$domain_uuid', "; $sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "table_category = '$table_category', "; $sql .= "schema_category = '$schema_category', ";
$sql .= "table_label = '$table_label', "; $sql .= "schema_label = '$schema_label', ";
$sql .= "table_name = '$table_name', "; $sql .= "schema_name = '$schema_name', ";
$sql .= "table_auth = '$table_auth', "; $sql .= "schema_auth = '$schema_auth', ";
$sql .= "table_captcha = '$table_captcha', "; $sql .= "schema_captcha = '$schema_captcha', ";
if (strlen($table_parent_uuid) == 0) { if (strlen($schema_parent_uuid) == 0) {
$sql .= "table_parent_uuid = null, "; $sql .= "schema_parent_uuid = null, ";
} }
else { else {
$sql .= "table_parent_uuid = '$table_parent_uuid', "; $sql .= "schema_parent_uuid = '$schema_parent_uuid', ";
} }
$sql .= "table_description = '$table_description' "; $sql .= "schema_description = '$schema_description' ";
$sql .= "where table_uuid = '$table_uuid'"; $sql .= "where schema_uuid = '$schema_uuid'";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=tables.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schemas.php\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Update Complete\n"; echo "Update Complete\n";
echo "</div>\n"; echo "</div>\n";
@@ -162,21 +162,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$table_uuid = $_GET["id"]; $schema_uuid = $_GET["id"];
$sql = "select * from v_tables "; $sql = "select * from v_schemas ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
$table_category = $row["table_category"]; $schema_category = $row["schema_category"];
$table_label = $row["table_label"]; $schema_label = $row["schema_label"];
$table_name = $row["table_name"]; $schema_name = $row["schema_name"];
$table_auth = $row["table_auth"]; $schema_auth = $row["schema_auth"];
$table_captcha = $row["table_captcha"]; $schema_captcha = $row["schema_captcha"];
$table_parent_uuid = $row["table_parent_uuid"]; $schema_parent_uuid = $row["schema_parent_uuid"];
$table_description = $row["table_description"]; $schema_description = $row["schema_description"];
break; //limit to 1 row break; //limit to 1 row
} }
unset ($prep_statement); unset ($prep_statement);
@@ -196,19 +196,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
if ($action == "add") { echo "<td align='left' width='30%' nowrap='nowrap'><b>Schema</b></td>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>Virtual Table Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Virtual Table Edit</b></td>\n";
}
echo "<td width='70%' align='right'>\n"; echo "<td width='70%' align='right'>\n";
if (strlen($table_uuid) > 0) { if (strlen($schema_uuid) > 0) {
echo " <input type='button' class='btn' name='' alt='view' onclick=\"window.location='table_data_view.php?id=".$row[table_uuid]."'\" value='View'>&nbsp;&nbsp;\n"; echo " <input type='button' class='btn' name='' alt='view' onclick=\"window.location='schema_data_view.php?id=".$row["schema_uuid"]."'\" value='View'>&nbsp;&nbsp;\n";
echo " <input type='button' class='btn' name='' alt='import' onclick=\"window.location='tables_import.php?id=".$row[table_uuid]."'\" value='Import'>&nbsp;&nbsp;\n"; echo " <input type='button' class='btn' name='' alt='import' onclick=\"window.location='schema_import.php?id=".$row["schema_uuid"]."'\" value='Import'>&nbsp;&nbsp;\n";
} }
include "export/index.php"; include "export/index.php";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='tables.php'\" value='Back'>\n"; echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='schemas.php'\" value='Back'>\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -220,11 +215,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Table Category:\n"; echo " Category:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$table_name = 'v_tables';$field_name = 'table_category';$sql_where_optional = "";$field_current_value = $table_category; $schema_name = 'v_schemas';$field_name = 'schema_category';$sql_where_optional = "";$field_current_value = $schema_category;
echo html_select_other($db, $table_name, $field_name, $sql_where_optional, $field_current_value); echo html_select_other($db, $schema_name, $field_name, $sql_where_optional, $field_current_value);
echo "Select the category.\n"; echo "Select the category.\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -234,7 +229,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " Label:\n"; echo " Label:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='table_label' maxlength='255' value=\"$table_label\">\n"; echo " <input class='formfld' type='text' name='schema_label' maxlength='255' value=\"$schema_label\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the label.\n"; echo "Enter the label.\n";
echo "</td>\n"; echo "</td>\n";
@@ -242,12 +237,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Table Name:\n"; echo " Name:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='table_name' maxlength='255' value=\"$table_name\">\n"; echo " <input class='formfld' type='text' name='schema_name' maxlength='255' value=\"$schema_name\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the table name.\n"; echo "Enter the schema name.\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -256,15 +251,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " Authentication:\n"; echo " Authentication:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='table_auth'>\n"; echo " <select class='formfld' name='schema_auth'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if ($table_auth == "yes") { if ($schema_auth == "yes") {
echo " <option value='yes' SELECTED >yes</option>\n"; echo " <option value='yes' SELECTED >yes</option>\n";
} }
else { else {
echo " <option value='yes'>yes</option>\n"; echo " <option value='yes'>yes</option>\n";
} }
if ($table_auth == "no") { if ($schema_auth == "no") {
echo " <option value='no' SELECTED >no</option>\n"; echo " <option value='no' SELECTED >no</option>\n";
} }
else { else {
@@ -281,15 +276,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//echo " Captcha:\n"; //echo " Captcha:\n";
//echo "</td>\n"; //echo "</td>\n";
//echo "<td class='vtable' align='left'>\n"; //echo "<td class='vtable' align='left'>\n";
//echo " <select class='formfld' name='table_captcha'>\n"; //echo " <select class='formfld' name='schema_captcha'>\n";
//echo " <option value=''></option>\n"; //echo " <option value=''></option>\n";
//if ($table_captcha == "yes") { //if ($schema_captcha == "yes") {
// echo " <option value='yes' SELECTED >yes</option>\n"; // echo " <option value='yes' SELECTED >yes</option>\n";
//} //}
//else { //else {
// echo " <option value='yes'>yes</option>\n"; // echo " <option value='yes'>yes</option>\n";
//} //}
//if ($table_captcha == "no") { //if ($schema_captcha == "no") {
// echo " <option value='no' SELECTED >no</option>\n"; // echo " <option value='no' SELECTED >no</option>\n";
//} //}
//else { //else {
@@ -303,29 +298,29 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Parent Table:\n"; echo " Parent Schema:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select name='table_parent_uuid' class='formfld'>\n"; echo " <select name='schema_parent_uuid' class='formfld'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
$sql = "select * from v_tables "; $sql = "select * from v_schemas ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
if ($row["table_uuid"] == $table_parent_uuid) { if ($row["schema_uuid"] == $schema_parent_uuid) {
echo " <option value='".$row["table_uuid"]."' selected>".$row["table_name"]."</option>\n"; echo " <option value='".$row["schema_uuid"]."' selected>".$row["schema_name"]."</option>\n";
} }
else { else {
echo " <option value='".$row["table_uuid"]."'>".$row["table_name"]."</option>\n"; echo " <option value='".$row["schema_uuid"]."'>".$row["schema_name"]."</option>\n";
} }
} }
echo " </select>\n"; echo " </select>\n";
echo "<br />\n"; echo "<br />\n";
echo "Select a parent table.\n"; echo "Select a parent schema.\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -334,7 +329,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " Description:\n"; echo " Description:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <textarea class='formfld' name='table_description' rows='4'>$table_description</textarea>\n"; echo " <textarea class='formfld' name='schema_description' rows='4'>$schema_description</textarea>\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter a description.\n"; echo "Enter a description.\n";
echo "</td>\n"; echo "</td>\n";
@@ -342,9 +337,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n"; echo " <tr>\n";
echo " <td colspan='2' align='right'>\n"; echo " <td colspan='2' align='right'>\n";
if ($action == "update") { if ($action == "update") {
echo " <input type='hidden' name='table_uuid' value='$table_uuid'>\n"; echo " <input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
} }
echo " <input type='hidden' name='table_captcha' value='$table_captcha'>\n"; echo " <input type='hidden' name='schema_captcha' value='$schema_captcha'>\n";
echo " <input type='submit' name='submit' class='btn' value='Save'>\n"; echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n"; echo " </td>\n";
echo " </tr>"; echo " </tr>";
@@ -352,7 +347,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</form>"; echo "</form>";
if ($action == "update") { if ($action == "update") {
require "table_fields.php"; require "schema_fields.php";
} }
echo " </td>"; echo " </td>";
+8 -9
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_delete')) { if (permission_exists('schema_delete')) {
//access granted //access granted
} }
else { else {
@@ -35,17 +35,16 @@ else {
} }
//get the http values //get the http values
if (count($_GET)>0) { if (count($_GET) > 0) {
$id = check_str($_GET["id"]); $id = check_str($_GET["id"]);
$table_uuid = check_str($_GET["table_uuid"]); $schema_uuid = check_str($_GET["schema_uuid"]);
} }
//delete the data //delete the data
if (strlen($id)>0) { if (strlen($id) > 0) {
$sql = ""; $sql = "delete from v_schema_fields ";
$sql .= "delete from v_table_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_field_uuid = '$id' "; $sql .= "and schema_field_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
unset($sql); unset($sql);
@@ -53,11 +52,11 @@ else {
//redirect the user //redirect the user
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_edit.php?id=$table_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_edit.php?id=$schema_uuid\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Delete Complete\n"; echo "Delete Complete\n";
echo "</div>\n"; echo "</div>\n";
require_once "includes/footer.php"; require_once "includes/footer.php";
return; return;
?> ?>
+28 -33
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('tables_add') || permission_exists('table_edit')) { if (permission_exists('schema_add') || permission_exists('schema_edit')) {
//access granted //access granted
} }
else { else {
@@ -37,15 +37,15 @@ else {
//set the action as an add or update //set the action as an add or update
if (isset($_REQUEST["id"])) { if (isset($_REQUEST["id"])) {
$action = "update"; $action = "update";
$table_field_uuid = check_str($_REQUEST["id"]); $schema_field_uuid = check_str($_REQUEST["id"]);
} }
else { else {
$action = "add"; $action = "add";
} }
//get the http variables //get the http variables
if (strlen($_GET["table_uuid"]) > 0) { if (strlen($_GET["schema_uuid"]) > 0) {
$table_uuid = check_str($_GET["table_uuid"]); $schema_uuid = check_str($_GET["schema_uuid"]);
} }
//get the http post variables //get the http post variables
@@ -67,7 +67,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; $msg = '';
if ($action == "update") { if ($action == "update") {
$table_field_uuid = check_str($_POST["table_field_uuid"]); $schema_field_uuid = check_str($_POST["schema_field_uuid"]);
} }
//check for all required data //check for all required data
@@ -98,13 +98,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('tables_add')) { if ($action == "add" && permission_exists('schema_add')) {
$table_field_uuid = uuid(); $schema_field_uuid = uuid();
$sql = "insert into v_table_fields "; $sql = "insert into v_schema_fields ";
$sql .= "("; $sql .= "(";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
$sql .= "table_field_uuid, "; $sql .= "schema_field_uuid, ";
$sql .= "field_label, "; $sql .= "field_label, ";
$sql .= "field_name, "; $sql .= "field_name, ";
$sql .= "field_type, "; $sql .= "field_type, ";
@@ -120,8 +120,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "values "; $sql .= "values ";
$sql .= "("; $sql .= "(";
$sql .= "'$domain_uuid', "; $sql .= "'$domain_uuid', ";
$sql .= "'$table_uuid', "; $sql .= "'$schema_uuid', ";
$sql .= "'$table_field_uuid', "; $sql .= "'$schema_field_uuid', ";
$sql .= "'$field_label', "; $sql .= "'$field_label', ";
$sql .= "'$field_name', "; $sql .= "'$field_name', ";
$sql .= "'$field_type', "; $sql .= "'$field_type', ";
@@ -138,7 +138,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql); unset($sql);
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_edit.php?id=$table_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_edit.php?id=$schema_uuid\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Add Complete\n"; echo "Add Complete\n";
echo "</div>\n"; echo "</div>\n";
@@ -146,8 +146,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return; return;
} //if ($action == "add") } //if ($action == "add")
if ($action == "update" && permission_exists('table_edit')) { if ($action == "update" && permission_exists('schema_edit')) {
$sql = "update v_table_fields set "; $sql = "update v_schema_fields set ";
$sql .= "field_label = '$field_label', "; $sql .= "field_label = '$field_label', ";
$sql .= "field_name = '$field_name', "; $sql .= "field_name = '$field_name', ";
$sql .= "field_type = '$field_type', "; $sql .= "field_type = '$field_type', ";
@@ -160,13 +160,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "field_order_tab = '$field_order_tab', "; $sql .= "field_order_tab = '$field_order_tab', ";
$sql .= "field_description = '$field_description' "; $sql .= "field_description = '$field_description' ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid'"; $sql .= "and schema_uuid = '$schema_uuid'";
$sql .= "and table_field_uuid = '$table_field_uuid' "; $sql .= "and schema_field_uuid = '$schema_field_uuid' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_edit.php?id=$table_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_edit.php?id=$schema_uuid\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Update Complete\n"; echo "Update Complete\n";
echo "</div>\n"; echo "</div>\n";
@@ -178,13 +178,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$table_uuid = $_GET["table_uuid"]; $schema_uuid = $_GET["schema_uuid"];
$table_field_uuid = $_GET["id"]; $schema_field_uuid = $_GET["id"];
$sql = "select * from v_table_fields "; $sql = "select * from v_schema_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "and table_field_uuid = '$table_field_uuid' "; $sql .= "and schema_field_uuid = '$schema_field_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@@ -219,13 +219,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
if ($action == "add") { echo "<td align='left' width='30%' nowrap=\"nowrap\"><b>Field</b></td>\n";
echo "<td align='left' width='30%' nowrap=\"nowrap\"><b>Virtual Table Field Add</b></td>\n"; echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='schema_edit.php?id=$schema_uuid'\" value='Back'></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap=\"nowrap\"><b>Virtual Table Field Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='table_edit.php?id=$table_uuid'\" value='Back'></td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td align=\"left\" colspan=\"2\">\n"; echo "<td align=\"left\" colspan=\"2\">\n";
@@ -555,9 +550,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n"; echo "</tr>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td colspan='2' align='right'>\n"; echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='table_uuid' value='$table_uuid'>\n"; echo " <input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
if ($action == "update") { if ($action == "update") {
echo " <input type='hidden' name='table_field_uuid' value='$table_field_uuid'>\n"; echo " <input type='hidden' name='schema_field_uuid' value='$schema_field_uuid'>\n";
} }
echo " <input type='submit' name='submit' class='btn' value='Save'>\n"; echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n"; echo " </td>\n";
@@ -567,7 +562,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") { if ($action == "update") {
if ($field_type == "select") { if ($field_type == "select") {
require "table_data_types_name_value.php"; require "schema_data_types_name_value.php";
} }
} }
+13 -13
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_view')) { if (permission_exists('schema_view')) {
//access granted //access granted
} }
else { else {
@@ -48,7 +48,7 @@ $order = $_GET["order"];
echo "<table width='100%' border='0'>\n"; echo "<table width='100%' border='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Table Fields</b></td>\n"; echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Fields</b></td>\n";
echo "<td width='50%' align=\"right\">&nbsp;</td>\n"; echo "<td width='50%' align=\"right\">&nbsp;</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
@@ -63,9 +63,9 @@ $order = $_GET["order"];
$order = 'asc'; $order = 'asc';
} }
$sql = "select * from v_table_fields "; $sql = "select * from v_schema_fields ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
@@ -91,8 +91,8 @@ $order = $_GET["order"];
echo th_order_by('field_order_tab', 'Tab Order', $order_by, $order); echo th_order_by('field_order_tab', 'Tab Order', $order_by, $order);
echo th_order_by('field_description', 'Description', $order_by, $order); echo th_order_by('field_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n"; echo "<td align='right' width='42'>\n";
if (permission_exists('table_view')) { if (permission_exists('schema_view')) {
echo " <a href='table_field_edit.php?table_uuid=".$table_uuid."' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_field_edit.php?schema_uuid=".$schema_uuid."' alt='add'>$v_link_label_add</a>\n";
} }
echo "</td>\n"; echo "</td>\n";
echo "<tr>\n"; echo "<tr>\n";
@@ -111,11 +111,11 @@ $order = $_GET["order"];
echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_order_tab']."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_order_tab']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_description']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n"; echo " <td valign='top' align='right'>\n";
if (permission_exists('table_edit')) { if (permission_exists('schema_edit')) {
echo " <a href='table_field_edit.php?table_uuid=".$row['table_uuid']."&id=".$row['table_field_uuid']."' alt='edit'>$v_link_label_edit</a>\n"; echo " <a href='schema_field_edit.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
} }
if (permission_exists('table_delete')) { if (permission_exists('schema_delete')) {
echo " <a href='table_field_delete.php?table_uuid=".$row['table_uuid']."&id=".$row['table_field_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n"; echo " <a href='schema_field_delete.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -131,8 +131,8 @@ $order = $_GET["order"];
echo " <td width='33.3%' nowrap>&nbsp;</td>\n"; echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>&nbsp;</td>\n"; echo " <td width='33.3%' align='center' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='right'>\n"; echo " <td width='33.3%' align='right'>\n";
if (permission_exists('tables_add')) { if (permission_exists('schema_add')) {
echo " <a href='table_field_edit.php?table_uuid=".$table_uuid."' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_field_edit.php?schema_uuid=".$schema_uuid."' alt='add'>$v_link_label_add</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
@@ -154,4 +154,4 @@ $order = $_GET["order"];
//include the footer //include the footer
require_once "includes/footer.php"; require_once "includes/footer.php";
?> ?>
+29 -30
View File
@@ -26,7 +26,7 @@
include "root.php"; include "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_edit')) { if (permission_exists('schema_edit')) {
//access granted //access granted
} }
else { else {
@@ -35,16 +35,16 @@ else {
} }
if (count($_POST)>0) { if (count($_POST)>0) {
$table_uuid = trim($_REQUEST["id"]); $schema_uuid = trim($_REQUEST["id"]);
$data = trim($_POST["data"]); $data = trim($_POST["data"]);
$data_delimiter = trim($_POST["data_delimiter"]); $data_delimiter = trim($_POST["data_delimiter"]);
$data_enclosure = trim($_POST["data_enclosure"]); $data_enclosure = trim($_POST["data_enclosure"]);
} }
//define the php class //define the php class
class v_table_fields { class v_schema_fields {
var $domain_uuid; var $domain_uuid;
var $table_uuid; var $schema_uuid;
var $field_label; var $field_label;
var $field_name; var $field_name;
var $field_type; var $field_type;
@@ -58,9 +58,9 @@ if (count($_POST)>0) {
function db_field_exists() { function db_field_exists() {
global $db; global $db;
$sql = "select count(*) as num_rows from v_table_fields "; $sql = "select count(*) as num_rows from v_schema_fields ";
$sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and table_uuid ='$this->table_uuid' "; $sql .= "and schema_uuid ='$this->schema_uuid' ";
$sql .= "and field_name = '$this->field_name' "; $sql .= "and field_name = '$this->field_name' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
if ($prep_statement) { if ($prep_statement) {
@@ -77,11 +77,11 @@ if (count($_POST)>0) {
function db_insert() { function db_insert() {
global $db; global $db;
$sql = "insert into v_table_fields "; $sql = "insert into v_schema_fields ";
$sql .= "("; $sql .= "(";
$sql .= "table_field_uuid, "; $sql .= "schema_field_uuid, ";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
$sql .= "field_label, "; $sql .= "field_label, ";
$sql .= "field_name, "; $sql .= "field_name, ";
$sql .= "field_type, "; $sql .= "field_type, ";
@@ -98,7 +98,7 @@ if (count($_POST)>0) {
$sql .= "("; $sql .= "(";
$sql .= "'".uuid()."', "; $sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', "; $sql .= "'$this->domain_uuid', ";
$sql .= "'$this->table_uuid', "; $sql .= "'$this->schema_uuid', ";
$sql .= "'$this->field_label', "; $sql .= "'$this->field_label', ";
$sql .= "'$this->field_name', "; $sql .= "'$this->field_name', ";
$sql .= "'$this->field_type', "; $sql .= "'$this->field_type', ";
@@ -118,18 +118,18 @@ if (count($_POST)>0) {
} }
} }
class v_table_data { class v_schema_data {
var $domain_uuid; var $domain_uuid;
var $table_uuid; var $schema_uuid;
var $data_row_uuid; var $data_row_uuid;
var $field_name; var $field_name;
var $data_field_value; var $data_field_value;
var $last_insert_id; var $last_insert_id;
var $table_data_uuid; var $schema_data_uuid;
function db_unique_id() { function db_unique_id() {
global $db; global $db;
$sql = "insert into v_table_data_row_id "; $sql = "insert into v_schema_data_row_id ";
$sql .= "("; $sql .= "(";
$sql .= "domain_uuid "; $sql .= "domain_uuid ";
$sql .= ")"; $sql .= ")";
@@ -144,12 +144,12 @@ if (count($_POST)>0) {
function db_insert() { function db_insert() {
global $db; global $db;
$sql = "insert into v_table_data "; $sql = "insert into v_schema_data ";
$sql .= "("; $sql .= "(";
$sql .= "table_data_uuid, "; $sql .= "schema_data_uuid, ";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "data_row_uuid, "; $sql .= "data_row_uuid, ";
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
$sql .= "field_name, "; $sql .= "field_name, ";
$sql .= "data_field_value, "; $sql .= "data_field_value, ";
$sql .= "data_add_user, "; $sql .= "data_add_user, ";
@@ -160,7 +160,7 @@ if (count($_POST)>0) {
$sql .= "'".uuid()."', "; $sql .= "'".uuid()."', ";
$sql .= "'$this->domain_uuid', "; $sql .= "'$this->domain_uuid', ";
$sql .= "'$this->data_row_uuid', "; $sql .= "'$this->data_row_uuid', ";
$sql .= "'$this->table_uuid', "; $sql .= "'$this->schema_uuid', ";
$sql .= "'$this->field_name', "; $sql .= "'$this->field_name', ";
$sql .= "'$this->data_field_value', "; $sql .= "'$this->data_field_value', ";
$sql .= "'".$_SESSION["username"]."', "; $sql .= "'".$_SESSION["username"]."', ";
@@ -173,14 +173,14 @@ if (count($_POST)>0) {
function db_update() { function db_update() {
global $db; global $db;
$sql = "update v_table_data set "; $sql = "update v_schema_data set ";
$sql .= "data_row_uuid = '$this->data_row_uuid', "; $sql .= "data_row_uuid = '$this->data_row_uuid', ";
$sql .= "field_name = '$this->field_name', "; $sql .= "field_name = '$this->field_name', ";
$sql .= "data_field_value = '$this->data_field_value', "; $sql .= "data_field_value = '$this->data_field_value', ";
$sql .= "data_add_user = '".$_SESSION["username"]."', "; $sql .= "data_add_user = '".$_SESSION["username"]."', ";
$sql .= "data_add_date = now() "; $sql .= "data_add_date = now() ";
$sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and table_data_uuid = '$this->table_data_uuid' "; $sql .= "and schema_data_uuid = '$this->schema_data_uuid' ";
$db->exec($sql); $db->exec($sql);
unset($sql); unset($sql);
} }
@@ -209,7 +209,7 @@ if (count($_POST)>0) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>Import Results</b></td>\n"; echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>Import Results</b></td>\n";
echo "<td width='70%' align='right' valign='top'>\n"; echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='tables_import.php?id=$table_uuid'\" value='Back'>\n"; echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='schema_import.php?id=$schema_uuid'\" value='Back'>\n";
echo " <br /><br />\n"; echo " <br /><br />\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -230,9 +230,9 @@ if (count($_POST)>0) {
$field_name = str_replace("-", "_", $field_name); $field_name = str_replace("-", "_", $field_name);
$field_name = strtolower($field_name); $field_name = strtolower($field_name);
$fields = new v_table_fields; $fields = new v_schema_fields;
$fields->domain_uuid = $domain_uuid; $fields->domain_uuid = $domain_uuid;
$fields->table_uuid = $table_uuid; $fields->schema_uuid = $schema_uuid;
$fields->field_label = $field_label; $fields->field_label = $field_label;
$fields->field_name = $field_name; $fields->field_name = $field_name;
$fields->field_type = 'text'; $fields->field_type = 'text';
@@ -262,9 +262,9 @@ if (count($_POST)>0) {
$field_value = trim($val); $field_value = trim($val);
$data = new v_table_data; $data = new v_schema_data;
$data->domain_uuid = $domain_uuid; $data->domain_uuid = $domain_uuid;
$data->table_uuid = $table_uuid; $data->schema_uuid = $schema_uuid;
if ($x == 0) { if ($x == 0) {
$data_row_uuid = uuid(); $data_row_uuid = uuid();
//echo "id: ".$data_row_uuid."<br />\n"; //echo "id: ".$data_row_uuid."<br />\n";
@@ -291,8 +291,7 @@ if (count($_POST)>0) {
//show the footer //show the footer
require_once "includes/footer.php"; require_once "includes/footer.php";
exit;
exit;
} }
@@ -305,7 +304,7 @@ if (count($_POST)>0) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>Import</b></td>\n"; echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>Import</b></td>\n";
echo "<td width='70%' align='right' valign='top'>\n"; echo "<td width='70%' align='right' valign='top'>\n";
//echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='tables_import.php?id=$table_uuid'\" value='Back'>\n"; //echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='schema_import.php?id=$schema_uuid'\" value='Back'>\n";
echo " <br /><br />\n"; echo " <br /><br />\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -314,7 +313,7 @@ if (count($_POST)>0) {
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr class='border'>\n"; echo "<tr class='border'>\n";
echo " <td align=\"left\">\n"; echo " <td align=\"left\">\n";
echo " <br>"; echo " <br>";
echo "<form method='post' name='frm' action=''>\n"; echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@@ -374,4 +373,4 @@ if (count($_POST)>0) {
echo "</form>"; echo "</form>";
require_once "includes/footer.php"; require_once "includes/footer.php";
?> ?>
+8 -9
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_delete')) { if (permission_exists('schema_delete')) {
//access granted //access granted
} }
else { else {
@@ -35,18 +35,17 @@ else {
} }
//get the http values //get the http values
if (count($_GET)>0) { if (count($_GET) > 0) {
$id = check_str($_GET["id"]); $id = check_str($_GET["id"]);
$table_uuid = check_str($_GET["table_uuid"]); $schema_uuid = check_str($_GET["schema_uuid"]);
$table_field_uuid = check_str($_GET["table_field_uuid"]); $schema_field_uuid = check_str($_GET["schema_field_uuid"]);
} }
//delete the data //delete the data
if (strlen($id)>0) { if (strlen($id) > 0) {
$sql = ""; $sql .= "delete from v_schema_name_values ";
$sql .= "delete from v_table_name_values ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_name_value_uuid = '$id' "; $sql .= "and schema_name_value_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
unset($sql); unset($sql);
@@ -54,7 +53,7 @@ else {
//redirect the user //redirect the user
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_fields_edit.php?table_uuid=$table_uuid&id=$table_field_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_field_edit.php?schema_uuid=$schema_uuid&id=$schema_field_uuid\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Delete Complete\n"; echo "Delete Complete\n";
echo "</div>\n"; echo "</div>\n";
+32 -34
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_edit')) { if (permission_exists('schema_edit')) {
//access granted //access granted
} }
else { else {
@@ -37,14 +37,14 @@ else {
//action add or update //action add or update
if (isset($_REQUEST["id"])) { if (isset($_REQUEST["id"])) {
$action = "update"; $action = "update";
$table_name_value_uuid = check_str($_REQUEST["id"]); $schema_name_value_uuid = check_str($_REQUEST["id"]);
} }
else { else {
$action = "add"; $action = "add";
} }
if (strlen($_GET["table_field_uuid"]) > 0) { if (strlen($_GET["schema_field_uuid"]) > 0) {
$table_field_uuid = check_str($_GET["table_field_uuid"]); $schema_field_uuid = check_str($_GET["schema_field_uuid"]);
} }
//POST to PHP variables //POST to PHP variables
@@ -52,21 +52,21 @@ if (strlen($_GET["table_field_uuid"]) > 0) {
//$domain_uuid = check_str($_POST["domain_uuid"]); //$domain_uuid = check_str($_POST["domain_uuid"]);
$data_types_name = check_str($_POST["data_types_name"]); $data_types_name = check_str($_POST["data_types_name"]);
$data_types_value = check_str($_POST["data_types_value"]); $data_types_value = check_str($_POST["data_types_value"]);
$table_uuid = $_REQUEST["table_uuid"]; $schema_uuid = $_REQUEST["schema_uuid"];
$table_field_uuid = $_REQUEST["table_field_uuid"]; $schema_field_uuid = $_REQUEST["schema_field_uuid"];
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; $msg = '';
if ($action == "update") { if ($action == "update") {
$table_name_value_uuid = check_str($_POST["table_name_value_uuid"]); $schema_name_value_uuid = check_str($_POST["schema_name_value_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; } if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
if (strlen($table_uuid) == 0) { $msg .= "Please provide: table_uuid<br>\n"; } if (strlen($schema_uuid) == 0) { $msg .= "Please provide: schema_uuid<br>\n"; }
if (strlen($table_field_uuid) == 0) { $msg .= "Please provide: table_field_uuid<br>\n"; } if (strlen($schema_field_uuid) == 0) { $msg .= "Please provide: schema_field_uuid<br>\n"; }
if (strlen($data_types_name) == 0) { $msg .= "Please provide: Name<br>\n"; } if (strlen($data_types_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
if (strlen($data_types_value) == 0) { $msg .= "Please provide: Value<br>\n"; } if (strlen($data_types_value) == 0) { $msg .= "Please provide: Value<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
@@ -85,12 +85,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
if ($action == "add") { if ($action == "add") {
$sql = "insert into v_table_name_values "; $sql = "insert into v_schema_name_values ";
$sql .= "("; $sql .= "(";
$sql .= "table_name_value_uuid, "; $sql .= "schema_name_value_uuid, ";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "table_uuid, "; $sql .= "schema_uuid, ";
$sql .= "table_field_uuid, "; $sql .= "schema_field_uuid, ";
$sql .= "data_types_name, "; $sql .= "data_types_name, ";
$sql .= "data_types_value "; $sql .= "data_types_value ";
$sql .= ") "; $sql .= ") ";
@@ -98,8 +98,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "("; $sql .= "(";
$sql .= "'".uuid()."', "; $sql .= "'".uuid()."', ";
$sql .= "'".$_SESSION['domain_uuid']."', "; $sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'$table_uuid', "; $sql .= "'$schema_uuid', ";
$sql .= "'$table_field_uuid', "; $sql .= "'$schema_field_uuid', ";
$sql .= "'$data_types_name', "; $sql .= "'$data_types_name', ";
$sql .= "'$data_types_value' "; $sql .= "'$data_types_value' ";
$sql .= ")"; $sql .= ")";
@@ -107,7 +107,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql); unset($sql);
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_fields_edit.php?table_uuid=$table_uuid&id=$table_field_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_field_edit.php?schema_uuid=$schema_uuid&id=$schema_field_uuid\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Add Complete\n"; echo "Add Complete\n";
echo "</div>\n"; echo "</div>\n";
@@ -116,18 +116,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
} //if ($action == "add") } //if ($action == "add")
if ($action == "update") { if ($action == "update") {
$sql = "update v_table_name_values set "; $sql = "update v_schema_name_values set ";
$sql .= "data_types_name = '$data_types_name', "; $sql .= "data_types_name = '$data_types_name', ";
$sql .= "data_types_value = '$data_types_value' "; $sql .= "data_types_value = '$data_types_value' ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and table_uuid = '$table_uuid' "; $sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "and table_field_uuid = '$table_field_uuid' "; $sql .= "and schema_field_uuid = '$schema_field_uuid' ";
$sql .= "and table_name_value_uuid = '$table_name_value_uuid' "; $sql .= "and schema_name_value_uuid = '$schema_name_value_uuid' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=table_fields_edit.php?table_uuid=$table_uuid&id=$table_field_uuid\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=schema_field_edit.php?schema_uuid=$schema_uuid&id=$schema_field_uuid\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Update Complete\n"; echo "Update Complete\n";
echo "</div>\n"; echo "</div>\n";
@@ -139,16 +139,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$table_uuid = $_GET["table_uuid"]; $schema_uuid = $_GET["schema_uuid"];
$table_field_uuid = $_GET["table_field_uuid"]; $schema_field_uuid = $_GET["schema_field_uuid"];
$table_name_value_uuid = $_GET["id"]; $schema_name_value_uuid = $_GET["id"];
$sql = ""; $sql = "select * from v_schema_name_values ";
$sql .= "select * from v_table_name_values ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
//$sql .= "and table_uuid = '$table_uuid' "; //$sql .= "and schema_uuid = '$schema_uuid' ";
$sql .= "and table_field_uuid = '$table_field_uuid' "; $sql .= "and schema_field_uuid = '$schema_field_uuid' ";
$sql .= "and table_name_value_uuid = '$table_name_value_uuid' "; $sql .= "and schema_name_value_uuid = '$schema_name_value_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@@ -212,10 +210,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n"; echo "</tr>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td colspan='2' align='right'>\n"; echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='table_uuid' value='$table_uuid'>\n"; echo " <input type='hidden' name='schema_uuid' value='$schema_uuid'>\n";
echo " <input type='hidden' name='table_field_uuid' value='$table_field_uuid'>\n"; echo " <input type='hidden' name='schema_field_uuid' value='$schema_field_uuid'>\n";
if ($action == "update") { if ($action == "update") {
echo " <input type='hidden' name='table_name_value_uuid' value='$table_name_value_uuid'>\n"; echo " <input type='hidden' name='schema_name_value_uuid' value='$schema_name_value_uuid'>\n";
} }
echo " <input type='submit' name='submit' class='btn' value='Save'>\n"; echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n"; echo " </td>\n";
@@ -229,4 +227,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</div>"; echo "</div>";
require_once "includes/footer.php"; require_once "includes/footer.php";
?> ?>
+15 -17
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_edit')) { if (permission_exists('schema_edit')) {
//access granted //access granted
} }
else { else {
@@ -49,7 +49,7 @@ require_once "includes/paging.php";
echo "<table width='100%' border='0'>\n"; echo "<table width='100%' border='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Virtual Table Data Types Name Value List</b></td>\n"; echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Schema Name Values</b></td>\n";
echo "<td width='50%' align=\"right\">&nbsp;</td>\n"; echo "<td width='50%' align=\"right\">&nbsp;</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
@@ -59,10 +59,9 @@ require_once "includes/paging.php";
echo "</tr>\n"; echo "</tr>\n";
echo "</tr></table>\n"; echo "</tr></table>\n";
//$sql = ""; //$sql = "select * from v_schema_name_values ";
//$sql .= " select * from v_table_name_values "; //$sql .= "where domain_uuid = '$domain_uuid' ";
//$sql .= " where domain_uuid = '$domain_uuid' "; //$sql .= "and schema_field_uuid = '$schema_field_uuid' ";
//$sql .= " and table_field_uuid = '$table_field_uuid' ";
//if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } //if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
//$prep_statement = $db->prepare(check_sql($sql)); //$prep_statement = $db->prepare(check_sql($sql));
//$prep_statement->execute(); //$prep_statement->execute();
@@ -76,10 +75,9 @@ require_once "includes/paging.php";
//list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); //list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
//$offset = $rows_per_page * $page; //$offset = $rows_per_page * $page;
$sql = ""; $sql = "select * from v_schema_name_values ";
$sql .= " select * from v_table_name_values "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= " where domain_uuid = '$domain_uuid' "; $sql .= "and schema_field_uuid = '$schema_field_uuid' ";
$sql .= " and table_field_uuid = '$table_field_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
//$sql .= " limit $rows_per_page offset $offset "; //$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
@@ -98,7 +96,7 @@ require_once "includes/paging.php";
echo th_order_by('data_types_name', 'Name', $order_by, $order); echo th_order_by('data_types_name', 'Name', $order_by, $order);
echo th_order_by('data_types_value', 'Value', $order_by, $order); echo th_order_by('data_types_value', 'Value', $order_by, $order);
echo "<td align='right' width='42'>\n"; echo "<td align='right' width='42'>\n";
echo " <a href='table_data_types_name_value_edit.php?table_uuid=".$row[table_uuid]."&table_field_uuid=".$row[table_field_uuid]."' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_name_value_edit.php?schema_uuid=".$row["schema_uuid"]."&schema_field_uuid=".$row["schema_field_uuid"]."' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n"; echo "</td>\n";
echo "<tr>\n"; echo "<tr>\n";
@@ -108,10 +106,10 @@ require_once "includes/paging.php";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[data_types_name]."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row[data_types_name]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[data_types_value]."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row[data_types_value]."</td>\n";
echo " <td valign='top' align='right'>\n"; echo " <td valign='top' align='right'>\n";
echo " <a href='table_data_types_name_value_edit.php?table_uuid=".$row[table_uuid]."&table_field_uuid=".$row[table_field_uuid]."&id=".$row[table_name_value_uuid]."' alt='edit'>$v_link_label_edit</a>\n"; echo " <a href='schema_name_value_edit.php?schema_uuid=".$row["schema_uuid"]."&schema_field_uuid=".$row["schema_field_uuid"]."&id=".$row["schema_name_value_uuid"]."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='table_data_types_name_value_delete.php?table_uuid=".$row[table_uuid]."&table_field_uuid=".$row[table_field_uuid]."&id=".$row[table_name_value_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n"; echo " <a href='schema_name_value_delete.php?schema_uuid=".$row["schema_uuid"]."&schema_field_uuid=".$row["schema_field_uuid"]."&id=".$row["schema_name_value_uuid"]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
//echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='table_data_types_name_value_edit.php?id=".$row[table_name_value_uuid]."'\" value='e'>\n"; //echo " <input type='button' class='btn' name='' alt='edit' onclick=\"window.location='schema_name_value_edit.php?id=".$row["schema_name_value_uuid"]."'\" value='e'>\n";
//echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='table_data_types_name_value_delete.php?id=".$row[table_name_value_uuid]."' }\" value='x'>\n"; //echo " <input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='schema_name_value_delete.php?id=".$row["schema_name_value_uuid"]."' }\" value='x'>\n";
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; } if ($c==0) { $c=1; } else { $c=0; }
@@ -127,7 +125,7 @@ require_once "includes/paging.php";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n"; echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
//echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; //echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n"; echo " <td width='33.3%' align='right'>\n";
echo " <a href='table_data_types_name_value_edit.php?table_uuid=".$row[table_uuid]."&table_field_uuid=".$row[table_field_uuid]."' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_name_value_edit.php?schema_uuid=".$row["schema_uuid"]."&schema_field_uuid=".$row["schema_field_uuid"]."' alt='add'>$v_link_label_add</a>\n";
echo " </td>\n"; echo " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
echo " </table>\n"; echo " </table>\n";
@@ -148,4 +146,4 @@ require_once "includes/paging.php";
//show the footer //show the footer
require_once "includes/footer.php"; require_once "includes/footer.php";
?> ?>
+20 -20
View File
@@ -26,7 +26,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('table_view')) { if (permission_exists('schema_view')) {
//access granted //access granted
} }
else { else {
@@ -49,7 +49,7 @@ require_once "includes/paging.php";
echo "<table width='100%' border='0'>\n"; echo "<table width='100%' border='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>Virtual Tables</b></td>\n"; echo "<td width='50%' align='left' nowrap='nowrap'><b>Schemas</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n"; echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
@@ -60,7 +60,7 @@ require_once "includes/paging.php";
echo "</tr>\n"; echo "</tr>\n";
echo "</tr></table>\n"; echo "</tr></table>\n";
$sql = " select * from v_tables "; $sql = " select * from v_schemas ";
$sql .= " where domain_uuid = '$domain_uuid' "; $sql .= " where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
@@ -75,7 +75,7 @@ require_once "includes/paging.php";
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
$sql = " select * from v_tables "; $sql = " select * from v_schemas ";
$sql .= " where domain_uuid = '$domain_uuid' "; $sql .= " where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= " limit $rows_per_page offset $offset "; $sql .= " limit $rows_per_page offset $offset ";
@@ -92,14 +92,14 @@ require_once "includes/paging.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo th_order_by('table_label', 'Label', $order_by, $order); echo th_order_by('schema_label', 'Label', $order_by, $order);
echo th_order_by('table_name', 'Table Name', $order_by, $order); echo th_order_by('schema_name', 'Schema Name', $order_by, $order);
echo th_order_by('table_auth', 'Authentication', $order_by, $order); echo th_order_by('schema_auth', 'Authentication', $order_by, $order);
echo th_order_by('table_description', 'Description', $order_by, $order); echo th_order_by('schema_description', 'Description', $order_by, $order);
//echo "<th align='center'>View</th>\n"; //echo "<th align='center'>View</th>\n";
echo "<td align='right' width='42'>\n"; echo "<td align='right' width='42'>\n";
if (permission_exists('tables_add')) { if (permission_exists('schema_add')) {
echo " <a href='table_edit.php' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_edit.php' alt='add'>$v_link_label_add</a>\n";
} }
echo "</td>\n"; echo "</td>\n";
echo "<tr>\n"; echo "<tr>\n";
@@ -110,16 +110,16 @@ require_once "includes/paging.php";
else { //received results else { //received results
foreach($result as $row) { foreach($result as $row) {
echo "<tr >\n"; echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['table_label']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['schema_label']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['table_name']."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['schema_name']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['table_auth']."</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['schema_auth']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['table_description']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['schema_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n"; echo " <td valign='top' align='right'>\n";
if (permission_exists('table_edit')) { if (permission_exists('schema_edit')) {
echo " <a href='table_edit.php?id=".$row['table_uuid']."' alt='edit'>$v_link_label_edit</a>\n"; echo " <a href='schema_edit.php?id=".$row['schema_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
} }
if (permission_exists('table_delete')) { if (permission_exists('schema_delete')) {
echo " <a href='table_delete.php?id=".$row['table_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n"; echo " <a href='schema_delete.php?id=".$row['schema_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
@@ -135,8 +135,8 @@ require_once "includes/paging.php";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n"; echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n"; echo " <td width='33.3%' align='right'>\n";
if (permission_exists('tables_add')) { if (permission_exists('schema_add')) {
echo " <a href='table_edit.php' alt='add'>$v_link_label_add</a>\n"; echo " <a href='schema_edit.php' alt='add'>$v_link_label_add</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo " </tr>\n"; echo " </tr>\n";