--- loncom/homework/grades.pm 2003/06/20 17:25:48 1.102
+++ loncom/homework/grades.pm 2003/06/20 20:13:18 1.103
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.102 2003/06/20 17:25:48 albertel Exp $
+# $Id: grades.pm,v 1.103 2003/06/20 20:13:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -49,6 +49,7 @@ use Apache::Constants qw(:common);
use String::Similarity;
my %oldessays=();
+my %perm=();
# ----- These first few routines are general use routines.----
#
@@ -130,23 +131,68 @@ sub getclasslist {
# filter students according to status selected
if ($filterlist && $ENV{'form.status'} ne 'Any') {
if ($ENV{'form.status'} ne $status) {
+Apache->request->print("
removed
");
delete ($classlist->{$_});
next;
}
}
$section = ($section ne '' ? $section : 'no');
- if ($getsec eq 'all' || $getsec eq $section) {
- $sections{$section}++;
- $fullnames{$_}=$fullname;
- } else {
- delete($classlist->{$_});
- }
+ if (&canview($section)) {
+ if ($getsec eq 'all' || $getsec eq $section) {
+ $sections{$section}++;
+ $fullnames{$_}=$fullname;
+ } else {
+ delete($classlist->{$_});
+ }
+ } else {
+ delete($classlist->{$_});
+ }
}
my %seen = ();
my @sections = sort(keys(%sections));
return ($classlist,\@sections,\%fullnames);
}
+sub canmodify {
+ my ($sec)=@_;
+ if ($perm{'mgr'}) {
+ if (!defined($perm{'mgr_section'})) {
+ # can modify whole class
+ return 1;
+ } else {
+ if ($sec eq $perm{'mgr_section'}) {
+ #can modify the requested section
+ return 1;
+ } else {
+ # can't modify the request section
+ return 0;
+ }
+ }
+ }
+ #can't modify
+ return 0;
+}
+
+sub canview {
+ my ($sec)=@_;
+ if ($perm{'vgr'}) {
+ if (!defined($perm{'vgr_section'})) {
+ # can modify whole class
+ return 1;
+ } else {
+ if ($sec eq $perm{'vgr_section'}) {
+ #can modify the requested section
+ return 1;
+ } else {
+ # can't modify the request section
+ return 0;
+ }
+ }
+ }
+ #can't modify
+ return 0;
+}
+
#--- Retrieve the grade status of a student for all the parts
sub student_gradeStatus {
my ($url,$symb,$udom,$uname,$partlist) = @_;
@@ -2486,6 +2532,7 @@ LISTJAVASCRIPT
' all details'."\n";
$result.=''."\n".
+ ''."\n".
''."\n".
''."\n".
''."\n".
@@ -2593,9 +2640,14 @@ sub displayPage {
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"};
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
my $pageTitle = $ENV{'form.page'};
- my (undef,undef,$fullname) = &getclasslist($getsec,'1');
+ my ($classlist,undef,$fullname) = &getclasslist($getsec,'1');
my ($uname,$udom) = split(/:/,$ENV{'form.student'});
-
+ my $usec=$classlist->{$ENV{'form.student'}}[5];
+ if (!&canview($usec)) {
+ $request->print('Unable to view requested student.('.$ENV{'form.student'}.')');
+ $request->print(&show_grading_menu_form($symb,$url));
+ return;
+ }
my $result='