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

raeburn raeburn at source.lon-capa.org
Sun Apr 29 11:05:26 EDT 2018


raeburn		Sun Apr 29 15:05:26 2018 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/homework	grades.pm 
  Log:
  - For 2.11
    Backport 1.748
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.596.2.12.2.41 loncom/homework/grades.pm:1.596.2.12.2.42
--- loncom/homework/grades.pm:1.596.2.12.2.41	Fri Sep 15 13:42:29 2017
+++ loncom/homework/grades.pm	Sun Apr 29 15:05:25 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.596.2.12.2.41 2017/09/15 13:42:29 raeburn Exp $
+# $Id: grades.pm,v 1.596.2.12.2.42 2018/04/29 15:05:25 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4177,6 +4177,7 @@
 	$ctr++;
     }
     my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb);
+    my $totcolspan = 0;
     foreach my $partid (@partid) {
 	$header .= '<th align="center">'.&mt('Old Score').'</th>'.
 	    '<th align="center">'.&mt('New Score').'</th>';
@@ -4193,6 +4194,7 @@
 		'<th align="center">'.&mt('New').' '.$display.'</th>';
 	    $columns{$partid}+=2;
 	}
+        $totcolspan += $columns{$partid};
     }
     foreach my $partid (@partid) {
 	my $display_part=&get_display_part($partid,$symb);
@@ -4208,20 +4210,20 @@
     my @noupdate;
     my ($updateCtr,$noupdateCtr) = (1,1);
     for ($i=0; $i<$env{'form.total'}; $i++) {
-	my $line;
 	my $user = $env{'form.ctr'.$i};
 	my ($uname,$udom)=split(/:/,$user);
 	my %newrecord;
 	my $updateflag = 0;
-	$line .= '<td>'.&nameUserString(undef,$$fullname{$user},$uname,$udom).'</td>';
-	my $usec=$classlist->{"$uname:$udom"}[5];
-	if (!&canmodify($usec)) {
-	    my $numcols=scalar(@partid)*4+2;
-	    push(@noupdate,
-		 $line."<td colspan=\"$numcols\"><span class=\"LC_warning\">".
-		 &mt('Not allowed to modify student')."</span></td></tr>");
-	    next;
-	}
+        my $usec=$classlist->{"$uname:$udom"}[5];
+        my $canmodify = &canmodify($usec);
+        my $line = '<td'.($canmodify?'':' colspan="2"').'>'.
+                   &nameUserString(undef,$$fullname{$user},$uname,$udom).'</td>';
+        if (!$canmodify) {
+            push(@noupdate,
+                 $line."<td colspan=\"$totcolspan\"><span class=\"LC_warning\">".
+                 &mt('Not allowed to modify student')."</span></td>");
+            next;
+        }
         my %aggregate = ();
         my $aggregateflag = 0;
 	$user=~s/:/_/; # colon doen't work in javascript for names
@@ -4336,8 +4338,7 @@
         }
     }
     if (@noupdate) {
-#	my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
-	my $numcols=scalar(@partid)*4+2;
+        my $numcols=$totcolspan+2;
 	$result .= &Apache::loncommon::start_data_table_row('LC_empty_row').
 	    '<td align="center" colspan="'.$numcols.'">'.
 	    &mt('No Changes Occurred For the Students Below').




More information about the LON-CAPA-cvs mailing list