Index: trunk/gsdl/src/colservr/mggdbmsource.cpp
===================================================================
--- trunk/gsdl/src/colservr/mggdbmsource.cpp	(revision 802)
+++ trunk/gsdl/src/colservr/mggdbmsource.cpp	(revision 803)
@@ -28,4 +28,7 @@
 /*
    $Log$
+   Revision 1.18  1999/12/05 21:27:30  sjboddie
+   added support for multiple gsdlhomes and gdbmhome
+
    Revision 1.17  1999/10/19 03:23:40  davidb
    Collection building support through web pages
@@ -110,4 +113,5 @@
     else if (key == "collectdir") collectdir = value;
     else if (key == "gsdlhome") gsdlhome = value;
+    else if (key == "gdbmhome") gdbmhome = value;
   }
 
@@ -134,9 +138,11 @@
   outconvertclass text_t2ascii;
   
+  if (gdbmhome.empty()) gdbmhome = gsdlhome;
+
   if (!sourceclass::init (logout)) return false;
   
   // get the collection directory name
   if (collectdir.empty()) {
-    collectdir = filename_cat (gsdlhome, "collect", collection);
+    collectdir = filename_cat (gdbmhome, "collect", collection);
   }
   
@@ -190,5 +196,5 @@
 }
 
-bool mggdbmsourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/, 
+bool mggdbmsourceclass::get_metadata (const text_t &requestParams, const text_t &refParams, 
 				      bool getParents, const text_tset &fields, 
 				      const text_t &OID, MetadataInfo_tmap &metadata, 
@@ -264,4 +270,5 @@
   text_tset::const_iterator fields_here = tfields.begin();
   text_tset::const_iterator fields_end = tfields.end();
+
   while (fields_here != fields_end) {
     this_metadata.clear();
@@ -271,8 +278,8 @@
     vector<infodbclass>::reverse_iterator end_info = info_array.rend(); 
     MetadataInfo_t *tmetaptr = &this_metadata;
+    int count = 0;
     while (this_info != end_info) {
 
       pos_metadata = (*this_info).getmultinfo(*fields_here);
-    
       if ((*fields_here == "hasnext" || *fields_here == "hasprevious")) {
 	
@@ -283,47 +290,50 @@
 	  // cache parent contents array
 	  text_t thisparent = get_parent (OID);
-	  if (thisparent != parentOID) {
-	    parentOID = thisparent;
-	    parentcontents.erase(parentcontents.begin(), parentcontents.end());
-	    if (gdbmptr->getinfo(parentOID, parentinfo)) {
-	      text_t &parentinfocontains = parentinfo["contains"];
-	      if (!parentinfocontains.empty())
-		splitchar (parentinfocontains.begin(), parentinfocontains.end(), 
-			   ';', parentcontents);
+	  if (!thisparent.empty()) {
+	    if (thisparent != parentOID) {
+	      parentOID = thisparent;
+	      parentcontents.erase(parentcontents.begin(), parentcontents.end());
+	      if (gdbmptr->getinfo(parentOID, parentinfo)) {
+		text_t &parentinfocontains = parentinfo["contains"];
+		if (!parentinfocontains.empty())
+		  splitchar (parentinfocontains.begin(), parentinfocontains.end(), 
+			     ';', parentcontents);
+	      }
 	    }
-	  }
-	  
-	  // do tests
-	  text_tarray::const_iterator parentcontents_here = parentcontents.begin();
-	  text_tarray::const_iterator parentcontents_end = parentcontents.end();
-	  text_t shrunk_OID = OID;
-	  shrink_parent (shrunk_OID);
-	  while (parentcontents_here != parentcontents_end) {
-	    if (*parentcontents_here == shrunk_OID) {
-	      if (parentcontents_here == parentcontents.begin()) hasprevious = false;
-	      else hasprevious = true;
+	    
+	    // do tests
+	    text_tarray::const_iterator parentcontents_here = parentcontents.begin();
+	    text_tarray::const_iterator parentcontents_end = parentcontents.end();
+	    text_t shrunk_OID = OID;
+	    shrink_parent (shrunk_OID);
+	    while (parentcontents_here != parentcontents_end) {
+	      if (*parentcontents_here == shrunk_OID) {
+		if (parentcontents_here == parentcontents.begin()) hasprevious = false;
+		else hasprevious = true;
+		
+		parentcontents_here++;
+		
+		if (parentcontents_here == parentcontents.end()) hasnext = false;
+		else hasnext = true;
+		
+		break;
+	      }  
 	      
-	      parentcontents_here++;
-	      
-	      if (parentcontents_here == parentcontents.end()) hasnext = false;
-	      else hasnext = true;
-	      
-	      break;
-	    }  
-	    
-	    parentcontents_here ++;
-	  }
-	}  
-	
-	// fill in metadata
-	if ((*fields_here == "hasnext" && hasnext) ||
-	    (*fields_here == "hasprevious" && hasprevious))
-	  tmetaptr->values.push_back("1");
-	else
-	  tmetaptr->values.push_back("0");
-	
+	      parentcontents_here ++;
+	    }
+	 
+	    // fill in metadata
+	    if ((*fields_here == "hasnext" && hasnext) ||
+		(*fields_here == "hasprevious" && hasprevious))
+	      tmetaptr->values.push_back("1");
+	    else
+	      tmetaptr->values.push_back("0");
+	  } else
+	    tmetaptr->values.push_back("0");
+	}
       }
-      else if (pos_metadata != NULL && *fields_here != "contains")
+      else if (pos_metadata != NULL && *fields_here != "contains") {
 	tmetaptr->values = *pos_metadata;
+      }
       else
 	tmetaptr->values.push_back("");
@@ -336,8 +346,6 @@
     }
     metadata[*fields_here] = this_metadata;
-    
     fields_here++;
   }
-
   return true;
 }
Index: trunk/gsdl/src/colservr/mggdbmsource.h
===================================================================
--- trunk/gsdl/src/colservr/mggdbmsource.h	(revision 802)
+++ trunk/gsdl/src/colservr/mggdbmsource.h	(revision 803)
@@ -42,4 +42,5 @@
 protected:
   text_t gsdlhome;
+  text_t gdbmhome;
   text_t collection;
   text_t collectdir;
