From 64624fa5975c4e0fc1bded41b8054f5bf21f0ab0 Mon Sep 17 00:00:00 2001
From: steve-lad <72376554+steve-lad@users.noreply.github.com>
Date: Wed, 30 Jun 2021 08:14:15 +0200
Subject: [PATCH] Simplify chan-sccp help usage
Convert array to string when loaded, and rename arrays that hold the data for clarity
---
Sccp_manager.class.php | 12 +++++----
conf/sccpgeneral.xml.v433 | 1 -
views/formShow.php | 16 ++++++------
views/formShowSysDefs.php | 52 ++++++++++++++++++++++-----------------
4 files changed, 45 insertions(+), 36 deletions(-)
diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php
index 63c052f..c6f78a9 100644
--- a/Sccp_manager.class.php
+++ b/Sccp_manager.class.php
@@ -101,7 +101,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
public $xml_data;
public $class_error; //error construct
public $info_warning;
- public $sccp_metainfo = array();
+ public $sccpHelpInfo = array();
// Move all non sccp_manager specific functions to traits
use \FreePBX\modules\Sccp_Manager\sccpManTraits\helperFunctions;
@@ -155,11 +155,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v433';
$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)) {
+ if (empty($this->sccpHelpInfo)) {
$sysConfiguration = $this->aminterface->getSCCPConfigMetaData('general');
foreach ($sysConfiguration['Options'] as $key => $valueArray) {
- $this->sccp_metainfo[$valueArray['Name']] = $valueArray['Description'];
+ foreach ($valueArray['Description'] as $descKey => $descValue) {
+ $this->sccpHelpInfo[$valueArray['Name']] .= $descValue . '
';
+ }
}
unset($sysConfiguration);
}
@@ -174,7 +176,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
'form_prefix' => $form_prefix,
'fvalues' => $form_values,
'tftp_lang' => $this->tftpLang,
- 'metainfo' => $this->sccp_metainfo,
+ 'chanSccpHelp' => $this->sccpHelpInfo,
'sccp_defaults' => $this->sccpvalues
));
} else {
@@ -184,7 +186,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
'form_prefix' => $form_prefix,
'fvalues' => $form_values,
'tftp_lang' => $this->tftpLang,
- 'metainfo' => $this->sccp_metainfo,
+ 'chanSccpHelp' => $this->sccpHelpInfo,
'sccp_defaults' => $this->sccpvalues
)
);
diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433
index e9214aa..c777dcb 100644
--- a/conf/sccpgeneral.xml.v433
+++ b/conf/sccpgeneral.xml.v433
@@ -107,7 +107,6 @@ and open the template in the editor. Base Version before all crash :-)