Ignore:
Timestamp:
2003-07-16T09:04:05+12:00 (21 years ago)
Author:
sjboddie
Message:

Added new format options for [DocTOC], [DocImage], [DocumentButtonDetach],
[DocumentButtonHighlight], [DocumentButtonExpandText], and
[DocumentButtonExpandContents]. These can all be inserted in a
DocumentText format string to allow more flexible arrangement of table of
contents, document buttons, etc.

File:
1 edited

Legend:

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

    r4906 r4936  
    2525
    2626#include <string.h>
     27#include <sstream>
     28
    2729#include "documentaction.h"
    2830#include "browsetools.h"
     
    416418  // _httppagehome_      overridden home url if html collections have own homepage
    417419
    418   // _usability_ - a macro for remote usability reporting
     420  // _usability_         a macro for remote usability reporting
    419421
    420422  // must have a valid collection server to continue
     423   
    421424  text_t &collection = args["c"];
    422425  if (collection.empty()) return;
     
    630633
    631634  // must have a valid collection server to continue
    632   text_t &collection = args["c"];
     635
     636   text_t &collection = args["c"];
    633637  if (collection.empty()) return;
    634638  recptproto *collectproto = protos->getrecptproto (collection, logout);
     
    692696       //call function in formattools.cpp which will return the text of the
    693697       //related documents in a vertical list. This is the default format.
     698
    694699       if (get_info (arg_d, collection, metadata, options, false, collectproto, response, logout))
    695700     relation += get_related_docs(collection, collectproto, response.docInfo[0], logout);
    696701       
    697702       //set macro to be the related document string
     703
    698704       disp.setmacro ("relateddoc", "document", relation);
    699705     }
     
    837843        << "</html>\n";
    838844      } else {
    839     output_document (OID, args, collectproto, disp, outconvert, textout, logout);   
     845    output_document (OID, args, collectproto, browsers, disp, outconvert, textout, logout);
    840846      }
    841847      return true;
     
    861867    if (!args["d"].empty()) {
    862868      textout << outconvert << "<p>\n";
    863       output_document (OID, args, collectproto, disp, outconvert, textout, logout);
     869      output_document (OID, args, collectproto, browsers, disp, outconvert, textout, logout);
    864870    }
    865871
     
    872878                  const TermInfo_tarray &terminfo, const text_t &OID,
    873879                  bool highlight, int hastxt, int wanttext,
    874                   text_t &collection, recptproto *collectproto, 
    875                   displayclass &disp, outconvertclass &outconvert,
    876                   ostream &textout, ostream &logout,
    877                   cgiargsclass &args) {
     880                  text_t &collection, recptproto *collectproto,
     881                  browsermapclass *browsers, displayclass &disp,
     882                  outconvertclass &outconvert, ostream &textout,
     883                  ostream &logout, cgiargsclass &args) {
    878884 
    879885  DocumentRequest_t docrequest;
     
    901907      text_tmap options;
    902908      options["text"] = docresponse.doc;
     909      options["DocImage"] = get_cover_image();
     910
     911      ostringstream tmpstr(ostringstream::binary);
     912      if (args["gc"] == "1") {
     913     expanded_contents (args, 0, false, browsers, formatinfo,
     914                collectproto, disp, outconvert, tmpstr,
     915                logout);
     916      } else {
     917     contracted_contents (args, 0, false, browsers, formatinfo,
     918                  collectproto, disp, outconvert, tmpstr, logout);
     919      }
     920      text_t tmp = (char *)(tmpstr.str().c_str());
     921      int len = tmp.size();
     922      char *ctmp = tmp.getcstr();
     923      utf8inconvertclass utf82text_t;
     924      utf82text_t.setinput(ctmp, len);
     925      convertclass::status_t status;
     926      utf82text_t.convert(tmp, status);
     927      options["DocTOC"] = tmp;
     928      delete ctmp;
     929
     930      options["DocumentButtonDetach"] = "_document:imagedetach_";
     931      if (args["hl"] == "1") {
     932     options["DocumentButtonHighlight"] = "_document:imagenohighlight_";
     933      } else {
     934     options["DocumentButtonHighlight"] = "_document:imagehighlight_";
     935      }
     936      if (args["gc"] == "1") {
     937     options["DocumentButtonExpandContents"] = "_document:imagecontracttoc_";
     938      } else {
     939     options["DocumentButtonExpandContents"] = "_document:imageexpandtoc_";
     940      }
     941      if (args["gt"] == "1") {
     942     options["DocumentButtonExpandText"] = "_document:imagecontracttext_";
     943      } else {
     944     options["DocumentButtonExpandText"] = "_document:imageexpandtext_";
     945      }
     946     
    903947      text_t doctext
    904948     = get_formatted_string (collection, collectproto, docinfo, disp,
     
    916960
    917961void documentaction::output_document (const text_t &OID, cgiargsclass &args,
    918                       recptproto *collectproto, displayclass &disp,
    919                       outconvertclass &outconvert, ostream &textout,
    920                       ostream &logout) {
     962                      recptproto *collectproto, browsermapclass *browsers,
     963                      displayclass &disp, outconvertclass &outconvert,
     964                      ostream &textout, ostream &logout) {
    921965  FilterResponse_t inforesponse;
    922966  FilterResponse_t queryresponse;
     
    930974  // if we have a query string and highlighting is turned on we need
    931975  // to redo the query to get the terms for highlighting
     976 
    932977  if (!args["q"].empty() && args.getintarg("hl")) {
    933978    FilterRequest_t request;
     
    9721017      output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo,
    9731018           OID, highlight, hastxt, wanttext, collection, collectproto,
    974            disp, outconvert, textout, logout, args);
     1019           browsers, disp, outconvert, textout, logout, args);
    9751020
    9761021
     
    10151060      output_text (thisdocinfo, formatlistptr, queryresponse.termInfo,
    10161061               OID, highlight, hastxt, wanttext, collection,
    1017                collectproto, disp, outconvert, textout, logout, args);
     1062               collectproto, browsers, disp, outconvert, textout, logout, args);
    10181063     
    10191064    }
     
    10321077      output_text (*sechere, formatlistptr, queryresponse.termInfo,
    10331078               (*sechere).OID, highlight, shastxt, wanttext, collection,
    1034                collectproto, disp, outconvert, textout, logout, args);
     1079               collectproto, browsers, disp, outconvert, textout, logout, args);
    10351080      count ++;
    10361081      sechere ++;
Note: See TracChangeset for help on using the changeset viewer.