MDL-8062 Remove name attribute from <form> and related javascript code cleanup (tested with FF, IE, Konq and Opera)

This commit is contained in:
skodak 2007-01-06 19:22:58 +00:00
parent ee7f231d08
commit d2ce367fb9
38 changed files with 135 additions and 125 deletions

View file

@ -858,15 +858,15 @@ class assignment_base {
echo '<script type="text/javascript">'."\n";
echo 'function setNext(){'."\n";
echo 'document.submitform.mode.value=\'next\';'."\n";
echo 'document.submitform.userid.value="'.$nextid.'";'."\n";
echo 'getElementById(\'submitform\').mode.value=\'next\';'."\n";
echo 'getElementById(\'submitform\').userid.value="'.$nextid.'";'."\n";
echo '}'."\n";
echo 'function saveNext(){'."\n";
echo 'document.submitform.mode.value=\'saveandnext\';'."\n";
echo 'document.submitform.userid.value="'.$nextid.'";'."\n";
echo 'document.submitform.saveuserid.value="'.$userid.'";'."\n";
echo 'document.submitform.menuindex.value = document.submitform.grade.selectedIndex;'."\n";
echo 'getElementById(\'submitform\').mode.value=\'saveandnext\';'."\n";
echo 'getElementById(\'submitform\').userid.value="'.$nextid.'";'."\n";
echo 'getElementById(\'submitform\').saveuserid.value="'.$userid.'";'."\n";
echo 'getElementById(\'submitform\').menuindex.value = getElementById(\'submitform\').grade.selectedIndex;'."\n";
echo '}'."\n";
echo '</script>'."\n";
@ -922,7 +922,7 @@ class assignment_base {
///Print Buttons in Single View
echo '<div class="buttons" align="center">';
echo '<input type="submit" name="submit" value="'.get_string('savechanges').'" onclick = "document.submitform.menuindex.value = document.submitform.grade.selectedIndex" />';
echo '<input type="submit" name="submit" value="'.get_string('savechanges').'" onclick = "getElementById(\'submitform\').menuindex.value = getElementById(\'submitform\').grade.selectedIndex" />';
echo '<input type="submit" name="cancel" value="'.get_string('cancel').'" />';
//if there are more to be graded.
if ($nextid) {

View file

@ -37,7 +37,7 @@
//]]>
</script>
<form name="form" method="post" action="../mod/assignment/details.php">
<form id="form" method="post" action="../mod/assignment/details.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("assignmentname", "assignment") ?>:</b></td>

View file

@ -85,7 +85,7 @@
}
print_heading(get_string("amend", "exercise")." ".get_string("gradeforstudentsassessment",
"exercise", $course->student));
echo "<form name=\"amendgrade\" method=\"post\" action=\"assessments.php\">\n";
echo "<form id=\"amendgrade\" method=\"post\" action=\"assessments.php\">\n";
echo "<input type=\"hidden\" name=\"aid\" value=\"$aid\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"updategradinggrade\" />\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
@ -271,7 +271,7 @@
// set up heading, form and table
print_heading_with_help(get_string("editingassessmentelements", "exercise"), "elements", "exercise");
?>
<form name="form" method="post" action="assessments.php">
<form id="form" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="action" value="insertelements" />
<center><table cellpadding="5" border="1">

View file

@ -1567,7 +1567,7 @@ function exercise_print_assessment_form($exercise, $assessment = false, $allowch
// now print the grading form with the teacher's comments if any
// FORM is needed for Mozilla browsers, else radio bttons are not checked
?>
<form name="assessmentform" method="post" action="assessments.php">
<form id="assessmentform" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="aid" value="<?php echo $assessment->id ?>" />
<input type="hidden" name="action" value="updateassessment" />
@ -2017,9 +2017,9 @@ function exercise_print_assessment_form($exercise, $assessment = false, $allowch
if (isteacher($course->id)) {
// ...show two buttons...to resubmit or not to resubmit
echo "<input type=\"button\" value=\"".get_string("studentnotallowed", "exercise", $course->student)."\"
onclick=\"document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').submit();\" />\n";
echo "<input type=\"button\" value=\"".get_string("studentallowedtoresubmit", "exercise", $course->student)."\"
onclick=\"document.assessmentform.resubmit.value='1';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').resubmit.value='1';getElementById('assessmentform').submit();\" />\n";
}
else {
// ... show save button
@ -2368,7 +2368,7 @@ function exercise_print_teacher_assessment_form($exercise, $assessment, $submiss
echo "</td></tr></table></center><br clear=\"all\" />\n";
?>
<form name="assessmentform" method="post" action="assessments.php">
<form id="assessmentform" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="said" value="<?php echo $assessment->id ?>" />
<input type="hidden" name="sid" value="<?php echo $submission->id ?>" />
@ -2784,9 +2784,9 @@ function exercise_print_teacher_assessment_form($exercise, $assessment, $submiss
// ...and close the table and show two buttons...to resubmit or not to resubmit
echo "</table>\n";
echo "<br /><input type=\"button\" value=\"".get_string("studentnotallowed", "exercise", $course->student)."\"
onclick=\"document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').submit();\" />\n";
echo "<input type=\"button\" value=\"".get_string("studentallowedtoresubmit", "exercise", $course->student)."\"
onclick=\"document.assessmentform.resubmit.value='1';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').resubmit.value='1';getElementById('assessmentform').submit();\" />\n";
echo "</center></form>\n";
}

View file

@ -69,7 +69,7 @@
$submission = get_record("exercise_submissions", "id", $sid);
print_heading(get_string("amendtitle", "exercise"));
?>
<form name="amendtitleform" action="submissions.php" method="post">
<form id="amendtitleform" action="submissions.php" method="post">
<input type="hidden" name="action" value="adminupdatetitle" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="sid" value="<?php echo $sid ?>" />

View file

@ -251,7 +251,7 @@
if (!$correctpass) {
print_simple_box_start("center");
echo "<form name=\"password\" method=\"post\" action=\"view.php\">\n";
echo "<form id=\"password\" method=\"post\" action=\"view.php\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
echo "<table cellpadding=\"7px\">";
if (isset($_POST['userpassword'])) {

View file

@ -275,7 +275,7 @@ function forum_print_big_search_form($course) {
echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
echo "</script>\n";
echo '<form name="search" action="search.php" method="get">';
echo '<form id="searchform" action="search.php" method="get">';
echo '<input type="hidden" value="'.$course->id.'" name="id" alt="" />';
echo '<table cellpadding="10" class="searchbox" id="form">';
@ -304,7 +304,7 @@ function forum_print_big_search_form($course) {
echo '<tr>';
echo '<td class="c0">'.get_string('searchdatefrom', 'forum').':</td>';
echo '<td class="c1">';
echo '<input name="timefromrestrict" type="checkbox" value="1" alt="'.get_string('searchdatefrom', 'forum').'" onclick="return lockoptions(\'search\', \'timefromrestrict\', timefromitems)" /> ';
echo '<input name="timefromrestrict" type="checkbox" value="1" alt="'.get_string('searchdatefrom', 'forum').'" onclick="return lockoptions(\'searchform\', \'timefromrestrict\', timefromitems)" /> ';
if (empty($dateto)) {
$datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
}
@ -323,7 +323,7 @@ function forum_print_big_search_form($course) {
echo '<tr>';
echo '<td class="c0">'.get_string('searchdateto', 'forum').':</td>';
echo '<td class="c1">';
echo '<input name="timetorestrict" type="checkbox" value="1" alt="'.get_string('searchdateto', 'forum').'" onclick="return lockoptions(\'search\', \'timetorestrict\', timetoitems)" /> ';
echo '<input name="timetorestrict" type="checkbox" value="1" alt="'.get_string('searchdateto', 'forum').'" onclick="return lockoptions(\'searchform\', \'timetorestrict\', timetoitems)" /> ';
if (empty($dateto)) {
$dateto = time()+3600;
}
@ -365,8 +365,8 @@ function forum_print_big_search_form($course) {
echo '</form>';
echo "<script type=\"text/javascript\">";
echo "lockoptions('search','timefromrestrict', timefromitems);";
echo "lockoptions('search','timetorestrict', timetoitems);";
echo "lockoptions('searchform','timefromrestrict', timefromitems);";
echo "lockoptions('searchform','timetorestrict', timetoitems);";
echo "</script>\n";
print_simple_box_end();

View file

@ -60,7 +60,7 @@ $text_source_options = array(
//]]>
</script>
<center>
<form name="form" method="post" action="mod.php">
<form id="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
@ -371,7 +371,7 @@ $text_source_options = array(
// override the standard Moodle "setfocus" function,
// which gives a js error if the "name" field is hidden
function setfocus() {
var f = document.form;
var f = getElementById('form');
if (f) {
if (canfocus(f, 'namesource')) {
f.namesource.focus();

View file

@ -33,7 +33,7 @@ if (!isset($form->create_sequence_url)) {
}
?>
<form name="form" method="post" action="mod.php" onSubmit="disableSumbit(this);">
<form id="form" method="post" action="mod.php" onSubmit="disableSumbit(this);">
<center>
<span id="message"><p>Please wait .......</p></span>
<table cellpadding="5">
@ -229,7 +229,7 @@ function refreshLists(){
dol = new DynamicOptionList("workspace","sequence");
dol.setFormName("form");
url = "../mod/lams/list.php?courseid="+document.form.course.value;
url = "../mod/lams/list.php?courseid="+getElementById('form').course.value;
if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest();
req.onreadystatechange = processStateChange;

View file

@ -72,7 +72,7 @@
<?php } ?>
<form name="pageform" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
<form id="pageform" method ="post" action="<?php echo $CFG->wwwroot ?>/mod/lesson/view.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="pageid" value="<?php echo $newpageid ?>" />

View file

@ -944,7 +944,7 @@
if (!$highscores or $madeit) {
echo '<p>'.get_string("youmadehighscore", "lesson", $lesson->maxhighscores).
'</p><p>
<form method="post" name="highscores" action="'.$CFG->wwwroot.'/mod/lesson/highscores.php">
<form method="post" id="highscores" action="'.$CFG->wwwroot.'/mod/lesson/highscores.php">
<input type="hidden" name="mode" value="add" />
<input type="hidden" name="id" value="'.$cm->id.'" />
<input type="hidden" name="sesskey" value="'.sesskey().'" />

View file

@ -87,7 +87,7 @@
//]]>
</script>
<form method="post" action="module.php" name="form">
<form method="post" action="module.php" id="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<!-- Table of default values -->

View file

@ -1,4 +1,4 @@
<form method="post" action="module.php" name="form">
<form method="post" action="module.php" id="form">
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table cellpadding="9" cellspacing="0" >

View file

@ -1,4 +1,4 @@
<form name="form" method="post" action="<?php echo "$CFG->wwwroot/course/mod.php" ?>">
<form id="form" method="post" action="<?php echo "$CFG->wwwroot/course/mod.php" ?>">
<input type="hidden" name="type" value="<?php p($form->type) ?>" />
<input type="hidden" name="course" value="<?php p($form->course) ?>" />

View file

@ -36,10 +36,10 @@
<br />
<div align="center" class="form">
<form name="myform">
<form id="myform">
<input type="file" size="60" name="myfile"><br />
<input type="button" value="<?php print_string('localfileselect','resource') ?>"
onClick="return set_value(document.myform.myfile.value)">
onClick="return set_value(getElementById('myform').myfile.value)">
<input type="button" value="<?php print_string('cancel') ?>"
onClick="window.close()">
</form>

View file

@ -32,20 +32,20 @@
} else if (txt.indexOf('\\') > -1) {
txt = txt.substring(0,txt.lastIndexOf('\\'));
}
document.myform.pathname.value = txt;
document.myform.submit();
getElementById('myform').pathname.value = txt;
getElementById('myform').submit();
}
//]]>
</script>
<br />
<div align="center" class="form">
<form name="myform" action="localpath.php" method="post">
<form id="myform" action="localpath.php" method="post">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>">
<input type="hidden" name="pathname" value="">
<input type="file" size="60" name="myfile"><br />
<input type="button" value="<?php print_string('localfileselect','resource') ?>"
onClick="return set_value(document.myform.myfile.value)">
onClick="return set_value(getElementById('myform').myfile.value)">
<input type="button" value="<?php print_string('cancel') ?>"
onClick="window.close()">
</form>

View file

@ -40,7 +40,7 @@ $query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION;
/***********8
notify('Opening HarvestRoad Hive. Please wait. Contacting '. $CFG->hivehost );
echo '<form name="OPEN_HIVE_FORM" action="'. $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'" method="post">';
echo '<form id="OPEN_HIVE_FORM" action="'. $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath .'" method="post">';
echo '<input type="hidden" name="HISTORY" value="">';
echo '<input type="hidden" name="hiveLanguage" value="en_AU">';
@ -62,7 +62,7 @@ $query .= '&HIVE_SESSION='.$SESSION->HIVE_SESSION;
echo '</form>';
echo '<script type="text/javascript"/>';
echo "\n//<![CDATA[\n";
echo 'document.OPEN_HIVE_FORM.submit();';
echo 'getElementById(\'OPEN_HIVE_FORM\').submit();';
echo "\n//]]>\n";
echo '</script>';

View file

@ -205,7 +205,7 @@
}
</script>
<form name="form" method="post" action="mod.php?goto=" onsubmit="return validate_scorm(document.form,document.form.reference.value,false)">
<form id="form" method="post" action="mod.php?goto=" onsubmit="return validate_scorm(getElementById('form'),getElementById('form').reference.value,false)">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string('name') ?>:</b></td>
@ -243,7 +243,7 @@
<td align="right"><b><?php print_string('grademethod', 'scorm') ?>:</b></td>
<td>
<?php
choose_from_menu($SCORM_GRADE_METHOD, 'grademethod', (int) $form->grademethod, '','checkscormform(this,0,document.form.maxgrade);');
choose_from_menu($SCORM_GRADE_METHOD, 'grademethod', (int) $form->grademethod, '','checkscormform(this,0,getElementById(\'form\').maxgrade);');
helpbutton('grademethod', get_string('grademethod','scorm'), 'scorm');
?>
</td>
@ -272,7 +272,7 @@
$attempts[$i] = $i . ' ' . get_string('attempts','scorm');
}
}
choose_from_menu($attempts, 'maxattempt', (int) $form->maxattempt, get_string('nolimit','scorm'),'checkscormform(this,1,document.form.whatgrade);');
choose_from_menu($attempts, 'maxattempt', (int) $form->maxattempt, get_string('nolimit','scorm'),'checkscormform(this,1,getElementById(\'form\').whatgrade);');
helpbutton('maxattempt', get_string('maximumattempts','scorm'), 'scorm');
?>
</td>

View file

@ -163,7 +163,7 @@ function checkform() {
var error=false;
with (document.form) {
with (getElementById('form')) {
<?php
if (!empty($checklist)) {
foreach ($checklist as $question => $default) {
@ -176,7 +176,7 @@ function checkform() {
if (error) {
alert("<?php print_string("questionsnotanswered", "survey") ?>");
} else {
document.form.submit();
getElementById('form').submit();
}
}

View file

@ -418,7 +418,7 @@
error("Edit Comment: Submission not found");
}
?>
<form name="gradingform" action="assessments.php" method="post">
<form id="gradingform" action="assessments.php" method="post">
<input type="hidden" name="action" value="updatecomment" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="cid" value="<?php echo $cid ?>" />
@ -454,7 +454,7 @@
// set up heading, form and table
print_heading_with_help(get_string("editingassessmentelements", "workshop"), "elements", "workshop");
?>
<form name="form" method="post" action="assessments.php">
<form id="form" method="post" action="assessments.php">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="action" value="insertelements" />
<center><table cellpadding="5" border="1">

View file

@ -2138,17 +2138,17 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // show comments in fixed order (oldest first)
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments)."';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2242,18 +2242,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2347,18 +2347,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2510,18 +2510,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // show comments in fixed (creation) order
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2571,17 +2571,17 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment';
document.assessmentform.elementno.value=99;document.assessmentform.submit();\" /> \n";
onclick=\"getElementById('assessmentform').action.value='addstockcomment';
getElementById('assessmentform').elementno.value=99;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = 99", "id")) { // show in the same order (oldest at the top)
foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.generalcomment.value+=' '+'".
echo "<a onclick=\"getElementById('assessmentform').generalcomment.value+=' '+'".
addslashes($stockcomment->comments)."';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) {
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
echo " <a onclick=\"getElementById('assessmentform').action.value='removestockcomment';getElementById('assessmentform').stockcommentid.value=$stockcomment->id;getElementById('assessmentform').submit();\"> <small><i>&lt;--".get_string("delete","workshop")."</i></small></a>\n";
}
echo "<br />\n";
}
@ -2630,9 +2630,9 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if (($submission->userid == $USER->id) and !$assessment->timeagreed and !$comments and $showcommentlinks and
$submission->userid != $assessment->userid) {
echo "<input type=\"button\" value=\"".get_string("agreetothisassessment", "workshop")."\"
onclick=\"document.assessmentform.action.value='agreeassessment';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').action.value='agreeassessment';getElementById('assessmentform').submit();\" />\n";
echo "<input type=\"submit\" value=\"".get_string("disagreewiththisassessment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addcomment';document.assessmentform.submit();\" />\n";
onclick=\"getElementById('assessmentform').action.value='addcomment';getElementById('assessmentform').submit();\" />\n";
}
}
echo "</center>";

View file

@ -241,7 +241,7 @@
error(get_string('notallowed', 'workshop'));
}
?>
<form name="editform" enctype="multipart/form-data" action="submissions.php" method="post">
<form id="editform" enctype="multipart/form-data" action="submissions.php" method="post">
<input type="hidden" name="action" value="updatesubmission" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="sid" value="<?php echo $sid ?>" />
@ -260,8 +260,8 @@
if ($files = get_directory_list($basedir)) {
echo "<tr><td><b>".get_string("attachments", "workshop").
"</b><div align=\"right\"><input type=\"button\" value=\"".get_string("removeallattachments",
"workshop")."\" onclick=\"document.editform.action.value='removeattachments';
document.editform.submit();\"/></div></td></tr>\n";
"workshop")."\" onclick=\"getElementById('editform').action.value='removeattachments';
getElementById('editform').submit();\"/></div></td></tr>\n";
$n = 1;
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);