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

@ -815,7 +815,7 @@ function displaydir ($wdir) {
"zip" => "$strcreateziparchive" "zip" => "$strcreateziparchive"
); );
if (!empty($count)) { if (!empty($count)) {
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()"); choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()");
} }
echo "</td></tr></table>"; echo "</td></tr></table>";
echo "</form>"; echo "</form>";

View file

@ -714,7 +714,7 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {
if ($nextstage != DOWNLOADLANG) { if ($nextstage != DOWNLOADLANG) {
$needtoopenform = false; $needtoopenform = false;
?> ?>
<form name="installform" method="post" action="<?php echo $formaction ?>"> <form id="installform" method="post" action="<?php echo $formaction ?>">
<input type="hidden" name="stage" value="<?php echo $nextstage ?>" /> <input type="hidden" name="stage" value="<?php echo $nextstage ?>" />
<?php <?php
@ -916,7 +916,7 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {
<?php <?php
if ($needtoopenform) { if ($needtoopenform) {
?> ?>
<form name="installform" method="post" action="<?php echo $formaction ?>"> <form id="installform" method="post" action="<?php echo $formaction ?>">
<input type="hidden" name="stage" value="<?php echo $nextstage ?>" /> <input type="hidden" name="stage" value="<?php echo $nextstage ?>" />
<?php <?php
} }
@ -1197,8 +1197,8 @@ function database_js() {
function toggledbinfo() { function toggledbinfo() {
//Calculate selected value //Calculate selected value
var showid = 'mysql'; var showid = 'mysql';
if (document.installform.dbtype.value) { if (getElementById('installform').dbtype.value) {
showid = document.installform.dbtype.value; showid = getElementById('installform').dbtype.value;
} }
if (document.getElementById) { if (document.getElementById) {
//Hide all the divs //Hide all the divs

View file

@ -331,7 +331,7 @@
html_header($course, $wdir, "form.name"); html_header($course, $wdir, "form.name");
echo "<p>$strrenamefileto:"; echo "<p>$strrenamefileto:";
echo "<table border=\"0\">\n<tr>\n<td>\n"; echo "<table border=\"0\">\n<tr>\n<td>\n";
echo "<form action=\"coursefiles.php\" method=\"post\" name=\"form\">\n"; echo "<form action=\"coursefiles.php\" method=\"post\" id=\"form\">\n";
echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n"; echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n"; echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
echo " <input type=\"hidden\" name=\"action\" value=\"rename\" />\n"; echo " <input type=\"hidden\" name=\"action\" value=\"rename\" />\n";
@ -809,7 +809,7 @@ function displaydir ($wdir) {
"zip" => "$strcreateziparchive" "zip" => "$strcreateziparchive"
); );
if (!empty($count)) { if (!empty($count)) {
choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()"); choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()");
} }
if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) { if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) {
echo "<form action=\"coursefiles.php\" method=\"get\">\n"; echo "<form action=\"coursefiles.php\" method=\"get\">\n";

View file

@ -51,7 +51,7 @@ border-bottom: 1px solid black; letter-spacing: 2px;
</head> </head>
<body> <body>
<div class="title"><?php print_string("createanchor","editor");?></div> <div class="title"><?php print_string("createanchor","editor");?></div>
<form name="fie"> <form id="fie">
<table border="0" cellpadding="2" cellspacing="0"> <table border="0" cellpadding="2" cellspacing="0">
<tr> <tr>
<td><?php print_string("anchorname","editor");?>: <input id="f_anc" name="anc" type="text" size="30" /></td> <td><?php print_string("anchorname","editor");?>: <input id="f_anc" name="anc" type="text" size="30" /></td>

View file

@ -178,7 +178,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
<div class="space"></div> <div class="space"></div>
<div class="space"></div> <div class="space"></div>
<div class="space"></div> <div class="space"></div>
<form action="" method="get" name="first" id="first"> <form action="" method="get" id="first">
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="15%" align="right"><?php print_string("imageurl","editor");?>:</td> <td width="15%" align="right"><?php print_string("imageurl","editor");?>:</td>
@ -281,13 +281,13 @@ form { margin-bottom: 0px; margin-top: 0px; }
<?php if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?> <?php if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<table border="0" cellpadding="2" cellspacing="0"> <table border="0" cellpadding="2" cellspacing="0">
<tr><td><?php print_string("selection","editor");?>: </td> <tr><td><?php print_string("selection","editor");?>: </td>
<td><form name="idelete" id="idelete"> <td><form id="idelete">
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td> <input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
<td><form name="imove" id="imove"> <td><form id="imove">
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></td> <input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></td>
<td><form name="izip" id="izip"> <td><form id="izip">
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td> <input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
<td><form name="irename" id="irename" method="post" action="../coursefiles.php" target="ibrowser"> <td><form id="irename" method="post" action="../coursefiles.php" target="ibrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" /> <input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" /> <input type="hidden" name="wdir" value="" />
<input type="hidden" name="file" value="" /> <input type="hidden" name="file" value="" />
@ -315,7 +315,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
<tr> <tr>
<td height="22"><?php <td height="22"><?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?> if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<form name="cfolder" id="cfolder" action="../coursefiles.php" method="post" target="ibrowser"> <form id="cfolder" action="../coursefiles.php" method="post" target="ibrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" /> <input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" /> <input type="hidden" name="wdir" value="" />
<input type="hidden" name="action" value="mkdir" /> <input type="hidden" name="action" value="mkdir" />
@ -324,7 +324,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
<input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" /> <input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" />
</form> </form>
<div class="space"></div> <div class="space"></div>
<form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" name="uploader" target="ibrowser" id="uploader"> <form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" target="ibrowser" id="uploader">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" /> <input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
<input type="hidden" name="id" VALUE="<?php print($course->id);?>" /> <input type="hidden" name="id" VALUE="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" /> <input type="hidden" name="wdir" value="" />

View file

@ -102,13 +102,13 @@ form { margin-bottom: 1px; margin-top: 1px; }
<td> <td>
<table border="0" cellpadding="2" cellspacing="0"> <table border="0" cellpadding="2" cellspacing="0">
<tr><td><?php print_string("selection","editor");?>: </td> <tr><td><?php print_string("selection","editor");?>: </td>
<td><form name="idelete" id="idelete"> <td><form id="idelete">
<input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td> <input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
<td><form name="imove" id="imove"> <td><form id="imove">
<input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></form></td> <input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></form></td>
<td><form name="izip" id="izip"> <td><form id="izip">
<input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td> <input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
<td><form name="irename" id="irename" method="post" action="../coursefiles.php" target="fbrowser"> <td><form id="irename" method="post" action="../coursefiles.php" target="fbrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" /> <input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" /> <input type="hidden" name="wdir" value="" />
<input type="hidden" name="file" value="" /> <input type="hidden" name="file" value="" />
@ -127,7 +127,7 @@ form { margin-bottom: 1px; margin-top: 1px; }
<tr> <tr>
<td height="22"><?php <td height="22"><?php
if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?> if(has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id))) { ?>
<form name="cfolder" id="cfolder" action="../coursefiles.php" method="post" target="fbrowser"> <form id="cfolder" action="../coursefiles.php" method="post" target="fbrowser">
<input type="hidden" name="id" value="<?php print($course->id);?>" /> <input type="hidden" name="id" value="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" /> <input type="hidden" name="wdir" value="" />
<input type="hidden" name="action" value="mkdir" /> <input type="hidden" name="action" value="mkdir" />
@ -135,7 +135,7 @@ form { margin-bottom: 1px; margin-top: 1px; }
<input name="name" type="text" id="foldername" size="35" /> <input name="name" type="text" id="foldername" size="35" />
<input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" /> <input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" />
</form> </form>
<form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" name="uploader" target="fbrowser" id="uploader"> <form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" target="fbrowser" id="uploader">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" /> <input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
<input type="hidden" name="id" VALUE="<?php print($course->id);?>" /> <input type="hidden" name="id" VALUE="<?php print($course->id);?>" />
<input type="hidden" name="wdir" value="" /> <input type="hidden" name="wdir" value="" />

View file

@ -9,8 +9,10 @@ function popupchecker(msg) {
} }
} }
/*
function popUpProperties(inobj) { function popUpProperties(inobj) {
op = window.open(); /// Legacy function
var op = window.open();
op.document.open('text/plain'); op.document.open('text/plain');
for (objprop in inobj) { for (objprop in inobj) {
op.document.write(objprop + ' => ' + inobj[objprop] + '\n'); op.document.write(objprop + ' => ' + inobj[objprop] + '\n');
@ -19,6 +21,7 @@ function popUpProperties(inobj) {
} }
function fillmessagebox(text) { function fillmessagebox(text) {
/// Legacy function
document.form.message.value = text; document.form.message.value = text;
} }
@ -26,27 +29,34 @@ function copyrichtext(textname) {
/// Legacy stub for old editor - to be removed soon /// Legacy stub for old editor - to be removed soon
return true; return true;
} }
*/
function checkall() { function checkall() {
void(d=document); var el = document.getElementsByTagName('input');
void(el=d.getElementsByTagName('INPUT')); for(var i=0; i<el.length; i++) {
for(i=0;i<el.length;i++) if(el[i].type == 'checkbox') {
void(el[i].checked=1) el[i].checked = true;
}
}
} }
function checknone() { function checknone() {
void(d=document); var el = document.getElementsByTagName('input');
void(el=d.getElementsByTagName('INPUT')); for(var i=0; i<el.length; i++) {
for(i=0;i<el.length;i++) if(el[i].type == 'checkbox') {
void(el[i].checked=0) el[i].checked = false;
}
}
} }
function lockoptions(form, master, subitems) { function lockoptions(formid, master, subitems) {
// Subitems is an array of names of sub items. // Subitems is an array of names of sub items.
// Optionally, each item in subitems may have a // Optionally, each item in subitems may have a
// companion hidden item in the form with the // companion hidden item in the form with the
// same name but prefixed by "h". // same name but prefixed by "h".
if (eval("document."+form+"."+master+".checked")) { var form = document.forms[formid];
if (eval("form."+master+".checked")) {
for (i=0; i<subitems.length; i++) { for (i=0; i<subitems.length; i++) {
unlockoption(form, subitems[i]); unlockoption(form, subitems[i]);
} }
@ -59,16 +69,16 @@ function lockoptions(form, master, subitems) {
} }
function lockoption(form,item) { function lockoption(form,item) {
eval("document."+form+"."+item+".disabled=true");/* IE thing */ eval("form."+item+".disabled=true");/* IE thing */
if(document.forms[form].elements['h'+item]) { if(form.elements['h'+item]) {
eval("document."+form+".h"+item+".value=1"); eval("form.h"+item+".value=1");
} }
} }
function unlockoption(form,item) { function unlockoption(form,item) {
eval("document."+form+"."+item+".disabled=false");/* IE thing */ eval("form."+item+".disabled=false");/* IE thing */
if(document.forms[form].elements['h'+item]) { if(form.elements['h'+item]) {
eval("document."+form+".h"+item+".value=0"); eval("form.h"+item+".value=0");
} }
} }
function lockoptionsall(formid) { function lockoptionsall(formid) {
@ -139,7 +149,7 @@ function submitFormById(id) {
if(!theform) { if(!theform) {
return false; return false;
} }
if(theform.tagName != 'FORM') { if(theform.tagName != 'form') {
return false; return false;
} }
if(!theform.onsubmit || theform.onsubmit()) { if(!theform.onsubmit || theform.onsubmit()) {
@ -148,7 +158,7 @@ function submitFormById(id) {
} }
function select_all_in(elTagName, elClass, elId) { function select_all_in(elTagName, elClass, elId) {
var inputs = document.getElementsByTagName('INPUT'); var inputs = document.getElementsByTagName('input');
inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elClass, elId);}); inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elClass, elId);});
for(var i = 0; i < inputs.length; ++i) { for(var i = 0; i < inputs.length; ++i) {
if(inputs[i].type == 'checkbox' || inputs[i].type == 'radio') { if(inputs[i].type == 'checkbox' || inputs[i].type == 'radio') {

View file

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

View file

@ -37,7 +37,7 @@
//]]> //]]>
</script> </script>
<form name="form" method="post" action="../mod/assignment/details.php"> <form id="form" method="post" action="../mod/assignment/details.php">
<table cellpadding="5"> <table cellpadding="5">
<tr valign="top"> <tr valign="top">
<td align="right"><b><?php print_string("assignmentname", "assignment") ?>:</b></td> <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", print_heading(get_string("amend", "exercise")." ".get_string("gradeforstudentsassessment",
"exercise", $course->student)); "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=\"aid\" value=\"$aid\" />\n";
echo "<input type=\"hidden\" name=\"action\" value=\"updategradinggrade\" />\n"; echo "<input type=\"hidden\" name=\"action\" value=\"updategradinggrade\" />\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n"; echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
@ -271,7 +271,7 @@
// set up heading, form and table // set up heading, form and table
print_heading_with_help(get_string("editingassessmentelements", "exercise"), "elements", "exercise"); 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="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="action" value="insertelements" /> <input type="hidden" name="action" value="insertelements" />
<center><table cellpadding="5" border="1"> <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 // 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 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="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="aid" value="<?php echo $assessment->id ?>" /> <input type="hidden" name="aid" value="<?php echo $assessment->id ?>" />
<input type="hidden" name="action" value="updateassessment" /> <input type="hidden" name="action" value="updateassessment" />
@ -2017,9 +2017,9 @@ function exercise_print_assessment_form($exercise, $assessment = false, $allowch
if (isteacher($course->id)) { if (isteacher($course->id)) {
// ...show two buttons...to resubmit or not to resubmit // ...show two buttons...to resubmit or not to resubmit
echo "<input type=\"button\" value=\"".get_string("studentnotallowed", "exercise", $course->student)."\" 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)."\" 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 { else {
// ... show save button // ... 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"; 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="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="said" value="<?php echo $assessment->id ?>" /> <input type="hidden" name="said" value="<?php echo $assessment->id ?>" />
<input type="hidden" name="sid" value="<?php echo $submission->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 // ...and close the table and show two buttons...to resubmit or not to resubmit
echo "</table>\n"; echo "</table>\n";
echo "<br /><input type=\"button\" value=\"".get_string("studentnotallowed", "exercise", $course->student)."\" 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)."\" 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"; echo "</center></form>\n";
} }

View file

@ -69,7 +69,7 @@
$submission = get_record("exercise_submissions", "id", $sid); $submission = get_record("exercise_submissions", "id", $sid);
print_heading(get_string("amendtitle", "exercise")); 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="action" value="adminupdatetitle" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" /> <input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="sid" value="<?php echo $sid ?>" /> <input type="hidden" name="sid" value="<?php echo $sid ?>" />

View file

@ -251,7 +251,7 @@
if (!$correctpass) { if (!$correctpass) {
print_simple_box_start("center"); 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 "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />\n";
echo "<table cellpadding=\"7px\">"; echo "<table cellpadding=\"7px\">";
if (isset($_POST['userpassword'])) { 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 "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
echo "</script>\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 '<input type="hidden" value="'.$course->id.'" name="id" alt="" />';
echo '<table cellpadding="10" class="searchbox" id="form">'; echo '<table cellpadding="10" class="searchbox" id="form">';
@ -304,7 +304,7 @@ function forum_print_big_search_form($course) {
echo '<tr>'; echo '<tr>';
echo '<td class="c0">'.get_string('searchdatefrom', 'forum').':</td>'; echo '<td class="c0">'.get_string('searchdatefrom', 'forum').':</td>';
echo '<td class="c1">'; 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)) { if (empty($dateto)) {
$datefrom = make_timestamp(2000, 1, 1, 0, 0, 0); $datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
} }
@ -323,7 +323,7 @@ function forum_print_big_search_form($course) {
echo '<tr>'; echo '<tr>';
echo '<td class="c0">'.get_string('searchdateto', 'forum').':</td>'; echo '<td class="c0">'.get_string('searchdateto', 'forum').':</td>';
echo '<td class="c1">'; 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)) { if (empty($dateto)) {
$dateto = time()+3600; $dateto = time()+3600;
} }
@ -365,8 +365,8 @@ function forum_print_big_search_form($course) {
echo '</form>'; echo '</form>';
echo "<script type=\"text/javascript\">"; echo "<script type=\"text/javascript\">";
echo "lockoptions('search','timefromrestrict', timefromitems);"; echo "lockoptions('searchform','timefromrestrict', timefromitems);";
echo "lockoptions('search','timetorestrict', timetoitems);"; echo "lockoptions('searchform','timetorestrict', timetoitems);";
echo "</script>\n"; echo "</script>\n";
print_simple_box_end(); print_simple_box_end();

View file

@ -60,7 +60,7 @@ $text_source_options = array(
//]]> //]]>
</script> </script>
<center> <center>
<form name="form" method="post" action="mod.php"> <form id="form" method="post" action="mod.php">
<table cellpadding="5"> <table cellpadding="5">
<tr valign="top"> <tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td> <td align="right"><b><?php print_string("name") ?>:</b></td>
@ -371,7 +371,7 @@ $text_source_options = array(
// override the standard Moodle "setfocus" function, // override the standard Moodle "setfocus" function,
// which gives a js error if the "name" field is hidden // which gives a js error if the "name" field is hidden
function setfocus() { function setfocus() {
var f = document.form; var f = getElementById('form');
if (f) { if (f) {
if (canfocus(f, 'namesource')) { if (canfocus(f, 'namesource')) {
f.namesource.focus(); 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> <center>
<span id="message"><p>Please wait .......</p></span> <span id="message"><p>Please wait .......</p></span>
<table cellpadding="5"> <table cellpadding="5">
@ -229,7 +229,7 @@ function refreshLists(){
dol = new DynamicOptionList("workspace","sequence"); dol = new DynamicOptionList("workspace","sequence");
dol.setFormName("form"); 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 if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest(); req = new XMLHttpRequest();
req.onreadystatechange = processStateChange; req.onreadystatechange = processStateChange;

View file

@ -72,7 +72,7 @@
<?php } ?> <?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="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="pageid" value="<?php echo $newpageid ?>" /> <input type="hidden" name="pageid" value="<?php echo $newpageid ?>" />

View file

@ -944,7 +944,7 @@
if (!$highscores or $madeit) { if (!$highscores or $madeit) {
echo '<p>'.get_string("youmadehighscore", "lesson", $lesson->maxhighscores). echo '<p>'.get_string("youmadehighscore", "lesson", $lesson->maxhighscores).
'</p><p> '</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="mode" value="add" />
<input type="hidden" name="id" value="'.$cm->id.'" /> <input type="hidden" name="id" value="'.$cm->id.'" />
<input type="hidden" name="sesskey" value="'.sesskey().'" /> <input type="hidden" name="sesskey" value="'.sesskey().'" />

View file

@ -87,7 +87,7 @@
//]]> //]]>
</script> </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 ?>" /> <input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
<!-- Table of default values --> <!-- 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 ?>"> <input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
<table cellpadding="9" cellspacing="0" > <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="type" value="<?php p($form->type) ?>" />
<input type="hidden" name="course" value="<?php p($form->course) ?>" /> <input type="hidden" name="course" value="<?php p($form->course) ?>" />

View file

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

View file

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

View file

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

View file

@ -205,7 +205,7 @@
} }
</script> </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"> <table cellpadding="5">
<tr valign="top"> <tr valign="top">
<td align="right"><b><?php print_string('name') ?>:</b></td> <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 align="right"><b><?php print_string('grademethod', 'scorm') ?>:</b></td>
<td> <td>
<?php <?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'); helpbutton('grademethod', get_string('grademethod','scorm'), 'scorm');
?> ?>
</td> </td>
@ -272,7 +272,7 @@
$attempts[$i] = $i . ' ' . get_string('attempts','scorm'); $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'); helpbutton('maxattempt', get_string('maximumattempts','scorm'), 'scorm');
?> ?>
</td> </td>

View file

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

View file

@ -418,7 +418,7 @@
error("Edit Comment: Submission not found"); 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="action" value="updatecomment" />
<input type="hidden" name="id" value="<?php echo $cm->id ?>" /> <input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="cid" value="<?php echo $cid ?>" /> <input type="hidden" name="cid" value="<?php echo $cid ?>" />
@ -454,7 +454,7 @@
// set up heading, form and table // set up heading, form and table
print_heading_with_help(get_string("editingassessmentelements", "workshop"), "elements", "workshop"); 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="id" value="<?php echo $cm->id ?>" />
<input type="hidden" name="action" value="insertelements" /> <input type="hidden" name="action" value="insertelements" />
<center><table cellpadding="5" border="1"> <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)) { if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"". echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\" get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment'; onclick=\"getElementById('assessmentform').action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n"; getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop"); helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n"; echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // show comments in fixed order (oldest first) AND elementno = $i", "id")) { // show comments in fixed order (oldest first)
foreach ($stockcomments as $stockcomment) { 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"; addslashes($stockcomment->comments)."';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) { 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"; echo "<br />\n";
} }
@ -2242,18 +2242,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) { if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"". echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\" get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment'; onclick=\"getElementById('assessmentform').action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n"; getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop"); helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n"; echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
foreach ($stockcomments as $stockcomment) { foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'". echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments). addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n"; "';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) { 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"; echo "<br />\n";
} }
@ -2347,18 +2347,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) { if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"". echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\" get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment'; onclick=\"getElementById('assessmentform').action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n"; getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop"); helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n"; echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
foreach ($stockcomments as $stockcomment) { foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'". echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments). addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n"; "';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) { 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"; echo "<br />\n";
} }
@ -2510,18 +2510,18 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) { if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"". echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\" get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment'; onclick=\"getElementById('assessmentform').action.value='addstockcomment';
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n"; getElementById('assessmentform').elementno.value=$i;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop"); helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n"; echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = $i", "id")) { // show comments in fixed (creation) order AND elementno = $i", "id")) { // show comments in fixed (creation) order
foreach ($stockcomments as $stockcomment) { foreach ($stockcomments as $stockcomment) {
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'". echo "<a onclick=\"getElementById('assessmentform').feedback_$i.value+=' '+'".
addslashes($stockcomment->comments). addslashes($stockcomment->comments).
"';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n"; "';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) { 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"; echo "<br />\n";
} }
@ -2571,17 +2571,17 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) { if ($allowchanges and workshop_is_teacher($workshop, $USER->id)) {
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"". echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
get_string("addcomment", "workshop")."\" get_string("addcomment", "workshop")."\"
onclick=\"document.assessmentform.action.value='addstockcomment'; onclick=\"getElementById('assessmentform').action.value='addstockcomment';
document.assessmentform.elementno.value=99;document.assessmentform.submit();\" /> \n"; getElementById('assessmentform').elementno.value=99;getElementById('assessmentform').submit();\" /> \n";
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop"); helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
echo "</td><td>\n"; echo "</td><td>\n";
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
AND elementno = 99", "id")) { // show in the same order (oldest at the top) AND elementno = 99", "id")) { // show in the same order (oldest at the top)
foreach ($stockcomments as $stockcomment) { 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"; addslashes($stockcomment->comments)."';\">&lt;&lt;$stockcomment->comments&gt;&gt;</a>\n";
if (workshop_is_teacheredit($workshop, $USER->id)) { 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"; 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 if (($submission->userid == $USER->id) and !$assessment->timeagreed and !$comments and $showcommentlinks and
$submission->userid != $assessment->userid) { $submission->userid != $assessment->userid) {
echo "<input type=\"button\" value=\"".get_string("agreetothisassessment", "workshop")."\" 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")."\" 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>"; echo "</center>";

View file

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

View file

@ -169,7 +169,7 @@ function question_category_form($course, $current, $recurse=1, $showhidden=false
echo "<input type=\"submit\" value=\"$streditcats\" />"; echo "<input type=\"submit\" value=\"$streditcats\" />";
echo "</form>"; echo "</form>";
echo '</td></tr></table>'; echo '</td></tr></table>';
echo '<form method="post" action="edit.php" name="displayoptions">'; echo '<form method="post" action="edit.php" id="displayoptions">';
echo '<table><tr><td>'; echo '<table><tr><td>';
echo "<input type=\"hidden\" name=\"courseid\" value=\"{$course->id}\" />"; echo "<input type=\"hidden\" name=\"courseid\" value=\"{$course->id}\" />";
echo '<input type="hidden" name="recurse" value="0" />'; echo '<input type="hidden" name="recurse" value="0" />';
@ -177,7 +177,7 @@ function question_category_form($course, $current, $recurse=1, $showhidden=false
if ($recurse) { if ($recurse) {
echo ' checked="checked"'; echo ' checked="checked"';
} }
echo ' onchange="document.displayoptions.submit(); return true;" />'; echo ' onchange="getElementById(\'displayoptions\').submit(); return true;" />';
print_string('recurse', 'quiz'); print_string('recurse', 'quiz');
// hide-feature // hide-feature
echo '<br />'; echo '<br />';
@ -186,7 +186,7 @@ function question_category_form($course, $current, $recurse=1, $showhidden=false
if ($showhidden) { if ($showhidden) {
echo ' checked="checked"'; echo ' checked="checked"';
} }
echo ' onchange="document.displayoptions.submit(); return true;" />'; echo ' onchange="getElementById(\'displayoptions\').submit(); return true;" />';
print_string('showhidden', 'quiz'); print_string('showhidden', 'quiz');
echo '</td><noscript><td valign="center">'; echo '</td><noscript><td valign="center">';
echo ' <input type="submit" value="'. get_string('go') .'" />'; echo ' <input type="submit" value="'. get_string('go') .'" />';

View file

@ -225,7 +225,7 @@
?> ?>
<form name="form" enctype="multipart/form-data" method="post" action="import.php"> <form id="form" enctype="multipart/form-data" method="post" action="import.php">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" /> <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<?php print_simple_box_start("center"); ?> <?php print_simple_box_start("center"); ?>
<table cellpadding="5"> <table cellpadding="5">

View file

@ -89,7 +89,7 @@ $QTYPES[$question->qtype]->print_question_form_end($question,
function determineMinAndMax() { function determineMinAndMax() {
// This client-side script will determine the values for min and max // This client-side script will determine the values for min and max
// based on the input for answer and acceptederror. // based on the input for answer and acceptederror.
with(document.theform) { with(getElementById('theform')) {
if (formula0.value=='') { if (formula0.value=='') {
alert('<?php print_string("missingformula","quiz") ?>'); alert('<?php print_string("missingformula","quiz") ?>');
return false; return false;
@ -103,8 +103,8 @@ function determineMinAndMax() {
} else if (isNaN(tolerance0.value)) { } else if (isNaN(tolerance0.value)) {
alert('<?php print_string("tolerancemustbenumeric","quiz") ?>'); alert('<?php print_string("tolerancemustbenumeric","quiz") ?>');
return false; return false;
} else if ('2' == document.theform['correctanswerformat[]'].value } else if ('2' == getElementById('theform')['correctanswerformat[]'].value
&& '0' == document.theform['correctanswerlength[]'].value) { && '0' == getElementById('theform')['correctanswerlength[]'].value) {
alert('<?php print_string("zerosignificantfiguresnotallowed","quiz") ?>'); alert('<?php print_string("zerosignificantfiguresnotallowed","quiz") ?>');
return false; return false;
} else { } else {

View file

@ -337,7 +337,7 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
: 'significantfigures'), 'quiz', $i); : 'significantfigures'), 'quiz', $i);
} }
return '<input type="submit" onClick="' return '<input type="submit" onClick="'
. "document.addform.regenerateddefid.value='$defid'; return true;" . "getElementById('addform').regenerateddefid.value='$defid'; return true;"
.'" value="'. get_string('generatevalue', 'quiz') . '"/><br/>' .'" value="'. get_string('generatevalue', 'quiz') . '"/><br/>'
. '<input type="text" size="3" name="calcmin[]" ' . '<input type="text" size="3" name="calcmin[]" '
. " value=\"$regs[2]\"/> &amp; <input name=\"calcmax[]\" " . " value=\"$regs[2]\"/> &amp; <input name=\"calcmax[]\" "

View file

@ -249,7 +249,7 @@
// Print the new-dataset table // Print the new-dataset table
$addtable->data = array($addline); $addtable->data = array($addline);
echo "<form name=\"addform\" method=\"post\" action=\"question.php\"> echo "<form id=\"addform\" method=\"post\" action=\"question.php\">
<input type=\"hidden\" name=\"regenerateddefid\" value=\"0\"/> <input type=\"hidden\" name=\"regenerateddefid\" value=\"0\"/>
<input type=\"hidden\" name=\"id\" value=\"$question->id\"/> <input type=\"hidden\" name=\"id\" value=\"$question->id\"/>
<input type=\"hidden\" name=\"category\" value=\"$question->category\"/> <input type=\"hidden\" name=\"category\" value=\"$question->category\"/>

View file

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php"> <form id="theform" method="post" action="question.php">
<center> <center>
<table cellpadding="5"> <table cellpadding="5">
<?php if (!empty($datasets)) { ?> <?php if (!empty($datasets)) { ?>

View file

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php"> <form id="theform" method="post" action="question.php">
<center> <center>
<table cellpadding="5"> <table cellpadding="5">

View file

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php"> <form id="theform" method="post" action="question.php">
<center> <center>
<table cellpadding="5"> <table cellpadding="5">

View file

@ -1,4 +1,4 @@
<form name="theform" method="post" action="question.php"> <form id="theform" method="post" action="question.php">
<table cellpadding="5"> <table cellpadding="5">
<tr valign="top"> <tr valign="top">