Diff for /loncom/interface/lonprintout.pm between versions 1.63 and 1.64

version 1.63, 2002/09/12 15:25:49 version 1.64, 2002/09/12 18:28:45
Line 371  ENDPART Line 371  ENDPART
  my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'});   my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'});
  $symbolic =~ m/([^_]+)_/;   $symbolic =~ m/([^_]+)_/;
  my $primary_sequence = '/res/'.$1;   my $primary_sequence = '/res/'.$1;
         #-- open and analyses the primary sequence  
  my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence);  
  my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file);  
  my @master_seq = &coming_from_hash($primary_sequence);    my @master_seq = &coming_from_hash($primary_sequence); 
         #-- produce an output string          #-- produce an output string
  for (my $i=0;$i<=$#master_seq;$i++) {   for (my $i=0;$i<=$#master_seq;$i++) {
Line 403  ENDPART Line 400  ENDPART
         # where is the main sequence of the course?          # where is the main sequence of the course?
  $selectionmade = 4;   $selectionmade = 4;
  my $main_seq = '/res/'.$ENV{'request.course.uri'};   my $main_seq = '/res/'.$ENV{'request.course.uri'};
  my $file=&Apache::lonnet::filelocation("",$main_seq);   my @file_seq = &coming_from_hash($main_seq); 
  my $filecontents=&Apache::lonnet::getfile($file);  
  my @file_seq = &content_map($filecontents);  
  for (my $iu=0;$iu<=$#file_seq;$iu++) {  
     $file_seq[$iu]=~s/^"//;  
     $file_seq[$iu]=~s/"$//;  
     if ($file_seq[$iu]=~m/\S+/) {  
  $file_seq[$iu]=&Apache::lonnet::filelocation("",$file_seq[$iu]);  
     } else {  
  $file_seq[$iu]= 'REMOVE IT PLEASE';  
     }  
  }  
  my $i=0;  
         my $limit = $#file_seq;      
         while ($i<=$limit) {  
     unless ($file_seq[$i]=~m/\.(problem|page)/) {  
  if ($file_seq[$i]=~m/\.sequence/) {  
     my $filecontents=&Apache::lonnet::getfile($file_seq[$i]);  
     my @newfile_seq = &content_map($filecontents);  
     for (my $iu=0;$iu<=$#newfile_seq;$iu++) {  
  $newfile_seq[$iu]=~s/^"//;  
                 $newfile_seq[$iu]=~s/"$//;  
  if ($newfile_seq[$iu]=~m/\S+/) {  
     $newfile_seq[$iu]=&Apache::lonnet::filelocation("",$newfile_seq[$iu]);  
  } else {  
     $newfile_seq[$iu]= 'REMOVE IT PLEASE';  
  }  
     }  
     splice @file_seq,$i,1,@newfile_seq;  
     $i=0;  
     $limit = $#file_seq;  
  } else {  
     splice @file_seq,$i,1,'REMOVE IT PLEASE';  
  }  
     }  
     $i++;  
  }  
  for (my $iu=0;$iu<=$#file_seq;$iu++) {  
     if ($file_seq[$iu]=~m/REMOVE IT PLEASE/) {  
  splice @file_seq,$iu,1;  
     }  
  }  
  if ($file_seq[-1]=~m/REMOVE IT PLEASE/) {  
     pop @file_seq;  
  }  
         #-- produce an output string          #-- produce an output string
  for (my $i=0;$i<=$#file_seq;$i++) {   for (my $i=0;$i<=$#file_seq;$i++) {
             my $urlp = $file_seq[$i];              my $urlp = $file_seq[$i];
Line 475  ENDPART Line 428  ENDPART
  my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'});   my $symbolic = &Apache::lonnet::symbread($ENV{'form.url'});
  $symbolic =~ m/([^_]+)_/;   $symbolic =~ m/([^_]+)_/;
  my $primary_sequence = '/res/'.$1;   my $primary_sequence = '/res/'.$1;
  #opens and analyses the primary sequence file, produces the array of resources   my @master_seq = &coming_from_hash($primary_sequence); 
  my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence);  
  my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file);  
  my @master_seq = &content_map($sequencefilecontents);  
        #loop over students         #loop over students
  foreach my $person (@students) {   foreach my $person (@students) {
     my $current_output = '';       my $current_output = ''; 
Line 975  sub page_cleanup { Line 925  sub page_cleanup {
     return $result,$number_of_columns;      return $result,$number_of_columns;
 }  }
   
 sub content_map {  
 #-- find a list of files to print  
     my $map_string = shift;  
     my @number_seq = ();  
     my @file_seq = ();  
     my $startlink = index($map_string,'<link',0);  
     my $endlink = index($map_string,'</link>',$startlink);  
     my $chunk = substr($map_string,$startlink,$endlink-$startlink+7);  
     $_ = $chunk;  
     m/from=\"(\d+)\"/;  
     push @number_seq,$1;  
     while ($startlink != -1) {  
  $endlink = index($map_string,'</link>',$startlink);  
  $chunk = substr($map_string,$startlink,$endlink-$startlink+7);  
  substr($map_string,$startlink,$endlink-$startlink+7) = '';  
  $_ = $chunk;  
         m/to=\"(\d+)\"/;  
  push @number_seq,$1;  
  $startlink = index($map_string,'from="'.$1.'"',0);  
  $startlink = rindex($map_string,'<link ',$startlink);  
     }  
     my $stalink = index($map_string,' to="'.$number_seq[0].'"',0);  
     while ($stalink != -1) {  
  $startlink = rindex($map_string,'<link ',$stalink);  
  $endlink = index($map_string,'</link>',$startlink);  
  $chunk = substr($map_string,$startlink,$endlink-$startlink+7);  
  substr($map_string,$startlink,$endlink-$startlink+7) = '';  
  $_ = $chunk;  
         m/from=\"(\d+)\"/;  
  unshift @number_seq,$1;  
  $stalink = index($map_string,' to="'.$number_seq[0].'"',0);  
     }  
     for (my $i=0;$i<=$#number_seq;$i++) {  
  $stalink = index($map_string,' id="'.$number_seq[$i].'"',0);  
         {      
     my $ahed1 = index($map_string,'src="',$stalink);  
     my $ahed2 = index($map_string,'</resource>',$stalink);  
     if ($ahed1 != -1) {  
  if ($ahed1 < $ahed2) {  
     $startlink = $ahed1;  
  } else {  
     $startlink = rindex($map_string,'src="',$stalink);  
  }  
     } else {  
  $startlink = rindex($map_string,'src="',$stalink);  
     }  
   
  }  
  $startlink = index($map_string,'"',$startlink);  
  $endlink = index($map_string,'"',$startlink+1);  
  $chunk = substr($map_string,$startlink,$endlink-$startlink+1);  
  push @file_seq,$chunk;  
     }  
     return @file_seq;  
 }  
   
   
 sub details_for_menu {  sub details_for_menu {
   

Removed from v.1.63  
changed lines
  Added in v.1.64


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