diff --git a/admin/judges_teams.php b/admin/judges_teams.php index 8714bae..4c5964f 100644 --- a/admin/judges_teams.php +++ b/admin/judges_teams.php @@ -34,11 +34,12 @@ function addbuttonclicked(team) document.forms.judges.team_num.value=team; document.forms.judges.submit(); } -function delbuttonclicked(team_id,team_num,judge) +function delbuttonclicked(team_id,team_num,team_name,judge) { document.forms.judges.action.value="del"; document.forms.judges.team_id.value=team_id; document.forms.judges.team_num.value=team_num; + document.forms.judges.team_name.value=team_name; document.forms.judges.judges_id.value=judge; document.forms.judges.submit(); } @@ -58,17 +59,19 @@ function saveteamnamesbuttonclicked() if($_POST['action']=="add" && $_POST['team_num'] && count($_POST['judgelist'])>0) { //first check if this team exists. - $q=mysql_query("SELECT id FROM judges_teams WHERE num='".$_POST['team_num']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT id,name FROM judges_teams WHERE num='".$_POST['team_num']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { $r=mysql_fetch_object($q); $team_id=$r->id; + $team_name=$r->name; } else { - echo notice(i18n("Creating new team #%1 with name '%2'",array($_POST['team_num'],$_POST['team_name']))); - mysql_query("INSERT INTO judges_teams (num,name,year) VALUES ('".$_POST['team_num']."','".$_POST['team_name']."','".$config['FAIRYEAR']."')"); + echo notice(i18n("Creating new team #%1 with name '%2'",array($_POST['team_num'],$_POST['new_team_name']))); + 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']; } $added=0; @@ -82,19 +85,19 @@ function saveteamnamesbuttonclicked() if($added==1) $j=i18n("judge"); else $j=i18n("judges"); - echo happy(i18n("%1 %2 added to team #%3 (%4)",array($added,$j,$_POST['team_num'],$_POST['team_name']))); + echo happy(i18n("%1 %2 added to team #%3 (%4)",array($added,$j,$_POST['team_num'],$team_name))); } if($_POST['action']=="del" && $_POST['team_num'] && $_POST['team_id'] && $_POST['judges_id']) { mysql_query("DELETE FROM judges_teams_link WHERE judges_id='".$_POST['judges_id']."' AND judges_teams_id='".$_POST['team_id']."' AND year='".$config['FAIRYEAR']."'"); - echo happy(i18n("Removed judge from team #%1",array($_POST['team_num']))); + echo happy(i18n("Removed judge from team #%1 (%2)",array($_POST['team_num'],$_POST['team_name']))); $q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_POST['team_id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)==0) { mysql_query("DELETE FROM judges_teams WHERE year='".$config['FAIRYEAR']."' AND id='".$_POST['team_id']."'"); - echo notice(i18n("Removed empty team #%1",array($_POST['team_num']))); + echo notice(i18n("Removed empty team #%1 (%2)",array($_POST['team_num'],$_POST['team_name']))); } @@ -103,9 +106,9 @@ function saveteamnamesbuttonclicked() if($_POST['action']=="saveteamnames") { - if(count($_POST['teamname'])) + if(count($_POST['team_names'])) { - foreach($_POST['teamname'] AS $team_id=>$team_name) + foreach($_POST['team_names'] AS $team_id=>$team_name) { mysql_query("UPDATE judges_teams SET name='".mysql_escape_string(stripslashes($team_name))."' WHERE id='$team_id'"); } @@ -118,6 +121,7 @@ function saveteamnamesbuttonclicked() echo ""; echo ""; echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -229,7 +233,7 @@ function saveteamnamesbuttonclicked() echo "
"; echo ""; - echo ""; + echo ""; echo "
New #$newteamid:
New #$newteamid:
"; echo "
"; @@ -245,15 +249,15 @@ function saveteamnamesbuttonclicked() echo ""; echo ""; - echo ""; + echo "
\n"; echo ""; + echo ""; + echo "\n"; foreach($team['members'] AS $member) { echo "";
#".$team['num'].": "; - echo ""; - echo "
"; - echo ""; + echo ""; echo ""; echo $member['firstname']." ".$member['lastname']; echo "