Domain Edit: Add delete button.

This commit is contained in:
Nate
2019-12-16 13:32:27 -07:00
parent 843e3d3c01
commit 5056e7ba4f
3 changed files with 55 additions and 16 deletions

View File

@@ -767,6 +767,26 @@ $text['header-domain_settings']['ru-ru'] = "Настройки домена";
$text['header-domain_settings']['sv-se'] = "Domän Inställning";
$text['header-domain_settings']['uk-ua'] = "Налаштування домену";
$text['header_description-domain_settings']['en-us'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['ar-eg'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['de-at'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['de-ch'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['de-de'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['es-cl'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['es-mx'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['fr-ca'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['fr-fr'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['he-il'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['it-it'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['nl-nl'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['pl-pl'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['pt-br'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['pt-pt'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['ro-ro'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['ru-ru'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['sv-se'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header_description-domain_settings']['uk-ua'] = "Settings for this domain that should override those defined in Default Settings.";
$text['header-domain_setting-edit']['en-us'] = "Domain Setting";
$text['header-domain_setting-edit']['ar-eg'] = "";
$text['header-domain_setting-edit']['de-at'] = "Domain Einstellungen"; //copied from de-de

View File

@@ -74,6 +74,21 @@
$domain_uuid = $_POST["domain_uuid"];
}
//delete the domain
if (permission_exists('domain_delete')) {
if ($_POST['action'] == 'delete' && is_uuid($domain_uuid)) {
//prepare
$array[0]['checked'] = 'true';
$array[0]['uuid'] = $domain_uuid;
//delete
$obj = new domains;
$obj->delete($array);
//redirect
header('Location: domains.php');
exit;
}
}
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
@@ -574,7 +589,8 @@
}
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<form method='post' id='frm' action=''>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' width='30%' nowrap='nowrap'><b>";
@@ -587,20 +603,23 @@
echo "</b></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
if (permission_exists('domain_add')) { //only for superadmin, not admin editing their own domain
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='domains.php'\" value='".$text['button-back']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'domains.php']);
}
if (permission_exists("domain_select") && is_array($_SESSION['domains']) && @sizeof($_SESSION['domains']) > 1) {
echo " <select id='domains' class='formfld' style='width: auto; margin-right: 15px;' onchange=\"window.location.href='?id=' + document.getElementById('domains').options[document.getElementById('domains').selectedIndex].value;\">\n";
echo "<select id='domains' class='formfld' style='width: auto;' onchange=\"window.location.href='?id=' + document.getElementById('domains').options[document.getElementById('domains').selectedIndex].value;\">\n";
foreach ($_SESSION['domains'] as $domain) {
$selected = $domain["domain_uuid"] == $domain_uuid ? "selected='selected'" : null;
echo " <option value='".escape($domain["domain_uuid"])."' ".$selected.">".escape($domain["domain_name"])."</option>\n";
echo " <option value='".escape($domain["domain_uuid"])."' ".$selected.">".escape($domain["domain_name"])."</option>\n";
}
echo " </select>\n";
echo "</select>";
}
if (permission_exists('domain_delete') && is_array($_SESSION['domains']) && @sizeof($_SESSION['domains']) > 1 && $domain_uuid != $_SESSION['domain_uuid']) {
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'action','value'=>'delete','style'=>'margin-left: 15px;','onclick'=>"if (confirm('".$text['confirm-delete']."')) { document.getElementById('frm').submit(); } else { this.blur(); return false; }"]);
}
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=".escape($domain_uuid)."'\" value='".$text['button-export']."'>\n";
echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'link'=>PROJECT_PATH."/app/domain_export/index.php?id=".escape($domain_uuid)]);
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'style'=>'margin-left: 15px;']);
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";

View File

@@ -184,15 +184,15 @@
if (permission_exists('domain_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'domain_edit.php']);
}
if (permission_exists('domain_copy') && $domains) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
// if (permission_exists('domain_copy') && $domains) {
// echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
// }
if (permission_exists('domain_edit') && $domains) {
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
if (permission_exists('domain_delete') && $domains) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}
// if (permission_exists('domain_delete') && $domains) {
// echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
// }
echo "<form id='form_search' class='inline' method='get'>\n";
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
@@ -214,7 +214,7 @@
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('domain_add') || permission_exists('domain_edit') || permission_exists('domain_delete')) {
if (permission_exists('domain_edit') || permission_exists('domain_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($domains ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
@@ -237,7 +237,7 @@
$list_row_url = "domain_edit.php?id=".urlencode($row['domain_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('domain_add') || permission_exists('domain_edit') || permission_exists('domain_delete')) {
if (permission_exists('domain_edit') || permission_exists('domain_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='domains[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='domains[$x][uuid]' value='".escape($row['domain_uuid'])."' />\n";
@@ -284,4 +284,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>