Index: /trunk/cstr/macros/cstr.dm
===================================================================
--- /trunk/cstr/macros/cstr.dm	(revision 2484)
+++ /trunk/cstr/macros/cstr.dm	(revision 2485)
@@ -30,21 +30,21 @@
 _imagefigures_ [c=cstr] {_gsimage_(_httpcurrentdocument_&gg=figures,_document:httpiconefigof_,_document:httpiconefigon_,fig,_document:texticonfigures_)}
 
-_httpiconepsof_ [c=cstr] {_httpcollection_/images/epsof.gif}
-_httpiconepson_ [c=cstr] {_httpcollection_/images/epson.gif}
+_httpiconepsof_ [c=cstr] {_httpprefix_/collect/cstr/images/epsof.gif}
+_httpiconepson_ [c=cstr] {_httpprefix_/collect/cstr/images/epson.gif}
 _widthepsx_ [c=cstr] {64}
 _heightepsx_ [c=cstr] {30}
 
-_httpiconetextof_ [c=cstr] {_httpcollection_/images/etextof.gif}
-_httpiconetexton_ [c=cstr] {_httpcollection_/images/etexton.gif}
+_httpiconetextof_ [c=cstr] {_httpprefix_/collect/cstr/images/etextof.gif}
+_httpiconetexton_ [c=cstr] {_httpprefix_/collect/cstr/images/etexton.gif}
 _widthetextx_ [c=cstr] {65}
 _heightetextx_ [c=cstr] {30}
 
-_httpiconeabstrof_ [c=cstr] {_httpcollection_/images/eabstrof.gif}
-_httpiconeabstron_ [c=cstr] {_httpcollection_/images/eabstron.gif}
+_httpiconeabstrof_ [c=cstr] {_httpprefix_/collect/cstr/images/eabstrof.gif}
+_httpiconeabstron_ [c=cstr] {_httpprefix_/collect/cstr/images/eabstron.gif}
 _widtheabstrx_ [c=cstr] {65}
 _heighteabstrx_ [c=cstr] {30}
 
-_httpiconefigof_ [c=cstr] {_httpcollection_/images/efigof.gif}
-_httpiconefigon_ [c=cstr] {_httpcollection_/images/efigon.gif}
+_httpiconefigof_ [c=cstr] {_httpprefix_/collect/cstr/images/efigof.gif}
+_httpiconefigon_ [c=cstr] {_httpprefix_/collect/cstr/images/efigon.gif}
 _widthefigx_ [c=cstr] {47}
 _heightefigx_ [c=cstr] {30}
Index: /trunk/cstr/src/recpt/Makefile.in
===================================================================
--- /trunk/cstr/src/recpt/Makefile.in	(revision 2484)
+++ /trunk/cstr/src/recpt/Makefile.in	(revision 2485)
@@ -46,4 +46,5 @@
 RANLIB = @RANLIB@
 LDFLAGS = @LDFLAGS@
+#LIBS = -lgdbm -lstdc++ -lm -lcrypt
 LIBS = @LIBS@
 
@@ -64,10 +65,12 @@
 
 
-HEADERS = cstrdocaction.h
+HEADERS = cstrdocaction.h cstrbrowsetools.h cstrpagedbrowserclass.h
 
-SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp
+SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp cstrbrowsetools.cpp \
+	  cstrpagedbrowserclass.cpp
 
 
-OBJECTS = cstrlibrarymain.o cstrdocaction.o
+OBJECTS = cstrlibrarymain.o cstrdocaction.o cstrbrowsetools.o \
+	  cstrpagedbrowserclass.o
 
 
@@ -123,5 +126,4 @@
     $(MAINRECPTDIR)/usersaction.o \
     $(MAINRECPTDIR)/userdb.o \
-    $(MAINRECPTDIR)/delhistoryaction.o \
     $(MAINRECPTDIR)/historydb.o \
     $(MAINCOLSERVRDIR)/mgq.o \
@@ -135,11 +137,18 @@
     $(MAINCOLSERVRDIR)/browsefilter.o \
     $(MAINCOLSERVRDIR)/queryfilter.o \
-    $(MAINCOLSERVRDIR)/phrasequeryfilter.o \
+    $(MAINCOLSERVRDIR)/mgqueryfilter.o \
+    $(MAINCOLSERVRDIR)/mgppqueryfilter.o \
     $(MAINCOLSERVRDIR)/phrasesearch.o \
     $(MAINCOLSERVRDIR)/mggdbmsource.o \
+    $(MAINCOLSERVRDIR)/search.o \
     $(MAINCOLSERVRDIR)/mgsearch.o \
+    $(MAINCOLSERVRDIR)/mgppsearch.o \
+    $(MAINCOLSERVRDIR)/collectset.o \
     $(GD)/lib/gsdllib.a  \
     $(GD)/packages/mg/src/text/libtextin.a \
-    $(GD)/packages/mg/lib/libmg.a
+    $(GD)/packages/mg/lib/libmg.a \
+    $(GD)/src/mgpp/text/libtextin.a \
+    $(GD)/src/mgpp/lib/libmg.a
+
 
 ifneq ($(USE_FASTCGI), 1)
Index: /trunk/cstr/src/recpt/cstrdocaction.cpp
===================================================================
--- /trunk/cstr/src/recpt/cstrdocaction.cpp	(revision 2484)
+++ /trunk/cstr/src/recpt/cstrdocaction.cpp	(revision 2485)
@@ -28,6 +28,7 @@
 /*
    $Log$
-   Revision 1.3  2000/04/04 04:43:07  nzdl
-   caught cstr collection up with DocumentColumn stuff
+   Revision 1.4  2001/05/30 01:39:18  sjboddie
+   Rewound cstr to use the old browsetools etc approach rather than the
+   LeftColumn etc methods
 
    Revision 1.2  2000/02/06 21:25:21  sjboddie
@@ -42,7 +43,9 @@
 #include <string.h>
 #include "cstrdocaction.h"
+#include "cstrbrowsetools.h"
+#include "browsetools.h"
 #include "OIDtools.h"
 #include "querytools.h"
-#include "cgiutils.h"
+#include "unitool.h"
 
 cstrdocaction::cstrdocaction () {
@@ -77,74 +80,4 @@
 }
 
-void cstrdocaction::output_controls (cgiargsclass &args, const text_tarray &ibuttons,
-				     recptproto *collectproto, displayclass &disp, 
-				     outconvertclass &outconvert, ostream &textout, 
-				     ostream &logout) {
-
-
-  if (args["u"] != "1") {
-
-    text_tarray buttons;
-    text_t &arg_gg = args["gg"];
-
-    text_tarray::const_iterator here = ibuttons.begin();
-    text_tarray::const_iterator end = ibuttons.end();
-    
-    while (here != end) {
-      
-      if (*here == "Detach")
-	buttons.push_back ("_document:imagedetach_");
-      else if ((*here == "Highlight") && (arg_gg == "text")) {
-	if (args["hl"] == "1") 
-	  buttons.push_back ("_document:imagenohighlight_");
-	else 
-	  buttons.push_back ("_document:imagehighlight_");
-      } else if ((*here == "Expand Text") && arg_gg == "text") {
-	if (args.getintarg("gt"))
-	  buttons.push_back ("_document:imagecontracttext_");
-	else 
-	  buttons.push_back ("_document:imageexpandtext_");
-      }
-      here ++;
-    }
-
-    FilterResponse_t response;
-    text_tset metadata;
-    text_t top;
-    get_top (args["d"], top);
-    metadata.insert ("figures");
-    metadata.insert ("Description");
-    metadata.insert ("Source");
-    if (get_info (top, args["c"], metadata, false, collectproto, response, logout)) {
-      text_t &figures = response.docInfo[0].metadata["figures"].values[0];
-      text_t &description = response.docInfo[0].metadata["Description"].values[0];
-      text_t &source = response.docInfo[0].metadata["Source"].values[0];
-
-      if (!source.empty())
-	buttons.push_back ("_document:imagepostscript_(" + cgi_safe(source) + ")");
-      
-      if ((!description.empty()) && (arg_gg != "abstract"))
-	buttons.push_back ("_document:imageabstract_");
-      
-      if ((!figures.empty()) && (arg_gg != "figures"))
-	buttons.push_back ("_document:imagefigures_");
-      
-      if (arg_gg != "text")
-	buttons.push_back ("_document:imageviewtext_");
-    }
-      
-    here = buttons.begin();
-    end = buttons.end();
-    int count = 0;
-    while (here != end) {
-      if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";
-      textout << outconvert << disp << *here;
-      count ++;
-      here ++;
-    }
-  }
-}
-
-
 
 void cstrdocaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass * /*protos*/,
@@ -177,4 +110,5 @@
 	
   int arg_gt = args.getintarg("gt");
+  //  int arg_gc = args.getintarg("gc");
   int arg_hl = args.getintarg("hl");
 
@@ -192,4 +126,9 @@
       else
 	javaimagescontent += "_javaexpandtext_";
+      //    } else if (*button_here == "Expand Contents") {
+      //      if (arg_gc == 1)
+      //	javaimagescontent += "_javacontractcontents_";
+      //      else
+      //	javaimagescontent += "_javaexpandcontents_";
     } else if (*button_here == "Highlight" && arg_gg == "text") {
       if (arg_hl == 1)
@@ -203,4 +142,115 @@
   disp.setmacro ("javaimagescontent", "document", javaimagescontent);
 }
+
+
+
+/*
+// define all the macros which are related to pages generated
+// by this action. we also load up the formatinfo structure 
+// here (it's used in do_action as well as here)
+void cstrdocaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 
+					    cgiargsclass &args, recptproto *collectproto, 
+					    ostream &logout) {
+  
+  // define_internal_macros sets the following macros:
+
+  // _pagetitle_            the title to be displayed at the top of the browser window
+  
+  // _imagethispage_        the title image to be displayed at top right of page
+  
+  // _classificationlinks_  the links between classifications to be displayed
+  //                        at top of list or datelist classifications
+
+  // _httpprevarrow_        these are set if next or previous arrows
+  // _httpnextarrow_        are to be used - (i.e. if it's an AZList or a DateList 
+  //                        classifytype at a top level or if it's a Book or a
+  //                        Hierarchy classifytype at document level 
+
+  // _navarrows_            this may be overridden to "" when format option 
+  //                        DocumentArrowsBottom is false
+
+  // _header_               the header macro is overridden if we're not at a top level 
+  //                        classification to remove the title block
+
+  // _javaimagescontent_    this is the javascript code to shove in to make the 
+  //                        flashy buttons work
+
+  // _thisOID_              the OID (directory) of the current document - this corresponds
+  //                        to the archivedir metadata element
+
+  // can't do anything if collectproto is null (i.e. no collection was specified)
+  if (collectproto == NULL) return;
+  
+  text_tarray metadata;
+  FilterResponse_t response;
+  text_t &arg_d = args["d"];
+  text_t &arg_cl = args["cl"];
+  text_t &collection = args["c"];
+  int gt = args.getintarg("gt");
+  load_formatinfo (collectinfo.format, gt);
+
+  // don't want arrows or goto if we're in figures or facsimiles
+  if (args["gg"] != "text") {
+    formatinfo.DocumentArrowsBottom = false;
+    formatinfo.DocumentArrowsTop = false;
+    formatinfo.DocumentGoTo = false;
+  }
+
+  if (!formatinfo.DocumentArrowsBottom)
+    disp.setmacro("navarrows", "document", "");
+
+  metadata.push_back ("Title");
+  metadata.push_back ("classifytype");
+  metadata.push_back ("archivedir");
+  
+  if (!arg_d.empty()) {
+    // we're at document level
+    
+    // get metadata for this document and it's parents
+    if (get_info (arg_d, collection, metadata, true, collectproto, response, logout)) {
+      disp.setmacro ("header", "document", "_textheader_");
+
+      disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]);
+
+      text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
+      if (classifytype.empty()) classifytype = "Book"; // defaults to Book
+
+      // set arrow macros if required
+      if (((classifytype == "Book") && (formatinfo.DocumentArrowsTop || formatinfo.DocumentArrowsBottom)) ||
+	  ((classifytype == "Hierarchy") && formatinfo.DocumentArrowsBottom))
+	set_arrow_macros (arg_d, classifytype, formatinfo.DocumentTopPages, 
+			  disp, collectproto, collection, logout);
+      
+      if (args["u"] != "1")
+	set_java_macros (args, disp);
+
+    }
+  } else {
+    if (!arg_cl.empty()) {
+	
+      // get metadata for top level classification
+      text_t classtop;
+      get_top (arg_cl, classtop);
+      if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
+	  
+	text_t &title = response.docInfo[0].metadata["Title"].values[0];
+	text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
+
+	disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
+	disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
+
+	// now get the metadata for each child of top level
+	// so we can generate the _classificationlinks_ and arrow macros
+	// (if they're required by the current classification type)
+	
+	if ((classifytype == "AZList") || (classifytype == "DateList"))
+	  get_classificationlinks (arg_cl, collection, collectproto, disp, logout);
+      
+      }
+    }
+  }
+}
+
+*/
 
 void cstrdocaction::output_document (const text_t &OID, cgiargsclass &args, 
@@ -226,5 +276,4 @@
 	textout << outconvert << disp << "_textnoabstract_";
     }
-
   } else if (arg_gg == "figures") {
     metadata.insert ("figures");
@@ -241,5 +290,5 @@
 	while (this_figure != end_figure) {
 	  textout << outconvert << disp 
-		  << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/" 
+		  << "<p><center><img border=1 src=\"_httpprefix_/collect/cstr/index/assoc/_thisOID_/" 
 		  << *this_figure << "\"></center>\n";
 	  this_figure ++;
@@ -249,5 +298,4 @@
       }
     }
-
   } else if (arg_gg == "facsimiles") {
     metadata.insert ("facsimiles");
@@ -255,16 +303,21 @@
     get_top (OID, top);
     if (get_info (top, collection, metadata, false, collectproto, inforesponse, logout)) {
-
-      text_tarray::const_iterator this_facs = inforesponse.docInfo[0].metadata["facsimiles"].values.begin();
-      text_tarray::const_iterator end_facs = inforesponse.docInfo[0].metadata["facsimiles"].values.end();
-      while (this_facs != end_facs) {
-	textout << outconvert << disp 
-		<< "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/" 
-		<< *this_facs << "\"></center>\n";
-	this_facs ++;
+      text_t &facsimiles = inforesponse.docInfo[0].metadata["facsimiles"].values[0];
+      
+      if (!facsimiles.empty()) {
+	text_tarray facs_array;
+	splitchar (facsimiles.begin(), facsimiles.end(), ',', facs_array);
+	text_tarray::const_iterator this_facs = facs_array.begin();
+	text_tarray::const_iterator end_facs = facs_array.end();
+	while (this_facs != end_facs) {
+	  textout << outconvert << disp 
+		    << "<p><center><img border=1 src=\"_httpprefix_/collect/cstr/index/assoc/_thisOID_/" 
+		  << *this_facs << "\"></center>\n";
+	  this_facs ++;
+	}
+      } else {
+	textout << outconvert << disp << "_textnofacsimiles_";
       }
-    } else {
-      textout << outconvert << disp << "_textnofacsimiles_";
-    }
+    }      
     
   } else {
@@ -274,5 +327,5 @@
     int wanttext = 0;
     int arg_gt = args.getintarg("gt");
-    
+
     // if we have a query string and highlighting is turned on we need
     // to redo the query to get the terms for highlighting
@@ -391,12 +444,54 @@
 
 
-
-
-
-
-
-
-
-
-
-
+bool cstrdocaction::do_action (cgiargsclass &args, recptprotolistclass *protos, 
+				browsermapclass *browsers, displayclass &disp, 
+				outconvertclass &outconvert, ostream &textout, 
+				ostream &logout) {
+
+
+  // must have a valid collection server
+  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
+  if (collectproto == NULL) {
+    logout << "cstrdocaction::do_action called with NULL collectproto\n";
+    textout << outconvert << disp << "_document:header_\n" 
+	    << "Error: Attempt to get document without setting collection\n"
+	    << "_document:footer_\n";
+  } else {  
+    
+    text_t OID = args["d"];
+    if (OID.empty()) OID = args["cl"];
+    if (OID.empty()) {
+      textout << outconvert << disp << "Document contains no data_document:footer_\n";
+      return true;
+    }
+
+    textout << outconvert << disp << "_document:header_\n"
+	    << "_document:content_\n";
+
+    if (args["d"].empty()) {
+      output_toc (args, browsers, formatinfo, collectproto, 
+		  disp, outconvert, textout, logout);
+    } else {
+      output_cstr_toc (args, browsers, formatinfo, collectproto, 
+		       disp, outconvert, textout, logout);
+
+      textout << "<p>\n";
+      output_document (OID, args, collectproto, disp, outconvert, textout, logout);
+    }
+
+    textout << outconvert << disp << "_document:footer_\n";
+  }
+  return true;
+}
+
+
+
+
+
+
+
+
+
+
+
+
Index: /trunk/cstr/src/recpt/cstrdocaction.h
===================================================================
--- /trunk/cstr/src/recpt/cstrdocaction.h	(revision 2484)
+++ /trunk/cstr/src/recpt/cstrdocaction.h	(revision 2485)
@@ -36,9 +36,4 @@
 protected:
 
-  void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
-			recptproto *collectproto, displayclass &disp, 
-			outconvertclass &outconvert, ostream &textout, 
-			ostream &logout);
-
   void set_java_macros (cgiargsclass &args, displayclass &disp);
 
@@ -53,7 +48,18 @@
   virtual ~cstrdocaction ();
 
+
   void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
 			 response_t &response,text_t &response_data, 
 			 ostream &logout);
+  
+  //  void define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 
+				   //			       cgiargsclass &args, recptproto *collectproto, 
+				   //			       ostream &logout);
+    
+  bool do_action (cgiargsclass &args, recptprotolistclass *protos, 
+		  browsermapclass *browsers, displayclass &disp, 
+		  outconvertclass &outconvert, ostream &textout, 
+		  ostream &logout);
+  
 };
 
Index: /trunk/cstr/src/recpt/cstrlibrarymain.cpp
===================================================================
--- /trunk/cstr/src/recpt/cstrlibrarymain.cpp	(revision 2484)
+++ /trunk/cstr/src/recpt/cstrlibrarymain.cpp	(revision 2485)
@@ -26,8 +26,15 @@
 
 #include "receptionist.h"
-#include "collectset.h"
 #include "cgiwrapper.h"
 #include "nullproto.h"
+#include "collectserver.h"
+#include "filter.h"
+#include "browsefilter.h"
+#include "queryfilter.h"
+#include "infodbclass.h"
+#include "mgsearch.h"
+#include "mggdbmsource.h"
 #include "fileutil.h"
+#include "collectset.h"
 #include <assert.h>
 
@@ -40,4 +47,5 @@
 #include "authenaction.h"
 #include "usersaction.h"
+#include "authenaction.h"
 
 #include "browserclass.h"
@@ -46,5 +54,5 @@
 #include "datelistbrowserclass.h"
 #include "invbrowserclass.h"
-#include "pagedbrowserclass.h"
+#include "cstrpagedbrowserclass.h"
 #include "htmlbrowserclass.h"
 
@@ -112,5 +120,5 @@
   recpt.add_browser (&ainvbrowserclass);
 
-  pagedbrowserclass apagedbrowserclass;
+  cstrpagedbrowserclass apagedbrowserclass;
   recpt.add_browser (&apagedbrowserclass);
 
@@ -121,2 +129,6 @@
   return 0;
 }
+
+
+
+
