Impliment defaults for class IS
WIP
This commit is contained in:
parent
e50c32a1ac
commit
02f0b401d0
|
@ -169,7 +169,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
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) {
|
||||||
// TODO: Clean up below after debug
|
// TODO: Clean up below after debug
|
||||||
if (($group_name == 'sccp_general') || ($group_name == 'sccp_qos_config')) {
|
if (($group_name == 'sccp_general') || ($group_name == 'sccp_qos_config') || ($group_name =='sccp_dev_config')) {
|
||||||
$htmlret = load_view(__DIR__ . '/views/formShowSysDefs.php', array(
|
$htmlret = load_view(__DIR__ . '/views/formShowSysDefs.php', array(
|
||||||
'itm' => $item,
|
'itm' => $item,
|
||||||
'h_show' => $show_Header,
|
'h_show' => $show_Header,
|
||||||
|
|
|
@ -103,12 +103,10 @@ foreach ($items as $child) {
|
||||||
if (!empty($child ->class)) {
|
if (!empty($child ->class)) {
|
||||||
$res_sec_class = (string)$child ->class;
|
$res_sec_class = (string)$child ->class;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($child->nameseparator)) {
|
if (empty($child->nameseparator)) {
|
||||||
$child->nameseparator = ' / ';
|
$child->nameseparator = ' / ';
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
echo '<!-- Begin '.$child->label.' -->';
|
echo '<!-- Begin '.$child->label.' -->';
|
||||||
?>
|
?>
|
||||||
<div class="element-container">
|
<div class="element-container">
|
||||||
|
@ -125,12 +123,12 @@ foreach ($items as $child) {
|
||||||
$res_n = (string)$value->name;
|
$res_n = (string)$value->name;
|
||||||
$res_name = $npref . $res_n;
|
$res_name = $npref . $res_n;
|
||||||
//if (!empty($fvalues[$res_n])) {
|
//if (!empty($fvalues[$res_n])) {
|
||||||
//if (!empty($fvalues[$res_n]['data'])) {
|
if (!empty($fvalues[$res_n]['data'])) {
|
||||||
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data'])) {
|
if (!empty($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $fvalues[$res_n]['data'])) {
|
||||||
$usingSysDefaults = false;
|
$usingSysDefaults = false;
|
||||||
}
|
}
|
||||||
$value->value = $fvalues[$res_n]['data'];
|
$value->value = $fvalues[$res_n]['data'];
|
||||||
//}
|
}
|
||||||
//}
|
//}
|
||||||
// Default to chan-sccp defaults, not xml defaults.
|
// Default to chan-sccp defaults, not xml defaults.
|
||||||
//if (empty($value->value)) {
|
//if (empty($value->value)) {
|
||||||
|
@ -145,6 +143,7 @@ foreach ($items as $child) {
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
echo $child->nameseparator;
|
echo $child->nameseparator;
|
||||||
}
|
}
|
||||||
|
// Output current value
|
||||||
echo $value->value;
|
echo $value->value;
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
@ -175,6 +174,7 @@ foreach ($items as $child) {
|
||||||
echo ($usingSysDefaults) ? "Customise" : "Use chan-sccp defaults";
|
echo ($usingSysDefaults) ? "Customise" : "Use chan-sccp defaults";
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -368,7 +368,6 @@ foreach ($items as $child) {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($child->addbutton)) {
|
if (!empty($child->addbutton)) {
|
||||||
|
@ -399,7 +398,8 @@ foreach ($items as $child) {
|
||||||
$child->help = $metaInfo[$res_n];
|
$child->help = $metaInfo[$res_n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// --- Add Hidden option
|
|
||||||
|
// --- Add Hidden option
|
||||||
$res_sec_class ='';
|
$res_sec_class ='';
|
||||||
if (!empty($child ->class)) {
|
if (!empty($child ->class)) {
|
||||||
$res_sec_class = (string)$child ->class;
|
$res_sec_class = (string)$child ->class;
|
||||||
|
@ -411,10 +411,73 @@ foreach ($items as $child) {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group <?php echo $res_sec_class;?>">
|
<div class="form-group <?php echo $res_sec_class;?>">
|
||||||
<div class="col-md-3 radioset">
|
<div class="col-md-3 radioset">
|
||||||
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
|
<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>
|
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$i = 0;
|
||||||
|
// $res_v = 'no';
|
||||||
|
$opt_hide = '';
|
||||||
|
$res_v = '';
|
||||||
|
// set res_v according to precedence Default here, value here, supplied value
|
||||||
|
|
||||||
|
if (!empty($child->default)) {
|
||||||
|
$res_v = (string)$child->default;
|
||||||
|
}
|
||||||
|
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($sccp_defaults[$res_n]['systemdefault']) && ($sccp_defaults[$res_n]['systemdefault'] != $res_v)) {
|
||||||
|
$usingSysDefaults = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output current value
|
||||||
|
echo $res_v;
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<span class="radioset">
|
||||||
|
<input type="checkbox"
|
||||||
|
<?php
|
||||||
|
if ($usingSysDefaults) {
|
||||||
|
// Setting a site specific value
|
||||||
|
echo " data-for={$res_id}";
|
||||||
|
echo " class=sccp-edit";
|
||||||
|
echo " id=usedefault_{$res_id}";
|
||||||
|
echo " :checked";
|
||||||
|
} else {
|
||||||
|
// reverting to chan-sccp default values
|
||||||
|
echo " data-for={$res_id}";
|
||||||
|
echo " class=sccp-restore";
|
||||||
|
echo " id=usedefault_{$res_id}";
|
||||||
|
echo " ";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
<?php
|
||||||
|
echo "for=usedefault_{$res_id} >";
|
||||||
|
echo ($usingSysDefaults) ? "Customise" : "Use chan-sccp defaults";
|
||||||
|
?>
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" id="edit_<?php echo $res_id; ?>" style="display: none">
|
||||||
|
<div class="form-group <?php echo $res_sec_class; ?>">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<i><?php echo "Enter new site value for {$shortId}"; ?></i>
|
||||||
|
</div>
|
||||||
<div class="col-md-9 radioset " data-hide="on">
|
<div class="col-md-9 radioset " data-hide="on">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
// $res_v = 'no';
|
// $res_v = 'no';
|
||||||
|
@ -457,13 +520,12 @@ foreach ($items as $child) {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="row"><div class="col-md-12">
|
<div class="row"><div class="col-md-12">
|
||||||
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
|
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
|
||||||
</div>
|
</div></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in a new issue