[LON-CAPA-cvs] cvs: loncom /homework grades.pm

wenzelju wenzelju@source.lon-capa.org
Thu, 11 Mar 2010 16:29:43 -0000


This is a MIME encoded message

--wenzelju1268324983
Content-Type: text/plain

wenzelju		Thu Mar 11 16:29:43 2010 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - &scripttag()-call for XHTML-conformity.
  - Deleted non-opend but closed <b>Tags.
  
  
--wenzelju1268324983
Content-Type: text/plain
Content-Disposition: attachment; filename="wenzelju-20100311162943.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.596 loncom/homework/grades.pm:1.597
--- loncom/homework/grades.pm:1.596	Sun Feb 28 23:31:42 2010
+++ loncom/homework/grades.pm	Thu Mar 11 16:29:42 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.596 2010/02/28 23:31:42 raeburn Exp $
+# $Id: grades.pm,v 1.597 2010/03/11 16:29:42 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -425,7 +425,7 @@
 	return '<blockquote><table border="1">'.
 	    '<tr valign="top"><td>'.&mt('Answer').'</td>'.$toprow.'</tr>'.
 	    '<tr valign="top"><td>'.$grayFont.&mt('Option ID').'</span></td>'.
-	    $grayFont.$bottomrow.'</tr>'.'</table></blockquote>';
+	    $bottomrow.'</tr>'.'</table></blockquote>';
     } elsif ($response eq 'essay') {
 	if (! exists ($env{'form.'.$symb})) {
 	    my (%keyhash) = &Apache::lonnet::dump('nohist_handgrade',
@@ -487,8 +487,7 @@
 #-- A couple of common js functions
 sub commonJSfunctions {
     my $request = shift;
-    $request->print(<<COMMONJSFUNCTIONS);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<COMMONJSFUNCTIONS));
     function radioSelection(radioButton) {
 	var selection=null;
 	if (radioButton.length > 1) {
@@ -516,7 +515,6 @@
 	    return selectOne.value;
 	}
     }
-</script>
 COMMONJSFUNCTIONS
 }
 
@@ -671,13 +669,13 @@
 sub jscriptNform {
     my ($symb) = @_;
     my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
-    my $jscript='<script type="text/javascript" language="javascript">'."\n".
+    my $jscript= &Apache::lonhtmlcommon::scripttag(
 	'    function viewOneStudent(user,domain) {'."\n".
 	'	document.onestudent.student.value = user;'."\n".
 	'	document.onestudent.userdom.value = domain;'."\n".
 	'	document.onestudent.submit();'."\n".
 	'    }'."\n".
-	'</script>'."\n";
+	"\n");
     $jscript.= '<form action="/adm/grades" method="post" name="onestudent">'."\n".
 	'<input type="hidden" name="symb"    value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n".
 	'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n".
@@ -886,8 +884,7 @@
 		'multiple' => 'Please select a student or group of students before clicking on the Next button.',
 		'single'   => 'Please select the student before clicking on the Next button.',
 	     );
-    $request->print(<<LISTJAVASCRIPT);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<LISTJAVASCRIPT));
     function checkSelect(checkBox) {
 	var ctr=0;
 	var sense="";
@@ -916,7 +913,6 @@
 	formname.command.value = 'submission';
 	formname.submit();
     }
-</script>
 LISTJAVASCRIPT
 
     &commonJSfunctions($request);
@@ -1152,7 +1148,7 @@
 
 sub check_script {
     my ($form, $type)=@_;
-    my $chkallscript='<script type="text/javascript">
+    my $chkallscript= &Apache::lonhtmlcommon::scripttag('
     function checkall() {
         for (i=0; i<document.forms.'.$form.'.elements.length; i++) {
             ele = document.forms.'.$form.'.elements[i];
@@ -1183,7 +1179,7 @@
         }
     }
 
-</script>'."\n";
+'."\n");
     return $chkallscript;
 }
 
@@ -1222,8 +1218,7 @@
 sub sub_page_js {
     my $request = shift;
 	    my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = ');
-    $request->print(<<SUBJAVASCRIPT);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<SUBJAVASCRIPT));
     function updateRadio(formname,id,weight) {
 	var gradeBox = formname["GD_BOX"+id];
 	var radioButton = formname["RADVAL"+id];
@@ -1391,7 +1386,6 @@
 
 	formname.submit();
     }
-</script>
 SUBJAVASCRIPT
 }
 
@@ -1401,8 +1395,7 @@
     my $iconpath = $request->dir_config('lonIconsURL');
     &commonJSfunctions($request);
 
-    my $inner_js_msg_central=<<INNERJS;
-    <script text="text/javascript">
+    my $inner_js_msg_central= &Apache::lonhtmlcommon::scripttag(<<INNERJS);
     function checkInput() {
       opener.document.SCORE.msgsub.value = opener.checkEntities(document.msgcenter.msgsub.value);
       var nmsg   = opener.document.SCORE.savemsgN.value;
@@ -1439,11 +1432,9 @@
       self.close()
 
     }
-    </script>
 INNERJS
 
-    my $inner_js_highlight_central=<<INNERJS;
- <script type="text/javascript">
+    my $inner_js_highlight_central= &Apache::lonhtmlcommon::scripttag(<<INNERJS);
     function updateChoice(flag) {
       opener.document.SCORE.kwclr.value = opener.radioSelection(document.hlCenter.kwdclr);
       opener.document.SCORE.kwsize.value = opener.radioSelection(document.hlCenter.kwdsize);
@@ -1454,7 +1445,6 @@
       }
       self.close()
     }
-</script>
 INNERJS
 
     my $start_page_msg_central = 
@@ -1478,8 +1468,7 @@
     my $docopen=&Apache::lonhtmlcommon::javascript_docopen();
     $docopen=~s/^document\.//;
     my $alertmsg = &mt('Please select a word or group of words from document and then click this link.');
-    $request->print(<<SUBJAVASCRIPT);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<SUBJAVASCRIPT));
 
 //===================== Show list of keywords ====================
   function keywords(formname) {
@@ -1710,7 +1699,6 @@
     hDoc.close();
   }
 
-</script>
 SUBJAVASCRIPT
 }
 
@@ -2204,7 +2192,7 @@
                     $lastsubonly.="\n".'<div class="LC_grade_submission_part">'.
                         '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
                         ' <span class="LC_internal_info">'.
-                        '('.&mt('Part ID: [_1]',$respid).')</b>'.
+                        '('.&mt('Part ID: [_1]',$respid).')'.
                         '</span>&nbsp; &nbsp;'.
 			'<span class="LC_warning">'.&mt('Nothing submitted - no attempts.').'</span><br /><br /></div>';
 		    next;
@@ -2250,7 +2238,7 @@
                             '<b>'.&mt('Part: [_1]',$display_part).'</b>'.
                             ' <span class="LC_internal_info">'.
                             '('.&mt('Part ID: [_1]',$respid).')'.
-                            '</b></span>&nbsp; &nbsp;';
+                            '</span>&nbsp; &nbsp;';
 			my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
 			if (@$files) {
                             if ($hide) {
@@ -3170,8 +3158,7 @@
     my ($request) = shift;
 
     my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = ');
-    $request->print(<<VIEWJAVASCRIPT);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<VIEWJAVASCRIPT));
    function writePoint(partid,weight,point) {
 	var radioButton = document.classgrade["RADVAL_"+partid];
 	var textbox = document.classgrade["TEXTVAL_"+partid];
@@ -3332,7 +3319,6 @@
 	}
     }
 
-</script>
 VIEWJAVASCRIPT
 }
 
@@ -3935,10 +3921,8 @@
 <input type="hidden" name="probTitle"  value="$env{'form.probTitle'}" />
 <input type="hidden" name="command"    value="csvuploadoptions" />
 <hr />
-<script type="text/javascript" language="Javascript">
-$javascript
-</script>
 ENDPICK
+    $request->print(&Apache::lonhtmlcommon::scripttag($javascript));
     return '';
 
 }
@@ -3983,8 +3967,7 @@
 
 sub checkforfile_js {
     my $alertmsg = &mt('Please use the browse button to select a file from your local directory.');
-    my $result =<<CSVFORMJS;
-<script type="text/javascript" language="javascript">
+    my $result = &Apache::lonhtmlcommon::scripttag(<<CSVFORMJS);
     function checkUpload(formname) {
 	if (formname.upfile.value == "") {
 	    alert("$alertmsg");
@@ -3992,7 +3975,6 @@
 	}
 	formname.submit();
     }
-    </script>
 CSVFORMJS
     return $result;
 }
@@ -4266,8 +4248,7 @@
     my ($request) = shift;
 
     my $alertmsg = &mt('Please select the student you wish to grade.');
-    $request->print(<<LISTJAVASCRIPT);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<LISTJAVASCRIPT));
 
 function checkPickOne(formname) {
     if (radioSelection(formname.student) == null) {
@@ -4280,7 +4261,6 @@
     formname.submit();
 }
 
-</script>
 LISTJAVASCRIPT
     &commonJSfunctions($request);
     my ($symb) = &get_symb($request);
@@ -5318,17 +5298,15 @@
     my $default_form_data=&defaultFormData(&get_symb($r,1));
     my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'};
-    $r->print('
-              <script type="text/javascript" language="javascript">
+    $r->print(&Apache::lonhtmlcommon::scripttag('
     function checkUpload(formname) {
 	if (formname.upfile.value == "") {
 	    alert("'.&mt('Please use the browse button to select a file from your local directory.').'");
 	    return false;
 	}
 	formname.submit();
-    }
-              </script>
-
+    }'));
+    $r->print('
               <form enctype="multipart/form-data" action="/adm/grades" name="rules" method="post">
                 '.$default_form_data.'
                 <input name="courseid" type="hidden" value="'.$cnum.'" />
@@ -7015,8 +6993,7 @@
 	    $r->print("\n<br />");
 	}
 
-	$r->print(<<ENDSCRIPT);
-<script type="text/javascript">
+	$r->print(&Apache::lonhtmlcommon::scripttag(<<ENDSCRIPT));
 function change_radio(field) {
     var slct=document.scantronupload.scantron_CODE_resolution;
     var i;
@@ -7024,7 +7001,6 @@
         if (slct[i].value==field) { slct[i].checked=true; }
     }
 }
-</script>
 ENDSCRIPT
 	my $href="/adm/pickcode?".
 	   "form=".&escape("scantronupload").
@@ -7096,8 +7072,7 @@
     my (@ansnums) = @_;
     my $ansnumstr = join('","',@ansnums);
     my $warning = &mt("A bubble or 'No bubble' selection has not been made for one or more lines.");
-    my $output = (<<ENDSCRIPT);
-<script type="text/javascript">
+    my $output = &Apache::lonhtmlcommon::scripttag((<<ENDSCRIPT));
 function verify_bubble_radio(form) {
     var ansnumArray = new Array ("$ansnumstr");
     var need_bubble_count = 0;
@@ -7120,7 +7095,6 @@
     }
     form.submit(); 
 }
-</script>
 ENDSCRIPT
     return $output;
 }
@@ -7979,8 +7953,7 @@
     my $default_form_data=&defaultFormData(&get_symb($r,1));
     my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.');
     my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded.");
-    $r->print('
-<script type="text/javascript" language="javascript">
+    $r->print(&Apache::lonhtmlcommon::scripttag('
     function checkUpload(formname) {
 	if (formname.upfile.value == "") {
 	    alert("'.$nofile_alert.'");
@@ -8007,8 +7980,8 @@
         return;
     }
 
-</script>
-
+'));
+    $r->print('
 <h3>'.&mt('Send scanned bubblesheet data to a course').'</h3>
 
 <form enctype="multipart/form-data" action="/adm/grades" name="rules" method="post">
@@ -8622,8 +8595,7 @@
 
     $Str .="</form>\n";
     my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box.");
-    $request->print(<<GRADINGMENUJS);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<GRADINGMENUJS));
     function checkChoice(formname,val,cmdx) {
 	if (val <= 2) {
 	    var cmd = radioSelection(formname.radioChoice);
@@ -8656,7 +8628,6 @@
 	}
 	return true;
     }
-</script>
 GRADINGMENUJS
     &commonJSfunctions($request);
     return $Str;    
@@ -8671,8 +8642,7 @@
     my $probTitle = &Apache::lonnet::gettitle($symb);
 
     my $receiptalert = &mt("Please enter a receipt number given by a student in the receipt box."); 
-    $request->print(<<GRADINGMENUJS);
-<script type="text/javascript" language="javascript">
+    $request->print(&Apache::lonhtmlcommon::scripttag(<<GRADINGMENUJS));
     function checkChoice(formname,val,cmdx) {
 	if (val <= 2) {
 	    var cmd = radioSelection(formname.radioChoice);
@@ -8705,7 +8675,6 @@
 	}
 	return true;
     }
-</script>
 GRADINGMENUJS
     &commonJSfunctions($request);
     my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
@@ -8951,8 +8920,7 @@
 						   ('iclicker' => 'i>clicker',
                                                     'interwrite' => 'interwrite PRS'));
     $symb = &Apache::lonenc::check_encrypt($symb);
-    $result.=<<ENDUPFORM;
-<script type="text/javascript">
+    $result.= &Apache::lonhtmlcommon::scripttag(<<ENDUPFORM);
 function sanitycheck() {
 // Accept only integer percentages
    document.forms.gradesupload.pcorrect.value=Math.round(document.forms.gradesupload.pcorrect.value);
@@ -8990,7 +8958,8 @@
 // Remember the old state
    document.forms.gradesupload.waschecked.value=newgradingchoice;
 }
-</script>
+ENDUPFORM
+    $result.= <<ENDUPFORM;
 <form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">
 <input type="hidden" name="symb" value="$symb" />
 <input type="hidden" name="command" value="processclickerfile" />
@@ -9009,7 +8978,7 @@
 <br /><label>$pcorrect: <input type="text" name="pcorrect" size="4" value="$env{'form.pcorrect'}" onchange="sanitycheck()" /></label>
 <br /><label>$pincorrect: <input type="text" name="pincorrect" size="4" value="$env{'form.pincorrect'}" onchange="sanitycheck()" /></label>
 <br /><input type="button" onclick="javascript:checkUpload(this.form);" value="$upload" />
-</form>
+</form>'
 ENDUPFORM
     $result.='</td></tr></table>'."\n".
              '</td></tr></table><br /><br />'."\n";

--wenzelju1268324983--