Remove domain parent which is confusion and expectations of it working in some particular way.

This commit is contained in:
markjcrane
2015-08-13 16:55:42 -06:00
parent b0ea34d38d
commit 16527f49da
2 changed files with 29 additions and 88 deletions
-44
View File
@@ -51,11 +51,8 @@ else {
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$domain_name = check_str($_POST["domain_name"]);
$domain_parent_uuid = check_str($_POST["domain_parent_uuid"]);
$domain_enabled = check_str($_POST["domain_enabled"]);
$domain_description = check_str($_POST["domain_description"]);
$domain_parent_uuid = ($domain_parent_uuid == '') ? 'null' : "'".$domain_parent_uuid."'"; // fix null
}
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
@@ -95,7 +92,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "domain_name, ";
$sql .= "domain_parent_uuid, ";
$sql .= "domain_enabled, ";
$sql .= "domain_description ";
$sql .= ")";
@@ -103,7 +99,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'".$domain_name."', ";
$sql .= $domain_parent_uuid.", ";
$sql .= "'".$domain_enabled."', ";
$sql .= "'".$domain_description."' ";
$sql .= ")";
@@ -129,7 +124,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
// update domain name, description
$sql = "update v_domains set ";
$sql .= "domain_name = '".$domain_name."', ";
$sql .= "domain_parent_uuid = ".$domain_parent_uuid.", ";
$sql .= "domain_enabled = '".$domain_enabled."', ";
$sql .= "domain_description = '".$domain_description."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
@@ -597,7 +591,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$domain_name = strtolower($row["domain_name"]);
$domain_parent_uuid = $row["domain_parent_uuid"];
$domain_enabled = $row["domain_enabled"];
$domain_description = $row["domain_description"];
}
@@ -656,43 +649,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-parent_domain']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_parent_uuid'>\n";
echo " <option value=''></option>\n";
$sql = "select * from v_domains order by domain_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
function get_child_domains($parent_uuid) {
global $result, $indent, $domain_parent_uuid, $domain_name;
foreach ($result as $row) {
if ($row['domain_parent_uuid'] == $parent_uuid && $row['domain_name'] != $domain_name && ($row['domain_enabled'] == 'true' || $row['domain_enabled'] == '')) {
$selected = ($domain_parent_uuid == $row['domain_uuid']) ? "selected='selected'" : null;
echo "<option value='".$row['domain_uuid']."' ".$selected.">".(str_repeat("&nbsp;",($indent * 5))).$row['domain_name']."</option>\n";
$indent++;
get_child_domains($row['domain_uuid']);
$indent--;
}
}
}
$indent = 0;
get_child_domains();
}
unset ($prep_statement, $result, $sql);
echo " </select>\n";
echo " <br />\n";
echo $text['description-parent_domain']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";