Changeset 928


Ignore:
Timestamp:
2000-02-16T11:53:52+13:00 (24 years ago)
Author:
kjm18
Message:

search history stuff added.

Location:
trunk/gsdl/src/recpt
Files:
4 added
13 edited

Legend:

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

    r914 r928  
    2929/*
    3030   $Log$
     31   Revision 1.37  2000/02/15 22:53:47  kjm18
     32   search history stuff added.
     33
    3134   Revision 1.36  2000/02/06 21:31:36  sjboddie
    3235   made some formerly static functions accessible from elsewhere (for
     
    171174// output_controls displays the detach, expand/contract contents,
    172175// expand/contract text and highlighting/no highlighting buttons
     176
    173177void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
    174178              recptproto * /*collectproto*/, displayclass &disp,
     
    226230// server which would send a link to the cover image if there
    227231// was one otherwise send title, author and stuff
    228 static void output_cover_image (cgiargsclass &args, recptproto * /*collectproto*/,
     232 void output_cover_image (cgiargsclass &args, recptproto * /*collectproto*/,
    229233                displayclass &disp, outconvertclass &outconvert,
    230234                ostream &textout, ostream &/*logout*/) {
     
    234238  textout << outconvert << disp <<
    235239    "<img src=\"_httpcollection_/archives/_thisOID_/cover.jpg\"><br>\n";
    236 }
    237 
    238 static void output_titles (cgiargsclass &args, recptproto *collectproto,
     240 }
     241
     242 void output_titles (cgiargsclass &args, recptproto *collectproto,
    239243               formatinfo_t &formatinfo, displayclass &disp,
    240244               outconvertclass &outconvert, ostream &textout,
     
    533537  }
    534538}
    535 
    536539
    537540void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc,
     
    682685  if (havecontrols) textout << "</td></tr></table>\n";
    683686}
     687
     688
     689
  • trunk/gsdl/src/recpt/browsetools.h

    r914 r928  
    5656                 ostream &textout, ostream &logout);
    5757
    58 void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
    59               recptproto * /*collectproto*/, displayclass &disp,
    60               outconvertclass &outconvert, ostream &textout,
    61               ostream &/*logout*/);
     58
     59// output_controls displays the detach, expand/contract contents,
     60// expand/contract text and highlighting/no highlighting buttons
     61 void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
     62                 recptproto * /*collectproto*/, displayclass &disp,
     63                 outconvertclass &outconvert, ostream &textout,
     64                 ostream &/*logout*/);
     65   
     66 void output_cover_image (cgiargsclass &args, recptproto * /*collectproto*/,
     67                displayclass &disp, outconvertclass &outconvert,
     68                ostream &textout, ostream &/*logout*/);
     69
     70 void output_titles (cgiargsclass &args, recptproto *collectproto,
     71               formatinfo_t &formatinfo, displayclass &disp,
     72               outconvertclass &outconvert, ostream &textout,
     73               ostream &logout);
     74void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc,
     75                 browsermapclass *browsermap, formatinfo_t &formatinfo,
     76                 recptproto *collectproto, displayclass &disp,
     77                 outconvertclass &outconvert, ostream &textout,
     78                 ostream &logout);
     79
     80 void expanded_contents (cgiargsclass &args, int tabcount, bool fulltoc,
     81                   browsermapclass *browsermap, formatinfo_t &formatinfo,
     82                   recptproto *collectproto, displayclass &disp,
     83                   outconvertclass &outconvert, ostream &textout,
     84                   ostream &logout);
     85
    6286
    6387#endif
  • trunk/gsdl/src/recpt/cgiargs.h

    r776 r928  
    234234
    235235#endif
     236
     237
     238
  • trunk/gsdl/src/recpt/documentaction.cpp

    r921 r928  
    2828/*
    2929   $Log$
     30   Revision 1.34  2000/02/15 22:53:49  kjm18
     31   search history stuff added.
     32
    3033   Revision 1.33  2000/02/13 20:40:05  sjboddie
    3134   now dm_safe _thisOID_ macro
     
    372375  iwidth += width.getint();
    373376 
     377 
     378 
    374379  while (dochere != docend) {
    375380    const text_t &title = (*dochere).metadata["Title"].values[0];
     
    410415    javaimagesnavbar = "_javasearch_";
    411416  }
     417 
     418 
    412419  if (numc == 0) navigationbar += "_imagespacer_";
    413420   
     
    534541    // set _navigationbar_ and _javaimagesnavbar_ macros
    535542    set_navbarmacros (disp, response, args);
     543   
    536544      }
    537545    } else {
     
    10831091  textout << outconvert << disp << buffer;
    10841092}
     1093
     1094
     1095
     1096
     1097
     1098
     1099
     1100
     1101
     1102
     1103
  • trunk/gsdl/src/recpt/documentaction.h

    r913 r928  
    5353  virtual void set_java_macros (cgiargsclass &args, displayclass &disp);
    5454
     55  void get_classificationlinks (const text_t &arg_cl, const text_t &collection,
     56                recptproto *collectproto, displayclass &disp,
     57                ostream &logout);
     58
    5559  virtual void output_text (ResultDocInfo_t &docinfo, format_t *formatlistptr,
    5660                const TermInfo_tarray &terminfo, const text_t &OID,
  • trunk/gsdl/src/recpt/infodbclass.cpp

    r722 r928  
    2828/*
    2929   $Log$
     30   Revision 1.6  2000/02/15 22:53:50  kjm18
     31   search history stuff added.
     32
    3033   Revision 1.5  1999/10/19 03:23:42  davidb
    3134   Collection building support through web pages
     
    269272
    270273  return (ret == 0);
     274
     275}
     276
     277//returns true on success
     278bool gdbmclass::setinfo (const text_t &key, const text_t &data) {
     279  if (gdbmfile == NULL) return false;
     280 
     281  // store the value
     282  datum key_data;
     283  datum data_data;
     284
     285  // get a utf-8 encoded c string of the unicode key
     286  key_data.dptr = (to_utf8(key)).getcstr();
     287  if (key_data.dptr == NULL) {
     288    if (logout != NULL) (*logout) << "gdbmclass: out of memory\n";
     289    return false;
     290  }
     291  key_data.dsize = strlen (key_data.dptr);
     292
     293  data_data.dptr = (to_utf8(data)).getcstr();
     294  if (data_data.dptr == NULL) {
     295    if (logout != NULL) (*logout) << "gdbmclass: out of memory\n";
     296    delete key_data.dptr;
     297  }
     298  data_data.dsize = strlen (data_data.dptr);
     299
     300  int ret = gdbm_store (gdbmfile, key_data, data_data, GDBM_REPLACE);
     301  delete key_data.dptr;
     302  delete data_data.dptr;
     303
     304  return (ret == 0);
     305
    271306}
    272307
     
    549584}
    550585
     586
  • trunk/gsdl/src/recpt/infodbclass.h

    r533 r928  
    142142  // returns true on success
    143143  bool setinfo (const text_t &key, const infodbclass &info);
     144  // returns true on success
     145  bool setinfo (const text_t &key, const text_t &data);
    144146
    145147  void deletekey (const text_t &key);
     
    151153  text_t getfirstkey ();
    152154  text_t getnextkey (const text_t &key);
    153  
     155
     156    // returns true on success
     157  bool getkeydata (text_t key, text_t &data);
     158
    154159protected:
    155160  text_t openfile;
     
    162167  void get_previous_sibling (text_t &OID, infodbclass &info);
    163168
    164   // returns true on success
    165   bool getkeydata (text_t key, text_t &data);
    166169
    167170  // returns true on success
     
    172175
    173176#endif
     177
     178
     179
     180
     181
  • trunk/gsdl/src/recpt/librarymain.cpp

    r826 r928  
    2828/*
    2929   $Log$
     30   Revision 1.21  2000/02/15 22:53:51  kjm18
     31   search history stuff added.
     32
    3033   Revision 1.20  1999/12/13 02:46:56  davidb
    3134   Teach buildaction about recptionist
     
    122125#include "extlinkaction.h"
    123126#include "buildaction.h"
     127#include "delhistoryaction.h"
     128//#include "bibqueryaction.h"
     129//#include "bibindexaction.h"
     130//#include "bibdatabaseaction.h"
    124131
    125132#include "browserclass.h"
     
    233240  recpt.add_action (&aauthenaction);
    234241
     242  delhistoryaction adelhistoryaction;
     243  recpt.add_action(&adelhistoryaction);
     244
     245  //  bibqueryaction abibqueryaction;
     246  //recpt.add_action(&abibqueryaction);
     247
     248  //  bibindexaction abibindexaction;
     249  //recpt.add_action (&abibindexaction);
     250
     251  //  bibdatabaseaction abibdatabaseaction;
     252  //recpt.add_action(&abibdatabaseaction):
    235253  // list of browsers
    236254  vlistbrowserclass avlistbrowserclass;
     
    257275}
    258276
     277
     278
     279
     280
  • trunk/gsdl/src/recpt/pageaction.cpp

    r905 r928  
    2828/*
    2929   $Log$
     30   Revision 1.27  2000/02/15 22:53:51  kjm18
     31   search history stuff added.
     32
    3033   Revision 1.26  2000/02/03 01:49:35  sjboddie
    3134   fixed up some of the preferences stuff
     
    516519  return true;
    517520}
     521
     522
     523
     524
     525
  • trunk/gsdl/src/recpt/pagedbrowserclass.cpp

    r912 r928  
    2828/*
    2929   $Log$
     30   Revision 1.6  2000/02/15 22:53:51  kjm18
     31   search history stuff added.
     32
    3033   Revision 1.5  2000/02/06 21:29:11  sjboddie
    3134   fixed a bug - made some functions virtual for use with cstr collection
     
    105108    }
    106109  }
     110       
     111
     112   
    107113}
    108114
     
    176182  }
    177183
     184  if (!found) {
     185    textout << outconvert << disp
     186        << "<table><tr valign=top> <td colspan=3><center>\n";
     187  }
    178188  int numpages = sections.docInfo.size();
    179189  textout << outconvert << disp
     
    182192  if (!found)
    183193    nextarrow = "<a href=\"_httpdocument_&cl=" + args["cl"] + "&d=" + sections.docInfo[0].OID +
    184       "\">" + sections.docInfo[0].metadata["Title"].values[0] + "_iconnext_";
     194      "\">" + sections.docInfo[0].metadata["Title"].values[0] + "_iconnext_</a>\n";
    185195  else {
    186196    if (!previousOID.empty())
     
    200210  return 0;
    201211}
     212
     213
     214
     215
     216
     217
  • trunk/gsdl/src/recpt/pagedbrowserclass.h

    r912 r928  
    4141
    4242  // returns the name that specifies the browserclass type
    43   text_t get_browser_name ();
     43  virtual text_t get_browser_name ();
    4444
    4545  void load_metadata_defaults (text_tset &metadata);
     
    4949  virtual void processOID (cgiargsclass &args, recptproto *collectproto,
    5050               ostream &logout);
     51
    5152
    5253  virtual int output_section_group (ResultDocInfo_t &section, cgiargsclass &args,
     
    6566
    6667#endif
     68
  • trunk/gsdl/src/recpt/queryaction.cpp

    r865 r928  
    2828/*
    2929   $Log$
     30   Revision 1.34  2000/02/15 22:53:52  kjm18
     31   search history stuff added.
     32
    3033   Revision 1.33  2000/01/24 22:57:59  sjboddie
    3134   fixed bug in cross-collection searching, tidied up a bit
     
    151154#include "cgiutils.h"
    152155#include "OIDtools.h"
     156//#include "infodbclass.h"
     157#include "fileutil.h"
     158#include "text_t.h"
     159#include "historydb.h"
    153160
    154161void colinfo_t::clear () {
     
    347354  arg_ainfo.savedarginfo = cgiarginfo::must;
    348355  argsinfo.addarginfo (NULL, arg_ainfo);
     356
     357  // "hd" history display  - search history only displayed when
     358  // this var set.
     359  arg_ainfo.shortname = "hd";
     360  arg_ainfo.longname = "history display";
     361  arg_ainfo.multiplechar = false;
     362  arg_ainfo.defaultstatus = cgiarginfo::weak;
     363  arg_ainfo.argdefault = "0";
     364  arg_ainfo.savedarginfo = cgiarginfo::must;
     365  argsinfo.addarginfo (NULL, arg_ainfo);
     366       
     367
     368 // "hs"  save - set to 1 in query form, so only save when submit
     369  // query
     370  // 0 = no save 1 = save
     371  arg_ainfo.shortname = "hs";
     372  arg_ainfo.longname = "history save";
     373  arg_ainfo.multiplechar = false;
     374  arg_ainfo.defaultstatus = cgiarginfo::weak;
     375  arg_ainfo.argdefault = "0";
     376  arg_ainfo.savedarginfo = cgiarginfo::mustnot;
     377  argsinfo.addarginfo (NULL, arg_ainfo);
     378
     379
     380  // "hcl" compress the list (show only the last 5)
     381  // 0 = expand, 1 = compress
     382
     383  arg_ainfo.shortname = "hcl";
     384  arg_ainfo.longname = "history compress list";
     385  arg_ainfo.multiplechar = false;
     386  arg_ainfo.defaultstatus = cgiarginfo::weak;
     387  arg_ainfo.argdefault = "1";
     388  arg_ainfo.savedarginfo = cgiarginfo::must;
     389  argsinfo.addarginfo (NULL, arg_ainfo);
     390
     391
    349392
    350393}
     
    407450    cgiarginfo *rinfo = argsinfo.getarginfo ("r");
    408451    if (rinfo != NULL) args["r"] = rinfo->argdefault;
     452  }
     453  //check hd argument
     454    int arg_hd = args.getintarg("hd");
     455    if (arg_hd !=0 && arg_hd !=1) {
     456      logout << "Warning: \"hd\" argument out of range (" << arg_hd << ")\n";
     457          cgiarginfo *hdinfo = argsinfo.getarginfo ("hd");
     458          if (hdinfo != NULL) args["hd"] = hdinfo->argdefault;
     459    } 
     460  //check hs argument
     461  int arg_hs = args.getintarg("hs");
     462  if (arg_hs !=0 && arg_hs !=1) {
     463    logout << "Warning: \"hs\" argument out of range (" << arg_hs << ")\n";
     464    cgiarginfo *hsinfo = argsinfo.getarginfo ("hs");
     465    if (hsinfo != NULL) args["hs"] = hsinfo->argdefault;
     466  }
     467
     468  // chech hcl argument
     469  int arg_hcl = args.getintarg("hcl");
     470  if (arg_hcl !=0 && arg_hcl !=1) {
     471    logout << "Warning: \"hcl\" argument out of range (" << arg_hcl << ")\n";
     472    cgiarginfo *hclinfo = argsinfo.getarginfo ("hcl");
     473    if (hclinfo != NULL) args["hcl"] = hclinfo->argdefault;
    409474  }
    410475
     
    505570  // _cq2selection                the selection box for combining two queries
    506571 
    507  
     572
    508573  // can't do anything if collectproto is null (i.e. no collection was specified)
    509574  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
     
    539604    it = response.filterOptions.find ("CombineQuery");
    540605    if (it != end) set_option_macro ("cq2", args["cq2"], (*it).second, disp);
    541   }
     606
     607    // define_history_macros(disp, args, protos, logout);
     608  }
     609} // define external macros
     610
     611void queryaction::define_history_macros(displayclass &disp, cgiargsclass &args,
     612                      recptprotolistclass *protos, ostream &logout) {
     613
     614  // defines the following macros
     615
     616  // _searchhistorylist_
     617
     618  text_t historylist;
     619  int arghd = args.getintarg("hd");
     620  if (arghd != 1) {
     621    historylist="";
     622  }
     623  else {
     624    historylist = "<!-- Search History List -->\n";
     625   
     626    text_t userid = args["z"];
     627    text_tarray entries;
     628    if (get_history_info(userid, entries)) {
     629      int count = 1;
     630      text_tarray::iterator here = entries.begin();
     631      text_tarray::iterator end = entries.end();
     632      int size=(int)entries.size();
     633      if (args["hcl"]==1&&size>5) { // compress the list
     634    here = end-5;
     635    count=size-4;
     636      }
     637      historylist += "<table align=center width=500 border=0>\n";
     638      historylist += "<tr><td width=300 align=center>";
     639      historylist += "<a href=\"_httpclearhistory_\">Clear History</a></td>\n";
     640
     641      if (size>5&&args["hcl"]==1) { //compress the list, show the expand button
     642       
     643      historylist += "<td><a href=\"_gwcgi_?e=_compressedoptions_&a=q&hcl=0\">Expand</a></td>\n";
     644      }
     645      else if (size >5 && args["hcl"]==0) { // expand the list, show contract button
     646    historylist += "<td><a href=\"_gwcgi_?e=_compressedoptions_&a=q&hcl=1\">Contract</a></td>\n";
     647      }
     648      historylist += "</table>\n";
     649      historylist += " <table align=center width=500 border=1> \n <tr><th colspan=4 align=center>";
     650      historylist += "Search History </th></tr>\n";
     651      historylist += "<tr><th width=40>#</th>\n<th width=340>Query</th>\n";
     652      historylist += "<th width=60>Results</th><th width=60>View</th></tr>\n";
     653
     654      while (here !=end ) {
     655    text_t c;
     656    text_t query;
     657    text_t q = "q";
     658    text_t numdocs;
     659    text_t cgiargs;
     660    text_t  userinfo;
     661    split_saved_query(*here,c, numdocs, cgiargs);
     662    parse_saved_args(cgiargs, q, query); // get query string out
     663    decode_cgi_arg(query); // un cgisafe it
     664   
     665    format_user_info(cgiargs, userinfo, protos, logout);
     666   
     667    historylist += "<tr> <td width=40 align=center>"+c+"</td>\n";
     668    historylist += "<td width=340 align=left>"+query+"</td><td width=60 align=center>"+numdocs+"</td>\n";
     669    historylist += "<td width=60 align=center><a href=\"_gwcgi_?e=_compressedoptions_&";
     670    historylist += *here+"\"><img name=\"display\" src=\"/gsdl/images/display.gif\" width=\"60\" ";
     671    historylist += "height=\"20\" border=\"0\" alt=\"" + userinfo +"\"></a></td></tr>\n";
     672      here++;
     673      count++;
     674      }
     675      historylist+="</table>\n\n";
     676     
     677    } // if
     678    else {
     679      historylist += "Search history not available\n";
     680    }
     681    historylist += "<p><! ---- end of history list ----->\n";
     682  } // else display list
     683  disp.setmacro("searchhistorylist", "query", historylist);
     684 
     685} // define history macros
     686
     687void queryaction::output_ccp (cgiargsclass &args, recptprotolistclass *protos,
     688                  displayclass &disp, outconvertclass &outconvert,
     689                  ostream &textout, ostream &logout) {
     690
     691  ColInfoResponse_t cinfo;
     692  comerror_t err;
     693  InfoFilterOptionsResponse_t fresponse;
     694  InfoFilterOptionsRequest_t frequest;
     695  frequest.filterName = "QueryFilter";
     696
     697  text_t &index = args["h"];
     698  text_t &subcollection = args["j"];
     699  text_t &language = args["n"];
     700
     701  text_tset collections;
     702  text_t arg_cc = args["cc"];
     703  decode_cgi_arg (arg_cc);
     704  splitchar (arg_cc.begin(), arg_cc.end(), ',', collections);
     705
     706  textout << outconvert << disp << "_query:header_\n"
     707      << "<center>_navigationbar_</center><br>\n"
     708      << "<form name=QueryForm method=get action=\"_gwcgi_\">\n"
     709      << "<input type=hidden name=a value=\"q\">\n"
     710      << "<input type=hidden name=e value=\"_compressedoptions_\">\n"
     711      << "<input type=hidden name=ccp value=\"1\">\n"
     712      << "<center><table width=_pagewidth_><tr valign=top>\n"
     713      << "<td>Select collections to search for \"" << args["q"]
     714      << "\" <i>(index=" << index << " subcollection=" << subcollection
     715      << " language=" << language << ")</i></td>\n"
     716      << "<td><input type=\"submit\" value=\"_query:textbeginsearch_\"></td>\n"
     717      << "</tr></table></center>\n"
     718      << "<center><table width=_pagewidth_>\n"
     719      << "<tr><td>\n";
     720 
     721  recptprotolistclass::iterator rprotolist_here = protos->begin();
     722  recptprotolistclass::iterator rprotolist_end = protos->end();
     723  while (rprotolist_here != rprotolist_end) {
     724    if ((*rprotolist_here).p != NULL) {
     725     
     726      text_tarray collist;
     727      (*rprotolist_here).p->get_collection_list (collist, err, logout);
     728      if (err == noError) {
     729    text_tarray::iterator collist_here = collist.begin();
     730    text_tarray::iterator collist_end = collist.end();
     731    while (collist_here != collist_end) {
     732     
     733      (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
     734      //      if (err == noError && cinfo.isPublic && (cinfo.buildDate > 0)) {
     735      if (err == noError && (cinfo.buildDate > 0)) {
     736       
     737        (*rprotolist_here).p->get_filteroptions (*collist_here, frequest, fresponse, err, logout);
     738        if (err == noError) {
     739         
     740          FilterOption_tmap::const_iterator it;
     741          FilterOption_tmap::const_iterator end = fresponse.filterOptions.end();
     742          if (!index.empty()) {
     743        it = fresponse.filterOptions.find ("Index");
     744        if (it == end) {collist_here ++; continue;}
     745        text_tarray::const_iterator there = (*it).second.validValues.begin();
     746        text_tarray::const_iterator tend = (*it).second.validValues.end();
     747        while (there != tend) {
     748          if (*there == index) break;
     749          there ++;
     750        }
     751        if (there == tend) {collist_here++; continue;}
     752          }
     753          if (!subcollection.empty()) {
     754        it = fresponse.filterOptions.find ("Subcollection");
     755        if (it == end) {collist_here++; continue;}
     756        text_tarray::const_iterator there = (*it).second.validValues.begin();
     757        text_tarray::const_iterator tend = (*it).second.validValues.end();
     758        while (there != tend) {
     759          if (*there == subcollection) break;
     760          there ++;
     761        }
     762        if (there == tend) {collist_here++; continue;}
     763          }
     764          if (!language.empty()) {
     765        it = fresponse.filterOptions.find ("Language");
     766        if (it == end) {collist_here++; continue;}
     767        text_tarray::const_iterator there = (*it).second.validValues.begin();
     768        text_tarray::const_iterator tend = (*it).second.validValues.end();
     769        while (there != tend) {
     770          if (*there == language) break;
     771          there ++;
     772        }
     773        if (there == tend) {collist_here++; continue;}
     774          }
     775       
     776          // we've got a matching collection
     777          textout << "<input type=checkbox";
     778
     779          text_tset::const_iterator t = collections.find (*collist_here);
     780          if (t != collections.end()) textout << " checked";
     781
     782          textout << outconvert
     783              << " name=cc value=\"" << *collist_here << "\">";
     784         
     785          if (!cinfo.collectionmeta["collectionname"].empty())
     786        textout << outconvert << disp << cinfo.collectionmeta["collectionname"];
     787          else
     788        textout << outconvert << *collist_here;
     789         
     790          textout << "<br>\n";
     791         
     792        }
     793      }
     794      collist_here ++;
     795    }
     796      }
     797    }
     798    rprotolist_here ++;
     799  }
     800  textout << outconvert << disp
     801      << "</td></tr></table></center>\n"
     802      << "</form>\n"
     803      << "_query:footer_\n";
     804 
    542805}
    543806
     
    8231086  request.filterResultOptions = FROID | FRmetadata | FRtermFreq;
    8241087  text_t formattedstring = args["q"];
     1088  if (!combine_query(args["z"], formattedstring)) {
     1089    args["q"]=formattedstring;
     1090  }
    8251091  format_querystring (formattedstring, args.getintarg("b"));
    8261092  set_queryfilter_options (request, formattedstring, args);
     
    8331099    return false;
    8341100  }
     1101
    8351102 
    8361103  define_query_macros (args, disp, response);
     1104
     1105  // save the query if appropriate
     1106  if (!save_search_history(args, response))
     1107    logout << "save failed";
     1108
     1109  define_history_macros(disp, args, protos, logout);
    8371110
    8381111  textout << outconvert << disp << "_query:header_\n"
     
    8591132void queryaction::define_query_macros (cgiargsclass &args, displayclass &disp,
    8601133                       const FilterResponse_t &response) {
     1134
    8611135  // set up _freqmsg_ and _quotedquery_ macros
    8621136  text_t freqmsg = "_textfreqmsg1_";
     
    9201194}
    9211195
    922 
    923 
     1196bool queryaction::save_search_history (cgiargsclass &args, const FilterResponse_t &response)
     1197{
     1198  if (args["q"]=="") return true; // null query, dont save
     1199  if (args["hs"]=="0") return true; // only save when submit query
     1200
     1201  // get userid
     1202  text_t userid = args["z"];
     1203
     1204  // the number of docs goes on the front of the query string
     1205  int numdocs= response.numDocs;
     1206  text_t query = text_t(numdocs);
     1207  if (response.isApprox==MoreThan) { // there were more docs found
     1208    query.push_back('+');
     1209  }
     1210  query += "a=q";
     1211  query += "&c="+args["c"];
     1212  query += "&h="+args["h"];
     1213  query += "&t="+args["t"];
     1214  query += "&b="+args["b"];
     1215  query += "&j="+args["j"];
     1216  query += "&n="+args["n"];
     1217  query += "&s="+args["s"];
     1218  query += "&k="+args["k"];
     1219   
     1220  text_t qstring = args["q"];
     1221  text_t formattedquery =cgi_safe(qstring);
     1222  query += "&q="+formattedquery;
     1223
     1224  if (set_history_info(userid, query)) return true;
     1225  else return false;
     1226
     1227
     1228}
     1229
     1230
     1231
     1232
     1233
  • trunk/gsdl/src/recpt/queryaction.h

    r865 r928  
    6464  int num_phrases;
    6565
    66   void define_query_macros (cgiargsclass &args, displayclass &disp,
     66  virtual void define_query_macros (cgiargsclass &args, displayclass &disp,
    6767                const FilterResponse_t &response);
    6868
    69   void set_option_macro (const text_t &macroname, text_t current_value,
     69  void define_history_macros (displayclass &disp, cgiargsclass &args,
     70                   recptprotolistclass *protos, ostream &logout);
     71
     72  virtual void set_option_macro (const text_t &macroname, text_t current_value,
    7073             const FilterOption_t &option, displayclass &disp);
     74
     75  void output_ccp (cgiargsclass &args, recptprotolistclass *protos,
     76           displayclass &disp, outconvertclass &outconvert,
     77           ostream &textout, ostream &logout);
     78 
     79
    7180
    7281  bool search_multiple_collections (cgiargsclass &args, recptprotolistclass *protos,
     
    7584                    ostream &logout);
    7685
     86
    7787  bool search_single_collection (cgiargsclass &args, const text_t &collection,
    7888                 recptprotolistclass *protos, browsermapclass *browsers,
     
    8090                 ostream &textout, ostream &logout);
    8191
     92
     93  bool save_search_history(cgiargsclass &args, const FilterResponse_t &response);
     94  bool delete_search_history(cgiargsclass &args);
    8295
    8396public:
     
    88101  bool init (ostream &logout);
    89102 
    90   text_t get_action_name () {return "q";}
     103  virtual text_t get_action_name () {return "q";}
    91104 
    92   bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
     105  virtual bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
    93106              ostream &logout);
    94107
     
    97110             ostream &logout);
    98111 
    99   void define_internal_macros (displayclass &disp, cgiargsclass &args,
     112  virtual void define_internal_macros (displayclass &disp, cgiargsclass &args,
    100113                   recptprotolistclass *protos, ostream &logout);
    101114
    102   void define_external_macros (displayclass &disp, cgiargsclass &args,
     115  virtual void define_external_macros (displayclass &disp, cgiargsclass &args,
    103116                   recptprotolistclass *protos, ostream &logout);
    104117 
    105   bool do_action (cgiargsclass &args, recptprotolistclass *protos,
     118  virtual bool do_action (cgiargsclass &args, recptprotolistclass *protos,
    106119          browsermapclass *browsers, displayclass &disp,
    107120          outconvertclass &outconvert, ostream &textout,
     
    110123
    111124#endif
     125
     126
Note: See TracChangeset for help on using the changeset viewer.