From 2acda5ea06fb7575198c10056b301353145619ee Mon Sep 17 00:00:00 2001
From: Alex <40072887+alexdcrane@users.noreply.github.com>
Date: Fri, 10 Feb 2023 11:14:43 -0700
Subject: [PATCH] Add dashboard, device, extension, and gateway enabled toggle
(#6548)
* Update system_counts.php
* Update call_forward.php
* Add dashboard widget enabled toggle
* Add device enabled toggle
* Add extension enabled toggle
* Add gateway enabled toggle
* Update extension_edit.php
* Update extension_edit.php
* Update device_edit.php
* Update gateway_edit.php
---
.../resources/dashboard/call_forward.php | 2 +-
app/devices/device_edit.php | 22 ++++++++--------
app/extensions/extension_edit.php | 22 ++++++++--------
app/gateways/gateway_edit.php | 22 ++++++++--------
.../resources/dashboard/system_counts.php | 2 +-
core/dashboard/dashboard_edit.php | 25 ++++++++-----------
6 files changed, 43 insertions(+), 52 deletions(-)
diff --git a/app/call_forward/resources/dashboard/call_forward.php b/app/call_forward/resources/dashboard/call_forward.php
index b276793fb7..31d6cfef4a 100644
--- a/app/call_forward/resources/dashboard/call_forward.php
+++ b/app/call_forward/resources/dashboard/call_forward.php
@@ -143,7 +143,7 @@
echo " chart_text: '".$stats['call_forward']."'\n";
echo " },\n";
echo " legend: {\n";
- echo " position: 'right',\n";
+ echo " position: 'right',\n";
echo " reverse: true,\n";
echo " labels: {\n";
echo " usePointStyle: true,\n";
diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php
index 64d45cad28..a46a44700e 100644
--- a/app/devices/device_edit.php
+++ b/app/devices/device_edit.php
@@ -122,7 +122,7 @@
$device_uuid_alternate = $_POST["device_uuid_alternate"];
$device_model = $_POST["device_model"];
$device_firmware_version = $_POST["device_firmware_version"];
- $device_enabled = $_POST["device_enabled"];
+ $device_enabled = $_POST["device_enabled"] ?: 'false';
$device_template = $_POST["device_template"];
$device_description = $_POST["device_description"];
//lines
@@ -1862,20 +1862,18 @@
echo " ".$text['label-device_enabled']."\n";
echo "\n";
echo "
\n";
- echo " \n";
echo " \n";
echo $text['description-device_enabled']."\n";
echo " | \n";
diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php
index 196f04f0c1..ccc44a52ad 100644
--- a/app/extensions/extension_edit.php
+++ b/app/extensions/extension_edit.php
@@ -111,7 +111,7 @@
//$device_uuid = $_POST["device_uuid"];
//$device_line = $_POST["device_line"];
$voicemail_password = $_POST["voicemail_password"];
- $voicemail_enabled = $_POST["voicemail_enabled"];
+ $voicemail_enabled = $_POST["voicemail_enabled"] ?: 'false';
$voicemail_mail_to = $_POST["voicemail_mail_to"];
$voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"];
$voicemail_file = $_POST["voicemail_file"];
@@ -2169,20 +2169,18 @@
echo " ".$text['label-enabled']."\n";
echo "\n";
echo "\n";
- echo " \n";
- if ($enabled == "true") {
- echo " \n";
+ if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
+ echo " \n";
}
else {
- echo " \n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
}
- if ($enabled == "false") {
- echo " \n";
- }
- else {
- echo " \n";
- }
- echo " \n";
echo " \n";
echo $text['description-enabled']."\n";
echo " | \n";
diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php
index fb96fdc6ab..5bc4673431 100644
--- a/app/gateways/gateway_edit.php
+++ b/app/gateways/gateway_edit.php
@@ -110,7 +110,7 @@
$context = $_POST["context"];
$profile = $_POST["profile"];
$hostname = $_POST["hostname"];
- $enabled = $_POST["enabled"];
+ $enabled = $_POST["enabled"] ?: 'false';
$description = $_POST["description"];
}
@@ -876,20 +876,18 @@
echo " ".$text['label-enabled']."\n";
echo "\n";
echo "\n";
- echo " \n";
- if ($enabled == "true") {
- echo " \n";
+ if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
+ echo " \n";
}
else {
- echo " \n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
}
- if ($enabled == "false") {
- echo " \n";
- }
- else {
- echo " \n";
- }
- echo " \n";
echo " \n";
echo $text['description-enabled']."\n";
echo " | \n";
diff --git a/app/system/resources/dashboard/system_counts.php b/app/system/resources/dashboard/system_counts.php
index db6dcc1ebb..1569581447 100644
--- a/app/system/resources/dashboard/system_counts.php
+++ b/app/system/resources/dashboard/system_counts.php
@@ -315,7 +315,7 @@
chart_text: ''
},
legend: {
- position: 'right',
+ position: 'right',
reverse: true,
labels: {
usePointStyle: true,
diff --git a/core/dashboard/dashboard_edit.php b/core/dashboard/dashboard_edit.php
index 1fb5a659b7..1ee117012c 100644
--- a/core/dashboard/dashboard_edit.php
+++ b/core/dashboard/dashboard_edit.php
@@ -61,7 +61,7 @@
$dashboard_column_span = $_POST["dashboard_column_span"];
$dashboard_details_state = $_POST["dashboard_details_state"];
$dashboard_order = $_POST["dashboard_order"];
- $dashboard_enabled = $_POST["dashboard_enabled"];
+ $dashboard_enabled = $_POST["dashboard_enabled"] ?: 'false';
$dashboard_description = $_POST["dashboard_description"];
}
@@ -204,7 +204,7 @@
$sql .= " dashboard_column_span, ";
$sql .= " dashboard_details_state, ";
$sql .= " dashboard_order, ";
- $sql .= " cast(dashboard_enabled as text), ";
+ $sql .= " dashboard_enabled, ";
$sql .= " dashboard_description ";
$sql .= "from v_dashboard ";
$sql .= "where dashboard_uuid = :dashboard_uuid ";
@@ -469,21 +469,18 @@
echo " ".$text['label-dashboard_enabled']."\n";
echo "\n";
echo "\n";
- echo " \n";
- echo " \n";
- if ($dashboard_enabled == "true") {
- echo " \n";
+ if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
+ echo " \n";
}
else {
- echo " \n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
}
- if ($dashboard_enabled == "false") {
- echo " \n";
- }
- else {
- echo " \n";
- }
- echo " \n";
echo " \n";
echo $text['description-dashboard_enabled']."\n";
echo " | \n";