Changeset 2485


Ignore:
Timestamp:
2001-05-30T13:39:18+12:00 (20 years ago)
Author:
sjboddie
Message:

Rewound cstr to use the old browsetools etc approach rather than the
LeftColumn etc methods

Location:
trunk/cstr
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/cstr/macros/cstr.dm

    r1964 r2485  
    3030_imagefigures_ [c=cstr] {_gsimage_(_httpcurrentdocument_&gg=figures,_document:httpiconefigof_,_document:httpiconefigon_,fig,_document:texticonfigures_)}
    3131
    32 _httpiconepsof_ [c=cstr] {_httpcollection_/images/epsof.gif}
    33 _httpiconepson_ [c=cstr] {_httpcollection_/images/epson.gif}
     32_httpiconepsof_ [c=cstr] {_httpprefix_/collect/cstr/images/epsof.gif}
     33_httpiconepson_ [c=cstr] {_httpprefix_/collect/cstr/images/epson.gif}
    3434_widthepsx_ [c=cstr] {64}
    3535_heightepsx_ [c=cstr] {30}
    3636
    37 _httpiconetextof_ [c=cstr] {_httpcollection_/images/etextof.gif}
    38 _httpiconetexton_ [c=cstr] {_httpcollection_/images/etexton.gif}
     37_httpiconetextof_ [c=cstr] {_httpprefix_/collect/cstr/images/etextof.gif}
     38_httpiconetexton_ [c=cstr] {_httpprefix_/collect/cstr/images/etexton.gif}
    3939_widthetextx_ [c=cstr] {65}
    4040_heightetextx_ [c=cstr] {30}
    4141
    42 _httpiconeabstrof_ [c=cstr] {_httpcollection_/images/eabstrof.gif}
    43 _httpiconeabstron_ [c=cstr] {_httpcollection_/images/eabstron.gif}
     42_httpiconeabstrof_ [c=cstr] {_httpprefix_/collect/cstr/images/eabstrof.gif}
     43_httpiconeabstron_ [c=cstr] {_httpprefix_/collect/cstr/images/eabstron.gif}
    4444_widtheabstrx_ [c=cstr] {65}
    4545_heighteabstrx_ [c=cstr] {30}
    4646
    47 _httpiconefigof_ [c=cstr] {_httpcollection_/images/efigof.gif}
    48 _httpiconefigon_ [c=cstr] {_httpcollection_/images/efigon.gif}
     47_httpiconefigof_ [c=cstr] {_httpprefix_/collect/cstr/images/efigof.gif}
     48_httpiconefigon_ [c=cstr] {_httpprefix_/collect/cstr/images/efigon.gif}
    4949_widthefigx_ [c=cstr] {47}
    5050_heightefigx_ [c=cstr] {30}
  • trunk/cstr/src/recpt/Makefile.in

    r1065 r2485  
    4646RANLIB = @RANLIB@
    4747LDFLAGS = @LDFLAGS@
     48#LIBS = -lgdbm -lstdc++ -lm -lcrypt
    4849LIBS = @LIBS@
    4950
     
    6465
    6566
    66 HEADERS = cstrdocaction.h
     67HEADERS = cstrdocaction.h cstrbrowsetools.h cstrpagedbrowserclass.h
    6768
    68 SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp
     69SOURCES = cstrlibrarymain.cpp cstrdocaction.cpp cstrbrowsetools.cpp \
     70      cstrpagedbrowserclass.cpp
    6971
    7072
    71 OBJECTS = cstrlibrarymain.o cstrdocaction.o
     73OBJECTS = cstrlibrarymain.o cstrdocaction.o cstrbrowsetools.o \
     74      cstrpagedbrowserclass.o
    7275
    7376
     
    123126    $(MAINRECPTDIR)/usersaction.o \
    124127    $(MAINRECPTDIR)/userdb.o \
    125     $(MAINRECPTDIR)/delhistoryaction.o \
    126128    $(MAINRECPTDIR)/historydb.o \
    127129    $(MAINCOLSERVRDIR)/mgq.o \
     
    135137    $(MAINCOLSERVRDIR)/browsefilter.o \
    136138    $(MAINCOLSERVRDIR)/queryfilter.o \
    137     $(MAINCOLSERVRDIR)/phrasequeryfilter.o \
     139    $(MAINCOLSERVRDIR)/mgqueryfilter.o \
     140    $(MAINCOLSERVRDIR)/mgppqueryfilter.o \
    138141    $(MAINCOLSERVRDIR)/phrasesearch.o \
    139142    $(MAINCOLSERVRDIR)/mggdbmsource.o \
     143    $(MAINCOLSERVRDIR)/search.o \
    140144    $(MAINCOLSERVRDIR)/mgsearch.o \
     145    $(MAINCOLSERVRDIR)/mgppsearch.o \
     146    $(MAINCOLSERVRDIR)/collectset.o \
    141147    $(GD)/lib/gsdllib.a  \
    142148    $(GD)/packages/mg/src/text/libtextin.a \
    143     $(GD)/packages/mg/lib/libmg.a
     149    $(GD)/packages/mg/lib/libmg.a \
     150    $(GD)/src/mgpp/text/libtextin.a \
     151    $(GD)/src/mgpp/lib/libmg.a
     152
    144153
    145154ifneq ($(USE_FASTCGI), 1)
  • trunk/cstr/src/recpt/cstrdocaction.cpp

    r1065 r2485  
    2828/*
    2929   $Log$
    30    Revision 1.3  2000/04/04 04:43:07  nzdl
    31    caught cstr collection up with DocumentColumn stuff
     30   Revision 1.4  2001/05/30 01:39:18  sjboddie
     31   Rewound cstr to use the old browsetools etc approach rather than the
     32   LeftColumn etc methods
    3233
    3334   Revision 1.2  2000/02/06 21:25:21  sjboddie
     
    4243#include <string.h>
    4344#include "cstrdocaction.h"
     45#include "cstrbrowsetools.h"
     46#include "browsetools.h"
    4447#include "OIDtools.h"
    4548#include "querytools.h"
    46 #include "cgiutils.h"
     49#include "unitool.h"
    4750
    4851cstrdocaction::cstrdocaction () {
     
    7780}
    7881
    79 void cstrdocaction::output_controls (cgiargsclass &args, const text_tarray &ibuttons,
    80                      recptproto *collectproto, displayclass &disp,
    81                      outconvertclass &outconvert, ostream &textout,
    82                      ostream &logout) {
    83 
    84 
    85   if (args["u"] != "1") {
    86 
    87     text_tarray buttons;
    88     text_t &arg_gg = args["gg"];
    89 
    90     text_tarray::const_iterator here = ibuttons.begin();
    91     text_tarray::const_iterator end = ibuttons.end();
    92    
    93     while (here != end) {
    94      
    95       if (*here == "Detach")
    96     buttons.push_back ("_document:imagedetach_");
    97       else if ((*here == "Highlight") && (arg_gg == "text")) {
    98     if (args["hl"] == "1")
    99       buttons.push_back ("_document:imagenohighlight_");
    100     else
    101       buttons.push_back ("_document:imagehighlight_");
    102       } else if ((*here == "Expand Text") && arg_gg == "text") {
    103     if (args.getintarg("gt"))
    104       buttons.push_back ("_document:imagecontracttext_");
    105     else
    106       buttons.push_back ("_document:imageexpandtext_");
    107       }
    108       here ++;
    109     }
    110 
    111     FilterResponse_t response;
    112     text_tset metadata;
    113     text_t top;
    114     get_top (args["d"], top);
    115     metadata.insert ("figures");
    116     metadata.insert ("Description");
    117     metadata.insert ("Source");
    118     if (get_info (top, args["c"], metadata, false, collectproto, response, logout)) {
    119       text_t &figures = response.docInfo[0].metadata["figures"].values[0];
    120       text_t &description = response.docInfo[0].metadata["Description"].values[0];
    121       text_t &source = response.docInfo[0].metadata["Source"].values[0];
    122 
    123       if (!source.empty())
    124     buttons.push_back ("_document:imagepostscript_(" + cgi_safe(source) + ")");
    125      
    126       if ((!description.empty()) && (arg_gg != "abstract"))
    127     buttons.push_back ("_document:imageabstract_");
    128      
    129       if ((!figures.empty()) && (arg_gg != "figures"))
    130     buttons.push_back ("_document:imagefigures_");
    131      
    132       if (arg_gg != "text")
    133     buttons.push_back ("_document:imageviewtext_");
    134     }
    135      
    136     here = buttons.begin();
    137     end = buttons.end();
    138     int count = 0;
    139     while (here != end) {
    140       if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";
    141       textout << outconvert << disp << *here;
    142       count ++;
    143       here ++;
    144     }
    145   }
    146 }
    147 
    148 
    14982
    15083void cstrdocaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass * /*protos*/,
     
    177110   
    178111  int arg_gt = args.getintarg("gt");
     112  //  int arg_gc = args.getintarg("gc");
    179113  int arg_hl = args.getintarg("hl");
    180114
     
    192126      else
    193127    javaimagescontent += "_javaexpandtext_";
     128      //    } else if (*button_here == "Expand Contents") {
     129      //      if (arg_gc == 1)
     130      //    javaimagescontent += "_javacontractcontents_";
     131      //      else
     132      //    javaimagescontent += "_javaexpandcontents_";
    194133    } else if (*button_here == "Highlight" && arg_gg == "text") {
    195134      if (arg_hl == 1)
     
    203142  disp.setmacro ("javaimagescontent", "document", javaimagescontent);
    204143}
     144
     145
     146
     147/*
     148// define all the macros which are related to pages generated
     149// by this action. we also load up the formatinfo structure
     150// here (it's used in do_action as well as here)
     151void cstrdocaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
     152                        cgiargsclass &args, recptproto *collectproto,
     153                        ostream &logout) {
     154 
     155  // define_internal_macros sets the following macros:
     156
     157  // _pagetitle_            the title to be displayed at the top of the browser window
     158 
     159  // _imagethispage_        the title image to be displayed at top right of page
     160 
     161  // _classificationlinks_  the links between classifications to be displayed
     162  //                        at top of list or datelist classifications
     163
     164  // _httpprevarrow_        these are set if next or previous arrows
     165  // _httpnextarrow_        are to be used - (i.e. if it's an AZList or a DateList
     166  //                        classifytype at a top level or if it's a Book or a
     167  //                        Hierarchy classifytype at document level
     168
     169  // _navarrows_            this may be overridden to "" when format option
     170  //                        DocumentArrowsBottom is false
     171
     172  // _header_               the header macro is overridden if we're not at a top level
     173  //                        classification to remove the title block
     174
     175  // _javaimagescontent_    this is the javascript code to shove in to make the
     176  //                        flashy buttons work
     177
     178  // _thisOID_              the OID (directory) of the current document - this corresponds
     179  //                        to the archivedir metadata element
     180
     181  // can't do anything if collectproto is null (i.e. no collection was specified)
     182  if (collectproto == NULL) return;
     183 
     184  text_tarray metadata;
     185  FilterResponse_t response;
     186  text_t &arg_d = args["d"];
     187  text_t &arg_cl = args["cl"];
     188  text_t &collection = args["c"];
     189  int gt = args.getintarg("gt");
     190  load_formatinfo (collectinfo.format, gt);
     191
     192  // don't want arrows or goto if we're in figures or facsimiles
     193  if (args["gg"] != "text") {
     194    formatinfo.DocumentArrowsBottom = false;
     195    formatinfo.DocumentArrowsTop = false;
     196    formatinfo.DocumentGoTo = false;
     197  }
     198
     199  if (!formatinfo.DocumentArrowsBottom)
     200    disp.setmacro("navarrows", "document", "");
     201
     202  metadata.push_back ("Title");
     203  metadata.push_back ("classifytype");
     204  metadata.push_back ("archivedir");
     205 
     206  if (!arg_d.empty()) {
     207    // we're at document level
     208   
     209    // get metadata for this document and it's parents
     210    if (get_info (arg_d, collection, metadata, true, collectproto, response, logout)) {
     211      disp.setmacro ("header", "document", "_textheader_");
     212
     213      disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]);
     214
     215      text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
     216      if (classifytype.empty()) classifytype = "Book"; // defaults to Book
     217
     218      // set arrow macros if required
     219      if (((classifytype == "Book") && (formatinfo.DocumentArrowsTop || formatinfo.DocumentArrowsBottom)) ||
     220      ((classifytype == "Hierarchy") && formatinfo.DocumentArrowsBottom))
     221    set_arrow_macros (arg_d, classifytype, formatinfo.DocumentTopPages,
     222              disp, collectproto, collection, logout);
     223     
     224      if (args["u"] != "1")
     225    set_java_macros (args, disp);
     226
     227    }
     228  } else {
     229    if (!arg_cl.empty()) {
     230   
     231      // get metadata for top level classification
     232      text_t classtop;
     233      get_top (arg_cl, classtop);
     234      if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
     235     
     236    text_t &title = response.docInfo[0].metadata["Title"].values[0];
     237    text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
     238
     239    disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
     240    disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
     241
     242    // now get the metadata for each child of top level
     243    // so we can generate the _classificationlinks_ and arrow macros
     244    // (if they're required by the current classification type)
     245   
     246    if ((classifytype == "AZList") || (classifytype == "DateList"))
     247      get_classificationlinks (arg_cl, collection, collectproto, disp, logout);
     248     
     249      }
     250    }
     251  }
     252}
     253
     254*/
    205255
    206256void cstrdocaction::output_document (const text_t &OID, cgiargsclass &args,
     
    226276    textout << outconvert << disp << "_textnoabstract_";
    227277    }
    228 
    229278  } else if (arg_gg == "figures") {
    230279    metadata.insert ("figures");
     
    241290    while (this_figure != end_figure) {
    242291      textout << outconvert << disp
    243           << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/"
     292          << "<p><center><img border=1 src=\"_httpprefix_/collect/cstr/index/assoc/_thisOID_/"
    244293          << *this_figure << "\"></center>\n";
    245294      this_figure ++;
     
    249298      }
    250299    }
    251 
    252300  } else if (arg_gg == "facsimiles") {
    253301    metadata.insert ("facsimiles");
     
    255303    get_top (OID, top);
    256304    if (get_info (top, collection, metadata, false, collectproto, inforesponse, logout)) {
    257 
    258       text_tarray::const_iterator this_facs = inforesponse.docInfo[0].metadata["facsimiles"].values.begin();
    259       text_tarray::const_iterator end_facs = inforesponse.docInfo[0].metadata["facsimiles"].values.end();
    260       while (this_facs != end_facs) {
    261     textout << outconvert << disp
    262         << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/"
    263         << *this_facs << "\"></center>\n";
    264     this_facs ++;
     305      text_t &facsimiles = inforesponse.docInfo[0].metadata["facsimiles"].values[0];
     306     
     307      if (!facsimiles.empty()) {
     308    text_tarray facs_array;
     309    splitchar (facsimiles.begin(), facsimiles.end(), ',', facs_array);
     310    text_tarray::const_iterator this_facs = facs_array.begin();
     311    text_tarray::const_iterator end_facs = facs_array.end();
     312    while (this_facs != end_facs) {
     313      textout << outconvert << disp
     314            << "<p><center><img border=1 src=\"_httpprefix_/collect/cstr/index/assoc/_thisOID_/"
     315          << *this_facs << "\"></center>\n";
     316      this_facs ++;
     317    }
     318      } else {
     319    textout << outconvert << disp << "_textnofacsimiles_";
    265320      }
    266     } else {
    267       textout << outconvert << disp << "_textnofacsimiles_";
    268     }
     321    }     
    269322   
    270323  } else {
     
    274327    int wanttext = 0;
    275328    int arg_gt = args.getintarg("gt");
    276    
     329
    277330    // if we have a query string and highlighting is turned on we need
    278331    // to redo the query to get the terms for highlighting
     
    391444
    392445
    393 
    394 
    395 
    396 
    397 
    398 
    399 
    400 
    401 
    402 
     446bool cstrdocaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
     447                browsermapclass *browsers, displayclass &disp,
     448                outconvertclass &outconvert, ostream &textout,
     449                ostream &logout) {
     450
     451
     452  // must have a valid collection server
     453  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
     454  if (collectproto == NULL) {
     455    logout << "cstrdocaction::do_action called with NULL collectproto\n";
     456    textout << outconvert << disp << "_document:header_\n"
     457        << "Error: Attempt to get document without setting collection\n"
     458        << "_document:footer_\n";
     459  } else { 
     460   
     461    text_t OID = args["d"];
     462    if (OID.empty()) OID = args["cl"];
     463    if (OID.empty()) {
     464      textout << outconvert << disp << "Document contains no data_document:footer_\n";
     465      return true;
     466    }
     467
     468    textout << outconvert << disp << "_document:header_\n"
     469        << "_document:content_\n";
     470
     471    if (args["d"].empty()) {
     472      output_toc (args, browsers, formatinfo, collectproto,
     473          disp, outconvert, textout, logout);
     474    } else {
     475      output_cstr_toc (args, browsers, formatinfo, collectproto,
     476               disp, outconvert, textout, logout);
     477
     478      textout << "<p>\n";
     479      output_document (OID, args, collectproto, disp, outconvert, textout, logout);
     480    }
     481
     482    textout << outconvert << disp << "_document:footer_\n";
     483  }
     484  return true;
     485}
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
  • trunk/cstr/src/recpt/cstrdocaction.h

    r1065 r2485  
    3636protected:
    3737
    38   void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
    39             recptproto *collectproto, displayclass &disp,
    40             outconvertclass &outconvert, ostream &textout,
    41             ostream &logout);
    42 
    4338  void set_java_macros (cgiargsclass &args, displayclass &disp);
    4439
     
    5348  virtual ~cstrdocaction ();
    5449
     50
    5551  void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
    5652             response_t &response,text_t &response_data,
    5753             ostream &logout);
     54 
     55  //  void define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
     56                   //                  cgiargsclass &args, recptproto *collectproto,
     57                   //                  ostream &logout);
     58   
     59  bool do_action (cgiargsclass &args, recptprotolistclass *protos,
     60          browsermapclass *browsers, displayclass &disp,
     61          outconvertclass &outconvert, ostream &textout,
     62          ostream &logout);
     63 
    5864};
    5965
  • trunk/cstr/src/recpt/cstrlibrarymain.cpp

    r1964 r2485  
    2626
    2727#include "receptionist.h"
    28 #include "collectset.h"
    2928#include "cgiwrapper.h"
    3029#include "nullproto.h"
     30#include "collectserver.h"
     31#include "filter.h"
     32#include "browsefilter.h"
     33#include "queryfilter.h"
     34#include "infodbclass.h"
     35#include "mgsearch.h"
     36#include "mggdbmsource.h"
    3137#include "fileutil.h"
     38#include "collectset.h"
    3239#include <assert.h>
    3340
     
    4047#include "authenaction.h"
    4148#include "usersaction.h"
     49#include "authenaction.h"
    4250
    4351#include "browserclass.h"
     
    4654#include "datelistbrowserclass.h"
    4755#include "invbrowserclass.h"
    48 #include "pagedbrowserclass.h"
     56#include "cstrpagedbrowserclass.h"
    4957#include "htmlbrowserclass.h"
    5058
     
    112120  recpt.add_browser (&ainvbrowserclass);
    113121
    114   pagedbrowserclass apagedbrowserclass;
     122  cstrpagedbrowserclass apagedbrowserclass;
    115123  recpt.add_browser (&apagedbrowserclass);
    116124
     
    121129  return 0;
    122130}
     131
     132
     133
     134
Note: See TracChangeset for help on using the changeset viewer.