[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

www www@source.lon-capa.org
Thu, 03 Jun 2010 01:46:43 -0000


www		Thu Jun  3 01:46:43 2010 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Saving my work: correct key for different importmodes
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1067 loncom/lonnet/perl/lonnet.pm:1.1068
--- loncom/lonnet/perl/lonnet.pm:1.1067	Thu Jun  3 00:07:17 2010
+++ loncom/lonnet/perl/lonnet.pm	Thu Jun  3 01:46:43 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1067 2010/06/03 00:07:17 www Exp $
+# $Id: lonnet.pm,v 1.1068 2010/06/03 01:46:43 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -8240,7 +8240,7 @@
 # This is not a package - some other kind of start tag
 #
 		    my $entry=$token->[1];
-		    my $unikey;
+		    my $unikey='';
 
 		    if ($entry eq 'import') {
 #
@@ -8251,11 +8251,23 @@
                         $dir=~s|[^/]*$||;
                         $location=&filelocation($dir,$location);
  
-                        $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});
-                        if (defined($token->[2]->{'id'})) {
-                           $unikey.='_'.$token->[2]->{'id'};
+                        my $importmode=$token->[2]->{'importmode'};
+                        if ($importmode eq 'problem') {
+# Import as problem
+                           $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});
+                        } elsif ($importmode eq 'part') {
+# Import as part(s)
+                           $unikey=&add_prefix_and_part($prefix,$token->[2]->{'id'});
+                        } else {
+# Normal import
+                           $unikey=&add_prefix_and_part($prefix,$token->[2]->{'part'});
+                           if (defined($token->[2]->{'id'})) {
+                              $unikey.='_'.$token->[2]->{'id'};
+                           }
                         }
 
+#&logthis("About to use unikey $unikey");
+
 			if ($depthcount<20) {
 			    my $metadata = 
 				&metadata($uri,'keys', $location,$unikey,
@@ -8264,7 +8276,9 @@
 				$metaentry{':'.$meta}=$metaentry{':'.$meta};
 				$metathesekeys{$meta}=1;
 			    }
-			}
+			
+#&logthis("Metadata $metadata");
+                        }
 		    } else {
 #
 # Not importing, some other kind of non-package, non-library start tag