--- loncom/homework/grades.pm 2003/06/18 17:37:46 1.100
+++ loncom/homework/grades.pm 2003/07/11 14:45:59 1.111
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.100 2003/06/18 17:37:46 bowersj2 Exp $
+# $Id: grades.pm,v 1.111 2003/07/11 14:45:59 ng 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.----
#
@@ -135,53 +136,60 @@ sub getclasslist {
}
}
$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);
}
-#find user domain
-sub finduser {
- my ($name) = @_;
- my $domain = '';
- if ( $Apache::grades::viewgrades eq 'F' ) {
- my %classlist=&Apache::lonnet::dump('classlist',
- $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
- $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
- my (@fields) = grep /^$name:/, keys %classlist;
- ($name, $domain) = split(/:/,$fields[0]);
- return ($name,$domain);
- } else {
- return ($ENV{'user.name'},$ENV{'user.domain'});
+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;
}
-#--- Prompts a user to enter a username.
-sub moreinfo {
- my ($request,$reason) = @_;
- $request->print("Unable to process request: $reason");
- if ( $Apache::grades::viewgrades eq 'F' ) {
- $request->print('
');
+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;
+ }
+ }
}
- return '';
+ #can't modify
+ return 0;
}
#--- Retrieve the grade status of a student for all the parts
@@ -359,28 +367,47 @@ sub listStudents {
$request->print(<
- function checkSelect(checkBox) {
- var ctr=0;
- var sense="";
- if (checkBox.length > 1) {
- for (var i=0; i 1) {
+ for (var i=0; i 1) {
+ for (var i=0; i
LISTJAVASCRIPT
@@ -397,6 +424,10 @@ LISTJAVASCRIPT
if ($ENV{'form.handgrade'} eq 'yes') {
$gradeTable.=' handgrade only'."\n";
}
+
+ my $saveStatus = $ENV{'form.status'} eq '' ? 'Active' : $ENV{'form.status'};
+ $ENV{'form.status'} = $saveStatus;
+
$gradeTable.=' last sub only'."\n".
' last sub & parts info'."\n".
' all details'."\n".
@@ -409,58 +440,85 @@ LISTJAVASCRIPT
''."\n".
''."\n".
''."\n".
- 'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
+ ''."\n";
+
+ $gradeTable.='Student Status: '."\n";
+
+ $gradeTable.='To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".
' on the check boxes for the group of students. '."\n".
- ''."\n".
- ''."\n";
+ $gradeTable.=''."\n";
-
- my (undef,undef,$fullname) = &getclasslist($getsec,$ENV{'form.showgrading'} eq 'yes' ? '1' : '0');
-
+
+ my (undef, undef, $fullname) = &getclasslist($getsec,'1');
$gradeTable.='