From af20348191a0839d327ddb7d02e1863c4834bf30 Mon Sep 17 00:00:00 2001 From: fusionate Date: Thu, 21 Aug 2025 17:21:51 -0600 Subject: [PATCH] Call Forward, Follow Me, DND: Apply slide toggle option for boolean fields. --- app/call_forward/call_forward_edit.php | 381 ++++++++++++++++--------- 1 file changed, 251 insertions(+), 130 deletions(-) diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index 1cf50ad392..634141f8ed 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -477,7 +477,7 @@ unset($sql, $parameters, $result, $row); } } - + //add the pre-defined follow me destinations for ($n = 0; $n <= (((!empty($_SESSION['follow_me']['max_destinations']['numeric'])) ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) { if (empty($destinations[$n]['uuid'])) { $destinations[$n]['uuid'] = null; } @@ -523,7 +523,7 @@ echo " source: extensions\n"; echo " });\n"; } - + echo "});\n"; echo "\n"; } @@ -558,14 +558,38 @@ echo " ".$text['label-call_forward']."\n"; echo "\n"; echo "\n"; - $on_click = "$('#tr_follow_me_settings').slideUp('fast'); "; - $on_click .= "document.getElementById('dnd_disabled').checked=true; "; - $on_click .= "document.getElementById('forward_all_destination').focus(); "; - $on_click2 = "(document.getElementById('follow_me_enabled').checked) ? $('#tr_follow_me_settings').slideDown('fast') : '' "; - echo " \n"; - echo " \n"; - unset($on_click); - echo "   "; + + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo "\n"; + echo "\n"; + } + else { + $on_click = "$('#div_follow_me_settings').slideUp('fast'); "; + $on_click .= "document.getElementById('dnd_disabled').checked=true; "; + $on_click .= "document.getElementById('forward_all_destination').focus(); "; + $on_click2 = "(document.getElementById('follow_me_enabled').checked) ? $('#div_follow_me_settings').slideDown('fast') : '' "; + echo " \n"; + echo " \n"; + unset($on_click); + echo "  "; + } + + echo " "; echo " \n"; echo "
".$text['description-call_forward']."\n"; echo "\n"; @@ -576,12 +600,29 @@ echo " ".$text['label-on-busy']."\n"; echo "\n"; echo "\n"; - $on_click = "document.getElementById('dnd_disabled').checked=true;"; - $on_click .= "document.getElementById('forward_busy_destination').focus();"; - echo " \n"; - echo " \n"; - unset($on_click); - echo "   "; + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo "\n"; + echo "\n"; + } + else { + $on_click = "document.getElementById('dnd_disabled').checked=true;"; + $on_click .= "document.getElementById('forward_busy_destination').focus();"; + echo " \n"; + echo " \n"; + unset($on_click); + echo "  "; + } + echo " "; echo " \n"; echo "
".$text['description-on-busy']."\n"; echo "\n"; @@ -592,12 +633,29 @@ echo " ".$text['label-no_answer']."\n"; echo "\n"; echo "\n"; - $on_click = "document.getElementById('dnd_disabled').checked=true;"; - $on_click .= "document.getElementById('forward_no_answer_destination').focus();"; - echo " \n"; - echo " \n"; - unset($on_click); - echo "   "; + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo "\n"; + echo "\n"; + } + else { + $on_click = "document.getElementById('dnd_disabled').checked=true;"; + $on_click .= "document.getElementById('forward_no_answer_destination').focus();"; + echo " \n"; + echo " \n"; + unset($on_click); + echo "  "; + } + echo " "; echo " \n"; echo "
".$text['description-no_answer']."\n"; echo "\n"; @@ -608,122 +666,171 @@ echo " ".$text['label-not_registered']."\n"; echo "\n"; echo "\n"; - $on_click = "document.getElementById('forward_user_not_registered_destination').focus();"; - echo " \n"; - echo " \n"; - unset($on_click); - echo "   "; + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo "\n"; + echo "\n"; + } + else { + $on_click = "document.getElementById('forward_user_not_registered_destination').focus();"; + echo " \n"; + echo " \n"; + unset($on_click); + echo "  "; + } + echo " "; echo " \n"; echo "
".$text['description-not_registered']."\n"; echo "\n"; echo "\n"; echo "
\n"; - - echo "\n"; - echo "\n"; - echo " ".$text['label-follow_me']."\n"; - echo "\n"; - echo "\n"; - $on_click = "document.getElementById('forward_all_disabled').checked=true; "; - $on_click .= "document.getElementById('dnd_disabled').checked=true; "; - echo " \n"; - echo " \n"; - unset($on_click); - echo "\n"; - echo "\n"; echo "\n"; - if (!empty($follow_me_enabled) && $follow_me_enabled == "true" && $dnd_enabled != "true" && $forward_all_enabled != "true") { $style = ''; } else { $style = 'display: none;'; } - echo "
\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - if (permission_exists('follow_me_ignore_busy')) { - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - } - - if (permission_exists('follow_me_cid_name_prefix')) { - echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; - } + echo "
\n"; - echo " ".$text['label-destinations']."\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if (permission_exists('follow_me_prompt')) { - echo " \n"; - } - echo " \n"; - - //output destinations - $on_click = ""; - foreach ($destinations as $n => $destination) { - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if (permission_exists('follow_me_prompt')) { - echo " \n"; + echo "
".$text['label-destination_number']."".$text['label-destination_delay']."".$text['label-destination_timeout']."".$text['label-destination_prompt']."
\n"; - destination_select('destinations['.$n.'][delay]', $destination['delay'], '0'); - echo " \n"; - destination_select('destinations['.$n.'][timeout]', $destination['timeout'], ((!empty($_SESSION['follow_me']['timeout']['numeric'])) ? $_SESSION['follow_me']['timeout']['numeric'] : 30)); - echo " \n"; - echo " \n"; - echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; - } - - echo "
\n"; + echo " ".$text['label-follow_me']."\n"; + echo "\n"; + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo "\n"; + echo "\n"; + } + else { + $on_click = "document.getElementById('forward_all_disabled').checked=true; "; + $on_click .= "document.getElementById('dnd_disabled').checked=true; "; + echo " \n"; + echo " \n"; + unset($on_click); } - echo "
\n"; - echo "
"; - echo $text['label-ignore_busy']; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo $text['description-ignore_busy']."\n"; - echo "
\n"; - echo " ".$text['label-cid-name-prefix']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-cid-name-prefix']."\n"; echo "
\n"; - if (permission_exists('follow_me_cid_number_prefix')) { - echo "\n"; - echo "\n"; - echo " ".$text['label-cid-number-prefix']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-cid-number-prefix']."\n"; - echo "\n"; - echo "\n"; - } + if (!empty($follow_me_enabled) && $follow_me_enabled == "true" && $dnd_enabled != "true" && $forward_all_enabled != "true") { $style = ''; } else { $style = 'display: none;'; } + echo "
\n"; - echo "\n"; - echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if (permission_exists('follow_me_ignore_busy')) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + + if (permission_exists('follow_me_cid_name_prefix')) { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + if (permission_exists('follow_me_cid_number_prefix')) { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + // echo "\n"; + echo "
\n"; + echo " ".$text['label-destinations']."\n"; + echo "\n"; + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (permission_exists('follow_me_prompt')) { + echo " \n"; + } + echo " \n"; + + //output destinations + $on_click = ""; + foreach ($destinations as $n => $destination) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (permission_exists('follow_me_prompt')) { + echo " \n"; + } + echo " \n"; + } + + echo "
".$text['label-destination_number']."".$text['label-destination_delay']."".$text['label-destination_timeout']."".$text['label-destination_prompt']."
\n"; + destination_select('destinations['.$n.'][delay]', $destination['delay'], '0'); + echo " \n"; + destination_select('destinations['.$n.'][timeout]', $destination['timeout'], ((!empty($_SESSION['follow_me']['timeout']['numeric'])) ? $_SESSION['follow_me']['timeout']['numeric'] : 30)); + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
"; + echo $text['label-ignore_busy']; + echo " \n"; + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo " \n"; + + } + else { + echo " \n"; + echo " \n"; + } + echo "
\n"; + echo $text['description-ignore_busy']."\n"; + echo "
\n"; + echo " ".$text['label-cid-name-prefix']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-cid-name-prefix']."\n"; + echo "
\n"; + echo " ".$text['label-cid-number-prefix']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-cid-number-prefix']."\n"; + echo "

\n"; + + echo "
\n"; echo "\n"; echo "\n"; @@ -732,11 +839,25 @@ echo " ".$text['label-dnd']."\n"; echo "\n"; echo "\n"; echo "\n";

\n"; - $on_click = "document.getElementById('forward_all_disabled').checked=true;"; - $on_click .= "$('#tr_follow_me_settings').slideUp('fast'); "; - $on_click2 .= "(document.getElementById('follow_me_enabled').checked) ? $('#tr_follow_me_settings').slideDown('fast') : '' "; - echo " \n"; - echo " \n"; + if (substr($settings->get('theme', 'input_toggle_style'), 0, 6) == 'switch') { + echo "\n"; + echo "\n"; + } + else { + $on_click = "document.getElementById('forward_all_disabled').checked=true;"; + $on_click2 = "if (document.getElementById('follow_me_enabled').checked) { $('#div_follow_me_settings').slideDown('fast'); }"; + echo " \n"; + echo " \n"; + } echo "
\n"; echo "