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 * 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 = ""; $htmlret = "";
if (empty($form_values)) { if (empty($form_values)) {
$form_values = $this->sccpvalues; $form_values = $this->sccpvalues;
} }
if ((array) $this->xml_data) { 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( $htmlret .= load_view(__DIR__ . '/views/formShow.php', array(
'itm' => $item, 'h_show' => $heder_show, 'itm' => $item,
'form_prefix' => $form_prefix, 'fvalues' => $form_values, 'h_show' => $show_Header,
'tftp_lang' => $this->tftpLang, 'metainfo' => $this->sccp_metainfo)); 'form_prefix' => $form_prefix,
'fvalues' => $form_values,
'tftp_lang' => $this->tftpLang,
'metainfo' => $this->sccp_metainfo,
'inherit' => $show_inherit
)
);
} }
} else { } else {
$htmlret .= load_view(__DIR__ . '/views/formShowError.php'); $htmlret .= load_view(__DIR__ . '/views/formShowError.php');
@ -680,9 +686,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$save_settings[$key] = $value; $save_settings[$key] = $value;
} }
} }
// Save this device.
$this->dbinterface->write('sccpdevice', $save_settings, 'replace'); $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); $save_buttons = $this->getPhoneButtons($get_settings, $name_dev, $hw_type);
$this->dbinterface->write('sccpbuttons', $save_buttons, $update_hw, '', $name_dev); $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); $this->createSccpDeviceXML($name_dev);
if ($hw_id == 'new') { if ($hw_id == 'new') {
$this->aminterface->sccpDeviceReset($name_dev, 'reset'); $this->aminterface->sccpDeviceReset($name_dev, 'reset');

View file

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

View file

@ -536,7 +536,7 @@ and open the template in the editor. Base Version before all crash :-)
</item> </item>
</page_group> </page_group>
<page_group name="sccp_advant"> <page_group name="sccp_dev_vendor_conf">
<label>Device Vendor Setting</label> <label>Device Vendor Setting</label>
<item type="IE" id="3" seq="98"> <item type="IE" id="3" seq="98">
<label>Log Server</label> <label>Log Server</label>
@ -588,7 +588,6 @@ and open the template in the editor. Base Version before all crash :-)
</input> </input>
<help>Timeout in HH:MM format to automatically turn off phone display if outside the time specified by "daysDisplayNotActive", "displayOnTime" and "displayOnTimeout".</help> <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>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_settingsaccess</name> <name>vendorconfig_settingsaccess</name>
<label>Settings Access</label> <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> <button value="1">Enabled</button>
<help> Enable Link Layer Discovery Protocol on the PC (computer) port.</help> <help> Enable Link Layer Discovery Protocol on the PC (computer) port.</help>
</item> </item>
</page_group> </page_group>
<page_group name="sccp_srst"> <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> <options placeholder="default"></options>
<class>sccp-custom</class> <class>sccp-custom</class>
</input> </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>
<item type="IE" id="7"> <item type="IE" id="7">
<label>Default pickup group</label> <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> <options placeholder="default"></options>
<class>sccp-custom</class> <class>sccp-custom</class>
</input> </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>
<item type="IS" id="11"> <item type="IS" id="11">

View file

@ -10,8 +10,8 @@ trait ajaxHelper {
switch ($req) { switch ($req) {
case 'backupsettings': case 'backupsettings':
case 'savesettings': case 'savesettings':
case 'save_hardware': case 'save_device':
case 'save_sip_hardware': case 'save_sip_device':
case 'save_ruser': case 'save_ruser':
case 'save_dialplan_template': case 'save_dialplan_template':
case 'delete_hardware': 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) // !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); return array('status' => true, 'message' => $msg, 'reload' => true);
break; break;
case 'save_sip_hardware': case 'save_sip_device':
case 'save_hardware': case 'save_device':
$this->saveSccpDevice($request); $this->saveSccpDevice($request);
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'sccpdevice'); return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'sccpdevice');

View file

@ -115,8 +115,9 @@ if (!empty($device_warning)) {
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val); 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_advance', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_softkey', 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_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); echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?> ?>
</form> </form>

View file

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

View file

@ -13,7 +13,7 @@
<?php <?php
echo $this->showGroup('sccp_srst', 1); 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); // echo $this->showGroup('sccp_dev_time',1);
?> ?>