forked from science-ation/science-ation
Start un-breaking all the broken UI navigation
This commit is contained in:
parent
45e1e79072
commit
d5912ac1e8
104
common.inc.php
104
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("<?=$config['SFIABDIRECTORY']?>/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("<?=$config['SFIABDIRECTORY']?>/nav.php?level=2&id="+id,null,function() {
|
||||
$("#tertiarymenu_accordion").accordion({clearStyle: true}); //"option", "collapsible", true);
|
||||
});
|
||||
$("#tertiarymenu").show();
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
//if we're under /admin or /config we also want the translation editor
|
||||
@ -529,18 +556,9 @@ if(!$_SESSION['conferences_id']) {
|
||||
</div>
|
||||
<div id="header_login">
|
||||
<?
|
||||
if(isset($_SESSION['users_type'])) {
|
||||
$types = array('volunteer' => 'Volunteer', 'judge' => 'Judge',
|
||||
'student'=>'Participant','committee'=>'Committee Member',
|
||||
'fair'=>'Science Fair');
|
||||
if($_SESSION['users_type'] != false) {
|
||||
echo i18n($types[$_SESSION['users_type']])."<br />";
|
||||
}
|
||||
echo " {$_SESSION['email']} <br />";
|
||||
if($_SESSION['multirole'] == true) {
|
||||
echo "<a href=\"{$config['SFIABDIRECTORY']}/user_multirole.php\">[".i18n('Switch Roles')."]</a> ";
|
||||
}
|
||||
echo "<a href=\"{$config['SFIABDIRECTORY']}/user_login.php?action=logout\">[".i18n("Logout")."]</a>";
|
||||
if(isset($_SESSION['roles']) && $_SESSION['username']) {
|
||||
echo i18n("Logged in as %1",array($_SESSION['username']))."<br />";
|
||||
echo "<a href=\"{$config['SFIABDIRECTORY']}/user_login.php?action=logout\">".i18n("Logout")."</a>";
|
||||
|
||||
} 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 "<ul class=\"mainnav\">\n";
|
||||
echo "<ul class=\"primarynav\">\n";
|
||||
echo "<li><h4 style=\"text-align: center;\">".i18n("Fundraising")."</h4></li>\n";
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/fundraising.php\">".i18n("Fundraising Dashboard").'</a></li>';
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/fundraising_setup.php\">".i18n("Fundraising Setup").'</a></li>';
|
||||
@ -594,7 +612,7 @@ if(is_array($nav)) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
<ul class="mainnav">
|
||||
<ul class="primarynav">
|
||||
<?
|
||||
if ($config['website']) {
|
||||
if ($config['website_name']) {
|
||||
@ -634,9 +652,26 @@ if(is_array($nav)) {
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/winners.php\">".i18n("Winners").'</a></li>';
|
||||
}
|
||||
|
||||
if(is_array($_SESSION['roles'])) {
|
||||
foreach($_SESSION['roles'] AS $roletype) {
|
||||
$roleid=$roles[$roletype]['id'];
|
||||
$q=mysql_query("SELECT * FROM rolestasks WHERE roles_id='$roleid' AND pid=0 ORDER BY task");
|
||||
if(mysql_num_rows($q)==1) {
|
||||
$setPrimaryNav=true;
|
||||
}
|
||||
$cl="";
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
if($setPrimarynav) {
|
||||
$_SESSION['nav']['primary']=$r->id;
|
||||
$cl="class=\"selected\"";
|
||||
}
|
||||
echo "<li id=\"primary_nav_{$r->id}\" $cl><a href=\"#\" onclick=\"return taskNav($r->id,$r->pid,$r->level)\">".i18n($r->task)."</a></li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?
|
||||
|
||||
if(array_key_exists('users_id', $_SESSION)) {
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_main.php\">".i18n("Main Page").'</a></li>';
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_personal.php\">".i18n("My Profile").'</a></li>';
|
||||
@ -644,10 +679,10 @@ if(array_key_exists('users_id', $_SESSION)) {
|
||||
// echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committee_main.php\">".i18n("Committee Home").'</a></li>';
|
||||
}
|
||||
if(in_array('admin', $_SESSION['roles'])) {
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/\">".i18n("Administration").'</a></li>';
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/\">".i18n("Administration").' (old) </a></li>';
|
||||
}
|
||||
if(in_array('config', $_SESSION['roles'])) {
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/config/\">".i18n("Configuration").'</a></li>';
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/config/\">".i18n("Configuration").' (old) </a></li>';
|
||||
}
|
||||
if($_SESSION['superuser'] == 'yes') {
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/super/\">".i18n("System Setup").'</a></li>';
|
||||
@ -667,23 +702,36 @@ if(array_key_exists('users_id', $_SESSION)) {
|
||||
if(in_array('student', $_SESSION['roles'])) {
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/register_participants_main.php\">".i18n("Participant Home").'</a></li>';
|
||||
}
|
||||
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_login.php?action=logout\">".i18n("Logout").'</a></li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?
|
||||
if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config" || substr(getcwd(),-6)=="/super") {
|
||||
?>
|
||||
<div id="secondarymenu">
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
/*
|
||||
<div id="left">
|
||||
<div id="secondarymenu">
|
||||
</div>
|
||||
*/
|
||||
<div id="tertiarymenu">
|
||||
<div id="tertiarymenu_accordion">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?
|
||||
if($_SESSION['nav']['primary']) {
|
||||
echo "<script type=\"text/javascript\">";
|
||||
echo " $(document).ready(function() {\n";
|
||||
echo "taskNav({$_SESSION['nav']['primary']},0,0);";
|
||||
echo " });";
|
||||
echo "</script>\n";
|
||||
}
|
||||
|
||||
if($_SESSION['nav']['secondary']) {
|
||||
echo "<script type=\"text/javascript\">";
|
||||
echo " $(document).ready(function() {\n";
|
||||
echo "taskNav({$_SESSION['nav']['secondary']},{$_SESSION['nav']['primary']},1);";
|
||||
echo " });";
|
||||
echo "</script>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?
|
||||
/*
|
||||
if(is_array($nav)) {
|
||||
|
@ -1 +1 @@
|
||||
200
|
||||
201
|
||||
|
43
db/db.update.201.sql
Normal file
43
db/db.update.201.sql
Normal file
@ -0,0 +1,43 @@
|
||||
CREATE TABLE `rolestasks` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pid` int(11) NOT NULL,
|
||||
`roles_id` int(11) NOT NULL,
|
||||
`level` int(11) NOT NULL,
|
||||
`task` varchar(64) NOT NULL,
|
||||
`ord` int(11) NOT NULL,
|
||||
`link` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
|
||||
|
||||
INSERT INTO `rolestasks` (`id`, `pid`, `roles_id`, `level`, `task`, `ord`, `link`) VALUES
|
||||
(1, 0, 13, 0, 'Configuration', 0, '/config/index.php'),
|
||||
(2, 0, 12, 0, 'Administration', 0, '/admin/index.php'),
|
||||
(3, 2, 12, 1, 'General Tasks', 2, ''),
|
||||
(4, 2, 12, 1, 'People Tasks', 1, ''),
|
||||
(5, 2, 12, 1, 'Event Preparation', 3, ''),
|
||||
(6, 2, 12, 1, 'Event Wrap-Up', 4, ''),
|
||||
(7, 5, 12, 2, 'Awards Management', 0, ''),
|
||||
(8, 5, 12, 2, 'Schools Management', 0, ''),
|
||||
(9, 5, 12, 2, 'Tour Management', 0, ''),
|
||||
(10, 5, 12, 2, 'Report Management', 0, ''),
|
||||
(11, 7, 12, 3, 'Awards Editor', 0, '/admin/award_awards.php'),
|
||||
(12, 7, 12, 3, 'Sponsors', 0, '/admin/sponsors.php'),
|
||||
(13, 4, 12, 2, 'Participant Registration', 0, ''),
|
||||
(14, 13, 12, 3, 'Input Received Signature Forms ', 0, '/admin/registration_receivedforms.php'),
|
||||
(15, 13, 12, 3, 'Registration List and Student/Project Editor', 0, '/admin/registration_list.php'),
|
||||
(16, 13, 12, 3, 'Registration Statistics', 0, '/admin/registration_stats.php'),
|
||||
(17, 13, 12, 3, 'Website Consent', 0, '/admin/registration_webconsent.php'),
|
||||
(18, 4, 12, 2, 'Committee Management', 2, ''),
|
||||
(19, 4, 12, 2, 'Judging Management', 3, ''),
|
||||
(20, 4, 12, 2, 'Tour Management', 4, ''),
|
||||
(21, 18, 12, 3, 'Committee Management', 0, '/admin/committees.php'),
|
||||
(22, 19, 12, 3, 'Invite Judges', 0, '/admin/user_invite.php?type=judge'),
|
||||
(23, 19, 12, 3, 'Manage Judges', 2, '/admin/user_list.php?show_types[]=judge'),
|
||||
(24, 19, 12, 3, 'Create/Edit Judging Timeslots', 3, '/admin/judges_timeslots.php'),
|
||||
(25, 19, 12, 3, 'Create/Edit Divisional Judging Groupings', 4, '/admin/judges_jdiv.php'),
|
||||
(26, 19, 12, 3, 'Run the Automatic Judging Scheduler', 5, '/admin/judges_schedulerconfig.php'),
|
||||
(27, 19, 12, 3, 'Manage Judging Teams', 6, '/admin/judges_teams.php'),
|
||||
(28, 19, 12, 3, 'Manage Judging Team Members', 7, '/admin/judges_teams_members.php'),
|
||||
(29, 19, 12, 3, 'Manage Judging Team Timeslot Assignments', 8, '/admin/judges_teams_timeslots.php'),
|
||||
(30, 19, 12, 3, 'Manage Judging Team Project Assignments', 9, '/admin/judges_teams_projects.php');
|
||||
|
63
nav.php
Normal file
63
nav.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2010 James Grant <james@lightbox.org>
|
||||
|
||||
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.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
include "common.inc.php";
|
||||
$id=intval($_GET['id']);
|
||||
$level=intval($_GET['level']);
|
||||
|
||||
if($id && $level) {
|
||||
switch($level) {
|
||||
case 1: //populate the scecondary menu
|
||||
$_SESSION['nav']['primary']=$id;
|
||||
unset($_SESSION['nav']['secondary']);
|
||||
$q=mysql_query("SELECT * FROM rolestasks WHERE pid='$id' AND level=1 ORDER By ord,task");
|
||||
echo "<ul class=\"secondarynav\">";
|
||||
$cl="";
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
if($_SESSION['nav']['secondary'] == $r->id) {
|
||||
$cl="class=\"secondarynav-selected\"";
|
||||
}
|
||||
else $cl="";
|
||||
echo "<li id=\"secondary_nav_{$r->id}\" $cl><a href=\"#\" onclick=\"return taskNav($r->id,$r->pid,$r->level)\">".i18n($r->task)."</a></li>\n";
|
||||
}
|
||||
echo "</ul>\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 "<h3><a href=\"{$config['SFIABDIRECTORY']}$r->link\">".i18n("$r->task")."</a></h3>\n";
|
||||
echo "<ul>";
|
||||
$q2=mysql_query("SELECT * FROM rolestasks WHERE pid='$r->id' AND level=3 ORDER BY ord,task");
|
||||
while($r2=mysql_fetch_object($q2)) {
|
||||
echo "<li><a href=\"".$config['SFIABDIRECTORY']."$r2->link\">".i18n($r2->task)."</a></li>\n";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user