Index: trunk/gsdl/src/recpt/documentaction.cpp
===================================================================
--- trunk/gsdl/src/recpt/documentaction.cpp	(revision 267)
+++ trunk/gsdl/src/recpt/documentaction.cpp	(revision 277)
@@ -12,4 +12,8 @@
 /*
    $Log$
+   Revision 1.5  1999/06/16 03:10:49  sjboddie
+   define_internal_macros() now sets _pagetitle_ macro to document's title
+   (including parents of current document)
+
    Revision 1.4  1999/06/15 01:55:29  sjboddie
    - got text highlighting working
@@ -182,18 +186,22 @@
   int twidth, swidth, iwidth = 0;
 
+  text_t &arg_d = args["d"];
+  text_t &arg_cl = args["cl"];
+  text_t &collection = args["c"];
+
   // if the "gp" (go to page) argument is set we need to set 
   // the "d" argument to the corresponding page
-  if ((!args["d"].empty()) && (!args["gp"].empty()) &&
+  if ((!arg_d.empty()) && (!args["gp"].empty()) &&
       (is_number (args["gp"]))) {
     text_t top;
-    get_top (args["d"], top);
+    get_top (arg_d, top);
     metadata.push_back ("Title");
-    get_children (top, args["c"], metadata, collectproto, response, logout);
+    get_children (top, collection, metadata, collectproto, response, logout);
     ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin();
     ResultDocInfo_tarray::const_iterator docend = response.docInfo.end();
     while (dochere != docend) {
       if ((*dochere).metadata[0].values[0] == args["gp"]) {
-	args["d"] = (*dochere).OID;
-	disp.setmacro ("cgiargd", "Global", args["d"]);
+	arg_d = (*dochere).OID;
+	disp.setmacro ("cgiargd", "Global", arg_d);
 	break;
       }
@@ -206,21 +214,21 @@
   request.filterName = "NullFilter";
   request.filterResultOptions = FROID;
-  if (needs_translating (args["d"])) {
-    request.docSet.insert (args["d"]);
-    collectproto->filter (args["c"], request, response, err, logout);
-    args["d"] = response.docInfo[0].OID;
+  if (needs_translating (arg_d)) {
+    request.docSet.insert (arg_d);
+    collectproto->filter (collection, request, response, err, logout);
+    arg_d = response.docInfo[0].OID;
     request.docSet.erase (request.docSet.begin(), request.docSet.end());
-    disp.setmacro ("cgiargd", "Global", args["d"]);
-  }
-  if (needs_translating (args["cl"])) {
-    request.docSet.insert (args["cl"]);
-    collectproto->filter (args["c"], request, response, err, logout);
-    args["cl"] = response.docInfo[0].OID;
-    disp.setmacro ("cgiargcl", "Global", args["cl"]);
-  }
-
-  get_top (args["cl"], topparent);
-
-  collectproto->get_filterinfo (args["c"], filterinfo, err, logout);
+    disp.setmacro ("cgiargd", "Global", arg_d);
+  }
+  if (needs_translating (arg_cl)) {
+    request.docSet.insert (arg_cl);
+    collectproto->filter (collection, request, response, err, logout);
+    arg_cl = response.docInfo[0].OID;
+    disp.setmacro ("cgiargcl", "Global", arg_cl);
+  }
+
+  get_top (arg_cl, topparent);
+
+  collectproto->get_filterinfo (collection, filterinfo, err, logout);
   if (err == noError) {
     // check that there's a browse filter
@@ -229,5 +237,5 @@
       metadata.push_back ("Title");
       metadata.push_back ("classifytype");
-      get_children ("", args["c"], metadata, collectproto, response, logout);
+      get_children ("", collection, metadata, collectproto, response, logout);
 
       // don't do anything unless there are classifications
@@ -270,5 +278,5 @@
 
 	  // if we're inside a document all the classification buttons should be enabled
-	  if (args["d"].empty() && ((*dochere).OID == topparent))
+	  if (arg_d.empty() && ((*dochere).OID == topparent))
 	    navigationbar += "_imagespacer__icontab" + title + "green_";
 	  else {
@@ -306,4 +314,6 @@
   // 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
 
@@ -322,5 +332,4 @@
   //                        flashy buttons work
 
-  
   // can't do anything if collectproto is null (i.e. no collection was specified)
   if (collectproto == NULL) return;
@@ -329,21 +338,33 @@
   text_tarray metadata;
   FilterResponse_t response;
-  
+  text_t &arg_d = args["d"];
+  text_t &arg_cl = args["cl"];
+  text_t &collection = args["c"];
+
   metadata.push_back ("Title");
   metadata.push_back ("classifytype");
   
-  if (!args["d"].empty()) {
+  if (!arg_d.empty()) {
     // we're at document level
     text_t javaimagescontent;
 
-    // get metadata for top level of document
-    text_t doctop;
-    get_top (args["d"], doctop);
-    if (get_info (doctop, args["c"], metadata, collectproto, response, logout)) {
+    // 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_");
+
+      text_t pagetitle;
+      text_tarray::const_iterator this_title = response.docInfo[0].metadata[0].values.begin();
+      text_tarray::const_iterator end_title = response.docInfo[0].metadata[0].values.end();
+      while (this_title != end_title) {
+	if ((this_title + 1) == end_title) pagetitle += *this_title;
+	else pagetitle += *this_title + ": ";
+	this_title ++;
+      }
+      disp.setmacro ("pagetitle", "document", pagetitle);
+
       text_t &classifytype = response.docInfo[0].metadata[1].values[0];
       if (classifytype.empty()) classifytype = "Book"; // defaults to Book
       if ((classifytype == "Book") || (classifytype == "Hierarchy"))
-	set_arrow_macros (args["d"], classifytype, disp, collectproto, args["c"], logout);
+	set_arrow_macros (arg_d, classifytype, disp, collectproto, collection, logout);
 
       if (args["u"] != "1") {
@@ -366,10 +387,10 @@
     }
   } else {
-    if (!args["cl"].empty()) {
+    if (!arg_cl.empty()) {
 	
       // get metadata for top level classification
       text_t classtop;
-      get_top (args["cl"], classtop);
-      if (get_info (classtop, args["c"], metadata, collectproto, response, logout)) {
+      get_top (arg_cl, classtop);
+      if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
 	  
 	text_t &title = response.docInfo[0].metadata[0].values[0];
@@ -391,5 +412,5 @@
 	  metadata.push_back ("Title");
 	  metadata.push_back ("doctype");
-	  if (get_children (classtop, args["c"], metadata, collectproto, response, logout)) {
+	  if (get_children (classtop, collection, metadata, collectproto, response, logout)) {
 	    
 	    // don't want links unless there are 2 or more sections
@@ -405,5 +426,5 @@
 	      while (sechere != secend) {
 		if ((*sechere).metadata[1].values[0] == "classify") {
-		  if ((*sechere).OID == args["cl"]) {
+		  if ((*sechere).OID == arg_cl) {
 		    
 		    // set the _httpprevarrow_, _httpnextarrow_ macros while we're here
@@ -484,5 +505,5 @@
     metadata.push_back ("Title");
     metadata.push_back ("classifytype");
-    if (get_info (topparent, collection, metadata, collectproto, response, logout)) {
+    if (get_info (topparent, collection, metadata, false, collectproto, response, logout)) {
       classifytitle = response.docInfo[0].metadata[0].values[0];
       classifytype = response.docInfo[0].metadata[1].values[0];
@@ -520,5 +541,5 @@
     metadata.push_back("haschildren");
     
-    if (get_info (OID, collection, metadata, collectproto, response, logout)) {
+    if (get_info (OID, collection, metadata, false, collectproto, response, logout)) {
       text_t &title = response.docInfo[0].metadata[0].values[0];
       int hastxt = response.docInfo[0].metadata[1].values[0].getint();
