Modify default values

Change sccpgeneral to remove inherit - now inherit default values automatically
Add default values to form groups
Revert changes informShow
Update getTableDefaults to better manage underscores with chan-sccp
Change Defaults in Install
This commit is contained in:
steve-lad 2021-06-18 11:58:00 +02:00
parent f36c224f87
commit 57bc13f782
11 changed files with 89 additions and 80 deletions

View file

@ -173,7 +173,7 @@ 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($group_name, $show_Header, $form_prefix = 'sccp', $form_values = null, $show_inherit = true) { public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array(), $show_inherit = true) {
$htmlret = ""; $htmlret = "";
if (empty($form_values)) { if (empty($form_values)) {
$form_values = $this->sccpvalues; $form_values = $this->sccpvalues;

View file

@ -536,7 +536,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IE" id="3" seq="98"> <item type="IE" id="3" seq="98">
<label>Log Server</label> <label>Log Server</label>
<input> <input>
<name>vendorconfig_logserver</name> <name>logserver</name>
<default></default> <default></default>
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="x.x.x.x:9001" /> <options placeholder="x.x.x.x:9001" />
@ -546,7 +546,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IE" id="3" seq="98"> <item type="IE" id="3" seq="98">
<label>Display Not Active</label> <label>Display Not Active</label>
<input> <input>
<name>vendorconfig_daysdisplaynotactive</name> <name>daysdisplaynotactive</name>
<default></default> <default></default>
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="1,7" /> <options placeholder="1,7" />
@ -556,7 +556,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IE" id="3" seq="98"> <item type="IE" id="3" seq="98">
<label>Display Not Active</label> <label>Display Not Active</label>
<input> <input>
<name>vendorconfig_displayontime</name> <name>displayontime</name>
<default></default> <default></default>
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="08:00" /> <options placeholder="08:00" />
@ -566,7 +566,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IE" id="3" seq="98"> <item type="IE" id="3" seq="98">
<label>Display On Duration</label> <label>Display On Duration</label>
<input> <input>
<name>vendorconfig_displayonduration</name> <name>displayonduration</name>
<default></default> <default></default>
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="10:00" /> <options placeholder="10:00" />
@ -576,109 +576,97 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IE" id="3" seq="98"> <item type="IE" id="3" seq="98">
<label>Display Idle Timeout</label> <label>Display Idle Timeout</label>
<input> <input>
<name>vendorconfig_displayidletimeout</name> <name>displayidletimeout</name>
<default></default> <default></default>
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="00:10" /> <options placeholder="00:10" />
</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>settingsaccess</name>
<label>Settings Access</label> <label>Settings Access</label>
<default>Inherit</default> <default>off</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>videocapability</name>
<label>Video Capability</label> <label>Video Capability</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>webaccess</name>
<label>Web Access</label> <label>Web Access</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>webadmin</name>
<label>Web Admin</label> <label>Web Admin</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>pcport</name>
<label>Pc Port</label> <label>Pc Port</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>spantopcport</name>
<label>Span to PC Port</label> <label>Span to PC Port</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>voicevlanaccess</name>
<label>Voice Vlan Access</label> <label>Voice Vlan Access</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>enablecdpswport</name>
<label>Cdp Sw Port</label> <label>Cdp Sw Port</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>enablecdppcport</name>
<label>Cdp PC Port</label> <label>Cdp PC Port</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>enablelldpswport</name>
<label>Link Layer Discovery Sw</label> <label>Link Layer Discovery Sw</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>enablelldppcport</name>
<label>Link Layer Discovery PC</label> <label>Link Layer Discovery PC</label>
<default>Inherit</default> <default>"off"</default>
<button value="">Inherit</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">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>
@ -1136,16 +1124,16 @@ and open the template in the editor. Base Version before all crash :-)
<name>backgroundImageAccess</name> <name>backgroundImageAccess</name>
<label>Allow change Background Image</label> <label>Allow change Background Image</label>
<default>true</default> <default>true</default>
<button value="true">Enabled</button> <button value="on">Enabled</button>
<button value="false">Disabled</button> <button value="off">Disabled</button>
<help>I'm guessing on this one, but on some devices, the background image on the display can be modified at the device. I think this is the thing that allows that to happen.</help> <help>I'm guessing on this one, but on some devices, the background image on the display can be modified at the device. I think this is the thing that allows that to happen.</help>
</item> </item>
<item type="IS" id="11" seq="98"> <item type="IS" id="11" seq="98">
<name>phonePersonalization</name> <name>phonePersonalization</name>
<label>Allow push background from server </label> <label>Allow push background from server </label>
<default>0</default> <default>0</default>
<button value="1">Enabled</button> <button value="on">Enabled</button>
<button value="0">Disabled</button> <button value="off">Disabled</button>
<help>This needs to be enabled to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:</help> <help>This needs to be enabled to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:</help>
</item> </item>
<item type="IS" id="11" seq="98"> <item type="IS" id="11" seq="98">
@ -1397,7 +1385,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>transfer</name> <name>transfer</name>
<label>Transfer</label> <label>Transfer</label>
<default>off</default> <default>off</default>
<button value="off">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Transfer allowed</help> <help>Transfer allowed</help>
@ -1406,7 +1393,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>park</name> <name>park</name>
<label>Park</label> <label>Park</label>
<default>on</default> <default>on</default>
<button_d value="NONE">Inherit</button_d>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Take a look to the compile how-to. Park stuff is not compiled by default.</help> <help>Take a look to the compile how-to. Park stuff is not compiled by default.</help>
@ -1415,7 +1401,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>cfwdall</name> <name>cfwdall</name>
<label>Call Forward</label> <label>Call Forward</label>
<default>off</default> <default>off</default>
<button value="off">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Activate the callforward softkeys. Default is On</help> <help>Activate the callforward softkeys. Default is On</help>
@ -1424,7 +1409,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>cfwdbusy</name> <name>cfwdbusy</name>
<label>Call Forward busy</label> <label>Call Forward busy</label>
<default>off</default> <default>off</default>
<button value="off">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Activate the callforward busy softkeys. Default is On</help> <help>Activate the callforward busy softkeys. Default is On</help>
@ -1433,7 +1417,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>cfwdnoanswer</name> <name>cfwdnoanswer</name>
<label>Call Forward NOANSWER</label> <label>Call Forward NOANSWER</label>
<default>on</default> <default>on</default>
<button value="on">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Activate the callforward NOANSWER stuff and softkeys. Default is On</help> <help>Activate the callforward NOANSWER stuff and softkeys. Default is On</help>
@ -1442,7 +1425,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>dndFeature</name> <name>dndFeature</name>
<label>DND Button on Device</label> <label>DND Button on Device</label>
<default>off</default> <default>off</default>
<button value="off">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Do Not Disturb. Default is Off</help> <help>Do Not Disturb. Default is Off</help>
@ -1481,7 +1463,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>mwioncall</name> <name>mwioncall</name>
<label>Message Lamp On Call</label> <label>Message Lamp On Call</label>
<default>on</default> <default>on</default>
<button value="on">Inherit</button>
<button value="on">Yes</button> <button value="on">Yes</button>
<button value="off">No</button> <button value="off">No</button>
<help>Set the MWI on call.</help> <help>Set the MWI on call.</help>
@ -1491,7 +1472,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>mwilamp</name> <name>mwilamp</name>
<label>Message Waiting Indication (MWI)</label> <label>Message Waiting Indication (MWI)</label>
<default>on</default> <default>on</default>
<button value="on">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<button value="wink">Wink</button> <button value="wink">Wink</button>
@ -1635,7 +1615,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>nat</name> <name>nat</name>
<label>NAT</label> <label>NAT</label>
<default>auto</default> <default>auto</default>
<button value="auto">Inherit</button>
<button value="auto">Auto</button> <button value="auto">Auto</button>
<button value="off">Off</button> <button value="off">Off</button>
<button value="on">On</button> <button value="on">On</button>
@ -1646,7 +1625,6 @@ and open the template in the editor. Base Version before all crash :-)
<label>Direct RTP</label> <label>Direct RTP</label>
<default>off</default> <default>off</default>
<button- value="off">Auto</button-> <button- value="off">Auto</button->
<button value="off">Inherit</button>
<button value="off">Off</button> <button value="off">Off</button>
<button value="on">On</button> <button value="on">On</button>
<help>This option allow devices to do direct RTP sessions (default Off)</help> <help>This option allow devices to do direct RTP sessions (default Off)</help>
@ -1655,7 +1633,6 @@ and open the template in the editor. Base Version before all crash :-)
<name>earlyrtp</name> <name>earlyrtp</name>
<label>Early RTP</label> <label>Early RTP</label>
<default>NONE</default> <default>NONE</default>
<button value="NONE">Inherit</button>
<button-d value="immediate">Immediate</button-d> <button-d value="immediate">Immediate</button-d>
<button value="offhook">Offhook</button> <button value="offhook">Offhook</button>
<button value="dialing">Dial</button> <button value="dialing">Dial</button>

View file

@ -257,7 +257,7 @@ function Get_DB_config($sccp_compatible)
'_autocall_select' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"), '_autocall_select' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'_backgroundImageAccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"), '_backgroundImageAccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'_phonePersonalization' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"), '_phonePersonalization' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'_callLogBlfEnabled' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')") '_callLogBlfEnabled' => array('create' => "enum('3','2') NOT NULL default '2'", 'modify' => "enum('3','2')")
) )
); );

View file

@ -1,7 +1,7 @@
<module> <module>
<rawname>sccp_manager</rawname> <rawname>sccp_manager</rawname>
<name>SCCP Manager</name> <name>SCCP Manager</name>
<version>14.3.0.1</version> <version>14.3.0.0</version>
<type>setup</type> <type>setup</type>
<category>SCCP Connectivity</category> <category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher> <publisher>Steve Lad, Alex GP</publisher>

View file

@ -110,7 +110,7 @@ class dbinterface
$stmts = $dbh->prepare('DESCRIBE sccpuser'); $stmts = $dbh->prepare('DESCRIBE sccpuser');
break; break;
case 'get_columns_sccpline': case 'get_columns_sccpline':
$stmts = $dbh->prepare('DESCRIBE sccpuser'); $stmts = $dbh->prepare('DESCRIBE sccpline');
break; break;
case 'get_sccpdevice_byid': case 'get_sccpdevice_byid':
$stmt = $dbh->prepare('SELECT t1.*, types.dns, types.buttons, types.loadimage, types.nametemplate as nametemplate, $stmt = $dbh->prepare('SELECT t1.*, types.dns, types.buttons, types.loadimage, types.nametemplate as nametemplate,
@ -145,6 +145,8 @@ class dbinterface
$raw_settings = array(); $raw_settings = array();
} }
break; break;
// No default case so will give exception of $raw_settings undefined if there
// dataid is not in the switch.
} }
if (!empty($stmt)) { if (!empty($stmt)) {
$stmt->execute(); $stmt->execute();

View file

@ -42,7 +42,6 @@ trait ajaxHelper {
// ajaxHandler is called after ajaxRequest returns true // ajaxHandler is called after ajaxRequest returns true
public function ajaxHandler() { public function ajaxHandler() {
dbug('REQUEST',$_REQUEST);
$request = $_REQUEST; $request = $_REQUEST;
$msg = array(); $msg = array();
$cmd_id = $request['command']; $cmd_id = $request['command'];
@ -382,6 +381,7 @@ trait ajaxHelper {
} }
function handleSubmit($request, $validateonly = false) { function handleSubmit($request, $validateonly = false) {
dbug('Request', $request);
$hdr_prefix = 'sccp_'; $hdr_prefix = 'sccp_';
$hdr_arprefix = 'sccp-ar_'; $hdr_arprefix = 'sccp-ar_';
$save_settings = array(); $save_settings = array();
@ -396,28 +396,45 @@ trait ajaxHelper {
$this->initializeTFtpLanguagePath(); $this->initializeTFtpLanguagePath();
} }
foreach ($request as $key => $value) { foreach ($request as $key => $value) {
// Initallly saved all to sccpvalues. Now will save to db defaults if appropriate // Originally saved all to sccpvalues. Now will save to db defaults if appropriate
// TODO: Need to verify the tables defined in showGroup - some options maybe // TODO: Need to verify the tables defined in showGroup - some options maybe
// device options, but if set by freePbx extensions, be in sccpline. // device options, but if set by freePbx extensions, be in sccpline.
$key = (str_replace('sccpdevice_', '', $key, $count_mods)); $key = (str_replace('sccpdevice_', '', $key, $count_mods));
if (($count_mods) && (!empty($value))) { if ($count_mods) {
// There will be some exceptions to be handled where there should be no underscore // There will be some exceptions to be handled where there should be no underscore
// Handle at db write // Handle at db write
// Have default to be saved to db sccpdevice // Have default to be saved to db sccpdevice
$dev_def = $this->getTableDefaults('sccpdevice'); $dev_def = $this->getTableDefaults('sccpdevice', false);
if (!array_key_exists($key, $dev_def)) { if (!array_key_exists($key, $dev_def)) {
// This key needs to be prefixed with underscore // This key needs to be prefixed with underscore
$key = '_'.$key; $key = "_{$key}";
}
if ((array_key_exists($key, $dev_def)) && (($dev_def[$key]['data'] == $value) || empty($dev_def[$key]['data']))) {
// Value unchanged or null so ignore and go to next key.
continue;
}
$dbSaveArray[] = array('table' => 'sccpdevice', 'field' => $key, 'Default' => $value);
continue;
}
$key = (str_replace('sccpline_', '', $key, $count_mods));
if ($count_mods) {
// There will be some exceptions to be handled where there should be no underscore
// Handle at db write
// Have default to be saved to db sccpdevice
$dev_def = $this->getTableDefaults('sccpline', false);
if (!array_key_exists($key, $dev_def)) {
// This key needs to be prefixed with underscore
$key = "_{$key}";
} }
if ((array_key_exists($key, $dev_def)) && ($dev_def[$key]['data'] == $value)) { if ((array_key_exists($key, $dev_def)) && ($dev_def[$key]['data'] == $value)) {
// Value unchanged so ignore and get next key. // Value unchanged so ignore and get next key.
continue; continue;
} }
$dbSaveArray[] = array('table' => 'sccpdevice', 'field' => $key, 'Default' => $value); $dbSaveArray[] = array('table' => 'sccpline', 'field' => $key, 'Default' => $value);
unset($request[$key]); unset($request[$key]);
continue; continue;
} }
dbug('still in loop with key', $key);
$pos = strpos($key, $hdr_prefix); $pos = strpos($key, $hdr_prefix);
if ($pos !== false) { if ($pos !== false) {
$key1 = substr_replace($key, '', 0, strlen($hdr_prefix)); $key1 = substr_replace($key, '', 0, strlen($hdr_prefix));
@ -493,7 +510,9 @@ trait ajaxHelper {
break; break;
} }
} }
if (!empty($save_settings)) { if (!empty($save_settings)) {
dbug('save settings', $save_settings);
$this->saveSccpSettings($save_settings); $this->saveSccpSettings($save_settings);
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); $this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
} }

View file

@ -69,13 +69,20 @@ trait helperfunctions {
} }
return FALSE; return FALSE;
} }
private function getTableDefaults($table) { private function getTableDefaults($table, $trim_underscore = true) {
$def_val = array(); $def_val = array();
// TODO: This is ugly and overkill - needs to be cleaned up in dbinterface // TODO: This is ugly and overkill - needs to be cleaned up in dbinterface
$sccpTableDesc = $this->dbinterface->HWextension_db_SccpTableData("get_columns_{$table}"); $sccpTableDesc = $this->dbinterface->HWextension_db_SccpTableData("get_columns_{$table}");
foreach ($sccpTableDesc as $data) { foreach ($sccpTableDesc as $data) {
$key = (string) $data['Field']; $key = (string) $data['Field'];
// function has 2 roles: return actual table keys (trim_underscore = false)
// return sanitised keys to add defaults (trim_underscore = true)
if ($trim_underscore) {
// Remove any leading (or trailing but should be none) underscore
// These are only used to hide fields from chan-sccp for compatibility
$key = trim($key,'_');
}
$def_val[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99"); $def_val[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99");
} }
return $def_val; return $def_val;

View file

@ -24,9 +24,9 @@ $napref = $form_prefix.'-ar_';
if (empty($form_prefix)) { if (empty($form_prefix)) {
$npref = "sccp_"; $npref = "sccp_";
$napref ="sccp-ar_"; $napref ="sccp-ar_";
} elseif ($form_prefix == 'vendorconfig') { //} elseif ($form_prefix == 'vendorconfig') {
$npref = 'vendorconfig'; // $npref = 'vendorconfig';
$napref = 'vendorconfig-ar'; // $napref = 'vendorconfig-ar';
} }
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA", $day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA"); "D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
@ -360,15 +360,16 @@ foreach ($items as $child) {
// $res_v = 'no'; // $res_v = 'no';
$opt_hide = ''; $opt_hide = '';
$res_v = ''; $res_v = '';
// set res_v according to precedence Default here, value here, supplied value
if (!empty($child->default)) { if (!empty($child->default)) {
$res_v = (string)$child->default; $res_v = (string)$child->default;
} }
if (!empty($child->value)) { if (!empty($child->value)) {
$res_v = (string)$child->value; $res_v = (string)$child->value;
} }
if (!empty($fvalues[$res_ext])) { if (!empty($fvalues[$res_n])) {
if (($fvalues[$res_ext]['data'] != '') ) { if (($fvalues[$res_n]['data'] != '') ) {
$res_v = (string)$fvalues[$res_ext]['data']; $res_v = (string)$fvalues[$res_n]['data'];
} }
} }
if (!empty($child->option_hide)) { if (!empty($child->option_hide)) {

View file

@ -14,10 +14,10 @@
// originally, this was populated by sccpgeneral.xml but that should be static // originally, this was populated by sccpgeneral.xml but that should be static
// now will populate from the db defaults. // now will populate from the db defaults.
$defaultVals = $this->getTableDefaults('sccpdevice'); $defaultVals = $this->getTableDefaults('sccpdevice', true);
echo $this->showGroup('sccp_srst', 1); echo $this->showGroup('sccp_srst', 1);
echo $this->showGroup('sccp_dev_vendor_conf', 1,'vendorconfig',$defaultVals,false); echo $this->showGroup('sccp_dev_vendor_conf', 1,'sccpdevice', $defaultVals, false);
?> ?>
</form> </form>

View file

@ -14,10 +14,11 @@
$def_val_line = $this->getTableDefaults('sccpline'); $def_val_line = $this->getTableDefaults('sccpline');
$def_val_device = $this->getTableDefaults('sccpdevice'); $def_val_device = $this->getTableDefaults('sccpdevice');
echo $this->showGroup('sccp_dev_config', 1, 'sccpdevice');
echo $this->showGroup('sccp_dev_group_config', 1, 'sccpline'); echo $this->showGroup('sccp_dev_config', 1, 'sccpdevice', $def_val_device);
echo $this->showGroup('sccp_dev_advconfig', 1, 'sccpdevice'); echo $this->showGroup('sccp_dev_group_config', 1, 'sccpline', $def_val_line);
echo $this->showGroup('sccp_dev_softkey', 1, 'sccpdevice'); echo $this->showGroup('sccp_dev_advconfig', 1, 'sccpdevice', $def_val_device);
echo $this->showGroup('sccp_hotline_config', 1, 'sccpdevice'); echo $this->showGroup('sccp_dev_softkey', 1, 'sccpdevice', $def_val_device);
echo $this->showGroup('sccp_hotline_config', 1, 'sccpdevice', $def_val_device);
?> ?>
</form> </form>

View file

@ -22,11 +22,13 @@
</div> </div>
</div> </div>
<?php <?php
$def_val_device = $this->getTableDefaults('sccpdevice');
echo $this->showGroup('sccp_general', 1); echo $this->showGroup('sccp_general', 1);
echo $this->showGroup('sccp_dev_time_s', 1); echo $this->showGroup('sccp_dev_time_s', 1);
echo $this->showGroup('sccp_net', 1); echo $this->showGroup('sccp_net', 1);
echo $this->showGroup('sccp_lang', 1); echo $this->showGroup('sccp_lang', 1);
echo $this->showGroup('sccp_qos_config', 1, 'sccpdevice'); echo $this->showGroup('sccp_qos_config', 1, 'sccpdevice', $def_val_device);
echo $this->showGroup('sccp_extpath_config', 1); echo $this->showGroup('sccp_extpath_config', 1);
?> ?>