Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1068 and 1.1069

version 1.1068, 2010/06/03 01:46:43 version 1.1069, 2010/06/03 17:04:41
Line 8157  sub metadata { Line 8157  sub metadata {
  if (defined($cached)) { return $result->{':'.$what}; }   if (defined($cached)) { return $result->{':'.$what}; }
     }      }
     {      {
   # Imported parts would go here
           my @newpartorder=();
           my $importedparts=0;
 #  #
 # Is this a recursive call for a library?  # Is this a recursive call for a library?
 #  #
Line 8250  sub metadata { Line 8253  sub metadata {
                         my $dir=$filename;                          my $dir=$filename;
                         $dir=~s|[^/]*$||;                          $dir=~s|[^/]*$||;
                         $location=&filelocation($dir,$location);                          $location=&filelocation($dir,$location);
                           
                         my $importmode=$token->[2]->{'importmode'};                          my $importmode=$token->[2]->{'importmode'};
                         if ($importmode eq 'problem') {                          if ($importmode eq 'problem') {
 # Import as problem  # Import as problem/response
                            $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});                             $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});
                         } elsif ($importmode eq 'part') {                          } elsif ($importmode eq 'part') {
 # Import as part(s)  # Import as part(s)
                            $unikey=&add_prefix_and_part($prefix,$token->[2]->{'id'});                             $importedparts=1;
   # We need to get the original file and the imported file to get the part order correct
   # Good news: we do not need to worry about nested libraries, since parts cannot be nested
   # Load and inspect original file
                              my $origfilelocation=$perlvar{'lonDocRoot'}.&clutter($uri);
                              my $origfile=&getfile($origfilelocation);
                              my @origfileimportpartids=($origfile=~/<(part|import)[^>]*id\s*=\s*[\"\']([^\"\']+)[\"\'][^>]*>/gs);
   # Load and inspect imported file
                              my $impfile=&getfile($location);
                              my @impfilepartids=($impfile=~/<part[^>]*id\s*=\s*[\"\']([^\"\']+)[\"\'][^>]*>/gs);
   
   #&logthis("Found imported parts".join(',',@impfilepartids));
   #&logthis("Found original parts and imports".join(',',@origfileimportpartids));
                              if ($#impfilepartids>=0) {
   # This problem had parts
   #&logthis("Importing parted problem");
                              } else {
   # Importing by turning a single problem into a problem part
   # It gets the import-tags ID as part-ID
   #&logthis("Importing unparted problem");
                                  $unikey=&add_prefix_and_part($prefix,$token->[2]->{'id'});
                                  push(@newpartorder,$token->[2]->{'id'});
                              }
                         } else {                          } else {
 # Normal import  # Normal import
                            $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});                             $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});

Removed from v.1.1068  
changed lines
  Added in v.1.1069


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