Domains: Add front end to set domain status, and assign a parent domain.
This commit is contained in:
parent
1b53a059bc
commit
10ef66986b
|
|
@ -68,10 +68,22 @@
|
|||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_parent_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_name";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the domain name.";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_enabled";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Set the status of the domain.";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_description";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the description.";
|
||||
|
|
@ -90,6 +102,8 @@
|
|||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_setting_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
|
|
|
|||
|
|
@ -34,4 +34,14 @@
|
|||
//unset($sql);
|
||||
}
|
||||
|
||||
//proccess this only one time
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//set domains with enabled status of empty or null to true
|
||||
$sql = "update v_domains set domain_enabled = 'true' where domain_enabled = '' or domain_enabled is null";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -170,10 +170,10 @@
|
|||
$text['label-enabled']['pt-pt'] = "Habilitado";
|
||||
$text['label-enabled']['fr-fr'] = "Actif";
|
||||
|
||||
$text['description-enabled']['en-us'] = "Set the status of this default setting.";
|
||||
$text['description-enabled']['es-cl'] = "Configure el estado de esta configuración predeterminada.";
|
||||
$text['description-enabled']['pt-pt'] = "Escolha o estado desta definição por omissão.";
|
||||
$text['description-enabled']['fr-fr'] = "Choisir l'état de ce paramètre";
|
||||
$text['description-setting_enabled']['en-us'] = "Set the status of this default setting.";
|
||||
$text['description-setting_enabled']['es-cl'] = "Configure el estado de esta configuración predeterminada.";
|
||||
$text['description-setting_enabled']['pt-pt'] = "Escolha o estado desta definição por omissão.";
|
||||
$text['description-setting_enabled']['fr-fr'] = "Choisir l'état de ce paramètre";
|
||||
|
||||
$text['label-description']['en-us'] = "Description";
|
||||
$text['label-description']['es-cl'] = "Descripción";
|
||||
|
|
@ -270,4 +270,24 @@
|
|||
$text['message-required']['pt-pt'] = "Por favor indique: ";
|
||||
$text['message-required']['fr-fr'] = "Merci d'indiquer: ";
|
||||
|
||||
$text['description-domain_enabled']['en-us'] = "Set the status of the domain.";
|
||||
$text['description-domain_enabled']['es-cl'] = "Ajuste el estado del dominio.";
|
||||
$text['description-domain_enabled']['pt-pt'] = "Definir o estado do domínio.";
|
||||
$text['description-domain_enabled']['fr-fr'] = "Régler le statut du domaine.";
|
||||
|
||||
$text['label-parent_domain']['en-us'] = "Parent Domain";
|
||||
$text['label-parent_domain']['es-cl'] = "Dominio de los Padres";
|
||||
$text['label-parent_domain']['pt-pt'] = "Domínio Parent";
|
||||
$text['label-parent_domain']['fr-fr'] = "Domaine Parent";
|
||||
|
||||
$text['description-parent_domain']['en-us'] = "Set the parent domain.";
|
||||
$text['description-parent_domain']['es-cl'] = "Establecer el dominio principal.";
|
||||
$text['description-parent_domain']['pt-pt'] = "Defina o domínio pai.";
|
||||
$text['description-parent_domain']['fr-fr'] = "Réglez le domaine parent.";
|
||||
|
||||
$text['label-disabled']['en-us'] = "Disabled";
|
||||
$text['label-disabled']['es-cl'] = "Discapacitado";
|
||||
$text['label-disabled']['pt-pt'] = "Inválido";
|
||||
$text['label-disabled']['fr-fr'] = "Non Permis";
|
||||
|
||||
?>
|
||||
|
|
@ -50,7 +50,11 @@ else {
|
|||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
$domain_name = strtolower(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) {
|
||||
|
|
@ -80,7 +84,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('domain_add')) {
|
||||
$sql = "select count(*) as num_rows from v_domains ";
|
||||
$sql .= "where domain_name = '$domain_name' ";
|
||||
$sql .= "where domain_name = '".$domain_name."' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
|
|
@ -90,13 +94,17 @@ 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 .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_name', ";
|
||||
$sql .= "'$domain_description' ";
|
||||
$sql .= "'".$domain_name."', ";
|
||||
$sql .= $domain_parent_uuid.", ";
|
||||
$sql .= "'".$domain_enabled."', ";
|
||||
$sql .= "'".$domain_description."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
|
@ -120,6 +128,8 @@ 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."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
|
|
@ -550,6 +560,8 @@ 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"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
|
@ -565,16 +577,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
}
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>";
|
||||
echo "<td align='left' valign='top' width='30%' nowrap='nowrap'><b>";
|
||||
if ($action == "update") {
|
||||
echo $text['header-domain-edit'];
|
||||
}
|
||||
|
|
@ -582,7 +588,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo $text['header-domain-add'];
|
||||
}
|
||||
echo "</b></td>\n";
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
echo "<td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='domains.php'\" value='".$text['button-back']."'>\n";
|
||||
if (permission_exists('domain_export')) {
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-export']."' onclick=\"window.location='".PROJECT_PATH."/app/domain_export/index.php?id=".$domain_uuid."'\" value='".$text['button-export']."'>\n";
|
||||
|
|
@ -604,10 +610,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-name'].":\n";
|
||||
echo " ".$text['label-name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value=\"$domain_name\">\n";
|
||||
echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value=\"".$domain_name."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-name']."\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -615,33 +621,83 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-description'].":\n";
|
||||
echo " ".$text['label-parent_domain']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_description' maxlength='255' value=\"$domain_description\">\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";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='domain_enabled'>\n";
|
||||
echo " <option value='true' ".(($domain_enabled == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".(($domain_enabled == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-domain_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_description' maxlength='255' value=\"".$domain_description."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " <br />";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
if ($action == "update") {
|
||||
echo "<br /><br />";
|
||||
require "domain_settings.php";
|
||||
}
|
||||
echo " <br /><br /><br />";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
|
|
|||
|
|
@ -267,17 +267,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
}
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>";
|
||||
echo "<td align='left' valign='top' width='30%' nowrap='nowrap'><b>";
|
||||
if ($action == "update") {
|
||||
echo $text['header-domain_setting-edit'];
|
||||
}
|
||||
|
|
@ -285,7 +278,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo $text['header-domain_setting-add'];
|
||||
}
|
||||
echo "</b></td>\n";
|
||||
echo "<td width='70%' align='right'>";
|
||||
echo "<td width='70%' align='right' valign='top'>";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='domain_edit.php?id=$domain_uuid'\" value='".$text['button-back']."'>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -547,7 +540,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-enabled']."\n";
|
||||
echo $text['description-setting_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -564,21 +557,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='domain_setting_uuid' value='$domain_setting_uuid'>\n";
|
||||
echo " <input type='hidden' name='domain_setting_uuid' value='$domain_setting_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " <br />";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
|
@ -98,11 +98,6 @@ if (sizeof($_REQUEST) > 1) {
|
|||
echo "<input type='hidden' name='action' id='action' value=''>";
|
||||
echo "<input type='hidden' name='domain_uuid' value='".$domain_uuid."'>";
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
|
|
@ -148,7 +143,6 @@ if (sizeof($_REQUEST) > 1) {
|
|||
$row_style["1"] = "row_style1";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
|
|
@ -158,8 +152,9 @@ if (sizeof($_REQUEST) > 1) {
|
|||
$c = 0;
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan='7' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
if ($previous_category != '') {
|
||||
echo " <br /><br />\n";
|
||||
}
|
||||
echo " <b>\n";
|
||||
if (strtolower($row['domain_setting_category']) == "cdr") {
|
||||
echo " CDR";
|
||||
|
|
@ -290,15 +285,6 @@ if (sizeof($_REQUEST) > 1) {
|
|||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
echo "<br /><br />";
|
||||
|
|
|
|||
|
|
@ -103,26 +103,19 @@ else {
|
|||
$order = check_str($_GET["order"]);
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
//show the header and the search
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-domains']."</b></td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td width='50%' align='right'>\n";
|
||||
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'><b>".$text['header-domains']."</b></td>\n";
|
||||
echo " <td width='50%' align='right' valign='top'>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </form>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " <td align='left' valign='top' colspan='2'>\n";
|
||||
echo " ".$text['description-domains']."<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
|
@ -136,7 +129,6 @@ else {
|
|||
$sql .= " or domain_description like '%".$search."%' ";
|
||||
$sql .= ") ";
|
||||
}
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
|
|
@ -169,20 +161,25 @@ else {
|
|||
$sql .= "order by domain_name asc ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_by $order ";
|
||||
$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->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
foreach ($result as $domain) {
|
||||
$domains[$domain['domain_uuid']]['name'] = $domain['domain_name'];
|
||||
$domains[$domain['domain_uuid']]['parent_uuid'] = $domain['domain_parent_uuid'];
|
||||
$domains[$domain['domain_uuid']]['enabled'] = $domain['domain_enabled'];
|
||||
$domains[$domain['domain_uuid']]['description'] = $domain['domain_description'];
|
||||
}
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
|
|
@ -195,36 +192,54 @@ else {
|
|||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$tr_link = (permission_exists('domain_edit')) ? "href='domain_edit.php?id=".$row['domain_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
echo " <a href='domain_edit.php?id=".$row['domain_uuid']."'>".$row['domain_name']."</a>";
|
||||
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=".$row['domain_uuid']."&domain_change=true'>".$text['label-manage']."</a>";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " <td valign='top' class='row_stylebg'>".$row['domain_description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('domain_edit')) {
|
||||
echo "<a href='domain_edit.php?id=".$row['domain_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('domain_delete')) {
|
||||
if ($_SESSION["groups"][0]["domain_uuid"] != $row['domain_uuid'] && $result_count > 1) {
|
||||
echo "<a href='domain_delete.php?id=".$row['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>";
|
||||
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--;
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
}
|
||||
|
||||
$indent = 0;
|
||||
get_child_domains();
|
||||
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
|
|
@ -244,14 +259,6 @@ else {
|
|||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
|
|
|
|||
Loading…
Reference in New Issue