Ignore:
Timestamp:
2000-02-17T15:41:13+13:00 (24 years ago)
Author:
sjboddie
Message:

tidied up a bit - replaced strings with macros etc.

File:
1 edited

Legend:

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

    r928 r940  
    4141delhistoryaction::delhistoryaction () {
    4242
    43   //  num_phrases = 0;
    44 
    4543  // this action uses cgi variable "a"
    4644  cgiarginfo arg_ainfo;
     
    5856  arg_ainfo.longname = "history deletion mode";
    5957  arg_ainfo.multiplechar = true;
    60   //arg_ainfo.multiplevalue = true;
    6158  arg_ainfo.defaultstatus = cgiarginfo::weak;
    6259  arg_ainfo.argdefault = "delete";
     
    6461  argsinfo.addarginfo (NULL, arg_ainfo);
    6562
    66  // "hsr" -- the selected records
    67  
     63  // "hsr" -- the selected records
    6864  arg_ainfo.shortname = "hsr";
    6965  arg_ainfo.longname = "history selected records";
     
    7672
    7773  // "hdh" delete history for current user
    78   // clear history = delete some, delete all
    79 
     74  // clear history = 0 = delete some, 1 = delete all
    8075  arg_ainfo.shortname = "hdh";
    8176  arg_ainfo.longname = "history delete history";
    82   arg_ainfo.multiplechar = true;
    83   arg_ainfo.defaultstatus = cgiarginfo::weak;
    84   arg_ainfo.argdefault = "";
     77  arg_ainfo.multiplechar = false;
     78  arg_ainfo.multiplevalue = false;
     79  arg_ainfo.defaultstatus = cgiarginfo::weak;
     80  arg_ainfo.argdefault = "0";
    8581  arg_ainfo.savedarginfo = cgiarginfo::mustnot;
    8682  argsinfo.addarginfo (NULL, arg_ainfo);
     
    122118
    123119void delhistoryaction::define_external_macros (displayclass &/*disp*/, cgiargsclass &/*args*/,
    124                       recptprotolistclass */*protos*/, ostream &/*logout*/) {
     120                           recptprotolistclass * /*protos*/, ostream &/*logout*/) {
    125121
    126122  // define_external_macros sets the following macros:
    127 
     123 
    128124  // can't do anything if collectproto is null (i.e. no collection was specified)
    129125  //recptproto *collectproto = protos->getrecptproto (args["c"], logout);
    130126  //if (collectproto == NULL) return;
    131 
    132     // define_history_macros(disp, args, protos, logout);
    133  
    134 } // define external macros
     127 
     128  // define_history_macros(disp, args, protos, logout);
     129 
     130}
     131
    135132
    136133void delhistoryaction::define_history_macros(displayclass &disp, cgiargsclass &args,
    137                       recptprotolistclass *protos, ostream &logout) {
     134                         recptprotolistclass *protos, ostream &logout) {
    138135
    139136  // defines the following macros
     
    146143    text_tarray entries;
    147144
    148     historylist += " <table align=center width=500 border=1> \n <tr><th colspan=4 align=center>";
    149     historylist += "Search History </th></tr>\n";
    150     historylist += "<tr><th width=60>select</th><th width=40>#</th>\n<th width=340>Query</th>\n";
    151     historylist += "<th width=60>Results</th></tr>\n";
    152     if (get_history_info(userid, entries)) {
     145    historylist += "<table align=center width=500 border=1> \n <tr><th colspan=4 align=center>";
     146    historylist += "_query:textsearchhistory_</th></tr>\n";
     147    historylist += "<tr><th width=60>_textselect_</th><th width=40>#</th>\n<th width=340>_query:textquery_</th>\n";
     148    historylist += "<th width=60>_query:textresults_</th></tr>\n";
     149    if (get_history_info (userid, entries, logout)) {
    153150      int count = 1;
    154151      text_tarray::iterator here = entries.begin();
     
    159156    text_t querynum;
    160157    text_t query;
    161     text_t q = "q";
    162158    text_t numdocs;
    163159    text_t cgiargs;
    164160    text_t  userinfo;
    165161    split_saved_query(*here, querynum, numdocs, cgiargs);
    166     parse_saved_args(cgiargs, q, query); // get query string out
     162    parse_saved_args(cgiargs, "q", query); // get query string out
    167163    decode_cgi_arg(query); // un cgisafe it
    168164   
     
    189185
    190186bool delhistoryaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
    191                  browsermapclass */*browsers*/, displayclass &disp,
    192                  outconvertclass &outconvert, ostream &textout,
    193                  ostream &logout) {
     187                  browsermapclass * /*browsers*/, displayclass &disp,
     188                  outconvertclass &outconvert, ostream &textout,
     189                  ostream &logout) {
    194190
    195191  if (args["hdh"] !="") {
     
    205201
    206202
    207 bool delhistoryaction::delete_search_history(cgiargsclass &args)
    208 {
    209 
     203bool delhistoryaction::delete_search_history (cgiargsclass &args) {
     204 
    210205  bool result;
    211206  text_t userid = args["z"];
    212207  text_t type = args["hdh"];
    213   decode_cgi_arg(type);
    214   if (type=="Delete All") {
    215     result=delete_all_history_info(userid);
    216   }else if (type=="Clear History"){
     208  if (type == "1") {
     209    result = delete_all_history_info (userid);
     210  } else {
    217211    text_t records = args["hsr"];
    218212    text_t deletemode = args["hmode"];
    219     result=delete_history_info(userid, deletemode, records);
    220   } else {
    221     result=false;
     213    result = delete_history_info (userid, deletemode, records);
    222214  }
    223215
    224216  return result;
    225 
    226 }
    227 
    228 
    229 
    230 
    231 
     217}
     218
     219
     220
     221
     222
Note: See TracChangeset for help on using the changeset viewer.