From 9f66a1486d714f007211bcbc095ea616624590be Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Thu, 2 Apr 2020 19:22:12 -0400 Subject: [PATCH 1/4] Update call_flows.php --- app/call_flows/call_flows.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index ab3bff30ab..55ec083021 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -48,6 +48,7 @@ $action = $_POST['action']; $search = $_POST['search']; $call_flows = $_POST['call_flows']; + $toggle_field = $_POST['toggle_field']; } //process the http post data by action @@ -62,6 +63,7 @@ case 'toggle': if (permission_exists('call_flow_edit')) { $obj = new call_flows; + $obj->toggle_field = $toggle_field; $obj->toggle($call_flows); } break; @@ -130,6 +132,16 @@ $document['title'] = $text['title-call_flows']; require_once "resources/header.php"; +//javascript for toggle select box + echo "\n"; + //show the content echo "
\n"; echo "
".$text['title-call_flows']." (".$num_rows.")
\n"; @@ -141,7 +153,12 @@ echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','onclick'=>"modal_open('modal-copy','btn_copy');"]); } if (permission_exists('call_flow_edit') && $call_flows) { - echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'name'=>'btn_toggle','onclick'=>"modal_open('modal-toggle','btn_toggle');"]); + echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'name'=>'btn_toggle','onclick'=>"toggle_select(); this.blur();"]); + echo ""; } if (permission_exists('call_flow_delete') && $call_flows) { echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','onclick'=>"modal_open('modal-delete','btn_delete');"]); @@ -162,7 +179,7 @@ echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]); } if (permission_exists('call_flow_edit') && $call_flows) { - echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]); + echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); document.getElementById('toggle_field').value = document.getElementById('call_flow_feature').options[document.getElementById('call_flow_feature').selectedIndex].value; list_action_set('toggle'); list_form_submit('form_list');"])]); } if (permission_exists('call_flow_delete') && $call_flows) { echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]); @@ -173,6 +190,7 @@ echo "
\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -189,6 +207,7 @@ if (permission_exists('call_flow_context')) { echo th_order_by('call_flow_context', $text['label-call_flow_context'], $order_by, $order); } + echo th_order_by('call_flow_enabled', $text['label-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('call_flow_description', $text['label-call_flow_description'], $order_by, $order, null, "class='hide-sm-dn'"); if (permission_exists('call_flow_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; @@ -214,7 +233,7 @@ $status_label = $row['call_flow_status'] != 'false' ? $row['call_flow_label'] : $row['call_flow_alternate_label']; if (permission_exists('call_flow_edit')) { echo " \n"; } + if (permission_exists('call_flow_edit')) { + echo " \n"; if (permission_exists('call_flow_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; } + echo "\n"; + echo "\n"; + echo "\n"; echo "
 "; @@ -224,6 +243,14 @@ if (permission_exists('call_flow_context')) { echo " ".escape($row['call_flow_context'])." "; + echo escape($row['call_flow_enabled']); + } echo " ".escape($row['call_flow_description'])." "; From 4d251bd47a91b12bef5417192e889c86909c8fb4 Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Thu, 2 Apr 2020 19:22:56 -0400 Subject: [PATCH 2/4] Update call_flow_edit.php --- app/call_flows/call_flow_edit.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 24b24afb6f..c3609320ac 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -73,6 +73,7 @@ $call_flow_alternate_sound = $_POST["call_flow_alternate_sound"]; $call_flow_alternate_destination = $_POST["call_flow_alternate_destination"]; $call_flow_context = $_POST["call_flow_context"]; + $call_flow_enabled = $_POST["call_flow_enabled"]; $call_flow_description = $_POST["call_flow_description"]; //seperate the action and the param @@ -194,7 +195,7 @@ $array["dialplans"][$i]["dialplan_continue"] = "false"; $array["dialplans"][$i]["dialplan_xml"] = $dialplan_xml; $array["dialplans"][$i]["dialplan_order"] = "333"; - $array["dialplans"][$i]["dialplan_enabled"] = "true"; + $array["dialplans"][$i]["dialplan_enabled"] = $call_flow_enabled; $array["dialplans"][$i]["dialplan_description"] = $call_flow_description; $array["dialplans"][$i]["app_uuid"] = "b1b70f85-6b42-429b-8c5a-60c8b02b7d14"; @@ -219,6 +220,7 @@ $array["call_flows"][$i]["call_flow_alternate_data"] = $call_flow_alternate_data; } $array["call_flows"][$i]["call_flow_context"] = $call_flow_context; + $array["call_flows"][$i]["call_flow_enabled"] = $call_flow_enabled; $array["call_flows"][$i]["call_flow_description"] = $call_flow_description; //add the dialplan permission @@ -297,6 +299,7 @@ $call_flow_alternate_sound = $row["call_flow_alternate_sound"]; $call_flow_alternate_app = $row["call_flow_alternate_app"]; $call_flow_alternate_data = $row["call_flow_alternate_data"]; + $call_flow_enabled = $row["call_flow_enabled"]; $call_flow_description = $row["call_flow_description"]; //if superadmin show both the app and data @@ -679,6 +682,26 @@ echo "
\n"; + echo " ".$text['label-enabled']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; echo " ".$text['label-call_flow_description']."\n"; From 5be42308478c3777b186b4c0d7f5c923f51e1d79 Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Thu, 2 Apr 2020 19:23:25 -0400 Subject: [PATCH 3/4] Update app_config.php --- app/call_flows/app_config.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/call_flows/app_config.php b/app/call_flows/app_config.php index 9c2866e065..7cfe5535c9 100644 --- a/app/call_flows/app_config.php +++ b/app/call_flows/app_config.php @@ -167,6 +167,11 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the alernate application data."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "call_flow_enabled"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select whether to enable or disable the call flow"; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "call_flow_description"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; From 0aedf080554947352daddce0829c9a5c7b41e0e7 Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Thu, 2 Apr 2020 19:25:26 -0400 Subject: [PATCH 4/4] Update call_flows.php --- app/call_flows/resources/classes/call_flows.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/call_flows/resources/classes/call_flows.php b/app/call_flows/resources/classes/call_flows.php index d6460cd98e..10320a3e07 100644 --- a/app/call_flows/resources/classes/call_flows.php +++ b/app/call_flows/resources/classes/call_flows.php @@ -28,6 +28,11 @@ if (!class_exists('call_flows')) { class call_flows { + /** + * declare public variables + */ + public $toggle_field; + /** * declare private variables */ @@ -37,7 +42,6 @@ if (!class_exists('call_flows')) { private $list_page; private $table; private $uuid_prefix; - private $toggle_field; private $toggle_values; /** @@ -52,7 +56,6 @@ if (!class_exists('call_flows')) { $this->list_page = 'call_flows.php'; $this->table = 'call_flows'; $this->uuid_prefix = 'call_flow_'; - $this->toggle_field = 'call_flow_status'; $this->toggle_values = ['true','false']; } @@ -171,7 +174,6 @@ if (!class_exists('call_flows')) { */ public function toggle($records) { if (permission_exists($this->permission_prefix.'edit')) { - //add multi-lingual support $language = new text; $text = $language->get(); @@ -385,4 +387,4 @@ if (!class_exists('call_flows')) { } //class } -?> \ No newline at end of file +?>