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

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.