Changeset 438 for trunk/gsdl/src/recpt/receptionist.cpp
- Timestamp:
- 1999-08-09T16:25:19+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/receptionist.cpp
r418 r438 12 12 /* 13 13 $Log$ 14 Revision 1.21 1999/08/09 04:25:17 sjboddie 15 moved OID translation stuff from documentaction::define_external_macros 16 to receptionist 17 14 18 Revision 1.20 1999/07/30 02:13:09 sjboddie 15 19 -added collectinfo argument to some functions … … 503 507 // decide on the protocol used for communicating with 504 508 // the collection server 509 text_t &collection = args["c"]; 505 510 recptproto *collectproto = NULL; 506 if (!args["c"].empty()) { 507 collectproto = protocols.getrecptproto (args["c"], logout); 508 } 511 if (!collection.empty()) { 512 collectproto = protocols.getrecptproto (collection, logout); 513 } 514 515 // translate "d" and "cl" arguments if required 516 translate_OIDs (args, collectproto, logout); 509 517 510 518 // produce the page using the desired action … … 647 655 648 656 return true; 657 } 658 659 // translate_OIDs translates the "d" and "cl" arguments to their correct values 660 // if they use the tricky ".fc", ".lc" type syntax. also sorts out the "d" argument 661 // if the goto page ("gp") argument was used 662 void receptionist::translate_OIDs (cgiargsclass &args, recptproto *collectproto, ostream &logout) { 663 664 FilterResponse_t response; 665 FilterRequest_t request; 666 comerror_t err; 667 text_t &arg_d = args["d"]; 668 text_t &arg_cl = args["cl"]; 669 text_t &collection = args["c"]; 670 text_t &arg_gp = args["gp"]; 671 672 bool ShowTopPages = true; 673 text_tmap::const_iterator it = collectinfo.format.find("ShowTopPages"); 674 if ((it != collectinfo.format.end()) && ((*it).second == "false")) ShowTopPages = false; 675 676 // do a call to translate OIDs if required 677 request.filterName = "NullFilter"; 678 request.filterResultOptions = FROID; 679 if ((!arg_d.empty()) && (needs_translating (arg_d) || !ShowTopPages)) { 680 request.docSet.insert (arg_d); 681 request.fields.push_back ("classifytype"); 682 request.filterResultOptions = FRmetadata; 683 request.getParents = true; 684 collectproto->filter (collection, request, response, err, logout); 685 arg_d = response.docInfo[0].OID; 686 687 text_t &classifytype = response.docInfo[0].metadata[0].values[0]; 688 if (classifytype.empty() || classifytype == "Book") 689 if (!ShowTopPages && is_top (arg_d)) arg_d += ".fc"; 690 691 request.clear(); 692 } 693 // we'll also check here that the "cl" argument has a "classify" doctype 694 // (in case ".fc" or ".lc" have screwed up) 695 if (needs_translating (arg_cl)) { 696 request.fields.push_back("doctype"); 697 request.docSet.insert (arg_cl); 698 request.filterResultOptions = FRmetadata; 699 collectproto->filter (collection, request, response, err, logout); 700 // set to original value (without .xx stuff) if doctype isn't "classify" 701 if (response.docInfo[0].metadata[0].values[0] != "classify") 702 strip_suffix (arg_cl); 703 else 704 arg_cl = response.docInfo[0].OID; 705 } 706 707 // if the "gp" (go to page) argument is set we need to set 708 // the "d" argument to the corresponding page 709 if ((!arg_d.empty()) && (!arg_gp.empty()) && (is_number (arg_gp))) { 710 text_t top; 711 get_top (arg_d, top); 712 text_tarray metadata; 713 metadata.push_back ("Title"); 714 bool getParents = false; 715 get_children (top, collection, metadata, getParents, collectproto, response, logout); 716 ResultDocInfo_tarray::const_iterator dochere = response.docInfo.begin(); 717 ResultDocInfo_tarray::const_iterator docend = response.docInfo.end(); 718 while (dochere != docend) { 719 if ((*dochere).metadata[0].values[0] == arg_gp) { 720 arg_d = (*dochere).OID; 721 break; 722 } 723 dochere ++; 724 } 725 } 649 726 } 650 727
Note:
See TracChangeset
for help on using the changeset viewer.