Diff for /loncom/homework/grades.pm between versions 1.99 and 1.102

version 1.99, 2003/06/18 17:37:10 version 1.102, 2003/06/20 17:25:48
Line 147  sub getclasslist { Line 147  sub getclasslist {
     return ($classlist,\@sections,\%fullnames);      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'});  
     }  
 }  
   
 #--- 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('<form action="/adm/grades" method="post">'."\n");  
  if ($ENV{'form.url'}) {  
     $request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />'."\n");  
  }  
  if ($ENV{'form.symb'}) {  
     $request->print('<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />'."\n");  
  }  
  $request->print('<input type="hidden" name="command" value="'.$ENV{'form.command'}.'" />'."\n");  
  $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 '';  
 }  
   
 #--- 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 1050  sub submission { Line 1013  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 '';  
     $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)));
Line 2597  sub getSymbMap { Line 2560  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) {
  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++;
Line 2668  sub displayPage { Line 2630  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 2756  sub displayPage { Line 2718  sub displayPage {
   
        }         }
         $curRes = $iterator->next();          $curRes = $iterator->next();
  $ctr++;  
     }      }
   
     $navmap->untieHashes();      $navmap->untieHashes();
Line 2804  sub updateGradeByPage { Line 2765  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 2867  sub updateGradeByPage { Line 2828  sub updateGradeByPage {
   
  }   }
         $curRes = $iterator->next();          $curRes = $iterator->next();
  $ctr++;  
     }      }
   
     $navmap->untieHashes();      $navmap->untieHashes();
Line 3399  GRADINGMENUJS Line 3359  GRADINGMENUJS
   
 sub handler {  sub handler {
     my $request=$_[0];      my $request=$_[0];
       
       undef(%Apache::grades::perm);
     if ($ENV{'browser.mathml'}) {      if ($ENV{'browser.mathml'}) {
  $request->content_type('text/xml');   $request->content_type('text/xml');
     } else {      } else {
Line 3444  sub handler { Line 3405  sub handler {
     }      }
  }   }
     } else {      } else {
  $Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});   if (!($Apache::grades::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'})) {
    $Apache::grades::perm{'vgr_section'}=$ENV{'request.course.sec'};
       } else {
    delete($Apache::grades::perm{'vgr'});
       }
    }
    if (!($Apache::grades::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'})) {
    $Apache::grades::perm{'mgr_section'}=$ENV{'request.course.sec'};
       } else {
    delete($Apache::grades::perm{'mgr'});
       }
    }
   
  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') {

Removed from v.1.99  
changed lines
  Added in v.1.102


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