forked from science-ation/science-ation
show error if team is empty
add ability to empty entire teams switch 'delete' button from a form button to the standard cancel icon (saves vert space)
This commit is contained in:
parent
a947ff8e85
commit
b3cad6ebd3
@ -35,15 +35,6 @@ function addbuttonclicked(team)
|
|||||||
document.forms.judges.team_num.value=team;
|
document.forms.judges.team_num.value=team;
|
||||||
document.forms.judges.submit();
|
document.forms.judges.submit();
|
||||||
}
|
}
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
function openjudgeinfo(id)
|
function openjudgeinfo(id)
|
||||||
{
|
{
|
||||||
@ -128,13 +119,13 @@ function switchjudgeinfo()
|
|||||||
echo happy(i18n("%1 %2 added to team #%3 (%4)",array($added,$j,$_POST['team_num'],$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'])
|
if($_GET['action']=="del" && $_GET['team_num'] && $_GET['team_id'] && $_GET['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']."'");
|
mysql_query("DELETE FROM judges_teams_link WHERE judges_id='".$_GET['judges_id']."' AND judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
echo happy(i18n("Removed judge from team #%1 (%2)",array($_POST['team_num'],$_POST['team_name'])));
|
echo happy(i18n("Removed judge from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name'])));
|
||||||
|
|
||||||
//if there is still members left in the team, make sure we have a captain still
|
//if there is still members left in the team, make sure we have a captain still
|
||||||
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_POST['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
if(mysql_num_rows($q))
|
if(mysql_num_rows($q))
|
||||||
{
|
{
|
||||||
//make sure the team still has a captain!
|
//make sure the team still has a captain!
|
||||||
@ -158,12 +149,18 @@ function switchjudgeinfo()
|
|||||||
if(!$gotcaptain)
|
if(!$gotcaptain)
|
||||||
{
|
{
|
||||||
//make the first judge the captain
|
//make the first judge the captain
|
||||||
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_POST['team_id']."' AND judges_id='$firstjudge' AND year='".$config['FAIRYEAR']."'");
|
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='$firstjudge' AND year='".$config['FAIRYEAR']."'");
|
||||||
echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned"));
|
echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_GET['action']=="empty" && $_GET['team_num'] && $_GET['team_id'])
|
||||||
|
{
|
||||||
|
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
|
echo happy(i18n("Emptied all judges from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name'])));
|
||||||
|
}
|
||||||
|
|
||||||
if($_POST['action']=="saveteamnames")
|
if($_POST['action']=="saveteamnames")
|
||||||
{
|
{
|
||||||
if(count($_POST['team_names']))
|
if(count($_POST['team_names']))
|
||||||
@ -325,31 +322,46 @@ function switchjudgeinfo()
|
|||||||
echo $team['name'];
|
echo $team['name'];
|
||||||
echo "</th></tr>\n";
|
echo "</th></tr>\n";
|
||||||
|
|
||||||
foreach($team['members'] AS $member)
|
if(count($team['members']))
|
||||||
{
|
{
|
||||||
echo "<tr><td>";
|
foreach($team['members'] AS $member)
|
||||||
// echo "<a onclick=\"return confirmClick('Are you sure you want to remove this judge from this team?')\" href=\"judges_teams.php?action=unassign&unassign=".$award['id']."&edit=".$team['id']."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
|
||||||
echo "<input onclick=\"delbuttonclicked('".$team['id']."','".$team['num']."','".htmlspecialchars($team['name'])."','".$member['id']."')\" type=\"button\" value=\"<<\">";
|
|
||||||
echo "</td><td width=\"100%\">";
|
|
||||||
if($member['captain']=="yes")
|
|
||||||
{
|
{
|
||||||
echo "<a title=\"Captain - Click to remove captain status\" href=\"judges_teams_members.php?action=removecaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
|
echo "<tr><td>";
|
||||||
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark.".$config['icon_extension']."\">";
|
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this judge from this team?')\" href=\"judges_teams_members.php?action=del&team_id=".$team['id']."&team_num=".$team['num']."&team_name=".htmlspecialchars($team['name'])."&judges_id=".$member['id']."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||||
echo "</a> ";
|
echo "</td><td width=\"100%\">";
|
||||||
|
if($member['captain']=="yes")
|
||||||
|
{
|
||||||
|
echo "<a title=\"Captain - Click to remove captain status\" href=\"judges_teams_members.php?action=removecaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
|
||||||
|
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark.".$config['icon_extension']."\">";
|
||||||
|
echo "</a> ";
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<a title=\"Non-Captain - Click to make a team captain\" href=\"judges_teams_members.php?action=addcaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
|
echo "<a title=\"Non-Captain - Click to make a team captain\" href=\"judges_teams_members.php?action=addcaptain&team_id=".$team['id']."&judge_id=".$member['id']."\">";
|
||||||
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark_disabled.".$config['icon_extension']."\">";
|
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/bookmark_disabled.".$config['icon_extension']."\">";
|
||||||
echo "</a> ";
|
echo "</a> ";
|
||||||
|
|
||||||
|
}
|
||||||
|
echo "<a href=\"\" onclick=\"return openjudgeinfo(".$member['id'].");\">";
|
||||||
|
echo $member['firstname']." ".$member['lastname'];
|
||||||
|
echo "</a>";
|
||||||
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
echo "<a href=\"\" onclick=\"return openjudgeinfo(".$member['id'].");\">";
|
|
||||||
echo $member['firstname']." ".$member['lastname'];
|
echo "<tr><td colspan=\"2\">";
|
||||||
|
echo "<a onclick=\"return confirmClick('Are you sure you want to empty all judges from this team?')\" href=\"judges_teams_members.php?action=empty&team_id=".$team['id']."&team_num=".$team['num']."&team_name=".htmlspecialchars($team['name'])."\">";
|
||||||
|
echo " ".i18n("Empty All Members")." ";
|
||||||
|
echo "<img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<tr><td colspan=\"2\">";
|
||||||
|
echo error(i18n("Team has no members"),"inline");
|
||||||
|
echo "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user