WIP Partial fix for setting default radio buttons
This commit is contained in:
parent
02f0b401d0
commit
dcd9c75886
|
@ -1057,7 +1057,7 @@ function sleep(milliseconds)
|
|||
}
|
||||
|
||||
$(".sccp-restore").click(function() {
|
||||
//input is sent by data-for where for is an attribute
|
||||
//input is sent by data-for where for as an attribute
|
||||
var id = $(this).data("for"), input = $("#" + id);
|
||||
var edit_style = document.getElementById("edit_" + id).style;
|
||||
|
||||
|
@ -1066,9 +1066,11 @@ $(".sccp-restore").click(function() {
|
|||
return;
|
||||
}
|
||||
if ($(this).is(":checked")) {
|
||||
console.log('restore/checked');
|
||||
edit_style.display = 'block';
|
||||
input.prop("readonly", true);
|
||||
} else {
|
||||
console.log('restore/unchecked');
|
||||
edit_style.display = 'none';
|
||||
input.data("custom", input.val());
|
||||
input.prop("readonly", true);
|
||||
|
@ -1077,20 +1079,36 @@ $(".sccp-restore").click(function() {
|
|||
});
|
||||
|
||||
$(".sccp-edit").click(function() {
|
||||
//input is sent by data-for where for is an attribute
|
||||
var id = $(this).data("for"), input = $("#" + id);
|
||||
var edit_style = document.getElementById("edit_" + id).style;
|
||||
//input is sent by data-for where for is an attribute
|
||||
if ($(this).data("type") === 'radio') {
|
||||
input = 'radio';
|
||||
console.log('have radio type');
|
||||
// $(':radio:not(:checked)').attr('disabled', true); to make readonly
|
||||
// Need to use getElementBy Name
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(input);
|
||||
if (input.length === 0) {
|
||||
return;
|
||||
}
|
||||
if ($(this).is(":checked")) {
|
||||
console.log('edit/checked');
|
||||
edit_style.display = 'block';
|
||||
if (input == 'radio') {
|
||||
return;
|
||||
}
|
||||
input.prop("readonly", false);
|
||||
input.focus();
|
||||
} else {
|
||||
console.log('edit/unchecked');
|
||||
edit_style.display = 'none';
|
||||
if (input == 'radio') {
|
||||
return;
|
||||
}
|
||||
input.data("custom", input.val());
|
||||
input.prop("readonly", true);
|
||||
input.val(input.data("default"));
|
||||
|
|
|
@ -403,6 +403,8 @@ foreach ($items as $child) {
|
|||
$res_sec_class ='';
|
||||
if (!empty($child ->class)) {
|
||||
$res_sec_class = (string)$child ->class;
|
||||
} else {
|
||||
$res_sec_class = 'sccp-custom';
|
||||
}
|
||||
|
||||
echo '<!-- Begin '.$child->label.' -->';
|
||||
|
@ -411,7 +413,7 @@ foreach ($items as $child) {
|
|||
<div class="row">
|
||||
<div class="form-group <?php echo $res_sec_class;?>">
|
||||
<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>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
|
@ -449,12 +451,14 @@ foreach ($items as $child) {
|
|||
if ($usingSysDefaults) {
|
||||
// Setting a site specific value
|
||||
echo " data-for={$res_id}";
|
||||
echo " data-type=radio";
|
||||
echo " class=sccp-edit";
|
||||
echo " id=usedefault_{$res_id}";
|
||||
echo " :checked";
|
||||
} else {
|
||||
// reverting to chan-sccp default values
|
||||
echo " data-for={$res_id}";
|
||||
echo " data-type=radio";
|
||||
echo " class=sccp-restore";
|
||||
echo " id=usedefault_{$res_id}";
|
||||
echo " ";
|
||||
|
@ -471,10 +475,11 @@ foreach ($items as $child) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <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_id; ?>">
|
||||
<div class="col-md-3">
|
||||
<i><?php echo "Enter new site value for {$shortId}"; ?></i>
|
||||
<i><?php echo "Enter new site value for {$res_n}"; ?></i>
|
||||
</div>
|
||||
<div class="col-md-9 radioset " data-hide="on">
|
||||
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
<form autocomplete="off" name="frm_device" id="frm_device" class="fpbx-submit" action="" method="post">
|
||||
<input type="hidden" name="category" value="deviceform">
|
||||
<input type="hidden" name="Submit" value="Submit">
|
||||
<div class="fpbx-container container-fluid">
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<h2 style="border:2px solid Tomato;color:Tomato;" ><?php echo _("Warning : Any changes to the device configuration can cause all phones to restart"); ?></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$def_val_line = $this->getTableDefaults('sccpline');
|
||||
|
|
Loading…
Reference in a new issue