Browse Source

Dashboard - Add chart type setting (#6951)

* Dashboard - Add chart type setting
Alex 1 year ago
parent
commit
af67e49ef0

+ 5 - 0
core/dashboard/app_config.php

@@ -72,6 +72,11 @@
 		$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
 		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard path.';
 		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_chart_type';
+		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the chart type.';
+		$z++;
 		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_heading_text_color';
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
 		$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';

+ 79 - 1
core/dashboard/app_languages.php

@@ -260,6 +260,84 @@ $text['description-dashboard_groups']['zh-cn'] = "添加有权访问此小部件
 $text['description-dashboard_groups']['ja-jp'] = "このウィジェットに対する権限を持つグループを追加します。";
 $text['description-dashboard_groups']['ko-kr'] = "이 위젯에 대한 권한이 있는 그룹을 추가하십시오.";
 
+$text['label-dashboard_chart_type']['en-us'] = "Chart Type";
+$text['label-dashboard_chart_type']['en-gb'] = "Chart Type";
+$text['label-dashboard_chart_type']['ar-eg'] = "نوع التخطيط";
+$text['label-dashboard_chart_type']['de-at'] = "Diagramm Typ";
+$text['label-dashboard_chart_type']['de-ch'] = "Diagramm Typ";
+$text['label-dashboard_chart_type']['de-de'] = "Diagramm Typ";
+$text['label-dashboard_chart_type']['el-gr'] = "Τύπος γραφήματος";
+$text['label-dashboard_chart_type']['es-cl'] = "Tipo de gráfico";
+$text['label-dashboard_chart_type']['es-mx'] = "Tipo de gráfico";
+$text['label-dashboard_chart_type']['fr-ca'] = "Type de graphiqueType de graphique";
+$text['label-dashboard_chart_type']['fr-fr'] = "Type de graphique";
+$text['label-dashboard_chart_type']['he-il'] = "סוג תרשים";
+$text['label-dashboard_chart_type']['it-it'] = "Tipo di grafico";
+$text['label-dashboard_chart_type']['nl-nl'] = "Grafiektype";
+$text['label-dashboard_chart_type']['pl-pl'] = "Typ wykresu";
+$text['label-dashboard_chart_type']['pt-br'] = "Tipo de Gráfico";
+$text['label-dashboard_chart_type']['pt-pt'] = "Tipo de Gráfico";
+$text['label-dashboard_chart_type']['ro-ro'] = "Tip diagramă";
+$text['label-dashboard_chart_type']['ru-ru'] = "Тип диаграммы";
+$text['label-dashboard_chart_type']['sv-se'] = "Diagramtyp";
+$text['label-dashboard_chart_type']['uk-ua'] = "Тип діаграми";
+$text['label-dashboard_chart_type']['tr-tr'] = "Grafik tipi";
+$text['label-dashboard_chart_type']['zh-cn'] = "图表类型";
+$text['label-dashboard_chart_type']['ja-jp'] = "グラフの種類";
+$text['label-dashboard_chart_type']['ko-kr'] = "차트 종류";
+
+$text['description-dashboard_chart_type']['en-us'] = "Enter the dashboard widget chart type.";
+$text['description-dashboard_chart_type']['en-gb'] = "Enter the dashboard widget chart type.";
+$text['description-dashboard_chart_type']['ar-eg'] = "أدخل نوع مخطط عنصر واجهة المستخدم للوحة المعلومات.";
+$text['description-dashboard_chart_type']['de-at'] = "Geben Sie den Diagrammtyp des Dashboard-Widgets ein.";
+$text['description-dashboard_chart_type']['de-ch'] = "Geben Sie den Diagrammtyp des Dashboard-Widgets ein.";
+$text['description-dashboard_chart_type']['de-de'] = "Geben Sie den Diagrammtyp des Dashboard-Widgets ein.";
+$text['description-dashboard_chart_type']['el-gr'] = "Εισαγάγετε τον τύπο γραφήματος του γραφικού στοιχείου πίνακα εργαλείων.";
+$text['description-dashboard_chart_type']['es-cl'] = "Ingrese el tipo de gráfico del widget del panel.";
+$text['description-dashboard_chart_type']['es-mx'] = "Ingrese el tipo de gráfico del widget del panel.";
+$text['description-dashboard_chart_type']['fr-ca'] = "Entrez le type de graphique du widget de tableau de bord.";
+$text['description-dashboard_chart_type']['fr-fr'] = "Entrez le type de graphique du widget de tableau de bord.";
+$text['description-dashboard_chart_type']['he-il'] = "הזן את סוג תרשים הווידג'ט של לוח המחוונים.";
+$text['description-dashboard_chart_type']['it-it'] = "Inserisci il tipo di grafico del widget del dashboard.";
+$text['description-dashboard_chart_type']['nl-nl'] = "Voer het diagramtype van de dashboardwidget in.";
+$text['description-dashboard_chart_type']['pl-pl'] = "Wprowadź typ wykresu widżetu panelu kontrolnego.";
+$text['description-dashboard_chart_type']['pt-br'] = "Insira o tipo de gráfico do widget do painel.";
+$text['description-dashboard_chart_type']['pt-pt'] = "Insira o tipo de gráfico do widget do painel.";
+$text['description-dashboard_chart_type']['ro-ro'] = "Introduceți tipul de diagramă widget din tabloul de bord.";
+$text['description-dashboard_chart_type']['ru-ru'] = "Введите тип диаграммы виджета информационной панели.";
+$text['description-dashboard_chart_type']['sv-se'] = "Ange diagramtypen för instrumentpanelens widget.";
+$text['description-dashboard_chart_type']['uk-ua'] = "Введіть тип діаграми віджета інформаційної панелі.";
+$text['description-dashboard_chart_type']['tr-tr'] = "Kontrol paneli widget'ı grafik türünü girin.";
+$text['description-dashboard_chart_type']['zh-cn'] = "输入仪表板小部件图表类型。";
+$text['description-dashboard_chart_type']['ja-jp'] = "ダッシュボード ウィジェットのグラフ タイプを入力します。";
+$text['description-dashboard_chart_type']['ko-kr'] = "대시보드 위젯 차트 유형을 입력합니다.";
+
+$text['label-doughnut']['en-us'] = "Doughnut";
+$text['label-doughnut']['en-gb'] = "Doughnut";
+$text['label-doughnut']['ar-eg'] = "كعكة محلاة";
+$text['label-doughnut']['de-at'] = "Krapfen";
+$text['label-doughnut']['de-ch'] = "Krapfen";
+$text['label-doughnut']['de-de'] = "Krapfen";
+$text['label-doughnut']['el-gr'] = "Ντόνατ";
+$text['label-doughnut']['es-cl'] = "Rosquilla";
+$text['label-doughnut']['es-mx'] = "Rosquilla";
+$text['label-doughnut']['fr-ca'] = "Donut";
+$text['label-doughnut']['fr-fr'] = "Donut";
+$text['label-doughnut']['he-il'] = "סופגניה";
+$text['label-doughnut']['it-it'] = "Ciambella";
+$text['label-doughnut']['nl-nl'] = "Donut";
+$text['label-doughnut']['pl-pl'] = "Pączek";
+$text['label-doughnut']['pt-br'] = "Rosquinha";
+$text['label-doughnut']['pt-pt'] = "Rosquinha";
+$text['label-doughnut']['ro-ro'] = "Gogoașă";
+$text['label-doughnut']['ru-ru'] = "Пончик";
+$text['label-doughnut']['sv-se'] = "Munk";
+$text['label-doughnut']['uk-ua'] = "Пончик";
+$text['label-doughnut']['tr-tr'] = "Tatlı çörek";
+$text['label-doughnut']['zh-cn'] = "油炸圈饼";
+$text['label-doughnut']['ja-jp'] = "ドーナツ";
+$text['label-doughnut']['ko-kr'] = "도넛";
+
 $text['label-dashboard_heading_text_color']['en-us'] = "Heading Text Color";
 $text['label-dashboard_heading_text_color']['en-gb'] = "Heading Text Color";
 $text['label-dashboard_heading_text_color']['ar-eg'] = "لون نص العنوان";
@@ -728,4 +806,4 @@ $text['login-message_dismiss']['zh-cn'] = "Dismiss Message";
 $text['login-message_dismiss']['ja-jp'] = "Dismiss Message";
 $text['login-message_dismiss']['ko-kr'] = "Dismiss Message";
 
-?>
+?>

+ 29 - 1
core/dashboard/dashboard_edit.php

@@ -65,6 +65,7 @@
 		$dashboard_name = $_POST["dashboard_name"] ?? '';
 		$dashboard_path = $_POST["dashboard_path"] ?? '';
 		$dashboard_groups = $_POST["dashboard_groups"] ?? '';
+		$dashboard_chart_type = $_POST["dashboard_chart_type"] ?? '';
 		$dashboard_heading_text_color = $_POST["dashboard_heading_text_color"] ?? '';
 		$dashboard_number_text_color = $_POST["dashboard_number_text_color"] ?? '';
 		$dashboard_column_span = $_POST["dashboard_column_span"] ?? '';
@@ -165,6 +166,7 @@
 			$array['dashboard'][0]['dashboard_uuid'] = $dashboard_uuid;
 			$array['dashboard'][0]['dashboard_name'] = $dashboard_name;
 			$array['dashboard'][0]['dashboard_path'] = $dashboard_path;
+			$array['dashboard'][0]['dashboard_chart_type'] = $dashboard_chart_type;
 			$array['dashboard'][0]['dashboard_heading_text_color'] = $dashboard_heading_text_color;
 			$array['dashboard'][0]['dashboard_number_text_color'] = $dashboard_number_text_color;
 			$array['dashboard'][0]['dashboard_column_span'] = $dashboard_column_span;
@@ -212,6 +214,7 @@
 		$sql .= " dashboard_uuid, ";
 		$sql .= " dashboard_name, ";
 		$sql .= " dashboard_path, ";
+		$sql .= " dashboard_chart_type, ";
 		$sql .= " dashboard_heading_text_color, ";
 		$sql .= " dashboard_number_text_color, ";
 		$sql .= " dashboard_column_span, ";
@@ -227,6 +230,7 @@
 		if (is_array($row) && @sizeof($row) != 0) {
 			$dashboard_name = $row["dashboard_name"];
 			$dashboard_path = $row["dashboard_path"];
+			$dashboard_chart_type = $row["dashboard_chart_type"];
 			$dashboard_heading_text_color = $row["dashboard_heading_text_color"];
 			$dashboard_number_text_color = $row["dashboard_number_text_color"];
 			$dashboard_column_span = $row["dashboard_column_span"];
@@ -404,6 +408,30 @@
 	echo "</td>\n";
 	echo "</tr>\n";
 
+	echo "<tr>\n";
+	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+	echo $text['label-dashboard_chart_type']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<select name='dashboard_chart_type' class='formfld'>\n";
+	if ($dashboard_chart_type == "doughnut") {
+		echo "		<option value='doughnut' selected='selected'>".$text['label-doughnut']."</option>\n";
+	}
+	else {
+		echo "		<option value='doughnut'>".$text['label-doughnut']."</option>\n";
+	}
+	if ($dashboard_chart_type == "none") {
+		echo "		<option value='none' selected='selected'>".$text['label-none']."</option>\n";
+	}
+	else {
+		echo "		<option value='none'>".$text['label-none']."</option>\n";
+	}
+	echo "	</select>\n";
+	echo "<br />\n";
+	echo $text['description-dashboard_chart_type']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
 	echo "<tr>\n";
 	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
 	echo $text['label-dashboard_heading_text_color']."\n";
@@ -543,4 +571,4 @@
 //include the footer
 	require_once "resources/footer.php";
 
-?>
+?>

+ 2 - 1
core/dashboard/index.php

@@ -72,6 +72,7 @@
 	$sql .= "dashboard_uuid, \n";
 	$sql .= "dashboard_name, \n";
 	$sql .= "dashboard_path, \n";
+	$sql .= "dashboard_chart_type, \n";
 	$sql .= "dashboard_heading_text_color, \n";
 	$sql .= "dashboard_number_text_color, \n";
 	$sql .= "dashboard_column_span, \n";
@@ -149,7 +150,6 @@
 	echo "	Chart.defaults.responsive = true;\n";
 	echo "	Chart.defaults.maintainAspectRatio = false;\n";
 	echo "	Chart.defaults.plugins.legend.display = false;\n";
-	echo "	Chart.defaults.plugins.title.display = true;\n";
 	echo "	Chart.overrides.doughnut.cutout = '75%';\n";
 	echo "</script>\n";
 
@@ -303,6 +303,7 @@
 	foreach($dashboard as $row) {
 		$dashboard_name = strtolower($row['dashboard_name']);
 		$dashboard_name = str_replace(" ", "_", $dashboard_name);
+		$dashboard_chart_type = $row['dashboard_chart_type'] ?? 'doughnut';
 		$dashboard_heading_text_color = $row['dashboard_heading_text_color'] ?? $settings->get('theme', 'dashboard_heading_text_color');
 		$dashboard_number_text_color = $row['dashboard_heading_text_color'] ?? $settings->get('theme', 'dashboard_number_text_color');
 		echo "<div class='widget' id='".$dashboard_name."' draggable='false'>\n";

+ 4 - 4
themes/default/app_config.php

@@ -899,8 +899,8 @@
 		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
 		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "dashboard_heading_text_color";
 		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
-		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#444444";
-		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$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 (and opacity) of the Dashboard block heading text.";
 		$y++;
 		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "b09126da-c68b-473c-83f8-8e9a7523ce37";
@@ -963,8 +963,8 @@
 		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
 		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "dashboard_number_text_color";
 		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
-		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#444444";
-		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$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 (and opacity) of the Dashboard block number.";
 		$y++;
 		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "1d829bf8-6b4e-44e8-8cb5-962f8b91d64e";

+ 21 - 14
themes/default/css.php

@@ -213,20 +213,20 @@ $dashboard_detail_background_color_center = $_SESSION['theme']['dashboard_detail
 $dashboard_border_radius = $_SESSION['theme']['dashboard_border_radius']['text'] ?? '5px';
 $dashboard_border_color = $_SESSION['theme']['dashboard_border_color']['text'] ?? '#dbe0ea';
 $dashboard_border_color_hover = $_SESSION['theme']['dashboard_border_color_hover']['text'] ?? '#cbd3e1';
-$dashboard_heading_text_color = $_SESSION['theme']['dashboard_heading_text_color']['text'] ?? '#fff';
-$dashboard_heading_text_color_hover = $_SESSION['theme']['dashboard_heading_text_color_hover']['text'] ?? '#fff';
-$dashboard_heading_text_size = $_SESSION['theme']['dashboard_heading_text_size']['text'] ?? '12pt';
-$dashboard_heading_text_font = $_SESSION['theme']['dashboard_heading_text_font']['text'] ?? 'Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif';
-$dashboard_heading_text_shadow_color = $_SESSION['theme']['dashboard_heading_text_shadow_color']['text'] ?? '#000';
-$dashboard_heading_background_color = $_SESSION['theme']['dashboard_heading_background_color']['text'] ?? '#8e96a5';
+$dashboard_heading_text_color = $_SESSION['theme']['dashboard_heading_text_color']['text'] ?? '#444';
+$dashboard_heading_text_color_hover = $_SESSION['theme']['dashboard_heading_text_color_hover']['text'] ?? '';
+$dashboard_heading_text_size = $_SESSION['theme']['dashboard_heading_text_size']['text'] ?? '13px';
+$dashboard_heading_text_font = $_SESSION['theme']['dashboard_heading_text_font']['text'] ?? 'Arial, Calibri, Candara, Segoe, "Segoe UI", Optima, sans-serif';
+$dashboard_heading_text_shadow_color = $_SESSION['theme']['dashboard_heading_text_shadow_color']['text'] ?? 'rgba(0,0,0,0)';
+$dashboard_heading_background_color = $_SESSION['theme']['dashboard_heading_background_color']['text'] ?? '';
 $dashboard_heading_background_color_hover = $_SESSION['theme']['dashboard_heading_background_color_hover']['text'] ?? color_adjust($dashboard_heading_background_color, 0.03);
-$dashboard_number_text_color = $_SESSION['theme']['dashboard_number_text_color']['text'] ?? '#fff';
-$dashboard_number_text_color_hover = $_SESSION['theme']['dashboard_number_text_color_hover']['text'] ?? '#fff';
-$dashboard_number_text_font = $_SESSION['theme']['dashboard_number_text_font']['text'] ?? 'Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif';
-$dashboard_number_text_size = $_SESSION['theme']['dashboard_number_text_size']['text'] ?? '60pt';
-$dashboard_number_text_shadow_color = $_SESSION['theme']['dashboard_number_text_shadow_color']['text'] ?? '#737983';
-$dashboard_number_text_shadow_color_hover = $_SESSION['theme']['dashboard_number_text_shadow_color_hover']['text'] ?? '#737983';
-$dashboard_number_background_color = $_SESSION['theme']['dashboard_number_background_color']['text'] ?? '#a4aebf';
+$dashboard_number_text_color = $_SESSION['theme']['dashboard_number_text_color']['text'] ?? '#444';
+$dashboard_number_text_color_hover = $_SESSION['theme']['dashboard_number_text_color_hover']['text'] ?? '';
+$dashboard_number_text_font = $_SESSION['theme']['dashboard_number_text_font']['text'] ?? 'Arial, Calibri, Candara, Segoe, "Segoe UI", Optima, sans-serif';
+$dashboard_number_text_size = $_SESSION['theme']['dashboard_number_text_size']['text'] ?? '100px';
+$dashboard_number_text_shadow_color = $_SESSION['theme']['dashboard_number_text_shadow_color']['text'] ?? 'rgba(0,0,0,0)';
+$dashboard_number_text_shadow_color_hover = $_SESSION['theme']['dashboard_number_text_shadow_color_hover']['text'] ?? 'rgba(0,0,0,0)';
+$dashboard_number_background_color = $_SESSION['theme']['dashboard_number_background_color']['text'] ?? '';
 $dashboard_number_background_color_hover = $_SESSION['theme']['dashboard_number_background_color_hover']['text'] ?? color_adjust($dashboard_number_background_color, 0.03);
 $dashboard_number_title_text_color = $_SESSION['theme']['dashboard_number_title_text_color']['text'] ?? '#fff';
 $dashboard_number_title_text_size = $_SESSION['theme']['dashboard_number_title_text_size']['text'] ?? '14px';
@@ -2358,7 +2358,7 @@ else { //default: white
 		cursor: not-allowed;
 		opacity: 0.5;
 		}
-		
+
 	div.ur_ext:after {
 		position: absolute;
 		content: "";
@@ -2568,6 +2568,7 @@ else { //default: white
 		letter-spacing: -0.02em;
 		color: <?=$dashboard_heading_text_color?>;
 		font-size: <?=$dashboard_heading_text_size?>;
+		font-weight: bold;
 		<?php
 		//calculate line height based on font size
 		$font_size = strtolower($dashboard_heading_text_size);
@@ -2619,6 +2620,7 @@ else { //default: white
 		border-top: 1px solid <?php echo color_adjust($dashboard_number_background_color, 0.2); ?>;
 		overflow: hidden;
 		<?php
+		/*
 		//calculate font padding
 		$font_size = strtolower($dashboard_heading_text_size);
 		$tmp = str_replace(' ', '', $font_size);
@@ -2628,9 +2630,14 @@ else { //default: white
 		$tmp = str_replace('%', '', $tmp);
 		$font_size_number = $tmp;
 		$padding_top_bottom = (int) floor((100-$tmp) * 0.25);
+		*/
 		?>
+		<!--
 		padding-top: <?php echo $padding_top_bottom.'px' ?>;
 		padding-bottom: <?php echo $padding_top_bottom.'px' ?>;
+		-->
+		padding-top: 5px;
+		padding-bottom: 10px;
 		}
 
 	span.hud_stat:hover {