Changeset 737 for trunk/gsdl/src/recpt


Ignore:
Timestamp:
1999-10-24T20:22:37+13:00 (25 years ago)
Author:
sjboddie
Message:

added a FullTOC option

File:
1 edited

Legend:

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

    r730 r737  
    2929/*
    3030   $Log$
     31   Revision 1.32  1999/10/24 07:22:37  sjboddie
     32   added a FullTOC option
     33
    3134   Revision 1.31  1999/10/20 03:54:20  sjboddie
    3235   problem with expanded contents
     
    269272
    270273
    271 static void recurse_contents (ResultDocInfo_t &section, cgiargsclass &args,
     274static void recurse_contents (ResultDocInfo_t &section, cgiargsclass &args, bool fulltoc,
    272275                  browserclass *bptr, text_tset &metadata, bool &getParents,
    273276                  format_t *formatlistptr, format_tmap &formatlistmap,
    274277                  formatinfo_t &formatinfo, browsermapclass *browsermap,
    275                   int colnumber, recptproto *collectproto, displayclass &disp,
     278                  int tabcount, recptproto *collectproto, displayclass &disp,
    276279                  outconvertclass &outconvert, ostream &textout, ostream &logout) {
    277280  text_t formatstring;
    278281
    279282  bool is_classify = false;
    280   if (args["d"].empty()) is_classify = true;
     283  if (args["d"].empty() || fulltoc) is_classify = true;
    281284
    282285  // output this section
    283286  bool use_table = is_table_content (formatlistptr);
    284   colnumber += bptr->output_section_group (section, args, colnumber, formatlistptr, use_table,
    285                        metadata, getParents, collectproto, disp, outconvert,
    286                        textout, logout);
     287  tabcount += bptr->output_section_group (section, args, tabcount, formatlistptr, use_table,
     288                      metadata, getParents, collectproto, disp, outconvert,
     289                      textout, logout);
    287290
    288291  text_t classification;
    289292  if (!is_classify) classification = "Document";
    290   else get_top (section.OID, classification);
     293  else get_top (args["cl"], classification);
    291294
    292295  int haschildren = section.metadata["haschildren"].values[0].getint();
    293296  const text_t &doctype = section.metadata["doctype"].values[0];
    294297  text_t classifytype = section.metadata["childtype"].values[0];
    295   // HLists are displayed as VLists when contents are expanded,
    296   // Paged documents are displayed as HLists
    297   if (classifytype == "HList") classifytype = "VList";
     298  // HLists and DateLists are displayed as VLists when contents
     299  // are expanded, Paged documents are displayed as HLists
     300  if (classifytype == "HList" || classifytype == "DateList") classifytype = "VList";
    298301  if (classifytype == "Paged") classifytype = "HList";
    299302
    300303  // recurse through children
    301   if ((haschildren == 1) && ((!is_classify) || (doctype == "classify"))) {
     304  if ((haschildren == 1) && (!is_classify || fulltoc || doctype == "classify")) {
    302305
    303306    // get browser for displaying children
     
    325328
    326329    while (thisdoc != lastdoc) {
    327       recurse_contents (*thisdoc, args, bptr, metadata, getParents,
     330      recurse_contents (*thisdoc, args, fulltoc, bptr, metadata, getParents,
    328331            formatlistptr, formatlistmap, formatinfo, browsermap,
    329             colnumber, collectproto, disp, outconvert, textout, logout);
     332            tabcount, collectproto, disp, outconvert, textout, logout);
    330333      thisdoc ++;
    331334    }
     
    341344// the current one
    342345
    343 static void expanded_contents (cgiargsclass &args, browsermapclass *browsermap,
    344                    formatinfo_t &formatinfo, recptproto *collectproto,
    345                    displayclass &disp, outconvertclass &outconvert,
    346                    ostream &textout, ostream &logout) {
     346static void expanded_contents (cgiargsclass &args, int tabcount, bool fulltoc,
     347                   browsermapclass *browsermap, formatinfo_t &formatinfo,
     348                   recptproto *collectproto, displayclass &disp,
     349                   outconvertclass &outconvert, ostream &textout,
     350                   ostream &logout) {
    347351 
    348352  if (args["d"].empty() && args["cl"].empty()) return;
     
    353357  text_tset metadata;
    354358  text_t classifytype, classification, formatstring;
    355   int colnumber = 0;
    356359
    357360  if (!args["d"].empty()) {
    358     // document level - expand from top
    359     get_top (args["d"], OID);
    360     classification = "Document";
     361    // document level
     362    if (fulltoc) {
     363      get_top (args["cl"], OID);
     364      classification = OID;
     365    }
     366    else {
     367      // always expand document level from top
     368      get_top (args["d"], OID);
     369      classification = "Document";
     370    }
    361371  } else {
    362372    // classification level
     
    416426  formatlistmap[formatstring] = formatlistptr;
    417427
    418   recurse_contents (response.docInfo[0], args, bptr, metadata,
     428  recurse_contents (response.docInfo[0], args, fulltoc, bptr, metadata,
    419429            getParents, formatlistptr, formatlistmap, formatinfo, browsermap,
    420             colnumber, collectproto, disp, outconvert, textout, logout);
     430            tabcount, collectproto, disp, outconvert, textout, logout);
    421431
    422432  // clean up format list pointers
     
    485495                browsermapclass *browsermap, formatinfo_t &formatinfo,
    486496                format_tmap &formatlistmap, const text_t &classification,
    487                 int &colnumber, text_tset &metadata, bool &getParents,
     497                int &tabcount, text_tset &metadata, bool &getParents,
    488498                recptproto *collectproto, displayclass &disp,
    489499                outconvertclass &outconvert, ostream &textout,
     
    523533   
    524534    use_table = is_table_content (formatlistptr);
    525     colnumber += bptr->output_section_group (*thisparent, args, colnumber, formatlistptr, use_table,
    526                          metadata, getParents, collectproto, disp, outconvert,
    527                         textout, logout);
     535    tabcount += bptr->output_section_group (*thisparent, args, tabcount, formatlistptr,
     536                        use_table, metadata, getParents, collectproto,
     537                        disp, outconvert, textout, logout);
    528538    first = false;
    529539    thisparent ++;
     
    532542
    533543
    534 static void contracted_contents (cgiargsclass &args, browsermapclass *browsermap,
    535                  formatinfo_t &formatinfo, recptproto *collectproto,
    536                  displayclass &disp, outconvertclass &outconvert,
    537                  ostream &textout, ostream &logout) {
     544static void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc,
     545                 browsermapclass *browsermap, formatinfo_t &formatinfo,
     546                 recptproto *collectproto, displayclass &disp,
     547                 outconvertclass &outconvert, ostream &textout,
     548                 ostream &logout) {
    538549  FilterResponse_t response;
    539550  text_tset metadata;
     
    546557    OID = args["cl"];
    547558    get_top (OID, classification);
    548   }
    549   int colnumber = 0;
     559  } else if (fulltoc)
     560    get_top (args["cl"], classification);   
    550561
    551562  bool haschildren = has_children (OID, args["c"], collectproto, logout);
    552563
     564  if ((!args["d"].empty()) && fulltoc)
     565    get_parents_array (args["cl"] + ".fc", parents);
    553566  if (haschildren) get_parents_array (OID + ".fc", parents);
    554567  else get_parents_array (OID, parents);
     
    572585    // display each parent
    573586    output_parents (response, args, browsermap, formatinfo, formatlistmap,
    574             classification, colnumber, metadata, getParents,
     587            classification, tabcount, metadata, getParents,
    575588            collectproto, disp, outconvert, textout, logout);
    576589   
     
    618631  // display children
    619632  bool use_table = is_table_content (formatlistptr);
    620   bptr->output_section_group (response, args, colnumber, formatlistptr, use_table,
     633  bptr->output_section_group (response, args, tabcount, formatlistptr, use_table,
    621634                  metadata, getParents, collectproto, disp, outconvert,
    622635                  textout, logout);
     
    630643                 ostream &textout, ostream &logout) {
    631644
     645  int tabcount = 0;
    632646  bool havecontrols = false;
     647  bool fulltoc = false;
     648
     649  if (args["cl"] != "search") {
     650    // see if there's a FullTOC string
     651    text_t cl_top, full_toc;
     652    get_top (args["cl"], cl_top);
     653    if (get_formatstring (cl_top, "FullTOC", formatinfo.formatstrings, full_toc))
     654      if (full_toc == "true") fulltoc = true;
     655  }
    633656 
    634657  // get the cover image (if there is one) and the control buttons
    635658  // if we're inside a book
    636   if (!args["d"].empty()) {
     659  if ((!fulltoc) && (!args["d"].empty())) {
    637660    textout << "<p><table cellpadding=0 cellspacing=0><tr>\n";
    638661    textout << "<td valign=top";
    639     if (formatinfo.DocumentContents) textout << "width=200>\n";
    640     else textout << "width=100%>\n";
     662    if (formatinfo.DocumentContents) textout << " width=200>\n";
     663    else textout << " width=100%>\n";
    641664    if (formatinfo.DocumentImages)
    642665      output_cover_image (args, collectproto, disp, outconvert, textout, logout);
     
    653676     
    654677      // expanded table of contents
    655       expanded_contents (args, browsermap, formatinfo, collectproto,
    656              disp, outconvert, textout, logout);
     678      expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo,
     679             collectproto, disp, outconvert, textout, logout);
    657680    } else {
    658681     
    659682      // contracted table of contents
    660       contracted_contents (args, browsermap, formatinfo, collectproto,
    661                disp, outconvert, textout, logout);
     683      contracted_contents (args, tabcount, fulltoc, browsermap, formatinfo,
     684               collectproto, disp, outconvert, textout, logout);
    662685    }
    663686  }
Note: See TracChangeset for help on using the changeset viewer.