Changeset 138 for trunk/gsdl/src/library


Ignore:
Timestamp:
1999-02-03T14:13:30+13:00 (25 years ago)
Author:
sjboddie
Message:

Got interface to handle subcollections and language subcollections -
committed changes made to some of the collections

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

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/library/libinterface.cpp

    r137 r138  
    1212/*
    1313   $Log$
     14   Revision 1.18  1999/02/03 01:13:29  sjboddie
     15
     16   Got interface to handle subcollections and language subcollections -
     17   committed changes made to some of the collections
     18
    1419   Revision 1.17  1999/02/02 10:01:11  rjmcnab
    1520
     
    255260    cfgline.erase(cfgline.begin());
    256261    if (key == "maintainer")        cfg_info.maintainer = cfgline[0];
    257     else if (key == "indexes")      cfg_info.indexes = cfgline;
     262    //  else if (key == "indexes")      cfg_info.indexes = cfgline;
    258263    else if (key == "defaultindex") cfg_info.defaultindex = cfgline[0];
    259264    else if (key == "macrofiles")   cfg_info.macrofiles = cfgline;
    260265    else if (key == "builddate")    cfg_info.builddate = cfgline[0];
    261266    else if (key == "indexmap")     cfg_info.indexmap = cfgline;
     267    else if (key == "subcollectionmap")
     268                                    cfg_info.subcollectionmap = cfgline;
     269    else if (key == "languagemap")  cfg_info.languagemap = cfgline;
    262270    else if (key == "numbytes")     cfg_info.numbytes = (double)cfgline[0].getint();
    263271    else if (key == "numdocs")      cfg_info.numdocs = (double)cfgline[0].getint();
     
    318326    default_index.clear();
    319327  } else if (cfg_info.defaultindex.empty() ||
    320          !isrealindex (cfg_info.indexmap, cfg_info.defaultindex)) {
     328         !isrealindex (cfg_info.indexmap, cfg_info.subcollectionmap,
     329               cfg_info.languagemap, cfg_info.defaultindex)) {
    321330    logout << "warning: the default index has been reset to the first index\n";
    322     getrealdirindex (cfg_info.indexmap[0], cfg_info.defaultindex, default_index);
     331    text_t subcollection, language;
     332    if (!cfg_info.subcollectionmap.empty())
     333      subcollection = cfg_info.subcollectionmap[0];
     334    if (!cfg_info.languagemap.empty())
     335      language = cfg_info.languagemap[0];
     336    getrealdirindex (cfg_info.indexmap[0], subcollection,
     337             language, cfg_info.defaultindex, default_index);
    323338  } else {
    324     default_index = real2dirindex (cfg_info.indexmap, cfg_info.defaultindex);
     339    default_index = real2dirindex (cfg_info.indexmap, cfg_info.subcollectionmap,
     340                   cfg_info.languagemap, cfg_info.defaultindex);
    325341  }
    326342
     
    328344  // retrieving documents).
    329345  text_default_index = default_index;
    330   if (!isdoclevelindex (cfg_info.defaultindex)) {
    331     text_default_index = real2dirindex (cfg_info.indexmap,
    332                     getdoclevelindex (cfg_info.indexmap));
    333   }
     346  //if (!isdoclevelindex (cfg_info.defaultindex)) {
     347  //  text_default_index = real2dirindex (cfg_info.indexmap, cfg_info.subcollectionmap,
     348  //                    cfg_info.languagemap, getdoclevelindex (cfg_info.indexmap));
     349  //}
    334350
    335351  // load up the default macro files, the collection directory
     
    371387
    372388  parse_cgi_args (argstr, args);
     389
    373390  expand_compressed_args (args);
    374391  add_default_args (args);
     
    574591  if (args["p"].empty()) args.setarg("p", cfg_info.defaultpage);
    575592  if (args["w"].empty()) args.setarg("w", cfg_info.defaultencoding);
    576   if (args["i"].empty()) args.setarg("i", default_index);
     593
     594  // override those parts of the index that need it
     595  int indexsize = args["i"].size();
     596  if ((indexsize < 3) || (indexsize > 7)) {
     597    args["i"] = args["h"] + args["i"] + args["n"];
     598  } else {
     599    if (args["h"].size() == 3) {
     600      args["i"][0] = args["h"][0];
     601      args["i"][1] = args["h"][1];
     602      args["i"][2] = args["h"][2];
     603    }
     604
     605    if (args["j"].size() == 2) {
     606      if (indexsize >= 5) {
     607    args["i"][3] = args["j"][0];
     608    args["i"][4] = args["j"][1];
     609      } else {
     610    args["i"] += args["j"];
     611      }
     612    }
     613    if (args["n"].size() == 2) {
     614      if (cfg_info.subcollectionmap.empty()) {
     615    if (args["i"].size() >= 5) {
     616      args["i"][3] = args["n"][0];
     617      args["i"][4] = args["n"][1];
     618    } else {
     619      args["i"] += args["n"];
     620    }
     621      } else {
     622    if (args["i"].size() == 7) {
     623      args["i"][5] = args["n"][0];
     624      args["i"][6] = args["n"][1];
     625    } else {
     626      args["i"] += args["n"];
     627    }
     628      }
     629    }
     630  }     
     631  if ((args["i"].size() < 3) || (args["i"].size() > 7))
     632    args.setarg("i", default_index);
     633
    577634}
    578635
     
    627684  disp.setmacro("g", "Global", args["g"]);
    628685
    629  // set the selection macros
    630 
    631   text_t indexselect;
    632   text_t maprealindex, mapdirindex;
    633   if (cfg_info.indexmap.size() == 1) {
    634     getrealdirindex (cfg_info.indexmap[0], maprealindex, mapdirindex);
    635     indexselect += "<input type=hidden name=\"i\" value=\"";
    636     indexselect += mapdirindex;
    637     indexselect += "\">_query:";
    638     indexselect += real2macroindex (maprealindex);
    639     indexselect += "_\n";
    640 
    641   } else {
    642     text_t &arg_i = args["i"];
    643     text_tarray::const_iterator maphere = cfg_info.indexmap.begin();
    644     text_tarray::const_iterator mapend = cfg_info.indexmap.end();
    645    
    646     indexselect += "<select name=\"i\">\n";
    647     while (maphere != mapend) {
    648       getrealdirindex (*maphere, maprealindex, mapdirindex);
    649       indexselect += "<option value=\"";
    650       indexselect += mapdirindex;
    651       indexselect += "\"";
    652       if (arg_i == mapdirindex) indexselect += " selected";
    653       indexselect += ">_query:";
    654       indexselect += real2macroindex (maprealindex);
    655       indexselect += "_\n";
    656      
    657       maphere++;
    658     }
    659     indexselect += "</select>\n";
    660   }
    661 
    662   disp.setmacro("indexselection", "query", indexselect);
     686  // set the selection macros
     687
     688  text_t index, subcollection, language;
     689  getdirindexparts (cfg_info.indexmap, cfg_info.subcollectionmap,
     690            cfg_info.languagemap, args["i"],  index,
     691            subcollection, language);
     692
     693  // main part of index
     694  set_selection_macro (cfg_info.indexmap, index, "h");
     695 
     696  // subcollection part of index
     697  if (!cfg_info.subcollectionmap.empty())
     698    set_selection_macro (cfg_info.subcollectionmap, subcollection, "j");
     699
     700  // language part of index
     701  if (!cfg_info.languagemap.empty())
     702    set_selection_macro (cfg_info.languagemap, language, "n");
     703 
    663704
    664705  text_t qtselect;
     
    675716
    676717  disp.setmacro("querytypeselection", "query", qtselect);
     718}
     719
     720void libinterface::set_selection_macro (const text_tarray &map, const text_t &indexarg,
     721                    const text_t &index) {
     722
     723  text_t maprealindex, mapdirindex, indexselect;
     724
     725  if (map.size() == 1) {
     726    getrealdir (map[0], maprealindex, mapdirindex);
     727    indexselect += "<input type=hidden name=\"" + index + "\" value=\"";
     728    indexselect += mapdirindex + "\">_query:";
     729    indexselect += real2macroindex (maprealindex);
     730    indexselect += "_\n";
     731
     732  } else {
     733    text_tarray::const_iterator maphere = map.begin();
     734    text_tarray::const_iterator mapend = map.end();
     735   
     736    indexselect += "<select name=\"" + index +"\">\n";
     737    while (maphere != mapend) {
     738      getrealdir (*maphere, maprealindex, mapdirindex);
     739      indexselect += "<option value=\"";
     740      indexselect += mapdirindex;
     741      indexselect += "\"";
     742      if (indexarg == mapdirindex) indexselect += " selected";
     743      indexselect += ">_query:";
     744      indexselect += real2macroindex (maprealindex);
     745      indexselect += "_\n";
     746     
     747      maphere++;
     748    }
     749    indexselect += "</select>\n";
     750  }
     751  disp.setmacro(index + "selection", "query", indexselect);
    677752}
    678753
     
    12161291  caseoption += "\n<input type=radio name=k value=1";
    12171292  if (arg_k) caseoption += " checked";
    1218   caseoption += "> ignore case differences<br>\n";
     1293  caseoption += ">_textignorecase_<br>\n";
    12191294  caseoption += "<input type=radio name=k value=0";
    12201295  if (!arg_k) caseoption += " checked";
    1221   caseoption += "> upper/lower case must match\n";
     1296  caseoption += ">_textmatchcase_\n";
    12221297
    12231298  disp.setmacro ("caseoption", "preferences", caseoption);
     
    12291304  stemoption += "\n<input type=radio name=s value=1";
    12301305  if (arg_s) stemoption += " checked";
    1231   stemoption += "> ignore word endings<br>\n";
     1306  stemoption += ">_textstem_<br>\n";
    12321307  stemoption += "<input type=radio name=s value=0";
    12331308  if (!arg_s) stemoption += " checked";
    1234   stemoption += "> whole word must match\n";
     1309  stemoption += ">_textnostem_\n";
    12351310
    12361311  disp.setmacro ("stemoption", "preferences", stemoption);
  • trunk/gsdl/src/library/libinterface.h

    r137 r138  
    5555
    5656  text_t      maintainer;
    57   text_tarray indexes;
     57//  text_tarray indexes;
    5858  text_t      defaultindex;
    5959  text_tarray macrofiles;
    6060  text_t      builddate;
    6161  text_tarray indexmap;
     62  text_tarray subcollectionmap;
     63  text_tarray languagemap;
    6264  double      numbytes;
    6365  double      numdocs;
     
    156158  virtual void define_general_macros (cgiargsclass &args, outconvertclass &outconvert,
    157159                      ostream &logout);
     160
     161  virtual void set_selection_macro (const text_tarray &map, const text_t &indexarg,
     162                    const text_t &index);
     163
    158164  virtual void prepare_page (cgiargsclass &args, outconvertclass &outconvert,
    159165                 ostream &logout);
Note: See TracChangeset for help on using the changeset viewer.