Diff for /loncom/homework/grades.pm between versions 1.93 and 1.104

version 1.93, 2003/05/30 21:42:36 version 1.104, 2003/06/20 21:28: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 135  sub getclasslist { Line 136  sub getclasslist {
     }      }
  }   }
  $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);
 }  }
   
 #find user domain  sub canmodify {
 sub finduser {      my ($sec)=@_;
     my ($name) = @_;      if ($perm{'mgr'}) {
     my $domain = '';   if (!defined($perm{'mgr_section'})) {
     if ( $Apache::grades::viewgrades eq 'F' ) {      # can modify whole class
  my %classlist=&Apache::lonnet::dump('classlist',      return 1;
     $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},   } else {
     $ENV{'course.'.$ENV{'request.course.id'}.'.num'});      if ($sec eq $perm{'mgr_section'}) {
  my (@fields) = grep /^$name:/, keys %classlist;   #can modify the requested section
  ($name, $domain) = split(/:/,$fields[0]);   return 1;
  return ($name,$domain);      } else {
     } else {   # can't modify the request section
  return ($ENV{'user.name'},$ENV{'user.domain'});   return 0;
       }
    }
     }      }
       #can't modify
       return 0;
 }  }
   
 #--- Prompts a user to enter a username.  sub canview {
 sub moreinfo {      my ($sec)=@_;
     my ($request,$reason) = @_;      if ($perm{'vgr'}) {
     $request->print("Unable to process request: $reason");   if (!defined($perm{'vgr_section'})) {
     if ( $Apache::grades::viewgrades eq 'F' ) {      # can modify whole class
  $request->print('<form action="/adm/grades" method="post">'."\n");      return 1;
  if ($ENV{'form.url'}) {   } else {
     $request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n");      if ($sec eq $perm{'vgr_section'}) {
  }   #can modify the requested section
  if ($ENV{'form.symb'}) {   return 1;
     $request->print('<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'."\n");      } else {
  }   # can't modify the request section
  $request->print('<input type="hidden" name="command" value="'.$ENV{'form.command'}.'" />'."\n");   return 0;
  $request->print("Student:".'<input type="text" name="student" value="'.$ENV{'form.student'}.'" />'."<br />\n");      }
  $request->print("Domain:".'<input type="text" name="domain" value="'.$ENV{'user.domain'}.'" />'."<br />\n");   }
  $request->print('<input type="submit" name="submit" value="ReSubmit" />'."<br />\n");  
  $request->print('</form>');  
     }      }
     return '';      #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
Line 446  LISTJAVASCRIPT Line 454  LISTJAVASCRIPT
  next if ($statusflg eq '' && $submitonly eq 'yes');   next if ($statusflg eq '' && $submitonly eq 'yes');
   
  $ctr++;   $ctr++;
  if ( $Apache::grades::viewgrades eq 'F' ) {   if ( $perm{'vgr'} eq 'F' ) {
     $gradeTable.='<tr bgcolor="#ffffe6">'.      $gradeTable.='<tr bgcolor="#ffffe6">'.
  '<td align="center"><input type=checkbox name="stuinfo" value="'.   '<td align="center"><input type=checkbox name="stuinfo" value="'.
  $student.':'.$$fullname{$student}.'"></td>'."\n".   $student.':'.$$fullname{$student}.'"></td>'."\n".
Line 466  LISTJAVASCRIPT Line 474  LISTJAVASCRIPT
  'onClick="javascript:checkSelect(this.form.stuinfo);" '.   'onClick="javascript:checkSelect(this.form.stuinfo);" '.
  'value="'.$viewgrade.'" /></form>'."\n";   'value="'.$viewgrade.'" /></form>'."\n";
     if ($ctr == 0) {      if ($ctr == 0) {
  $gradeTable='<br />&nbsp;<font color="red">'.   my $num_students=(scalar(keys(%$fullname)));
     'No submission found for this resource.</font><br />';   if ($num_students eq 0) {
       $gradeTable='<br />&nbsp;<font color="red">There are no students currently enrolled.</font>';
    } else {
       $gradeTable='<br />&nbsp;<font color="red">'.
    'No submissions found for this resource for any students. ('.$num_students.' checked for submissions</font><br />';
    }
     } elsif ($ctr == 1) {      } elsif ($ctr == 1) {
  $gradeTable =~ s/type=checkbox/type=checkbox checked/;   $gradeTable =~ s/type=checkbox/type=checkbox checked/;
     }      }
Line 1045  sub submission { Line 1058  sub submission {
   
     (my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;      (my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
     my ($uname,$udom)     = ($ENV{'form.student'},$ENV{'form.userdom'});      my ($uname,$udom)     = ($ENV{'form.student'},$ENV{'form.userdom'});
     ($uname,$udom)        = &finduser($uname) if $udom eq '';      my $usec = &Apache::lonnet::getsection($udom,$uname,$ENV{'request.course.id'});
     $ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq '';      $ENV{'form.fullname'} = &get_fullname ($uname,$udom) if $ENV{'form.fullname'} eq '';
   
     my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));      my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
     if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }      if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
   
       if (!&canview($usec)) {
    $request->print('<font color="red">Unable to view requested student.('.$uname.$udom.$usec.$ENV{'request.course.id'}.')</font>');
    $request->print(&show_grading_menu_form($symb,$url));
    return;
       }
   
     my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');      my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
   
     # header info      # header info
Line 1283  KEYWORDS Line 1303  KEYWORDS
     }      }
           
     # return if view submission with no grading option      # return if view submission with no grading option
     if ($ENV{'form.showgrading'} eq '') {      if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) {
  $request->print('</td></tr></table></td></tr></table></form>'."\n");   $request->print('</td></tr></table></td></tr></table></form>'."\n");
  $request->print(&show_grading_menu_form($symb,$url))    $request->print(&show_grading_menu_form($symb,$url)) 
     if (($ENV{'form.command'} eq 'submission') ||       if (($ENV{'form.command'} eq 'submission') || 
Line 1427  sub processHandGrade { Line 1447  sub processHandGrade {
  $ctr++;   $ctr++;
  next;   next;
     }      }
       if ($errorflag eq 'not_allowed') {
    $request->print("<font color=\"red\">Not allowed to modify grades for $uname:$udom</font>");
    $ctr++;
    next;
       }
     my $includemsg = $ENV{'form.includemsg'.$ctr};      my $includemsg = $ENV{'form.includemsg'.$ctr};
     my ($subject,$message,$msgstatus) = ('','','');      my ($subject,$message,$msgstatus) = ('','','');
     if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {      if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
Line 1446  sub processHandGrade { Line 1471  sub processHandGrade {
     if ($ENV{'form.collaborator'.$ctr}) {      if ($ENV{'form.collaborator'.$ctr}) {
  my (@collaborators) = split(/:/,$ENV{'form.collaborator'.$ctr});   my (@collaborators) = split(/:/,$ENV{'form.collaborator'.$ctr});
  foreach (@collaborators) {   foreach (@collaborators) {
     &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,      my ($errorflag,$pts,$wgt) = &saveHandGrade($request,$url,$symb,$_,$udom,$ctr,$ENV{'form.unamedom'.$ctr});
    $ENV{'form.unamedom'.$ctr});      if ($errorflag eq 'not_allowed') {
     if ($message ne '') {   $request->print("<font color=\"red\">Not allowed to modify grades for $_:$udom</font>");
  $msgstatus = &Apache::lonmsg::user_normal_msg ($_,$udom,   next;
        $ENV{'form.msgsub'},      } else {
        $message);   if ($message ne '') {
       $msgstatus = &Apache::lonmsg::user_normal_msg ($_,$udom,
      $ENV{'form.msgsub'},
      $message);
    }
     }      }
  }   }
     }      }
Line 1584  sub processHandGrade { Line 1613  sub processHandGrade {
 #---- Save the score and award for each student, if changed  #---- Save the score and award for each student, if changed
 sub saveHandGrade {  sub saveHandGrade {
     my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;      my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter) = @_;
       my $usec = &Apache::lonnet::getsection($domain,$stuname,
      $ENV{'request.course.id'});
       if (!&canmodify($usec)) { return('not_allowed'); }
     my %record     = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);      my %record     = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$domain,$stuname);
     my %newrecord  = ();      my %newrecord  = ();
     my ($pts,$wgt) = ('','');      my ($pts,$wgt) = ('','');
Line 1924  sub viewgrades { Line 1956  sub viewgrades {
     $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";      $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
     $result.='<input type="button" value="Submit Changes" '.      $result.='<input type="button" value="Submit Changes" '.
  'onClick="javascript:submit();" TARGET=_self /></form>'."\n";   'onClick="javascript:submit();" TARGET=_self /></form>'."\n";
       if (scalar(%$fullname) eq 0) {
    my $colspan=3+scalar(@parts);
    $result='<font color="red">There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.status'}.'" to modify or grade.</font>';
       }
     $result.=&show_grading_menu_form($symb,$url);      $result.=&show_grading_menu_form($symb,$url);
     return $result;      return $result;
 }  }
Line 2386  sub csvuploadassign { Line 2422  sub csvuploadassign {
     }      }
     $request->print('<h3>Assigning Grades</h3>');      $request->print('<h3>Assigning Grades</h3>');
     my $courseid=$ENV{'request.course.id'};      my $courseid=$ENV{'request.course.id'};
     my ($classlist) = &getclasslist('all','1');      my ($classlist) = &getclasslist('all',0);
     my @skipped;      my @skipped;
     my $countdone=0;      my $countdone=0;
     foreach my $grade (@gradedata) {      foreach my $grade (@gradedata) {
Line 2418  sub csvuploadassign { Line 2454  sub csvuploadassign {
  $request->print('<br /><font size="+1"><b>Skipped Students</b></font><br />');   $request->print('<br /><font size="+1"><b>Skipped Students</b></font><br />');
  foreach my $student (@skipped) { $request->print("<br />$student"); }   foreach my $student (@skipped) { $request->print("<br />$student"); }
     }      }
     $request->print(&view_edit_entire_class_form($symb,$url));  
     $request->print(&show_grading_menu_form($symb,$url));      $request->print(&show_grading_menu_form($symb,$url));
     return '';      return '';
 }  }
Line 2515  LISTJAVASCRIPT Line 2550  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 2589  sub getSymbMap { Line 2625  sub getSymbMap {
     my $countProblems = 0;      my $countProblems = 0;
     $mapiterator->next(); # skip the first BEGIN_MAP      $mapiterator->next(); # skip the first BEGIN_MAP
     my $mapcurRes = $mapiterator->next(); # for "current resource"      my $mapcurRes = $mapiterator->next(); # for "current resource"
     my $ctr=0;      while ($mapdepth > 0) {
     while ($mapdepth > 0 && $ctr < 100) {  
  if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; }   if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; }
  if($mapcurRes == $mapiterator->END_MAP) { $mapdepth++; }   if($mapcurRes == $mapiterator->END_MAP) { $mapdepth--; }
   
  if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) {   if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) {
     $countProblems++;      $countProblems++;
  }   }
  $ctr++;   $mapcurRes = $mapiterator->next();
     }      }
     if ($countProblems > 0) {      if ($countProblems > 0) {
  my $title = $curRes->compTitle();   my $title = $curRes->compTitle();
Line 2623  sub displayPage { Line 2658  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">&nbsp;'.$ENV{'form.title'}.'</font></h3>';      my $result='<h3><font color="#339933">&nbsp;'.$ENV{'form.title'}.'</font></h3>';
     $result.='<h3>&nbsp;Student: '.$$fullname{$ENV{'form.student'}}.      $result.='<h3>&nbsp;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 2660  sub displayPage { Line 2700  sub displayPage {
  '<td align="center"><b>&nbsp;No&nbsp;</b></td>'.   '<td align="center"><b>&nbsp;No&nbsp;</b></td>'.
  '<td><b>&nbsp;'.($ENV{'form.vProb'} eq 'no' ? 'Title' : 'Problem View').'/Grade</b></td></tr>';   '<td><b>&nbsp;'.($ENV{'form.vProb'} eq 'no' ? 'Title' : 'Problem View').'/Grade</b></td></tr>';
   
     my ($depth,$ctr,$question) = (1,0,1);      my ($depth,$question) = (1,1);
     $iterator->next(); # skip the first BEGIN_MAP      $iterator->next(); # skip the first BEGIN_MAP
     my $curRes = $iterator->next(); # for "current resource"      my $curRes = $iterator->next(); # for "current resource"
     while ($depth > 0 && $ctr < 100) { # ctr, just in case it never gets out of loop      while ($depth > 0) {
         if($curRes == $iterator->BEGIN_MAP) { $depth++; }          if($curRes == $iterator->BEGIN_MAP) { $depth++; }
         if($curRes == $iterator->END_MAP) { $depth++; }          if($curRes == $iterator->END_MAP) { $depth--; }
   
         if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {          if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {
     my $parts = $curRes->parts();      my $parts = $curRes->parts();
Line 2738  sub displayPage { Line 2778  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();
  $ctr++;  
     }      }
   
       $navmap->untieHashes();
   
     $studentTable.='</td></tr></table></td></tr></table>'."\n".      $studentTable.='</td></tr></table></td></tr></table>'."\n".
  '&nbsp;&nbsp;<input type="button" value="Save" '.   '&nbsp;&nbsp;<input type="button" value="Save" '.
  'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'.   'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'.
Line 2768  sub updateGradeByPage { Line 2810  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">&nbsp;'.$ENV{'form.title'}.'</font></h3>';      my $result='<h3><font color="#339933">&nbsp;'.$ENV{'form.title'}.'</font></h3>';
     $result.='<h3>&nbsp;Student: '.$$fullname{$ENV{'form.student'}}.      $result.='<h3>&nbsp;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 2794  sub updateGradeByPage { Line 2841  sub updateGradeByPage {
   
     $iterator->next(); # skip the first BEGIN_MAP      $iterator->next(); # skip the first BEGIN_MAP
     my $curRes = $iterator->next(); # for "current resource"      my $curRes = $iterator->next(); # for "current resource"
     my ($depth,$ctr,$question,$changeflag)= (1,0,1,0);      my ($depth,$question,$changeflag)= (1,1,0);
     while ($depth > 0 && $ctr < 100) { # ctr, just in case it never gets out of loop      while ($depth > 0) {
         if($curRes == $iterator->BEGIN_MAP) { $depth++; }          if($curRes == $iterator->BEGIN_MAP) { $depth++; }
         if($curRes == $iterator->END_MAP) { $depth++; }          if($curRes == $iterator->END_MAP) { $depth--; }
   
         if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {          if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {
     my $parts = $curRes->parts();      my $parts = $curRes->parts();
Line 2857  sub updateGradeByPage { Line 2904  sub updateGradeByPage {
   
  }   }
         $curRes = $iterator->next();          $curRes = $iterator->next();
  $ctr++;  
     }      }
   
       $navmap->untieHashes();
   
     $studentTable.='</td></tr></table></td></tr></table>';      $studentTable.='</td></tr></table></td></tr></table>';
     $studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});      $studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});
     my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :      my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :
Line 3387  GRADINGMENUJS Line 3435  GRADINGMENUJS
   
 sub handler {  sub handler {
     my $request=$_[0];      my $request=$_[0];
       
       undef(%perm);
     if ($ENV{'browser.mathml'}) {      if ($ENV{'browser.mathml'}) {
  $request->content_type('text/xml');   $request->content_type('text/xml');
     } else {      } else {
Line 3416  sub handler { Line 3465  sub handler {
  if ($tsymb) {   if ($tsymb) {
     my ($map,$id,$url)=split(/\_\_\_/,$tsymb);      my ($map,$id,$url)=split(/\_\_\_/,$tsymb);
     if (&Apache::lonnet::allowed('mgr',$tcrsid)) {      if (&Apache::lonnet::allowed('mgr',$tcrsid)) {
  $request->print(   $request->print(&Apache::lonnet::ssi_body('/res/'.$url,
  &Apache::lonnet::ssi('/res/'.$url,    ('grade_username' => $tuname,
      ('grade_username' => $tuname,     'grade_domain' => $tudom,
       'grade_domain' => $tudom,     'grade_courseid' => $tcrsid,
       'grade_courseid' => $tcrsid,     'grade_symb' => $tsymb)));
       'grade_symb' => $tsymb)));  
     } else {      } else {
  $request->print('<h3>Not authorized: '.$token.'</h3>');   $request->print('<h3>Not authorized: '.$token.'</h3>');
     }                 }
  } else {   } else {
     $request->print('<h3>Not a valid DocID: '.$token.'</h3>');      $request->print('<h3>Not a valid DocID: '.$token.'</h3>');
  }   }
Line 3433  sub handler { Line 3481  sub handler {
     }      }
  }   }
     } else {      } else {
  $Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});   if (!($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}))) {
  if ($command eq 'submission') {      if ($perm{'vgr'}=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) {
    $perm{'vgr_section'}=$ENV{'request.course.sec'};
       } else {
    delete($perm{'vgr'});
       }
    }
    if (!($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}))) {
       if ($perm{'mgr'}=&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}.'/'.$ENV{'request.course.sec'})) {
    $perm{'mgr_section'}=$ENV{'request.course.sec'};
       } else {
    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));      ($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' && $perm{'mgr'}) {
     &updateGradeByPage($request);      &updateGradeByPage($request);
  } elsif ($command eq 'processGroup') {   } elsif ($command eq 'processGroup' && $perm{'vgr'}) {
     &processGroup($request);      &processGroup($request);
  } elsif ($command eq 'gradingmenu') {   } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
     $request->print(&gradingmenu($request));      $request->print(&gradingmenu($request));
  } elsif ($command eq 'viewgrades') {   } elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
     $request->print(&viewgrades($request));      $request->print(&viewgrades($request));
  } elsif ($command eq 'handgrade') {   } elsif ($command eq 'handgrade' && $perm{'mgr'}) {
     $request->print(&processHandGrade($request));      $request->print(&processHandGrade($request));
  } elsif ($command eq 'editgrades') {   } elsif ($command eq 'editgrades') {
     $request->print(&editgrades($request));      $request->print(&editgrades($request));

Removed from v.1.93  
changed lines
  Added in v.1.104


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>