Changeset 2745


Ignore:
Timestamp:
2001-09-21T12:20:54+12:00 (23 years ago)
Author:
kjm18
Message:

changes for gselection for mgpp queries, and some form query parsing changes

Location:
trunk/gsdl/src/recpt
Files:
3 edited

Legend:

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

    r2212 r2745  
    266266  argsinfo.addarginfo (NULL, arg_ainfo);
    267267
    268   // new arg for granularity, for mgpp collections
     268  // "g" - new arg for granularity, for mgpp collections
    269269  arg_ainfo.shortname = "g";
    270270  arg_ainfo.longname = "granularity";
     
    614614  text_t macrovalue = "";
    615615
    616   macrovalue += "<select name=\"fqf\" onChange=\"updatefqf();\">\n";
     616  if (option.validValues.size() == 1) {
     617    macrovalue = "_ZZ_";
     618  }
     619  else {
     620    macrovalue += "<select name=\"fqf\" onChange=\"updatefqf();\">\n";
     621   
     622    text_tarray::const_iterator thisvalue = option.validValues.begin();
     623    text_tarray::const_iterator endvalue = option.validValues.end();
     624   
     625    while (thisvalue != endvalue) {
     626      macrovalue += "<option value=\"" + *thisvalue + "\">_";   
     627      macrovalue += *thisvalue + "_\n";
     628      thisvalue ++;
     629    }
     630    macrovalue += "</select>\n";
     631  }
     632  disp.setmacro ("fqfselection", "query", macrovalue);
     633
     634}
     635// sets the selection box macros _gselection_.
     636void queryaction::set_gselection_macro (text_t current_value,
     637                    const FilterOption_t &option,
     638                    displayclass &disp) {
     639 
     640  if (option.validValues.size() <= 1) {
     641    return;
     642  }
     643 
     644  text_t macrovalue = "<select name=\"g\">\n";
     645 
     646  if (current_value.empty()) current_value = option.defaultValue;
    617647 
    618648  text_tarray::const_iterator thisvalue = option.validValues.begin();
     
    620650
    621651  while (thisvalue != endvalue) {
    622     macrovalue += "<option value=\"" + *thisvalue + "\">_";   
    623     macrovalue += *thisvalue + "_\n";
     652    macrovalue += "<option value=\"" + *thisvalue + "\"";
     653    if (*thisvalue == current_value)
     654      macrovalue += " selected";
     655    macrovalue += ">_" + *thisvalue + "_\n";
    624656    thisvalue ++;
    625657  }
    626658  macrovalue += "</select>\n";
    627   disp.setmacro ("fqfselection", "query", macrovalue);
    628 
     659  disp.setmacro ("gselection", "Global", macrovalue);
    629660}
    630661
     
    677708    // _gselection_ (Level) // for mgpp collections
    678709    it = response.filterOptions.find("Level");
    679     if (it!=end) set_option_macro("g", args["g"], (*it).second, disp);
     710    if (it!=end) set_gselection_macro(args["g"], (*it).second, disp);
    680711
    681712    // should probably go into define_internal_macros
     
    754785    parse_saved_args(cgiargs, "q", query); // get query string out
    755786    decode_cgi_arg(query); // un cgisafe it
    756     escquery = escape_quotes(query); // escape the quotes
     787    escquery = escape_quotes(query); // escape the quotes and newlines
    757788    text_t histvalue = "histvalue";
    758789    histvalue += i;
  • trunk/gsdl/src/recpt/queryaction.h

    r1915 r2745  
    8282             const FilterOption_t &option, displayclass &disp);
    8383
     84  virtual void set_gselection_macro (text_t current_value,
     85                     const FilterOption_t &option,
     86                     displayclass &disp);
     87
    8488  void output_ccp (cgiargsclass &args, recptprotolistclass *protos,
    8589           displayclass &disp, outconvertclass &outconvert,
  • trunk/gsdl/src/recpt/querytools.cpp

    r1988 r2745  
    252252         else
    253253           querystring.appendint(nextdate);
    254          querystring.appendcstr("]:Coverage");
     254         querystring.appendcstr("]:CO");
    255255           }
    256256         nextdate++;
     
    335335    if (!values[i].empty()) {
    336336      text_t text = formatelem(values[i]);
    337       addqueryelem(querystring, fields[i], values[i], combine);
     337      addqueryelem(querystring, fields[i], text, combine);
    338338    }
    339339  }
     
    347347
    348348  bool space = false;
     349  int words = 0;
    349350  text_t newtext = "";
    350351  while (here != end) {
    351352    if (is_unicode_letdig(*here)) {
    352353      newtext.push_back(*here);
     354      if (space==false) words++;
    353355      space = true;
    354356    }
     
    362364  }
    363365
     366  if (words > 1) { // have a phrase, put it in quotes
     367    newtext = "\""+newtext+"\"";
     368    cout <<"new text="<<newtext.getcstr()<<endl;
     369  }
    364370  return newtext;
    365371}
     
    402408    else if (combs[i-1]=="not")combine = "!";
    403409      }
    404       text_t term = values[i];
     410      text_t term = formatelem(values[i]);
    405411      term = addstemcase(term, stems[i], folds[i]);
    406412      addqueryelem(querystring, fields[i], term, combine);
     
    419425
    420426  while (here !=end) {
     427
    421428    if (is_unicode_letdig(*here)) {
    422429      // not word boundary
     
    435442      //else word += "c";
    436443    }
     444   
    437445    word += " ";
    438446    outtext += word;
    439447    word.clear();
    440448      }
    441       //outtext.push_back(*here);
     449      if (*here == '\"') {
     450    outtext.push_back(*here);
     451      }
    442452      here++;
    443453    }
Note: See TracChangeset for help on using the changeset viewer.