Simplify chan-sccp help usage
Convert array to string when loaded, and rename arrays that hold the data for clarity
This commit is contained in:
parent
3ec730b71b
commit
64624fa597
|
@ -101,7 +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();
|
public $sccpHelpInfo = 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;
|
||||||
|
@ -155,11 +155,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$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.
|
// 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');
|
$sysConfiguration = $this->aminterface->getSCCPConfigMetaData('general');
|
||||||
|
|
||||||
foreach ($sysConfiguration['Options'] as $key => $valueArray) {
|
foreach ($sysConfiguration['Options'] as $key => $valueArray) {
|
||||||
$this->sccp_metainfo[$valueArray['Name']] = $valueArray['Description'];
|
foreach ($valueArray['Description'] as $descKey => $descValue) {
|
||||||
|
$this->sccpHelpInfo[$valueArray['Name']] .= $descValue . '<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unset($sysConfiguration);
|
unset($sysConfiguration);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +176,7 @@ 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,
|
'chanSccpHelp' => $this->sccpHelpInfo,
|
||||||
'sccp_defaults' => $this->sccpvalues
|
'sccp_defaults' => $this->sccpvalues
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,7 +186,7 @@ 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,
|
'chanSccpHelp' => $this->sccpHelpInfo,
|
||||||
'sccp_defaults' => $this->sccpvalues
|
'sccp_defaults' => $this->sccpvalues
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -107,7 +107,6 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
<class>sccp-custom</class>
|
<class>sccp-custom</class>
|
||||||
<options placeholder="Host Name"></options>
|
<options placeholder="Host Name"></options>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
<help>External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address. Resolve Hostname (if dynamic) that we're going to resolve when setting up the RTP media stream (only active if externip=0.0.0.0 and host is natted.)</help>
|
<help>External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address. Resolve Hostname (if dynamic) that we're going to resolve when setting up the RTP media stream (only active if externip=0.0.0.0 and host is natted.)</help>
|
||||||
<meta_help>1</meta_help>
|
<meta_help>1</meta_help>
|
||||||
<nameseparator> / </nameseparator>
|
<nameseparator> / </nameseparator>
|
||||||
|
|
|
@ -92,7 +92,7 @@ foreach ($items as $child) {
|
||||||
$res_id = $npref.$res_oid;
|
$res_id = $npref.$res_oid;
|
||||||
if (!empty($metainfo[$res_oid])) {
|
if (!empty($metainfo[$res_oid])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_oid]['Description'];
|
$child->help = $metainfo[$res_oid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $res_value
|
// $res_value
|
||||||
|
@ -323,7 +323,7 @@ foreach ($items as $child) {
|
||||||
$res_ext = str_replace($npref,'',$res_n);
|
$res_ext = str_replace($npref,'',$res_n);
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ foreach ($items as $child) {
|
||||||
$res_id = $npref.$res_n;
|
$res_id = $npref.$res_n;
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,11 @@ foreach ($items as $child) {
|
||||||
$res_input = '';
|
$res_input = '';
|
||||||
$res_name = '';
|
$res_name = '';
|
||||||
$usingSysDefaults = true;
|
$usingSysDefaults = true;
|
||||||
$res_oid = (string)$child->input[0]->name;
|
$shortId = (string)$child->input[0]->name;
|
||||||
$res_id = $npref.$res_oid;
|
$res_id = $npref.$shortId;
|
||||||
if (!empty($metainfo[$res_oid])) {
|
if (!empty($metainfo[$shortId])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_oid]['Description'];
|
$child->help = $metainfo[$shortId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,17 @@ foreach ($items as $child) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
echo '<!-- Begin '.$child->label.' -->';
|
echo '<!-- Begin '.$child->label.' -->';
|
||||||
|
?>
|
||||||
|
<div class="element-container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group <?php echo $res_sec_class; ?>">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
|
||||||
|
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<?php
|
||||||
|
// Can have multiple inputs for a field displayed with a separator
|
||||||
foreach ($child->xpath('input') as $value) {
|
foreach ($child->xpath('input') as $value) {
|
||||||
$res_n = (string)$value->name;
|
$res_n = (string)$value->name;
|
||||||
$res_name = $npref . $res_n;
|
$res_name = $npref . $res_n;
|
||||||
|
@ -133,19 +143,16 @@ foreach ($items as $child) {
|
||||||
if (empty($value->class)) {
|
if (empty($value->class)) {
|
||||||
$value->class = 'form-control';
|
$value->class = 'form-control';
|
||||||
}
|
}
|
||||||
|
// TODO: This is a temporary workaround and should be fixed
|
||||||
$item = array('id' => $res_id, 'setting' => $child->label, 'feature' => $res_id, 'iscustom' => 'checked');
|
$item = array('id' => $res_id, 'setting' => $child->label, 'feature' => $res_id, 'iscustom' => 'checked');
|
||||||
|
|
||||||
|
if ($i > 0) {
|
||||||
|
echo $child->nameseparator;
|
||||||
|
}
|
||||||
|
echo $value->value;
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="element-container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group <?php echo $res_sec_class; ?>">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
|
|
||||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<?php echo $value->value; ?>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<span class="radioset">
|
<span class="radioset">
|
||||||
|
@ -158,11 +165,12 @@ foreach ($items as $child) {
|
||||||
<div class="row" id="edit_<?php echo $res_id; ?>" style="display: none;">
|
<div class="row" id="edit_<?php echo $res_id; ?>" style="display: none;">
|
||||||
<div class="form-group <?php echo $res_sec_class; ?>">
|
<div class="form-group <?php echo $res_sec_class; ?>">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<i><?php echo "Enter new site value for {$res_oid}"; ?></i>
|
<i><?php echo "Enter new site value for {$shortId}"; ?></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<?php
|
<?php
|
||||||
$i=0;
|
$i=0;
|
||||||
|
// Can have multiple inputs for a field displayed with a separator
|
||||||
foreach ($child->xpath('input') as $value) {
|
foreach ($child->xpath('input') as $value) {
|
||||||
$res_n = (string)$value->name;
|
$res_n = (string)$value->name;
|
||||||
$res_name = $npref . $res_n;
|
$res_name = $npref . $res_n;
|
||||||
|
@ -225,7 +233,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $res_value
|
// $res_value
|
||||||
|
@ -369,7 +377,7 @@ foreach ($items as $child) {
|
||||||
$res_ext = str_replace($npref,'',$res_n);
|
$res_ext = str_replace($npref,'',$res_n);
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +464,7 @@ foreach ($items as $child) {
|
||||||
$res_id = $npref.$res_n;
|
$res_id = $npref.$res_n;
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +544,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +636,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +697,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,7 +989,7 @@ foreach ($items as $child) {
|
||||||
|
|
||||||
if (!empty($metainfo[$res_n])) {
|
if (!empty($metainfo[$res_n])) {
|
||||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||||
$child->help = $metainfo[$res_n]['Description'];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue