Changeset 12183


Ignore:
Timestamp:
2006-07-12T21:48:07+12:00 (18 years ago)
Author:
sjboddie
Message:

Added expand_from_current_level option to browsetoolsclass::expanded_contents

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

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

    r12044 r12183  
    214214// for an HList when contents are expanded (i.e. it's displayed as a VList)
    215215//
    216 // if we're inside a document we expand all contents from the top,
    217 // if we're at classification level we'll just expand out those contents below
    218 // the current one
     216// if we're inside a document we expand all contents from the top (unless
     217// expand_from_current_level is true), if we're at classification level we'll just
     218// expand out those contents below the current one
    219219
    220220void browsetoolsclass::expanded_contents(cgiargsclass &args, int tabcount, bool fulltoc,
     
    222222                                         recptproto *collectproto, displayclass &disp,
    223223                                         outconvertclass &outconvert, ostream &textout,
    224                                          ostream &logout)
     224                                         ostream &logout, bool expand_from_current_level)
    225225{
    226226  if (args["d"].empty() && args["cl"].empty()) return;
     
    232232  text_t classifytype, classification, formatstring;
    233233
    234   if (!args["d"].empty()) {
    235     // document level
    236     if (fulltoc) {
    237       get_top (args["cl"], OID);
    238       classification = OID;
    239     }
    240     else {
    241       // always expand document level from top
    242       get_top (args["d"], OID);
    243       classification = "Document";
    244     }
    245   } else {
    246     // classification level
    247     OID = args["cl"];
    248     get_top (args["cl"], classification);
    249   }
     234  if (!args["d"].empty())
     235    {
     236      // document level
     237      if (fulltoc)
     238        {
     239          get_top(args["cl"], OID);
     240          classification = OID;
     241        }
     242      else
     243        {
     244          classification = "Document";
     245          if (expand_from_current_level)
     246            {
     247              OID = args["d"];
     248            }
     249          else
     250            {
     251              // Always expand document level from top, unless
     252              // expand_from_current_level is true.
     253              get_top(args["d"], OID);
     254            }
     255        }
     256    }
     257  else
     258    {
     259      // classification level
     260      OID = args["cl"];
     261      get_top(args["cl"], classification);
     262    }
    250263
    251264  // get classifytype of this level
     
    815828     
    816829    }
    817     if (args.getintarg("gc") == 1) {
    818      
    819       // expanded table of contents
    820       expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo,
    821              collectproto, disp, outconvert, textout, logout);
    822     } else if (args.getintarg("gc") == 2) {
    823 
    824         // expand visible levels of table of contents
    825       expand_show_contents(args, tabcount, fulltoc, browsermap, formatinfo,
    826             collectproto, disp, outconvert, textout, logout);
    827     } else {
    828      
    829       // contracted table of contents
    830       contracted_contents (args, tabcount, fulltoc, browsermap, formatinfo,
    831                collectproto, disp, outconvert, textout, logout);
    832     }
     830    if (args.getintarg("gc") == 1)
     831      {
     832        // expanded table of contents
     833        expanded_contents(args, tabcount, fulltoc, browsermap, formatinfo,
     834                          collectproto, disp, outconvert, textout, logout, false);
     835      }
     836    else if (args.getintarg("gc") == 2)
     837      {
     838        // expand visible levels of table of contents
     839        expand_show_contents(args, tabcount, fulltoc, browsermap, formatinfo,
     840                             collectproto, disp, outconvert, textout, logout);
     841      }
     842    else
     843      {
     844        // contracted table of contents
     845        contracted_contents(args, tabcount, fulltoc, browsermap, formatinfo,
     846                            collectproto, disp, outconvert, textout, logout);
     847      }
    833848    textout << outconvert << "</div>\n";
    834849  }
     
    850865    {
    851866      expanded_contents(args, 0, false, browsers, formatinfo, collectproto,
    852                         disp, outconvert, *tmpstr, logout);
     867                        disp, outconvert, *tmpstr, logout, false);
    853868    }
    854869  else
  • trunk/gsdl/src/recpt/browsetoolsclass.h

    r12044 r12183  
    5454                                     displayclass &disp, outconvertclass &outconvert, ostream &logout);
    5555
    56 protected:
    57 
    58   typedef map<text_t, format_t*, lttext_t> format_tmap;
    59 
    6056  virtual void expanded_contents(cgiargsclass &args, int tabcount, bool fulltoc,
    6157                                 browsermapclass *browsermap, formatinfo_t &formatinfo,
    6258                                 recptproto *collectproto, displayclass &disp,
    6359                                 outconvertclass &outconvert, ostream &textout,
    64                                  ostream &logout);
     60                                 ostream &logout, bool expand_from_current_level);
    6561
    6662  virtual void expand_show_contents(cgiargsclass &args, int tabcount, bool fulltoc,
     
    7066                                    ostream &logout);
    7167
     68  virtual void contracted_contents(cgiargsclass &args, int tabcount, bool fulltoc,
     69                                   browsermapclass *browsermap, formatinfo_t &formatinfo,
     70                                   recptproto *collectproto, displayclass &disp,
     71                                   outconvertclass &outconvert, ostream &textout,
     72                                   ostream &logout);
     73
     74protected:
     75
     76  typedef map<text_t, format_t*, lttext_t> format_tmap;
     77
    7278  virtual void recurse_contents_levels(text_tarray &parents, cgiargsclass &args, int coloffset,
    7379                                       int tabcount, bool fulltoc, browsermapclass *browsermap,
     
    7581                                       displayclass &disp, outconvertclass &outconvert,
    7682                                       ostream &textout, ostream &logout);
    77 
    78   virtual void contracted_contents(cgiargsclass &args, int tabcount, bool fulltoc,
    79                                    browsermapclass *browsermap, formatinfo_t &formatinfo,
    80                                    recptproto *collectproto, displayclass &disp,
    81                                    outconvertclass &outconvert, ostream &textout,
    82                                    ostream &logout);
    8383
    8484  virtual void output_titles(cgiargsclass &args, recptproto *collectproto,
     
    120120                              outconvertclass &outconvert, ostream &textout,
    121121                              ostream &logout);
    122 
    123 
    124 
    125122};
    126123
Note: See TracChangeset for help on using the changeset viewer.