version 1.102, 2003/06/20 17:25:48
|
version 1.103, 2003/06/20 20:13:18
|
Line 49 use Apache::Constants qw(:common);
|
Line 49 use Apache::Constants qw(:common);
|
use String::Similarity; |
use String::Similarity; |
|
|
my %oldessays=(); |
my %oldessays=(); |
|
my %perm=(); |
|
|
# ----- These first few routines are general use routines.---- |
# ----- These first few routines are general use routines.---- |
# |
# |
Line 130 sub getclasslist {
|
Line 131 sub getclasslist {
|
# filter students according to status selected |
# filter students according to status selected |
if ($filterlist && $ENV{'form.status'} ne 'Any') { |
if ($filterlist && $ENV{'form.status'} ne 'Any') { |
if ($ENV{'form.status'} ne $status) { |
if ($ENV{'form.status'} ne $status) { |
|
Apache->request->print("<p>removed</p>"); |
delete ($classlist->{$_}); |
delete ($classlist->{$_}); |
next; |
next; |
} |
} |
} |
} |
$section = ($section ne '' ? $section : 'no'); |
$section = ($section ne '' ? $section : 'no'); |
if ($getsec eq 'all' || $getsec eq $section) { |
if (&canview($section)) { |
$sections{$section}++; |
if ($getsec eq 'all' || $getsec eq $section) { |
$fullnames{$_}=$fullname; |
$sections{$section}++; |
} else { |
$fullnames{$_}=$fullname; |
delete($classlist->{$_}); |
} else { |
} |
delete($classlist->{$_}); |
|
} |
|
} else { |
|
delete($classlist->{$_}); |
|
} |
} |
} |
my %seen = (); |
my %seen = (); |
my @sections = sort(keys(%sections)); |
my @sections = sort(keys(%sections)); |
return ($classlist,\@sections,\%fullnames); |
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 |
#--- Retrieve the grade status of a student for all the parts |
sub student_gradeStatus { |
sub student_gradeStatus { |
my ($url,$symb,$udom,$uname,$partlist) = @_; |
my ($url,$symb,$udom,$uname,$partlist) = @_; |
Line 2486 LISTJAVASCRIPT
|
Line 2532 LISTJAVASCRIPT
|
'<input type="radio" name="lastSub" value="all" /> all details'."\n"; |
'<input type="radio" name="lastSub" value="all" /> all details'."\n"; |
|
|
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
|
'<input type="hidden" name="status" value="'.$ENV{'form.status'}.'" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="url" value="'.$url.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n". |
Line 2593 sub displayPage {
|
Line 2640 sub displayPage {
|
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $pageTitle = $ENV{'form.page'}; |
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 ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
|
my $usec=$classlist->{$ENV{'form.student'}}[5]; |
|
if (!&canview($usec)) { |
|
$request->print('<font color="red">Unable to view requested student.('.$ENV{'form.student'}.')</font>'); |
|
$request->print(&show_grading_menu_form($symb,$url)); |
|
return; |
|
} |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
$result.='<h3> Student: '.$$fullname{$ENV{'form.student'}}. |
$result.='<h3> Student: '.$$fullname{$ENV{'form.student'}}. |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font></h3>'."\n"; |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font></h3>'."\n"; |
Line 2708 sub displayPage {
|
Line 2760 sub displayPage {
|
'','.submission'); |
'','.submission'); |
|
|
} |
} |
|
if (&canmodify($usec)) { |
foreach my $partid (@{$parts}) { |
foreach my $partid (@{$parts}) { |
$studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record); |
$studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record); |
$studentTable.='<input type="hidden" name="q_'.$question.'" value="'.$partid.'" />'."\n"; |
$studentTable.='<input type="hidden" name="q_'.$question.'" value="'.$partid.'" />'."\n"; |
$question++; |
$question++; |
|
} |
} |
} |
$studentTable.='</td></tr>'; |
$studentTable.='</td></tr>'; |
|
|
} |
} |
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
|
|
Line 2739 sub updateGradeByPage {
|
Line 2792 sub updateGradeByPage {
|
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'}; |
my $pageTitle = $ENV{'form.page'}; |
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 ($uname,$udom) = split(/:/,$ENV{'form.student'}); |
|
my $usec=$classlist->{$ENV{'form.student'}}[5]; |
|
if (!&canmodify($usec)) { |
|
$request->print('<font color="red">Unable to modify requested student.('.$ENV{'form.student'}.'</font>'); |
|
$request->print(&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'})); |
|
return; |
|
} |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
my $result='<h3><font color="#339933"> '.$ENV{'form.title'}.'</font></h3>'; |
$result.='<h3> Student: '.$$fullname{$ENV{'form.student'}}. |
$result.='<h3> Student: '.$$fullname{$ENV{'form.student'}}. |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font></h3>'."\n"; |
'<font color="#999999"> ('.$uname.($udom eq $cdom ? '':':'.$udom).')</font></h3>'."\n"; |
Line 3360 GRADINGMENUJS
|
Line 3418 GRADINGMENUJS
|
sub handler { |
sub handler { |
my $request=$_[0]; |
my $request=$_[0]; |
|
|
undef(%Apache::grades::perm); |
undef(%perm); |
if ($ENV{'browser.mathml'}) { |
if ($ENV{'browser.mathml'}) { |
$request->content_type('text/xml'); |
$request->content_type('text/xml'); |
} else { |
} else { |
Line 3405 sub handler {
|
Line 3463 sub handler {
|
} |
} |
} |
} |
} else { |
} else { |
if (!($Apache::grades::perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}))) { |
if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}))) { |
if ($Apache::grades::perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) { |
if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) { |
$Apache::grades::perm{'vgr_section'}=$ENV{'request.course.sec'}; |
$perm{'vgr_section'}=$ENV{'request.course.sec'}; |
} else { |
} else { |
delete($Apache::grades::perm{'vgr'}); |
delete($perm{'vgr'}); |
} |
} |
} |
} |
if (!($Apache::grades::perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}))) { |
if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}))) { |
if ($Apache::grades::perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) { |
if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) { |
$Apache::grades::perm{'mgr_section'}=$ENV{'request.course.sec'}; |
$perm{'mgr_section'}=$ENV{'request.course.sec'}; |
} else { |
} else { |
delete($Apache::grades::perm{'mgr'}); |
delete($perm{'mgr'}); |
} |
} |
} |
} |
|
# $Apache::lonxml::debug=1; |
|
# &Apache::lonxml::debug("command is $command"); |
|
|
if ($command eq 'submission') { |
if ($command eq 'submission') { |
($ENV{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
($ENV{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); |
} elsif ($command eq 'pickStudentPage') { |
} elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { |
&pickStudentPage($request); |
&pickStudentPage($request); |
} elsif ($command eq 'displayPage') { |
} elsif ($command eq 'displayPage' && $perm{'vgr'}) { |
&displayPage($request); |
&displayPage($request); |
} elsif ($command eq 'gradeByPage') { |
} elsif ($command eq 'gradeByPage') { |
&updateGradeByPage($request); |
&updateGradeByPage($request); |