Default Setting - Edit: Add Clone button to duplicate setting.

This commit is contained in:
fusionate
2023-01-29 07:37:38 +00:00
parent eca0080b39
commit 5b3cd98a29
6 changed files with 170 additions and 0 deletions

View File

@@ -41,6 +41,9 @@
$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";

View File

@@ -301,6 +301,27 @@ $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'] = "";

View File

@@ -0,0 +1,86 @@
<?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));
?>

View File

@@ -273,7 +273,13 @@
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";

View File

@@ -539,6 +539,29 @@ $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?";
@@ -676,6 +699,29 @@ $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'] = "";

View File

@@ -2327,6 +2327,14 @@
$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'] = "814ed631-a315-4bde-a822-4038432ae2a6";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "keyboard_shortcut_check_all_enabled";