Changeset 2459


Ignore:
Timestamp:
2001-05-22T17:06:59+12:00 (23 years ago)
Author:
dmm9
Message:

got formatting of browse filter string working

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

Legend:

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

    r2456 r2459  
    3030browseaction::browseaction(){
    3131
    32   cerr<<"initialising browseaction"<<endl;
     32  //cerr<<"initialising browseaction"<<endl;
    3333
    3434  cgiarginfo arg_ainfo;
     
    9292  argsinfo.addarginfo (NULL, arg_ainfo);
    9393 
    94   cerr<<"constructor"<<endl;
     94  //cerr<<"constructor"<<endl;
    9595}
    9696
     
    197197  request.filterResultOptions = FROID | FRmetadata;
    198198 
    199   //set up querystring;
    200   text_t newqstring = "";
    201   format_qstring(args["bft"],newqstring,args.getintarg("bt"));
    202  
     199  //set up browse filter string;
     200  if(!args["bft"].empty()){
     201    text_t bf_string = "";
     202    format_browsestring(args["bft"],bf_string,args.getintarg("bt"));
     203    cout<<"F: "<<bf_string.getcstr()<<endl;
     204  }
     205
    203206  //check that there is a querystring
    204207  //if(!newqstring.empty()){
  • trunk/gsdl/src/recpt/browseactiontools.cpp

    r2455 r2459  
    2626
    2727#include "browseactiontools.h"
     28#include <ctype.h>
    2829
    29 void format_qstring(text_t orig, text_t& formatted, int and_or)
     30void format_browsestring(text_t orig, text_t& formatted, int and_or)
    3031{
     32 
     33 
     34  text_t conj = "";
     35 
     36  if(and_or == 0){ conj = " | "; }
     37  else { conj = " & "; }
     38  text_t::const_iterator here = orig.begin();
     39  text_t::const_iterator end = orig.end();
     40 
     41  //while not at the end of the filter string
     42  while(here!=end){
     43    //if seeing text, add it to the formatted string
     44    if(!isspace(*here)){
     45      formatted.push_back(*here);
     46      here++;
     47    }
     48    //else, if seeing spaces, check that there is following text and add
     49    //the ncessary conjugation if there is.
     50    else if(isspace(*here)){
     51      while(isspace(*here) && here!=end) here++;
     52      if(here!=end) formatted += conj;
     53    }
     54  }
    3155
    3256}
    3357
    34 void set_browsefilter_options(FilterRequest_t &request, text_t &querystring,
     58void set_browsefilter_options(FilterRequest_t &request, text_t &browsestring,
    3559                  cgiargsclass &args)
    3660{
Note: See TracChangeset for help on using the changeset viewer.