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 00000000..cb9a1c3c Binary files /dev/null and b/images/16/bookmark.gif differ diff --git a/images/16/bookmark.png b/images/16/bookmark.png new file mode 100644 index 00000000..5e761587 Binary files /dev/null and b/images/16/bookmark.png differ diff --git a/images/16/bookmark_disabled.gif b/images/16/bookmark_disabled.gif new file mode 100644 index 00000000..b3b2cbcc Binary files /dev/null and b/images/16/bookmark_disabled.gif differ diff --git a/images/16/bookmark_disabled.png b/images/16/bookmark_disabled.png new file mode 100644 index 00000000..fc5a9aed Binary files /dev/null and b/images/16/bookmark_disabled.png differ