Default Settings - Copy: Move function to list view and use copy method in class.
This commit is contained in:
parent
d04b6db96a
commit
6bc1e53244
|
|
@ -41,9 +41,6 @@
|
|||
$apps[$x]['permissions'][$y]['name'] = "default_setting_edit";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "default_setting_clone";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "default_setting_delete";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
|
||||
|
|
|
|||
|
|
@ -301,27 +301,6 @@ $text['message-toggled']['ru-ru'] = "Переключить выполнено";
|
|||
$text['message-toggled']['sv-se'] = "Växla Avslutade";
|
||||
$text['message-toggled']['uk-ua'] = "переключити Завершений";
|
||||
|
||||
$text['message-cloned']['en-us'] = "Setting Cloned";
|
||||
$text['message-cloned']['en-gb'] = "Setting Cloned";
|
||||
$text['message-cloned']['ar-eg'] = "Setting Cloned";
|
||||
$text['message-cloned']['de-at'] = "Setting Cloned";
|
||||
$text['message-cloned']['de-ch'] = "Setting Cloned";
|
||||
$text['message-cloned']['de-de'] = "Setting Cloned";
|
||||
$text['message-cloned']['es-cl'] = "Setting Cloned";
|
||||
$text['message-cloned']['es-mx'] = "Setting Cloned";
|
||||
$text['message-cloned']['fr-ca'] = "Setting Cloned";
|
||||
$text['message-cloned']['fr-fr'] = "Setting Cloned";
|
||||
$text['message-cloned']['he-il'] = "Setting Cloned";
|
||||
$text['message-cloned']['it-it'] = "Setting Cloned";
|
||||
$text['message-cloned']['nl-nl'] = "Setting Cloned";
|
||||
$text['message-cloned']['pl-pl'] = "Setting Cloned";
|
||||
$text['message-cloned']['pt-br'] = "Setting Cloned";
|
||||
$text['message-cloned']['pt-pt'] = "Setting Cloned";
|
||||
$text['message-cloned']['ro-ro'] = "Setting Cloned";
|
||||
$text['message-cloned']['ru-ru'] = "Setting Cloned";
|
||||
$text['message-cloned']['sv-se'] = "Setting Cloned";
|
||||
$text['message-cloned']['uk-ua'] = "Setting Cloned";
|
||||
|
||||
$text['message-settings_reloaded']['en-us'] = "Settings Reloaded";
|
||||
$text['message-settings_reloaded']['en-gb'] = "Settings Reloaded";
|
||||
$text['message-settings_reloaded']['ar-eg'] = "";
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//set the include path
|
||||
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
||||
set_include_path(parse_ini_file($conf[0])['document.root']);
|
||||
|
||||
//includes files
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('default_setting_clone')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get submitted variables
|
||||
$search = $_REQUEST['search'];
|
||||
$default_setting_uuid = $_REQUEST["id"];
|
||||
|
||||
//clone the setting
|
||||
if (is_uuid($default_setting_uuid)) {
|
||||
//get current setting
|
||||
$sql = "select * from v_default_settings where default_setting_uuid = :default_setting_uuid ";
|
||||
$parameters['default_setting_uuid'] = $default_setting_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//override old values
|
||||
$default_setting_uuid = uuid();
|
||||
$row['default_setting_uuid'] = $default_setting_uuid;
|
||||
$row['insert_date'] = 'now()';
|
||||
$row['insert_user'] = 'user_uuid()';
|
||||
$row['update_date'] = null;
|
||||
$row['update_user'] = null;
|
||||
|
||||
//set new status
|
||||
$array['default_settings'][0] = $row;
|
||||
$database = new database;
|
||||
$database->app_name = 'default_settings';
|
||||
$database->app_uuid = '2c2453c0-1bea-4475-9f44-4d969650de09';
|
||||
$database->save($array);
|
||||
$message = $database->message;
|
||||
unset($array);
|
||||
|
||||
}
|
||||
|
||||
$_SESSION["message"] = $text['message-cloned'];
|
||||
|
||||
//redirect the user
|
||||
$search = preg_replace('#[^a-zA-Z0-9_\-\.]# ', '', $search);
|
||||
header("Location: default_setting_edit.php?id=".$default_setting_uuid."".($search != '' ? '&search='.$search : null));
|
||||
|
||||
?>
|
||||
|
|
@ -273,13 +273,7 @@
|
|||
echo " </div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'default_settings.php?'.$query_string]);
|
||||
if (permission_exists('default_setting_clone') && $action == "update") {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-clone'],'icon'=>$_SESSION['theme']['button_icon_clone'],'name'=>'btn_clone','style'=>'margin-right: 15px;','onclick'=>"modal_open('modal-clone','btn_clone');"]);
|
||||
}
|
||||
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','onclick'=>'submit_form();']);
|
||||
if (permission_exists('default_setting_clone') && $action == "update") {
|
||||
echo modal::create(['id'=>'modal-clone','type'=>'general','message'=>$text['confirm-clone'],'actions'=>button::create(['type'=>'button','label'=>$text['button-clone'],'icon'=>'clone','id'=>'btn_clone','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); window.location.href='default_setting_clone.php?id=".$default_setting_uuid."'"])]);
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
|
|
|||
|
|
@ -275,7 +275,8 @@
|
|||
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";
|
||||
echo " <option value=''>".$text['label-domain']."...</option>\n";
|
||||
echo " <option value=''>(".$text['label-duplicate'].")</option>\n";
|
||||
echo " <option value='' disabled='disabled'>".$text['label-domain']."...</option>\n";
|
||||
foreach ($_SESSION['domains'] as $domain) {
|
||||
echo " <option value='".escape($domain["domain_uuid"])."'>".escape($domain["domain_name"])."</option>\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ if (!class_exists('default_settings')) {
|
|||
}
|
||||
|
||||
//copy settings
|
||||
if (is_uuid($this->domain_uuid) && is_array($uuids) && sizeof($uuids) > 0) {
|
||||
if (is_array($uuids) && sizeof($uuids) > 0) {
|
||||
$settings_copied = 0;
|
||||
foreach ($uuids as $x => $uuid) {
|
||||
|
||||
|
|
@ -233,6 +233,7 @@ if (!class_exists('default_settings')) {
|
|||
$default_setting_order = $row["default_setting_order"];
|
||||
$default_setting_enabled = $row["default_setting_enabled"];
|
||||
$default_setting_description = $row["default_setting_description"];
|
||||
$default_setting = $row; // all values
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
|
|
@ -241,6 +242,9 @@ if (!class_exists('default_settings')) {
|
|||
$default_setting_value = generate_password();
|
||||
}
|
||||
|
||||
//copy to domain
|
||||
if (is_uuid($this->domain_uuid)) {
|
||||
|
||||
// check if exists
|
||||
$sql = "select domain_setting_uuid from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
|
|
@ -293,6 +297,32 @@ if (!class_exists('default_settings')) {
|
|||
$settings_copied++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//duplicate default setting
|
||||
else {
|
||||
|
||||
//populate and adjust array
|
||||
$array['default_settings'][$x] = $default_setting;
|
||||
$array['default_settings'][$x]['default_setting_uuid'] = uuid();
|
||||
$array['default_settings'][$x]['default_setting_description'] .= ' (Copy)';
|
||||
unset($array['default_settings'][$x]['insert_date']);
|
||||
unset($array['default_settings'][$x]['insert_user']);
|
||||
unset($array['default_settings'][$x]['update_date']);
|
||||
unset($array['default_settings'][$x]['update_user']);
|
||||
|
||||
//execute
|
||||
$database = new database;
|
||||
$database->app_name = $this->table;
|
||||
$database->app_uuid = $this->app_uuid;
|
||||
$database->save($array);
|
||||
$message = $database->message;
|
||||
unset($array);
|
||||
|
||||
$settings_copied++;
|
||||
|
||||
}
|
||||
|
||||
} // foreach
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -539,29 +539,6 @@ $text['confirm-copy']['sv-se'] = "Vill du verkligen kopiera detta?";
|
|||
$text['confirm-copy']['uk-ua'] = "";
|
||||
$text['confirm-copy']['tr-tr'] = "Bunu gerçekten kopyalamak istiyor musunuz?";
|
||||
|
||||
$text['confirm-clone']['en-us'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['en-gb'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['ar-eg'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['de-at'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['de-ch'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['de-de'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['el-gr'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['es-cl'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['es-mx'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['fr-ca'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['fr-fr'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['he-il'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['it-it'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['nl-nl'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['pl-pl'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['pt-br'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['pt-pt'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['ro-ro'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['ru-ru'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['sv-se'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['uk-ua'] = "Do you really want to CLONE this?";
|
||||
$text['confirm-clone']['tr-tr'] = "Do you really want to CLONE this?";
|
||||
|
||||
$text['confirm-toggle']['en-us'] = "Do you really want to TOGGLE this?";
|
||||
$text['confirm-toggle']['en-gb'] = "Do you really want to TOGGLE this?";
|
||||
$text['confirm-toggle']['ar-eg'] = "Do you really want to TOGGLE this?";
|
||||
|
|
@ -699,29 +676,6 @@ $text['button-clear']['sv-se'] = "Rensa";
|
|||
$text['button-clear']['uk-ua'] = "";
|
||||
$text['button-clear']['tr-tr'] = "Temizle";
|
||||
|
||||
$text['button-clone']['en-us'] = "Clone";
|
||||
$text['button-clone']['en-gb'] = "Clone";
|
||||
$text['button-clone']['ar-eg'] = "Clone";
|
||||
$text['button-clone']['de-at'] = "Clone";
|
||||
$text['button-clone']['de-ch'] = "Clone";
|
||||
$text['button-clone']['de-de'] = "Clone";
|
||||
$text['button-clone']['el-gr'] = "Clone";
|
||||
$text['button-clone']['es-cl'] = "Clone";
|
||||
$text['button-clone']['es-mx'] = "Clone";
|
||||
$text['button-clone']['fr-ca'] = "Clone";
|
||||
$text['button-clone']['fr-fr'] = "Clone";
|
||||
$text['button-clone']['he-il'] = "Clone";
|
||||
$text['button-clone']['it-it'] = "Clone";
|
||||
$text['button-clone']['nl-nl'] = "Clone";
|
||||
$text['button-clone']['pl-pl'] = "Clone";
|
||||
$text['button-clone']['pt-br'] = "Clone";
|
||||
$text['button-clone']['pt-pt'] = "Clone";
|
||||
$text['button-clone']['ro-ro'] = "Clone";
|
||||
$text['button-clone']['ru-ru'] = "Clone";
|
||||
$text['button-clone']['sv-se'] = "Clone";
|
||||
$text['button-clone']['uk-ua'] = "Clone";
|
||||
$text['button-clone']['tr-tr'] = "Clone";
|
||||
|
||||
$text['button-close']['en-us'] = "Close";
|
||||
$text['button-close']['en-gb'] = "Close";
|
||||
$text['button-close']['ar-eg'] = "";
|
||||
|
|
@ -3372,6 +3326,29 @@ $text['label-copy']['sv-se'] = "Kopiera";
|
|||
$text['label-copy']['uk-ua'] = "Копіювати";
|
||||
$text['label-copy']['tr-tr'] = "Kopyala";
|
||||
|
||||
$text['label-duplicate']['en-us'] = "Duplicate";
|
||||
$text['label-duplicate']['en-gb'] = "Duplicate";
|
||||
$text['label-duplicate']['ar-eg'] = "";
|
||||
$text['label-duplicate']['de-at'] = "Kopieren"; //copied from de-de
|
||||
$text['label-duplicate']['de-ch'] = "Kopieren"; //copied from de-de
|
||||
$text['label-duplicate']['de-de'] = "Kopieren";
|
||||
$text['label-duplicate']['el-gr'] = "Αντιγραφή";
|
||||
$text['label-duplicate']['es-cl'] = "Copiar";
|
||||
$text['label-duplicate']['es-mx'] = "Copiar"; //copied from es-cl
|
||||
$text['label-duplicate']['fr-ca'] = "Copier"; //copied from fr-fr
|
||||
$text['label-duplicate']['fr-fr'] = "Copier";
|
||||
$text['label-duplicate']['he-il'] = "העתק";
|
||||
$text['label-duplicate']['it-it'] = "Copia";
|
||||
$text['label-duplicate']['nl-nl'] = "";
|
||||
$text['label-duplicate']['pl-pl'] = "Kopiuj";
|
||||
$text['label-duplicate']['pt-br'] = "Copiar"; //copied from pt-pt
|
||||
$text['label-duplicate']['pt-pt'] = "Copiar";
|
||||
$text['label-duplicate']['ro-ro'] = "";
|
||||
$text['label-duplicate']['ru-ru'] = "Копировать";
|
||||
$text['label-duplicate']['sv-se'] = "Kopiera";
|
||||
$text['label-duplicate']['uk-ua'] = "Копіювати";
|
||||
$text['label-duplicate']['tr-tr'] = "Kopyala";
|
||||
|
||||
$text['label-all']['en-us'] = "All";
|
||||
$text['label-all']['en-gb'] = "All";
|
||||
$text['label-all']['ar-eg'] = "الكل";
|
||||
|
|
|
|||
|
|
@ -2327,14 +2327,6 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "4323a528-06f4-4550-9b9b-3190c8325958";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_clone";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-clone";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "75424d2d-cb7d-4469-9269-7cb814e863b8";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_expand";
|
||||
|
|
|
|||
Loading…
Reference in New Issue