- Button assignment form adjustment

This commit is contained in:
PhantomVl 2019-09-27 14:44:56 +03:00 committed by Diederik de Groot
parent 8121a69607
commit bbe4b72fe7
No known key found for this signature in database
GPG key ID: AFA728250A1BECD6
4 changed files with 85 additions and 69 deletions

View file

@ -1038,6 +1038,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
function get_buttons_phone($get_settings, $ref_id = '', $ref_type = 'sccpdevice') { function get_buttons_phone($get_settings, $ref_id = '', $ref_type = 'sccpdevice') {
// Get Model Buttons info // Get Model Buttons info
$res = array(); $res = array();
$def_feature = array('parkinglot' => array('name' => 'P.slot', 'value' => 'default'),
'devstate' => array('name' => 'Coffee', 'value' => 'coffee'),
'monitor' => array('name' => 'Record Calls', 'value' => '')
);
// $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); // $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
$max_btn = ((!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 100)); $max_btn = ((!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 100));
@ -1073,7 +1077,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} else { } else {
$btn_opt .= ',' . $get_settings['button' . $it . '_fvalue']; $btn_opt .= ',' . $get_settings['button' . $it . '_fvalue'];
} }
if ($btn_f == 'parkinglot') {
if (!empty($get_settings['button' . $it . '_retrieve'])) {
$btn_opt .= ',RetrieveSingle';
}
}
} }
break; break;
case 'monitor': case 'monitor':
$btn_t = 'speeddial'; $btn_t = 'speeddial';
@ -1148,10 +1158,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$save_buttons = array(); $save_buttons = array();
$save_settings = array(); $save_settings = array();
$save_codec = array(); $save_codec = array();
$def_feature = array('parkinglot' => array('name' => 'P.slot', 'value' => 'default'),
'devstate' => array('name' => 'Coffee', 'value' => 'coffee'),
'monitor' => array('name' => 'Record Calls', 'value' => '')
);
$name_dev = ''; $name_dev = '';
$db_field = $this->dbinterface->get_db_SccpTableData("get_colums_sccpdevice"); $db_field = $this->dbinterface->get_db_SccpTableData("get_colums_sccpdevice");
$hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid']; $hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid'];

View file

@ -242,70 +242,59 @@ $(document).ready(function () {
} }
e.preventDefault(); e.preventDefault();
}); });
// Form.buttons - Form.adddevice // Form.buttons - Form.adddevice
$('.futuretype').change(function (e) {
$('.lineselect').change(function (e) {
var kid = $(this).data('id'); var kid = $(this).data('id');
var kval = $(this).val(); var kval = $(this).val();
$('.lineselect_' + kid).each(function () { $('.lineid_' + kid).each(function () {
var lval = $(this).data('type');
if (lval == 'featurep') {
if ( kval == 'parkinglot') {
$(this).removeClass('hidden');
} else {
$(this).addClass('hidden');
}
}
});
});
$('.buttontype').change(function (e) {
var kid = $(this).data('id');
var kval = $(this).val();
$('.lineid_' + kid).each(function () {
var lval = $(this).data('type');
var class_id = [kval];
switch (kval) { switch (kval) {
case 'silent': case 'silent':
case 'monitor': case 'monitor':
case 'line': case 'line':
class_id = ['line'];
break;
case 'adv.line': case 'adv.line':
$(this).removeClass('hidden'); class_id = ['line','adv_line'];
break; break;
case 'service': case 'service':
case 'feature': case 'feature':
if (lval == 'featurep') {
if ($('.futuretype').val() == 'parkinglot') {
class_id = [kval,lval];
}
}
break;
case 'speeddial': case 'speeddial':
class_id = ['speeddial','hintline'];
break;
case 'empty': case 'empty':
$(this).addClass('hidden'); class_id = [];
break; break;
} }
}); var pos = class_id.indexOf(lval);
$('.linevalue_' + kid).each(function () { if (pos >= 0) {
switch (kval) {
case 'service':
case 'speeddial':
$(this).removeClass('hidden');
break;
case 'feature':
case 'silent':
case 'monitor':
case 'empty':
case 'adv.line':
case 'line':
$(this).addClass('hidden');
break;
}
});
$('.linefeature_' + kid).each(function () {
switch (kval) {
case 'feature':
$(this).removeClass('hidden');
break;
case 'adv.line':
case 'service':
case 'speeddial':
case 'silent':
case 'monitor':
case 'empty':
case 'line':
$(this).addClass('hidden');
break;
}
});
$('.lineadv_' + kid).each(function () {
if (kval == 'adv.line') {
$(this).removeClass('hidden');
} else {
$(this).addClass('hidden');
}
});
$('.linespeed_' + kid).each(function () {
if (kval == 'speeddial') {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
} else { } else {
console.log(lval);
$(this).addClass('hidden'); $(this).addClass('hidden');
} }
}); });

View file

@ -13,6 +13,11 @@ $forminfo =array(
// "feature","service" -- Add leter ! // "feature","service" -- Add leter !
$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line"); $buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status"); $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status");
/*
button = feature,PDefault,ParkingLot,default,RetrieveSingle
feature,P.slot,parkinglot,P.slot,
*/
$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
//$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); //$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
@ -95,8 +100,10 @@ if (!empty($_REQUEST['ru_id'])) {
$show_form_mode = $defaul_tv; $show_form_mode = $defaul_tv;
$def_hint = ''; // Hint check Box $def_hint = ''; // Hint check Box
$def_hint_btn = ''; // Hint Combo Box $def_hint_btn = ''; // Hint Combo Box
$def_park = ''; // Hint check Box
$def_silent = ''; $def_silent = '';
$defaul_advline = ''; $defaul_advline = '';
$defaul_ftr = '';
if (strpos($defaul_btn,'@') >0) { if (strpos($defaul_btn,'@') >0) {
$defaul_tv = 'adv.line'; $defaul_tv = 'adv.line';
$show_form_mode = 'adv.line'; $show_form_mode = 'adv.line';
@ -114,7 +121,8 @@ if (!empty($_REQUEST['ru_id'])) {
if ($defaul_tv == "feature") { if ($defaul_tv == "feature") {
$defaul_ftr = $defaul_opt[0]; $defaul_ftr = $defaul_opt[0];
$defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1]; $defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1];
// print_r($defaul_fcod); $def_park = (empty($defaul_opt[2])) ? '': 'checked';
// print_r($defaul_opt);
} }
foreach ($defaul_opt as $data_i) { foreach ($defaul_opt as $data_i) {
@ -151,7 +159,7 @@ if (!empty($_REQUEST['ru_id'])) {
<div class="col-sm-5"> <div class="col-sm-5">
<div class="col-xs-3"> <div class="col-xs-3">
<!-- Line Type Select --> <!-- Line Type Select -->
<select class="form-control lineselect" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" > <select class="form-control buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" >
<?php <?php
if ($line_id == 0) { if ($line_id == 0) {
echo '<option value="line" selected >DEF LINE</option>'; echo '<option value="line" selected >DEF LINE</option>';
@ -166,7 +174,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<!-- if Line Type = feature Show Futures --> <!-- if Line Type = feature Show Futures -->
<div class="col-xs-7"> <div class="col-xs-7">
<select class ="form-control linefeature_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" > <select data-type="feature" class ="futuretype form-control lineid_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" >
<?php <?php
foreach ($feature_list as $fkey => $fval) { foreach ($feature_list as $fkey => $fval) {
$select = (($fkey == $defaul_ftr)?"selected":""); $select = (($fkey == $defaul_ftr)?"selected":"");
@ -175,7 +183,7 @@ if (!empty($_REQUEST['ru_id'])) {
?> ?>
</select> </select>
<!-- if Line Type = line Show SCCP Num --> <!-- if Line Type = line Show SCCP Num -->
<select class ="form-control lineselect_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" > <select data-type='line' class ="form-control lineid_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" >
<?php <?php
foreach ($lines_list as $data){ foreach ($lines_list as $data){
$select = (($data['name']==$defaul_btn)?"selected":""); $select = (($data['name']==$defaul_btn)?"selected":"");
@ -183,8 +191,8 @@ if (!empty($_REQUEST['ru_id'])) {
} }
?> ?>
</select> </select>
<!-- if Line Type = Othe Show Input --> <!-- if Line Type = Othe Show Input -->
<div class="linevalue_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" > <div data-type='speeddial' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
@ -194,7 +202,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<!-- if Line Type = speeddial Show Hint line --> <!-- if Line Type = speeddial Show Hint line -->
<div class="linespeed_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div data-type='hintline' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<?php <?php
echo '<div class="col-xs-5">'; echo '<div class="col-xs-5">';
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">';
@ -213,13 +221,14 @@ if (!empty($_REQUEST['ru_id'])) {
echo '</div>'; echo '</div>';
?> ?>
</div> </div>
<div class="linefeature_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <!-- if Line Type = feature Show Futures Park -->
<div class="col-xs-5"> <div data-type='feature' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div class="col-xs-4">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
</div> </div>
<div class="col-xs-5"> <div class="col-xs-4">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_fvalue" name="'.$forminfo[1]['name'].$line_id.'_fvalue" placeholder="code" value="'.$defaul_fcod.'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_fvalue" name="'.$forminfo[1]['name'].$line_id.'_fvalue" placeholder="code" value="'.$defaul_fcod.'" >';
?> ?>
@ -227,7 +236,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<!-- if Line Type = Advanced Show Hint line --> <!-- if Line Type = Advanced Show Hint line -->
<div class="lineadv_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div data-type='adv_line' class="lineid_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div class="col-xs-5"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >';
@ -239,6 +248,17 @@ if (!empty($_REQUEST['ru_id'])) {
?> ?>
</div> </div>
</div> </div>
<!-- if Line Type = feature Show Futures Park -->
<div data-type='featurep' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? (($defaul_ftr=='parkinglot')? ' ':' hidden'):' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_park';?>">
<div class="col-xs-4">
<div class="radioset" data-toggle="buttons">
<?php
echo '<input class="form-control" type="checkbox" name="'.$forminfo[1]['name'].$line_id.'_retrieve" id="'.$forminfo[1]['name'].$line_id.'_retrieve" '.$def_park.' value="retrieve">';
echo '<label for="'.$forminfo[1]['name'].$line_id.'_retrieve">RetrieveSingle</label>';
?>
</div>
</div>
</div>
</div> </div>

View file

@ -153,7 +153,7 @@ if (!empty($_REQUEST['ru_id'])) {
<div class="col-sm-5"> <div class="col-sm-5">
<div class="col-xs-3"> <div class="col-xs-3">
<!-- Line Type Select --> <!-- Line Type Select -->
<select class="form-control lineselect" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" > <select class="form-control buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" >
<?php <?php
if ($line_id == 0) { if ($line_id == 0) {
echo '<option value="line" selected >DEF LINE</option>'; echo '<option value="line" selected >DEF LINE</option>';
@ -168,7 +168,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<!-- if Line Type = feature Show Futures --> <!-- if Line Type = feature Show Futures -->
<div class="col-xs-7"> <div class="col-xs-7">
<select class ="form-control linefeature_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" > <select data-type="feature" class ="futuretype form-control lineid_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" >
<?php <?php
foreach ($feature_list as $fkey => $fval) { foreach ($feature_list as $fkey => $fval) {
$select = (($fkey == $defaul_ftr)?"selected":""); $select = (($fkey == $defaul_ftr)?"selected":"");
@ -177,7 +177,7 @@ if (!empty($_REQUEST['ru_id'])) {
?> ?>
</select> </select>
<!-- if Line Type = line Show SCCP Num --> <!-- if Line Type = line Show SCCP Num -->
<select class ="form-control lineselect_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" > <select data-type='line' class ="form-control lineid_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" >
<?php <?php
foreach ($lines_list as $data){ foreach ($lines_list as $data){
$select = (($data['id']==$defaul_btn)?"selected":""); $select = (($data['id']==$defaul_btn)?"selected":"");
@ -186,7 +186,7 @@ if (!empty($_REQUEST['ru_id'])) {
?> ?>
</select> </select>
<!-- if Line Type = Othe Show Input --> <!-- if Line Type = Othe Show Input -->
<div class="linevalue_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" > <div data-type='speeddial' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
@ -196,7 +196,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<!-- if Line Type = speeddial Show Hint line --> <!-- if Line Type = speeddial Show Hint line -->
<div class="linespeed_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div data-type='hintline' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<?php <?php
echo '<div class="col-xs-5">'; echo '<div class="col-xs-5">';
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">';
@ -215,7 +215,8 @@ if (!empty($_REQUEST['ru_id'])) {
echo '</div>'; echo '</div>';
?> ?>
</div> </div>
<div class="linefeature_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <!-- if Line Type = feature Show Futures Park -->
<div data-type='feature' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div class="col-xs-5"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >';
@ -229,7 +230,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<!-- if Line Type = Advanced Show Hint line --> <!-- if Line Type = Advanced Show Hint line -->
<div class="lineadv_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div data-type='adv_line' class="lineid_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div class="col-xs-5"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >';