If there are no jdiv's left, hide the multi-select box and all the "Add >>" buttons so the page looks much nicer (and better to print!)

This commit is contained in:
james 2008-03-20 20:59:56 +00:00
parent 560d799b4b
commit c0026c75e5

View File

@ -211,38 +211,42 @@ function get_all_divs()
} }
} }
reset($dkeys);
$showdivlist=false;
foreach($dkeys as $id) {
if($cdl[$id]['jdiv'] == 0){ $showdivlist=true; break; }
}
echo "<form name=\"jdivs\" method=\"post\" action=\"judges_jdiv.php\">"; echo "<form name=\"jdivs\" method=\"post\" action=\"judges_jdiv.php\">";
echo "<input type=\"hidden\" name=\"action\">"; echo "<input type=\"hidden\" name=\"action\">";
echo "<input type=\"hidden\" name=\"jdivs\" value=\"$jdivs\">"; echo "<input type=\"hidden\" name=\"jdivs\" value=\"$jdivs\">";
echo "<input type=\"hidden\" name=\"jdiv_id\">"; echo "<input type=\"hidden\" name=\"jdiv_id\">";
echo "<input type=\"hidden\" name=\"judges_id\">"; echo "<input type=\"hidden\" name=\"judges_id\">";
echo "<table width=100%>"; echo "<table width=\"100%\">";
echo "<tr>"; echo "<tr>";
echo "<th width=25% >".i18n("Division List");
echo "<br />"; if($showdivlist) {
echo "</th>"; echo "<th width=\"25%\">".i18n("Division List");
echo "<br />";
echo "</th>";
}
echo "<th>".i18n("Judging Division Groups")."</th>"; echo "<th>".i18n("Judging Division Groups")."</th>";
echo "</tr>"; echo "</tr>";
echo "<tr><td valign=\"top\">"; echo "<tr>";
// echo "<table width=\"100%\"><tr>";
// echo "</tr></table>";
if($showdivlist) {
echo "<td valign=\"top\">";
echo "<select name=\"cdllist[]\" multiple=\"multiple\" style=\"width: 300px; height: 600px;\">"; echo "<select name=\"cdllist[]\" multiple=\"multiple\" style=\"width: 300px; height: 600px;\">";
/* Print the list of all unassigned divs */
reset($dkeys);
/* Print the list of all unassigned divs */ foreach($dkeys as $id) {
reset($dkeys); if($cdl[$id]['jdiv'] != 0) continue;
foreach($dkeys as $id) { echo "<option value=\"$id\">{$cdl[$id]['name']}</option>\n";
if($cdl[$id]['jdiv'] != 0) continue; }
echo "<option value=\"$id\">{$cdl[$id]['name']}</option>\n"; echo "</select>";
echo "</td>";
} }
echo "</select>";
echo "</td>";
echo "<td valign=\"top\">"; echo "<td valign=\"top\">";
/* Print he groupings of the assigned ones */ /* Print he groupings of the assigned ones */
@ -251,7 +255,9 @@ function get_all_divs()
echo "<table width=\"100%\">"; echo "<table width=\"100%\">";
echo "<tr><td valign=top width=\"80\">"; echo "<tr><td valign=top width=\"80\">";
echo "<input onclick=\"addbuttonclicked('$jdiv')\" type=\"button\" value=\"Add &gt;&gt;\"><br />"; if($showdivlist) {
echo "<input onclick=\"addbuttonclicked('$jdiv')\" type=\"button\" value=\"Add &gt;&gt;\"><br />";
}
echo "<br />"; echo "<br />";
echo "<a onclick=\"return confirmClick('Are you sure you want to empty all the divisions from this grouping?')\" href=\"judges_jdiv.php?action=empty&jdiv_id=$jdiv \">"; echo "<a onclick=\"return confirmClick('Are you sure you want to empty all the divisions from this grouping?')\" href=\"judges_jdiv.php?action=empty&jdiv_id=$jdiv \">";
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">"; echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
@ -268,7 +274,7 @@ function get_all_divs()
$p += $cdl[$id]['projects']; $p += $cdl[$id]['projects'];
} }
echo "<table class=\"tableedit\">\n"; echo "<table class=\"tableedit\" width=\"95%\">\n";
echo "<tr><th colspan=\"2\" align=\"left\">Judging Division $jdiv ($p project".($p==1?'':'s').")"; echo "<tr><th colspan=\"2\" align=\"left\">Judging Division $jdiv ($p project".($p==1?'':'s').")";
echo "</th></tr>\n"; echo "</th></tr>\n";