Index: trunk/gsdl/src/recpt/browsetools.cpp
===================================================================
--- trunk/gsdl/src/recpt/browsetools.cpp	(revision 411)
+++ trunk/gsdl/src/recpt/browsetools.cpp	(revision 412)
@@ -12,4 +12,7 @@
 /*
    $Log$
+   Revision 1.15  1999/07/21 05:01:56  sjboddie
+   wrote handler for DateList classification
+
    Revision 1.14  1999/07/20 02:58:15  sjboddie
    got List and AZList classifications using format strings - tidied
@@ -775,7 +778,6 @@
 	icon = "_document:iconclosedbookshelf_";
 	link += (*sechere).OID + "\">";
-      } else {
-	link += arg_cl + "&d=" + (*sechere).OID + "\">";
-      }
+      } else link += arg_cl + "&d=" + (*sechere).OID + "\">";
+
       if (intable) textout << "<tr>\n";
 
@@ -798,9 +800,113 @@
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
 
-void datelist_toc (const text_t &/*classifytype*/, const text_t &/*classifytitle*/, 
-		   const text_t &/*formatstring*/, cgiargsclass &/*args*/, recptproto */*collectproto*/, 
-		   displayclass &/*disp*/, outconvertclass &/*outconvert*/, 
-		   ostream &/*textout*/, ostream &/*logout*/) {
-}
+// prototypes
+
+static void output_datelist (text_t &formatstring, cgiargsclass &args,
+			     recptproto *collectproto, displayclass &disp, 
+			     outconvertclass &outconvert, ostream &textout,
+			     ostream &logout);
+
+
+
+void datelist_toc (const text_t &/*classifytype*/, text_t &formatstring, 
+		   cgiargsclass &args, recptproto *collectproto, 
+		   displayclass &disp, outconvertclass &outconvert, 
+		   ostream &textout, ostream &logout) {
+
+  textout
+    << "\n<!-- Table of Contents produced by browsetools::datelist_toc -->\n\n"
+    << "<table cellspacing=10>\n";
+  
+  output_datelist (formatstring, args, collectproto, 
+		   disp, outconvert, textout, logout);
+  
+  textout << "</table>\n"
+	  << "<!-- end of Table of Contents -->\n";
+}
+
+void output_datelist (text_t &formatstring, cgiargsclass &args,
+		      recptproto *collectproto, displayclass &disp, 
+		      outconvertclass &outconvert, ostream &textout,
+		      ostream &logout) {
+
+  text_tarray metadata;
+  bool getParents = false;
+  FilterResponse_t response;
+
+  text_t &arg_cl = args["cl"];
+
+  // if format string is empty use the default
+  if (formatstring.empty()) 
+    formatstring = "<td valign=top nowrap>[link][icon][/link]</td><td>{Or}{[Title],Untitled}</td>";
+
+  bool intable = is_table_content (formatstring); 
+
+  format_t *formatlistptr = new format_t();
+  parse_formatstring (formatstring, formatlistptr, metadata, getParents);
+  metadata.push_back ("doctype"); // need this to decide which icon to use
+  metadata.push_back ("Date"); 
+
+  if (get_children (arg_cl, args["c"], metadata, getParents, 
+		    collectproto, response, logout)) {
+    
+    ResultDocInfo_tarray::const_iterator sechere = response.docInfo.begin();
+    ResultDocInfo_tarray::const_iterator secend = response.docInfo.end();
+    
+    text_t lastyear = "0000";
+    text_t lastmonth = "00";
+
+    while (sechere != secend) {
+
+      // grab date and doctype off end of metadata
+      const MetadataInfo_t &metadate = *(sechere->metadata.end()-1);
+      const text_t &date = metadate.values.back();
+      const MetadataInfo_t &metadoctype = *(sechere->metadata.end()-2);
+      const text_t &doctype = metadoctype.values.back();
+
+      // bail on this document if it has no date
+      if (date.empty()) continue;
+
+      text_t::const_iterator datebegin = date.begin();
+
+      text_t link = "<a href=\"_httpdocument_&cl=";
+      text_t icon = "_document:iconclosedbook_";
+      
+      if (doctype == "classify") {
+	icon = "_document:iconclosedbookshelf_";
+	link += (*sechere).OID + "\">";
+      } else link += arg_cl + "&d=" + (*sechere).OID + "\">";
+
+      text_t thisyear = substr (datebegin, datebegin+4);
+      text_t thismonth = substr (datebegin+4, datebegin+6); 
+
+      textout << "<tr>\n";
+
+      if (thisyear != lastyear) {
+	textout << outconvert << "<td><b>" << thisyear << "</b></td>";
+	lastyear = thisyear;
+      } else
+	textout << "<td></td>";
+
+      if (thismonth != lastmonth) {
+	textout << outconvert << disp << ("<td><b>_textmonth" + thismonth + "_</b></td>");
+	lastmonth = thismonth;
+      } else
+	textout << "<td></td>";
+
+      if (!intable) textout << "<td>\n";
+
+      textout << outconvert << disp 
+	      << get_formatted_string (*sechere, formatlistptr, link, icon) << "\n";
+
+      if (!intable) textout << "</td>";
+      
+      textout << "</tr>\n";
+
+      sechere ++;
+    }
+  }
+}
+
+
 
 
Index: trunk/gsdl/src/recpt/browsetools.h
===================================================================
--- trunk/gsdl/src/recpt/browsetools.h	(revision 411)
+++ trunk/gsdl/src/recpt/browsetools.h	(revision 412)
@@ -42,6 +42,6 @@
 	       ostream &textout, ostream &logout);
 
-void datelist_toc (const text_t &classifytype, const text_t &classifytitle, 
-		   const text_t &formatstring, cgiargsclass &args, recptproto *collectproto, 
+void datelist_toc (const text_t &classifytype, text_t &formatstring, 
+		   cgiargsclass &args, recptproto *collectproto, 
 		   displayclass &disp, outconvertclass &outconvert, 
 		   ostream &textout, ostream &logout);
