update todo

allow removing of students IF studentnumber > minstudentsperproject
add a class 'caution' to ues on links, such as 'remove student'
add confirmClick javascript function
This commit is contained in:
james 2004-12-06 21:37:49 +00:00
parent ece5a157ac
commit 0b46ebb808
4 changed files with 42 additions and 11 deletions

1
TODO
View File

@ -1,2 +1 @@
- Fix sending of registration number to email addresses other than the first.
- Remove students when switching from 2 back to 1

View File

@ -147,6 +147,17 @@ function send_header($title="")
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/sfiab.css" type="text/css" />
</head>
<body>
<script language="javascript" type="text/javascript">
//useful function that we'll be using throughout
function confirmClick(msg)
{
var okay=confirm(msg);
if(okay)
return true;
else
return false;
}
</script>
<div id="header">
<?

View File

@ -88,16 +88,21 @@ echo mysql_error();
}
$x++;
}
}
if($_GET['action']=="removestudent")
{
//first make sure this is one belonging to this registration id
$q=mysql_query("SELECT id FROM students WHERE id='".$_GET['removestudent']."' AND registrations_id='".$_SESSION['registration_id']."'");
if(mysql_num_rows($q)==1)
{
mysql_query("DELETE FROM students WHERE id='".$_GET['removestudent']."' AND registrations_id='".$_SESSION['registration_id']."'");
echo notice(i18n("Student successfully removed"));
}
else
{
echo error(i18n("Invalid student to remove"));
}
}
@ -130,6 +135,9 @@ echo mysql_error();
echo "<select name=\"numstudents\" onchange=\"document.forms.numstudentsform.submit()\">\n";
for($x=$config['minstudentsperproject'];$x<=$config['maxstudentsperproject'];$x++)
{
if($x<$numfound)
continue;
if($numtoshow==$x) $selected="selected=\"selected\""; else $selected="";
echo "<option $selected value=\"$x\">$x</option>\n";
@ -143,7 +151,6 @@ echo mysql_error();
{
$studentinfo=mysql_fetch_object($q);
echo "<h3>".i18n("Student %1 Details",array($x))."</h3>";
//if we have a valid student, set their ID, so we can UPDATE when we submit
//if there is no record for this student, then set the ID to 0, so we will INSERT when we submit
if($studentinfo->id) $id=$studentinfo->id; else $id=0;
@ -221,6 +228,11 @@ echo mysql_error();
*/
echo "</table>";
if($x>$config['minstudentsperproject'] && $studentinfo->id)
{
echo "<div align=\"right\"><a onclick=\"return confirmClick('".i18n("Are you sure you want to remove this student from the project?")."');\" class=\"caution\" href=\"register_participants_students.php?action=removestudent&amp;removestudent=$studentinfo->id\">".i18n("Remove this student from project")."</a></div>";
}
echo "<br />";
echo "<br />";
}

View File

@ -152,3 +152,12 @@ a {
border: 1px solid Silver;
background: #E0E0FF;
}
.caution {
text-decoration: none;
font-weight: bold;
font-size: 11px;
color: red;
}