Diff for /loncom/interface/Attic/lonchart.pm between versions 1.57 and 1.58

version 1.57, 2002/07/08 15:03:25 version 1.58, 2002/07/08 16:50:03
Line 245  sub FormatStudentData { Line 245  sub FormatStudentData {
     my $problem = $CacheData{$problemID.':problem'};      my $problem = $CacheData{$problemID.':problem'};
     my $LatestVersion = $CacheData{$name.":version:$problem"};      my $LatestVersion = $CacheData{$name.":version:$problem"};
   
               # Output blanks for all the parts of this problem if there
               # is no version information about the current problem.
             if(!$LatestVersion) {              if(!$LatestVersion) {
                 foreach my $part (split(/\:/,$CacheData{$sequence.':'.                  foreach my $part (split(/\:/,$CacheData{$sequence.':'.
                                                         $problemID.                                                          $problemID.
Line 257  sub FormatStudentData { Line 259  sub FormatStudentData {
             }              }
   
             my %partData=undef;              my %partData=undef;
             #initialize data, displays skips correctly              # Initialize part data, display skips correctly
               # Skip refers to when a student made no submissions on that
               # part/problem.
             foreach my $part (split(/\:/,$CacheData{$sequence.':'.              foreach my $part (split(/\:/,$CacheData{$sequence.':'.
                                                     $problemID.                                                      $problemID.
                                                     ':parts'})) {                                                      ':parts'})) {
                 $partData{$part.':tries'}=0;                  $partData{$part.':tries'}=0;
                 $partData{$part.':code'}=' ';                  $partData{$part.':code'}=' ';
             }              }
   
               # Looping through all the versions of each part, starting with the
               # oldest version.  Basically, it gets the most recent 
               # set of grade data for each part.
     for(my $Version=1; $Version<=$LatestVersion; $Version++) {      for(my $Version=1; $Version<=$LatestVersion; $Version++) {
                 foreach my $part (split(/\:/,$CacheData{$sequence.':'.                  foreach my $part (split(/\:/,$CacheData{$sequence.':'.
                                                         $problemID.                                                          $problemID.
Line 271  sub FormatStudentData { Line 279  sub FormatStudentData {
   
                     if(!defined($CacheData{$name.":$Version:$problem".                      if(!defined($CacheData{$name.":$Version:$problem".
                                                ":resource.$part.solved"})) {                                                 ":resource.$part.solved"})) {
                           # No grade for this submission, so skip
                         next;                          next;
                     }                      }
   
Line 294  sub FormatStudentData { Line 303  sub FormatStudentData {
                 }                  }
             }              }
   
               # All grades (except for versionless parts) are displayed as links
               # to their submission record.  Loop through all the parts for the
               # current problem in the correct order and prepare the output links
             $Str.='<a href="/adm/grades?symb='.              $Str.='<a href="/adm/grades?symb='.
                 &Apache::lonnet::escape($problem).                  &Apache::lonnet::escape($problem).
                 '&student='.$sname.'&domain='.$sdom.'&command=submission">';                   '&student='.$sname.'&domain='.$sdom.'&command=submission">'; 
Line 319  sub FormatStudentData { Line 331  sub FormatStudentData {
             $Str.='</a>';              $Str.='</a>';
         }          }
   
           # Output the number of correct answers for the current sequence.
           # This part takes up 6 character slots, but is formated right 
           # justified.
         my $spacesNeeded=$CacheData{$sequence.':columnWidth'}-$characterCount;          my $spacesNeeded=$CacheData{$sequence.':columnWidth'}-$characterCount;
         $spacesNeeded -= 3;          $spacesNeeded -= 3;
         $Str .= (' 'x$spacesNeeded);          $Str .= (' 'x$spacesNeeded);
Line 331  sub FormatStudentData { Line 346  sub FormatStudentData {
         $Str .= $spacePadding;          $Str .= $spacePadding;
     }      }
   
       # Output the total correct problems over the total number of problems.
       # I don't like this type of formatting, but it is a solution.  Need
       # a way to dynamically determine the space requirements.
     my $outputProblemsSolved = sprintf( "%4d", $problemsSolved );      my $outputProblemsSolved = sprintf( "%4d", $problemsSolved );
     my $outputTotalProblems  = sprintf( "%4d", $totalProblems );      my $outputTotalProblems  = sprintf( "%4d", $totalProblems );
     $Str .= '<font color="#000088">'.$outputProblemsSolved.      $Str .= '<font color="#000088">'.$outputProblemsSolved.
Line 843  sub ProcessTopResourceMap { Line 861  sub ProcessTopResourceMap {
  return 'Could not tie cache hash.';   return 'Could not tie cache hash.';
     }      }
   
       # Initialize state machine.  Set information pointing to top level map.
     my (@sequences, @currentResource, @finishResource);      my (@sequences, @currentResource, @finishResource);
     my ($currentSequence, $currentResourceID, $lastResourceID);      my ($currentSequence, $currentResourceID, $lastResourceID);
   
Line 911  sub ProcessTopResourceMap { Line 930  sub ProcessTopResourceMap {
     ':'.$currentResourceID;      ':'.$currentResourceID;
     }      }
   
             #Get Parts for problem              # Get Parts for problem
     my $meta=$hash{'src_'.$currentResourceID};      my $meta=$hash{'src_'.$currentResourceID};
     foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {      foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {
  if($_=~/^stores\_(\d+)\_tries$/) {   if($_=~/^stores\_(\d+)\_tries$/) {
Line 928  sub ProcessTopResourceMap { Line 947  sub ProcessTopResourceMap {
     }      }
  }   }
   
  #if resource == finish resource   # if resource == finish resource, then it is the end of a sequence/page
  if($currentResourceID eq $lastResourceID) {   if($currentResourceID eq $lastResourceID) {
     #pop off last resource of sequence      # pop off last resource of sequence
     $currentResourceID=pop(@currentResource);      $currentResourceID=pop(@currentResource);
     $lastResourceID=pop(@finishResource);      $lastResourceID=pop(@finishResource);
   
Line 962  sub ProcessTopResourceMap { Line 981  sub ProcessTopResourceMap {
                         (scalar @titleLength);                          (scalar @titleLength);
  }   }
     } else {      } else {
                   # Remove sequence from list, if it contains no problems to
                   # display.
                 $CacheData{'orderedSequences'}=~s/$currentSequence//;                  $CacheData{'orderedSequences'}=~s/$currentSequence//;
                 $CacheData{'orderedSequences'}=~s/::/:/g;                  $CacheData{'orderedSequences'}=~s/::/:/g;
                 $CacheData{'orderedSequences'}=~s/^:|:$//g;                  $CacheData{'orderedSequences'}=~s/^:|:$//g;
Line 974  sub ProcessTopResourceMap { Line 995  sub ProcessTopResourceMap {
  }   }
   
  # MOVE!!!   # MOVE!!!
  #move to next resource   # move to next resource
  unless(defined($hash{'to_'.$currentResourceID})) {   unless(defined($hash{'to_'.$currentResourceID})) {
     # big problem, need to handle.  Next is probably wrong      # big problem, need to handle.  Next is probably wrong
     last;      last;
Line 1302  Output: None Line 1323  Output: None
   
 =cut  =cut
   
   # For all data, if ENV data doesn't exist for it, default values is used.
 sub ProcessFormData {  sub ProcessFormData {
     my ($ChartDB, $isCached)=@_;      my ($ChartDB, $isCached)=@_;
     my %CacheData;      my %CacheData;
   
     if(tie(%CacheData,'GDBM_File',$ChartDB,&GDBM_WRCREAT,0640)) {      if(tie(%CacheData,'GDBM_File',$ChartDB,&GDBM_WRCREAT,0640)) {
           # Ignore $ENV{'form.refresh'}
           # Ignore $ENV{'form.recalculate'}
   
         if(defined($ENV{'form.sort'})) {          if(defined($ENV{'form.sort'})) {
             $CacheData{'form.sort'}=$ENV{'form.sort'};              $CacheData{'form.sort'}=$ENV{'form.sort'};
         } elsif(!defined($CacheData{'form.sort'})) {          } elsif(!defined($CacheData{'form.sort'})) {
             $CacheData{'form.sort'}='username';              $CacheData{'form.sort'}='username';
         }          }
   
         # Ignore $ENV{'form.refresh'}  
         # Ignore $ENV{'form.recalculate'}  
   
         if(defined($ENV{'form.status'})) {          if(defined($ENV{'form.status'})) {
             $CacheData{'form.status'}=$ENV{'form.status'};              $CacheData{'form.status'}=$ENV{'form.status'};
         } elsif(!defined($CacheData{'form.status'})) {          } elsif(!defined($CacheData{'form.status'})) {
             $CacheData{'form.status'}='Active';              $CacheData{'form.status'}='Active';
         }          }
   
           # $found checks for any instances of form data in the ENV.  If it is
           # missing I assume the chrt button on the remote has been pressed.
         my @headings=();          my @headings=();
         my @sequences=();          my @sequences=();
         my $found=0;          my $found=0;
Line 1355  sub ProcessFormData { Line 1379  sub ProcessFormData {
             }              }
         }          }
   
           # !$found and !$isCached are how I determine if the chrt button
           # on the remote was pressed and needs to reset all the selections
         if(defined($ENV{'form.reset'}) || (!$found && !$isCached)) {          if(defined($ENV{'form.reset'}) || (!$found && !$isCached)) {
             $CacheData{'form.reset'}='true';              $CacheData{'form.reset'}='true';
             $CacheData{'form.status'}='Active';              $CacheData{'form.status'}='Active';
Line 1442  jobs. Line 1468  jobs.
 =item &ProcessFullName()  =item &ProcessFullName()
   
 Takes lastname, generation, firstname, and middlename (or some partial  Takes lastname, generation, firstname, and middlename (or some partial
 set of this data) and returns the full name version as a string.  set of this data) and returns the full name version as a string.  Format
   is Lastname generation, firstname middlename or a subset of this.
   
 =cut  =cut
   
Line 1870  sub handler { Line 1897  sub handler {
         $r->send_http_header;          $r->send_http_header;
         return OK;          return OK;
     }      }
       
     unless($ENV{'request.course.fn'}) {      unless($ENV{'request.course.fn'}) {
         my $requrl=$r->uri;          my $requrl=$r->uri;
         $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";          $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";

Removed from v.1.57  
changed lines
  Added in v.1.58


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