Load help from chan-sccp
Load metainfo descriptions which provide help if not in XML
This commit is contained in:
		
							parent
							
								
									b7766fcf64
								
							
						
					
					
						commit
						ace4945eb0
					
				|  | @ -94,7 +94,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { | ||||||
|     private $hint_context = array('default' => '@ext-local'); /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
 |     private $hint_context = array('default' => '@ext-local'); /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
 | ||||||
|     private $val_null = 'NONE'; /// REPLACE to null Field
 |     private $val_null = 'NONE'; /// REPLACE to null Field
 | ||||||
|     public $sccp_model_list = array(); |     public $sccp_model_list = array(); | ||||||
|     public $sccp_metainfo = array(); |  | ||||||
|     private $cnf_wr = null; |     private $cnf_wr = null; | ||||||
|     public $sccppath = array(); |     public $sccppath = array(); | ||||||
|     public $sccpvalues = array(); |     public $sccpvalues = array(); | ||||||
|  | @ -102,6 +101,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { | ||||||
|     public $xml_data; |     public $xml_data; | ||||||
|     public $class_error; //error construct
 |     public $class_error; //error construct
 | ||||||
|     public $info_warning; |     public $info_warning; | ||||||
|  |     public $sccp_metainfo = array(); | ||||||
| 
 | 
 | ||||||
|     // Move all non sccp_manager specific functions to traits
 |     // Move all non sccp_manager specific functions to traits
 | ||||||
|     use \FreePBX\modules\Sccp_Manager\sccpManTraits\helperFunctions; |     use \FreePBX\modules\Sccp_Manager\sccpManTraits\helperFunctions; | ||||||
|  | @ -149,12 +149,20 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { | ||||||
|      */ |      */ | ||||||
| 
 | 
 | ||||||
|     public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array()) { |     public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = array()) { | ||||||
|         if (empty($form_values)) { | 
 | ||||||
|             $form_values = $this->sccpvalues; |         // load xml data - moved from Construct to simplify Construct.
 | ||||||
|         } |         // TODO: This is static data so only load first time. Left as is for dbug.
 | ||||||
|         // load xml data - moved from Construct to simplify Construct
 |  | ||||||
|         $xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v433'; |         $xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v433'; | ||||||
|               $this->xml_data = simplexml_load_file($xml_vars); |               $this->xml_data = simplexml_load_file($xml_vars); | ||||||
|  |         // load metainfo from chan-sccp - help information if not in xml. Only load first time as static data.
 | ||||||
|  |         if (empty($this->sccp_metainfo)) { | ||||||
|  |             $sysConfiguration = $this->aminterface->getSCCPConfigMetaData('general'); | ||||||
|  | 
 | ||||||
|  |             foreach ($sysConfiguration['Options'] as $key => $valueArray) { | ||||||
|  |                 $this->sccp_metainfo[$valueArray['Name']] = $valueArray['Description']; | ||||||
|  |             } | ||||||
|  |             unset($sysConfiguration); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         if ((array) $this->xml_data) { |         if ((array) $this->xml_data) { | ||||||
|             foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) { |             foreach ($this->xml_data->xpath('//page_group[@name="' . $group_name . '"]') as $item) { | ||||||
|  | @ -166,7 +174,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { | ||||||
|                         'form_prefix' => $form_prefix, |                         'form_prefix' => $form_prefix, | ||||||
|                         'fvalues' => $form_values, |                         'fvalues' => $form_values, | ||||||
|                         'tftp_lang' => $this->tftpLang, |                         'tftp_lang' => $this->tftpLang, | ||||||
|                         'metainfo' => $this->sccp_metainfo |                         'metainfo' => $this->sccp_metainfo, | ||||||
|  |                         'sccp_defaults' => $this->sccpvalues | ||||||
|                       )); |                       )); | ||||||
|                 } else { |                 } else { | ||||||
|                     $htmlret = load_view(__DIR__ . '/views/formShow.php', array( |                     $htmlret = load_view(__DIR__ . '/views/formShow.php', array( | ||||||
|  |  | ||||||
|  | @ -247,7 +247,6 @@ class dbinterface | ||||||
|         $result = false; |         $result = false; | ||||||
|         switch ($table_name) { |         switch ($table_name) { | ||||||
|             case 'sccpsettings': |             case 'sccpsettings': | ||||||
|                 dbug('savevalue', $save_value); |  | ||||||
|                 if ($mode == 'replace') {  // Change mode name to be more transparent
 |                 if ($mode == 'replace') {  // Change mode name to be more transparent
 | ||||||
|                     $dbh->prepare('TRUNCATE sccpsettings')->execute(); |                     $dbh->prepare('TRUNCATE sccpsettings')->execute(); | ||||||
|                     $stmt = $dbh->prepare('INSERT INTO sccpsettings (keyword, data, seq, type, systemdefault) VALUES (:keyword,:data,:seq,:type,:systemdefault)'); |                     $stmt = $dbh->prepare('INSERT INTO sccpsettings (keyword, data, seq, type, systemdefault) VALUES (:keyword,:data,:seq,:type,:systemdefault)'); | ||||||
|  |  | ||||||
|  | @ -58,6 +58,9 @@ if (function_exists('music_list')) { | ||||||
| if (!is_array($moh_list)) { | if (!is_array($moh_list)) { | ||||||
|     $moh_list = array('default'); |     $moh_list = array('default'); | ||||||
| } | } | ||||||
|  | if (empty($fvalues)) { | ||||||
|  |     $fvalues = $sccp_defaults; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| $items = $itm -> children(); | $items = $itm -> children(); | ||||||
| 
 | 
 | ||||||
|  | @ -115,8 +118,7 @@ foreach ($items as $child) { | ||||||
|             } |             } | ||||||
|             if (!empty($fvalues[$res_n])) { |             if (!empty($fvalues[$res_n])) { | ||||||
|                 if (!empty($fvalues[$res_n]['data'])) { |                 if (!empty($fvalues[$res_n]['data'])) { | ||||||
|                     // TODO: Need to store sysvalues in a separate array
 |                     if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data'])) { | ||||||
|                     if (!empty($fvalues[$res_n]['systemdefault']) && ($fvalues[$res_n]['systemdefault'] != $fvalues[$res_n]['data'])) { |  | ||||||
|                         $usingSysDefaults = false; |                         $usingSysDefaults = false; | ||||||
|                     } |                     } | ||||||
|                     $value->value = $fvalues[$res_n]['data']; |                     $value->value = $fvalues[$res_n]['data']; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue