Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enable toggle to more pages #6549

Merged
merged 19 commits into from Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 11 additions & 13 deletions app/bridges/bridge_edit.php
Expand Up @@ -54,7 +54,7 @@
$bridge_uuid = $_POST["bridge_uuid"];
$bridge_name = $_POST["bridge_name"];
$bridge_destination = $_POST["bridge_destination"];
$bridge_enabled = $_POST["bridge_enabled"];
$bridge_enabled = $_POST["bridge_enabled"] ?: 'false';
$bridge_description = $_POST["bridge_description"];
}

Expand Down Expand Up @@ -218,20 +218,18 @@
echo " ".$text['label-bridge_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <select class='formfld' name='bridge_enabled'>\n";
if ($bridge_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='bridge_enabled' name='bridge_enabled' value='true' ".($bridge_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='bridge_enabled' name='bridge_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($bridge_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
if ($bridge_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-bridge_enabled']."\n";
echo "</td>\n";
Expand Down Expand Up @@ -261,4 +259,4 @@
//include the footer
require_once "resources/footer.php";

?>
?>
18 changes: 13 additions & 5 deletions app/call_block/call_block_edit.php
Expand Up @@ -60,7 +60,7 @@
$call_block_name = $_POST["call_block_name"];
$call_block_country_code = $_POST["call_block_country_code"];
$call_block_number = $_POST["call_block_number"];
$call_block_enabled = $_POST["call_block_enabled"];
$call_block_enabled = $_POST["call_block_enabled"] ?: 'false';
$call_block_description = $_POST["call_block_description"];

$action_array = explode(':', $_POST["call_block_action"]);
Expand Down Expand Up @@ -496,10 +496,18 @@ function call_block_action_select($label = false) {
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='call_block_enabled'>\n";
echo " <option value='true' ".(($call_block_enabled == "true") ? "selected" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".(($call_block_enabled == "false") ? "selected" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='call_block_enabled' name='call_block_enabled' value='true' ".($call_block_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' id='call_block_enabled' name='call_block_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($call_block_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo $text['description-enable']."\n";
echo "\n";
Expand Down
23 changes: 10 additions & 13 deletions app/call_flows/call_flow_edit.php
Expand Up @@ -76,7 +76,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_enabled = $_POST["call_flow_enabled"] ?: 'false';
$call_flow_description = $_POST["call_flow_description"];

//seperate the action and the param
Expand Down Expand Up @@ -717,21 +717,18 @@ function sound_select_list($var, $name, $description_name, $load_sound=false) {
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td width=\"70%\" class='vtable' align='left'>\n";
echo " <select class='formfld' name='call_flow_enabled'>\n";
if ($call_flow_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='call_flow_enabled' name='call_flow_enabled' value='true' ".($call_flow_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($call_flow_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <select class='formfld' id='call_flow_enabled' name='call_flow_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($call_flow_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo " </select>\n";

echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-call_flow_description']."\n";
Expand Down
18 changes: 13 additions & 5 deletions app/conference_centers/conference_center_edit.php
Expand Up @@ -77,7 +77,7 @@
$conference_center_extension = $_POST["conference_center_extension"];
$conference_center_greeting = $_POST["conference_center_greeting"];
$conference_center_pin_length = $_POST["conference_center_pin_length"];
$conference_center_enabled = $_POST["conference_center_enabled"];
$conference_center_enabled = $_POST["conference_center_enabled"] ?: 'false';
$conference_center_description = $_POST["conference_center_description"];

//validate the token
Expand Down Expand Up @@ -435,10 +435,18 @@
echo " ".$text['label-conference_center_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_center_enabled'>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' ".($conference_center_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='conference_center_enabled' name='conference_center_enabled' value='true' ".($conference_center_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' id='conference_center_enabled' name='conference_center_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($conference_center_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo $text['description-conference_center_enabled']."\n";
echo "</td>\n";
Expand Down
20 changes: 14 additions & 6 deletions app/conference_controls/conference_control_detail_edit.php
Expand Up @@ -40,7 +40,7 @@
$control_digits = $_POST["control_digits"];
$control_action = $_POST["control_action"];
$control_data = $_POST["control_data"];
$control_enabled = $_POST["control_enabled"];
$control_enabled = $_POST["control_enabled"] ?: 'false';
}

//process the http post
Expand Down Expand Up @@ -190,10 +190,18 @@
echo " ".$text['label-control_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='control_enabled'>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' ".($control_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='control_enabled' name='control_enabled' value='true' ".($control_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' id='control_enabled' name='control_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($control_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo $text['description-control_enabled']."\n";
echo "</td>\n";
Expand All @@ -213,4 +221,4 @@
//include the footer
require_once "resources/footer.php";

?>
?>
20 changes: 14 additions & 6 deletions app/conference_controls/conference_control_edit.php
Expand Up @@ -33,7 +33,7 @@
//get http post variables and set them to php variables
if (is_array($_POST)) {
$control_name = $_POST["control_name"];
$control_enabled = $_POST["control_enabled"];
$control_enabled = $_POST["control_enabled"] ?: 'false';
$control_description = $_POST["control_description"];
}

Expand Down Expand Up @@ -161,10 +161,18 @@
echo " ".$text['label-control_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='control_enabled'>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' ".($control_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='control_enabled' name='control_enabled' value='true' ".($control_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' id='control_enabled' name='control_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($control_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo $text['description-control_enabled']."\n";
echo "</td>\n";
Expand Down Expand Up @@ -198,4 +206,4 @@
//include the footer
require_once "resources/footer.php";

?>
?>
18 changes: 13 additions & 5 deletions app/conferences/conference_edit.php
Expand Up @@ -66,7 +66,7 @@
$conference_account_code = $_POST["conference_account_code"];
$conference_order = $_POST["conference_order"];
$conference_description = $_POST["conference_description"];
$conference_enabled = $_POST["conference_enabled"];
$conference_enabled = $_POST["conference_enabled"] ?: 'false';

//sanitize the conference name
$conference_name = preg_replace("/[^A-Za-z0-9\- ]/", "", $conference_name);
Expand Down Expand Up @@ -521,10 +521,18 @@
echo " ".$text['table-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_enabled'>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' ".($conference_enabled == 'false' ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='conference_enabled' name='conference_enabled' value='true' ".($conference_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' id='conference_enabled' name='conference_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($conference_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo "".$text['description-conference-enable']."\n";
echo "</td>\n";
Expand Down
26 changes: 17 additions & 9 deletions app/destinations/destination_edit.php
Expand Up @@ -109,7 +109,7 @@
$user_uuid = $_POST["user_uuid"];
$group_uuid = $_POST["group_uuid"];
$destination_order= $_POST["destination_order"];
$destination_enabled = $_POST["destination_enabled"];
$destination_enabled = $_POST["destination_enabled"] ?: 'false';
$destination_description = $_POST["destination_description"];
$destination_sell = check_float($_POST["destination_sell"]);
$currency = $_POST["currency"];
Expand Down Expand Up @@ -1735,15 +1735,23 @@
echo " ".$text['label-destination_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='destination_enabled'>\n";
switch ($destination_enabled) {
case "true" : $selected[1] = "selected='selected'"; break;
case "false" : $selected[2] = "selected='selected'"; break;
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='destination_enabled' name='destination_enabled' value='true' ".($destination_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' name='destination_enabled'>\n";
switch ($destination_enabled) {
case "true" : $selected[1] = "selected='selected'"; break;
case "false" : $selected[2] = "selected='selected'"; break;
}
echo " <option value='true' ".$selected[1].">".$text['label-true']."</option>\n";
echo " <option value='false' ".$selected[2].">".$text['label-false']."</option>\n";
unset($selected);
echo " </select>\n";
}
echo " <option value='true' ".$selected[1].">".$text['label-true']."</option>\n";
echo " <option value='false' ".$selected[2].">".$text['label-false']."</option>\n";
unset($selected);
echo " </select>\n";
echo "<br />\n";
echo $text['description-destination_enabled']."\n";
echo "</td>\n";
Expand Down
24 changes: 11 additions & 13 deletions app/email_templates/email_template_edit.php
Expand Up @@ -60,7 +60,7 @@
$template_subject = $_POST["template_subject"];
$template_body = $_POST["template_body"];
$template_type = $_POST["template_type"];
$template_enabled = $_POST["template_enabled"];
$template_enabled = $_POST["template_enabled"] ?: 'false';
$template_description = $_POST["template_description"];
}

Expand Down Expand Up @@ -430,20 +430,18 @@
echo " ".$text['label-template_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <select class='formfld' name='template_enabled'>\n";
if ($template_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='template_enabled' name='template_enabled' value='true' ".($template_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='template_enabled' name='template_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($template_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
if ($template_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-template_enabled']."\n";
echo "</td>\n";
Expand Down Expand Up @@ -506,4 +504,4 @@
//include the footer
require_once "resources/footer.php";

?>
?>