Get rid of the old (not used anymore) taskNav function

Add some missing <tbody> tags so the tablesorter doesnt choke (every table with class=tableview MUST have a <tbody> element, even if there are no <tr>'s inside the body
This commit is contained in:
james 2010-07-21 20:14:05 +00:00
parent b4f206c6db
commit 71074eaf24
5 changed files with 58 additions and 71 deletions

View File

@ -309,7 +309,7 @@ $(document).ready(function() {
<br />
<table width="100%">
<table>
<tr><td>
<?=i18n("Choose Status")?>:
<form name="statuschangerform" method="get" action="registration_list.php">

View File

@ -183,6 +183,7 @@ else $wherestatus="";
}
echo "<th>".i18n("Total")."<br /><nobr>".i18n("Stud | Proj")."</th>";
echo "</tr></thead>";
echo "<tbody>";
foreach($divs AS $d=>$dn) {
echo "<tr><td>$dn</td>";
$tstud=0;
@ -225,7 +226,7 @@ else $wherestatus="";
echo ($tproj);
echo "</b></td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
echo "</td></tr>";
@ -239,10 +240,10 @@ else $wherestatus="";
}
echo "<th>".i18n("Total")."<br /><nobr>".i18n("Stud | Proj")."</nobr></th>";
echo "</tr></thead>";
echo "<tbody>";
asort($schools_names);
foreach($schools_names AS $id=>$sn)
{
foreach($schools_names AS $id=>$sn) {
echo "<tr><td>$sn</td>";
$tstud=0;
$tproj=0;
@ -258,6 +259,7 @@ else $wherestatus="";
echo ($tproj?$tproj:0)."</b></td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo i18n("%1 schools total",array(count($schools_names)));
@ -266,7 +268,7 @@ else $wherestatus="";
echo "<tr><td colspan=\"2\"><h3>{$status_str[$showstatus]} - ".i18n("Projects per age category / division / language")."</h3></td></tr>";
echo "<tr><td colspan=\"2\">";
echo "<table class=\"tableview\" width=\"100%\">";
echo "<thead><tr><td rowspan='2' width=\"50%\"></td>";
echo "<thead><tr><th rowspan='2' width=\"50%\"></th>";
foreach($cats AS $c=>$cn) {
echo "<th colspan='".count($languages)."'>$cn</th>";
}
@ -283,11 +285,11 @@ else $wherestatus="";
echo "<th>$l</th>";
}
echo "</tr></thead>";
echo "<tbody>";
foreach($divs AS $d=>$dn) {
echo "<tr><td>$dn</td>";
$tproj=array();
foreach($cats AS $c=>$cn)
{
foreach($cats AS $c=>$cn) {
foreach($languages AS $l=>$ln) {
echo "<td align=\"center\">";
echo ($stats_projects_lang[$c][$d][$l]?$stats_projects_lang[$c][$d][$l]:0);
@ -321,7 +323,7 @@ else $wherestatus="";
}
echo "</tr>";
echo "</tbody>";
echo "</table>";
echo "</td></tr>";

View File

@ -102,6 +102,7 @@
echo " <th>".i18n("Last")."</th>";
echo " <th>".i18n("Photo")."</th>";
echo "</tr></thead>";
echo "<tbody>";
while($r=mysql_fetch_object($sq))
{
echo "<tr>";
@ -115,6 +116,7 @@
echo "<td><input $ch type=\"checkbox\" name=\"webphoto[$r->id]\" value=\"yes\" onchange=\"changed($r->id)\"></td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Changes")."\">";
echo "</form>";

View File

@ -62,35 +62,11 @@ $(document).ready(function(){
});
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, collapsible: true, active: false}); //"option", "collapsible", true);
$("#tertiarymenu_accordion").accordion("activate",false);
$("#tertiarymenu").show();
});
break;
}
return false;
}
function taskNavLevel(l1,l2,l3,l4) {
if(l2) {
$("#secondarymenu").load("<?=$config['SFIABDIRECTORY']?>/nav.php?level=1&id="+l1);
//we have a secondary click, which implies we also have a primary nav selected
//we may or may not have l3 or l4 though, so they are handled separately below
$("#secondarymenu").load("<?=$config['SFIABDIRECTORY']?>/nav.php?level=1&id="+l1,null,function() {
$("#secondarymenu").show();
$("#tertiarymenu_accordion").accordion("destroy");
@ -104,14 +80,26 @@ function taskNavLevel(l1,l2,l3,l4) {
$(".secondarynav-selected").removeClass("secondarynav-selected");
$("#secondary_nav_"+l2).addClass("secondarynav-selected");
//if we have a 3rd level nav, open up the accordion to the appropriate place
if(l3) {
$("#tertiarymenu_accordion").accordion("activate",$("#tertiary_nav_"+l3));
}
//if we have a 4th level nav, set the selected class on the appropriate item in the list
if(l4) {
$(".tertiarylinknav-selected").removeClass("tertiarylinknav-selected");
$("#tertiarylink_nav_"+l4).addClass("tertiarylinknav-selected");
}
});
});
}
else {
//only the primary link clicked, so show the secondary, and thats it.
$("#secondarymenu").load("<?=$config['SFIABDIRECTORY']?>/nav.php?level=1&id="+l1,null,function() {
//show the secondary
$("#secondarymenu").show();
//and hide the tertiary
$("#tertiarymenu").hide();
});
}
}
@ -304,7 +292,7 @@ if(is_array($_SESSION['roles'])) {
$cl="class=\"selected\"";
}
echo "<li id=\"primary_nav_{$r->id}\" $cl>";
echo "<a href=\"#\" onclick=\"return taskNav($r->id,$r->pid,$r->level)\">".i18n($r->task)."</a>";
echo "<a href=\"#\" onclick=\"return taskNavLevel($r->id,0,0,0)\">".i18n($r->task)."</a>";
echo "</li>\n";
}
}
@ -352,27 +340,27 @@ if(array_key_exists('users_id', $_SESSION)) {
//take SFIABDIRECTORY off of the current URL
$pageurl=substr($_SERVER['PHP_SELF'],strlen($config['SFIABDIRECTORY']));
echo "looking up [$pageurl] <br />";
$q=mysql_query("SELECT * FROM rolestasks WHERE link='".mysql_real_escape_string($pageurl)."'");
if($r=mysql_fetch_object($q)) {
//okay we found it, now what do we do?
//FIXME: we need to populate the secondarynva, tertiarynav, and select the right thing in the accordion,
//because we cannot assume that the user navigated to this page via the pri/sec/ter nav menus
//okay we found it, now get its full tree above it
$navTree=array();
upTree($r->id,&$navTree);
//set things to 0 to start
$_SESSION['nav']['primary']=0;
$_SESSION['nav']['secondary']=0;
$_SESSION['nav']['tertiary']=0;
$_SESSION['nav']['tertiarylink']=0;
//go through each one, and set the SESSION vars
foreach($navTree AS $t) {
switch($t['level']) {
case 0: //primary nav
$_SESSION['nav']['primary']=$t['id'];
// echo "$(\"#primary_nav_".$t['id']."\").addClass('primarynav-selected');";
break;
case 1: //secondary nav
$_SESSION['nav']['secondary']=$t['id'];
// echo "$(\"#secondary_nav_".$t['id']."\").addClass('secondarynav-selected');";
break;
case 2: //tertiary nav heading
$_SESSION['nav']['tertiary']=$t['id'];
@ -382,18 +370,16 @@ if($r=mysql_fetch_object($q)) {
break;
}
}
echo "<script type=\"text/javascript\">";
echo " $(document).ready(function() {\n";
echo "taskNavLevel({$_SESSION['nav']['primary']},
{$_SESSION['nav']['secondary']},
{$_SESSION['nav']['tertiary']},
{$_SESSION['nav']['tertiarylink']}
);";
echo "\n\n<script type=\"text/javascript\">";
//and once the page is ready, call the taskNavLevel function to fill everything out and select what needs to be selected
echo "$(document).ready(function(){\n";
$str = "taskNavLevel({$_SESSION['nav']['primary']}, {$_SESSION['nav']['secondary']}, {$_SESSION['nav']['tertiary']}, {$_SESSION['nav']['tertiarylink']});";
echo $str;
echo " });";
echo "</script>\n";
}
else {
}
/*
if(is_array($nav)) {
@ -476,7 +462,6 @@ echo "<a target=\"blank\" href=\"http://www.sfiab.ca\">SFIAB Version ".$config['
</div>
<div id="debug" style="display:<?=($_SESSION['debug']=='true')?'block':'none'?>; font-family:monospace; white-space:pre; " >Debug...</div>
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
</body>
</html>

View File

@ -43,10 +43,8 @@
}
else $cl="";
echo "<li id=\"secondary_nav_{$r->id}\" $cl>";
echo "<a href=\"#\" onclick=\"return taskNav($r->id,$r->pid,$r->level)\">".i18n($r->task)."</a>";
if($_SESSION['debug']) {
//echo "<a href=\"#\" onclick=\"return taskNavLevel($r->pid, $r->id)\">(*)</a>";
}
//echo "<a href=\"#\" onclick=\"return taskNavLevel($r->id,$r->pid,$r->level)\">".i18n($r->task)."</a>";
echo "<a href=\"#\" onclick=\"return taskNavLevel($r->pid, $r->id)\">".i18n($r->task)."</a>";
echo "</li>\n";
}
echo "</ul>\n";