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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 20 Jun 2003 21:45:20 -0000


albertel		Fri Jun 20 17:45:20 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - BUG#1862
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.104 loncom/homework/grades.pm:1.105
--- loncom/homework/grades.pm:1.104	Fri Jun 20 17:28:18 2003
+++ loncom/homework/grades.pm	Fri Jun 20 17:45:20 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.104 2003/06/20 21:28:18 albertel Exp $
+# $Id: grades.pm,v 1.105 2003/06/20 21:45:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -136,7 +136,7 @@
 	    }
 	}
 	$section = ($section ne '' ? $section : 'no');
-	if (&canview($section)) {
+	if (1 || &canview($section)) {
 	    if ($getsec eq 'all' || $getsec eq $section) {
 		$sections{$section}++;
 		$fullnames{$_}=$fullname;
@@ -1847,7 +1847,7 @@
 
     #beginning of class grading form
     $result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n".
-	'<input type="hidden" name="symb"    value="'.$symb.'" />'."\n".
+	'<input type="hidden" name="symb"    value="'.$symb.'" /resu\n".
 	'<input type="hidden" name="url"     value="'.$url.'" />'."\n".
 	'<input type="hidden" name="command" value="editgrades" />'."\n".
 	'<input type="hidden" name="section" value="'.$ENV{'form.section'}.'" />'."\n".
@@ -2080,10 +2080,15 @@
 	my ($uname,$udom)=split(/_/,$user);
 	my %newrecord;
 	my $updateflag = 0;
-
 	$line .= '<tr bgcolor="#ffffde"><td>'.$uname.'&nbsp;</td><td>'.
 	    $udom.'&nbsp;</td><td>'.
 		$$fullname{$usercolon}.'&nbsp;</td>';
+	my $usec=%$classlist->{"$uname:$udom"}[5];
+	if (!&canmodify($usec)) {
+	    my $numcols=scalar(@partid)*(scalar(@parts)-1)*2;
+	    $noupdate.=$line."<td colspan=\"$numcols\"><font color=\"red\">Not allowed to modify student</font></td></tr>";
+	    next;
+	}
 	foreach (@partid) {
 	    my $old_aw    = $ENV{'form.GD_'.$user.'_'.$_.'_awarded_s'};
 	    my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1);
@@ -2141,7 +2146,8 @@
 	}
     }
     if ($noupdate) {
-	$result .= '<tr bgcolor="#ffffff"><td align="center" colspan="7">No Changes Occured For the Students Below</td></tr>'.$noupdate;
+	my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
+	$result .= '<tr bgcolor="#ffffff"><td align="center" colspan="'.$numcols.'">No Changes Occured For the Students Below</td></tr>'.$noupdate;
     }
     $result .= '</table></td></tr></table>'."\n".
 	&show_grading_menu_form ($symb,$url);
@@ -3515,7 +3521,7 @@
 	    $request->print(&viewgrades($request));
 	} elsif ($command eq 'handgrade' && $perm{'mgr'}) {
 	    $request->print(&processHandGrade($request));
-	} elsif ($command eq 'editgrades') {
+	} elsif ($command eq 'editgrades' && $perm{'mgr'} ) {
 	    $request->print(&editgrades($request));
 	} elsif ($command eq 'verify') {
 	    $request->print(&verifyreceipt($request));