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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Oct 2006 22:32:19 -0000


albertel		Mon Oct 23 18:32:19 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - some xhtml cleanups
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.380 loncom/homework/grades.pm:1.381
--- loncom/homework/grades.pm:1.380	Tue Oct 17 16:19:31 2006
+++ loncom/homework/grades.pm	Mon Oct 23 18:32:09 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.380 2006/10/17 20:19:31 albertel Exp $
+# $Id: grades.pm,v 1.381 2006/10/23 22:32:09 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1469,7 +1469,8 @@
 #--- displays the grading box, used in essay type problem and grading by page/sequence
 sub gradeBox {
     my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
-    my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL').
+    my $checkIcon = '<img alt="'.&mt('Check Mark').
+	'" src="'.$request->dir_config('lonIconsURL').
 	'/check.gif" height="16" border="0" />';
     my $wgt    = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
     my $wgtmsg = ($wgt > 0 ? '(problem weight)' : 
@@ -1492,10 +1493,10 @@
     my $increment = &get_increment();
     $result.='<table border="0"><tr>'."\n";  # display radio buttons in a nice table 10 across
     while ($thisweight<=$wgt) {
-	$result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '.
+	$result.= '<td><span style="white-space: nowrap;"><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '.
 	    'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','.
 	    $thisweight.')" value="'.$thisweight.'" '.
-	    ($score eq $thisweight ? 'checked':'').' /> '.$thisweight."</label></nobr></td>\n";
+	    ($score eq $thisweight ? 'checked':'').' /> '.$thisweight."</label></span></td>\n";
 	$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : '');
         $thisweight += $increment;
 	$ctr++;
@@ -1512,14 +1513,14 @@
     $result.='<select name="GD_SEL'.$counter.'_'.$partid.'" '.
 	'onChange="javascript:clearRadBox(this.form,\''.$counter.'_'.$partid.'\')" >'."\n";
     if ($$record{'resource.'.$partid.'.solved'} eq 'excused') {
-	$result.='<option> </option>'.
+	$result.='<option>&nbsp;</option>'.
 	    '<option selected="on">excused</option>';
     } else {
-	$result.='<option selected="on"> </option>'.
+	$result.='<option selected="on">&nbsp;</option>'.
 	    '<option>excused</option>';
     }
     $result.='<option>reset status</option></select>'."\n";
-    $result.="&nbsp&nbsp\n";
+    $result.="&nbsp;&nbsp;\n";
     $result.='<input type="hidden" name="stores'.$counter.'_'.$partid.'" value="" />'."\n".
 	'<input type="hidden" name="oldpts'.$counter.'_'.$partid.'" value="'.$score.'" />'."\n".
 	'<input type="hidden" name="solved'.$counter.'_'.$partid.'" value="'.
@@ -1640,7 +1641,8 @@
     if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; }
     if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; }
     my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : '');
-    my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL').
+    my $checkIcon = '<img alt="'.&mt('Check Mark').
+	'" src="'.$request->dir_config('lonIconsURL').
 	'/check.gif" height="16" border="0" />';
 
     # header info
@@ -3806,8 +3808,8 @@
 	$studentTable.=($ptr%2 == 0 ? '</td></tr>' : '');
 	$ptr++;
     }
-    $studentTable.='</td><td>&nbsp;</td><td>&nbsp;' if ($ptr%2 == 0);
-    $studentTable.='</td></tr></table></td></tr></table>'."\n";
+    $studentTable.='</td><td>&nbsp;</td><td>&nbsp;</td></tr>' if ($ptr%2 == 0);
+    $studentTable.='</table></td></tr></table>'."\n";
     $studentTable.='<input type="button" '.
 	'onClick="javascript:checkPickOne(this.form);"value="Next->" /></form>'."\n";
 
@@ -3830,9 +3832,10 @@
 					       1,0,1);
     for my $sequence ($navmap->getById('0.0'), @sequences) {
 	if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
-	    my $title = $minder.'.'.$sequence->compTitle();
-	    push @titles, $title; # minder in case two titles are identical
-	    $symbx{$title} = $sequence->symb();
+	    my $title = $minder.'.'.
+		&HTML::Entities::encode($sequence->compTitle(),'"\'&');
+	    push(@titles, $title); # minder in case two titles are identical
+	    $symbx{$title} = &HTML::Entities::encode($sequence->symb(),'"\'&');
 	    $minder++;
 	}
     }
@@ -3892,7 +3895,8 @@
 	'<input type="hidden" name="overRideScore" value="no" />'."\n".
 	'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n";
 
-    my $checkIcon = '<img src="'.$request->dir_config('lonIconsURL').
+    my $checkIcon = '<img alt="'.&mt('Check Mark').
+	'" src="'.$request->dir_config('lonIconsURL').
 	'/check.gif" height="16" border="0" />';
 
     $studentTable.='&nbsp;<b>Note:</b> Problems graded correct by the computer are marked with a '.$checkIcon.
@@ -3972,9 +3976,9 @@
         $curRes = $iterator->next();
     }
 
-    $studentTable.='</td></tr></table></td></tr></table>'."\n".
+    $studentTable.='</table></td></tr></table>'."\n".
 	'<input type="button" value="Save" '.
-	'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'.
+	'onClick="javascript:checkSubmitPage(this.form,'.$question.');" />'.
 	'</form>'."\n";
     $studentTable.=&show_grading_menu_form($symb);
     $request->print($studentTable);
@@ -4080,7 +4084,7 @@
 	if ($displaySub[2]) {
 	    $studentTable.='Manually graded by '.$displaySub[2];
 	}
-	$studentTable.='&nbsp;</td></tr>';
+	$studentTable.='&nbsp;</td></tr>3';
     
     }
     $studentTable.='</table></td></tr></table>';
@@ -4321,14 +4325,14 @@
 }
 
 sub scantron_CODEunique {
-    my $result='<nobr>
+    my $result='<span style="white-space: nowrap;">
                  <label><input type="radio" name="scantron_CODEunique"
                         value="yes" checked="checked" /> Yes </label>
-                </nobr>
-                <nobr>
+                </span>
+                <span style="white-space: nowrap;">
                  <label><input type="radio" name="scantron_CODEunique"
                         value="no" /> No </label>
-                </nobr>';
+                </span>';
     return $result;
 }