Changeset 226 for trunk/gsdl/src/recpt


Ignore:
Timestamp:
1999-04-07T10:20:35+12:00 (25 years ago)
Author:
rjmcnab
Message:

Got browsefilter working.

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

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/Makefile

    r220 r226  
    4242
    4343COLSERVRHEADERS = infodbclass.h mgq.h mgsearch.h querycache.h queryinfo.h \
    44                   collectserver.h colservrconfig.h maptools.h filter.h source.h
     44                  collectserver.h colservrconfig.h maptools.h filter.h \
     45                  source.h browsefilter.h queryfilter.h
    4546
    4647LIBRARYHEADERS = $(COLSERVRHEADERS) \
     
    5859
    5960COLSERVRSOURCES = infodbclass.cpp mgq.c mgsearch.cpp querycache.cpp queryinfo.cpp \
    60                   collectserver.cpp colservrconfig.cpp maptools.cpp filter.cpp source.cpp
     61                  collectserver.cpp colservrconfig.cpp maptools.cpp filter.cpp \
     62                  source.cpp browsefilter.cpp queryfilter.cpp
    6163
    6264LIBRARYSOURCES = $(COLSERVRSOURCES) \
     
    7476
    7577COLSERVROBJECTS = infodbclass.o mgq.o mgsearch.o querycache.o queryinfo.o \
    76                   collectserver.o colservrconfig.o maptools.o filter.o source.o
     78                  collectserver.o colservrconfig.o maptools.o filter.o \
     79                  source.o browsefilter.o queryfilter.o
    7780
    7881LIBRARYOBJECTS = $(COLSERVROBJECTS) \
     
    212215queryinfo.o: ../../lib/text_t.h
    213216collectserver.o: collectserver.h ../../lib/gsdlconf.h ../../lib/site.h
    214 collectserver.o: ../../lib/text_t.h comtypes.h maptools.h
     217collectserver.o: ../../lib/text_t.h comtypes.h filter.h source.h
    215218colservrconfig.o: colservrconfig.h ../../lib/gsdlconf.h ../../lib/site.h
    216 colservrconfig.o: ../../lib/text_t.h collectserver.h comtypes.h maptools.h
    217 colservrconfig.o: ../../lib/fileutil.h ../../lib/cfgread.h
     219colservrconfig.o: ../../lib/text_t.h collectserver.h comtypes.h filter.h
     220colservrconfig.o: source.h ../../lib/fileutil.h ../../lib/cfgread.h
    218221maptools.o: maptools.h ../../lib/gsdlconf.h ../../lib/site.h
    219222maptools.o: ../../lib/text_t.h
    220223filter.o: filter.h ../../lib/gsdlconf.h ../../lib/site.h ../../lib/text_t.h
    221 filter.o: comtypes.h
     224filter.o: comtypes.h ../../lib/fileutil.h
    222225source.o: source.h ../../lib/gsdlconf.h ../../lib/site.h ../../lib/text_t.h
    223226source.o: comtypes.h
     227browsefilter.o: browsefilter.h ../../lib/gsdlconf.h ../../lib/site.h
     228browsefilter.o: ../../lib/text_t.h comtypes.h filter.h infodbclass.h
     229browsefilter.o: ../../lib/fileutil.h
     230queryfilter.o: queryfilter.h ../../lib/gsdlconf.h ../../lib/site.h
     231queryfilter.o: ../../lib/text_t.h comtypes.h filter.h infodbclass.h
     232queryfilter.o: maptools.h ../../lib/fileutil.h
    224233nullproto.o: nullproto.h ../../lib/gsdlconf.h ../../lib/site.h
    225 nullproto.o: collectserver.h ../../lib/text_t.h comtypes.h maptools.h
     234nullproto.o: collectserver.h ../../lib/text_t.h comtypes.h filter.h source.h
    226235nullproto.o: recptproto.h colservrconfig.h
    227236librarymain.o: receptionist.h ../../lib/gsdlconf.h ../../lib/site.h
    228237librarymain.o: ../../lib/text_t.h cgiargs.h ../../lib/display.h action.h
    229238librarymain.o: recptproto.h comtypes.h converter.h ../../lib/gsdlunicode.h
    230 librarymain.o: cgiwrapper.h nullproto.h collectserver.h maptools.h
     239librarymain.o: cgiwrapper.h nullproto.h collectserver.h filter.h source.h
     240librarymain.o: browsefilter.h infodbclass.h queryfilter.h maptools.h
  • trunk/gsdl/src/recpt/comtypes.cpp

    r220 r226  
    1212/*
    1313   $Log$
     14   Revision 1.6  1999/04/06 22:20:34  rjmcnab
     15   Got browsefilter working.
     16
    1417   Revision 1.5  1999/03/31 23:44:47  rjmcnab
    1518   Altered the protocol so that the metadata is part of the filter.
     
    3942  else if (err == authenticationFailure) return "authentication failure";
    4043  else if (err == protocolError) return "protocol error";
     44  else if (err == configurationError) return "configuration error";
    4145  else if (err == systemProblem) return "system problem";
    4246
     
    9498
    9599void FilterOption_t::check_defaultValue () {
    96   if (validValues.empty()) {
    97     // nothing to check against
    98     defaultValue.clear();
    99     return;
     100  text_tarray::iterator here, end;
     101
     102  // how the default is interpreted depends on the option type
     103  switch (type) {
     104  case booleant:
     105  case enumeratedt: // has to be one of the validValues
     106    here = validValues.begin ();
     107    end = validValues.end ();
     108    while (here != end) {
     109      if (*here == defaultValue) return;
     110      here++;
     111    }
     112   
     113    break;
     114
     115  case integert: // has to be in the validValues range
     116    if ((validValues.size() >= 2) &&
     117    (validValues[0].getint() <= defaultValue.getint()) &&
     118    (validValues[1].getint() >= defaultValue.getint()))
     119      return;
     120    break;
     121
     122  case stringt: // any value is valid
     123    return;
    100124  }
    101125
    102   text_tarray::iterator here = validValues.begin ();
    103   text_tarray::iterator end = validValues.end ();
    104   while (here != end) {
    105     if (*here == defaultValue) {
    106       // found the default value in the list of valid values
    107       // now there is nothing more to do
    108       return;
    109     }
    110 
    111     here++;
    112   }
    113 
    114   // did not find the defaultValue, set it to be the
    115   // first option in the list
    116   defaultValue = validValues[0];
     126  // did not find the defaultValue
     127  if (validValues.empty()) defaultValue.clear();
     128  else defaultValue = validValues[0];
    117129}
    118130
  • trunk/gsdl/src/recpt/comtypes.h

    r220 r226  
    3232
    3333
    34 enum comerror_t {noError, authenticationFailure, protocolError, systemProblem};
     34enum comerror_t {noError, authenticationFailure, protocolError,
     35         configurationError, systemProblem};
    3536text_t get_comerror_string (comerror_t err);
    3637
     
    203204  text_t filterName;
    204205  OptionValue_tarray filterOptions;
    205   text_tarray docSet;      // contains "" if not used
     206  text_tset docSet;        // empty if not used
    206207  int filterResultOptions; // use the FR* defines above
    207208
  • trunk/gsdl/src/recpt/librarymain.cpp

    r189 r226  
    1212/*
    1313   $Log$
     14   Revision 1.3  1999/04/06 22:20:35  rjmcnab
     15   Got browsefilter working.
     16
    1417   Revision 1.2  1999/03/05 03:53:54  sjboddie
    1518
     
    2730#include "nullproto.h"
    2831#include "collectserver.h"
     32#include "filter.h"
     33#include "browsefilter.h"
     34#include "queryfilter.h"
     35#include "infodbclass.h"
     36#include "mgsearch.h"
    2937#include <assert.h>
    3038
     
    3543  // add a collection server for each collection ... (not implemented yet)
    3644  collectserver cserver;
     45  gdbmclass gdbmhandler;
     46  mgsearchclass mgsearch;
     47
     48  // add a null filter
     49  filterclass filter;
     50  cserver.add_filter (&filter);
     51
     52  // add a browse filter
     53  browsefilterclass browsefilter;
     54  browsefilter.set_gdbmptr (&gdbmhandler);
     55  cserver.add_filter (&browsefilter);
     56
     57  // add a query filter
     58  queryfilterclass queryfilter;
     59  queryfilter.set_gdbmptr (&gdbmhandler);
     60  queryfilter.set_mgsearchptr (&mgsearch);
     61  cserver.add_filter (&queryfilter);
     62
     63  // inform collection server and everything it contains about its
     64  // collection name
    3765  cserver.configure ("collection", "gberg");
     66
    3867  nproto.add_collectserver (&cserver);
    3968
     
    4170  recpt.add_protocol (&nproto);
    4271
    43   cgiwrapper (recpt, "gberg");
     72  cgiwrapper (recpt, "cnrub");
    4473  return 0;
    4574}
  • trunk/gsdl/src/recpt/statusaction.cpp

    r220 r226  
    1212/*
    1313   $Log$
     14   Revision 1.12  1999/04/06 22:20:35  rjmcnab
     15   Got browsefilter working.
     16
    1417   Revision 1.11  1999/03/31 23:44:49  rjmcnab
    1518   Altered the protocol so that the metadata is part of the filter.
     
    470473    }
    471474
    472     /*    textout << outconvert << "<hr>\n"
    473         << "<h3>Metadata options</h3>\n";
    474 
    475     MetadataInfoResponse_t metainfo;
    476     rproto->get_metadataoptions (arg_c, metainfo, err, logout);
     475
     476    InfoFiltersResponse_t filterinfo;
     477    InfoFilterOptionsRequest_t filteroptions_request;
     478    InfoFilterOptionsResponse_t filteroptions;
     479    rproto->get_filterinfo (arg_c, filterinfo, err, logout);
    477480    if (err == noError) {
    478       textout << outconvert
    479           << "<table>\n"
    480           << "<tr><th>supported fields</th><td>";
    481       text_tset::iterator sup_here = metainfo.supportedFields.begin();
    482       text_tset::iterator sup_end = metainfo.supportedFields.end();
    483       bool sup_first = true;
    484       while (sup_here != sup_end) {
    485     if (!sup_first) textout << outconvert << ", ";
    486     sup_first = false;
    487     textout << outconvert << "\"" << *sup_here << "\"";
    488     sup_here++;
    489       }
    490       textout << outconvert << "</td></tr>\n"
    491    
    492           << "<tr><th>supported languages</th><td>";
    493       sup_here = metainfo.supportedLanguages.begin();
    494       sup_end = metainfo.supportedLanguages.end();
    495       sup_first = true;
    496       while (sup_here != sup_end) {
    497     if (!sup_first) textout << outconvert << ", ";
    498     sup_first = false;
    499     textout << outconvert << "\"" << *sup_here << "\"";
    500     sup_here++;
    501       }
    502       textout << outconvert << "</td></tr>\n"
    503           << "</table>\n";
    504 
    505     } else {
    506       textout << outconvert << "Error (" << get_comerror_string (err)
    507           << ") while getting metadata information\n";
    508     }
    509     */
    510     textout << outconvert << "<hr>\n";
    511     /* // this needs some work
    512     InfoFilterOptionsResponse_t filterinfo;
    513     rproto->get_filteroptions (arg_c, filterinfo, err, logout);
    514     if (err == noError) {
    515       FilterDescript_tmap::iterator filter_here =
    516     filterinfo.filterOptions.begin();
    517       FilterDescript_tmap::iterator filter_end =
    518     filterinfo.filterOptions.end();
    519       while (filter_here != filter_end) {
     481      text_tset::iterator filternames_here = filterinfo.filterNames.begin();
     482      text_tset::iterator filternames_end = filterinfo.filterNames.end();
     483      while (filternames_here != filternames_end) {
    520484    textout << outconvert
    521         << "<h3>Filter options for \"" << (*filter_here).first << "\"</h3>\n"
     485        << "<hr>\n"
     486        << "<h3>Filter options for \"" << (*filternames_here) << "\"</h3>\n"
    522487        << "<table>\n"
    523488        << "<tr><th>option name</th><th>type</th><th>repeatable</th>"
    524489        << "<th>default value</th><th>valid values</th></tr>\n";
    525490
    526     FilterOption_tmap::iterator filteropt_here =
    527       (*filter_here).second.filterOptions.begin();
    528     FilterOption_tmap::iterator filteropt_end =
    529       (*filter_here).second.filterOptions.end();
    530     while (filteropt_here != filteropt_end) {
     491    filteroptions_request.clear();
     492    filteroptions_request.filterName = *filternames_here;
     493    rproto->get_filteroptions (arg_c, filteroptions_request,
     494                   filteroptions, err, logout);
     495    if (err == noError) {
     496      FilterOption_tmap::iterator filteropt_here =
     497        filteroptions.filterOptions.begin();
     498      FilterOption_tmap::iterator filteropt_end =
     499        filteroptions.filterOptions.end();
     500      while (filteropt_here != filteropt_end) {
     501        textout << outconvert
     502            << "<tr><td>\""
     503            << (*filteropt_here).second.name
     504            << "\"</td>\n"
     505         
     506            << "<td>";
     507        text_t type_string;
     508        switch ((*filteropt_here).second.type) {
     509        case FilterOption_t::booleant: type_string = "boolean"; break;
     510        case FilterOption_t::integert: type_string = "integer"; break;
     511        case FilterOption_t::enumeratedt: type_string = "enumerated"; break;
     512        case FilterOption_t::stringt: type_string = "string"; break;
     513        }
     514        textout << outconvert
     515            << type_string
     516            << "</td>\n"
     517         
     518            << "<td>";
     519        text_t repeat_string;
     520        switch ((*filteropt_here).second.repeatable) {
     521        case FilterOption_t::onePerQuery: repeat_string = "one per query"; break;
     522        case FilterOption_t::onePerTerm: repeat_string = "one per term"; break;
     523        case FilterOption_t::nPerTerm: repeat_string = "n per term"; break;
     524        }
     525        textout << outconvert
     526            << repeat_string
     527            << "</td>\n"
     528         
     529            << "<td>\""
     530            << (*filteropt_here).second.defaultValue
     531            << "\"</td>\n"
     532         
     533            << "<td>";
     534       
     535        text_tarray::iterator valid_here =
     536          (*filteropt_here).second.validValues.begin();
     537        text_tarray::iterator valid_end =
     538          (*filteropt_here).second.validValues.end();
     539        bool valid_first = true;
     540        while (valid_here != valid_end) {
     541          if (!valid_first) textout << outconvert << ", ";
     542          valid_first = false;
     543          textout << outconvert << "\"" << *valid_here << "\"";
     544          valid_here++;
     545        }
     546        textout << outconvert
     547            << "</td></tr>\n";
     548
     549        filteropt_here++;
     550      }
     551
    531552      textout << outconvert
    532           << "<tr><td>\""
    533           << (*filteropt_here).second.name
    534           << "\"</td>\n"
    535 
    536           << "<td>";
    537       text_t type_string;
    538       switch ((*filteropt_here).second.type) {
    539       case FilterOption_t::booleant: type_string = "boolean"; break;
    540       case FilterOption_t::integert: type_string = "integer"; break;
    541       case FilterOption_t::enumeratedt: type_string = "enumerated"; break;
    542       case FilterOption_t::stringt: type_string = "string"; break;
    543       }
    544       textout << outconvert
    545           << type_string
    546           << "</td>\n"
    547        
    548           << "<td>";
    549       text_t repeat_string;
    550       switch ((*filteropt_here).second.repeatable) {
    551       case FilterOption_t::onePerQuery: repeat_string = "one per query"; break;
    552       case FilterOption_t::onePerTerm: repeat_string = "one per term"; break;
    553       case FilterOption_t::nPerTerm: repeat_string = "n per term"; break;
    554       }
    555       textout << outconvert
    556           << repeat_string
    557           << "</td>\n"
    558        
    559           << "<td>\""
    560           << (*filteropt_here).second.defaultValue
    561           << "\"</td>\n"
    562 
    563           << "<td>";
    564 
    565       text_tarray::iterator valid_here =
    566         (*filteropt_here).second.validValues.begin();
    567       text_tarray::iterator valid_end =
    568         (*filteropt_here).second.validValues.end();
    569       bool valid_first = true;
    570       while (valid_here != valid_end) {
    571         if (!valid_first) textout << outconvert << ", ";
    572         valid_first = false;
    573         textout << outconvert << "\"" << *valid_here << "\"";
    574         valid_here++;
    575       }
    576       textout << outconvert
    577           << "</td></tr>\n";
    578 
    579       filteropt_here++;
     553          << "</table>\n";
     554
     555    } else {
     556      textout << outconvert << "Error (" << get_comerror_string (err)
     557          << ") while getting filter option information\n";
    580558    }
    581559
    582     textout << outconvert
    583         << "</table>\n";
    584 
    585     filter_here++;
     560    filternames_here++;
    586561      }
    587562
    588563    } else {
    589564      textout << outconvert << "Error (" << get_comerror_string (err)
    590           << ") while getting filter option information\n";
    591     }
    592     */
     565          << ") while getting filter information\n";
     566    }
    593567  }
    594568 
Note: See TracChangeset for help on using the changeset viewer.