2009-02-06 Evi Vanoost <vanooste@rcbi.rochester.edu>

* include/styles/menu.css: Updated to make it look good again
	
	* general/main_menu.php: Updated to make it look good again. Also 
	simplified to allow easier modification. If you want to make things
	visible/selected again externally (JS or COOKIE), use the IF/ELSE 
	construction with the big warning.
	
	* general/links_menu.php: Updated to conform to CSS
	
	* include/javascript/jquery.cookie.js: Added to mess with cookies for 
	menu. I will do this in a future update

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1431 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-02-06 21:18:03 +00:00
parent 355c7873ee
commit ef32f64adf
5 changed files with 195 additions and 148 deletions

View File

@ -1,3 +1,17 @@
2009-02-06 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/styles/menu.css: Updated to make it look good again
* general/main_menu.php: Updated to make it look good again. Also
simplified to allow easier modification. If you want to make things
visible/selected again externally (JS or COOKIE), use the IF/ELSE
construction with the big warning.
* general/links_menu.php: Updated to conform to CSS
* include/javascript/jquery.cookie.js: Added to mess with cookies for
menu. I will do this in a future update
2009-02-05 Evi Vanoost <vanooste@rcbi.rochester.edu>
* general/header.php: Added alt tags to images

View File

@ -19,9 +19,9 @@ $sql = 'SELECT link, name FROM tlink ORDER BY name';
$result = get_db_all_rows_sql ($sql);
if ($result !== false) {
echo '<div class="tit bg4">:: '.__('Links').' ::</div>';
echo '<div class="menu links"><ul>';
echo '<div class="menu"><ul>';
foreach ($result as $link) {
echo '<li class="menu_option menu_link"><a href="'.$link["link"].'" target="_new">'.$link["name"].'</a></li>';
echo '<li class="links"><a href="'.$link["link"].'" target="_new">'.$link["name"].'</a></li>';
}
echo '</ul></div>';
}

View File

@ -40,7 +40,7 @@ function temp_print_menu ($menu, $classtype) {
}
$submenu = false;
$classes = array ('menu_option');
$classes = array ();
if (isset ($main["sub"])) {
$classes[] = 'has_submenu';
$submenu = true;
@ -57,22 +57,13 @@ function temp_print_menu ($menu, $classtype) {
$output = '';
if (! $submenu) {
$output .= '<li class="'.implode (" ", $classes).'" id="'.$id.'">';
$output .= '<div class="title">';
$output .= '<div class="menu_icon" id="icon_'.$id.'"><br /></div>';
//Print out the first level
$output .= '<a href="index.php?sec='.$mainsec.'&amp;sec2='.$main["sec2"].($main["refr"] ? '&amp;refr='.$main["refr"] : '').'">'.$main["text"].'</a>';
$output .= '</div>';
$output .= "</li>\n";
echo $output;
continue;
$main["sub"] = array (); //Empty array won't go through foreach
}
$submenu_output = '';
$visible = false;
if (isset ($_COOKIE[$id]))
$visible = true;
$selected = false;
$visible = false;
foreach ($main["sub"] as $subsec2 => $sub) {
//Set class
if ($sec2 == $subsec2 && isset ($sub[$subsec2]["options"])
@ -87,7 +78,7 @@ function temp_print_menu ($menu, $classtype) {
$selected = true;
$visible = true;
} else {
//Else it's invisible
//Else it's not selected
$class = 'submenu_not_selected';
}
@ -97,7 +88,7 @@ function temp_print_menu ($menu, $classtype) {
if (isset ($sub["type"]) && $sub["type"] == "direct") {
//This is an external link
$submenu_output .= '<li class="'.$class.'"><a href="'.$subsec2.'">'.$sub["text"]."</a></li>\n";
$submenu_output .= '<li class="'.$class.'"><a href="'.$subsec2.'">'.$sub["text"]."</a></li>";
} else {
//This is an internal link
if (isset ($sub[$subsec2]["options"])) {
@ -106,37 +97,29 @@ function temp_print_menu ($menu, $classtype) {
$link_add = "";
}
$submenu_output .= '<li'.($class ? ' class="'.$class.'"' : '').'>';
$submenu_output .= '<a href="index.php?sec='.$mainsec.'&amp;sec2='.$subsec2.($main["refr"] ? '&amp;refr='.$main["refr"] : '').$link_add.'">'.$sub["text"].'</a>';
$submenu_output .= "</li>\n";
$submenu_output .= '<a href="index.php?sec='.$mainsec.'&amp;sec2='.$subsec2.($main["refr"] ? '&amp;refr='.$main["refr"] : '').$link_add.'"'.($class == 'submenu_selected' ? 'style="font-weight:bold;"' : '').'>'.$sub["text"].'</a>';
$submenu_output .= "</li>";
}
}
//Print out the first level
if ($visible)
$classes[] = 'has_submenu_visible';
if ($selected) {
$classes[] = 'has_submenu_selected';
$output .= '<li class="'.implode (" ", $classes).'" id="icon_'.$id.'">';
$output .= '<a href="index.php?sec='.$mainsec.'&amp;sec2='.$main["sec2"].($main["refr"] ? '&amp;refr='.$main["refr"] : '').'"'.(($selected || in_array ("selected", $classes)) ? ' style="font-weight:bold;"' : '').'>'.$main["text"].'</a>';
if ($submenu_output != '') {
//WARNING: IN ORDER TO MODIFY THE VISIBILITY OF MENU'S AND SUBMENU'S (eg. with cookies) YOU HAVE TO ADD TO THIS ELSEIF. DON'T MODIFY THE CSS
if ($visible || in_array ("selected", $classes)) {
$visible = true;
}
$output .= '<ul class="submenu'.($visible ? '' : ' invisible').'">';
$output .= $submenu_output;
$output .= '</ul>';
}
$output .= '<li class="'.implode (" ", $classes).'" id="'.$id.'">';
$output .= '<div class="title">';
$output .= '<div class="menu_icon" id="icon_'.$id.'"><br /></div>';
$output .= '<div class="toggle"><br /></div>';
$output .= '<a href="index.php?sec='.$mainsec.'&amp;sec2='.$main["sec2"].($main["refr"] ? '&amp;refr='.$main["refr"] : '').'">'.$main["text"].'</a>';
$output .= '</div>';
$output .= '<div class="submenu'.($visible ? '' : ' invisible').'">';
$output .= '<ul>';
$output .= $submenu_output;
$output .= '</ul>';
$output .= '</div>';
$output .= '</li>';
echo $output;
}
echo '</ul>';
//Invisible UL for adding border-top
echo '<ul style="height: 0px;">&nbsp;</ul></div>';
echo '<ul style="height: 0px;"><li>&nbsp;</li></ul></div>';
}
echo '<div class="tit bg">:: '.__('Operation').' ::</div>';

View File

@ -0,0 +1,97 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// NOTE Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

View File

@ -31,16 +31,14 @@
padding: 0;
margin: 0;
}
.menu li.menu_option {
.menu li.selected, .menu li.not_selected {
border: 0px solid black;
border-bottom: 1px solid #d4d4d4;
margin: 0;
}
li.not_selected a {
background: #E9F3D2;
}
.menu a {
.menu li a {
background-color: inherit;
color: #000000;
display:block; /* This makes it so that the whole li is clickable */
text-decoration:none;
@ -52,142 +50,97 @@ li.not_selected a {
text-decoration:none;
color: #D54E21;
}
/* This is for the dropout menu */
.menu.int ul {
height: 26px;
}
/* a selected ul has a height set in the style tag */
.menu.int ul.selected {
height: inherit;
}
/* Force the hovered ul to be 28px unless the ul is selected */
.menu.int ul:hover {
height: 26px;
}
.menu.int ul:hover.selected {
height: inherit;
}
.menu.int ul.selected > .submenu {
height: 14px;
}
.submenu {
background: #FFFFFF !important;
border-bottom-color: #AAAAAA !important;
border-bottom-style: solid;
border-bottom-width: 1px;
border-right-color: #D6D6D6 !important;
border-right-style: solid;
border-right-width: 1px;
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
margin: 0px 10px 0px 0;
width:155px;
}
.submenu ul li a {
background: #FFFFFF !important;
border-style: none solid none none;
border-width: 0 1px 0 0;
border-color: #E9F3D2;
margin-left: 0;
}
.submenu ul li a:hover {
background: #D6DCC6 !important;
}
.submenu_selected {
font-weight: bold;
background-color: #F5F5F5 !important;
}
.not_selected .submenu_not_selected a {
background-color: #FFFFFF !important;
}
.menu li.selected .title {
background: #71AC6B;
}
.menu .not_selected .title {
.submenu li a {
background-color: #E9F3D2;
margin-left: 0px;
padding-left: 29px;
display:block;
border-width: 1px 0 0 1px;
border-style: solid;
border-color: #dadbdc;
}
.menu .toggle {
clear: right;
float: right;
height: 27px;
width: 22px;
z-index: 1;
.menu li.has_submenu.selected > a, .menu li:hover.has_submenu > a {
background: transparent url(images/toggle.gif) no-repeat 110px 2px;
}
.menu .menu_icon {
clear: left;
float: left;
height: 27px;
width: 22px;
.menu li:hover.has_submenu ul.invisible {
display:block;
}
.menu ul li:hover > .title > .toggle, .menu ul li.selected > .title > .toggle {
background: transparent url(images/toggle.gif) no-repeat scroll !important;
.menu li.links {
background: #E9F3D2 url(../../images/link.png) no-repeat 4px 8px;
border-width: 1px 0 0 1px;
border-style: solid;
border-color: #dadbdc;
}
/* Icons specified here */
div#icon_oper-agents {
background: transparent url(../../images/bricks.png) no-repeat 4px 8px;
#icon_oper-agents {
background: #E9F3D2 url(../../images/bricks.png) no-repeat 4px 4px;
}
div#icon_oper-servers {
background: transparent url(../../images/server_database.png) no-repeat 4px 8px;
#icon_oper-servers {
background: #E9F3D2 url(../../images/server_database.png) no-repeat 4px 4px;
}
div#icon_oper-incidents {
background: transparent url(../../images/book_edit.png) no-repeat 4px 8px;
#icon_oper-incidents {
background: #E9F3D2 url(../../images/book_edit.png) no-repeat 4px 4px;
}
div#icon_oper-events {
background: transparent url(../../images/lightning_go.png) no-repeat 4px 8px;
#icon_oper-events {
background: #E9F3D2 url(../../images/lightning_go.png) no-repeat 4px 4px;
}
/* users */
div#icon_oper-users {
background: transparent url(../../images/group.png) no-repeat 4px 8px;
#icon_oper-users {
background: #E9F3D2 url(../../images/group.png) no-repeat 4px 4px;
}
/* trap console */
div#icon_oper-snmpc, #god-snmpc {
background: transparent url(../../images/computer_error.png) no-repeat 4px 8px;
#icon_oper-snmpc, #icon_god-snmpc {
background: #E9F3D2 url(../../images/computer_error.png) no-repeat 4px 4px;
}
div#icon_oper-messages {
background: transparent url(../../images/email.png) no-repeat 4px 8px;
#icon_oper-messages {
background: #E9F3D2 url(../../images/email.png) no-repeat 4px 4px;
}
div#icon_oper-reporting {
background: transparent url(../../images/reporting.png) no-repeat 4px 8px;
#icon_oper-reporting {
background: #E9F3D2 url(../../images/reporting.png) no-repeat 4px 4px;
}
div#icon_oper-visualc {
background: transparent url(../../images/monitor.png) no-repeat 4px 8px;
#icon_oper-visualc {
background: #E9F3D2 url(../../images/monitor.png) no-repeat 4px 4px;
}
div#icon_oper-extensions, div#icon_god-extensions {
background: transparent url(../../images/extensions.png) no-repeat 4px 8px;
#icon_oper-extensions, #icon_god-extensions {
background: #E9F3D2 url(../../images/extensions.png) no-repeat 4px 4px;
}
/* Godmode images */
div#icon_god-agents {
background: transparent url(../../images/god1.png) no-repeat 4px 8px;
#icon_god-agents {
background: #E9F3D2 url(../../images/god1.png) no-repeat 4px 4px;
}
div#icon_god-modules {
background: transparent url(../../images/brick.png) no-repeat 4px 8px;
#icon_god-modules {
background: #E9F3D2 url(../../images/brick.png) no-repeat 4px 4px;
}
div#icon_god-alerts {
background: transparent url(../../images/god2.png) no-repeat 4px 8px;
#icon_god-alerts {
background: #E9F3D2 url(../../images/god2.png) no-repeat 4px 4px;
}
div#icon_god-dbmaint {
background: transparent url(../../images/god8.png) no-repeat 4px 8px;
#icon_god-dbmaint {
background: #E9F3D2 url(../../images/god8.png) no-repeat 4px 4px;
}
div#icon_god-users {
background: transparent url(../../images/god3.png) no-repeat 4px 8px;
#icon_god-users {
background: #E9F3D2 url(../../images/god3.png) no-repeat 4px 4px;
}
div#icon_god-reporting {
background: transparent url(../../images/reporting_edit.png) no-repeat 4px 8px;
#icon_god-reporting {
background: #E9F3D2 url(../../images/reporting_edit.png) no-repeat 4px 4px;
}
div#icon_god-profiles {
background: transparent url(../../images/god4.png) no-repeat 4px 8px;
#icon_god-profiles {
background: #E9F3D2 url(../../images/god4.png) no-repeat 4px 4px;
}
div#icon_god-servers {
background: transparent url(../../images/god5.png) no-repeat 4px 8px;
#icon_god-servers {
background: #E9F3D2 url(../../images/god5.png) no-repeat 4px 4px;
}
div#icon_god-audit {
background: transparent url(../../images/god6.png) no-repeat 4px 8px;
#icon_god-audit {
background: #E9F3D2 url(../../images/god6.png) no-repeat 4px 4px;
}
div#icon_god-setup {
background: transparent url(../../images/god7.png) no-repeat 4px 8px;
}
div#icon_oper-inventory {
background: transparent url(../../images/page_white_text.png) no-repeat 4px 8px;
#icon_god-setup {
background: #E9F3D2 url(../../images/god7.png) no-repeat 4px 4px;
}
#icon_oper-inventory {
background: #E9F3D2 url(../../images/page_white_text.png) no-repeat 4px 4px;
}