Robustness fixes

This commit is contained in:
moodler 2002-12-30 06:07:03 +00:00
parent bdece65d72
commit 149f85f035
2 changed files with 18 additions and 15 deletions

View file

@ -4,28 +4,28 @@
<td><P><? print_string("fullname") ?>:</td> <td><P><? print_string("fullname") ?>:</td>
<td><input type="text" name="fullname" size=50 value="<? p($form->fullname) ?>"> <td><input type="text" name="fullname" size=50 value="<? p($form->fullname) ?>">
<? helpbutton("coursefullname", get_string("fullname")) ?> <? helpbutton("coursefullname", get_string("fullname")) ?>
<? formerr($err["fullname"]) ?> <? if (isset($err["fullname"])) formerr($err["fullname"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td><P><? print_string("shortname") ?>:</td> <td><P><? print_string("shortname") ?>:</td>
<td><input type="text" name="shortname" size=10 value="<? p($form->shortname) ?>"> <td><input type="text" name="shortname" size=10 value="<? p($form->shortname) ?>">
<? helpbutton("courseshortname", get_string("shortname")) ?> <? helpbutton("courseshortname", get_string("shortname")) ?>
<? formerr($err["shortname"]) ?> <? if (isset($err["shortname"])) formerr($err["shortname"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td><P><? print_string("summary") ?>:</td> <td><P><? print_string("summary") ?>:</td>
<td><TEXTAREA NAME=summary COLS=50 ROWS=10 WRAP=virtual><? p($form->summary) ?></TEXTAREA> <td><TEXTAREA NAME=summary COLS=50 ROWS=10 WRAP=virtual><? p($form->summary) ?></TEXTAREA>
<? helpbutton("text", get_string("helptext")) ?> <? helpbutton("text", get_string("helptext")) ?>
<? formerr($err["summary"]) ?> <? if (isset($err["summary"])) formerr($err["summary"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td><P><? print_string("enrolmentkey") ?>:</td> <td><P><? print_string("enrolmentkey") ?>:</td>
<td><input type="text" name="password" size=25 value="<? p($form->password) ?>"> <td><input type="text" name="password" size=25 value="<? p($form->password) ?>">
<? helpbutton("enrolmentkey", get_string("enrolmentkey")) ?> <? helpbutton("enrolmentkey", get_string("enrolmentkey")) ?>
<? formerr($err["password"]) ?> <? if (isset($err["password"])) formerr($err["password"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
@ -43,7 +43,6 @@
<td><? <td><?
choose_from_menu ($form->categories, "category", "$form->category", ""); choose_from_menu ($form->categories, "category", "$form->category", "");
helpbutton("coursecategory", get_string("category")); helpbutton("coursecategory", get_string("category"));
formerr($err["category"]);
?> ?>
</td> </td>
</tr> </tr>
@ -52,7 +51,6 @@
<td><? <td><?
choose_from_menu ($form->courseformats, "format", "$form->format", ""); choose_from_menu ($form->courseformats, "format", "$form->format", "");
helpbutton("courseformats", get_string("courseformats")); helpbutton("courseformats", get_string("courseformats"));
formerr($err["format"]);
?> ?>
</td> </td>
</tr> </tr>
@ -75,7 +73,6 @@
"10" => "10 $newsitems"); "10" => "10 $newsitems");
choose_from_menu ($options, "newsitems", "$form->newsitems", ""); choose_from_menu ($options, "newsitems", "$form->newsitems", "");
helpbutton("coursenewsitems", get_string("newsitemsnumber")); helpbutton("coursenewsitems", get_string("newsitemsnumber"));
formerr($err["newsitems"]);
?> ?>
</td> </td>
</tr> </tr>
@ -84,7 +81,6 @@
<td><? <td><?
print_date_selector("startday", "startmonth", "startyear", $form->startdate); print_date_selector("startday", "startmonth", "startyear", $form->startdate);
helpbutton("coursestartdate", get_string("startdate")); helpbutton("coursestartdate", get_string("startdate"));
formerr($err["startdate"]);
?></td> ?></td>
</tr> </tr>
<tr valign=top> <tr valign=top>
@ -93,9 +89,8 @@
for ($i=1; $i<=52; $i++) { for ($i=1; $i<=52; $i++) {
$sectionmenu[$i] = "$i"; $sectionmenu[$i] = "$i";
} }
choose_from_menu ($sectionmenu, "numsections", "$form->numsections"); choose_from_menu ($sectionmenu, "numsections", "$form->numsections", "");
helpbutton("coursenumsections", get_string("numberweeks")); helpbutton("coursenumsections", get_string("numberweeks"));
formerr($err["numsections"]);
?></td> ?></td>
</tr> </tr>
<tr valign=top> <tr valign=top>
@ -111,25 +106,29 @@
<tr valign=top> <tr valign=top>
<td><P><? print_string("wordforteacher") ?>:</td> <td><P><? print_string("wordforteacher") ?>:</td>
<td><input type="text" name="teacher" size=25 value="<? p($form->teacher) ?>"> <td><input type="text" name="teacher" size=25 value="<? p($form->teacher) ?>">
(<? print_string("wordforteachereg") ?>) <? formerr($err["teacher"]) ?> (<? print_string("wordforteachereg") ?>)
<? if (isset($err["teacher"])) formerr($err["teacher"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td><P><? print_string("wordforteachers") ?>:</td> <td><P><? print_string("wordforteachers") ?>:</td>
<td><input type="text" name="teachers" size=25 value="<? p($form->teachers) ?>"> <td><input type="text" name="teachers" size=25 value="<? p($form->teachers) ?>">
(<? print_string("wordforteacherseg") ?>) <? formerr($err["teachers"]) ?> (<? print_string("wordforteacherseg") ?>)
<? if (isset($err["teachers"])) formerr($err["teachers"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td><P><? print_string("wordforstudent") ?>:</td> <td><P><? print_string("wordforstudent") ?>:</td>
<td><input type="text" name="student" size=25 value="<? p($form->student) ?>"> <td><input type="text" name="student" size=25 value="<? p($form->student) ?>">
(<? print_string("wordforstudenteg") ?>) <? formerr($err["student"]) ?> (<? print_string("wordforstudenteg") ?>)
<? if (isset($err["student"])) formerr($err["student"]); ?>
</td> </td>
</tr> </tr>
<tr valign=top> <tr valign=top>
<td><P><? print_string("wordforstudents") ?>:</td> <td><P><? print_string("wordforstudents") ?>:</td>
<td><input type="text" name="students" size=25 value="<? p($form->students) ?>"> <td><input type="text" name="students" size=25 value="<? p($form->students) ?>">
(<? print_string("wordforstudentseg") ?>) <? formerr($err["students"]) ?> (<? print_string("wordforstudentseg") ?>)
<? if (isset($err["students"])) formerr($err["students"]); ?>
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -76,7 +76,7 @@
/// Otherwise fill and print the form. /// Otherwise fill and print the form.
if (!$form) { if (empty($form)) {
if ($course) { if ($course) {
$form = $course; $form = $course;
} else { } else {
@ -96,6 +96,10 @@
} }
} }
if (empty($focus)) {
$focus = "";
}
$form->categories = get_records_select_menu("course_categories", "", "name", "id,name"); $form->categories = get_records_select_menu("course_categories", "", "name", "id,name");
$form->courseformats = array ( $form->courseformats = array (