diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index b8edf49..33406c2 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -738,18 +738,31 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return array('status' => true, 'table_reload' => true, 'message' => 'HW is Delete ! '); } break; +// ------------- Create device tftp configuration case 'create_hw_tftp': $ver_id = ' Test !'; - $this->sccp_delete_device_XML('all'); // Концы в вводу !! - $this->sccp_create_tftp_XML(); - $models = $this->dbinterface->get_db_SccpTableData("SccpDevice"); + if (!empty($request['idn'])) { + $models = array(); + foreach ($request['idn'] as $idv) { + $this->sccp_delete_device_XML($idv); + $models []= array('name'=>$idv); + } + } else { + $this->sccp_delete_device_XML('all'); + $models = $this->dbinterface->get_db_SccpTableData("SccpDevice"); + } + + $this->sccp_create_tftp_XML(); // Default XML $ver_id = ' on found active model !'; //return array('status' => false, 'message' => 'Error :'. print_r($models,1)); foreach ($models as $data) { $ver_id = $this->sccp_create_device_XML($data['name']); }; -// !TODO!: -TODO-: Check SIP Suport Enabled - $this->sccp_create_xmlSoftkey(); // Create Softkey Sets for SIP + + if ($this->sccpvalues['siptftp']['data'] == 'on') { // Check SIP Suport Enabled + $this->sccp_create_xmlSoftkey(); // Create Softkey Sets for SIP + } + // !TODO!: -TODO-: Do these returned message strings work with i18n ? // !TODO!: It is necessary in the future to check, and replace all server responses on correct messages. Use _(msg) return array('status' => true, 'message' => 'Create new config files (version:' . $ver_id . ')'); diff --git a/Sccp_manager.inc/xmlinterface.class.php b/Sccp_manager.inc/xmlinterface.class.php index a828430..13ade6a 100644 --- a/Sccp_manager.inc/xmlinterface.class.php +++ b/Sccp_manager.inc/xmlinterface.class.php @@ -324,11 +324,16 @@ class xmlinterface { if (!empty($dev_config['addon'])) { $xnode = $xml_work->addChild('addOnModules'); $ti = 1; - foreach ($dev_config['addon_info'] as $add_key => $add_val) { - $xnode_obj = $xnode->addChild('addOnModule'); - $xnode_obj->addAttribute('idx', $ti); - $xnode_obj->addChild('loadInformation', $add_val); - $ti ++; + $hw_addon = explode(',', $dev_config['addon']); + foreach ($hw_addon as $add_key) { +// foreach ($dev_config['addon_info'] as $add_key => $add_val) { + if (!empty($dev_config['addon_info'][$add_key])) { + $add_val = $dev_config['addon_info'][$add_key]; + $xnode_obj = $xnode->addChild('addOnModule'); + $xnode_obj->addAttribute('idx', $ti); + $xnode_obj->addChild('loadInformation', $add_val); + $ti ++; + } } // $this->appendSimpleXmlNode($xml_work , $xnode_obj); } diff --git a/assets/js/sccp_manager.js b/assets/js/sccp_manager.js index 66de6e9..cc05be3 100644 --- a/assets/js/sccp_manager.js +++ b/assets/js/sccp_manager.js @@ -571,12 +571,29 @@ $(document).ready(function () { // ----------------------- form ---------------- if ($(this).data('id') === 'create-cnf') { var dev_cmd = 'create_hw_tftp'; + var datas = ''; + var i = 0; + $('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) { + datas = datas + 'idn[' + i + ']=' + entry['name'] + '&'; + i++; + }); + $('#table-sip').bootstrapTable('getSelections').forEach(function (entry) { + datas = datas + 'idn[' + i + ']=' + entry['name'] + '&'; + i++; + }); + console.log(datas); + } if ($(this).data('id') === 'delete_hardware') { var dev_cmd = $(this).data('id'); var datas = ''; var i = 0; - $('table').bootstrapTable('getSelections').forEach(function (entry) { +// $('table').bootstrapTable('getSelections').forEach(function (entry) { + $('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) { + datas = datas + 'idn[' + i + ']=' + entry['name'] + '&'; + i++; + }); + $('#table-sip').bootstrapTable('getSelections').forEach(function (entry) { datas = datas + 'idn[' + i + ']=' + entry['name'] + '&'; i++; }); @@ -599,10 +616,16 @@ $(document).ready(function () { if ($(this).data('id') === 'update_button_label') { conf_msg = 'Update Butons Labels on All device ?'; } - $('table').bootstrapTable('getSelections').forEach(function (entry) { +// $('table').bootstrapTable('getSelections').forEach(function (entry) { + $('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) { datas = datas + 'name[' + i + ']=' + entry['name'] + '&'; i++; }); + $('#table-sip').bootstrapTable('getSelections').forEach(function (entry) { + datas = datas + 'name[' + i + ']=' + entry['name'] + '&'; + i++; + }); + if (datas === '') { if (confirm(conf_msg)) { datas = 'name[0]=all'; diff --git a/views/hardware.phone.php b/views/hardware.phone.php index 998deff..2303cc0 100644 --- a/views/hardware.phone.php +++ b/views/hardware.phone.php @@ -31,7 +31,7 @@ - +