From 9dc4ee9046a2e358386d5c197a7c421eb1fc0f73 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:51:34 -0700 Subject: [PATCH] Dashboard - Use the uuid instead of name for widget ids (#7443) * Dashboard - Use the uuid instead of name for widget ids * Update active_calls.php * Update domain_limits.php * Update caller_id.php * Update registrations.php * Update ring_group_forward.php * Update switch_status.php * Update system_counts.php * Update system_cpu_status.php * Update system_services.php * Update system_status.php * Update voicemails.php * Update missed_calls.php * Update recent_calls.php * Update content.php * Update icon.php * Update parent.php * Update domains.php --- .../resources/dashboard/active_calls.php | 2 +- .../resources/dashboard/domain_limits.php | 6 +- .../resources/dashboard/caller_id.php | 6 +- .../resources/dashboard/registrations.php | 2 +- .../dashboard/ring_group_forward.php | 6 +- .../resources/dashboard/switch_status.php | 4 +- .../resources/dashboard/system_counts.php | 4 +- .../resources/dashboard/system_cpu_status.php | 4 +- .../resources/dashboard/system_services.php | 4 +- .../resources/dashboard/system_status.php | 4 +- .../resources/dashboard/voicemails.php | 4 +- .../resources/dashboard/missed_calls.php | 4 +- .../resources/dashboard/recent_calls.php | 4 +- core/dashboard/index.php | 82 +++++++++---------- .../dashboard/resources/dashboard/content.php | 2 +- core/dashboard/resources/dashboard/icon.php | 2 +- core/dashboard/resources/dashboard/parent.php | 36 ++++---- core/domains/resources/dashboard/domains.php | 2 +- 18 files changed, 88 insertions(+), 90 deletions(-) diff --git a/app/active_calls/resources/dashboard/active_calls.php b/app/active_calls/resources/dashboard/active_calls.php index 72d259b4cb..f2d176a22e 100644 --- a/app/active_calls/resources/dashboard/active_calls.php +++ b/app/active_calls/resources/dashboard/active_calls.php @@ -68,7 +68,7 @@ $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //icon and count -echo "
\n"; +echo "
\n"; echo "".$text['title']."\n"; echo "
\n"; echo "\n"; diff --git a/app/domain_limits/resources/dashboard/domain_limits.php b/app/domain_limits/resources/dashboard/domain_limits.php index 55d95dab85..5949378bf7 100644 --- a/app/domain_limits/resources/dashboard/domain_limits.php +++ b/app/domain_limits/resources/dashboard/domain_limits.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2017-2023 + Portions created by the Initial Developer are Copyright (C) 2017-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -110,7 +110,7 @@ $hud_stat_title = $text['label-destinations']; } - echo "
\n"; + echo "
\n"; echo " ".$text['label-domain_limits']."\n"; //doughnut chart @@ -240,7 +240,7 @@ echo "
"; //$n++; - echo ""; + echo ""; } echo "
\n"; } diff --git a/app/extensions/resources/dashboard/caller_id.php b/app/extensions/resources/dashboard/caller_id.php index 2d1c6e7d56..f7b5133e52 100644 --- a/app/extensions/resources/dashboard/caller_id.php +++ b/app/extensions/resources/dashboard/caller_id.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2017-2023 + Portions created by the Initial Developer are Copyright (C) 2017-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -172,7 +172,7 @@ //caller id echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".$text['label-caller_id_number']."\n"; //doughnut chart @@ -310,7 +310,7 @@ echo "\n"; echo "\n"; - echo ""; + echo ""; } echo "
\n"; diff --git a/app/registrations/resources/dashboard/registrations.php b/app/registrations/resources/dashboard/registrations.php index ff01d99c89..1c03b40e69 100644 --- a/app/registrations/resources/dashboard/registrations.php +++ b/app/registrations/resources/dashboard/registrations.php @@ -51,7 +51,7 @@ //dashboard icon echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".escape($dashboard_label).""; echo "
\n"; echo " \n"; diff --git a/app/ring_groups/resources/dashboard/ring_group_forward.php b/app/ring_groups/resources/dashboard/ring_group_forward.php index 5066e384fa..a62b352677 100644 --- a/app/ring_groups/resources/dashboard/ring_group_forward.php +++ b/app/ring_groups/resources/dashboard/ring_group_forward.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2013-2023 + Portions created by the Initial Developer are Copyright (C) 2013-2025 the Initial Developer. All Rights Reserved. Contributor(s): @@ -153,7 +153,7 @@ //ring group forward echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".$text['header-ring-group-forward']."\n"; //doughnut chart @@ -307,7 +307,7 @@ echo "\n"; } - echo ""; + echo ""; } echo "
\n"; diff --git a/app/switch/resources/dashboard/switch_status.php b/app/switch/resources/dashboard/switch_status.php index 3fb031e61d..cbcddbc288 100644 --- a/app/switch/resources/dashboard/switch_status.php +++ b/app/switch/resources/dashboard/switch_status.php @@ -77,7 +77,7 @@ } //show the content - echo "
\n"; + echo "
\n"; echo " ".$text['label-switch_status']."\n"; if (!isset($dashboard_chart_type) || $dashboard_chart_type == "doughnut") { @@ -178,7 +178,7 @@ echo "
"; //$n++; - echo ""; + echo ""; } echo "
\n"; diff --git a/app/system/resources/dashboard/system_counts.php b/app/system/resources/dashboard/system_counts.php index c143d18433..add6584799 100644 --- a/app/system/resources/dashboard/system_counts.php +++ b/app/system/resources/dashboard/system_counts.php @@ -295,7 +295,7 @@ echo "
\n"; if ($show_stat) { - echo "
\n"; + echo "
\n"; echo " ".$text['label-system_counts']."\n"; if (!isset($dashboard_chart_type) || $dashboard_chart_type == "doughnut") { @@ -499,7 +499,7 @@ echo "
"; //$n++; - echo "\n"; + echo "\n"; } echo "
\n"; ?> diff --git a/app/system/resources/dashboard/system_cpu_status.php b/app/system/resources/dashboard/system_cpu_status.php index 606fedaff9..f95c1b9423 100644 --- a/app/system/resources/dashboard/system_cpu_status.php +++ b/app/system/resources/dashboard/system_cpu_status.php @@ -51,7 +51,7 @@ } //show the content - echo "
\n"; + echo "
\n"; echo " ".$text['label-cpu_usage']."\n"; $token = (new token())->create($_SERVER['PHP_SELF']); @@ -379,7 +379,7 @@ echo "
"; //$n++; - echo ""; + echo ""; } echo "
\n"; diff --git a/app/system/resources/dashboard/system_services.php b/app/system/resources/dashboard/system_services.php index 3fbcdf4c0a..1bccbc9172 100644 --- a/app/system/resources/dashboard/system_services.php +++ b/app/system/resources/dashboard/system_services.php @@ -39,8 +39,6 @@ exit; } - $dashboard_name = "System Services"; - //function to parse a FusionPBX service from a .service file if (!function_exists('get_classname')) { function get_classname(string $file) { @@ -161,7 +159,7 @@ //show the results echo "
\n"; -echo "
\n"; +echo "
\n"; echo " System Services\n"; //doughnut chart diff --git a/app/system/resources/dashboard/system_status.php b/app/system/resources/dashboard/system_status.php index 1854523721..1d50726db9 100644 --- a/app/system/resources/dashboard/system_status.php +++ b/app/system/resources/dashboard/system_status.php @@ -120,7 +120,7 @@ \n"; + echo "
\n"; echo " ".$text['label-system_status']."\n"; if ($dashboard_chart_type == "doughnut") { @@ -406,7 +406,7 @@ echo "
"; //$n++; - echo ""; + echo ""; } echo "
\n"; diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index e24f957850..e5f42636af 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -49,7 +49,7 @@ } } - echo "
\n"; + echo "
\n"; echo " ".$text['label-new_messages'].""; if (isset($dashboard_chart_type) && $dashboard_chart_type == "doughnut") { @@ -147,7 +147,7 @@ echo "
"; //$n++; - echo ""; + echo ""; } echo "
\n"; diff --git a/app/xml_cdr/resources/dashboard/missed_calls.php b/app/xml_cdr/resources/dashboard/missed_calls.php index 20051cb68e..23e6b7b353 100644 --- a/app/xml_cdr/resources/dashboard/missed_calls.php +++ b/app/xml_cdr/resources/dashboard/missed_calls.php @@ -90,7 +90,7 @@ //missed calls echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".$text['label-missed_calls'].""; if ($dashboard_chart_type == "doughnut") { @@ -214,7 +214,7 @@ echo "
"; //$n++; - echo ""; + echo ""; } echo "
\n"; diff --git a/app/xml_cdr/resources/dashboard/recent_calls.php b/app/xml_cdr/resources/dashboard/recent_calls.php index b5ca5a635b..0ef18847f5 100644 --- a/app/xml_cdr/resources/dashboard/recent_calls.php +++ b/app/xml_cdr/resources/dashboard/recent_calls.php @@ -87,7 +87,7 @@ //recent calls echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".$text['label-recent_calls']."\n"; if ($dashboard_chart_type == "doughnut") { @@ -234,7 +234,7 @@ echo "".$text['label-view_all']."\n"; echo "
"; - echo ""; + echo ""; } echo "
\n"; diff --git a/core/dashboard/index.php b/core/dashboard/index.php index 2c257a000c..18b73b2dad 100644 --- a/core/dashboard/index.php +++ b/core/dashboard/index.php @@ -130,13 +130,13 @@ $parent_uuid = null; foreach ($dashboard as $row) { - $dashboard_name = trim(preg_replace("/[^a-z0-9_]/", '_', strtolower($row['dashboard_name'])),'_'); - if ($widget_id == $dashboard_name) { + $dashboard_id = 'id_'.md5(preg_replace('/[^-A-Fa-f0-9]/', '', $row['dashboard_uuid'])); + if ($widget_id == $dashboard_id) { if (!empty($parent_id)) { //find parent uuid foreach ($dashboard as $parent_row) { - $parent_dashboard_name = trim(preg_replace("/[^a-z0-9_]/", '_', strtolower($parent_row['dashboard_name'])), '_'); - if ($parent_dashboard_name === $parent_id) { + $parent_dashboard_id = 'id_'.md5(preg_replace('/[^-A-Fa-f0-9]/', '', $parent_row['dashboard_uuid'])); + if ($parent_dashboard_id === $parent_id) { $parent_uuid = $parent_row['dashboard_uuid']; break; } @@ -284,48 +284,48 @@ div.hud_chart { /* dashboard settings */ 2) { - echo "#".$dashboard_name." {\n"; + echo "#".$dashboard_id." {\n"; echo " grid-column: span 2;\n"; echo "}\n"; } else if (is_numeric($row['dashboard_column_span'])) { - echo "#".$dashboard_name." {\n"; + echo "#".$dashboard_id." {\n"; echo " grid-column: span ".$row['dashboard_column_span'].";\n"; echo "}\n"; } if ($row['dashboard_details_state'] == "contracted") { - echo "#".$dashboard_name." .hud_box .hud_details {\n"; + echo "#".$dashboard_id." .hud_box .hud_details {\n"; echo " display: none;\n"; echo "}\n"; } if ($row['dashboard_details_state'] == "hidden" || $row['dashboard_details_state'] == "disabled") { - echo "#".$dashboard_name." .hud_box .hud_expander, \n"; - echo "#".$dashboard_name." .hud_box .hud_details {\n"; + echo "#".$dashboard_id." .hud_box .hud_expander, \n"; + echo "#".$dashboard_id." .hud_box .hud_details {\n"; echo " display: none;\n"; echo "}\n"; } @@ -468,9 +468,9 @@ foreach ($dashboard as $row) { .col-num { grid-column: span 2; } \n"; + echo "
\n"; if (file_exists($path_array[0])) { include $path_array[0]; } diff --git a/core/dashboard/resources/dashboard/content.php b/core/dashboard/resources/dashboard/content.php index 27d98202bf..ec6424fc03 100644 --- a/core/dashboard/resources/dashboard/content.php +++ b/core/dashboard/resources/dashboard/content.php @@ -24,7 +24,7 @@ //dashboard icon echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".escape($dashboard_name).""; echo " ".$dashboard_content."\n"; echo "
\n"; diff --git a/core/dashboard/resources/dashboard/icon.php b/core/dashboard/resources/dashboard/icon.php index e0419a83b1..54581c2350 100644 --- a/core/dashboard/resources/dashboard/icon.php +++ b/core/dashboard/resources/dashboard/icon.php @@ -23,7 +23,7 @@ //dashboard icon echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".escape($dashboard_label)."\n"; echo " \n"; echo "
\n"; diff --git a/core/dashboard/resources/dashboard/parent.php b/core/dashboard/resources/dashboard/parent.php index 346498ade8..01eeb07d2c 100644 --- a/core/dashboard/resources/dashboard/parent.php +++ b/core/dashboard/resources/dashboard/parent.php @@ -117,78 +117,78 @@ div.child_widget.editable:hover:has(i) div.hud_box { /* dashboard settings */ 1) { - echo "#".$dashboard_name.".child_widget {\n"; + echo "#".$dashboard_id.".child_widget {\n"; echo " grid-column: span ".preg_replace($number_pattern, '', $row['dashboard_column_span']).";\n"; echo "}\n"; } else if ($row['dashboard_row_span'] > 1) { - echo "#".$dashboard_name.".child_widget {\n"; + echo "#".$dashboard_id.".child_widget {\n"; echo " grid-column: span 2;\n"; echo "}\n"; } @@ -231,8 +231,8 @@ foreach ($parent_widgets as $row) { //sanitize the data $dashboard_uuid = preg_replace($uuid_pattern, '', $dashboard_uuid); + $dashboard_id = 'id_'.md5($dashboard_uuid); $dashboard_name = trim(preg_replace($text_pattern, '', $dashboard_name)); - $dashboard_name_id = trim(preg_replace("/[^a-z0-9_]/", '_', strtolower($dashboard_name)),'_'); $dashboard_icon = preg_replace($text_pattern, '', $dashboard_icon); $dashboard_url = trim(preg_replace($text_pattern, '', $dashboard_url)); $dashboard_target = trim(preg_replace($text_pattern, '', $dashboard_target)); @@ -257,7 +257,7 @@ foreach ($parent_widgets as $row) { $child_widget_name = $dashboard_path_array[1]; $path_array = glob(dirname(__DIR__, 4).'/*/'.$application_name.'/resources/dashboard/'.$child_widget_name.'.php'); - echo "
\n"; + echo "
\n"; if (file_exists($path_array[0])) { include $path_array[0]; } diff --git a/core/domains/resources/dashboard/domains.php b/core/domains/resources/dashboard/domains.php index 232a427f3d..8fa3251b3c 100644 --- a/core/domains/resources/dashboard/domains.php +++ b/core/domains/resources/dashboard/domains.php @@ -33,7 +33,7 @@ //dashboard icon echo "
\n"; - echo "
\n"; + echo "
\n"; echo " ".escape($dashboard_label).""; echo "
\n"; echo " \n";