Ignore:
Timestamp:
1999-06-16T15:10:49+12:00 (25 years ago)
Author:
sjboddie
Message:

define_internal_macros() now sets _pagetitle_ macro to document's title
(including parents of current document)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/documentaction.cpp

    r267 r277  
    1212/*
    1313   $Log$
     14   Revision 1.5  1999/06/16 03:10:49  sjboddie
     15   define_internal_macros() now sets _pagetitle_ macro to document's title
     16   (including parents of current document)
     17
    1418   Revision 1.4  1999/06/15 01:55:29  sjboddie
    1519   - got text highlighting working
     
    182186  int twidth, swidth, iwidth = 0;
    183187
     188  text_t &arg_d = args["d"];
     189  text_t &arg_cl = args["cl"];
     190  text_t &collection = args["c"];
     191
    184192  // if the "gp" (go to page) argument is set we need to set
    185193  // the "d" argument to the corresponding page
    186   if ((!args["d"].empty()) && (!args["gp"].empty()) &&
     194  if ((!arg_d.empty()) && (!args["gp"].empty()) &&
    187195      (is_number (args["gp"]))) {
    188196    text_t top;
    189     get_top (args["d"], top);
     197    get_top (arg_d, top);
    190198    metadata.push_back ("Title");
    191     get_children (top, args["c"], metadata, collectproto, response, logout);
     199    get_children (top, collection, metadata, collectproto, response, logout);
    192200    ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin();
    193201    ResultDocInfo_tarray::const_iterator docend = response.docInfo.end();
    194202    while (dochere != docend) {
    195203      if ((*dochere).metadata[0].values[0] == args["gp"]) {
    196     args["d"] = (*dochere).OID;
    197     disp.setmacro ("cgiargd", "Global", args["d"]);
     204    arg_d = (*dochere).OID;
     205    disp.setmacro ("cgiargd", "Global", arg_d);
    198206    break;
    199207      }
     
    206214  request.filterName = "NullFilter";
    207215  request.filterResultOptions = FROID;
    208   if (needs_translating (args["d"])) {
    209     request.docSet.insert (args["d"]);
    210     collectproto->filter (args["c"], request, response, err, logout);
    211     args["d"] = response.docInfo[0].OID;
     216  if (needs_translating (arg_d)) {
     217    request.docSet.insert (arg_d);
     218    collectproto->filter (collection, request, response, err, logout);
     219    arg_d = response.docInfo[0].OID;
    212220    request.docSet.erase (request.docSet.begin(), request.docSet.end());
    213     disp.setmacro ("cgiargd", "Global", args["d"]);
    214   }
    215   if (needs_translating (args["cl"])) {
    216     request.docSet.insert (args["cl"]);
    217     collectproto->filter (args["c"], request, response, err, logout);
    218     args["cl"] = response.docInfo[0].OID;
    219     disp.setmacro ("cgiargcl", "Global", args["cl"]);
    220   }
    221 
    222   get_top (args["cl"], topparent);
    223 
    224   collectproto->get_filterinfo (args["c"], filterinfo, err, logout);
     221    disp.setmacro ("cgiargd", "Global", arg_d);
     222  }
     223  if (needs_translating (arg_cl)) {
     224    request.docSet.insert (arg_cl);
     225    collectproto->filter (collection, request, response, err, logout);
     226    arg_cl = response.docInfo[0].OID;
     227    disp.setmacro ("cgiargcl", "Global", arg_cl);
     228  }
     229
     230  get_top (arg_cl, topparent);
     231
     232  collectproto->get_filterinfo (collection, filterinfo, err, logout);
    225233  if (err == noError) {
    226234    // check that there's a browse filter
     
    229237      metadata.push_back ("Title");
    230238      metadata.push_back ("classifytype");
    231       get_children ("", args["c"], metadata, collectproto, response, logout);
     239      get_children ("", collection, metadata, collectproto, response, logout);
    232240
    233241      // don't do anything unless there are classifications
     
    270278
    271279      // if we're inside a document all the classification buttons should be enabled
    272       if (args["d"].empty() && ((*dochere).OID == topparent))
     280      if (arg_d.empty() && ((*dochere).OID == topparent))
    273281        navigationbar += "_imagespacer__icontab" + title + "green_";
    274282      else {
     
    306314  // define_internal_macros sets the following macros:
    307315
     316  // _pagetitle_            the title to be displayed at the top of the browser window
     317 
    308318  // _imagethispage_        the title image to be displayed at top right of page
    309319
     
    322332  //                        flashy buttons work
    323333
    324  
    325334  // can't do anything if collectproto is null (i.e. no collection was specified)
    326335  if (collectproto == NULL) return;
     
    329338  text_tarray metadata;
    330339  FilterResponse_t response;
    331  
     340  text_t &arg_d = args["d"];
     341  text_t &arg_cl = args["cl"];
     342  text_t &collection = args["c"];
     343
    332344  metadata.push_back ("Title");
    333345  metadata.push_back ("classifytype");
    334346 
    335   if (!args["d"].empty()) {
     347  if (!arg_d.empty()) {
    336348    // we're at document level
    337349    text_t javaimagescontent;
    338350
    339     // get metadata for top level of document
    340     text_t doctop;
    341     get_top (args["d"], doctop);
    342     if (get_info (doctop, args["c"], metadata, collectproto, response, logout)) {
     351    // get metadata for this document and it's parents
     352    if (get_info (arg_d, collection, metadata, true, collectproto, response, logout)) {
    343353      disp.setmacro ("header", "document", "_textheader_");
     354
     355      text_t pagetitle;
     356      text_tarray::const_iterator this_title = response.docInfo[0].metadata[0].values.begin();
     357      text_tarray::const_iterator end_title = response.docInfo[0].metadata[0].values.end();
     358      while (this_title != end_title) {
     359    if ((this_title + 1) == end_title) pagetitle += *this_title;
     360    else pagetitle += *this_title + ": ";
     361    this_title ++;
     362      }
     363      disp.setmacro ("pagetitle", "document", pagetitle);
     364
    344365      text_t &classifytype = response.docInfo[0].metadata[1].values[0];
    345366      if (classifytype.empty()) classifytype = "Book"; // defaults to Book
    346367      if ((classifytype == "Book") || (classifytype == "Hierarchy"))
    347     set_arrow_macros (args["d"], classifytype, disp, collectproto, args["c"], logout);
     368    set_arrow_macros (arg_d, classifytype, disp, collectproto, collection, logout);
    348369
    349370      if (args["u"] != "1") {
     
    366387    }
    367388  } else {
    368     if (!args["cl"].empty()) {
     389    if (!arg_cl.empty()) {
    369390   
    370391      // get metadata for top level classification
    371392      text_t classtop;
    372       get_top (args["cl"], classtop);
    373       if (get_info (classtop, args["c"], metadata, collectproto, response, logout)) {
     393      get_top (arg_cl, classtop);
     394      if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
    374395     
    375396    text_t &title = response.docInfo[0].metadata[0].values[0];
     
    391412      metadata.push_back ("Title");
    392413      metadata.push_back ("doctype");
    393       if (get_children (classtop, args["c"], metadata, collectproto, response, logout)) {
     414      if (get_children (classtop, collection, metadata, collectproto, response, logout)) {
    394415       
    395416        // don't want links unless there are 2 or more sections
     
    405426          while (sechere != secend) {
    406427        if ((*sechere).metadata[1].values[0] == "classify") {
    407           if ((*sechere).OID == args["cl"]) {
     428          if ((*sechere).OID == arg_cl) {
    408429           
    409430            // set the _httpprevarrow_, _httpnextarrow_ macros while we're here
     
    484505    metadata.push_back ("Title");
    485506    metadata.push_back ("classifytype");
    486     if (get_info (topparent, collection, metadata, collectproto, response, logout)) {
     507    if (get_info (topparent, collection, metadata, false, collectproto, response, logout)) {
    487508      classifytitle = response.docInfo[0].metadata[0].values[0];
    488509      classifytype = response.docInfo[0].metadata[1].values[0];
     
    520541    metadata.push_back("haschildren");
    521542   
    522     if (get_info (OID, collection, metadata, collectproto, response, logout)) {
     543    if (get_info (OID, collection, metadata, false, collectproto, response, logout)) {
    523544      text_t &title = response.docInfo[0].metadata[0].values[0];
    524545      int hastxt = response.docInfo[0].metadata[1].values[0].getint();
Note: See TracChangeset for help on using the changeset viewer.