Changeset 172 for trunk/gsdl


Ignore:
Timestamp:
1999-02-26T10:59:02+13:00 (25 years ago)
Author:
rjmcnab
Message:

Merged sources.

Location:
trunk/gsdl
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/macros/base.dm

    r156 r172  
    2222#######################################################################
    2323
    24 _gwcgi_ {http://nowhere.nzdl.org/cgi-bin/gw}
    25 _httpprefix_ {http://nowhere.nzdl.org}
     24#_gwcgi_ {http://nowhere.nzdl.org/cgi-bin/gw}
     25#_httpprefix_ {http://nowhere.nzdl.org}
    2626
    2727_cookie_ {}
     
    460460_httpicontsrchof_ [language=mi] {_httpimg_/mtsrchof.gif}
    461461_httpicontsrchon_ {_httpimg_/tsrchon.gif}
    462 _httpicontsrchon_ [language=mi] {_httpimg_/tsrchon.gif}
     462_httpicontsrchon_ [language=mi] {_httpimg_/mtsrchon.gif}
    463463_widthtsrchx_ {87}
    464464_heighttsrchx_ {17}
  • trunk/gsdl/src/library/browse.cpp

    r124 r172  
    1212/*
    1313   $Log$
     14   Revision 1.9  1999/02/25 21:58:55  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.8  1999/01/21 21:20:10  sjboddie
    1519   removed unused collection parameter from several functions
     
    429433// get_alphabet_links adds the html for the letter selection links to return_text
    430434void browseclass::get_alphabet_links (const text_t &classification,
    431                       const text_t &booksection, gdbmclass &gdbm,
     435                      const text_t &/*booksection*/, gdbmclass &gdbm,
    432436                      text_t &return_text) {
    433437 
  • trunk/gsdl/src/library/libinterface.cpp

    r162 r172  
    1212/*
    1313   $Log$
     14   Revision 1.22  1999/02/25 21:58:55  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.21  1999/02/21 22:29:57  rjmcnab
    1519
     
    662666
    663667void libinterface::define_general_macros (cgiargsclass &args, outconvertclass &outconvert,
    664                       ostream &logout) {
     668                      ostream &/*logout*/) {
    665669  disp.setmacro("httpprefix", "Global", httpprefix);
    666670  disp.setmacro("gwcgi", "Global", gwcgi);
     
    897901void libinterface::docLinks (cgiargsclass &args,
    898902                 queryresultsclass &queryresults,
    899                  ostream &logout)
     903                 ostream &/*logout*/)
    900904{
    901905  text_t links;
     
    12621266// highlighttext highlights query terms in text string and outputs the resulting text string
    12631267void libinterface::highlighttext(text_tarray &termvars, outconvertclass &outconvert,
    1264                  ostream &textout, ostream &logout, text_t &text) {
     1268                 ostream &textout, ostream &/*logout*/, text_t &text) {
    12651269  map<text_t, int, lttext_t> terms;
    12661270  map<text_t, int, lttext_t>::const_iterator it;
     
    13191323}
    13201324
    1321 void libinterface::define_pref_macros (cgiargsclass &args, ostream &logout)
     1325void libinterface::define_pref_macros (cgiargsclass &args, ostream &/*logout*/)
    13221326{
    13231327  // the caseoption macro
  • trunk/gsdl/src/library/libinterface.h

    r138 r172  
    198198
    199199  virtual void define_collection_macros (cgiargsclass &/*args*/, ostream &/*logout*/) {}
    200   virtual bool collection_init(const text_t &collection) {return true;}
     200  virtual bool collection_init(const text_t &/*collection*/) {return true;}
    201201  virtual void displaydocsummary (cgiargsclass &/*args*/, outconvertclass &/*outconvert*/,
    202202                  ostream &/*textout*/, ostream &/*logout*/,
  • trunk/gsdl/src/recpt/Makefile

    r165 r172  
    1111AR = ar
    1212CC = gcc
    13 CCFLAGS = -g -Wall -Wunused -pedantic -W
     13CCFLAGS = -g -Wall -Wunused -pedantic -W -Woverloaded-virtual
    1414DEFS = -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DUSE_FASTCGI -DGSDLSERVER
    1515INCLUDES = -I../../lib -I../../packages/mg-1.3d -I../../packages/mg-1.3d/lib \
  • trunk/gsdl/src/recpt/action.cpp

    r165 r172  
    1212/*
    1313   $Log$
     14   Revision 1.7  1999/02/25 21:58:58  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.6  1999/02/21 22:33:52  rjmcnab
    1519
     
    115119// returns false if there was an error which prevented the action
    116120// from outputing anything.
    117 bool action::do_action (cgiargsclass &/*args*/, outconvertclass &/*outconvert*/,
    118             recptproto */*collectproto*/, ostream &/*textout*/,
    119             ostream &/*logout*/) {
     121bool action::do_action (cgiargsclass &/*args*/, recptproto */*collectproto*/,
     122            displayclass &/*disp*/, outconvertclass &/*outconvert*/,
     123            ostream &/*textout*/, ostream &/*logout*/) {
    120124  return true;
    121125}
     126
    122127
    123128
  • trunk/gsdl/src/recpt/action.h

    r165 r172  
    7676  // returns false if there was an error which prevented the action
    7777  // from outputing anything.
    78   virtual bool do_action (cgiargsclass &args, outconvertclass &outconvert,
    79               recptproto *collectproto, ostream &textout,
    80               ostream &logout);
     78  virtual bool do_action (cgiargsclass &args, recptproto *collectproto,
     79              displayclass &disp, outconvertclass &outconvert,
     80              ostream &textout, ostream &logout);
    8181 
    8282  // getargsinfo should be called after all configuration files
  • trunk/gsdl/src/recpt/nullproto.cpp

    r166 r172  
    1212/*
    1313   $Log$
     14   Revision 1.2  1999/02/25 21:58:58  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.1  1999/02/21 22:35:22  rjmcnab
    1519
     
    9094void nullproto::get_collection_list (text_tarray &collist, comerror_t &err,
    9195                     ostream &/*logout*/) {
    92   collist.clear();
     96  collist.erase(collist.begin(),collist.end());
    9397  err = noError;
    9498
  • trunk/gsdl/src/recpt/pageaction.cpp

    r165 r172  
    1212/*
    1313   $Log$
     14   Revision 1.3  1999/02/25 21:58:58  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.2  1999/02/21 22:33:54  rjmcnab
    1519
     
    2428
    2529#include "pageaction.h"
     30#include "receptionist.h"
    2631
    2732
     
    4449  arg_ainfo.savedarginfo = cgiarginfo::can;
    4550  argsinfo.addarginfo (NULL, arg_ainfo);
    46 
    4751}
    4852
     
    6165}
    6266
    63 bool pageaction::do_action (cgiargsclass &args, outconvertclass &outconvert,
    64                 recptproto */*collectproto*/, ostream &textout,
    65                 ostream &/*logout*/) {
    66 
    67   textout << outconvert << "<html>\n";
    68   textout << outconvert << "<head><title>Page action</title></head>\n";
    69   textout << outconvert << "<body><h2>Page action</h2>\n";
    70   textout << outconvert << "a: " << args["a"] << "  p: " << args["p"] << "\n";
    71   textout << outconvert << "</body>\n";
    72   textout << outconvert << "</html>\n";
     67bool pageaction::do_action (cgiargsclass &args, recptproto */*collectproto*/,
     68                displayclass &disp, outconvertclass &outconvert,
     69                ostream &textout, ostream &logout) {
     70  text_t pageparams;
     71  text_t &arg_p = args["p"];
     72
     73  bool first = true;
     74  if (!args["c"].empty()) {
     75    pageparams +=  "collection=" + args["c"]; first = false;}
     76  if (args.getintarg("u") == 1)
     77    if (first) {pageparams += "style=htmlonly"; first = false;}
     78    else pageparams += ",style=htmlonly";
     79  if (args.getintarg("v") == 1)
     80    if (first) {pageparams += "version=text"; first = false;}
     81    else pageparams += ",version=text";
     82  if (args.getintarg("f") == 1)
     83    if (first) {pageparams += ",queryversion=big"; first = false;}
     84    else pageparams += ",queryversion=big";
     85  if (args["l"] != "en")
     86    if (first) pageparams += ",language=" + args["l"];
     87    else pageparams += ",language=" + args["l"];
     88 
     89  disp.openpage(pageparams, MACROPRECEDENCE);
     90  define_internal_macros (disp, args, logout);
     91
     92  textout << outconvert << disp << ("_" + arg_p + ":header_\n")
     93      << ("_" + arg_p + ":imagestandardbar_\n") << ("_" + arg_p + ":content_\n")
     94      << ("_" + arg_p + ":footer_\n");
    7395
    7496  return true;
    7597}
     98
     99
     100// define all the macros which are related to pages generated
     101// by this action
     102void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
     103                     ostream &logout) {
     104
     105  // not sure which macros should be defined where - what is difference between
     106  // define_internal_macros and define_external_macros
     107  // urlsafequerystring and querystring macros need some kind of cgisafe and
     108  // htmlsafe functions (maybe to be defined in htmlutils.cpp?)
     109
     110  // the following macros are also defined in libinterface, some of them I'm not
     111  // sure how to define from here and some I don't think are required anymore
     112  // httpprefix
     113  // numdocs
     114  // collection
     115  // istitle and pagedest -- these don't occur anywhere in the macro files
     116 
     117  // I don't know what structure has replaced what used to be cfg_info
     118  // so haven't defined the selection macros _hselection_, _jselection_
     119  // and _nselection_ (these should be set in define_query_macros)
     120
     121  // _imagethispage_ needs to be set for any browse pages but I guess
     122  // browse pages will be generated by a different action
     123
     124  // not sure what to do with any collection specific macros - these
     125  // used to be defined in define_collection_macros although there
     126  // wasn't much collection specific stuff left I don't think
     127
     128  //  disp.setmacro ("gwcgi", "Global", recpt->get_gwcgi());
     129  //  disp.setmacro ("httpimg", "Global", recpt->get_httpimg());
     130  //  disp.setmacro("compressedoptions", "Global", recpt->get_compressed_arg(args));
     131
     132  //  disp.setmacro("urlsafequerystring", "Global", cgisafe(outconvert.convert(args["q"])));
     133  //  disp.setmacro("querystring", "Global", htmlsafe(outconvert.convert(args["q"]))));
     134
     135  // define the macro for the "g" argument
     136  disp.setmacro("g", "Global", args["g"]);
     137
     138  // this gets set unless page has been detached by the 'detach' button.
     139  if (args.getintarg("x") == 0) disp.setmacro("notdetached", "Global", "1");
     140
     141  // not sure if home and about pages will both need query macros defined
     142  if ((args["p"] == "query") || (args["p"] == "home") || (args["p"] == "about"))
     143    define_query_macros (disp, args, logout);
     144
     145  if (args["p"] == "preferences")
     146    define_pref_macros (disp, args, logout);
     147
     148}
     149
     150void pageaction::define_query_macros (displayclass &disp, cgiargsclass &args,
     151                      ostream &/*logout*/) {
     152
     153  // some/all query type selection
     154  text_t qtselect = "<select name=\"t\">\n";
     155  qtselect += "<option value=\"1\"";
     156  if (args.getintarg("t") == 1) qtselect += " selected";
     157  qtselect += ">_query:textsome_\n";
     158  qtselect += "<option value=\"0\"";
     159  if (args.getintarg("t") == 0) qtselect += " selected";
     160  qtselect += ">_query:textall_\n";
     161  qtselect += "</select>\n";
     162  disp.setmacro("querytypeselection", "query", qtselect);
     163
     164
     165}
     166
     167void pageaction::define_pref_macros (displayclass &disp, cgiargsclass &args,
     168                     ostream &/*logout*/) {
     169
     170  // the caseoption macro
     171  text_t caseoption;
     172  int arg_k = args.getintarg("k");
     173
     174  caseoption += "\n<input type=radio name=k value=1";
     175  if (arg_k) caseoption += " checked";
     176  caseoption += ">_textignorecase_<br>\n";
     177  caseoption += "<input type=radio name=k value=0";
     178  if (!arg_k) caseoption += " checked";
     179  caseoption += ">_textmatchcase_\n";
     180
     181  disp.setmacro ("caseoption", "preferences", caseoption);
     182
     183  // the stemoption macro
     184  text_t stemoption;
     185  int arg_s = args.getintarg("s");
     186
     187  stemoption += "\n<input type=radio name=s value=1";
     188  if (arg_s) stemoption += " checked";
     189  stemoption += ">_textstem_<br>\n";
     190  stemoption += "<input type=radio name=s value=0";
     191  if (!arg_s) stemoption += " checked";
     192  stemoption += ">_textnostem_\n";
     193
     194  disp.setmacro ("stemoption", "preferences", stemoption);
     195
     196
     197  // the encodingoption
     198  text_t encodingoption;
     199  const text_t &arg_w = args["w"];
     200
     201  encodingoption += "\n<select name=\"nw\">\n";
     202  encodingoption += "  <option value=\"w\"";
     203  if (arg_w == "w") encodingoption += " selected";
     204  encodingoption += ">Western (ISO-8859-1)\n";
     205  encodingoption += "  <option value=\"g\"";
     206  if (arg_w == "g") encodingoption += " selected";
     207  encodingoption += ">Simplified Chinese (GB2312)\n";
     208  encodingoption += "  <option value=\"8\"";
     209  if (arg_w == "8") encodingoption += " selected";
     210  encodingoption += ">Unicode (UTF-8)\n";
     211  encodingoption += "</select>\n";
     212
     213  disp.setmacro ("encodingoption", "preferences", encodingoption);
     214
     215  // the maxdocoption
     216  text_t maxdocoption;
     217  int arg_m = args.getintarg("m");
     218
     219  maxdocoption += "\n<select name=m>\n";
     220  maxdocoption += "  <option value=\"50\"";
     221  if (arg_m < 100) maxdocoption += " selected";
     222  maxdocoption += ">50\n";
     223  maxdocoption += "  <option value=\"100\"";
     224  if (arg_m >= 100 && arg_m < 200) maxdocoption += " selected";
     225  maxdocoption += ">100\n";
     226  maxdocoption += "  <option value=\"200\"";
     227  if (arg_m >= 200 && arg_m < 500) maxdocoption += " selected";
     228  maxdocoption += ">200\n";
     229  maxdocoption += "  <option value=\"500\"";
     230  if (arg_m >= 500) maxdocoption += " selected";
     231  maxdocoption += ">500\n";
     232  maxdocoption += "</select>\n";
     233
     234  disp.setmacro ("maxdocoption", "preferences", maxdocoption);
     235
     236  // the hitsperpageoption
     237  text_t hitsoption;
     238  int arg_o = args.getintarg("o");
     239
     240  hitsoption += "\n<select name=o>\n";
     241  hitsoption += "  <option value=\"10\"";
     242  if (arg_o < 20) hitsoption += " selected";
     243  hitsoption += ">10\n";
     244  hitsoption += "  <option value=\"20\"";
     245  if (arg_o >= 20 && arg_o < 50) hitsoption += " selected";
     246  hitsoption += ">20\n";
     247  hitsoption += "  <option value=\"50\"";
     248  if (arg_o >= 50 && arg_o < 100) hitsoption += " selected";
     249  hitsoption += ">50\n";
     250  hitsoption += "  <option value=\"100\"";
     251  if (arg_o >= 100 && arg_o < 500) hitsoption += " selected";
     252  hitsoption += ">100\n";
     253  hitsoption += "  <option value=\"500\"";
     254  if (arg_o >= 500) hitsoption += " selected";
     255  hitsoption += ">all\n";
     256  hitsoption += "  </select>\n";
     257
     258  disp.setmacro ("hitsperpageoption", "preferences", hitsoption);
     259}
     260
  • trunk/gsdl/src/recpt/pageaction.h

    r165 r172  
    2020
    2121class pageaction : public action {
     22protected:
     23  void define_internal_macros (displayclass &disp, cgiargsclass &args,
     24                   ostream &logout);
     25  void define_query_macros (displayclass &disp, cgiargsclass &args,
     26                ostream &logout);
     27  void define_pref_macros (displayclass &disp, cgiargsclass &args,
     28               ostream &logout);
     29 
    2230public:
    2331  pageaction ();
     
    2836  void get_cgihead_info (cgiargsclass &args, response_t &response,
    2937             text_t &response_data, ostream &logout);
    30   bool do_action (cgiargsclass &args, outconvertclass &outconvert,
    31           recptproto *collectproto, ostream &textout,
    32           ostream &logout);
     38  bool do_action (cgiargsclass &args, recptproto *collectproto,
     39          displayclass &disp, outconvertclass &outconvert,
     40          ostream &textout, ostream &logout);
    3341};
    3442
  • trunk/gsdl/src/recpt/pingaction.cpp

    r166 r172  
    1212/*
    1313   $Log$
     14   Revision 1.2  1999/02/25 21:58:59  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.1  1999/02/21 22:35:20  rjmcnab
    1519
     
    4246
    4347
    44 bool pingaction::do_action (cgiargsclass &args, outconvertclass &outconvert,
    45                 recptproto *collectproto, ostream &textout,
    46                 ostream &logout) {
     48bool pingaction::do_action (cgiargsclass &args, recptproto *collectproto,
     49                displayclass &/*disp*/, outconvertclass &outconvert,
     50                ostream &textout, ostream &logout) {
    4751  bool wassuccess = false;
    4852  comerror_t err;
    49 
     53 
    5054  if (!args["c"].empty() && (collectproto != NULL)) {
    5155    collectproto->ping (args["c"], wassuccess, err, logout);
  • trunk/gsdl/src/recpt/pingaction.h

    r166 r172  
    2626  void get_cgihead_info (cgiargsclass &args, response_t &response,
    2727             text_t &response_data, ostream &logout);
    28   bool do_action (cgiargsclass &args, outconvertclass &outconvert,
    29           recptproto *collectproto, ostream &textout,
    30           ostream &logout);
     28  bool do_action (cgiargsclass &args, recptproto *collectproto,
     29          displayclass &disp, outconvertclass &outconvert,
     30          ostream &textout, ostream &logout);
    3131};
    3232
  • trunk/gsdl/src/recpt/receptionist.cpp

    r165 r172  
    1212/*
    1313   $Log$
     14   Revision 1.8  1999/02/25 21:58:59  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.7  1999/02/21 22:33:55  rjmcnab
    1519
     
    330334  action *a = actions.getaction (args["a"]);
    331335  if (a != NULL) {
    332     if (!a->do_action (args, (*outconverter), collectproto, contentout, logout))
     336    if (!a->do_action (args, collectproto, disp, (*outconverter), contentout, logout))
    333337      return false;
    334338
  • trunk/gsdl/src/recpt/recptproto.cpp

    r166 r172  
    1212/*
    1313   $Log$
     14   Revision 1.2  1999/02/25 21:59:01  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.1  1999/02/21 22:35:24  rjmcnab
    1519
     
    4549void recptproto::get_collection_list (text_tarray &collist, comerror_t &err,
    4650                      ostream &/*logout*/) {
    47   collist.clear();
     51  collist.erase(collist.begin(),collist.end());
    4852  err = noError;
    4953}
  • trunk/gsdl/src/recpt/statusaction.cpp

    r165 r172  
    1212/*
    1313   $Log$
     14   Revision 1.6  1999/02/25 21:59:02  rjmcnab
     15
     16   Merged sources.
     17
    1418   Revision 1.5  1999/02/21 22:33:58  rjmcnab
    1519
     
    6872}
    6973
    70 bool statusaction::do_action (cgiargsclass &args, outconvertclass &outconvert,
    71                   recptproto */*collectproto*/, ostream &textout,
    72                   ostream &/*logout*/) {
    73 
     74bool statusaction::do_action (cgiargsclass &args, recptproto */*collectproto*/,
     75                  displayclass &/*disp*/, outconvertclass &outconvert,
     76                  ostream &textout, ostream &/*logout*/) {
    7477  textout << outconvert << "<html>\n";
    7578  textout << outconvert << "<head>\n";
  • trunk/gsdl/src/recpt/statusaction.h

    r165 r172  
    3434  void get_cgihead_info (cgiargsclass &args, response_t &response,
    3535             text_t &response_data, ostream &logout);
    36   bool do_action (cgiargsclass &args, outconvertclass &outconvert,
    37           recptproto *collectproto, ostream &textout,
    38           ostream &logout);
     36  bool do_action (cgiargsclass &args, recptproto *collectproto,
     37          displayclass &disp, outconvertclass &outconvert,
     38          ostream &textout, ostream &logout);
     39
    3940  void configure (const text_t &key, const text_tarray &cfgline);
    4041};
Note: See TracChangeset for help on using the changeset viewer.