Add vendorconfig data to Edit Device

Translate DB fields to formshow fields

These field translations need to be simplified
This commit is contained in:
steve-lad 2021-06-16 12:42:07 +02:00
parent b2ee6ad853
commit 790b5f7949
3 changed files with 63 additions and 34 deletions

View file

@ -568,7 +568,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
dbug('Settings', $get_settings); dbug('Settings', $get_settings);
$hdr_prefix = 'sccp_hw_'; $hdr_prefix = 'sccp_hw_';
$hdr_arprefix = 'sccp_hw-ar_'; $hdr_arprefix = 'sccp_hw-ar_';
$hdr_vendPrefix = 'sccp_hw_vendor'; $hdr_vendPrefix = 'sccp_hw_vendorconfig';
$save_buttons = array(); $save_buttons = array();
$save_settings = array(); $save_settings = array();
@ -625,6 +625,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if (!empty($get_settings[$hdr_prefix . $key])) { if (!empty($get_settings[$hdr_prefix . $key])) {
$value = $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])) { if (!empty($get_settings[$hdr_arprefix . $key])) {
$arr_data = ''; $arr_data = '';
$arr_clear = false; $arr_clear = false;

View file

@ -588,103 +588,104 @@ 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>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Whether a user can access the phone settings.</help> <help>Whether a user can access the phone settings.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_videocapability</name> <name>vendorconfig_videocapability</name>
<label>Video Capability</label> <label>Video Capability</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help></help> <help></help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_webaccess</name> <name>vendorconfig_webaccess</name>
<label>Web Access</label> <label>Web Access</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Enable the phone's HTTP server.</help> <help>Enable the phone's HTTP server.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_webadmin</name> <name>vendorconfig_webadmin</name>
<label>Web Admin</label> <label>Web Admin</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Enable remote administration using the phone's HTTP server. 8821 model only.</help> <help>Enable remote administration using the phone's HTTP server. 8821 model only.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_pcport</name> <name>vendorconfig_pcport</name>
<label>Pc Port</label> <label>Pc Port</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="1">Disabled</button> <button value="off">Disabled</button>
<button value="0">Enabled</button> <button value="on">Enabled</button>
<help>Disable the PC (computer) port</help> <help>Disable the PC (computer) port</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_spantopcport</name> <name>vendorconfig_spantopcport</name>
<label>Span to PC Port</label> <label>Span to PC Port</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="1">Disabled</button> <button value="off">Disabled</button>
<button value="0">Enabled</button> <button value="on">Enabled</button>
<help>Forward packets sent and received on the SW (network) port to the PC (computer) port.</help> <help>Forward packets sent and received on the SW (network) port to the PC (computer) port.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_voicevlanaccess</name> <name>vendorconfig_voicevlanaccess</name>
<label>Voice Vlan Access</label> <label>Voice Vlan Access</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Allow devices connected to the PC (computer) port to access the voice VLAN.</help> <help>Allow devices connected to the PC (computer) port to access the voice VLAN.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_enablecdpswport</name> <name>vendorconfig_enablecdpswport</name>
<label>Cdp Sw Port</label> <label>Cdp Sw Port</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Enable Cisco Discovery Protocol on the SW (network) port.</help> <help>Enable Cisco Discovery Protocol on the SW (network) port.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_enablecdppcport</name> <name>vendorconfig_enablecdppcport</name>
<label>Cdp PC Port</label> <label>Cdp PC Port</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Enable Cisco Discovery Protocol on the PC (computer) port.</help> <help>Enable Cisco Discovery Protocol on the PC (computer) port.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_enablelldpswport</name> <name>vendorconfig_enablelldpswport</name>
<label>Link Layer Discovery Sw</label> <label>Link Layer Discovery Sw</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<help>Enable Link Layer Discovery Protocol on the SW (network) port.</help> <help>Enable Link Layer Discovery Protocol on the SW (network) port.</help>
</item> </item>
<item type="IS" id="6" seq="98"> <item type="IS" id="6" seq="98">
<name>vendorconfig_enablelldppcport</name> <name>vendorconfig_enablelldppcport</name>
<label>Link Layer Discovery PC</label> <label>Link Layer Discovery PC</label>
<default></default> <default>Inherit</default>
<button value="">Inherit</button> <button value="">Inherit</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<button value="1">Enabled</button> <button value="on">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>

View file

@ -26,10 +26,12 @@ if (!empty($_REQUEST['new_id'])) {
} }
} }
// Editing an existing Device
if (!empty($_REQUEST['id'])) { if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id']; $dev_id = $_REQUEST['id'];
$dev_new = $dev_id; $dev_new = $dev_id;
$db_res = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $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) { foreach ($db_res as $key => $val) {
if (!empty($val)) { if (!empty($val)) {
switch ($key) { switch ($key) {
@ -65,9 +67,32 @@ if (!empty($_REQUEST['id'])) {
// $val = after('/', $val); // $val = after('/', $val);
// break; // 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"); $def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
} }
} }
dbug('def_value', $def_val);
} }
//print_r($db_res); //print_r($db_res);