[LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 21 Jul 2006 08:25:26 -0000


albertel		Fri Jul 21 04:25:26 2006 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  - actually fix #4931
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.148 loncom/interface/lonindexer.pm:1.149
--- loncom/interface/lonindexer.pm:1.148	Fri Jun 23 03:32:02 2006
+++ loncom/interface/lonindexer.pm	Fri Jul 21 04:25:25 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.148 2006/06/23 07:32:02 www Exp $
+# $Id: lonindexer.pm,v 1.149 2006/07/21 08:25:25 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -123,7 +123,11 @@
     %hash = ();
     {
 	my %dbfile;
-	if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_READER(),0640)) {
+	if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRITER(),0640)) {
+	    if ($env{'form.launch'} eq '1') {
+		&start_fresh_session(\%dbfile);
+	    }
+
 	    while(my($key,$value)=each(%dbfile)) {
 		$hash{$key}=$value;
 	    }
@@ -131,9 +135,6 @@
 	}
     }
     {
-	if ($env{'form.launch'} eq '1') {
-	    &start_fresh_session();
-	}
   #Hijack lonindexer to verify a title and be close down.
    if ($env{'form.launch'} eq '2') {
        &Apache::loncommon::content_type($r,'text/html');
@@ -1231,14 +1232,15 @@
 
 # --------- settings whenever the user causes the indexer window to be launched
 sub start_fresh_session {
-    delete $hash{'form.catalogmode'};
-    delete $hash{'form.mode'};
-    delete $hash{'form.form'};
-    delete $hash{'form.element'};
-    delete $hash{'form.omit'};
-    delete $hash{'form.only'};
-    foreach (keys %hash) {
-        delete $hash{$_} if (/^(pre_|store)/);
+    my ($hash) = @_;
+    delete $hash->{'form.catalogmode'};
+    delete $hash->{'form.mode'};
+    delete $hash->{'form.form'};
+    delete $hash->{'form.element'};
+    delete $hash->{'form.omit'};
+    delete $hash->{'form.only'};
+    foreach (keys %{$hash}) {
+        delete $hash->{$_} if (/^(pre_|store)/);
     }
 }