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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 26 Oct 2007 00:41:31 -0000


This is a MIME encoded message

--albertel1193359291
Content-Type: text/plain

albertel		Thu Oct 25 20:41:31 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/homework	grades.pm 
  Log:
  - BUG #5360 - implement the suggested grading interface
  
  
--albertel1193359291
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20071025204131.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.596 loncom/interface/loncommon.pm:1.597
--- loncom/interface/loncommon.pm:1.596	Thu Oct 25 20:23:45 2007
+++ loncom/interface/loncommon.pm	Thu Oct 25 20:40:54 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.596 2007/10/26 00:23:45 albertel Exp $
+# $Id: loncommon.pm,v 1.597 2007/10/26 00:40:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4995,18 +4995,56 @@
 div.LC_left_float {
   float: left;
   padding-right: 5%;
-  padding:bottom: 4px;
+  padding-bottom: 4px;
 }
 
 div.LC_clear_float_header {
-  padding:bottom: 2px;
+  padding-bottom: 2px;
 }
 
 div.LC_clear_float_footer {
-  padding:top: 10px;
+  padding-top: 10px;
   clear: both;
 }
 
+
+div.LC_grade_show_user {
+  margin-top: 20px;
+  border: 1px solid black;
+}
+div.LC_grade_user_name {
+  background: #DDDDEE;
+  border-bottom: 1px solid black;
+  font: bold large $sans;
+}
+div.LC_grade_show_user_odd_row div.LC_grade_user_name {
+  background: #DDEEDD;
+}
+
+div.LC_grade_show_problem,
+div.LC_grade_submissions,
+div.LC_grade_message_center,
+div.LC_grade_info_links,
+div.LC_grade_assign {
+  margin: 5px;
+  width: 99%;
+  background: #FFFFFF;
+}
+div.LC_grade_show_problem_header,
+div.LC_grade_submissions_header,
+div.LC_grade_message_center_header,
+div.LC_grade_assign_header {
+  font: bold large $sans;
+}
+div.LC_grade_show_problem_problem,
+div.LC_grade_submissions_body,
+div.LC_grade_message_center_body,
+div.LC_grade_assign_body {
+  border: 1px solid black;
+  width: 99%;
+  background: #FFFFFF;
+}
+
 END
 }
 
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.467 loncom/homework/grades.pm:1.468
--- loncom/homework/grades.pm:1.467	Thu Oct 25 20:39:09 2007
+++ loncom/homework/grades.pm	Thu Oct 25 20:41:31 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.467 2007/10/26 00:39:09 albertel Exp $
+# $Id: grades.pm,v 1.468 2007/10/26 00:41:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1739,27 +1739,27 @@
 	$companswer=~s|</form>||g;
 	$companswer=~s|name="submit"|name="would_have_been_submit"|g;
     }
-    my $result.='<table border="0" width="100%"><tr><td bgcolor="#777777">';
-    $result.='<table border="0" width="100%">';
-    if ($viewon) {
-	$result.='<tr><td bgcolor="#e6ffff"><b> ';
-	if ($mode eq 'both' or $mode eq 'text') {
-	    $result.='View of the problem - ';
-	} else {
-	    $result.='Correct answer: ';
-	}
-	$result.=$env{'form.fullname'}.'</b></td></tr>';
-    }
+    $rendered=
+	'<div class="LC_grade_show_problem_header">'.
+	&mt('View of the problem').
+	'</div><div class="LC_grade_show_problem_problem">'.
+	$rendered.
+	'</div>';
+    $companswer=
+	'<div class="LC_grade_show_problem_header">'.
+	&mt('Correct answer').
+	'</div><div class="LC_grade_show_problem_problem">'.
+	$companswer.
+	'</div>';
+    my $result;
     if ($mode eq 'both') {
-	$result.='<tr><td bgcolor="#ffffff">'.$rendered.'<br />';
-	$result.='<b>Correct answer:</b><br />'.$companswer;
+	$result=$rendered.$companswer;
     } elsif ($mode eq 'text') {
-	$result.='<tr><td bgcolor="#ffffff">'.$rendered;
+	$result=$rendered;
     } elsif ($mode eq 'answer') {
-	$result.='<tr><td bgcolor="#ffffff">'.$companswer;
+	$result=$companswer;
     }
-    $result.='</td></tr></table>';
-    $result.='</td></tr></table><br />';
+    $result='<div class="LC_grade_show_problem">'.$result.'</div>';
     return $result;
 }
 
@@ -1959,10 +1959,11 @@
     }
 
 # This is where output for one specific student would start
-    my $bgcolor='#DDEEDD';
-    if ($counter%2) { $bgcolor='#DDDDEE'; }
+    my $add_class = ($counter%2) ? 'LC_grade_show_user_odd_row' : '';
     $request->print("\n\n".
-                    '<p><table border="2"><tr><th bgcolor="'.$bgcolor.'">'.$env{'form.fullname'}.'</th></tr><tr><td bgcolor="'.$bgcolor.'">');
+                    '<div class="LC_grade_show_user '.$add_class.'">'.
+		    '<div class="LC_grade_user_name">'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'</div>'.
+		    '<div class="LC_grade_show_user_body">'."\n");
 
     if ($env{'form.vProb'} eq 'all' or $env{'form.vAns'} eq 'all') {
 	my $mode;
@@ -1982,10 +1983,10 @@
 
     # Display student info
     $request->print(($counter == 0 ? '' : '<br />'));
-    my $result='<table border="0" width="100%"><tr><td bgcolor="#777777">'."\n".
-	'<table border="0" width="100%"><tr bgcolor="#edffff"><td>'."\n";
-
-    $result.='<b>Fullname: </b>'.&nameUserString(undef,$env{'form.fullname'},$uname,$udom).'<br />'."\n";
+    my $result='<div class="LC_grade_submissions">';
+    
+    $result.='<div class="LC_grade_submissions_header">';
+    $result.= &mt('Submissions');
     $result.='<input type="hidden" name="name'.$counter.
 	'" value="'.$env{'form.fullname'}.'" />'."\n";
 
@@ -1999,7 +2000,7 @@
 	$result.=$sub_result;
     }
     $request->print($result."\n");
-
+    $request->print('</div>'."\n");
     # print student answer/submission
     # Options are (1) Handgaded submission only
     #             (2) Last submission, includes submission that is not handgraded 
@@ -2008,12 +2009,14 @@
     #             (4) The whole record for this student
     if ($env{'form.lastSub'} =~ /^(lastonly|hdgrade)$/) {
 	my ($string,$timestamp)= &get_last_submission(\%record);
-	my $lastsubonly=''.
-	    ($$timestamp eq '' ? '' : '<b>Date Submitted:</b> '.
-	     $$timestamp)."</td></tr>\n";
+	
+	my $lastsubonly;
+
 	if ($$timestamp eq '') {
-	    $lastsubonly.='<tr><td bgcolor="#ffffe6">'.$$string[0]; 
+	    $lastsubonly.='<div class="LC_grade_submissions_body">'.$$string[0].'</div>'; 
 	} else {
+	    $lastsubonly = '<div class="LC_grade_submissions_body"> <b>Date Submitted:</b> '.$$timestamp."\n";
+
 	    my %seenparts;
 	    my @part_response_id = &flatten_responseType($responseType);
 	    foreach my $part (@part_response_id) {
@@ -2036,16 +2039,16 @@
 		}
 		my $responsetype = $responseType->{$partid}->{$respid};
 		if (!exists($record{"resource.$partid.$respid.submission"})) {
-		    $lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '.
+		    $lastsubonly.="\n".'<div class="LC_grade_submission_part"><b>Part:</b> '.
 			$display_part.' <span class="LC_internal_info">( ID '.$respid.
 			' )</span>&nbsp; &nbsp;'.
-			'<span class="LC_warning">Nothing submitted - no attempts</span><br /><br />';
+			'<span class="LC_warning">'.&mt('Nothing submitted - no attempts').'</span><br /><br /></div>';
 		    next;
 		}
-		foreach (@$string) {
-		    my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/;
+		foreach my $submission (@$string) {
+		    my ($partid,$respid) = ($submission =~ /^resource\.([^\.]*)\.([^\.]*)\.submission/);
 		    if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
-		    my ($ressub,$subval) = split(/:/,$_,2);
+		    my ($ressub,$subval) = split(/:/,$submission,2);
 		    # Similarity check
 		    my $similar='';
 		    if($env{'form.checkPlag'}){
@@ -2075,31 +2078,32 @@
 			($env{'form.lastSub'} eq 'hdgrade' && 
 			 $$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
 			my $display_part=&get_display_part($partid,$symb);
-			$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '.
+			$lastsubonly.='<div class="LC_grade_submission_part"><b>Part:</b> '.
 			    $display_part.' <span class="LC_internal_info">( ID '.$respid.
 			    ' )</span>&nbsp; &nbsp;';
 			my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
 			if (@$files) {
-			    $lastsubonly.='<br /><span class="LC_warning">Like all files provided by users, this file may contain virusses</span><br />';
+			    $lastsubonly.='<br /><span class="LC_warning">'.&mt('Like all files provided by users, this file may contain virusses').'</span><br />';
 			    my $file_counter = 0;
 			    foreach my $file (@$files) {
-			        $file_counter ++;
+			        $file_counter++;
 				&Apache::lonnet::allowuploaded('/adm/grades',$file);
 				$lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>';
 			    }
 			    $lastsubonly.='<br />';
 			}
-			$lastsubonly.='<b>Submitted Answer: </b>'.
+			$lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'.
 			    &cleanRecord($subval,$responsetype,$symb,$partid,
 					 $respid,\%record,$order);
 			if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
+			$lastsubonly.='</div>';
 		    }
 		}
 	    }
+	    $lastsubonly.='</div>'."\n";
 	}
-	$lastsubonly.='</td></tr><tr bgcolor="#ffffff"><td>'."\n";
 	$request->print($lastsubonly);
-    } elsif ($env{'form.lastSub'} eq 'datesub') {
+   } elsif ($env{'form.lastSub'} eq 'datesub') {
 	my (undef,$responseType,undef,$parts) = &showResourceInfo($symb);
 	$request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom));
     } elsif ($env{'form.lastSub'} =~ /^(last|all)$/) {
@@ -2111,13 +2115,12 @@
 
     $request->print('<input type="hidden" name="unamedom'.$counter.'" value="'.$uname.':'
 	.$udom.'" />'."\n");
-    
     # return if view submission with no grading option
     if ($env{'form.showgrading'} eq '' || (!&canmodify($usec))) {
 	my $toGrade.='<input type="button" value="Grade Student" '.
 	    'onClick="javascript:checksubmit(this.form,\'Grade Student\',\''
 	    .$counter.'\');" target="_self" /> &nbsp;'."\n" if (&canmodify($usec));
-	$toGrade.='</td></tr></table></td></tr></table>'."\n";
+	$toGrade.='</div>'."\n";
 	if (($env{'form.command'} eq 'submission') || 
 	    ($env{'form.command'} eq 'processGroup' && $counter == $total)) {
 	    $toGrade.='</form>'.&show_grading_menu_form($symb); 
@@ -2125,11 +2128,15 @@
 	$request->print($toGrade);
 	return;
     } else {
-	$request->print('</td></tr></table></td></tr></table>'."\n");
+	$request->print('</div>'."\n");
     }
 
     # essay grading message center
     if ($env{'form.handgrade'} eq 'yes') {
+	my $result='<div class="LC_grade_message_center">';
+    
+	$result.='<div class="LC_grade_message_center_header">'.
+	    &mt('Send Message').'</div><div class="LC_grade_message_center_body">';
 	my ($lastname,$givenn) = split(/,/,$env{'form.fullname'});
 	my $msgfor = $givenn.' '.$lastname;
 	if (scalar(@$col_fullnames) > 0) {
@@ -2137,7 +2144,7 @@
 	    $msgfor .= ', '.(join ', ',@$col_fullnames).' and '.$lastone.'.';
 	}
 	$msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript
-	$result='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n".
+	$result.='<input type="hidden" name="includemsg'.$counter.'" value="" />'."\n".
 	    '<input type="hidden" name="newmsg'.$counter.'" value="" />'."\n";
 	$result.='&nbsp;<a href="javascript:msgCenter(document.SCORE,'.$counter.
 	    ',\''.$msgfor.'\');" target="_self">'.
@@ -2146,24 +2153,20 @@
 	    '<img src="'.$request->dir_config('lonIconsURL').
 	    '/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n".
 	    '<br />&nbsp;('.
-	    &mt('Message will be sent when you click on Save & Next below.').")\n";
+	    &mt('Message will be sent when you click on Save &amp; Next below.').")\n";
+	$result.='</div></div>';
 	$request->print($result);
     }
-    if ($perm{'vgr'}) {
-	$request->print('<br />'.
-	    &Apache::loncommon::track_student_link(&mt('View recent activity'),
-						   $uname,$udom,'check'));
-    }
-    if ($perm{'opa'}) {
-	$request->print('<br />'.
-	    &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),
-					 $uname,$udom,$symb,'check'));
-    }
 
     my %seen = ();
     my @partlist;
     my @gradePartRespid;
     my @part_response_id = &flatten_responseType($responseType);
+    $request->print('<div class="LC_grade_assign">'.
+		    
+		    '<div class="LC_grade_assign_header">'.
+		    &mt('Assign Grades').'</div>'.
+		    '<div class="LC_grade_assign_body">');
     foreach my $part_response_id (@part_response_id) {
     	my ($partid,$respid) = @{ $part_response_id };
 	my $part_resp = join('_',@{ $part_response_id });
@@ -2175,6 +2178,21 @@
 	push @gradePartRespid,$partid.'.'.$respid;
 	$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
     }
+    $request->print('</div></div>');
+
+    $request->print('<div class="LC_grade_info_links">');
+    if ($perm{'vgr'}) {
+	$request->print(
+	    &Apache::loncommon::track_student_link(&mt('View recent activity'),
+						   $uname,$udom,'check'));
+    }
+    if ($perm{'opa'}) {
+	$request->print(
+	    &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),
+					 $uname,$udom,$symb,'check'));
+    }
+    $request->print('</div>');
+
     $result='<input type="hidden" name="partlist'.$counter.
 	'" value="'.(join ":",@partlist).'" />'."\n";
     $result.='<input type="hidden" name="gradePartRespid'.
@@ -2185,11 +2203,12 @@
 	    $partlist[$ctr].'" />'."\n";
 	$ctr++;
     }
-    $request->print($result.'</td></tr></table></td></tr></table>'."\n");
+    $request->print($result.''."\n");
 
 # Done with printing info for one student
 
-    $request->print('</td></tr></table></p>');
+    $request->print('</div>');#LC_grade_show_user_body
+    $request->print('</div>');#LC_grade_show_user
 
 
     # print end of form

--albertel1193359291--