Fix update button labels

Convert modal responses to Toast
Correct reload parameters to stay on page and redraw table
Correct output text
This commit is contained in:
steve-lad 2021-06-14 15:19:45 +02:00
parent d7bc3e500b
commit 707371cb92
3 changed files with 10 additions and 9 deletions

View file

@ -1182,7 +1182,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$buton_list = $this->dbinterface->HWextension_db_SccpTableData("get_sccpdevice_buttons", array('buttontype' => 'speeddial')); $buton_list = $this->dbinterface->HWextension_db_SccpTableData("get_sccpdevice_buttons", array('buttontype' => 'speeddial'));
} }
if (empty($buton_list)) { if (empty($buton_list)) {
return array('Response' => ' Found 0 device ', 'data' => ''); return array('Response' => ' 0 buttons found ', 'data' => '');
} }
$copy_fld = array('ref', 'reftype', 'instance', 'buttontype'); $copy_fld = array('ref', 'reftype', 'instance', 'buttontype');
$user_list = $user_list = $this->dbinterface->get_db_SccpTableByID("SccpExtension", array(), 'name'); $user_list = $user_list = $this->dbinterface->get_db_SccpTableByID("SccpExtension", array(), 'name');

View file

@ -586,7 +586,7 @@ $(document).ready(function () {
conf_msg = 'Reset Token on All device ?'; conf_msg = 'Reset Token on All device ?';
} }
if ($(this).data('id') === 'update_button_label') { if ($(this).data('id') === 'update_button_label') {
conf_msg = 'Update Butons Labels on All device ?'; conf_msg = 'Update Button Labels on ALL devices ?';
} }
$('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) { $('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'name[' + i + ']=' + entry['name'] + '&'; datas = datas + 'name[' + i + ']=' + entry['name'] + '&';
@ -615,14 +615,15 @@ $(document).ready(function () {
success: function (data) { success: function (data) {
// console.log(data); // console.log(data);
if (data.status === true) { if (data.status === true) {
if (data.message) {
var old_style = bs_alert(data.message, data.status,data.reload);
}
if (data.table_reload === true) { if (data.table_reload === true) {
$('table').bootstrapTable('refresh'); $('table').bootstrapTable('refresh');
} }
if (data.reload === true && old_style === true) { if (data.message) {
location.reload(); fpbxToast(data.message,_('Operation Result'), 'success');
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
}
} }
} else { } else {
if (Array.isArray(data.message)) { if (Array.isArray(data.message)) {

View file

@ -185,8 +185,8 @@ trait ajaxHelper {
} }
} }
$res = $this->updateSccpButtons($hw_list); $res = $this->updateSccpButtons($hw_list);
$msg .= $res['Response'] . ' raw: ' . $res['data'] . ' '; $msg .= $res['Response'] . (empty($res['data']) ? '' : ' raw data: ' . $res['data'] . ' ');
return array('status' => true, 'message' => 'Update Butons Labels Complite ' . $msg, 'reload' => true); return array('status' => true, 'message' => 'Update Buttons Labels Complete: ' . $msg, 'reload' => false, 'table_reload' => true);
case 'model_add': case 'model_add':
$save_settings = array(); $save_settings = array();
$key_name = array('model', 'vendor', 'dns', 'buttons', 'loadimage', 'loadinformationid', 'nametemplate'); $key_name = array('model', 'vendor', 'dns', 'buttons', 'loadimage', 'loadinformationid', 'nametemplate');