From 3f471bde41a66099af46a0773b2b8d21da63fe0e Mon Sep 17 00:00:00 2001 From: james Date: Fri, 15 Apr 2005 14:27:18 +0000 Subject: [PATCH] Add judge team captains, bump db version --- TODO | 3 - admin/judges_teams.php | 111 ++++++++++++++++++++++++++++++-- db/db.code.version.txt | 2 +- images/16/bookmark.gif | Bin 0 -> 553 bytes images/16/bookmark.png | Bin 0 -> 690 bytes images/16/bookmark_disabled.gif | Bin 0 -> 576 bytes images/16/bookmark_disabled.png | Bin 0 -> 416 bytes 7 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 images/16/bookmark.gif create mode 100644 images/16/bookmark.png create mode 100644 images/16/bookmark_disabled.gif create mode 100644 images/16/bookmark_disabled.png diff --git a/TODO b/TODO index d0ab2e05..13b7e0cf 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ - Make auto-logout on email address change work properly on the FIRST submit, not on first action after the submit - same for judges changing email address -- Judges CSV contain categories and sub-categories info -- Judge 'info' button on judge teams page to view allt he judge info -- diff --git a/admin/judges_teams.php b/admin/judges_teams.php index d81d774c..00e6ffa7 100644 --- a/admin/judges_teams.php +++ b/admin/judges_teams.php @@ -95,6 +95,7 @@ function switchjudgeinfo() $r=mysql_fetch_object($q); $team_id=$r->id; $team_name=$r->name; + $captain='no'; } else { @@ -102,14 +103,31 @@ function switchjudgeinfo() mysql_query("INSERT INTO judges_teams (num,name,year) VALUES ('".$_POST['team_num']."','".$_POST['new_team_name']."','".$config['FAIRYEAR']."')"); $team_id=mysql_insert_id(); $team_name=$_POST['new_team_name']; + $captain='yes'; } $added=0; foreach($_POST['judgelist'] AS $selectedjudge) { - mysql_query("INSERT INTO judges_teams_link (judges_id,judges_teams_id,year) VALUES ('$selectedjudge','$team_id','".$config['FAIRYEAR']."')"); - $added++; + //before we insert them, we need to make sure they dont already belong to this team. We can not have the same judge assigned to the same team multiple times. + + $q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_id='$selectedjudge' AND judges_teams_id='$team_id'"); + if(mysql_num_rows($q)) + { + echo notice(i18n("Judge (%1) already belongs to judging team: %2",array($selectedjudge,$team_name))); + + } + else + { + //lets make the first one we add a captain, the rest, non-captains :) + mysql_query("INSERT INTO judges_teams_link (judges_id,judges_teams_id,captain,year) VALUES ('$selectedjudge','$team_id','$captain','".$config['FAIRYEAR']."')"); + $added++; + } + //if this is alreayd no, then who cares, but if its the first one that is going into the new team, then + //captain will be yes, and we only want the first one assigned to a new team to be the captain + //sno now we can set this back to no + $captain='no'; } if($added==1) $j=i18n("judge"); @@ -147,6 +165,35 @@ function switchjudgeinfo() } + if($_GET['action']=="addcaptain") + { + + //teams can have as many captains as they want, so just add it. + mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='".$_GET['judge_id']."'"); + echo happy(i18n("Team captain assigned")); + } + + if($_GET['action']=="removecaptain") + { + //teams must always have at least one captain, so if we only have one, and we are trying to remove it, dont let them! + $q=mysql_query("SELECT * FROM judges_teams_link WHERE captain='yes' AND judges_teams_id='".$_GET['team_id']."'"); + if(mysql_num_rows($q)<2) + { + echo error(i18n("A judge team must always have at least one captain")); + } + else + { + mysql_query("UPDATE judges_teams_link SET captain='no' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='".$_GET['judge_id']."'"); + echo happy(i18n("Team captain removed")); + } + } + + if(!$_SESSION['viewstate']['judges_teams_list_show']) + $_SESSION['viewstate']['judges_teams_list_show']='unassigned'; + //now update the judges_teams_list_show viewstate + if($_GET['judges_teams_list_show']) + $_SESSION['viewstate']['judges_teams_list_show']=$_GET['judges_teams_list_show']; + echo "
"; echo ""; echo ""; @@ -162,6 +209,19 @@ function switchjudgeinfo() echo "".i18n("Judge Teams").""; echo ""; echo ""; + echo ""; + if($_SESSION['viewstate']['judges_teams_list_show']=='all') + { + echo ""; + echo ""; + } + else + { + echo ""; + echo ""; + + } + echo "
".i18n("show unassigned")."".i18n("show all")."".i18n("show unassigned")."".i18n("show all")."
"; /* @@ -184,7 +244,26 @@ function switchjudgeinfo() lastname, firstname"; */ - $querystr="SELECT + if($_SESSION['viewstate']['judges_teams_list_show']=='all') + { + $querystr="SELECT + judges.id, + judges.firstname, + judges.lastname + FROM + judges, + judges_years + WHERE + judges_years.year='".$config['FAIRYEAR']."' AND + judges.id=judges_years.judges_id AND + judges.complete='yes' + ORDER BY + lastname, + firstname"; + } + else + { + $querystr="SELECT judges.id, judges.firstname, judges.lastname, @@ -201,6 +280,7 @@ function switchjudgeinfo() ORDER BY lastname, firstname"; + } $q=mysql_query($querystr); @@ -222,7 +302,8 @@ function switchjudgeinfo() judges_teams.name, judges.id AS judges_id, judges.firstname, - judges.lastname + judges.lastname, + judges_teams_link.captain FROM judges, @@ -235,6 +316,7 @@ function switchjudgeinfo() ORDER BY name, num, + captain DESC, lastname, firstname"); @@ -252,7 +334,12 @@ function switchjudgeinfo() $lastteamid=$r->id; $lastteamnum=$r->num; } - $teams[$lastteamid]['members'][]=array("id"=>$r->judges_id,"firstname"=>$r->firstname,"lastname"=>$r->lastname); + $teams[$lastteamid]['members'][]=array( + "id"=>$r->judges_id, + "firstname"=>$r->firstname, + "lastname"=>$r->lastname, + "captain"=>$r->captain + ); } //echo nl2br(print_r($teams,true)); @@ -292,6 +379,20 @@ function switchjudgeinfo() echo ""; echo ""; echo ""; + if($member['captain']=="yes") + { + echo ""; + echo ""; + echo " "; + + } + else + { + echo ""; + echo ""; + echo " "; + + } echo ""; echo $member['firstname']." ".$member['lastname']; echo ""; diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 00750edc..b8626c4c 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -3 +4 diff --git a/images/16/bookmark.gif b/images/16/bookmark.gif new file mode 100644 index 0000000000000000000000000000000000000000..cb9a1c3ca84ef70733ec7d02e07e0e4cb210ad88 GIT binary patch literal 553 zcmZ?wbhEHb6kyzh6WCehzt5 z!1QUc?7x5Jucj+KX%hX{#qhg>;YTyW*B-Xd(?vf_68-(k@7MFthxMZOYDBN5uwBjO zJLbi3*p1i<5(|NHLy@4L~z?{2^Ec-|}%I^@FewU7DlBcp#$HU2%+{C!OG zd<^sZ4vt@k#Qt5A`*&X9^GcbEF-))Onf@IU{kLEIY9jN8b$0JNnE!3(`?rc(&&(!o$nU$KN3!C?qT*DmF)4LQ+av zMpjNo#RY6;-t+bq&n}2Q{^{bvktQ^iQ2KFf{5lHo0`k)U4Os!qU>}mbFc< st)0Dtqm#3}i)*KwyN9Qjw~w!%e`i2oP)l$~XlK~Zj&%u=A{-3X0IInw2LJ#7 literal 0 HcmV?d00001 diff --git a/images/16/bookmark.png b/images/16/bookmark.png new file mode 100644 index 0000000000000000000000000000000000000000..5e761587198608815a4625f26923e4c2c59d5ed1 GIT binary patch literal 690 zcmV;j0!{siP)5r00004XF*Lt006JZ zHwB960000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!L`g(JRCwBA zV88=DRWZzeU(PTepBjJwV#Fo!p^`y>iJ$%c@81jzzux>*l$^-$0h>C20Aj*r!2kaY z1+2RA0&IF(0)PK76yQ<^5I{H$U|?g4XLHbF;Br!C_{Yi=k4qUq0AV%YZ5cxXv#PWL zBj;lVM()Q99O?=RPntv<{{7o6fUXuGfEfREG0gw_k3r!t(64_v*&P0H^D}_h+!2-x z%pxzrivGNmV|YH}0K?zE3=H32d}Lr?=lJmP{-+B-uRQ<=AjZF)4D*8l(j07*qoM6N<$f~cq`1poj5 literal 0 HcmV?d00001 diff --git a/images/16/bookmark_disabled.gif b/images/16/bookmark_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..b3b2cbcc016a13b3e948f68f74be1d6b7579d23d GIT binary patch literal 576 zcmZ?wbhEHb6kyDk%Y`T6;Ug@q+0C8edM<>lp-m6cUhRn^tiH8nL24GoQrjZIBWEiEl=ZEfxC?HwH* zot>S%y}f;Xef|CY6DLlbG-=Z0$&;r}ojPsWv>7vI%$zxM)~s1`=FFKpckaA-^XAW= zzhJ?Fg$oxhTC`~K;>AmrELpZ}*_t(L)~{c`VZ(;4Teoi8wr%_N?K^ht*tv7(u3fwK z@85smz=6Yu4<9{x^wg(_7GxN-OH-Fx@$J%0T7$&)8fpFVx|?AePK zFTQ{O{(n#c#ebsCMX8A;sVNHOnI#ztAsML(?w-B@42nNl7`Yhg8FWBV1d1#M_LheF zrsjGjg_e#EP1Vj`1#3&G-VSANFX_oGCO$rfDjhmn>e@zn?sMGQ#3XpQv@JZny*;*U z-Q+CC(WK+zx^KU$vx8uVhMm)i6OLv_I+g4%T(A}HHCMN>vA$s?(W|FrW~^mkY9`Cx isivzg&c`dFqsr1LDRs7qONg~o_Hyp1T{(=Ai0WnELK~#9! zb&x$z!f+6WpF$CosQ-b9#8`}plLST=>FBD7uE00I(M=LpL1J|9tsNa5SX@nXW_2*W z6A}q6CQ!94b%0q@l1y>z;$D@`@ELG9{D#n z80)8(0P?UWAuKGwLjnfG7?^=GKXNjC+Pu=D#}`o?b@ZEI=&O^oXkj!QW;2US?ig=v8Fs