Эх сурвалжийг харах

Add dashboard content text align

FusionPBX 1 жил өмнө
parent
commit
46e593f0ce

+ 8 - 3
core/dashboard/app_config.php

@@ -100,12 +100,17 @@
 		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_content';
 		$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 dashboard top content.';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard content.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_content_text_align';
+		$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'] = 'Select the dashboard content text alignment.';
 		$z++;
 		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_content_details';
 		$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 dashboard top content details.';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the dashboard content details.';
 		$z++;
 		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'dashboard_chart_type';
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
@@ -279,4 +284,4 @@
 		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
 		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
 
-?>
+?>

+ 53 - 1
core/dashboard/app_languages.php

@@ -208,6 +208,58 @@ $text['description-dashboard_path']['zh-cn'] = "输入仪表板小部件路径
 $text['description-dashboard_path']['ja-jp'] = "ダッシュボード ウィジェットのパスを入力します。";
 $text['description-dashboard_path']['ko-kr'] = "대시보드 위젯 경로를 입력합니다.";
 
+$text['label-dashboard_content_text_align']['en-us'] = "Text Align";
+$text['label-dashboard_content_text_align']['en-gb'] = "Text Align";
+$text['label-dashboard_content_text_align']['ar-eg'] = "";
+$text['label-dashboard_content_text_align']['de-at'] = "";
+$text['label-dashboard_content_text_align']['de-ch'] = "";
+$text['label-dashboard_content_text_align']['de-de'] = "";
+$text['label-dashboard_content_text_align']['el-gr'] = "";
+$text['label-dashboard_content_text_align']['es-cl'] = "";
+$text['label-dashboard_content_text_align']['es-mx'] = "";
+$text['label-dashboard_content_text_align']['fr-ca'] = "";
+$text['label-dashboard_content_text_align']['fr-fr'] = "";
+$text['label-dashboard_content_text_align']['he-il'] = "";
+$text['label-dashboard_content_text_align']['it-it'] = "";
+$text['label-dashboard_content_text_align']['nl-nl'] = "";
+$text['label-dashboard_content_text_align']['pl-pl'] = "";
+$text['label-dashboard_content_text_align']['pt-br'] = "";
+$text['label-dashboard_content_text_align']['pt-pt'] = "";
+$text['label-dashboard_content_text_align']['ro-ro'] = "";
+$text['label-dashboard_content_text_align']['ru-ru'] = "";
+$text['label-dashboard_content_text_align']['sv-se'] = "";
+$text['label-dashboard_content_text_align']['uk-ua'] = "";
+$text['label-dashboard_content_text_align']['tr-tr'] = "";
+$text['label-dashboard_content_text_align']['zh-cn'] = "";
+$text['label-dashboard_content_text_align']['ja-jp'] = "";
+$text['label-dashboard_content_text_align']['ko-kr'] = "";
+
+$text['description-dashboard_content_text_align']['en-us'] = "Align the text in the content.";
+$text['description-dashboard_content_text_align']['en-gb'] = "Align the text in the content.";
+$text['description-dashboard_content_text_align']['ar-eg'] = "";
+$text['description-dashboard_content_text_align']['de-at'] = "";
+$text['description-dashboard_content_text_align']['de-ch'] = "";
+$text['description-dashboard_content_text_align']['de-de'] = "";
+$text['description-dashboard_content_text_align']['el-gr'] = "";
+$text['description-dashboard_content_text_align']['es-cl'] = "";
+$text['description-dashboard_content_text_align']['es-mx'] = "";
+$text['description-dashboard_content_text_align']['fr-ca'] = "";
+$text['description-dashboard_content_text_align']['fr-fr'] = "";
+$text['description-dashboard_content_text_align']['he-il'] = "";
+$text['description-dashboard_content_text_align']['it-it'] = "";
+$text['description-dashboard_content_text_align']['nl-nl'] = "";
+$text['description-dashboard_content_text_align']['pl-pl'] = "";
+$text['description-dashboard_content_text_align']['pt-br'] = "";
+$text['description-dashboard_content_text_align']['pt-pt'] = "";
+$text['description-dashboard_content_text_align']['ro-ro'] = "";
+$text['description-dashboard_content_text_align']['ru-ru'] = "";
+$text['description-dashboard_content_text_align']['sv-se'] = "";
+$text['description-dashboard_content_text_align']['uk-ua'] = "";
+$text['description-dashboard_content_text_align']['tr-tr'] = "";
+$text['description-dashboard_content_text_align']['zh-cn'] = "";
+$text['description-dashboard_content_text_align']['ja-jp'] = "";
+$text['description-dashboard_content_text_align']['ko-kr'] = "";
+
 $text['label-dashboard_groups']['en-us'] = "Groups";
 $text['label-dashboard_groups']['en-gb'] = "Groups";
 $text['label-dashboard_groups']['ar-eg'] = "مجموعات";
@@ -1300,4 +1352,4 @@ $text['login-message_dismiss']['zh-cn'] = "忽略消息";
 $text['login-message_dismiss']['ja-jp'] = "メッセージを閉じる";
 $text['login-message_dismiss']['ko-kr'] = "메시지 닫기";
 
-?>
+?>

+ 26 - 16
core/dashboard/dashboard_edit.php

@@ -35,6 +35,9 @@
 		exit;
 	}
 
+//initialize the database
+	$database = new database;
+
 //add multi-lingual support
 	$language = new text;
 	$text = $language->get();
@@ -49,6 +52,7 @@
 	$dashboard_width = '';
 	$dashboard_height = '';
 	$dashboard_content = '';
+	$dashboard_content_text_align = '';
 	$dashboard_content_details = '';
 	$dashboard_heading_text_color = '';
 	$dashboard_heading_background_color = '';
@@ -82,6 +86,7 @@
 		$dashboard_width = $_POST["dashboard_width"] ?? '';
 		$dashboard_height = $_POST["dashboard_height"] ?? '';
 		$dashboard_content = $_POST["dashboard_content"] ?? '';
+		$dashboard_content_text_align = $_POST["dashboard_content_text_align"] ?? '';
 		$dashboard_content_details = $_POST["dashboard_content_details"] ?? '';
 		$dashboard_groups = $_POST["dashboard_groups"] ?? '';
 		$dashboard_chart_type = $_POST["dashboard_chart_type"] ?? '';
@@ -109,7 +114,6 @@
 			$dashboard_uuid = $_GET["dashboard_uuid"];
 		//delete the group from the users
 			$array['dashboard_groups'][0]['dashboard_group_uuid'] = $dashboard_group_uuid;
-			$database = new database;
 			$database->app_name = 'dashboard';
 			$database->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7';
 			$database->delete($array);
@@ -138,20 +142,17 @@
 				switch ($_POST['action']) {
 					case 'copy':
 						if (permission_exists('dashboard_add')) {
-							$obj = new database;
-							$obj->copy($array);
+							$database->copy($array);
 						}
 						break;
 					case 'delete':
 						if (permission_exists('dashboard_delete')) {
-							$obj = new database;
-							$obj->delete($array);
+							$database->delete($array);
 						}
 						break;
 					case 'toggle':
 						if (permission_exists('dashboard_update')) {
-							$obj = new database;
-							$obj->toggle($array);
+							$database->toggle($array);
 						}
 						break;
 				}
@@ -234,6 +235,7 @@
 			$array['dashboard'][0]['dashboard_height'] = $dashboard_height;
 			$array['dashboard'][0]['dashboard_target'] = $dashboard_target;
 			$array['dashboard'][0]['dashboard_content'] = $dashboard_content;
+			$array['dashboard'][0]['dashboard_content_text_align'] = $dashboard_content_text_align;
 			$array['dashboard'][0]['dashboard_content_details'] = $dashboard_content_details;
 			$array['dashboard'][0]['dashboard_chart_type'] = $dashboard_chart_type;
 			$array['dashboard'][0]['dashboard_heading_text_color'] = $dashboard_heading_text_color;
@@ -263,13 +265,10 @@
 			}
 
 		//save the data
-			$database = new database;
 			$database->app_name = 'dashboard';
 			$database->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7';
-			$database->save($array);
-			//$result = $database->message;
+			$result = $database->save($array);
 			//view_array($result);
-			//exit;
 
 		//redirect the user
 			if (isset($action)) {
@@ -297,6 +296,7 @@
 		$sql .= " dashboard_height, ";
 		$sql .= " dashboard_target, ";
 		$sql .= " dashboard_content, ";
+		$sql .= " dashboard_content_text_align, ";
 		$sql .= " dashboard_content_details, ";
 		$sql .= " dashboard_chart_type, ";
 		$sql .= " dashboard_heading_text_color, ";
@@ -317,7 +317,6 @@
 		$sql .= "from v_dashboard ";
 		$sql .= "where dashboard_uuid = :dashboard_uuid ";
 		$parameters['dashboard_uuid'] = $dashboard_uuid;
-		$database = new database;
 		$row = $database->select($sql, $parameters, 'row');
 		if (is_array($row) && @sizeof($row) != 0) {
 			$dashboard_name = $row["dashboard_name"];
@@ -328,6 +327,7 @@
 			$dashboard_height = $row["dashboard_height"];
 			$dashboard_target = $row["dashboard_target"];
 			$dashboard_content = $row["dashboard_content"];
+			$dashboard_content_text_align = $row["dashboard_content_text_align"];
 			$dashboard_content_details = $row["dashboard_content_details"];
 			$dashboard_chart_type = $row["dashboard_chart_type"];
 			$dashboard_heading_text_color = $row["dashboard_heading_text_color"];
@@ -357,7 +357,6 @@
 		$sql .= "from v_dashboard_groups ";
 		$sql .= "where dashboard_uuid = :dashboard_uuid ";
 		$parameters['dashboard_uuid'] = $dashboard_uuid;
-		$database = new database;
 		$dashboard_groups = $database->select($sql, $parameters, 'all');
 		unset ($sql, $parameters);
 	}
@@ -388,7 +387,6 @@
 		$dashboard_row_span = 2;
 	}
 
-
 //add an empty row
 	$x = is_array($dashboard_groups) ? count($dashboard_groups) : 0;
 	$dashboard_groups[$x]['dashboard_uuid'] = $dashboard_uuid;
@@ -408,7 +406,6 @@
 	$sql .= "where x.dashboard_uuid = :dashboard_uuid ";
 	$sql .= "and x.group_uuid = g.group_uuid ";
 	$parameters['dashboard_uuid'] = $dashboard_uuid ?? '';
-	$database = new database;
 	$dashboard_groups = $database->select($sql, $parameters, 'all');
 	unset ($sql, $parameters);
 
@@ -417,7 +414,6 @@
 	$sql .= "WHERE (domain_uuid = :domain_uuid or domain_uuid is null)";
 	$sql .= "ORDER by group_name asc ";
 	$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
-	$database = new database;
 	$groups = $database->execute($sql, $parameters, 'all');
 	unset ($sql, $parameters);
 
@@ -621,6 +617,20 @@
 		echo $text['description-dashboard_content']."\n";
 		echo "</td>\n";
 		echo "</tr>\n";
+
+		echo "<tr class='type_content' ".($dashboard_path != 'core/dashboard/resources/dashboard/content.php' ? "style='display: none;'" : null).">\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "	".$text['label-dashboard_content_text_align']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' align='left'>\n";
+		echo "	<select name='dashboard_content_text_align' class='formfld'>\n";
+		echo "		<option value='left' ".(!empty($dashboard_content_text_align) && $dashboard_content_text_align == 'left' ? "selected='selected'" : null).">".$text['label-left']."</option>\n";
+		echo "		<option value='right' ".(!empty($dashboard_content_text_align) && $dashboard_content_text_align == 'right' ? "selected='selected'" : null).">".$text['label-right']."</option>\n";
+		echo "		<option value='middle' ".(!empty($dashboard_content_text_align) && $dashboard_content_text_align == 'middle' ? "selected='selected'" : null).">".$text['label-middle']."</option>\n";
+		echo "	</select>\n";		echo "<br />\n";
+		echo $text['description-dashboard_content_text_align']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
 	}
 
 	if (

+ 4 - 1
core/dashboard/index.php

@@ -78,6 +78,7 @@
 	$sql .= "dashboard_width, ";
 	$sql .= "dashboard_height, ";
 	$sql .= "dashboard_content, ";
+	$sql .= "dashboard_content_text_align, ";
 	$sql .= "dashboard_content_details, ";
 	$sql .= "dashboard_chart_type, ";
 	$sql .= "dashboard_heading_text_color, ";
@@ -123,6 +124,7 @@
 						$array['dashboard'][$x]['dashboard_icon'] = $row['dashboard_icon'];
 						$array['dashboard'][$x]['dashboard_url'] = $row['dashboard_url'];
 						$array['dashboard'][$x]['dashboard_content'] = $row['dashboard_content'];
+						$array['dashboard'][$x]['dashboard_content_text_align'] = $row['dashboard_content_text_align'];
 						$array['dashboard'][$x]['dashboard_content_details'] = $row['dashboard_content_details'];
 						$array['dashboard'][$x]['dashboard_target'] = $row['dashboard_target'];
 						$array['dashboard'][$x]['dashboard_width'] = $row['dashboard_width'];
@@ -442,6 +444,7 @@ function toggle_grid_row_end(dashboard_name) {
 		$dashboard_width  = $row['dashboard_width'] ?? '';
 		$dashboard_height  = $row['dashboard_height'] ?? '';
 		$dashboard_content  = $row['dashboard_content'] ?? '';
+		$dashboard_content_text_align = $row['dashboard_content_text_align'] ?? '';
 		$dashboard_content_details  = $row['dashboard_content_details'] ?? '';
 		$dashboard_chart_type = $row['dashboard_chart_type'] ?? "doughnut";
 		$dashboard_heading_text_color = $row['dashboard_heading_text_color'] ?? $settings->get('theme', 'dashboard_heading_text_color');
@@ -558,4 +561,4 @@ function toggle_grid_row_end(dashboard_name) {
 //show the footer
 	require_once "resources/footer.php";
 
-?>
+?>

+ 1 - 1
core/dashboard/resources/dashboard/content.php

@@ -12,7 +12,7 @@
 	echo "<div class='hud_box'>\n";
 	echo "	<div class='hud_content' ".(!empty($row['dashboard_background_color']) ? "style='background: ".$row['dashboard_background_color'].";'" : null)." ".(empty($dashboard_details_state) || $dashboard_details_state != "disabled" ? "onclick=\"$('#hud_content_details').slideToggle('fast'); toggle_grid_row_end('".trim(preg_replace("/[^a-z]/", '_', strtolower($row['dashboard_name'])),'_')."');\"" : null).">\n";
 	echo "		<span class='hud_title' ".(!empty($row['dashboard_heading_background_color']) ? "style='background: ".$row['dashboard_heading_background_color'].";'" : null).">".escape($dashboard_name)."</span>";
-	echo "		<span style='padding: 5%; height: 150px; max-height: 150px; vertical-align: middle; overflow: auto; ".(!empty($row['dashboard_number_text_color']) ? "color: ".$row['dashboard_number_text_color'].";" : null)."'>".str_replace("\r", '<br>', escape($dashboard_content))."</span>\n";
+	echo "		<span style='padding: 5%; height: 150px; max-height: 150px; text-align: ".$row['dashboard_content_text_align']."; vertical-align: middle; overflow: auto; ".(!empty($row['dashboard_number_text_color']) ? "color: ".$row['dashboard_number_text_color'].";" : null)."'>".str_replace("\r", '<br>', escape($dashboard_content))."</span>\n";
 	echo "	</div>\n";
 	if (empty($dashboard_details_state) || $dashboard_details_state != "disabled") {
 		echo "	<div class='hud_details hud_box' id='hud_content_details' style='padding: 20px; 10%; overflow: auto; ".(!empty($row['dashboard_detail_background_color']) ? "background: ".$row['dashboard_detail_background_color'].";" : null)."'>".str_replace("\r", '<br>', escape($dashboard_content_details))."</div>\n";

+ 76 - 1
resources/app_languages.php

@@ -6562,4 +6562,79 @@ $text['label-details']['zh-cn'] = "详细情况";
 $text['label-details']['ja-jp'] = "インフォメーション";
 $text['label-details']['ko-kr'] = "제품 정보";
 
-?>
+$text['label-left']['en-us'] = "Left";
+$text['label-left']['en-gb'] = "Left";
+$text['label-left']['ar-eg'] = "";
+$text['label-left']['de-at'] = "";
+$text['label-left']['de-ch'] = "";
+$text['label-left']['de-de'] = "";
+$text['label-left']['el-gr'] = "";
+$text['label-left']['es-cl'] = "";
+$text['label-left']['es-mx'] = "";
+$text['label-left']['fr-ca'] = "";
+$text['label-left']['fr-fr'] = "";
+$text['label-left']['he-il'] = "";
+$text['label-left']['it-it'] = "";
+$text['label-left']['nl-nl'] = "";
+$text['label-left']['pl-pl'] = "";
+$text['label-left']['pt-br'] = "";
+$text['label-left']['pt-pt'] = "";
+$text['label-left']['ro-ro'] = "";
+$text['label-left']['ru-ru'] = "";
+$text['label-left']['sv-se'] = "";
+$text['label-left']['uk-ua'] = "";
+$text['label-left']['zh-cn'] = "";
+$text['label-left']['ja-jp'] = "";
+$text['label-left']['ko-kr'] = "";
+
+$text['label-right']['en-us'] = "Right";
+$text['label-right']['en-gb'] = "Right";
+$text['label-right']['ar-eg'] = "";
+$text['label-right']['de-at'] = "";
+$text['label-right']['de-ch'] = "";
+$text['label-right']['de-de'] = "";
+$text['label-right']['el-gr'] = "";
+$text['label-right']['es-cl'] = "";
+$text['label-right']['es-mx'] = "";
+$text['label-right']['fr-ca'] = "";
+$text['label-right']['fr-fr'] = "";
+$text['label-right']['he-il'] = "";
+$text['label-right']['it-it'] = "";
+$text['label-right']['nl-nl'] = "";
+$text['label-right']['pl-pl'] = "";
+$text['label-right']['pt-br'] = "";
+$text['label-right']['pt-pt'] = "";
+$text['label-right']['ro-ro'] = "";
+$text['label-right']['ru-ru'] = "";
+$text['label-right']['sv-se'] = "";
+$text['label-right']['uk-ua'] = "";
+$text['label-right']['zh-cn'] = "";
+$text['label-right']['ja-jp'] = "";
+$text['label-right']['ko-kr'] = "";
+
+$text['label-middle']['en-us'] = "Middle";
+$text['label-middle']['en-gb'] = "Middle";
+$text['label-middle']['ar-eg'] = "";
+$text['label-middle']['de-at'] = "";
+$text['label-middle']['de-ch'] = "";
+$text['label-middle']['de-de'] = "";
+$text['label-middle']['el-gr'] = "";
+$text['label-middle']['es-cl'] = "";
+$text['label-middle']['es-mx'] = "";
+$text['label-middle']['fr-ca'] = "";
+$text['label-middle']['fr-fr'] = "";
+$text['label-middle']['he-il'] = "";
+$text['label-middle']['it-it'] = "";
+$text['label-middle']['nl-nl'] = "";
+$text['label-middle']['pl-pl'] = "";
+$text['label-middle']['pt-br'] = "";
+$text['label-middle']['pt-pt'] = "";
+$text['label-middle']['ro-ro'] = "";
+$text['label-middle']['ru-ru'] = "";
+$text['label-middle']['sv-se'] = "";
+$text['label-middle']['uk-ua'] = "";
+$text['label-middle']['zh-cn'] = "";
+$text['label-middle']['ja-jp'] = "";
+$text['label-middle']['ko-kr'] = "";
+
+?>