Ring Groups: Enhance Destination Enabled Switch

This commit is contained in:
fusionate
2023-01-21 01:30:34 +00:00
parent 581c919132
commit df6bc02489
5 changed files with 214 additions and 24 deletions

View File

@@ -368,14 +368,16 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_prompt";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; //confirm,announce
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false'];
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_prompt";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';

View File

@@ -883,6 +883,27 @@ $text['label-destination_timeout']['ru-ru'] = "Тайм-аут";
$text['label-destination_timeout']['sv-se'] = "Tidsgräns";
$text['label-destination_timeout']['uk-ua'] = "Таймаут";
$text['label-destination_enabled']['en-us'] = "Enabled";
$text['label-destination_enabled']['en-gb'] = "Enabled";
$text['label-destination_enabled']['ar-eg'] = "";
$text['label-destination_enabled']['de-at'] = "Aktiviert"; //copied from de-de
$text['label-destination_enabled']['de-ch'] = "Aktiviert"; //copied from de-de
$text['label-destination_enabled']['de-de'] = "Aktiviert";
$text['label-destination_enabled']['es-cl'] = "Activado";
$text['label-destination_enabled']['es-mx'] = "Activado"; //copied from es-cl
$text['label-destination_enabled']['fr-ca'] = "Activé"; //copied from fr-fr
$text['label-destination_enabled']['fr-fr'] = "Activé";
$text['label-destination_enabled']['he-il'] = "מופעל";
$text['label-destination_enabled']['it-it'] = "Abilitato";
$text['label-destination_enabled']['nl-nl'] = "Aan";
$text['label-destination_enabled']['pl-pl'] = "Włączony";
$text['label-destination_enabled']['pt-br'] = "Ativado";
$text['label-destination_enabled']['pt-pt'] = "Habilitado";
$text['label-destination_enabled']['ro-ro'] = "";
$text['label-destination_enabled']['ru-ru'] = "Включено";
$text['label-destination_enabled']['sv-se'] = "Aktiverad";
$text['label-destination_enabled']['uk-ua'] = "Включено";
$text['label-destination_prompt_confirm']['en-us'] = "Confirm";
$text['label-destination_prompt_confirm']['en-gb'] = "Confirm";
$text['label-destination_prompt_confirm']['ar-eg'] = "";

View File

@@ -377,8 +377,8 @@
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_number"] = $row['destination_number'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_delay"] = $row['destination_delay'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_timeout"] = $row['destination_timeout'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_prompt"] = $row['destination_prompt'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_enabled"] = $row['destination_enabled'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_prompt"] = $row['destination_prompt'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["domain_uuid"] = $domain_uuid;
}
$y++;
@@ -755,7 +755,7 @@
if (permission_exists('ring_group_prompt')) {
echo " <td class='vtable'>".$text['label-destination_prompt']."</td>\n";
}
echo " <td class='vtable'>"."Enable"."</td>\n";
echo " <td class='vtable'>".$text['label-destination_enabled']."</td>\n";
if ($show_destination_delete && permission_exists('ring_group_destination_delete')) {
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_destinations', 'delete_toggle_destinations');\" onmouseout=\"swap_display('delete_label_destinations', 'delete_toggle_destinations');\">\n";
echo " <span id='delete_label_destinations'>".$text['label-delete']."</span>\n";
@@ -770,13 +770,19 @@
if (strlen($row['ring_group_destination_uuid']) > 0) {
echo " <input name='ring_group_destinations[".$x."][ring_group_destination_uuid]' type='hidden' value=\"".escape($row['ring_group_destination_uuid'])."\">\n";
} else {
$row['destination_enabled'] = 'true';
}
}
echo " <tr>\n";
echo " <td class='formfld'>\n";
echo " <input type=\"text\" name=\"ring_group_destinations[".$x."][destination_number]\" class=\"formfld\" value=\"".escape($row['destination_number'])."\">\n";
if (!is_uuid($row['ring_group_destination_uuid'])) { // new record
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
$onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').checked = (this.value != '' ? true : false);\""; // switch
}
else {
$onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').value = (this.value != '' ? true : false);\""; // select
}
}
echo " <input type=\"text\" name=\"ring_group_destinations[".$x."][destination_number]\" class=\"formfld\" value=\"".escape($row['destination_number'])."\" ".$onkeyup.">\n";
echo " </td>\n";
echo " <td class='formfld'>\n";
echo " <select name='ring_group_destinations[".$x."][destination_delay]' class='formfld' style='width:55px'>\n";
@@ -807,7 +813,6 @@
}
echo " </select>\n";
echo " </td>\n";
if (permission_exists('ring_group_prompt')) {
echo " <td class='formfld'>\n";
echo " <select class='formfld' style='width: 90px;' name='ring_group_destinations[".$x."][destination_prompt]'>\n";
@@ -817,19 +822,22 @@
echo " </select>\n";
echo " </td>\n";
}
echo " <td valign='top' class='".$row_style[$c]." switch-c'>\n";
###iphone
echo " <label class='switch'>\n";
$checked = ($row['destination_enabled'] == 'true' ? 'checked=checked' : '');
echo " <input type ='checkbox' id='ring_group_destinations[".$x."][destination_enabled]' name='ring_group_destinations[".$x."][destination_enabled]' $checked>\n";
echo " <div class ='slider round'></div>\n";
echo " </div>\n";
#iphone button
echo "</td>";
echo " <td class='formfld'>\n";
// switch
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='ring_group_destinations_".$x."_destination_enabled' name='ring_group_destinations[".$x."][destination_enabled]' value='true' ".($row['destination_enabled'] == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
// select
else {
echo " <select class='formfld' id='ring_group_destinations_".$x."_destination_enabled' name='ring_group_destinations[".$x."][destination_enabled]'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($row['destination_enabled'] == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo " </td>\n";
if ($show_destination_delete && permission_exists('ring_group_destination_delete')) {
if (is_uuid($row['ring_group_destination_uuid'])) {
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";

View File

@@ -1655,6 +1655,46 @@
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the color (and opacity) of input placeholder text.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "f409564a-5f06-4d93-b8ae-7fa38838252a";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_toggle_switch_background_color_false";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#c0c0c0";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the color of the toggle switch container when it is in the off/false position.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7d922f86-a085-4a9a-9656-677c596101c6";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_toggle_switch_background_color_true";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#2e82d0";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the color of the toggle switch container when it is in the on/true position.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "26ba3dec-55c2-4884-8d6e-3b05022865a7";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_toggle_switch_handle_color";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#ffffff";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the color of the toggle switch handle.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "e375d855-fc96-46ff-abd0-199c812bdb25";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_toggle_switch_handle_symbol";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set whether the off/false 'O' and on/true '|' symbol appears on the toggle switch handle.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "e3fc36f3-c11e-4030-8338-1bff25e55748";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "input_toggle_style";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "switch_round";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the toggle control style. Options: 'select' (default), 'switch_square', 'switch_round'";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "c2630eb3-a04e-4a32-9990-45f37af70005";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "login_input_background_color";

View File

@@ -1672,6 +1672,125 @@ header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
border-color: <?php echo ($_SESSION['theme']['login_input_border_color']['text'] != '') ? $_SESSION['theme']['login_input_border_color']['text'] : (($_SESSION['theme']['input_border_color']['text'] != '') ? $_SESSION['theme']['input_border_color']['text'] : '#c0c0c0'); ?>;
}
/* TOGGLE SWITCH *******************************************************/
.switch { /* container */
position: relative;
display: inline-block;
width: 50px;
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
height: 28px;
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
height: 26px;
<?php } ?>
margin: 1px;
<?php $br = format_border_radius($_SESSION['theme']['input_border_radius']['text'], '3px'); ?>
-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-khtml-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
<?php unset($br); ?>
}
.switch > input {
display: none;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: <?php echo $_SESSION['theme']['input_toggle_switch_background_color_false']['text'] ?: ($_SESSION['theme']['input_border_color']['text'] ?: '#c0c0c0'); ?>;
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
<?php $br = format_border_radius($_SESSION['theme']['input_border_radius']['text'], '3px'); ?>
-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-khtml-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
<?php unset($br); ?>
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
border-radius: 22px;
<?php } ?>
-webkit-transition: .2s;
transition: .2s;
}
.slider:before { /* when disabled */
position: absolute;
<?php if ($_SESSION['theme']['input_toggle_switch_handle_symbol']['boolean'] === 'true') { ?>
text-align: center;
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
padding-top: 3px;
<?php } else if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
padding-top: 2px;
<?php } ?>
content: 'O';
color: <?php echo $_SESSION['theme']['input_toggle_switch_background_color_false']['text'] ?: ($_SESSION['theme']['input_border_color']['text'] ?: '#c0c0c0'); ?>;
<?php } else { ?>
content: '';
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
height: 24px;
width: 24px;
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
height: 22px;
width: 22px;
<?php } ?>
top: 2px;
left: 2px;
bottom: 2px;
background: <?php echo $_SESSION['theme']['input_toggle_switch_handle_color']['text'] ?: ($_SESSION['theme']['input_background_color']['text'] ?: '#ffffff'); ?>;
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
<?php $br = format_border_radius($_SESSION['theme']['input_border_radius']['text'], '3px'); ?>
-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-khtml-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
<?php unset($br); ?>
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
border-radius: 50%;
<?php } ?>
-webkit-transition: .2s;
transition: .2s;
}
input:checked + .slider { /* when enabled */
background: <?php echo $_SESSION['theme']['input_toggle_switch_background_color_true']['text'] ?: '#2e82d0'; ?>;
}
input:focus + .slider { /* when focused, required for switch movement */
}
input:checked + .slider:before { /* distance switch moves horizontally */
<?php if ($_SESSION['theme']['input_toggle_switch_handle_symbol']['boolean'] === 'true') { ?>
text-align: center;
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
padding-top: 2px;
<?php } else if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
padding-top: 1px;
<?php } ?>
content: '|';
color: <?php echo $_SESSION['theme']['input_toggle_switch_background_color_true']['text'] ?: '#2e82d0'; ?>;
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_square') { ?>
-webkit-transform: translateX(22px);
-ms-transform: translateX(22px);
transform: translateX(22px);
<?php } ?>
<?php if ($_SESSION['theme']['input_toggle_style']['text'] == 'switch_round') { ?>
-webkit-transform: translateX(24px);
-ms-transform: translateX(24px);
transform: translateX(24px);
<?php } ?>
}
/* TABLES *****************************************************************/
table {