From 790b5f7949b5eae5cd13a9ec595be2bd1456fcb2 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Wed, 16 Jun 2021 12:42:07 +0200 Subject: [PATCH] Add vendorconfig data to Edit Device Translate DB fields to formshow fields These field translations need to be simplified --- Sccp_manager.class.php | 5 ++- conf/sccpgeneral.xml.v433 | 67 ++++++++++++++++++++------------------- views/form.adddevice.php | 25 +++++++++++++++ 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index 87d38e8..5fd8c92 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -568,7 +568,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { dbug('Settings', $get_settings); $hdr_prefix = 'sccp_hw_'; $hdr_arprefix = 'sccp_hw-ar_'; - $hdr_vendPrefix = 'sccp_hw_vendor'; + $hdr_vendPrefix = 'sccp_hw_vendorconfig'; $save_buttons = array(); $save_settings = array(); @@ -625,6 +625,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { if (!empty($get_settings[$hdr_prefix . $key])) { $value = $get_settings[$hdr_prefix . $key]; } + if (!empty($get_settings[$hdr_vendPrefix . $key])) { + $value = $get_settings[$hdr_vendPrefix . $key]; + } if (!empty($get_settings[$hdr_arprefix . $key])) { $arr_data = ''; $arr_clear = false; diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433 index 0d0bc08..4bfe55b 100644 --- a/conf/sccpgeneral.xml.v433 +++ b/conf/sccpgeneral.xml.v433 @@ -588,103 +588,104 @@ and open the template in the editor. Base Version before all crash :-) Timeout in HH:MM format to automatically turn off phone display if outside the time specified by "daysDisplayNotActive", "displayOnTime" and "displayOnTimeout". + vendorconfig_settingsaccess - + Inherit - - + + Whether a user can access the phone settings. vendorconfig_videocapability - + Inherit - - + + vendorconfig_webaccess - + Inherit - - + + Enable the phone's HTTP server. vendorconfig_webadmin - + Inherit - - + + Enable remote administration using the phone's HTTP server. 8821 model only. vendorconfig_pcport - + Inherit - - + + Disable the PC (computer) port vendorconfig_spantopcport - + Inherit - - + + Forward packets sent and received on the SW (network) port to the PC (computer) port. vendorconfig_voicevlanaccess - + Inherit - - + + Allow devices connected to the PC (computer) port to access the voice VLAN. vendorconfig_enablecdpswport - + Inherit - - + + Enable Cisco Discovery Protocol on the SW (network) port. vendorconfig_enablecdppcport - + Inherit - - + + Enable Cisco Discovery Protocol on the PC (computer) port. vendorconfig_enablelldpswport - + Inherit - - + + Enable Link Layer Discovery Protocol on the SW (network) port. vendorconfig_enablelldppcport - + Inherit - - + + Enable Link Layer Discovery Protocol on the PC (computer) port. diff --git a/views/form.adddevice.php b/views/form.adddevice.php index 09bb2dc..91b54dd 100644 --- a/views/form.adddevice.php +++ b/views/form.adddevice.php @@ -26,10 +26,12 @@ if (!empty($_REQUEST['new_id'])) { } } +// Editing an existing Device if (!empty($_REQUEST['id'])) { $dev_id = $_REQUEST['id']; $dev_new = $dev_id; $db_res = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id)); + dbug('db_res', $db_res); foreach ($db_res as $key => $val) { if (!empty($val)) { switch ($key) { @@ -65,9 +67,32 @@ if (!empty($_REQUEST['id'])) { // $val = after('/', $val); // break; } + $translateFieldArray = array('_logserver' => 'vendorconfig_logserver', + '_daysdisplaynotactive' => 'vendorconfig_daysdisplaynotactive', + '_displayontime' => 'vendorconfig_displayontime', + '_displayonduration' => 'vendorconfig_displayonduration', + '_displayidletimeout' => 'vendorconfig_displayidletimeout', + '_settingsaccess' => 'vendorconfig_settingsaccess', + '_videocapability' => 'vendorconfig_videocapability', + '_webaccess' => 'vendorconfig_webaccess', + '_webadmin' => 'vendorconfig_webadmin', + '_pcport' => 'vendorconfig_pcport', + '_spantopcport' => 'vendorconfig_spantopcport', + '_voicevlanaccess' => 'vendorconfig_voicevlanaccess', + '_enablecdpswport' => 'vendorconfig_enablecdpswport', + '_enablecdppcport' => 'vendorconfig_enablecdppcport', + '_enablelldpswport' => 'vendorconfig_enablelldpswport', + '_enablelldppcport' => 'vendorconfig_enablelldppcport' + ); + if (array_key_exists($key,$translateFieldArray)) { + $def_val[$translateFieldArray[$key]] = array("keyword" => $translateFieldArray[$key], "data" => $val, "seq" => "99"); + continue; + } $def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99"); } } + dbug('def_value', $def_val); + } //print_r($db_res);