Ignore:
Timestamp:
1999-07-30T14:18:49+12:00 (25 years ago)
Author:
sjboddie
Message:

-added collectinfo argument to some functions
-caught up with changes to browsetools (allowing nested classifications)
-added showtoppage format option

File:
1 edited

Legend:

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

    r411 r420  
    1212/*
    1313   $Log$
     14   Revision 1.15  1999/07/30 02:18:49  sjboddie
     15   -added collectinfo argument to some functions
     16   -caught up with changes to browsetools (allowing nested classifications)
     17   -added showtoppage format option
     18
    1419   Revision 1.14  1999/07/21 05:01:09  sjboddie
    1520   fixed up wrapping of classificationlinks
     
    219224// define all the macros which might be used by other actions
    220225// to produce pages.
    221 void documentaction::define_external_macros (displayclass &disp, cgiargsclass &args,
    222                          recptproto *collectproto, ostream &logout) {
     226void documentaction::define_external_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
     227                         cgiargsclass &args, recptproto *collectproto,
     228                         ostream &logout) {
    223229 
    224230  // define_external_macros sets the following macros:
     
    278284  }
    279285
     286  bool showtoppage = true;
     287  text_tmap::const_iterator it = collectinfo.format.find("showtoppage");
     288  if ((it != collectinfo.format.end()) && ((*it).second == "false")) showtoppage = false;
     289
    280290  // do a call to translate OIDs if required
    281291  request.filterName = "NullFilter";
    282292  request.filterResultOptions = FROID;
    283   if (needs_translating (arg_d)) {
     293  if ((!arg_d.empty()) && (needs_translating (arg_d) || !showtoppage)) {
    284294    request.docSet.insert (arg_d);
     295    request.fields.push_back ("classifytype");
     296    request.filterResultOptions = FRmetadata;
     297    request.getParents = true;
    285298    collectproto->filter (collection, request, response, err, logout);
    286299    arg_d = response.docInfo[0].OID;
    287     request.docSet.erase (request.docSet.begin(), request.docSet.end());
     300   
     301    text_t &classifytype = response.docInfo[0].metadata[0].values[0];
     302    if (classifytype.empty() || classifytype == "book")
     303      if (!showtoppage && is_top (arg_d)) arg_d += ".fc";
     304   
     305    request.clear();
    288306    disp.setmacro ("cgiargd", "Global", arg_d);
    289307  }
     
    391409// define all the macros which are related to pages generated
    392410// by this action
    393 void documentaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
    394                          recptproto *collectproto, ostream &logout) {
     411void documentaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
     412                         cgiargsclass &args, recptproto *collectproto,
     413                         ostream &logout) {
    395414
    396415  // define_internal_macros sets the following macros:
     
    420439  //                        to the archivedir metadata element
    421440
    422 
    423441  // can't do anything if collectproto is null (i.e. no collection was specified)
    424442  if (collectproto == NULL) return;
    425443
    426   disp.setmacro("random", "document", rand());
    427444 
    428445  text_tarray metadata;
     
    431448  text_t &arg_cl = args["cl"];
    432449  text_t &collection = args["c"];
     450
     451  disp.setmacro("random", "document", rand());
    433452
    434453  metadata.push_back ("Title");
     
    461480      text_t &classifytype = response.docInfo[0].metadata[1].values[0];
    462481      if (classifytype.empty()) classifytype = "Book"; // defaults to Book
    463       if ((classifytype == "Book") || (classifytype == "Hierarchy"))
    464     set_arrow_macros (arg_d, classifytype, disp, collectproto, collection, logout);
     482      if ((classifytype == "Book") || (classifytype == "Hierarchy")) {
     483    bool showtoppage = true;
     484    text_tmap::const_iterator it = collectinfo.format.find("showtoppage");
     485    if ((it != collectinfo.format.end()) && ((*it).second == "false")) showtoppage = false;
     486    set_arrow_macros (arg_d, classifytype, showtoppage, disp,
     487              collectproto, collection, logout);
     488      }
    465489
    466490      if (args["u"] != "1") {
     
    572596}
    573597
    574 bool documentaction::do_action (cgiargsclass &args, recptproto *collectproto,
    575                 displayclass &disp, outconvertclass &outconvert,
    576                 ostream &textout, ostream &logout) {
     598bool documentaction::do_action (cgiargsclass &args, const ColInfoResponse_t &collectinfo,
     599                recptproto *collectproto, displayclass &disp,
     600                outconvertclass &outconvert, ostream &textout,
     601                ostream &logout) {
    577602
    578603  if (collectproto == NULL) {
     
    586611    FilterResponse_t response;
    587612    text_t toptitle, toptype, thistype, formatstring;
    588    
     613    bool cover = false;
     614
    589615    text_t &collection = args["c"];
    590616    text_t &arg_d = args["d"];
     
    612638    }
    613639
     640    text_tmap::const_iterator it = collectinfo.format.find(toptype + toptitle);
     641    if (it != collectinfo.format.end()) formatstring = (*it).second;
     642    it = collectinfo.format.find("cover");
     643    if (it != collectinfo.format.end()) cover = true;
     644
    614645    // output the table of contents
    615646    if (!arg_d.empty()) {
    616647     
    617648      if (toptype == "Hierarchy")
    618     hierarchy_toc (thistype, args, collectproto,
    619                disp, outconvert, textout, logout);
     649    output_toc (thistype, formatstring, args, cover, collectproto,
     650            disp, outconvert, textout, logout);
    620651      else
    621     // Book is the default for a document level toc - AZList, List and
    622     // DateList don't make sense for document level
     652    // Book is the default for a document level toc
    623653    book_toc (args, collectproto, disp,
    624654          outconvert, textout, logout);
     655
    625656    } else {
    626 
    627       // see if we can find a formatstring for this type of toc
    628       ColInfoResponse_t collectinfo;
    629       comerror_t err;
    630       collectproto->get_collectinfo (collection, collectinfo, err, logout);
    631       if (err == noError) {
    632     text_tmap::const_iterator it = collectinfo.format.find(toptype + toptitle);
    633     if (it != collectinfo.format.end()) formatstring = (*it).second;
    634       }
    635      
    636       if (toptype == "Hierarchy")
    637     hierarchy_toc (thistype, args, collectproto,
    638                disp, outconvert, textout, logout);
    639       else if (toptype == "DateList")
    640     datelist_toc (thistype, formatstring, args, collectproto,
    641               disp, outconvert, textout, logout);
    642       else
    643     // List is the default for a classification level toc - Book doesn't make
    644     // sense for classification level
    645     list_toc (thistype, formatstring, args, collectproto,
     657      // Book should never used at classification level (I think;)
     658      output_toc (thistype, formatstring, args, false, collectproto,
    646659          disp, outconvert, textout, logout);
    647660    }
Note: See TracChangeset for help on using the changeset viewer.