From bdb31f17bd345a5de80fb27c0cd8bea7b5cf0a6b Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 11 Apr 2013 16:56:30 +0000 Subject: [PATCH] Change the tables to schemas. --- app/schemas/app_config.php | 20 ++- app/schemas/schema_data_delete.php | 26 ++-- app/schemas/schema_data_edit.php | 176 +++++++++++---------- app/schemas/schema_data_view.php | 83 +++++----- app/schemas/schema_delete.php | 11 +- app/schemas/schema_edit.php | 185 +++++++++++------------ app/schemas/schema_field_delete.php | 17 +-- app/schemas/schema_field_edit.php | 61 ++++---- app/schemas/schema_fields.php | 26 ++-- app/schemas/schema_import.php | 59 ++++---- app/schemas/schema_name_value_delete.php | 17 +-- app/schemas/schema_name_value_edit.php | 66 ++++---- app/schemas/schema_name_values.php | 32 ++-- app/schemas/schemas.php | 40 ++--- 14 files changed, 401 insertions(+), 418 deletions(-) diff --git a/app/schemas/app_config.php b/app/schemas/app_config.php index 1143f93e58..81c3d1a1cf 100644 --- a/app/schemas/app_config.php +++ b/app/schemas/app_config.php @@ -72,8 +72,9 @@ //schema details $y = 0; //table array index $z = 0; //field array index - $apps[$x]['db'][$y]['table']['text'] = 'v_schema_data'; - $apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_data'; + $apps[$x]['db'][$y]['table'] = 'v_schema_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']['deprecated'] = 'virtual_table_data_id'; @@ -175,8 +176,9 @@ $y = 1; //table array index $z = 0; //field array index - $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]['table'] = 'v_schema_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]['type']['pgsql'] = 'serial'; @@ -251,8 +253,9 @@ $y = 2; //table array index $z = 0; //field array index - $apps[$x]['db'][$y]['table']['text'] = 'v_schema_fields'; - $apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_table_fields'; + $apps[$x]['db'][$y]['table'] = 'v_schema_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']['deprecated'] = 'virtual_table_field_id'; @@ -356,8 +359,9 @@ $y = 3; //table array index $z = 0; //field array index - $apps[$x]['db'][$y]['table']['text'] = 'v_schemas'; - $apps[$x]['db'][$y]['table']['deprecated'] = 'v_virtual_tables'; + $apps[$x]['db'][$y]['table'] = 'v_schemas'; + //$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]['type']['pgsql'] = 'serial'; diff --git a/app/schemas/schema_data_delete.php b/app/schemas/schema_data_delete.php index 5ec93e8b8e..aceccba562 100644 --- a/app/schemas/schema_data_delete.php +++ b/app/schemas/schema_data_delete.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_data_delete')) { +if (permission_exists('schema_delete')) { //access granted } else { @@ -37,45 +37,45 @@ else { if (count($_GET)>0) { //declare variable(s) - $table_parent_id = ''; + $schema_parent_id = ''; //get the http get and set them as php variables $data_row_uuid = check_str($_GET["data_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 require_once "includes/header.php"; - //get the table_parent_id from the child table - if (strlen($table_parent_id) == 0) { - $sql = "select * from v_tables "; + //get the schema_parent_id from the child table + if (strlen($schema_parent_id) == 0) { + $sql = "select * from v_schemas "; $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->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $table_parent_id = $row["table_parent_id"]; + $schema_parent_id = $row["schema_parent_id"]; } } //delete the child data - $sql = "delete from v_table_data "; + $sql = "delete from v_schema_data "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and data_parent_row_uuid = '$data_row_uuid' "; $db->exec(check_sql($sql)); unset($sql); //delete the data - $sql = "delete from v_table_data "; + $sql = "delete from v_schema_data "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and data_row_uuid = '$data_row_uuid' "; $db->exec(check_sql($sql)); unset($sql); //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_user = '".$_SESSION["username"]."' "; //$sql .= "where domain_uuid = '$domain_uuid' "; @@ -86,10 +86,10 @@ if (count($_GET)>0) { //set the meta redirect if (strlen($data_parent_row_uuid) == 0) { - echo "\n"; + echo "\n"; } else { - echo "\n"; + echo "\n"; } //show a message to the user before the redirect diff --git a/app/schemas/schema_data_edit.php b/app/schemas/schema_data_edit.php index ca8885cc75..8b9cd37fa9 100644 --- a/app/schemas/schema_data_edit.php +++ b/app/schemas/schema_data_edit.php @@ -26,7 +26,7 @@ include "root.php"; require_once "includes/require.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 } else { @@ -36,7 +36,7 @@ else { //set http get variables to php variables $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 $data_row_uuid = check_str($_GET["data_row_uuid"]); $action = "update"; @@ -50,45 +50,44 @@ else { } } 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) { $data_parent_row_uuid = check_str($_GET["data_parent_row_uuid"]); } -//get table information - $sql = ""; - $sql .= "select * from v_tables "; +//get schema information + $sql = "select * from v_schemas "; $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->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $table_category = $row["table_category"]; - $table_label = $row["table_label"]; - $table_name = $row["table_name"]; - $table_auth = $row["table_auth"]; - $table_captcha = $row["table_captcha"]; - $table_parent_id = $row["table_parent_id"]; - $table_description = $row["table_description"]; + $schema_category = $row["schema_category"]; + $schema_label = $row["schema_label"]; + $schema_name = $row["schema_name"]; + $schema_auth = $row["schema_auth"]; + $schema_captcha = $row["schema_captcha"]; + $schema_parent_id = $row["schema_parent_id"]; + $schema_description = $row["schema_description"]; break; //limit to 1 row } unset ($prep_statement); //process the data submitted to by the html form if (count($_POST)>0) { //add - $table_uuid = check_str($_POST["table_uuid"]); - $table_name = check_str($_POST["table_name"]); + $schema_uuid = check_str($_POST["schema_uuid"]); + $schema_name = check_str($_POST["schema_name"]); $rcount = check_str($_POST["rcount"]); //get the field information $db_field_name_array = array(); $db_value_array = array(); $db_names .= "\n"; - $sql = "select * from v_table_fields "; + $sql = "select * from v_schema_fields "; $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; $sql .= "order by field_order asc "; $prep_statement = $db->prepare($sql); $prep_statement->execute(); @@ -126,9 +125,9 @@ else { $unique_temp_id = md5('7k3j2m'.date('r')); //used to find the first item $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 .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; $sql .= "and field_name = '$field_name' "; $prep_statement = $db->prepare($sql); $prep_statement->execute(); @@ -183,24 +182,24 @@ else { //} } //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 if ($i==1) { $data_row_uuid = uuid(); } //insert the field data - $sql = "insert into v_table_data "; + $sql = "insert into v_schema_data "; $sql .= "("; - $sql .= "table_data_uuid, "; + $sql .= "schema_data_uuid, "; $sql .= "domain_uuid, "; $sql .= "data_row_uuid, "; if(strlen($data_parent_row_uuid)>0) { $sql .= "data_parent_row_uuid, "; } - $sql .= "table_uuid, "; - if (strlen($table_parent_id) > 0) { - $sql .= "table_parent_id, "; + $sql .= "schema_uuid, "; + if (strlen($schema_parent_id) > 0) { + $sql .= "schema_parent_id, "; } $sql .= "field_name, "; $sql .= "data_field_value, "; @@ -215,9 +214,9 @@ else { if(strlen($data_parent_row_uuid)>0) { $sql .= "'$data_parent_row_uuid', "; } - $sql .= "'$table_uuid', "; - if (strlen($table_parent_id) > 0) { - $sql .= "'$table_parent_id', "; + $sql .= "'$schema_uuid', "; + if (strlen($schema_parent_id) > 0) { + $sql .= "'$schema_parent_id', "; } $sql .= "'$field_name', "; switch ($name_array[$field_name]['field_type']) { @@ -248,10 +247,10 @@ else { unset($sql); } //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"]; - $sql_update = "update v_table_data set "; + $sql_update = "update v_schema_data set "; switch ($name_array[$field_name]['field_type']) { case "phone": $tmp_phone = preg_replace('{\D}', '', $data_field_value); @@ -273,9 +272,9 @@ else { $sql_update .= "data_field_value = '$data_field_value' "; } $sql_update .= "where domain_uuid = '$domain_uuid' "; - $sql_update .= "and table_uuid = '$table_uuid' "; - if (strlen($table_parent_id) > 0) { - $sql_update .= "and table_parent_id = '$table_parent_id' "; + $sql_update .= "and schema_uuid = '$schema_uuid' "; + if (strlen($schema_parent_id) > 0) { + $sql_update .= "and schema_parent_id = '$schema_parent_id' "; } $sql_update .= "and data_row_uuid = '$data_row_uuid' "; if(strlen($data_parent_row_uuid)>0) { @@ -289,15 +288,15 @@ else { } else { //no value to update so insert new value - $sql = "insert into v_table_data "; + $sql = "insert into v_schema_data "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "data_row_uuid, "; if(strlen($data_parent_row_uuid)>0) { $sql .= "data_parent_row_uuid, "; } - $sql .= "table_uuid, "; - $sql .= "table_parent_id, "; + $sql .= "schema_uuid, "; + $sql .= "schema_parent_id, "; $sql .= "field_name, "; $sql .= "data_field_value, "; $sql .= "data_add_user, "; @@ -310,8 +309,8 @@ else { if(strlen($data_parent_row_uuid)>0) { $sql .= "'$data_parent_row_uuid', "; } - $sql .= "'$table_uuid', "; - $sql .= "'$table_parent_id', "; + $sql .= "'$schema_uuid', "; + $sql .= "'$schema_parent_id', "; $sql .= "'$field_name', "; switch ($name_array[$field_name]['field_type']) { case "phone": @@ -350,10 +349,10 @@ else { //set the meta redirect if (strlen($data_parent_row_uuid) == 0) { - echo "\n"; + echo "\n"; } else { - echo "\n"; + echo "\n"; } //show a message to the user before the redirect @@ -372,19 +371,19 @@ else { if ($action == "update") { //get the field values $sql = ""; - $sql .= "select * from v_table_data "; + $sql .= "select * from v_schema_data "; $sql .= "where domain_uuid = '".$domain_uuid."' "; if (strlen($search_all) == 0) { - $sql .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; if (strlen($data_parent_row_uuid) > 0) { $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; } } else { $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 .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; if (strlen($data_parent_row_uuid) > 0) { $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; } @@ -476,11 +475,11 @@ else { //begin creating the content echo "
"; -//get the title and description of the table +//get the title and description of the schema echo "\n"; echo " \n"; echo " \n"; @@ -502,32 +501,32 @@ else { if (strlen($data_parent_row_uuid) == 0) { echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; } else { echo " \n"; } echo " \n"; @@ -553,12 +552,12 @@ else { echo "
\n"; - echo " $table_label \n"; + echo " $schema_label \n"; if ($action == "add") { echo " Add\n"; } @@ -489,12 +488,12 @@ else { } echo " \n"; echo "      \n"; - if ($action == "update" && permission_exists('tables_data_edit')) { - echo " \n"; - //echo " \n"; + if ($action == "update" && permission_exists('schema_data_edit')) { + echo " \n"; + //echo " \n"; } echo "
\n"; - echo " $table_description\n"; + echo " $schema_description\n"; echo "
\n"; echo "
\n"; echo "
\n"; - if ($action == "update" && permission_exists('tables_data_edit')) { - //echo " \n"; + if ($action == "update" && permission_exists('schema_data_edit')) { + //echo " \n"; if (strlen($previous_data_row_uuid) == 0) { echo " \n"; } else { - echo " \n"; + echo " \n"; } echo " \n"; if (strlen($next_data_row_uuid) == 0) { echo " \n"; } else { - echo " \n"; + echo " \n"; } - //echo " \n"; + //echo " \n"; } echo "    "; echo "    "; echo "    "; echo "
\n"; - echo " \n"; - //echo " \n"; + echo " \n"; + //echo " \n"; //echo " \n"; //echo " \n"; echo " \n"; @@ -535,14 +534,14 @@ else { echo "\n"; - echo " \n"; + echo " \n"; echo "\n"; - //echo " \n"; - //echo " \n"; - echo " \n"; + //echo " \n"; + //echo " \n"; + echo " \n"; echo "
\n"; //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 .= "and table_uuid = '$table_uuid ' "; + $sql .= "and schema_uuid = '$schema_uuid ' "; $sql .= "and field_type = 'uploadimage' "; $sql .= "or domain_uuid = '$domain_uuid ' "; - $sql .= "and table_uuid = '$table_uuid ' "; + $sql .= "and schema_uuid = '$schema_uuid ' "; $sql .= "and field_type = 'upload_file' "; $prep_statement = $db->prepare($sql); $prep_statement->execute(); @@ -570,11 +569,10 @@ else { echo "\n"; } -//get the table fields and then display them - $sql = ""; - $sql .= "select * from v_table_fields "; +//get the fields and then display them + $sql = "select * from v_schema_fields "; $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 "; $prep_statement = $db->prepare($sql); $prep_statement->execute(); @@ -582,7 +580,7 @@ else { $result_count = count($result); echo "\n"; - echo "\n"; + echo "\n"; if ($result_count == 0) { //no results echo "\n"; @@ -590,13 +588,13 @@ else { else { //received results $x=1; $field_column_previous = ''; - $column_table_cell_status = ''; + $column_schema_cell_status = ''; foreach($result as $row) { //handle more than one column $field_column = $row[field_column]; //echo "\n"; 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 if ($x != 1) { //close the table @@ -740,9 +738,9 @@ else { echo "\n"; $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 .= "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->execute(); $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED); @@ -766,9 +764,9 @@ else { echo "\n"; $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 .= "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->execute(); $result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED); @@ -928,17 +926,17 @@ else { } //end foreach unset($sql, $result, $row_count); - if ($column_table_cell_status == 'open') { - $column_table_cell_status = 'closed'; + if ($column_schema_cell_status == 'open') { + $column_schema_cell_status = 'closed'; } } //end if results echo " \n"; echo " \n"; echo "\n"; - if ($action == "update" && permission_exists('tables_data_edit')) { - //get the child table_uuid and use it to show the list of data - $sql = "select * from v_tables "; + if ($action == "update" && permission_exists('schema_data_edit')) { + //get the child schema_uuid and use it to show the list of data + $sql = "select * from v_schemas "; $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->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -962,15 +960,15 @@ else { echo "\n"; echo " "; echo " "; } diff --git a/app/schemas/schema_data_view.php b/app/schemas/schema_data_view.php index 7ebba89f4f..f25e32870a 100644 --- a/app/schemas/schema_data_view.php +++ b/app/schemas/schema_data_view.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_data_view')) { +if (permission_exists('schema_data_view')) { //access granted } else { @@ -35,7 +35,7 @@ else { } 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) { $data_parent_row_uuid = $_GET["data_parent_row_uuid"]; } @@ -54,22 +54,21 @@ if (strlen($_GET["id"]) > 0) { //show the header require_once "includes/header.php"; -//get the information about the table by using the id - $sql = ""; - $sql .= "select * from v_tables "; +//get the information about the schema by using the id + $sql = "select * from v_schemas "; $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->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as &$row) { - $table_category = $row["table_category"]; - $table_label = $row["table_label"]; - $table_name = $row["table_name"]; - $table_auth = $row["table_auth"]; - $table_captcha = $row["table_captcha"]; - $table_parent_uuid = $row["table_parent_uuid"]; - $table_description = $row["table_description"]; + $schema_category = $row["schema_category"]; + $schema_label = $row["schema_label"]; + $schema_name = $row["schema_name"]; + $schema_auth = $row["schema_auth"]; + $schema_captcha = $row["schema_captcha"]; + $schema_parent_uuid = $row["schema_parent_uuid"]; + $schema_description = $row["schema_description"]; break; //limit to 1 row } unset ($prep_statement); @@ -78,9 +77,9 @@ if (strlen($_GET["id"]) > 0) { $db_field_name_array = array(); $db_value_array = array(); $db_names .= "\n"; - $sql = "select * from v_table_fields "; + $sql = "select * from v_schema_fields "; $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; $sql .= "order by field_order asc "; $prep_statement = $db->prepare($sql); $prep_statement->execute(); @@ -112,19 +111,19 @@ if (strlen($_GET["id"]) > 0) { //get the data $sql = ""; - $sql .= "select * from v_table_data "; + $sql .= "select * from v_schema_data "; $sql .= "where domain_uuid = '".$domain_uuid."' "; if (strlen($search_all) == 0) { - $sql .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; if (strlen($data_parent_row_uuid) > 0) { $sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' "; } } else { $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 .= "and table_uuid = '$table_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; if (strlen($data_parent_row_uuid) == 0) { $tmp_digits = preg_replace('{\D}', '', $search_all); 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 $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]['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]; } $num_rows = count($value_array); @@ -175,9 +174,9 @@ if (strlen($_GET["id"]) > 0) { $sql = "CREATE TABLE memory_table "; $sql .= "("; $sql .= "'id' INTEGER PRIMARY KEY, "; - $sql .= "'table_uuid' TEXT, "; + $sql .= "'schema_uuid' TEXT, "; $sql .= "'data_row_uuid' TEXT, "; - $sql .= "'table_parent_uuid' TEXT, "; + $sql .= "'schema_parent_uuid' TEXT, "; $sql .= "'data_parent_row_uuid' TEXT, "; foreach($result_names as $row) { if ($row["field_type"] != "label") { @@ -207,9 +206,9 @@ if (strlen($_GET["id"]) > 0) { //insert the data into the memory table $sql = "insert into memory_table "; $sql .= "("; - $sql .= "'table_uuid', "; + $sql .= "'schema_uuid', "; $sql .= "'data_row_uuid', "; - $sql .= "'table_parent_uuid', "; + $sql .= "'schema_parent_uuid', "; $sql .= "'data_parent_row_uuid', "; //foreach($array as $key => $value) { // $sql .= "'$key', "; @@ -221,9 +220,9 @@ if (strlen($_GET["id"]) > 0) { $sql .= ")"; $sql .= "values "; $sql .= "("; - $sql .= "'".$array['table_uuid']."', "; + $sql .= "'".$array['schema_uuid']."', "; $sql .= "'".$array['data_row_uuid']."', "; - $sql .= "'".$array['table_parent_uuid']."', "; + $sql .= "'".$array['schema_parent_uuid']."', "; $sql .= "'".$array['data_parent_row_uuid']."', "; //foreach($array as $key => $value) { // $sql .= "'$value', "; @@ -247,15 +246,15 @@ if (strlen($_GET["id"]) > 0) { echo "
\n"; echo "
 
\n"; - if ($action == "add" && permission_exists('table_data_add')) { + if ($action == "add" && permission_exists('schema_data_add')) { echo " \n"; } - if ($action == "update" && permission_exists('tables_data_edit')) { + if ($action == "update" && permission_exists('schema_data_edit')) { echo " \n"; echo " \n"; } @@ -950,11 +948,11 @@ else { echo "
\n"; echo "
"; - $_GET["id"] = $row["table_uuid"]; - $table_label = $row["table_label"]; + $_GET["id"] = $row["schema_uuid"]; + $schema_label = $row["schema_label"]; $_GET["data_parent_row_uuid"] = $data_row_uuid; //show button - //echo "\n"; + //echo "\n"; //show list - require_once "table_data_view.php"; + require_once "schema_data_view.php"; echo "
\n"; echo " \n"; - echo " \n"; echo " \n"; echo "\n"; @@ -354,16 +353,16 @@ if (strlen($_GET["id"]) > 0) { } echo "\n"; @@ -379,8 +378,8 @@ if (strlen($_GET["id"]) > 0) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; diff --git a/app/schemas/schema_delete.php b/app/schemas/schema_delete.php index a6c383d523..9c84db8029 100644 --- a/app/schemas/schema_delete.php +++ b/app/schemas/schema_delete.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_delete')) { +if (permission_exists('schema_delete')) { //access granted } else { @@ -42,18 +42,17 @@ else { //show the header require_once "includes/header.php"; -if (strlen($id)>0) { - $sql = ""; - $sql .= "delete from v_tables "; +if (strlen($id) > 0) { + $sql = "delete from v_schemas "; $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->execute(); unset($sql); } //redirect the user - echo "\n"; + echo "\n"; echo "
\n"; echo "Delete Complete\n"; echo "
\n"; diff --git a/app/schemas/schema_edit.php b/app/schemas/schema_edit.php index 8d508201ea..a7e600a565 100644 --- a/app/schemas/schema_edit.php +++ b/app/schemas/schema_edit.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.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 } else { @@ -37,7 +37,7 @@ else { //action add or update if (isset($_REQUEST["id"])) { $action = "update"; - $table_uuid = check_str($_REQUEST["id"]); + $schema_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; @@ -45,33 +45,33 @@ else { //get the http post variables if (count($_POST)>0) { - $table_category = check_str($_POST["table_category"]); - $table_category_other = check_str($_POST["table_category_other"]); - if (strlen($table_category_other) > 0) { $table_category = $table_category_other; } - $table_label = check_str($_POST["table_label"]); - $table_name = check_str($_POST["table_name"]); - $table_auth = check_str($_POST["table_auth"]); - $table_captcha = check_str($_POST["table_captcha"]); - $table_parent_uuid = check_str($_POST["table_parent_uuid"]); - $table_description = check_str($_POST["table_description"]); + $schema_category = check_str($_POST["schema_category"]); + $schema_category_other = check_str($_POST["schema_category_other"]); + if (strlen($schema_category_other) > 0) { $schema_category = $schema_category_other; } + $schema_label = check_str($_POST["schema_label"]); + $schema_name = check_str($_POST["schema_name"]); + $schema_auth = check_str($_POST["schema_auth"]); + $schema_captcha = check_str($_POST["schema_captcha"]); + $schema_parent_uuid = check_str($_POST["schema_parent_uuid"]); + $schema_description = check_str($_POST["schema_description"]); } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { - $table_uuid = check_str($_POST["table_uuid"]); + $schema_uuid = check_str($_POST["schema_uuid"]); } //check for all required data if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid
\n"; } - //if (strlen($table_category) == 0) { $msg .= "Please provide: Table Category
\n"; } - //if (strlen($table_label) == 0) { $msg .= "Please provide: Label
\n"; } - if (strlen($table_name) == 0) { $msg .= "Please provide: Table Name
\n"; } - //if (strlen($table_auth) == 0) { $msg .= "Please provide: Authentication
\n"; } - //if (strlen($table_captcha) == 0) { $msg .= "Please provide: Captcha
\n"; } - //if (strlen($table_parent_uuid) == 0) { $msg .= "Please provide: Parent Table
\n"; } - //if (strlen($table_description) == 0) { $msg .= "Please provide: Description
\n"; } + //if (strlen($schema_category) == 0) { $msg .= "Please provide: Schema Category
\n"; } + //if (strlen($schema_label) == 0) { $msg .= "Please provide: Label
\n"; } + if (strlen($schema_name) == 0) { $msg .= "Please provide: Schema Name
\n"; } + //if (strlen($schema_auth) == 0) { $msg .= "Please provide: Authentication
\n"; } + //if (strlen($schema_captcha) == 0) { $msg .= "Please provide: Captcha
\n"; } + //if (strlen($schema_parent_uuid) == 0) { $msg .= "Please provide: Parent Schema
\n"; } + //if (strlen($schema_description) == 0) { $msg .= "Please provide: Description
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; @@ -88,41 +88,41 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //add or update the database if ($_POST["persistformvar"] != "true") { if ($action == "add") { - $table_uuid = uuid(); - $sql = "insert into v_tables "; + $schema_uuid = uuid(); + $sql = "insert into v_schemas "; $sql .= "("; $sql .= "domain_uuid, "; - $sql .= "table_uuid, "; - $sql .= "table_category, "; - $sql .= "table_label, "; - $sql .= "table_name, "; - $sql .= "table_auth, "; - $sql .= "table_captcha, "; - $sql .= "table_parent_uuid, "; - $sql .= "table_description "; + $sql .= "schema_uuid, "; + $sql .= "schema_category, "; + $sql .= "schema_label, "; + $sql .= "schema_name, "; + $sql .= "schema_auth, "; + $sql .= "schema_captcha, "; + $sql .= "schema_parent_uuid, "; + $sql .= "schema_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; - $sql .= "'$table_uuid', "; - $sql .= "'$table_category', "; - $sql .= "'$table_label', "; - $sql .= "'$table_name', "; - $sql .= "'$table_auth', "; - $sql .= "'$table_captcha', "; - if (strlen($table_parent_uuid) == 0) { + $sql .= "'$schema_uuid', "; + $sql .= "'$schema_category', "; + $sql .= "'$schema_label', "; + $sql .= "'$schema_name', "; + $sql .= "'$schema_auth', "; + $sql .= "'$schema_captcha', "; + if (strlen($schema_parent_uuid) == 0) { $sql .= "null, "; } else { - $sql .= "'$table_parent_uuid', "; + $sql .= "'$schema_parent_uuid', "; } - $sql .= "'$table_description' "; + $sql .= "'$schema_description' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Add Complete\n"; echo "
\n"; @@ -131,26 +131,26 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //if ($action == "add") if ($action == "update") { - $sql = "update v_tables set "; + $sql = "update v_schemas set "; $sql .= "domain_uuid = '$domain_uuid', "; - $sql .= "table_category = '$table_category', "; - $sql .= "table_label = '$table_label', "; - $sql .= "table_name = '$table_name', "; - $sql .= "table_auth = '$table_auth', "; - $sql .= "table_captcha = '$table_captcha', "; - if (strlen($table_parent_uuid) == 0) { - $sql .= "table_parent_uuid = null, "; + $sql .= "schema_category = '$schema_category', "; + $sql .= "schema_label = '$schema_label', "; + $sql .= "schema_name = '$schema_name', "; + $sql .= "schema_auth = '$schema_auth', "; + $sql .= "schema_captcha = '$schema_captcha', "; + if (strlen($schema_parent_uuid) == 0) { + $sql .= "schema_parent_uuid = null, "; } else { - $sql .= "table_parent_uuid = '$table_parent_uuid', "; + $sql .= "schema_parent_uuid = '$schema_parent_uuid', "; } - $sql .= "table_description = '$table_description' "; - $sql .= "where table_uuid = '$table_uuid'"; + $sql .= "schema_description = '$schema_description' "; + $sql .= "where schema_uuid = '$schema_uuid'"; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; @@ -162,21 +162,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { - $table_uuid = $_GET["id"]; - $sql = "select * from v_tables "; + $schema_uuid = $_GET["id"]; + $sql = "select * from v_schemas "; $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->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $table_category = $row["table_category"]; - $table_label = $row["table_label"]; - $table_name = $row["table_name"]; - $table_auth = $row["table_auth"]; - $table_captcha = $row["table_captcha"]; - $table_parent_uuid = $row["table_parent_uuid"]; - $table_description = $row["table_description"]; + $schema_category = $row["schema_category"]; + $schema_label = $row["schema_label"]; + $schema_name = $row["schema_name"]; + $schema_auth = $row["schema_auth"]; + $schema_captcha = $row["schema_captcha"]; + $schema_parent_uuid = $row["schema_parent_uuid"]; + $schema_description = $row["schema_description"]; break; //limit to 1 row } unset ($prep_statement); @@ -196,19 +196,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; echo "
$table_label
\n"; - echo " $table_description\n"; + echo "
$schema_label
\n"; + echo " $schema_description\n"; echo "
\n"; if (strlen($data_parent_row_uuid) == 0) { $search_all = str_replace("''", "'", $search_all); echo "
\n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo "
\n"; @@ -271,11 +270,11 @@ if (strlen($_GET["id"]) > 0) { $param = ""; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - if (strlen($table_parent_uuid) > 0) { - $param = "&id=$table_parent_uuid&data_row_uuid=$data_row_uuid"; + if (strlen($schema_parent_uuid) > 0) { + $param = "&id=$schema_parent_uuid&data_row_uuid=$data_row_uuid"; } 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); $offset = $rows_per_page * $page; @@ -301,8 +300,8 @@ if (strlen($_GET["id"]) > 0) { } } echo "
\n"; - if (permission_exists('table_data_add')) { - echo " $v_link_label_add\n"; + if (permission_exists('schema_data_add')) { + echo " $v_link_label_add\n"; } echo "
\n"; - if (permission_exists('tables_data_edit')) { + if (permission_exists('schema_data_edit')) { if (strlen($data_parent_row_uuid) == 0) { - echo " $v_link_label_edit\n"; + echo " $v_link_label_edit\n"; } else { - echo " $v_link_label_edit\n"; + echo " $v_link_label_edit\n"; } } - if (permission_exists('table_data_delete')) { - echo" $v_link_label_delete\n"; + if (permission_exists('schema_delete')) { + echo" $v_link_label_delete\n"; } echo " $paging_controls\n"; - if (permission_exists('table_data_add')) { - echo " $v_link_label_add\n"; + if (permission_exists('schema_data_add')) { + echo " $v_link_label_add\n"; } echo "
\n"; echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - echo "\n"; - } + echo "\n"; echo "\n"; echo "\n"; @@ -220,11 +215,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -234,7 +229,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " Label:\n"; echo "\n"; echo "\n"; @@ -242,12 +237,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -256,15 +251,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " Authentication:\n"; echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -334,7 +329,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " Description:\n"; echo "\n"; echo "\n"; @@ -342,9 +337,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; echo " \n"; echo " "; @@ -352,7 +347,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo ""; if ($action == "update") { - require "table_fields.php"; + require "schema_fields.php"; } echo " "; diff --git a/app/schemas/schema_field_delete.php b/app/schemas/schema_field_delete.php index f66e6fb59f..7024348ad6 100644 --- a/app/schemas/schema_field_delete.php +++ b/app/schemas/schema_field_delete.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_delete')) { +if (permission_exists('schema_delete')) { //access granted } else { @@ -35,17 +35,16 @@ else { } //get the http values - if (count($_GET)>0) { + if (count($_GET) > 0) { $id = check_str($_GET["id"]); - $table_uuid = check_str($_GET["table_uuid"]); + $schema_uuid = check_str($_GET["schema_uuid"]); } //delete the data - if (strlen($id)>0) { - $sql = ""; - $sql .= "delete from v_table_fields "; + if (strlen($id) > 0) { + $sql = "delete from v_schema_fields "; $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->execute(); unset($sql); @@ -53,11 +52,11 @@ else { //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Delete Complete\n"; echo "
\n"; require_once "includes/footer.php"; return; -?> +?> \ No newline at end of file diff --git a/app/schemas/schema_field_edit.php b/app/schemas/schema_field_edit.php index 55412ab213..492ae75d20 100644 --- a/app/schemas/schema_field_edit.php +++ b/app/schemas/schema_field_edit.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.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 } else { @@ -37,15 +37,15 @@ else { //set the action as an add or update if (isset($_REQUEST["id"])) { $action = "update"; - $table_field_uuid = check_str($_REQUEST["id"]); + $schema_field_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; } //get the http variables - if (strlen($_GET["table_uuid"]) > 0) { - $table_uuid = check_str($_GET["table_uuid"]); + if (strlen($_GET["schema_uuid"]) > 0) { + $schema_uuid = check_str($_GET["schema_uuid"]); } //get the http post variables @@ -67,7 +67,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; 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 @@ -98,13 +98,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //add or update the database if ($_POST["persistformvar"] != "true") { - if ($action == "add" && permission_exists('tables_add')) { - $table_field_uuid = uuid(); - $sql = "insert into v_table_fields "; + if ($action == "add" && permission_exists('schema_add')) { + $schema_field_uuid = uuid(); + $sql = "insert into v_schema_fields "; $sql .= "("; $sql .= "domain_uuid, "; - $sql .= "table_uuid, "; - $sql .= "table_field_uuid, "; + $sql .= "schema_uuid, "; + $sql .= "schema_field_uuid, "; $sql .= "field_label, "; $sql .= "field_name, "; $sql .= "field_type, "; @@ -120,8 +120,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; - $sql .= "'$table_uuid', "; - $sql .= "'$table_field_uuid', "; + $sql .= "'$schema_uuid', "; + $sql .= "'$schema_field_uuid', "; $sql .= "'$field_label', "; $sql .= "'$field_name', "; $sql .= "'$field_type', "; @@ -138,7 +138,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Add Complete\n"; echo "
\n"; @@ -146,8 +146,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { return; } //if ($action == "add") - if ($action == "update" && permission_exists('table_edit')) { - $sql = "update v_table_fields set "; + if ($action == "update" && permission_exists('schema_edit')) { + $sql = "update v_schema_fields set "; $sql .= "field_label = '$field_label', "; $sql .= "field_name = '$field_name', "; $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_description = '$field_description' "; $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and table_uuid = '$table_uuid'"; - $sql .= "and table_field_uuid = '$table_field_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid'"; + $sql .= "and schema_field_uuid = '$schema_field_uuid' "; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; @@ -178,13 +178,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { - $table_uuid = $_GET["table_uuid"]; - $table_field_uuid = $_GET["id"]; + $schema_uuid = $_GET["schema_uuid"]; + $schema_field_uuid = $_GET["id"]; - $sql = "select * from v_table_fields "; + $sql = "select * from v_schema_fields "; $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and table_uuid = '$table_uuid' "; - $sql .= "and table_field_uuid = '$table_field_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; + $sql .= "and schema_field_uuid = '$schema_field_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -219,13 +219,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; echo "
Virtual Table AddVirtual Table EditSchema\n"; - if (strlen($table_uuid) > 0) { - echo "   \n"; - echo "   \n"; + if (strlen($schema_uuid) > 0) { + echo "   \n"; + echo "   \n"; } include "export/index.php"; - echo " \n"; + echo " \n"; echo "
\n"; - echo " Table Category:\n"; + echo " Category:\n"; echo "\n"; - $table_name = 'v_tables';$field_name = 'table_category';$sql_where_optional = "";$field_current_value = $table_category; - echo html_select_other($db, $table_name, $field_name, $sql_where_optional, $field_current_value); + $schema_name = 'v_schemas';$field_name = 'schema_category';$sql_where_optional = "";$field_current_value = $schema_category; + echo html_select_other($db, $schema_name, $field_name, $sql_where_optional, $field_current_value); echo "Select the category.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the label.\n"; echo "
\n"; - echo " Table Name:\n"; + echo " Name:\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; - echo "Enter the table name.\n"; + echo "Enter the schema name.\n"; echo "
\n"; - echo " \n"; echo " \n"; - if ($table_auth == "yes") { + if ($schema_auth == "yes") { echo " \n"; } else { echo " \n"; } - if ($table_auth == "no") { + if ($schema_auth == "no") { echo " \n"; } else { @@ -281,15 +276,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //echo " Captcha:\n"; //echo "\n"; - //echo " \n"; //echo " \n"; - //if ($table_captcha == "yes") { + //if ($schema_captcha == "yes") { // echo " \n"; //} //else { // echo " \n"; //} - //if ($table_captcha == "no") { + //if ($schema_captcha == "no") { // echo " \n"; //} //else { @@ -303,29 +298,29 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " Parent Table:\n"; + echo " Parent Schema:\n"; echo "\n"; - echo " \n"; echo " \n"; - $sql = "select * from v_tables "; + $sql = "select * from v_schemas "; $sql .= "where domain_uuid = '$domain_uuid' "; $prep_statement = $db->prepare($sql); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - if ($row["table_uuid"] == $table_parent_uuid) { - echo " \n"; + if ($row["schema_uuid"] == $schema_parent_uuid) { + echo " \n"; } else { - echo " \n"; + echo " \n"; } } echo " \n"; echo "
\n"; - echo "Select a parent table.\n"; + echo "Select a parent schema.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter a description.\n"; echo "
\n"; if ($action == "update") { - echo " \n"; + echo " \n"; } - echo " \n"; + echo " \n"; echo " \n"; echo "
\n"; echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - echo "\n"; - } - echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; @@ -567,7 +562,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { if ($field_type == "select") { - require "table_data_types_name_value.php"; + require "schema_data_types_name_value.php"; } } diff --git a/app/schemas/schema_fields.php b/app/schemas/schema_fields.php index 8aa79e0590..21bdff8dde 100644 --- a/app/schemas/schema_fields.php +++ b/app/schemas/schema_fields.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_view')) { +if (permission_exists('schema_view')) { //access granted } else { @@ -48,7 +48,7 @@ $order = $_GET["order"]; echo "
Virtual Table Field AddVirtual Table Field EditField
\n"; @@ -555,9 +550,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " \n"; + echo " \n"; if ($action == "update") { - echo " \n"; + echo " \n"; } echo " \n"; echo "
\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -63,9 +63,9 @@ $order = $_GET["order"]; $order = 'asc'; } - $sql = "select * from v_table_fields "; + $sql = "select * from v_schema_fields "; $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 "; } $prep_statement = $db->prepare(check_sql($sql)); $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_description', 'Description', $order_by, $order); echo "\n"; echo "\n"; @@ -111,11 +111,11 @@ $order = $_GET["order"]; echo " \n"; echo " \n"; echo " \n"; echo "\n"; @@ -131,8 +131,8 @@ $order = $_GET["order"]; echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -154,4 +154,4 @@ $order = $_GET["order"]; //include the footer require_once "includes/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/schemas/schema_import.php b/app/schemas/schema_import.php index 60acea6a52..a63ed46606 100644 --- a/app/schemas/schema_import.php +++ b/app/schemas/schema_import.php @@ -26,7 +26,7 @@ include "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_edit')) { +if (permission_exists('schema_edit')) { //access granted } else { @@ -35,16 +35,16 @@ else { } if (count($_POST)>0) { - $table_uuid = trim($_REQUEST["id"]); + $schema_uuid = trim($_REQUEST["id"]); $data = trim($_POST["data"]); $data_delimiter = trim($_POST["data_delimiter"]); $data_enclosure = trim($_POST["data_enclosure"]); } //define the php class - class v_table_fields { + class v_schema_fields { var $domain_uuid; - var $table_uuid; + var $schema_uuid; var $field_label; var $field_name; var $field_type; @@ -58,9 +58,9 @@ if (count($_POST)>0) { function db_field_exists() { 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 .= "and table_uuid ='$this->table_uuid' "; + $sql .= "and schema_uuid ='$this->schema_uuid' "; $sql .= "and field_name = '$this->field_name' "; $prep_statement = $db->prepare($sql); if ($prep_statement) { @@ -77,11 +77,11 @@ if (count($_POST)>0) { function db_insert() { global $db; - $sql = "insert into v_table_fields "; + $sql = "insert into v_schema_fields "; $sql .= "("; - $sql .= "table_field_uuid, "; + $sql .= "schema_field_uuid, "; $sql .= "domain_uuid, "; - $sql .= "table_uuid, "; + $sql .= "schema_uuid, "; $sql .= "field_label, "; $sql .= "field_name, "; $sql .= "field_type, "; @@ -98,7 +98,7 @@ if (count($_POST)>0) { $sql .= "("; $sql .= "'".uuid()."', "; $sql .= "'$this->domain_uuid', "; - $sql .= "'$this->table_uuid', "; + $sql .= "'$this->schema_uuid', "; $sql .= "'$this->field_label', "; $sql .= "'$this->field_name', "; $sql .= "'$this->field_type', "; @@ -118,18 +118,18 @@ if (count($_POST)>0) { } } - class v_table_data { + class v_schema_data { var $domain_uuid; - var $table_uuid; + var $schema_uuid; var $data_row_uuid; var $field_name; var $data_field_value; var $last_insert_id; - var $table_data_uuid; + var $schema_data_uuid; function db_unique_id() { global $db; - $sql = "insert into v_table_data_row_id "; + $sql = "insert into v_schema_data_row_id "; $sql .= "("; $sql .= "domain_uuid "; $sql .= ")"; @@ -144,12 +144,12 @@ if (count($_POST)>0) { function db_insert() { global $db; - $sql = "insert into v_table_data "; + $sql = "insert into v_schema_data "; $sql .= "("; - $sql .= "table_data_uuid, "; + $sql .= "schema_data_uuid, "; $sql .= "domain_uuid, "; $sql .= "data_row_uuid, "; - $sql .= "table_uuid, "; + $sql .= "schema_uuid, "; $sql .= "field_name, "; $sql .= "data_field_value, "; $sql .= "data_add_user, "; @@ -160,7 +160,7 @@ if (count($_POST)>0) { $sql .= "'".uuid()."', "; $sql .= "'$this->domain_uuid', "; $sql .= "'$this->data_row_uuid', "; - $sql .= "'$this->table_uuid', "; + $sql .= "'$this->schema_uuid', "; $sql .= "'$this->field_name', "; $sql .= "'$this->data_field_value', "; $sql .= "'".$_SESSION["username"]."', "; @@ -173,14 +173,14 @@ if (count($_POST)>0) { function db_update() { global $db; - $sql = "update v_table_data set "; + $sql = "update v_schema_data set "; $sql .= "data_row_uuid = '$this->data_row_uuid', "; $sql .= "field_name = '$this->field_name', "; $sql .= "data_field_value = '$this->data_field_value', "; $sql .= "data_add_user = '".$_SESSION["username"]."', "; $sql .= "data_add_date = now() "; $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); unset($sql); } @@ -209,7 +209,7 @@ if (count($_POST)>0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -230,9 +230,9 @@ if (count($_POST)>0) { $field_name = str_replace("-", "_", $field_name); $field_name = strtolower($field_name); - $fields = new v_table_fields; + $fields = new v_schema_fields; $fields->domain_uuid = $domain_uuid; - $fields->table_uuid = $table_uuid; + $fields->schema_uuid = $schema_uuid; $fields->field_label = $field_label; $fields->field_name = $field_name; $fields->field_type = 'text'; @@ -262,9 +262,9 @@ if (count($_POST)>0) { $field_value = trim($val); - $data = new v_table_data; + $data = new v_schema_data; $data->domain_uuid = $domain_uuid; - $data->table_uuid = $table_uuid; + $data->schema_uuid = $schema_uuid; if ($x == 0) { $data_row_uuid = uuid(); //echo "id: ".$data_row_uuid."
\n"; @@ -291,8 +291,7 @@ if (count($_POST)>0) { //show the footer require_once "includes/footer.php"; - - exit; + exit; } @@ -305,7 +304,7 @@ if (count($_POST)>0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -314,7 +313,7 @@ if (count($_POST)>0) { echo "
Table FieldsFields 
\n"; - if (permission_exists('table_view')) { - echo " $v_link_label_add\n"; + if (permission_exists('schema_view')) { + echo " $v_link_label_add\n"; } echo "
".$row['field_order_tab']."".$row['field_description']." \n"; - if (permission_exists('table_edit')) { - echo " $v_link_label_edit\n"; + if (permission_exists('schema_edit')) { + echo " $v_link_label_edit\n"; } - if (permission_exists('table_delete')) { - echo " $v_link_label_delete\n"; + if (permission_exists('schema_delete')) { + echo " $v_link_label_delete\n"; } echo "
  \n"; - if (permission_exists('tables_add')) { - echo " $v_link_label_add\n"; + if (permission_exists('schema_add')) { + echo " $v_link_label_add\n"; } echo "
Import Results\n"; - echo " \n"; + echo " \n"; echo "

\n"; echo "
Import\n"; - //echo " \n"; + //echo " \n"; echo "

\n"; echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; @@ -229,4 +227,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo ""; require_once "includes/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/schemas/schema_name_values.php b/app/schemas/schema_name_values.php index baf17f1728..8a75d9f030 100644 --- a/app/schemas/schema_name_values.php +++ b/app/schemas/schema_name_values.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_edit')) { +if (permission_exists('schema_edit')) { //access granted } else { @@ -49,7 +49,7 @@ require_once "includes/paging.php"; echo "
\n"; - echo "
"; + echo "
"; echo "
\n"; echo "
\n"; @@ -374,4 +373,4 @@ if (count($_POST)>0) { echo ""; require_once "includes/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/schemas/schema_name_value_delete.php b/app/schemas/schema_name_value_delete.php index fe8407bc2f..081659efa5 100644 --- a/app/schemas/schema_name_value_delete.php +++ b/app/schemas/schema_name_value_delete.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_delete')) { +if (permission_exists('schema_delete')) { //access granted } else { @@ -35,18 +35,17 @@ else { } //get the http values - if (count($_GET)>0) { + if (count($_GET) > 0) { $id = check_str($_GET["id"]); - $table_uuid = check_str($_GET["table_uuid"]); - $table_field_uuid = check_str($_GET["table_field_uuid"]); + $schema_uuid = check_str($_GET["schema_uuid"]); + $schema_field_uuid = check_str($_GET["schema_field_uuid"]); } //delete the data - if (strlen($id)>0) { - $sql = ""; - $sql .= "delete from v_table_name_values "; + if (strlen($id) > 0) { + $sql .= "delete from v_schema_name_values "; $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->execute(); unset($sql); @@ -54,7 +53,7 @@ else { //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Delete Complete\n"; echo "
\n"; diff --git a/app/schemas/schema_name_value_edit.php b/app/schemas/schema_name_value_edit.php index 894a42030a..7dd74d23d6 100644 --- a/app/schemas/schema_name_value_edit.php +++ b/app/schemas/schema_name_value_edit.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_edit')) { +if (permission_exists('schema_edit')) { //access granted } else { @@ -37,14 +37,14 @@ else { //action add or update if (isset($_REQUEST["id"])) { $action = "update"; - $table_name_value_uuid = check_str($_REQUEST["id"]); + $schema_name_value_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; } -if (strlen($_GET["table_field_uuid"]) > 0) { - $table_field_uuid = check_str($_GET["table_field_uuid"]); +if (strlen($_GET["schema_field_uuid"]) > 0) { + $schema_field_uuid = check_str($_GET["schema_field_uuid"]); } //POST to PHP variables @@ -52,21 +52,21 @@ if (strlen($_GET["table_field_uuid"]) > 0) { //$domain_uuid = check_str($_POST["domain_uuid"]); $data_types_name = check_str($_POST["data_types_name"]); $data_types_value = check_str($_POST["data_types_value"]); - $table_uuid = $_REQUEST["table_uuid"]; - $table_field_uuid = $_REQUEST["table_field_uuid"]; + $schema_uuid = $_REQUEST["schema_uuid"]; + $schema_field_uuid = $_REQUEST["schema_field_uuid"]; } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; 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 if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid
\n"; } - if (strlen($table_uuid) == 0) { $msg .= "Please provide: table_uuid
\n"; } - if (strlen($table_field_uuid) == 0) { $msg .= "Please provide: table_field_uuid
\n"; } + if (strlen($schema_uuid) == 0) { $msg .= "Please provide: schema_uuid
\n"; } + if (strlen($schema_field_uuid) == 0) { $msg .= "Please provide: schema_field_uuid
\n"; } if (strlen($data_types_name) == 0) { $msg .= "Please provide: Name
\n"; } if (strlen($data_types_value) == 0) { $msg .= "Please provide: Value
\n"; } 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 if ($_POST["persistformvar"] != "true") { if ($action == "add") { - $sql = "insert into v_table_name_values "; + $sql = "insert into v_schema_name_values "; $sql .= "("; - $sql .= "table_name_value_uuid, "; + $sql .= "schema_name_value_uuid, "; $sql .= "domain_uuid, "; - $sql .= "table_uuid, "; - $sql .= "table_field_uuid, "; + $sql .= "schema_uuid, "; + $sql .= "schema_field_uuid, "; $sql .= "data_types_name, "; $sql .= "data_types_value "; $sql .= ") "; @@ -98,8 +98,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "("; $sql .= "'".uuid()."', "; $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'$table_uuid', "; - $sql .= "'$table_field_uuid', "; + $sql .= "'$schema_uuid', "; + $sql .= "'$schema_field_uuid', "; $sql .= "'$data_types_name', "; $sql .= "'$data_types_value' "; $sql .= ")"; @@ -107,7 +107,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Add Complete\n"; echo "
\n"; @@ -116,18 +116,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //if ($action == "add") 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_value = '$data_types_value' "; $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and table_uuid = '$table_uuid' "; - $sql .= "and table_field_uuid = '$table_field_uuid' "; - $sql .= "and table_name_value_uuid = '$table_name_value_uuid' "; + $sql .= "and schema_uuid = '$schema_uuid' "; + $sql .= "and schema_field_uuid = '$schema_field_uuid' "; + $sql .= "and schema_name_value_uuid = '$schema_name_value_uuid' "; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; @@ -139,16 +139,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { - $table_uuid = $_GET["table_uuid"]; - $table_field_uuid = $_GET["table_field_uuid"]; - $table_name_value_uuid = $_GET["id"]; - $sql = ""; - $sql .= "select * from v_table_name_values "; + $schema_uuid = $_GET["schema_uuid"]; + $schema_field_uuid = $_GET["schema_field_uuid"]; + $schema_name_value_uuid = $_GET["id"]; + $sql = "select * from v_schema_name_values "; $sql .= "where domain_uuid = '$domain_uuid' "; - //$sql .= "and table_uuid = '$table_uuid' "; - $sql .= "and table_field_uuid = '$table_field_uuid' "; - $sql .= "and table_name_value_uuid = '$table_name_value_uuid' "; - + //$sql .= "and schema_uuid = '$schema_uuid' "; + $sql .= "and schema_field_uuid = '$schema_field_uuid' "; + $sql .= "and schema_name_value_uuid = '$schema_name_value_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -212,10 +210,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; if ($action == "update") { - echo " \n"; + echo " \n"; } echo " \n"; echo "
\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -59,10 +59,9 @@ require_once "includes/paging.php"; echo "\n"; echo "
Virtual Table Data Types Name Value ListSchema Name Values 
\n"; - //$sql = ""; - //$sql .= " select * from v_table_name_values "; - //$sql .= " where domain_uuid = '$domain_uuid' "; - //$sql .= " and table_field_uuid = '$table_field_uuid' "; + //$sql = "select * from v_schema_name_values "; + //$sql .= "where domain_uuid = '$domain_uuid' "; + //$sql .= "and schema_field_uuid = '$schema_field_uuid' "; //if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } //$prep_statement = $db->prepare(check_sql($sql)); //$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); //$offset = $rows_per_page * $page; - $sql = ""; - $sql .= " select * from v_table_name_values "; - $sql .= " where domain_uuid = '$domain_uuid' "; - $sql .= " and table_field_uuid = '$table_field_uuid' "; + $sql = "select * from v_schema_name_values "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and schema_field_uuid = '$schema_field_uuid' "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } //$sql .= " limit $rows_per_page offset $offset "; $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_value', 'Value', $order_by, $order); echo "\n"; - echo " $v_link_label_add\n"; + echo " $v_link_label_add\n"; echo "\n"; echo "\n"; @@ -108,10 +106,10 @@ require_once "includes/paging.php"; echo " ".$row[data_types_name]."\n"; echo " ".$row[data_types_value]."\n"; echo " \n"; - echo " $v_link_label_edit\n"; - echo " $v_link_label_delete\n"; - //echo " \n"; - //echo " \n"; + echo " $v_link_label_edit\n"; + echo " $v_link_label_delete\n"; + //echo " \n"; + //echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } @@ -127,7 +125,7 @@ require_once "includes/paging.php"; echo "  \n"; //echo " $paging_controls\n"; echo " \n"; - echo " $v_link_label_add\n"; + echo " $v_link_label_add\n"; echo " \n"; echo " \n"; echo " \n"; @@ -148,4 +146,4 @@ require_once "includes/paging.php"; //show the footer require_once "includes/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/schemas/schemas.php b/app/schemas/schemas.php index a84091633f..943e6eec06 100644 --- a/app/schemas/schemas.php +++ b/app/schemas/schemas.php @@ -26,7 +26,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('table_view')) { +if (permission_exists('schema_view')) { //access granted } else { @@ -49,7 +49,7 @@ require_once "includes/paging.php"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -60,7 +60,7 @@ require_once "includes/paging.php"; echo "\n"; echo "
Virtual TablesSchemas 
\n"; - $sql = " select * from v_tables "; + $sql = " select * from v_schemas "; $sql .= " where domain_uuid = '$domain_uuid' "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } $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); $offset = $rows_per_page * $page; - $sql = " select * from v_tables "; + $sql = " select * from v_schemas "; $sql .= " where domain_uuid = '$domain_uuid' "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } $sql .= " limit $rows_per_page offset $offset "; @@ -92,14 +92,14 @@ require_once "includes/paging.php"; echo "
\n"; echo "\n"; echo "\n"; - echo th_order_by('table_label', 'Label', $order_by, $order); - echo th_order_by('table_name', 'Table Name', $order_by, $order); - echo th_order_by('table_auth', 'Authentication', $order_by, $order); - echo th_order_by('table_description', 'Description', $order_by, $order); + echo th_order_by('schema_label', 'Label', $order_by, $order); + echo th_order_by('schema_name', 'Schema Name', $order_by, $order); + echo th_order_by('schema_auth', 'Authentication', $order_by, $order); + echo th_order_by('schema_description', 'Description', $order_by, $order); //echo "\n"; echo "\n"; echo "\n"; @@ -110,16 +110,16 @@ require_once "includes/paging.php"; else { //received results foreach($result as $row) { echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo "\n"; @@ -135,8 +135,8 @@ require_once "includes/paging.php"; echo " \n"; echo " \n"; echo " \n"; echo " \n";
View\n"; - if (permission_exists('tables_add')) { - echo " $v_link_label_add\n"; + if (permission_exists('schema_add')) { + echo " $v_link_label_add\n"; } echo "
".$row['table_label']." ".$row['table_name']."".$row['table_auth']."".$row['table_description']." ".$row['schema_label']." ".$row['schema_name']."".$row['schema_auth']."".$row['schema_description']." \n"; - if (permission_exists('table_edit')) { - echo " $v_link_label_edit\n"; + if (permission_exists('schema_edit')) { + echo " $v_link_label_edit\n"; } - if (permission_exists('table_delete')) { - echo " $v_link_label_delete\n"; + if (permission_exists('schema_delete')) { + echo " $v_link_label_delete\n"; } echo "
 $paging_controls\n"; - if (permission_exists('tables_add')) { - echo " $v_link_label_add\n"; + if (permission_exists('schema_add')) { + echo " $v_link_label_add\n"; } echo "