Diff for /loncom/interface/Attic/lonchart.pm between versions 1.30 and 1.32

version 1.30, 2002/02/19 18:58:10 version 1.32, 2002/02/28 01:49:33
Line 88  sub ExtractStudentData { Line 88  sub ExtractStudentData {
             substr($rowlabels[$index].              substr($rowlabels[$index].
             '                                                        ',0,45).' ! ';              '                                                        ',0,45).' ! ';
     unless ($reply=~/^error\:/) {      unless ($reply=~/^error\:/) {
         map {          foreach (split(/\&/,$reply)) {
             my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_));              my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_));
             $result{$name}=$value;              $result{$name}=$value;
         } split(/\&/,$reply);          }
  $ProbNo = 0;   $ProbNo = 0;
  $ProbTotal = 0;   $ProbTotal = 0;
         $ProbSolved = 0;          $ProbSolved = 0;
Line 109  sub ExtractStudentData { Line 109  sub ExtractStudentData {
     my $meta=$hash{'src_'.$ResId};      my $meta=$hash{'src_'.$ResId};
     my $PartNo = 0;      my $PartNo = 0;
     undef %TempHash;      undef %TempHash;
     map {      foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {
  if ($_=~/^stores\_(\d+)\_tries$/) {   if ($_=~/^stores\_(\d+)\_tries$/) {
                     my $Part=&Apache::lonnet::metadata($meta,$_.'.part');                      my $Part=&Apache::lonnet::metadata($meta,$_.'.part');
     if ( $TempHash{"$Part"} eq '' ) {       if ( $TempHash{"$Part"} eq '' ) { 
Line 119  sub ExtractStudentData { Line 119  sub ExtractStudentData {
  $PartNo++;   $PartNo++;
     }      }
  }   }
             } split(/\,/,&Apache::lonnet::metadata($meta,'keys'));              }
   
             my $Prob = &Apache::lonnet::declutter( $hash{'map_id_'.$1} ).              my $Prob = &Apache::lonnet::declutter( $hash{'map_id_'.$1} ).
                        '___'.$2.'___'.                         '___'.$2.'___'.
Line 217  sub tracetable { Line 217  sub tracetable {
           }            }
        }         }
        if (defined($hash{'to_'.$rid})) {         if (defined($hash{'to_'.$rid})) {
           map {            foreach (split(/\,/,$hash{'to_'.$rid})){
               &tracetable($hash{'goesto_'.$_},$beenhere);                &tracetable($hash{'goesto_'.$_},$beenhere);
           } split(/\,/,$hash{'to_'.$rid});            }
        }         }
     }      }
 }  }
Line 239  sub BuildChart { Line 239  sub BuildChart {
                             ('dump:'.$cdom.':'.$cnum.':classlist',$chome);                              ('dump:'.$cdom.':'.$cnum.':classlist',$chome);
  my $now=time;   my $now=time;
  unless ($classlst=~/^error\:/) {   unless ($classlst=~/^error\:/) {
     map {      foreach my $KeyPoint(sort split(/\&/,$classlst)) {
  my ($name,$value)=split(/\=/,$_);   my ($name,$value)=split(/\=/,$KeyPoint);
  my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));   my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));
  my $active=1;   my $active=1;
  if (($end) && ($now>$end)) { $active=0; }   if (($end) && ($now>$end)) { $active=0; }
Line 260  sub BuildChart { Line 260  sub BuildChart {
                                      ':environment:lastname&generation&firstname&middlename',                                       ':environment:lastname&generation&firstname&middlename',
                                                  &Apache::lonnet::homeserver($sname,$sdom));                                                   &Apache::lonnet::homeserver($sname,$sdom));
  #$ssec=(int($ssec)) ? int($ssec) : $ssec;   #$ssec=(int($ssec)) ? int($ssec) : $ssec;
  $rowlabels[$thisindex]=   my $sec=sprintf('%3s',$ssec);
     sprintf('%3s',$ssec).' '.$reply{$sname}.' ';   $rowlabels[$thisindex]=$sec.' '.$reply{$sname}.' ';
  $PreCol[$thisindex] .= $reply.':'.$ssec;   $PreCol[$thisindex] .= $reply.':'.$sec;
  my $i=0;   my $i=0;
  map {   foreach (split(/\&/,$reply)) {
     $i++;      $i++;
     if ( $_ ne '') {      if ( $_ ne '') {
  $rowlabels[$thisindex].=&Apache::lonnet::unescape($_).' ';   $rowlabels[$thisindex].=&Apache::lonnet::unescape($_).' ';
Line 273  sub BuildChart { Line 273  sub BuildChart {
  chop($rowlabels[$thisindex]);   chop($rowlabels[$thisindex]);
  $rowlabels[$thisindex].=', ';   $rowlabels[$thisindex].=', ';
     }      }
  } split(/\&/,$reply);   }
     }      }
  }   }
     } sort split(/\&/,$classlst);      }
   
  } else {   } else {
     $r->print('<h1>Could not access course data</h1>');      $r->print('<h1>Could not access course data</h1>');
Line 321  sub CreateForm { Line 321  sub CreateForm {
 }  }
   
 sub CacheChart {  sub CacheChart {
     my @list = ();      my %list = ();
     my $count=0;      my $count=0;
   
     my $Pos = $ENV{'form.sort'};      my $Pos = $ENV{'form.sort'};
Line 332  sub CacheChart { Line 332  sub CacheChart {
     foreach my $key( keys %CachData) {       foreach my $key( keys %CachData) { 
  my @Temp=split(/\:/,$key);   my @Temp=split(/\:/,$key);
  my $Use = $Temp[$Pos];   my $Use = $Temp[$Pos];
  $list[$count]=$Use.$key.'*'.$CachData{$key};   $list{$Use.$key}=$key;
  $count++;   $count++;
     }      }
   
     @list = sort (@list);      my @order = sort(keys(%list));
   
     $r->print('<h3>'.$count.' students</h3>');      $r->print('<h3>'.$count.' students</h3>');
     &CreateForm();      &CreateForm();
Line 344  sub CacheChart { Line 344  sub CacheChart {
           
     $r->print('<p><pre>');      $r->print('<p><pre>');
     for ( my $n; $n < $count; $n++) {      for ( my $n; $n < $count; $n++) {
  my ($dummy, $Line) = split(/\*/,$list[$n]);   $r->print($CachData{$list{$order[$n]}}.'<br>');
  $r->print($Line.'<br>');  
     }      }
     $r->print('</pre>');      $r->print('</pre>');
 }  }

Removed from v.1.30  
changed lines
  Added in v.1.32


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