[LON-CAPA-cvs] cvs: modules /gerd/harvesting lonindexer.pm

www www at source.lon-capa.org
Sun Jul 8 23:28:24 EDT 2012


www		Mon Jul  9 03:28:24 2012 EDT

  Modified files:              
    /modules/gerd/harvesting	lonindexer.pm 
  Log:
  Receive current basket and turn into resource IDs
  
  
Index: modules/gerd/harvesting/lonindexer.pm
diff -u modules/gerd/harvesting/lonindexer.pm:1.2 modules/gerd/harvesting/lonindexer.pm:1.3
--- modules/gerd/harvesting/lonindexer.pm:1.2	Sat Jul  7 21:44:41 2012
+++ modules/gerd/harvesting/lonindexer.pm	Mon Jul  9 03:28:24 2012
@@ -5,7 +5,7 @@
 #
 # MODIFY $datapath VARIABLE FOR LOCATION OF DATA FILES
 #
-# $Id: lonindexer.pm,v 1.2 2012/07/07 21:44:41 www Exp $
+# $Id: lonindexer.pm,v 1.3 2012/07/09 03:28:24 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -281,6 +281,21 @@
 }
 
 # =================================================================================
+# Return the resource keys for URLs
+# and vice versa. The dbfile is double-hashed
+
+sub urlres {
+   my @urls=@_;
+   my %output=();
+   tie(%hash, 'GDBM_File', $datapath.'dbfiles/keywords.db',&GDBM_READER(),0640);
+   foreach my $url (@urls) {
+      $output{$url}=$hash{$url}; 
+   }
+   untie(%hash);
+   return(%output);
+}
+
+# =================================================================================
 #
 
 # ----------------------------- Handling routine called via Apache and mod_perl
@@ -299,7 +314,15 @@
     undef (@Only);
     undef (@Omit);
     %fieldnames=&Apache::lonmeta::fieldnames();
-
+#
+# Get the current basket
+#
+    my ($cnum,$cdom,$folder)=split(/\,/,$env{'form.basket'});
+    my %existingres=();
+    if ($folder) {
+       %existingres=&urlres(&mapread($cnum,$cdom,$folder));
+    }
+    
 # ------------------------------------- read in machine configuration variables
     my $iconpath= $r->dir_config('lonIconsURL') . "/";
     my $domain  = $r->dir_config('lonDefDomain');




More information about the LON-CAPA-cvs mailing list