|
@@ -38,12 +38,13 @@
|
|
|
}
|
|
|
|
|
|
//set permissions
|
|
|
- $has_add = permission_exists('default_setting_add');
|
|
|
- $has_all = permission_exists('default_setting_all');
|
|
|
- $has_edit = permission_exists('default_setting_edit');
|
|
|
- $has_delete = permission_exists('default_setting_delete');
|
|
|
- $has_domain_select = permission_exists('domain_select');
|
|
|
- $has_domain_setting_add = permission_exists('domain_setting_add');
|
|
|
+ $permission = array();
|
|
|
+ $permission['default_setting_add'] = permission_exists('default_setting_add');
|
|
|
+ $permission['default_setting_all'] = permission_exists('default_setting_all');
|
|
|
+ $permission['default_setting_edit'] = permission_exists('default_setting_edit');
|
|
|
+ $permission['default_setting_delete'] = permission_exists('default_setting_delete');
|
|
|
+ $permission['domain_select'] = permission_exists('domain_select');
|
|
|
+ $permission['domain_setting_add'] = permission_exists('domain_setting_add');
|
|
|
|
|
|
//add multi-lingual support
|
|
|
$language = new text;
|
|
@@ -88,20 +89,20 @@
|
|
|
if (!empty($action) && !empty($default_settings)) {
|
|
|
switch ($action) {
|
|
|
case 'copy':
|
|
|
- if ($has_add) {
|
|
|
+ if ($permission['default_setting_add']) {
|
|
|
$obj = new default_settings;
|
|
|
$obj->domain_uuid = $domain_uuid;
|
|
|
$obj->copy($default_settings);
|
|
|
}
|
|
|
break;
|
|
|
case 'toggle':
|
|
|
- if ($has_edit) {
|
|
|
+ if ($permission['default_setting_edit']) {
|
|
|
$obj = new default_settings;
|
|
|
$obj->toggle($default_settings);
|
|
|
}
|
|
|
break;
|
|
|
case 'delete':
|
|
|
- if ($has_delete) {
|
|
|
+ if ($permission['default_setting_delete']) {
|
|
|
$obj = new default_settings;
|
|
|
$obj->delete($default_settings);
|
|
|
}
|
|
@@ -256,7 +257,7 @@
|
|
|
require_once "resources/header.php";
|
|
|
|
|
|
//copy settings javascript
|
|
|
- if ($has_domain_select && $has_domain_setting_add) {
|
|
|
+ if ($permission['domain_select'] && domain_setting_add) {
|
|
|
echo "<script language='javascript' type='text/javascript'>\n";
|
|
|
echo " function show_domains() {\n";
|
|
|
echo " document.getElementById('action').value = 'copy';\n";
|
|
@@ -282,11 +283,11 @@
|
|
|
echo " <div class='actions'>\n";
|
|
|
echo button::create(['type'=>'button','label'=>$text['label-domain'],'icon'=>$_SESSION['theme']['button_icon_domain'],'style'=>'','link'=>PROJECT_PATH.'/core/domain_settings/domain_settings.php?id='.$domain_uuid]);
|
|
|
echo button::create(['label'=>$text['button-reload'],'icon'=>$_SESSION['theme']['button_icon_reload'],'type'=>'button','id'=>'button_reload','link'=>'default_settings_reload.php'.(!empty($search) ? '?search='.urlencode($search) : null),'style'=>'margin-right: 15px;']);
|
|
|
- if ($has_add) {
|
|
|
+ if ($permission['default_setting_add']) {
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','link'=>'default_setting_edit.php?'.$query_string]);
|
|
|
}
|
|
|
- if ($has_add && !empty($default_settings)) {
|
|
|
- if ($has_domain_select && $has_domain_setting_add) {
|
|
|
+ if ($permission['default_setting_add'] && !empty($default_settings)) {
|
|
|
+ if ($permission['domain_select'] && domain_setting_add) {
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','onclick'=>'show_domains();']);
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-cancel'],'id'=>'btn_copy_cancel','icon'=>$_SESSION['theme']['button_icon_cancel'],'style'=>'display: none;','onclick'=>'hide_domains();']);
|
|
|
echo "<select name='domain_uuid' class='formfld' style='display: none; width: auto;' id='target_domain_uuid' onchange=\"document.getElementById('domain_uuid').value = this.options[this.selectedIndex].value;\">\n";
|
|
@@ -299,10 +300,10 @@
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-paste'],'icon'=>$_SESSION['theme']['button_icon_paste'],'id'=>'btn_paste','style'=>'display: none;','onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
|
|
}
|
|
|
}
|
|
|
- if ($has_edit && $default_settings) {
|
|
|
+ if ($permission['default_setting_edit'] && $default_settings) {
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
|
|
}
|
|
|
- if ($has_delete && $default_settings) {
|
|
|
+ if ($permission['default_setting_delete'] && $default_settings) {
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
|
|
}
|
|
|
echo "<form id='form_search' class='inline' method='get'>\n";
|
|
@@ -329,10 +330,10 @@
|
|
|
echo " <div style='clear: both;'></div>\n";
|
|
|
echo "</div>\n";
|
|
|
|
|
|
- if ($has_edit && $default_settings) {
|
|
|
+ if ($permission['default_setting_edit'] && $default_settings) {
|
|
|
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
|
|
}
|
|
|
- if ($has_delete && $default_settings) {
|
|
|
+ if ($permission['default_setting_delete'] && $default_settings) {
|
|
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
|
|
}
|
|
|
|
|
@@ -413,12 +414,12 @@
|
|
|
|
|
|
echo "<table class='list'>\n";
|
|
|
echo "<tr class='list-header'>\n";
|
|
|
- if ($has_add || $has_edit || $has_delete) {
|
|
|
+ if ($permission['default_setting_add'] || $permission['default_setting_edit'] || $permission['default_setting_delete']) {
|
|
|
echo " <th class='checkbox'>\n";
|
|
|
echo " <input type='checkbox' id='checkbox_all_".$default_setting_category."' name='checkbox_all' onclick=\"list_all_toggle('".$default_setting_category."'); checkbox_on_change(this);\">\n";
|
|
|
echo " </th>\n";
|
|
|
}
|
|
|
- if ($show == 'all' && $has_all) {
|
|
|
+ if ($show == 'all' && $permission['default_setting_all']) {
|
|
|
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
|
|
}
|
|
|
echo th_order_by('default_setting_subcategory', $text['label-subcategory'], $order_by, $order, null, "class='pct-35'");
|
|
@@ -426,26 +427,26 @@
|
|
|
echo th_order_by('default_setting_value', $text['label-value'], $order_by, $order, null, "class='pct-30'");
|
|
|
echo th_order_by('default_setting_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
|
|
|
echo " <th class='pct-25 hide-sm-dn'>".$text['label-description']."</th>\n";
|
|
|
- if ($has_edit && $list_row_edit_button == 'true') {
|
|
|
+ if ($permission['default_setting_edit'] && $list_row_edit_button == 'true') {
|
|
|
echo " <td class='action-button'> </td>\n";
|
|
|
}
|
|
|
echo "</tr>\n";
|
|
|
}
|
|
|
- if ($has_edit) {
|
|
|
+ if ($permission['default_setting_edit']) {
|
|
|
$list_row_url = "default_setting_edit.php?id=".urlencode($row['default_setting_uuid']).'&'.$query_string;
|
|
|
}
|
|
|
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
|
|
- if ($has_add || $has_edit || $has_delete) {
|
|
|
+ if ($permission['default_setting_add'] || $permission['default_setting_edit'] || $permission['default_setting_delete']) {
|
|
|
echo " <td class='checkbox'>\n";
|
|
|
echo " <input type='checkbox' name='default_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_".$default_setting_category."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all_".$default_setting_category."').checked = false; }\">\n";
|
|
|
echo " <input type='hidden' name='default_settings[$x][uuid]' value='".escape($row['default_setting_uuid'])."' />\n";
|
|
|
echo " </td>\n";
|
|
|
}
|
|
|
- if ($show == 'all' && $has_all) {
|
|
|
+ if ($show == 'all' && $permission['default_setting_all']) {
|
|
|
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
|
|
}
|
|
|
echo " <td class='overflow no-wrap'>";
|
|
|
- if ($has_edit) {
|
|
|
+ if ($permission['default_setting_edit']) {
|
|
|
echo "<a href='".$list_row_url."'>".escape($row['default_setting_subcategory'])."</a>";
|
|
|
}
|
|
|
else {
|
|
@@ -556,7 +557,7 @@
|
|
|
}
|
|
|
}
|
|
|
echo " </td>\n";
|
|
|
- if ($has_edit) {
|
|
|
+ if ($permission['default_setting_edit']) {
|
|
|
echo " <td class='no-link center'>\n";
|
|
|
if (!empty($enabled_bold)) {
|
|
|
echo button::create(['type'=>'submit','class'=>'link','style'=>'font-weight:bold', 'label'=>$text['label-'.$row['default_setting_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
|
@@ -571,7 +572,7 @@
|
|
|
}
|
|
|
echo " </td>\n";
|
|
|
echo " <td class='description overflow hide-sm-dn' title=\"".escape($row['default_setting_description'])."\">".escape($row['default_setting_description'])."</td>\n";
|
|
|
- if ($has_edit && $list_row_edit_button == 'true') {
|
|
|
+ if ($permission['default_setting_edit'] && $list_row_edit_button == 'true') {
|
|
|
echo " <td class='action-button'>\n";
|
|
|
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
|
|
echo " </td>\n";
|