From 2c4adc6d21d861c5b2a740aac07af1e2255d5910 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sun, 4 Aug 2024 10:33:19 -0600 Subject: [PATCH] Add parent dashboard parent Added for future use. Currently does nothing. --- core/dashboard/app_config.php | 16 +++++----- core/dashboard/app_languages.php | 52 +++++++++++++++++++++++++++++++ core/dashboard/dashboard_edit.php | 42 ++++++++++++++++++++++--- 3 files changed, 98 insertions(+), 12 deletions(-) diff --git a/core/dashboard/app_config.php b/core/dashboard/app_config.php index acdb555eb3..de50113316 100644 --- a/core/dashboard/app_config.php +++ b/core/dashboard/app_config.php @@ -14,42 +14,36 @@ $y = 0; $apps[$x]['permissions'][$y]['name'] = 'dashboard_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_group_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_group_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_group_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_group_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'dashboard_group_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; + $apps[$x]['permissions'][$y]['name'] = 'dashboard_parent_uuid'; + $y++; //dashboard $y = 0; @@ -62,6 +56,12 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_parent_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_name'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['search_by'] = ''; diff --git a/core/dashboard/app_languages.php b/core/dashboard/app_languages.php index ac8f489248..feb8a843d2 100644 --- a/core/dashboard/app_languages.php +++ b/core/dashboard/app_languages.php @@ -1092,6 +1092,58 @@ $text['description-dashboard_details_state']['zh-cn'] = "设置小部件详细 $text['description-dashboard_details_state']['ja-jp'] = "ウィジェットの詳細のデフォルト状態を設定します。"; $text['description-dashboard_details_state']['ko-kr'] = "위젯 세부 정보의 기본 상태를 설정합니다."; +$text['label-dashboard_parent_uuid']['en-us'] = "Parent"; +$text['label-dashboard_parent_uuid']['en-gb'] = "Parent"; +$text['label-dashboard_parent_uuid']['ar-eg'] = "الوالد"; +$text['label-dashboard_parent_uuid']['de-at'] = "Elternteil"; +$text['label-dashboard_parent_uuid']['de-ch'] = "Elternteil"; +$text['label-dashboard_parent_uuid']['de-de'] = "Elternteil"; +$text['label-dashboard_parent_uuid']['el-gr'] = "Γονέας"; +$text['label-dashboard_parent_uuid']['es-cl'] = "Padre"; +$text['label-dashboard_parent_uuid']['es-mx'] = "Padre"; +$text['label-dashboard_parent_uuid']['fr-ca'] = "Parent"; +$text['label-dashboard_parent_uuid']['fr-fr'] = "Parent"; +$text['label-dashboard_parent_uuid']['he-il'] = "הורה"; +$text['label-dashboard_parent_uuid']['it-it'] = "Genitore"; +$text['label-dashboard_parent_uuid']['nl-nl'] = "Ouder"; +$text['label-dashboard_parent_uuid']['pl-pl'] = "Rodzic"; +$text['label-dashboard_parent_uuid']['pt-br'] = "Parente"; +$text['label-dashboard_parent_uuid']['pt-pt'] = "Parente"; +$text['label-dashboard_parent_uuid']['ro-ro'] = "Părinte"; +$text['label-dashboard_parent_uuid']['ru-ru'] = "Родитель"; +$text['label-dashboard_parent_uuid']['sv-se'] = "Förälder"; +$text['label-dashboard_parent_uuid']['uk-ua'] = "Батько"; +$text['label-dashboard_parent_uuid']['tr-tr'] = "Ebeveyn"; +$text['label-dashboard_parent_uuid']['zh-cn'] = "父母"; +$text['label-dashboard_parent_uuid']['ja-jp'] = "親"; +$text['label-dashboard_parent_uuid']['ko-kr'] = "부모"; + +$text['description-dashboard_parent_uuid']['en-us'] = "Select the parent dashboard."; +$text['description-dashboard_parent_uuid']['en-gb'] = "Select the parent dashboard."; +$text['description-dashboard_parent_uuid']['ar-eg'] = "حدد لوحة التحكم الرئيسية."; +$text['description-dashboard_parent_uuid']['de-at'] = "Wählen Sie das übergeordnete Dashboard aus."; +$text['description-dashboard_parent_uuid']['de-ch'] = "Wählen Sie das übergeordnete Dashboard aus."; +$text['description-dashboard_parent_uuid']['de-de'] = "Wählen Sie das übergeordnete Dashboard aus."; +$text['description-dashboard_parent_uuid']['el-gr'] = "Επιλέξτε τον αρχικό πίνακα ελέγχου."; +$text['description-dashboard_parent_uuid']['es-cl'] = "Seleccione el tablero principal."; +$text['description-dashboard_parent_uuid']['es-mx'] = "Seleccione el tablero principal."; +$text['description-dashboard_parent_uuid']['fr-ca'] = "Sélectionnez le tableau de bord parent."; +$text['description-dashboard_parent_uuid']['fr-fr'] = "Sélectionnez le tableau de bord parent."; +$text['description-dashboard_parent_uuid']['he-il'] = "בחר את לוח המחוונים הראשי."; +$text['description-dashboard_parent_uuid']['it-it'] = "Seleziona la dashboard principale."; +$text['description-dashboard_parent_uuid']['nl-nl'] = "Selecteer het hoofddashboard."; +$text['description-dashboard_parent_uuid']['pl-pl'] = "Wybierz główny pulpit nawigacyjny."; +$text['description-dashboard_parent_uuid']['pt-br'] = "Selecione o painel principal."; +$text['description-dashboard_parent_uuid']['pt-pt'] = "Selecione o painel principal."; +$text['description-dashboard_parent_uuid']['ro-ro'] = "Selectați tabloul de bord principal."; +$text['description-dashboard_parent_uuid']['ru-ru'] = "Выберите основную панель."; +$text['description-dashboard_parent_uuid']['sv-se'] = "Välj huvuddashboarden."; +$text['description-dashboard_parent_uuid']['uk-ua'] = "Виберіть головну панель."; +$text['description-dashboard_parent_uuid']['tr-tr'] = "Ana panoyu seçin."; +$text['description-dashboard_parent_uuid']['zh-cn'] = "选择父仪表板。"; +$text['description-dashboard_parent_uuid']['ja-jp'] = "親ダッシュボードを選択します。"; +$text['description-dashboard_parent_uuid']['ko-kr'] = "상위 대시보드를 선택하십시오."; + $text['label-dashboard_order']['en-us'] = "Order"; $text['label-dashboard_order']['en-gb'] = "Order"; $text['label-dashboard_order']['ar-eg'] = "طلب"; diff --git a/core/dashboard/dashboard_edit.php b/core/dashboard/dashboard_edit.php index 539fa0bcf5..d7b414ca24 100644 --- a/core/dashboard/dashboard_edit.php +++ b/core/dashboard/dashboard_edit.php @@ -61,6 +61,7 @@ $dashboard_column_span = ''; $dashboard_row_span = ''; $dashboard_details_state = ''; + $dashboard_parent_uuid = ''; $dashboard_order = ''; $dashboard_enabled = $row["dashboard_enabled"] ?? 'true'; $dashboard_description = ''; @@ -102,6 +103,7 @@ $dashboard_column_span = $_POST["dashboard_column_span"] ?? ''; $dashboard_row_span = $_POST["dashboard_row_span"] ?? ''; $dashboard_details_state = $_POST["dashboard_details_state"] ?? ''; + $dashboard_parent_uuid = $_POST["dashboard_parent_uuid"] ?? ''; $dashboard_order = $_POST["dashboard_order"] ?? ''; $dashboard_enabled = $_POST["dashboard_enabled"] ?? 'false'; $dashboard_description = $_POST["dashboard_description"] ?? ''; @@ -250,6 +252,7 @@ $array['dashboard'][0]['dashboard_column_span'] = $dashboard_column_span; $array['dashboard'][0]['dashboard_row_span'] = $dashboard_row_span; $array['dashboard'][0]['dashboard_details_state'] = $dashboard_details_state; + $array['dashboard'][0]['dashboard_parent_uuid'] = $dashboard_parent_uuid; $array['dashboard'][0]['dashboard_order'] = $dashboard_order; $array['dashboard'][0]['dashboard_enabled'] = $dashboard_enabled; $array['dashboard'][0]['dashboard_description'] = $dashboard_description; @@ -311,6 +314,7 @@ $sql .= " dashboard_column_span, "; $sql .= " dashboard_row_span, "; $sql .= " dashboard_details_state, "; + $sql .= " dashboard_parent_uuid, "; $sql .= " dashboard_order, "; $sql .= " dashboard_enabled, "; $sql .= " dashboard_description "; @@ -342,6 +346,7 @@ $dashboard_column_span = $row["dashboard_column_span"]; $dashboard_row_span = $row["dashboard_row_span"]; $dashboard_details_state = $row["dashboard_details_state"]; + $dashboard_parent_uuid = $row["dashboard_parent_uuid"]; $dashboard_order = $row["dashboard_order"]; $dashboard_enabled = $row["dashboard_enabled"] ?? 'false'; $dashboard_description = $row["dashboard_description"]; @@ -402,9 +407,9 @@ require_once "resources/header.php"; //get the child groups - $sql = "select * from v_dashboard_groups as x, v_groups as g "; - $sql .= "where x.dashboard_uuid = :dashboard_uuid "; - $sql .= "and x.group_uuid = g.group_uuid "; + $sql = "SELECT * FROM v_dashboard_groups as x, v_groups as g "; + $sql .= "WHERE x.dashboard_uuid = :dashboard_uuid "; + $sql .= "AND x.group_uuid = g.group_uuid "; $parameters['dashboard_uuid'] = $dashboard_uuid ?? ''; $dashboard_groups = $database->select($sql, $parameters, 'all'); unset ($sql, $parameters); @@ -417,6 +422,14 @@ $groups = $database->execute($sql, $parameters, 'all'); unset ($sql, $parameters); +//get the dashboards + $sql = "SELECT dashboard_uuid, dashboard_name FROM v_dashboard "; + $sql .= "WHERE dashboard_parent_uuid is null "; + $sql .= "ORDER by dashboard_order, dashboard_name asc "; + $parameters = null; + $dashboard_parents = $database->execute($sql, $parameters, 'all'); + unset ($sql, $parameters); + //set the assigned_groups array if (is_array($dashboard_groups) && sizeof($dashboard_groups) != 0) { $assigned_groups = array(); @@ -944,6 +957,27 @@ echo "\n"; echo "\n"; + if (permission_exists('dashboard_parent_uuid')) { + echo " "; + echo " ".$text['label-dashboard_parent_uuid'].""; + echo " "; + echo " "; + echo "
\n"; + echo $text['description-dashboard_parent_uuid']."\n"; + echo " "; + echo " "; + } + echo "\n"; echo "\n"; echo " ".$text['label-dashboard_order']."\n"; @@ -1013,4 +1047,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file