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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 21 Jun 2003 00:39:46 -0000


albertel		Fri Jun 20 20:39:46 2003 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - Should be the last of BUG#1862
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.105 loncom/homework/grades.pm:1.106
--- loncom/homework/grades.pm:1.105	Fri Jun 20 17:45:20 2003
+++ loncom/homework/grades.pm	Fri Jun 20 20:39:46 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.105 2003/06/20 21:45:20 albertel Exp $
+# $Id: grades.pm,v 1.106 2003/06/21 00:39:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -136,7 +136,7 @@
 	    }
 	}
 	$section = ($section ne '' ? $section : 'no');
-	if (1 || &canview($section)) {
+	if (&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.'" /resu\n".
+	'<input type="hidden" name="symb"    value="'.$symb.'" />'."\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".
@@ -2350,7 +2350,7 @@
     $result.='<tr bgcolor=#ffffe6><td>'."\n";
     my $upfile_select=&Apache::loncommon::upfile_select_html();
     $result.=<<ENDUPFORM;
-<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload" target="LONcatInfo">
+<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload">
 <input type="hidden" name="symb" value="$symb" />
 <input type="hidden" name="url" value="$url" />
 <input type="hidden" name="command" value="csvuploadmap" />
@@ -2429,6 +2429,7 @@
     $request->print('<h3>Assigning Grades</h3>');
     my $courseid=$ENV{'request.course.id'};
     my ($classlist) = &getclasslist('all',0);
+    my @notallowed;
     my @skipped;
     my $countdone=0;
     foreach my $grade (@gradedata) {
@@ -2439,6 +2440,11 @@
 	    push(@skipped,"$username:$domain");
 	    next;
 	}
+	my $usec=%$classlist->{"$username:$domain"}[5];
+	if (!&canmodify($usec)) {
+	    push(@notallowed,"$username:$domain");
+	    next;
+	}
 	my %grades;
 	foreach my $dest (keys(%fields)) {
 	    if ($dest eq 'username' || $dest eq 'domain') { next; }
@@ -2457,9 +2463,14 @@
     }
     $request->print("<br />Stored $countdone students\n");
     if (@skipped) {
-	$request->print('<br /><font size="+1"><b>Skipped Students</b></font><br />');
-	foreach my $student (@skipped) { $request->print("<br />$student"); }
+	$request->print('<p<font size="+1"><b>Skipped Students</b></font></p>');
+	foreach my $student (@skipped) { $request->print("$student<br />\n"); }
+    }
+    if (@notallowed) {
+	$request->print('<p><font size="+1" color="red"><b>Students Not Allowed to Modify</b></font></p>');
+	foreach my $student (@notallowed) { $request->print("$student<br />\n"); }
     }
+    $request->print("<br />\n");
     $request->print(&show_grading_menu_form($symb,$url));
     return '';
 }
@@ -3501,9 +3512,6 @@
 		delete($perm{'mgr'});
 	    }
 	}
-	#delete($perm{'mgr'});
-	#$Apache::lonxml::debug=1;
-	#&Apache::lonxml::debug("command is $command");
 
 	if ($command eq 'submission' && $perm{'vgr'}) {
 	    ($ENV{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
@@ -3521,19 +3529,17 @@
 	    $request->print(&viewgrades($request));
 	} elsif ($command eq 'handgrade' && $perm{'mgr'}) {
 	    $request->print(&processHandGrade($request));
-	} elsif ($command eq 'editgrades' && $perm{'mgr'} ) {
+	} elsif ($command eq 'editgrades' && $perm{'mgr'}) {
 	    $request->print(&editgrades($request));
-	} elsif ($command eq 'verify') {
+	} elsif ($command eq 'verify' && $perm{'vgr'}) {
 	    $request->print(&verifyreceipt($request));
-	} elsif ($command eq 'csvform') {
+	} elsif ($command eq 'csvform' && $perm{'mgr'}) {
 	    $request->print(&upcsvScores_form($request));
-	} elsif ($command eq 'csvupload') {
+	} elsif ($command eq 'csvupload' && $perm{'mgr'}) {
 	    $request->print(&csvupload($request));
-	} elsif ($command eq 'viewclasslist') {
-	    $request->print(&viewclasslist($request));
-	} elsif ($command eq 'csvuploadmap') {
+	} elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) {
 	    $request->print(&csvuploadmap($request));
-	} elsif ($command eq 'csvuploadassign') {
+	} elsif ($command eq 'csvuploadassign' && $perm{'mgr'}) {
 	    if ($ENV{'form.associate'} ne 'Reverse Association') {
 		$request->print(&csvuploadassign($request));
 	    } else {
@@ -3544,12 +3550,12 @@
 		}
 		$request->print(&csvuploadmap($request));
 	    }
-	} elsif ($command eq 'scantron_selectphase') {
+	} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) {
 	    $request->print(&scantron_selectphase($request));
-	} elsif ($command eq 'scantron_process') {
+	} elsif ($command eq 'scantron_process' && $perm{'mgr'}) {
 	    $request->print(&scantron_process_students($request));
-	} else {
-	    $request->print("Unknown action: $command:");
+	} elsif ($command) {
+	    $request->print("Access Denied");
 	}
     }
     &send_footer($request);