diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index 5fd8c92..9489bdf 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -565,7 +565,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } function saveSccpDevice($get_settings, $validateonly = false) { - dbug('Settings', $get_settings); $hdr_prefix = 'sccp_hw_'; $hdr_arprefix = 'sccp_hw-ar_'; $hdr_vendPrefix = 'sccp_hw_vendorconfig'; diff --git a/views/form.adddevice.php b/views/form.adddevice.php index 91b54dd..47f046d 100644 --- a/views/form.adddevice.php +++ b/views/form.adddevice.php @@ -24,6 +24,9 @@ if (!empty($_REQUEST['new_id'])) { if (!empty($_REQUEST['addon'])) { $def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99"); } + // TODO Default values should be used to populate this device + // Currently these are read from sccpgeneral.xml + // Need to get these from the db as defaults may have changed. } // Editing an existing Device @@ -31,7 +34,6 @@ 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) { @@ -67,34 +69,11 @@ 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); if (!empty($device_warning)) { ?> @@ -142,7 +121,7 @@ if (!empty($device_warning)) { echo $this->showGroup('sccp_hw_dev_softkey', 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_dev_vendor_conf', 1, 'vendorconfig', $def_val, true); echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val); ?> diff --git a/views/formShow.php b/views/formShow.php index 9ed3fd8..63dffc9 100644 --- a/views/formShow.php +++ b/views/formShow.php @@ -18,11 +18,15 @@ * Help elemen HLP - Help Element */ +// This will not work if the field already has the underscore $npref = $form_prefix.'_'; $napref = $form_prefix.'-ar_'; if (empty($form_prefix)) { $npref = "sccp_"; $napref ="sccp-ar_"; +} elseif ($form_prefix == 'vendorconfig') { + $npref = 'vendorconfig'; + $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", "D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA"); @@ -328,7 +332,8 @@ foreach ($items as $child) { if ($child['type'] == 'IS') { $res_n = (string)$child->name; - $res_id = $npref.$child->name; + $res_id = $npref.$res_n; + $res_ext = str_replace($npref,'',$res_n); if (!empty($metainfo[$res_n])) { if ($child->meta_help == '1' || $child->help == 'Help!') { $child->help = $metainfo[$res_n]['Description']; @@ -361,9 +366,9 @@ foreach ($items as $child) { if (!empty($child->value)) { $res_v = (string)$child->value; } - if (!empty($fvalues[$res_n])) { - if (($fvalues[$res_n]['data'] != '') ) { - $res_v = (string)$fvalues[$res_n]['data']; + if (!empty($fvalues[$res_ext])) { + if (($fvalues[$res_ext]['data'] != '') ) { + $res_v = (string)$fvalues[$res_ext]['data']; } } if (!empty($child->option_hide)) { diff --git a/views/server.advanced.php b/views/server.advanced.php index 67145ed..f592dff 100644 --- a/views/server.advanced.php +++ b/views/server.advanced.php @@ -17,34 +17,12 @@ $defaultVal = array(); $sccpDeviceDesc = $this->dbinterface->HWextension_db_SccpTableData('get_columns_sccpdevice'); - $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' - ); - foreach ($sccpDeviceDesc as $data) { $key = (string) $data['Field']; - if (array_key_exists($key, $translateFieldArray)) { - $defaultVal[$translateFieldArray[$key]] = array("keyword" => $translateFieldArray[$key], "data" => $data['Default'], "seq" => "99"); - } + $defaultVal[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99"); } - echo $this->showGroup('sccp_srst', 1); - echo $this->showGroup('sccp_dev_vendor_conf', 1,'sccp',$defaultVal,false); -// echo $this->showGroup('sccp_dev_time',1); + echo $this->showGroup('sccp_dev_vendor_conf', 1,'vendorconfig',$defaultVal,false); ?>