瀏覽代碼

Enhanced Theme: Restored displaying domain name in header, can control visibility and style using Default Settings.

Nate Jones 11 年之前
父節點
當前提交
9ee9202410

+ 2 - 0
core/default_settings/default_setting_edit.php

@@ -416,6 +416,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 	elseif (
 		$category == "theme" && $subcategory == "background_color" && $name == "array" ||
 		$category == "theme" && $subcategory == "login_background_color" && $name == "text" ||
+		$category == "theme" && $subcategory == "domain_color" && $name == "text" ||
+		$category == "theme" && $subcategory == "domain_background_color" && $name == "text" ||
 		$category == "theme" && $subcategory == "footer_color" && $name == "text" ||
 		$category == "theme" && $subcategory == "footer_background_color" && $name == "text" ||
 		$category == "theme" && $subcategory == "message_default_background_color" && $name == "text" ||

+ 25 - 0
resources/functions.php

@@ -1070,4 +1070,29 @@ function number_pad($number,$n) {
 		}
 	}
 
+//function to convert hexidecimal color value to rgb value
+	if (!function_exists('hex2rgb')) {
+		function hex2rgb($hex, $delim = '') {
+			$hex = str_replace("#", "", $hex);
+
+			if (strlen($hex) == 3) {
+				$r = hexdec(substr($hex,0,1).substr($hex,0,1));
+				$g = hexdec(substr($hex,1,1).substr($hex,1,1));
+				$b = hexdec(substr($hex,2,1).substr($hex,2,1));
+			}
+			else {
+				$r = hexdec(substr($hex,0,2));
+				$g = hexdec(substr($hex,2,2));
+				$b = hexdec(substr($hex,4,2));
+			}
+			$rgb = array($r, $g, $b);
+
+			if ($delim != '') {
+				return implode($delim, $rgb); // return rgb delimited string
+			}
+			else {
+				return $rgb; // return array of rgb values
+			}
+		}
+	}
 ?>

+ 31 - 3
themes/enhanced/app_defaults.php

@@ -40,21 +40,49 @@ if ($domains_processed == 1) {
 		$array[$x]['default_setting_name'] = 'text';
 		$array[$x]['default_setting_value'] = '#ffffff';
 		$array[$x]['default_setting_enabled'] = 'true';
-		$array[$x]['default_setting_description'] = 'Set a background color (HTML compatible) for the login box.';
+		$array[$x]['default_setting_description'] = 'Set the background color (HTML compatible) for the login box.';
+		$x++;
+		$array[$x]['default_setting_category'] = 'theme';
+		$array[$x]['default_setting_subcategory'] = 'domain_visible';
+		$array[$x]['default_setting_name'] = 'text';
+		$array[$x]['default_setting_value'] = 'true';
+		$array[$x]['default_setting_enabled'] = 'true';
+		$array[$x]['default_setting_description'] = 'Set the visibility of the name of the domain currently being managed.';
+		$x++;
+		$array[$x]['default_setting_category'] = 'theme';
+		$array[$x]['default_setting_subcategory'] = 'domain_color';
+		$array[$x]['default_setting_name'] = 'text';
+		$array[$x]['default_setting_value'] = '#000000';
+		$array[$x]['default_setting_enabled'] = 'true';
+		$array[$x]['default_setting_description'] = 'Set the text color for domain name.';
+		$x++;
+		$array[$x]['default_setting_category'] = 'theme';
+		$array[$x]['default_setting_subcategory'] = 'domain_background_color';
+		$array[$x]['default_setting_name'] = 'text';
+		$array[$x]['default_setting_value'] = '#000000';
+		$array[$x]['default_setting_enabled'] = 'true';
+		$array[$x]['default_setting_description'] = 'Set the background color (hexidecimal) for the domain name.';
+		$x++;
+		$array[$x]['default_setting_category'] = 'theme';
+		$array[$x]['default_setting_subcategory'] = 'domain_background_opacity';
+		$array[$x]['default_setting_name'] = 'text';
+		$array[$x]['default_setting_value'] = '0.1';
+		$array[$x]['default_setting_enabled'] = 'true';
+		$array[$x]['default_setting_description'] = 'Set the background opacity of the domain name.';
 		$x++;
 		$array[$x]['default_setting_category'] = 'theme';
 		$array[$x]['default_setting_subcategory'] = 'footer_background_color';
 		$array[$x]['default_setting_name'] = 'text';
 		$array[$x]['default_setting_value'] = '#000000';
 		$array[$x]['default_setting_enabled'] = 'true';
-		$array[$x]['default_setting_description'] = 'Set a background color (HTML compatible) for the footer bar.';
+		$array[$x]['default_setting_description'] = 'Set the background color (HTML compatible) for the footer bar.';
 		$x++;
 		$array[$x]['default_setting_category'] = 'theme';
 		$array[$x]['default_setting_subcategory'] = 'footer_color';
 		$array[$x]['default_setting_name'] = 'text';
 		$array[$x]['default_setting_value'] = '#ffffff';
 		$array[$x]['default_setting_enabled'] = 'true';
-		$array[$x]['default_setting_description'] = 'Set a foreground color (HTML compatible) for the footer bar.';
+		$array[$x]['default_setting_description'] = 'Set the foreground color (HTML compatible) for the footer bar.';
 		$x++;
 		$array[$x]['default_setting_category'] = 'theme';
 		$array[$x]['default_setting_subcategory'] = 'footer_opacity';

+ 33 - 9
themes/enhanced/template.php

@@ -825,12 +825,17 @@ legend {
 		color: <?php echo $_SESSION['theme']['message_alert_color']['text']; ?>;
 	}
 
+	#header_icons {
+		display: inline-block;
+		margin-top: 10px;
+		}
+
 	#logout_icon {
 		filter: alpha(opacity=80);
 		opacity: 0.8;
 		-moz-opacity: 0.8;
 		-khtml-opacity: 0.8;
-		margin-left: 17px;
+		margin-left: 6px;
 	}
 
 	#logout_icon:hover {
@@ -846,7 +851,7 @@ legend {
 		opacity: 0.8;
 		-moz-opacity: 0.8;
 		-khtml-opacity: 0.8;
-		margin-left: 17px;
+		padding-left: 10px;
 	}
 
 	#domain_selector_icon:hover {
@@ -857,6 +862,24 @@ legend {
 		cursor: pointer;
 	}
 
+	#domain_selector_domain {
+		display: <?php echo ($_SESSION['theme']['domain_visible']['text'] != 'true') ? 'none' : 'inline-block'; ?>;
+		white-space: nowrap;
+		margin-top: 10px;
+		padding: 3px 7px 1px 7px;
+		margin-top: -1px;
+		background-color: rgba(<?php echo hex2rgb($_SESSION['theme']['domain_background_color']['text'],','); ?>, <?php echo $_SESSION['theme']['domain_background_opacity']['text']; ?>);
+		-webkit-border-radius: 1px;
+		-moz-border-radius: 1px;
+		border-radius: 1px;
+		font-size: 10px;
+		color: <?php echo $_SESSION['theme']['domain_color']['text']; ?>;
+	}
+
+	#domain_selector_domain:hover {
+		cursor: pointer;
+		}
+
 	#domains_container {
 		z-index: 99990;
 		position: absolute;
@@ -965,6 +988,7 @@ legend {
 <script language="JavaScript" type="text/javascript">
 	$(document).ready(function() {
 
+		$("#domain_selector_domain").click(function() { show_domains(); });
 		$("#domain_selector_icon").click(function() { show_domains(); });
 		$("#domains_hide").click(function() { hide_domains(); });
 
@@ -1264,20 +1288,20 @@ if (strlen($_SESSION['message']) > 0) {
 								</td>
 								<td width='100%' style='padding-right: 15px;' align='right' valign='middle'>
 									<?php
-									echo "<span style='white-space: nowrap;'>";
+									echo "<span id='header_icons'>";
+
+								//domain selector icon
+									if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
+										echo "&nbsp;<span id='domain_selector_domain'>".$_SESSION['domain_name']."</span><img id='domain_selector_icon' src='".PROJECT_PATH."/themes/enhanced/images/icon_domain_selector.png' style='width: 28px; height: 23px; border: none;' title='".$_SESSION['domain_name']." &#10;".$text['theme-label-open_selector']."' align='absmiddle'>";
+									}
 
 								//logout icon
 									if ($_SESSION['username'] != '') {
 										$username_full = $_SESSION['username'].((count($_SESSION['domains']) > 1) ? "@".$_SESSION["user_context"] : null);
-										echo "<a href='".PROJECT_PATH."/logout.php' onclick=\"return confirm('".$text['theme-confirm-logout']."');\"><img id='logout_icon' src='".PROJECT_PATH."/themes/enhanced/images/icon_logout.png' style='width: 28px; height: 23px; border: none; margin-top: 15px;' title='".$text['theme-label-logout']." ".$username_full."' align='absmiddle'></a>";
+										echo "<a href='".PROJECT_PATH."/logout.php' onclick=\"return confirm('".$text['theme-confirm-logout']."');\"><img id='logout_icon' src='".PROJECT_PATH."/themes/enhanced/images/icon_logout.png' style='width: 28px; height: 23px; border: none;' title='".$text['theme-label-logout']." ".$username_full."' align='absmiddle'></a>";
 										unset($username_full);
 									}
 
-								//domain selector icon
-									if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
-										echo "<img id='domain_selector_icon' src='".PROJECT_PATH."/themes/enhanced/images/icon_domain_selector.png' style='width: 28px; height: 23px; border: none; margin-top: 15px;' title='".$_SESSION['domain_name']." &#10;".$text['theme-label-open_selector']."' align='absmiddle'>";
-									}
-
 									echo "</span>\n";
 
 								// login form