From bbe4b72fe7d97f8ab9155c4d5d420edaa3aadf78 Mon Sep 17 00:00:00 2001 From: PhantomVl Date: Fri, 27 Sep 2019 14:44:56 +0300 Subject: [PATCH] - Button assignment form adjustment --- Sccp_manager.class.php | 14 +++++-- assets/js/sccp_manager.js | 83 +++++++++++++++++---------------------- views/form.buttons.php | 42 ++++++++++++++------ views/form.sbuttons.php | 15 +++---- 4 files changed, 85 insertions(+), 69 deletions(-) diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index 6d75830..b8edf49 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -1038,6 +1038,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { function get_buttons_phone($get_settings, $ref_id = '', $ref_type = 'sccpdevice') { // Get Model Buttons info $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'); $max_btn = ((!empty($get_settings['buttonscount']) ? $get_settings['buttonscount'] : 100)); @@ -1073,7 +1077,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } else { $btn_opt .= ',' . $get_settings['button' . $it . '_fvalue']; } + if ($btn_f == 'parkinglot') { + if (!empty($get_settings['button' . $it . '_retrieve'])) { + $btn_opt .= ',RetrieveSingle'; + } + } } + break; case 'monitor': $btn_t = 'speeddial'; @@ -1148,10 +1158,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $save_buttons = array(); $save_settings = 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 = ''; $db_field = $this->dbinterface->get_db_SccpTableData("get_colums_sccpdevice"); $hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid']; diff --git a/assets/js/sccp_manager.js b/assets/js/sccp_manager.js index 4628bdf..66de6e9 100644 --- a/assets/js/sccp_manager.js +++ b/assets/js/sccp_manager.js @@ -242,70 +242,59 @@ $(document).ready(function () { } e.preventDefault(); }); + // Form.buttons - Form.adddevice - - $('.lineselect').change(function (e) { + $('.futuretype').change(function (e) { var kid = $(this).data('id'); 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) { case 'silent': case 'monitor': case 'line': + class_id = ['line']; + break; case 'adv.line': - $(this).removeClass('hidden'); + class_id = ['line','adv_line']; break; case 'service': case 'feature': + if (lval == 'featurep') { + if ($('.futuretype').val() == 'parkinglot') { + class_id = [kval,lval]; + } + } + break; case 'speeddial': + class_id = ['speeddial','hintline']; + break; case 'empty': - $(this).addClass('hidden'); + class_id = []; break; } - }); - $('.linevalue_' + kid).each(function () { - 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') { + var pos = class_id.indexOf(lval); + if (pos >= 0) { $(this).removeClass('hidden'); } else { + console.log(lval); $(this).addClass('hidden'); } }); diff --git a/views/form.buttons.php b/views/form.buttons.php index acae18d..2fcd853 100644 --- a/views/form.buttons.php +++ b/views/form.buttons.php @@ -13,6 +13,11 @@ $forminfo =array( // "feature","service" -- Add leter ! $buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line"); $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'); //$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); @@ -95,8 +100,10 @@ if (!empty($_REQUEST['ru_id'])) { $show_form_mode = $defaul_tv; $def_hint = ''; // Hint check Box $def_hint_btn = ''; // Hint Combo Box + $def_park = ''; // Hint check Box $def_silent = ''; $defaul_advline = ''; + $defaul_ftr = ''; if (strpos($defaul_btn,'@') >0) { $defaul_tv = 'adv.line'; $show_form_mode = 'adv.line'; @@ -114,7 +121,8 @@ if (!empty($_REQUEST['ru_id'])) { if ($defaul_tv == "feature") { $defaul_ftr = $defaul_opt[0]; $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) { @@ -151,7 +159,7 @@ if (!empty($_REQUEST['ru_id'])) {
- DEF LINE'; @@ -166,7 +174,7 @@ if (!empty($_REQUEST['ru_id'])) {
- $fval) { $select = (($fkey == $defaul_ftr)?"selected":""); @@ -175,7 +183,7 @@ if (!empty($_REQUEST['ru_id'])) { ?> - - -
+ +
'; ?> @@ -194,7 +202,7 @@ if (!empty($_REQUEST['ru_id'])) {
-
+
'; echo ''; @@ -213,13 +221,14 @@ if (!empty($_REQUEST['ru_id'])) { echo '
'; ?>
-
-
+ +
+
'; ?>
-
+
'; ?> @@ -227,7 +236,7 @@ if (!empty($_REQUEST['ru_id'])) {
-
+
'; @@ -239,6 +248,17 @@ if (!empty($_REQUEST['ru_id'])) { ?>
+ +
+
+
+ '; + echo ''; + ?> +
+
+
diff --git a/views/form.sbuttons.php b/views/form.sbuttons.php index 67a4f0b..cac1a6d 100644 --- a/views/form.sbuttons.php +++ b/views/form.sbuttons.php @@ -153,7 +153,7 @@ if (!empty($_REQUEST['ru_id'])) {
- DEF LINE'; @@ -168,7 +168,7 @@ if (!empty($_REQUEST['ru_id'])) {
- $fval) { $select = (($fkey == $defaul_ftr)?"selected":""); @@ -177,7 +177,7 @@ if (!empty($_REQUEST['ru_id'])) { ?> - -
+
'; ?> @@ -196,7 +196,7 @@ if (!empty($_REQUEST['ru_id'])) {
-
+
'; echo ''; @@ -215,7 +215,8 @@ if (!empty($_REQUEST['ru_id'])) { echo '
'; ?>
-
+ +
'; @@ -229,7 +230,7 @@ if (!empty($_REQUEST['ru_id'])) {
-
+
';