From d5912ac1e81d6f637d12c6eb64b02fb9e460f374 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 13 Jul 2010 21:23:39 +0000 Subject: [PATCH] Start un-breaking all the broken UI navigation --- common.inc.php | 104 +++++++++++++++++++++++++++++----------- db/db.code.version.txt | 2 +- db/db.update.201.sql | 43 +++++++++++++++++ nav.php | 63 ++++++++++++++++++++++++ theme/default/sfiab.css | 61 +++++++++++++++++++---- 5 files changed, 235 insertions(+), 38 deletions(-) create mode 100644 db/db.update.201.sql create mode 100644 nav.php diff --git a/common.inc.php b/common.inc.php index ee0028f..df2e418 100644 --- a/common.inc.php +++ b/common.inc.php @@ -433,6 +433,7 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false) { global $HEADER_SENT; global $config; + global $roles; global $prependdir; global $conference; @@ -459,6 +460,32 @@ $(document).ready(function(){ if($("#importantdatesbox").length) $("#importantdatesbox").load("important_dates.php?display=box"); }); + + +function taskNav(id,pid,level) { + switch(level) { + case 0: //clicked on a top-level nav, so populate the secondary menu + $("#secondarymenu").load("/nav.php?level=1&id="+id); + $("#secondarymenu").show(); + $("#tertiarymenu").hide(); + $(".primarynav-selected").removeClass("primarynav-selected"); + $("#primary_nav_"+id).addClass("primarynav-selected"); + break; + + case 1: //clicked on a secondary nav, so populate the left-menu + $(".secondarynav-selected").removeClass("secondarynav-selected"); + $("#secondary_nav_"+id).addClass("secondarynav-selected"); + + $("#tertiarymenu_accordion").accordion("destroy"); + $("#tertiarymenu_accordion").load("/nav.php?level=2&id="+id,null,function() { + $("#tertiarymenu_accordion").accordion({clearStyle: true}); //"option", "collapsible", true); + }); + $("#tertiarymenu").show(); + break; + + } + return false; +}
'Volunteer', 'judge' => 'Judge', - 'student'=>'Participant','committee'=>'Committee Member', - 'fair'=>'Science Fair'); - if($_SESSION['users_type'] != false) { - echo i18n($types[$_SESSION['users_type']])."
"; - } - echo " {$_SESSION['email']}
"; - if($_SESSION['multirole'] == true) { - echo "[".i18n('Switch Roles')."] "; - } - echo "[".i18n("Logout")."]"; +if(isset($_SESSION['roles']) && $_SESSION['username']) { + echo i18n("Logged in as %1",array($_SESSION['username']))."
"; + echo "".i18n("Logout").""; } else if(isset($_SESSION['email'])) { /* Backwards compatible login settings */ @@ -579,7 +597,7 @@ if(is_array($nav)) { $navkeys=array_keys($nav); switch($navkeys[2]) { case "Fundraising": - echo "
- -
-
- +
-*/ +
+
+
+
+ +"; + echo " $(document).ready(function() {\n"; + echo "taskNav({$_SESSION['nav']['primary']},0,0);"; + echo " });"; + echo "\n"; +} + +if($_SESSION['nav']['secondary']) { + echo "\n"; +} + ?> + + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +"; + $cl=""; + while($r=mysql_fetch_object($q)) { + if($_SESSION['nav']['secondary'] == $r->id) { + $cl="class=\"secondarynav-selected\""; + } + else $cl=""; + echo "
  • id}\" $cl>id,$r->pid,$r->level)\">".i18n($r->task)."
  • \n"; + } + echo "\n"; + break; + + case 2: //populate the tertiary menu + $_SESSION['nav']['secondary']=$id; + $q=mysql_query("SELECT * FROM rolestasks WHERE pid='$id' AND level=2 ORDER By ord,task"); + while($r=mysql_fetch_object($q)) { + echo "

    link\">".i18n("$r->task")."

    \n"; + echo ""; + } + echo "\n"; + break; + } + } +?> + diff --git a/theme/default/sfiab.css b/theme/default/sfiab.css index 878d53a..19075eb 100644 --- a/theme/default/sfiab.css +++ b/theme/default/sfiab.css @@ -93,19 +93,22 @@ table tr.odd { margin-top: 0px; margin-bottom: 5px; height: 22px; + display: none; } -#left { - width: 165px; +#tertiarymenu { + width: 200px; + min-height: 600px; background: #EEEEFF; border: 2px solid Silver; padding: 5px; - font-size: 1.0em; + font-size: 1.1em; float: left; - margin-left: 3px; + margin-left: 0px; + margin-right: 10px; + display: none; } - #main { background: #FFFFFF; padding: 3px; @@ -178,21 +181,26 @@ h4 { margin-bottom: .1em; } -ul.mainnav { +ul.primarynav li.primarynav-selected a { + background-color: white; + color: black; +} + +ul.primarynav { list-style : none; margin : 0; padding : 0; border: 0px; } -ul.mainnav li { +ul.primarynav li { display: block; float: left; border: 1px solid black; margin-right: 5px; } -ul.mainnav li a { +ul.primarynav li a { display : block; padding : 3px; background-color : #5C6F90; @@ -201,13 +209,48 @@ ul.mainnav li a { text-decoration : none; } -ul.mainnav li a:hover { +ul.primarynav li a:hover { display : block; background-color : #63616b; color : #eee; text-decoration: none; } +ul.secondarynav { + list-style : none; + margin : 0; + padding : 0; + border: 0px; +} + +ul.secondarynav li { + display: block; + float: left; + border: 1px solid black; + margin-right: 5px; +} + +ul.secondarynav li a { + display : block; + padding : 3px; + background-color : #5C6F90; + font-weight: bold; + color : #fff; + text-decoration : none; +} + +ul.secondarynav li a:hover { + display : block; + background-color : #63616b; + color : #eee; + text-decoration: none; +} + +ul.secondarynav li.secondarynav-selected a { + background-color: white; + color: black; +} + .aligncenter { width: 100%; text-align: center;