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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 23 Sep 2005 15:19:07 -0000


albertel		Fri Sep 23 11:19:07 2005 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - BUG#4384 (stops the ISE)
  - added some more <label>
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.287 loncom/homework/grades.pm:1.288
--- loncom/homework/grades.pm:1.287	Thu Sep 22 17:30:42 2005
+++ loncom/homework/grades.pm	Fri Sep 23 11:19:05 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.287 2005/09/22 21:30:42 albertel Exp $
+# $Id: grades.pm,v 1.288 2005/09/23 15:19:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1370,10 +1370,10 @@
     my $ctr = 0;
     $result.='<table border="0"><tr>'."\n";  # display radio buttons in a nice table 10 across
     while ($ctr<=$wgt) {
-	$result.= '<td><nobr><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '.
+	$result.= '<td><nobr><label><input type="radio" name="RADVAL'.$counter.'_'.$partid.'" '.
 	    'onclick="javascript:writeBox(this.form,\''.$counter.'_'.$partid.'\','.
 	    $ctr.')" value="'.$ctr.'" '.
-	    ($score eq $ctr ? 'checked':'').' /> '.$ctr."</nobr></td>\n";
+	    ($score eq $ctr ? 'checked':'').' /> '.$ctr."</label></nobr></td>\n";
 	$result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : '');
 	$ctr++;
     }
@@ -2579,9 +2579,9 @@
 	$result.='<table border="0"><tr>';  
 	my $ctr = 0;
 	while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across
-	    $result.= '<td><input type="radio" name="RADVAL_'.$partid.'" '.
+	    $result.= '<td><label><input type="radio" name="RADVAL_'.$partid.'" '.
 		'onclick="javascript:writePoint(\''.$partid.'\','.$weight{$partid}.
-		','.$ctr.')" />'.$ctr."</td>\n";
+		','.$ctr.')" />'.$ctr."</label></td>\n";
 	    $result.=(($ctr+1)%10 == 0 ? '</tr><tr>' : '');
 	    $ctr++;
 	}
@@ -3365,13 +3365,13 @@
     $result.='<input type="hidden" name="page" />'."\n".
 	'<input type="hidden" name="title" />'."\n";
 
-    $result.='&nbsp;<b>View Problems Text: </b><input type="radio" name="vProb" value="no" checked="on" /> no '."\n".
-	'<input type="radio" name="vProb" value="yes" /> yes '."<br>\n";
+    $result.='&nbsp;<b>View Problems Text: </b><label><input type="radio" name="vProb" value="no" checked="on" /> no </label>'."\n".
+	'<label><input type="radio" name="vProb" value="yes" /> yes </label>'."<br />\n";
 
     $result.='&nbsp;<b>Submission Details: </b>'.
-	'<input type="radio" name="lastSub" value="none" /> none'."\n".
-	'<input type="radio" name="lastSub" value="datesub" checked /> by dates and submissions'."\n".
-	'<input type="radio" name="lastSub" value="all" /> all details'."\n";
+	'<label><input type="radio" name="lastSub" value="none" /> none</label>'."\n".
+	'<label><input type="radio" name="lastSub" value="datesub" checked /> by dates and submissions</label>'."\n".
+	'<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n";
 
     $result.='<input type="hidden" name="section"     value="'.$getsec.'" />'."\n".
 	'<input type="hidden" name="Status"  value="'.$env{'form.Status'}.'" />'."\n".
@@ -3399,8 +3399,8 @@
 	my ($uname,$udom) = split(/:/,$student);
 	$studentTable.=($ptr%2 == 1 ? '<tr bgcolor="#ffffe6">' : '</td>');
 	$studentTable.='<td align="right">'.$ptr.'&nbsp;</td>';
-	$studentTable.='<td>&nbsp;<input type="radio" name="student" value="'.$student.'" /> '
-	    .&nameUserString(undef,$$fullname{$student},$uname,$udom)."\n";
+	$studentTable.='<td>&nbsp;<label><input type="radio" name="student" value="'.$student.'" /> '
+	    .&nameUserString(undef,$$fullname{$student},$uname,$udom)."</label>\n";
 	$studentTable.=($ptr%2 == 0 ? '</td></tr>' : '');
 	$ptr++;
     }
@@ -3472,7 +3472,11 @@
     my $navmap = Apache::lonnavmaps::navmap->new();
     my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'});
     my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
-
+    if (!$map) {
+	$request->print('<font color="red">Unable to view requested sequence. ('.$resUrl.')</font>');
+	$request->print(&show_grading_menu_form($symb,$url));
+	return; 
+    }
     my $iterator = $navmap->getIterator($map->map_start(),
 					$map->map_finish());
 
@@ -3678,7 +3682,12 @@
     my $navmap = Apache::lonnavmaps::navmap->new();
     my ($mapUrl, $id, $resUrl) = &Apache::lonnet::decode_symb( $env{'form.page'});
     my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
-
+    if (!$map) {
+	$request->print('<font color="red">Unable to grade requested sequence. ('.$resUrl.')</font>');
+	my ($symb,$url)=&get_symb_and_url($request);
+	$request->print(&show_grading_menu_form($symb,$url));
+	return; 
+    }
     my $iterator = $navmap->getIterator($map->map_start(),
 					$map->map_finish());
 
@@ -5390,10 +5399,10 @@
 
     $result.='</td></tr>';
 
-    $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.
+    $result.='<tr bgcolor="#ffffe6"valign="top"><td><label>'.
 	'<input type="radio" name="radioChoice" value="submission" '.
 	($saveCmd eq 'submission' ? 'checked' : '').'> '.'<b>'.&mt('Current Resource').':</b> '.&mt('For one or more students').
-	' <select name="submitonly">'.
+	'</label> <select name="submitonly">'.
 	'<option value="yes" '.
 	($saveSub eq 'yes' ? 'selected="on"' : '').'>with submissions</option>'.
 	'<option value="graded" '.
@@ -5404,14 +5413,14 @@
 	($saveSub eq 'all' ? 'selected="on"' : '').'>with any status</option></select></td></tr>'."\n";
 
     $result.='<tr bgcolor="#ffffe6"valign="top"><td>'.
-	'<input type="radio" name="radioChoice" value="viewgrades" '.
+	'<label><input type="radio" name="radioChoice" value="viewgrades" '.
 	($saveCmd eq 'viewgrades' ? 'checked' : '').'> '.
-	'<b>Current Resource:</b> For all students in selected section or course</td></tr>'."\n";
+	'<b>Current Resource:</b> For all students in selected section or course</label></td></tr>'."\n";
 
     $result.='<tr bgcolor="#ffffe6" valign="top"><td>'.
-	'<input type="radio" name="radioChoice" value="pickStudentPage" '.
+	'<label><input type="radio" name="radioChoice" value="pickStudentPage" '.
 	($saveCmd eq 'pickStudentPage' ? 'checked' : '').'> '.
-	'The <b>complete</b> set/page/sequence: For one student</td></tr>'."\n";
+	'The <b>complete</b> set/page/sequence: For one student</label></td></tr>'."\n";
 
     $result.='<tr bgcolor="#ffffe6"><td><br />'.
 	'<input type="button" onClick="javascript:checkChoice(this.form,\'2\');" value="Next->" />'.