Disable Inherit in default system button settings

Disable Inherit buttons in system defaults (should only be used for specific devices)

Add Device Vendor settings to Add Device (WIP - may need db change)

Change various names to be more readable
This commit is contained in:
steve-lad 2021-06-15 17:56:37 +02:00
parent 92ef25bc62
commit 8c4b0ce240
7 changed files with 42 additions and 28 deletions

View file

@ -173,17 +173,23 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* Generate Input elements in Html Code from sccpgeneral.xml
*/
public function showGroup($grup_name, $heder_show, $form_prefix = 'sccp', $form_values = null) {
public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = null, $show_inherit = true) {
$htmlret = "";
if (empty($form_values)) {
$form_values = $this->sccpvalues;
}
if ((array) $this->xml_data) {
foreach ($this->xml_data->xpath('//page_group[@name="' . $grup_name . '"]') as $item) {
foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) {
$htmlret .= load_view(__DIR__ . '/views/formShow.php', array(
'itm' => $item, 'h_show' => $heder_show,
'form_prefix' => $form_prefix, 'fvalues' => $form_values,
'tftp_lang' => $this->tftpLang, 'metainfo' => $this->sccp_metainfo));
'itm' => $item,
'h_show' => $show_Header,
'form_prefix' => $form_prefix,
'fvalues' => $form_values,
'tftp_lang' => $this->tftpLang,
'metainfo' => $this->sccp_metainfo,
'inherit' => $show_inherit
)
);
}
} else {
$htmlret .= load_view(__DIR__ . '/views/formShowError.php');
@ -680,9 +686,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$save_settings[$key] = $value;
}
}
// Save this device.
$this->dbinterface->write('sccpdevice', $save_settings, 'replace');
// Retrieve the phone buttons and write back to
// update sccpdeviceconfig via Trigger
$save_buttons = $this->getPhoneButtons($get_settings, $name_dev, $hw_type);
$this->dbinterface->write('sccpbuttons', $save_buttons, $update_hw, '', $name_dev);
// Create new XML for this device, and then reset or restart the device
// so that it loads the file from TFT.
$this->createSccpDeviceXML($name_dev);
if ($hw_id == 'new') {
$this->aminterface->sccpDeviceReset($name_dev, 'reset');

View file

@ -34,10 +34,10 @@ $(document).ready(function () {
vdata = vdata + $(this).serialize() + '&';
});
if ($('.fpbx-submit').data('id') == "hw_edit") {
snd_command = 'save_hardware';
snd_command = 'save_device';
}
if ($('.fpbx-submit').data('id') == "hw_sedit") {
snd_command = 'save_sip_hardware';
snd_command = 'save_sip_device';
}
if ($('.fpbx-submit').data('id') == "ruser_edit") {
snd_command = 'save_ruser';
@ -71,10 +71,10 @@ $(document).ready(function () {
vdata = vdata + $(this).serialize() + '&';
});
if ($('.fpbx-submit').data('id') == "hw_edit") {
snd_command = 'save_hardware';
snd_command = 'save_device';
}
if ($('.fpbx-submit').data('id') == "hw_sedit") {
snd_command = 'save_sip_hardware';
snd_command = 'save_sip_device';
}
if ($('.fpbx-submit').data('id') == "ruser_edit") {
snd_command = 'save_ruser';

View file

@ -536,7 +536,7 @@ and open the template in the editor. Base Version before all crash :-)
</item>
</page_group>
<page_group name="sccp_advant">
<page_group name="sccp_dev_vendor_conf">
<label>Device Vendor Setting</label>
<item type="IE" id="3" seq="98">
<label>Log Server</label>
@ -588,7 +588,6 @@ and open the template in the editor. Base Version before all crash :-)
</input>
<help>Timeout in HH:MM format to automatically turn off phone display if outside the time specified by "daysDisplayNotActive", "displayOnTime" and "displayOnTimeout".</help>
</item>
<item type="IS" id="6" seq="98">
<name>vendorconfig_settingsaccess</name>
<label>Settings Access</label>
@ -688,8 +687,6 @@ and open the template in the editor. Base Version before all crash :-)
<button value="1">Enabled</button>
<help> Enable Link Layer Discovery Protocol on the PC (computer) port.</help>
</item>
</page_group>
<page_group name="sccp_srst">
@ -1069,7 +1066,7 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="default"></options>
<class>sccp-custom</class>
</input>
<help>Context where direct pickup search for extensions. if not set current contect will be use.</help>
<help>Context where direct pickup search for extensions. if not set current context will be use.</help>
</item>
<item type="IE" id="7">
<label>Default pickup group</label>
@ -1079,7 +1076,7 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="default"></options>
<class>sccp-custom</class>
</input>
<help>Context where direct pickup search for extensions. if not set current contect will be use.</help>
<help>Context where direct pickup search for extensions. if not set current context will be use.</help>
</item>
<item type="IS" id="11">

View file

@ -10,8 +10,8 @@ trait ajaxHelper {
switch ($req) {
case 'backupsettings':
case 'savesettings':
case 'save_hardware':
case 'save_sip_hardware':
case 'save_device':
case 'save_sip_device':
case 'save_ruser':
case 'save_dialplan_template':
case 'delete_hardware':
@ -62,8 +62,8 @@ trait ajaxHelper {
// !TODO!: It is necessary in the future to check, and replace all server responses on correct messages. Use _(msg)
return array('status' => true, 'message' => $msg, 'reload' => true);
break;
case 'save_sip_hardware':
case 'save_hardware':
case 'save_sip_device':
case 'save_device':
$this->saveSccpDevice($request);
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'sccpdevice');

View file

@ -70,14 +70,14 @@ if (!empty($_REQUEST['id'])) {
}
}
//print_r($db_res);
if (!empty($device_warning)) {
?>
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" >Warning in the SCCP Device</h2>
<div class="table-responsive">
<div class="table-responsive">
<?php
foreach ($device_warning as $key => $value) {
echo '<h3>'.$key.'</h3>';
@ -115,8 +115,9 @@ if (!empty($device_warning)) {
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'sccp_hw', $def_val, true);
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?>
?>
</form>

View file

@ -376,6 +376,11 @@ foreach ($items as $child) {
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
}
foreach ($child->xpath('button') as $value) {
if (!$inherit) {
if ($value == 'Inherit') {
continue;
}
}
$val_check = strtolower((string)$value[@value]);
if ($val_check == strtolower($res_v)) {
$val_check = " checked";

View file

@ -9,12 +9,12 @@
<form autocomplete="off" name="frm_advanced" id="frm_ntp" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="advancedform">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->showGroup('sccp_srst', 1);
echo $this->showGroup('sccp_advant', 1);
echo $this->showGroup('sccp_dev_vendor_conf', 1,'sccp',null,false);
// echo $this->showGroup('sccp_dev_time',1);
?>
?>
</form>