- Bug Fix. Create addons information

This commit is contained in:
PhantomVl 2019-10-14 18:01:16 +03:00
parent 2faf6e1200
commit e2761e5bdd
4 changed files with 54 additions and 13 deletions

View file

@ -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 . ')');

View file

@ -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);
}

View file

@ -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';

View file

@ -31,7 +31,7 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sip" data-id="mac">
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sccp" data-id="mac">
<thead>
<tr>
<th data-checkbox="true"></th>