Ignore:
Timestamp:
1999-10-10T21:14:12+13:00 (25 years ago)
Author:
sjboddie
Message:
  • metadata now returns mp rather than array
  • redesigned browsing support (although it's not finished so

won't currently work ;-)

File:
1 edited

Legend:

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

    r606 r649  
    2828/*
    2929   $Log$
     30   Revision 1.33  1999/10/10 08:14:10  sjboddie
     31   - metadata now returns mp rather than array
     32   - redesigned browsing support (although it's not finished so
     33   won't currently work ;-)
     34
    3035   Revision 1.32  1999/09/21 11:28:45  sjboddie
    3136   tidied up file locking
     
    290295  // add the cgi arguments from this action
    291296  argsinfo.addarginfo (NULL, theaction->getargsinfo());
     297}
     298
     299
     300void receptionist::add_browser (browserclass *thebrowser) {
     301  // make sure we have a browser to add
     302  if (thebrowser == NULL) return;
     303
     304  // add this browser to the list of browsers
     305  browsers.addbrowser(thebrowser);
     306}
     307
     308
     309void receptionist::setdefaultbrowser (const text_t &browsername) {
     310  browsers.setdefaultbrowser (browsername);
    292311}
    293312
     
    378397    }
    379398  }
    380 
    381399 
    382400  // configure the actions
     
    403421    protohere++;
    404422  }
    405 }
     423
     424  // configure the browsers
     425  browserptrmap::iterator browserhere = browsers.begin ();
     426  browserptrmap::iterator browserend = browsers.end ();
     427
     428  while (browserhere != browserend) {
     429    assert ((*browserhere).second.b != NULL);
     430    if ((*browserhere).second.b != NULL)
     431      (*browserhere).second.b->configure(key, cfgline);
     432   
     433    browserhere++;
     434  }
     435}
     436
    406437
    407438void receptionist::configure (const text_t &key, const text_t &value) {
     
    450481  }
    451482
     483  // there must be at least one browser defined
     484  if (browsers.empty()) {
     485    logout << "Error: no browsers have been added to the receptionist\n";
     486    return false;
     487  }
     488
    452489  // create a saveconf string if there isn't one already
    453490  if (configinfo.saveconf.empty())
     
    502539    !(*protohere).p->init(logout)) return false;
    503540    protohere++;
     541  }
     542
     543  // init the browsers
     544  browserptrmap::iterator browserhere = browsers.begin ();
     545  browserptrmap::iterator browserend = browsers.end ();
     546  while (browserhere != browserend) {
     547    if (((*browserhere).second.b == NULL) ||
     548    !(*browserhere).second.b->init(logout)) return false;
     549    browserhere++;
    504550  }
    505551
     
    800846  }
    801847
     848  // get browsers to process OID
     849  text_t OID = args["d"];
     850  if (OID.empty()) OID = args["cl"];
     851  text_tset metadata;
     852  FilterResponse_t response;
     853  metadata.insert ("classifytype");
     854  if (get_info (OID + ".pr", args["c"], metadata, false, collectproto, response, logout)) {
     855    browserclass *b =
     856      browsers.getbrowser (response.docInfo[0].metadata["classifytype"].values[0]);
     857    b->processOID (args);
     858  }
     859
    802860  // translate "d", "cl", and "hp" arguments if required
    803861  translate_OIDs (args, collectproto, logout);
     
    9471005// if they use the tricky ".fc", ".lc" type syntax. also sorts out the "d" argument
    9481006// if the goto page ("gp") argument was used
    949 void receptionist::translate_OIDs (cgiargsclass &args, recptproto *collectproto, ostream &logout) {
     1007void receptionist::translate_OIDs (cgiargsclass &args, recptproto *collectproto,
     1008                   ostream &logout) {
    9501009
    9511010  FilterResponse_t response;
     
    9571016  text_t &collection = args["c"];
    9581017  text_t &arg_gp = args["gp"];
    959 
    960   bool DocumentTopPages = true;
    961   text_tmap::const_iterator it = collectinfo.format.find("DocumentTopPages");
    962   if ((it != collectinfo.format.end()) && ((*it).second == "false")) DocumentTopPages = false;
    9631018 
    9641019  // do a call to translate OIDs if required
    9651020  request.filterName = "NullFilter";
    9661021  request.filterResultOptions = FROID;
    967   if ((!arg_d.empty()) && (needs_translating (arg_d) || !DocumentTopPages)) {
     1022  if (!arg_d.empty() && needs_translating (arg_d)) {
    9681023    request.docSet.push_back (arg_d);
    969     request.fields.push_back ("classifytype");
    970     request.filterResultOptions = FRmetadata;
    971     request.getParents = true;
    9721024    collectproto->filter (collection, request, response, err, logout);
    9731025    arg_d = response.docInfo[0].OID;
    974    
    975     text_t &classifytype = response.docInfo[0].metadata[0].values[0];
    976     if (classifytype.empty() || classifytype == "Book")
    977       if (!DocumentTopPages && is_top (arg_d)) arg_d += ".fc";
    978    
    9791026    request.clear();
    9801027  }
     
    9821029  // (in case ".fc" or ".lc" have screwed up)
    9831030  if (needs_translating (arg_cl)) {
    984     request.fields.push_back("doctype");
     1031    request.fields.insert ("doctype");
    9851032    request.docSet.push_back (arg_cl);
    9861033    request.filterResultOptions = FRmetadata;
    9871034    collectproto->filter (collection, request, response, err, logout);
    9881035    // set to original value (without .xx stuff) if doctype isn't "classify"
    989     if (response.docInfo[0].metadata[0].values[0] != "classify")
     1036    if (response.docInfo[0].metadata["doctype"].values[0] != "classify")
    9901037      strip_suffix (arg_cl);
    9911038    else
     
    10041051    text_t top;
    10051052    get_top (arg_d, top);
    1006     text_tarray metadata;
    1007     metadata.push_back ("Title");
     1053    text_tset metadata;
     1054    metadata.insert ("Title");
    10081055    bool getParents = false;
    10091056    get_children (top, collection, metadata, getParents, collectproto, response, logout);
    1010     ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin();
    1011     ResultDocInfo_tarray::const_iterator docend = response.docInfo.end();
     1057    ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
     1058    ResultDocInfo_tarray::iterator docend = response.docInfo.end();
    10121059    while (dochere != docend) {
    1013       if ((*dochere).metadata[0].values[0] == arg_gp) {
     1060      if ((*dochere).metadata["Title"].values[0] == arg_gp) {
    10141061    arg_d = (*dochere).OID;
    10151062    break;
     
    10991146  if ((!collection.empty()) && (collectproto != NULL)) {
    11001147    FilterResponse_t response;
    1101     text_tarray metadata;
    1102     //    metadata.push_back (".collectionimage");
    1103    
     1148    text_tset metadata;
    11041149    get_info ("collection", collection, metadata, false,
    11051150          collectproto, response, logout);
    11061151
    11071152    if (!response.docInfo[0].metadata.empty()) {
    1108       MetadataInfo_tarray::const_iterator here = response.docInfo[0].metadata.begin();
    1109       MetadataInfo_tarray::const_iterator end = response.docInfo[0].metadata.end();
     1153      MetadataInfo_tmap::const_iterator here = response.docInfo[0].metadata.begin();
     1154      MetadataInfo_tmap::const_iterator end = response.docInfo[0].metadata.end();
    11101155      while (here != end) {
    1111     if (((*here).name != "haschildren") && ((*here).name != "hasnext") &&
    1112         ((*here).name != "hasprevious")) {
    1113       disp.setmacro ((*here).name, "Global", (*here).values[0]);
     1156    if (((*here).first != "haschildren") && ((*here).first != "hasnext") &&
     1157        ((*here).first != "hasprevious")) {
     1158      disp.setmacro ((*here).first, "Global", (*here).second.values[0]);
    11141159    }
    11151160    here ++;
Note: See TracChangeset for help on using the changeset viewer.