--- loncom/homework/grades.pm 2003/06/20 21:45:20 1.105 +++ loncom/homework/grades.pm 2003/06/21 00:39:46 1.106 @@ -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 @@ sub getclasslist { } } $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 @@ sub viewgrades { #beginning of class grading form $result.= '
'."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -2350,7 +2350,7 @@ CSVFORMJS $result.=''."\n"; my $upfile_select=&Apache::loncommon::upfile_select_html(); $result.=< + @@ -2429,6 +2429,7 @@ sub csvuploadassign { $request->print('

Assigning Grades

'); 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 @@ sub csvuploadassign { 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 @@ sub csvuploadassign { } $request->print("
Stored $countdone students\n"); if (@skipped) { - $request->print('
Skipped Students
'); - foreach my $student (@skipped) { $request->print("
$student"); } + $request->print('Skipped Students

'); + foreach my $student (@skipped) { $request->print("$student
\n"); } + } + if (@notallowed) { + $request->print('

Students Not Allowed to Modify

'); + foreach my $student (@notallowed) { $request->print("$student
\n"); } } + $request->print("
\n"); $request->print(&show_grading_menu_form($symb,$url)); return ''; } @@ -3501,9 +3512,6 @@ sub handler { 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 @@ sub handler { $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 @@ sub handler { } $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);