Changeset 649 for trunk/gsdl/src/recpt/receptionist.cpp
- Timestamp:
- 1999-10-10T21:14:12+13:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/receptionist.cpp
r606 r649 28 28 /* 29 29 $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 30 35 Revision 1.32 1999/09/21 11:28:45 sjboddie 31 36 tidied up file locking … … 290 295 // add the cgi arguments from this action 291 296 argsinfo.addarginfo (NULL, theaction->getargsinfo()); 297 } 298 299 300 void 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 309 void receptionist::setdefaultbrowser (const text_t &browsername) { 310 browsers.setdefaultbrowser (browsername); 292 311 } 293 312 … … 378 397 } 379 398 } 380 381 399 382 400 // configure the actions … … 403 421 protohere++; 404 422 } 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 406 437 407 438 void receptionist::configure (const text_t &key, const text_t &value) { … … 450 481 } 451 482 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 452 489 // create a saveconf string if there isn't one already 453 490 if (configinfo.saveconf.empty()) … … 502 539 !(*protohere).p->init(logout)) return false; 503 540 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++; 504 550 } 505 551 … … 800 846 } 801 847 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 802 860 // translate "d", "cl", and "hp" arguments if required 803 861 translate_OIDs (args, collectproto, logout); … … 947 1005 // if they use the tricky ".fc", ".lc" type syntax. also sorts out the "d" argument 948 1006 // if the goto page ("gp") argument was used 949 void receptionist::translate_OIDs (cgiargsclass &args, recptproto *collectproto, ostream &logout) { 1007 void receptionist::translate_OIDs (cgiargsclass &args, recptproto *collectproto, 1008 ostream &logout) { 950 1009 951 1010 FilterResponse_t response; … … 957 1016 text_t &collection = args["c"]; 958 1017 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;963 1018 964 1019 // do a call to translate OIDs if required 965 1020 request.filterName = "NullFilter"; 966 1021 request.filterResultOptions = FROID; 967 if ( (!arg_d.empty()) && (needs_translating (arg_d) || !DocumentTopPages)) {1022 if (!arg_d.empty() && needs_translating (arg_d)) { 968 1023 request.docSet.push_back (arg_d); 969 request.fields.push_back ("classifytype");970 request.filterResultOptions = FRmetadata;971 request.getParents = true;972 1024 collectproto->filter (collection, request, response, err, logout); 973 1025 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 979 1026 request.clear(); 980 1027 } … … 982 1029 // (in case ".fc" or ".lc" have screwed up) 983 1030 if (needs_translating (arg_cl)) { 984 request.fields. push_back("doctype");1031 request.fields.insert ("doctype"); 985 1032 request.docSet.push_back (arg_cl); 986 1033 request.filterResultOptions = FRmetadata; 987 1034 collectproto->filter (collection, request, response, err, logout); 988 1035 // 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") 990 1037 strip_suffix (arg_cl); 991 1038 else … … 1004 1051 text_t top; 1005 1052 get_top (arg_d, top); 1006 text_t arraymetadata;1007 metadata. push_back("Title");1053 text_tset metadata; 1054 metadata.insert ("Title"); 1008 1055 bool getParents = false; 1009 1056 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(); 1012 1059 while (dochere != docend) { 1013 if ((*dochere).metadata[ 0].values[0] == arg_gp) {1060 if ((*dochere).metadata["Title"].values[0] == arg_gp) { 1014 1061 arg_d = (*dochere).OID; 1015 1062 break; … … 1099 1146 if ((!collection.empty()) && (collectproto != NULL)) { 1100 1147 FilterResponse_t response; 1101 text_tarray metadata; 1102 // metadata.push_back (".collectionimage"); 1103 1148 text_tset metadata; 1104 1149 get_info ("collection", collection, metadata, false, 1105 1150 collectproto, response, logout); 1106 1151 1107 1152 if (!response.docInfo[0].metadata.empty()) { 1108 MetadataInfo_t array::const_iterator here = response.docInfo[0].metadata.begin();1109 MetadataInfo_t array::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(); 1110 1155 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]); 1114 1159 } 1115 1160 here ++;
Note:
See TracChangeset
for help on using the changeset viewer.