Remove domain parent which is confusion and expectations of it working in some particular way.
This commit is contained in:
parent
b0ea34d38d
commit
16527f49da
|
|
@ -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(" ",($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";
|
||||
|
|
|
|||
|
|
@ -190,53 +190,38 @@ else {
|
|||
echo "</tr>\n";
|
||||
|
||||
if (count($domains) > 0) {
|
||||
|
||||
function get_child_domains($domain_parent_uuid) {
|
||||
global $domains, $indent;
|
||||
global $c, $row_style, $text, $v_link_label_edit, $v_link_label_delete;
|
||||
foreach ($domains as $domain_uuid => $domain) {
|
||||
if ($domain['parent_uuid'] == $domain_parent_uuid) {
|
||||
|
||||
$tr_link = (permission_exists('domain_edit')) ? "href='domain_edit.php?id=".$domain_uuid."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' ".(($indent != 0) ? "style='padding-left: ".($indent * 20)."px;'" : null).">";
|
||||
echo " <a href='domain_edit.php?id=".$domain_uuid."'>".$domain['name']."</a>";
|
||||
if ($domain['enabled'] != '' && $domain['enabled'] != 'true') {
|
||||
echo " <span style='color: #aaa; font-size: 80%;'> (".$text['label-disabled'].")</span>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if (permission_exists('domain_edit')) {
|
||||
echo "<a href='".PROJECT_PATH."/core/domain_settings/domains.php?domain_uuid=".$domain_uuid."&domain_change=true'>".$text['label-manage']."</a>";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " <td valign='top' class='row_stylebg'>".$domain['description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('domain_edit')) {
|
||||
echo "<a href='domain_edit.php?id=".$domain_uuid."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
|
||||
}
|
||||
if (permission_exists('domain_delete')) {
|
||||
if ($_SESSION["groups"][0]["domain_uuid"] != $domain_uuid && count($domains) > 1) {
|
||||
echo "<a href='domain_delete.php?id=".$domain_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
|
||||
}
|
||||
else {
|
||||
echo "<span onclick=\"alert('You cannot delete your own domain.\\n\\nPlease login with a user account under a different domain, then try again.');\">".$v_link_label_delete."</span>";
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c == 0) ? 1 : 0;
|
||||
|
||||
$indent++;
|
||||
get_child_domains($domain_uuid);
|
||||
$indent--;
|
||||
global $c, $row_style, $text, $v_link_label_edit, $v_link_label_delete;
|
||||
foreach ($domains as $domain_uuid => $domain) {
|
||||
$tr_link = (permission_exists('domain_edit')) ? "href='domain_edit.php?id=".$domain_uuid."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' ".(($indent != 0) ? "style='padding-left: ".($indent * 20)."px;'" : null).">";
|
||||
echo " <a href='domain_edit.php?id=".$domain_uuid."'>".$domain['name']."</a>";
|
||||
if ($domain['enabled'] != '' && $domain['enabled'] != 'true') {
|
||||
echo " <span style='color: #aaa; font-size: 80%;'> (".$text['label-disabled'].")</span>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if (permission_exists('domain_edit')) {
|
||||
echo "<a href='".PROJECT_PATH."/core/domain_settings/domains.php?domain_uuid=".$domain_uuid."&domain_change=true'>".$text['label-manage']."</a>";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " <td valign='top' class='row_stylebg'>".$domain['description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('domain_edit')) {
|
||||
echo "<a href='domain_edit.php?id=".$domain_uuid."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
|
||||
}
|
||||
if (permission_exists('domain_delete')) {
|
||||
if ($_SESSION["groups"][0]["domain_uuid"] != $domain_uuid && count($domains) > 1) {
|
||||
echo "<a href='domain_delete.php?id=".$domain_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
|
||||
}
|
||||
else {
|
||||
echo "<span onclick=\"alert('You cannot delete your own domain.\\n\\nPlease login with a user account under a different domain, then try again.');\">".$v_link_label_delete."</span>";
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
$indent = 0;
|
||||
get_child_domains();
|
||||
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue