Browse Source

Dashboard: Call Forward widget, Edit position without reload, misc adjustments.

fusionate 2 năm trước cách đây
mục cha
commit
4a9d2df365

+ 47 - 1
core/dashboard/app_languages.php

@@ -426,4 +426,50 @@
 		$text['label-welcome']['ru-ru'] = "Добро пожаловать:";
 		$text['label-welcome']['sv-se'] = "Välkommen:";
 		$text['label-welcome']['uk-ua'] = "Ласкаво просимо:";
-?>
+
+		$text['button-contract_all']['en-us'] = "Contract All";
+		$text['button-contract_all']['en-gb'] = "Contract All";
+		$text['button-contract_all']['ar-eg'] = "Contract All";
+		$text['button-contract_all']['de-at'] = "Contract All";
+		$text['button-contract_all']['de-ch'] = "Contract All";
+		$text['button-contract_all']['de-de'] = "Contract All";
+		$text['button-contract_all']['el-gr'] = "Contract All";
+		$text['button-contract_all']['es-cl'] = "Contract All";
+		$text['button-contract_all']['es-mx'] = "Contract All";
+		$text['button-contract_all']['fr-ca'] = "Contract All";
+		$text['button-contract_all']['fr-fr'] = "Contract All";
+		$text['button-contract_all']['he-il'] = "Contract All";
+		$text['button-contract_all']['it-it'] = "Contract All";
+		$text['button-contract_all']['nl-nl'] = "Contract All";
+		$text['button-contract_all']['pl-pl'] = "Contract All";
+		$text['button-contract_all']['pt-br'] = "Contract All";
+		$text['button-contract_all']['pt-pt'] = "Contract All";
+		$text['button-contract_all']['ro-ro'] = "Contract All";
+		$text['button-contract_all']['ru-ru'] = "Contract All";
+		$text['button-contract_all']['sv-se'] = "Contract All";
+		$text['button-contract_all']['uk-ua'] = "Contract All";
+		$text['button-contract_all']['tr-tr'] = "Contract All";
+
+		$text['button-expand_all']['en-us'] = "Expand All";
+		$text['button-expand_all']['en-gb'] = "Expand All";
+		$text['button-expand_all']['ar-eg'] = "Expand All";
+		$text['button-expand_all']['de-at'] = "Expand All";
+		$text['button-expand_all']['de-ch'] = "Expand All";
+		$text['button-expand_all']['de-de'] = "Expand All";
+		$text['button-expand_all']['el-gr'] = "Expand All";
+		$text['button-expand_all']['es-cl'] = "Expand All";
+		$text['button-expand_all']['es-mx'] = "Expand All";
+		$text['button-expand_all']['fr-ca'] = "Expand All";
+		$text['button-expand_all']['fr-fr'] = "Expand All";
+		$text['button-expand_all']['he-il'] = "Expand All";
+		$text['button-expand_all']['it-it'] = "Expand All";
+		$text['button-expand_all']['nl-nl'] = "Expand All";
+		$text['button-expand_all']['pl-pl'] = "Expand All";
+		$text['button-expand_all']['pt-br'] = "Expand All";
+		$text['button-expand_all']['pt-pt'] = "Expand All";
+		$text['button-expand_all']['ro-ro'] = "Expand All";
+		$text['button-expand_all']['ru-ru'] = "Expand All";
+		$text['button-expand_all']['sv-se'] = "Expand All";
+		$text['button-expand_all']['uk-ua'] = "Expand All";
+		$text['button-expand_all']['tr-tr'] = "Expand All";
+?>

+ 1 - 0
core/dashboard/dashboard.php

@@ -241,6 +241,7 @@
 	echo "<div class='action_bar' id='action_bar'>\n";
 	echo "	<div class='heading'><b>".$text['title-dashboard']." (".$num_rows.")</b></div>\n";
 	echo "	<div class='actions'>\n";
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','name'=>'btn_back','style'=>'margin-right: 15px;','link'=>'index.php']);
 	if (permission_exists('dashboard_add')) {
 		echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard_edit.php']);
 	}

+ 99 - 65
core/dashboard/index.php

@@ -172,6 +172,14 @@
 	</script>
 	<?php
 
+// determine initial state all button to display
+	if (is_array($dashboard) && @sizeof($dashboard) != 0) {
+		$expanded_all = true;
+		foreach ($dashboard as $row) {
+			if ($row['dashboard_details_state'] == 'contracted') { $expanded_all = false; }
+		}
+	}
+
 //show the content
 	echo "<form id='dashboard' method='POST' onsubmit='setFormSubmitting()'>\n";
 	echo "<div class='action_bar' id='action_bar'>\n";
@@ -181,13 +189,13 @@
 		echo "		".$text['label-welcome']." <a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION["username"]."</a>&nbsp; &nbsp;";
 	}
 	if (permission_exists('dashboard_edit')) {
-		if ($_GET['edit'] == 'true') {
-			echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','name'=>'btn_back','link'=>'index.php']);
-			echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','name'=>'btn_save']);
-		}
-		else {
-			echo button::create(['type'=>'button','label'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'id'=>'btn_edit','name'=>'btn_edit','link'=>'index.php?edit=true']);
-		}
+		echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','name'=>'btn_back','style'=>'display: none;','onclick'=>"edit_mode('off');"]);
+		echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','name'=>'btn_save','style'=>'display: none; margin-left: 15px;']);
+		echo "<span id='expand_contract'>\n";
+			echo button::create(['type'=>'button','label'=>$text['button-expand_all'],'icon'=>$_SESSION['theme']['button_icon_expand'],'id'=>'btn_expand','name'=>'btn_expand','style'=>($expanded_all ? 'display: none;' : null),'onclick'=>"$('.hud_details').slideDown('fast'); $(this).hide(); $('#btn_contract').show();"]);
+			echo button::create(['type'=>'button','label'=>$text['button-contract_all'],'icon'=>$_SESSION['theme']['button_icon_contract'],'id'=>'btn_contract','name'=>'btn_contract','style'=>(!$expanded_all ? 'display: none;' : null),'onclick'=>"$('.hud_details').slideUp('fast'); $(this).hide(); $('#btn_expand').show();"]);
+		echo "</span>\n";
+		echo button::create(['type'=>'button','label'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'id'=>'btn_edit','name'=>'btn_edit','style'=>'margin-left: 15px;','onclick'=>"edit_mode('on');"]);
 		echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard.php']);
 	}
 	echo "	</div>\n";
@@ -213,6 +221,7 @@
 
 .widget {
   /*background-color: #eee;*/
+  cursor: pointer;
 }
 
 .widgets {
@@ -312,11 +321,7 @@
 	foreach($dashboard as $row) {
 		$dashboard_name = strtolower($row['dashboard_name']);
 		$dashboard_name = str_replace(" ", "_", $dashboard_name);
-		$draggable = '';
-		if ($_GET['edit'] == 'true') {
-			$draggable = "draggable='true'";
-		}
-		echo "<div class='widget' id='".$dashboard_name."' ".$draggable.">\n";
+		echo "<div class='widget' id='".$dashboard_name."' draggable='false'>\n";
 			include($row['dashboard_path']);
 		echo "</div>\n";
 		$x++;
@@ -324,7 +329,7 @@
 	echo "</div>\n";
 
 //begin edit
-	if ($_GET['edit'] == 'true') {
+	if (permission_exists('dashboard_edit')) {
 		?>
 
 		<style>
@@ -336,83 +341,112 @@
 			user-select: none;
 		}
 
-		.widget {
+		div.widget.editable {
 			cursor: move;
 		}
 
-		.hud_box {
+		.hud_box.editable {
 			transition: 0.2s;
+			border: 1px dashed rgba(0,0,0,0.4);
 		}
 
-		.hud_box:hover {
+		.hud_box.editable:hover {
 			box-shadow: 0 5px 10px rgba(0,0,0,0.2);
+			border: 1px dashed rgba(0,0,0,0.4);
 			transform: scale(1.03, 1.03);
 			transition: 0.2s;
 		}
 
-		.hud_box .hud_box:hover {
+		.hud_box .hud_box.editable:hover {
 			box-shadow: none;
 			transform: none;
 		}
 
 		.ghost {
-			border: 3px dashed rgba(0,0,0,1);
+			border: 2px dashed rgba(0,0,0,1);
+			<?php $br = format_border_radius($_SESSION['theme']['dashboard_border_radius']['text'], '5px'); ?>
+			-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
+			-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
+			border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
+			<?php unset($br); ?>
 			opacity: 0.2;
 		}
 		</style>
 
 		<script>
-		//make widgets draggable
 		var widgets = document.getElementById('widgets');
-		var sortable = Sortable.create(widgets, {
-			animation: 150,
-			draggable: ".widget",
-			preventOnFilter: true,
-			ghostClass: 'ghost',
-			/*
-			onChange: function (evt) {
-				//check if chart exists
-				let chart_status = Chart.getChart(evt.item.id + "_chart");
-				if(chart_status !== undefined && chart_status !== null) {
-					let context = eval(evt.item.id + "_chart_context");
-					let chart = Chart.getChart(context);
-					let config = eval(evt.item.id + "_chart_config");
-
-					//re render the chart
-					chart.destroy();
-					chart.options.animation = { duration: 0 };
-					chart = new Chart(context, config);
-				}
-			},
-			*/
-			onSort: function (evt) {
-				let widget_ids = document.querySelectorAll("#widgets > div[id]");
-				let widget_ids_list = [];
-				for (let i = 0; i < widget_ids.length; i++) {
-					widget_ids_list.push(widget_ids[i].id);
-				}
-				document.getElementById('widget_order').value = widget_ids_list;
-			},
-		});
+		var sortable;
+		//make widgets draggable
+		function edit_mode(state) {
+
+			if (state == 'on') {
+				$('span#expand_contract, #btn_edit, #btn_add').hide();
+				$('.hud_box').addClass('editable');
+				$('#btn_back, #btn_save').show();
+				$('div.widget').attr('draggable',true).addClass('editable');
+
+				sortable = Sortable.create(widgets, {
+					animation: 150,
+					draggable: ".widget",
+					preventOnFilter: true,
+					ghostClass: 'ghost',
+					/*
+					onChange: function (evt) {
+						//check if chart exists
+						let chart_status = Chart.getChart(evt.item.id + "_chart");
+						if(chart_status !== undefined && chart_status !== null) {
+							let context = eval(evt.item.id + "_chart_context");
+							let chart = Chart.getChart(context);
+							let config = eval(evt.item.id + "_chart_config");
+
+							//re render the chart
+							chart.destroy();
+							chart.options.animation = { duration: 0 };
+							chart = new Chart(context, config);
+						}
+					},
+					*/
+					onSort: function (evt) {
+						let widget_ids = document.querySelectorAll("#widgets > div[id]");
+						let widget_ids_list = [];
+						for (let i = 0; i < widget_ids.length; i++) {
+							widget_ids_list.push(widget_ids[i].id);
+						}
+						document.getElementById('widget_order').value = widget_ids_list;
+					},
+				});
+
+				/*
+				//warn the user before leaving the page
+				var formSubmitting = false;
+				var setFormSubmitting = function() { formSubmitting = true; };
+
+				window.onload = function() {
+					window.addEventListener("beforeunload", function (e) {
+						var confirmationMessage = 'You have unsaved changes which will not be saved.';
+
+						if (formSubmitting) {
+							return undefined;
+						}
+
+						(e || window.event).returnValue = confirmationMessage;
+						return confirmationMessage;
+					});
+				};
+				*/
 
-		/*
-		//warn the user before leaving the page
-		var formSubmitting = false;
-		var setFormSubmitting = function() { formSubmitting = true; };
+			}
+			else { // off
 
-		window.onload = function() {
-			window.addEventListener("beforeunload", function (e) {
-				var confirmationMessage = 'You have unsaved changes which will not be saved.';
+				$('div.widget').attr('draggable',false).removeClass('editable');
+				$('.hud_box').removeClass('editable');
+				$('#btn_back, #btn_save').hide();
+				$('span#expand_contract, #btn_edit, #btn_add').show();
 
-				if (formSubmitting) {
-					return undefined;
-				}
+				sortable.option('disabled', true);
 
-				(e || window.event).returnValue = confirmationMessage;
-				return confirmationMessage;
-			});
-		};
-		*/
+			}
+		}
 		</script>
 		<?php
 	} //end edit
@@ -420,4 +454,4 @@
 //show the footer
 	require_once "resources/footer.php";
 
-?>
+?>

+ 8 - 8
core/user_settings/app_languages.php

@@ -2589,16 +2589,16 @@ $text['label-active']['ru-ru'] = "Активные";
 $text['label-active']['sv-se'] = "Aktiv";
 $text['label-active']['uk-ua'] = "";
 
-$text['label-inactive']['en-us'] = "InActive";
-$text['label-inactive']['en-gb'] = "InActive";
+$text['label-inactive']['en-us'] = "Inactive";
+$text['label-inactive']['en-gb'] = "Inactive";
 $text['label-inactive']['ar-eg'] = "";
-$text['label-inactive']['de-at'] = "InAktiv"; //copied from de-de
-$text['label-inactive']['de-ch'] = "InAktiv"; //copied from de-de
-$text['label-inactive']['de-de'] = "InAktiv";
+$text['label-inactive']['de-at'] = "Inaktiv"; //copied from de-de
+$text['label-inactive']['de-ch'] = "Inaktiv"; //copied from de-de
+$text['label-inactive']['de-de'] = "Inaktiv";
 $text['label-inactive']['es-cl'] = "";
 $text['label-inactive']['es-mx'] = "";
-$text['label-inactive']['fr-ca'] = "InActif";
-$text['label-inactive']['fr-fr'] = "InActif";
+$text['label-inactive']['fr-ca'] = "Inactif";
+$text['label-inactive']['fr-fr'] = "Inactif";
 $text['label-inactive']['he-il'] = "";
 $text['label-inactive']['it-it'] = "Non Attivo";
 $text['label-inactive']['nl-nl'] = "";
@@ -2607,7 +2607,7 @@ $text['label-inactive']['pt-br'] = "";
 $text['label-inactive']['pt-pt'] = "";
 $text['label-inactive']['ro-ro'] = "";
 $text['label-inactive']['ru-ru'] = "Неактивный";
-$text['label-inactive']['sv-se'] = "InAktiv";
+$text['label-inactive']['sv-se'] = "Inaktiv";
 $text['label-inactive']['uk-ua'] = "";
 
 ?>

+ 16 - 0
themes/default/app_config.php

@@ -2335,6 +2335,22 @@
 		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
 		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
 		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "75424d2d-cb7d-4469-9269-7cb814e863b8";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_expand";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-expand";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "df614b6d-217c-43a6-a6ce-5cef689e5348";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_contract";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-compress";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
 		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "814ed631-a315-4bde-a822-4038432ae2a6";
 		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
 		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "keyboard_shortcut_check_all_enabled";

+ 29 - 1
themes/default/css.php

@@ -2431,7 +2431,6 @@ header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
 		-webkit-box-shadow: inset 0 7px 7px -7px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>, inset 0 -8px 12px -10px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>;
 		box-shadow: inset 0 7px 7px -7px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>, inset 0 -8px 12px -10px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>;
 		*/
-		padding-top: 3px;
 		padding-bottom: 15px;
 		overflow-y: auto;
 		}
@@ -2455,6 +2454,35 @@ header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
 		font-size: <?php echo ($_SESSION['theme']['dashboard_detail_heading_text_size']['text'] != '') ? $_SESSION['theme']['dashboard_detail_heading_text_size']['text'] : '11px'; ?>;
 		font-family: <?php echo ($_SESSION['theme']['table_heading_text_font']['text'] != '') ? $_SESSION['theme']['table_heading_text_font']['text'] : 'arial'; ?>
 		color: <?php echo ($_SESSION['theme']['table_heading_text_color']['text'] != '') ? $_SESSION['theme']['table_heading_text_color']['text'] : '#3164ad'; ?>;
+		padding-top: 3px;
+		<?php
+		$color_edge = ($_SESSION['theme']['dashboard_detail_background_color_edge']['text'] != '') ? $_SESSION['theme']['dashboard_detail_background_color_edge']['text'] : '#edf1f7';
+		$color_center = ($_SESSION['theme']['dashboard_detail_background_color_center']['text'] != '') ? $_SESSION['theme']['dashboard_detail_background_color_center']['text'] : '#f9fbfe';
+		?>
+		background: <?php echo $color_center; ?>;
+		background-image: -ms-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
+		background-image: -moz-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
+		background-image: -o-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
+		background-image: -webkit-gradient(linear, left, right, color-stop(0, <?php echo $color_edge; ?>), color-stop(0.30, <?php echo $color_center; ?>), color-stop(0.70, <?php echo $color_center; ?>), color-stop(1, <?php echo $color_edge; ?>));
+		background-image: -webkit-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
+		background-image: linear-gradient(to right, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
+		<?php unset($color_edge, $color_center); ?>
+		}
+
+	th.hud_heading:first-of-type {
+		<?php $br = format_border_radius($_SESSION['theme']['dashboard_border_radius']['text'], '5px'); ?>
+		-webkit-border-top-left-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?>;
+		-moz-border-top-left-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?>;
+		border-top-left-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?>;
+		<?php unset($br); ?>
+		}
+
+	th.hud_heading:first-of-type {
+		<?php $br = format_border_radius($_SESSION['theme']['dashboard_border_radius']['text'], '5px'); ?>
+		-webkit-border-top-left-radius: <?php echo $br['tr']['n'].$br['tr']['u']; ?>;
+		-moz-border-top-left-radius: <?php echo $br['tr']['n'].$br['tr']['u']; ?>;
+		border-top-left-radius: <?php echo $br['tr']['n'].$br['tr']['u']; ?>;
+		<?php unset($br); ?>
 		}
 
 	td.hud_text {