Changeset 420 for trunk/gsdl/src/recpt/documentaction.cpp
- Timestamp:
- 1999-07-30T14:18:49+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/documentaction.cpp
r411 r420 12 12 /* 13 13 $Log$ 14 Revision 1.15 1999/07/30 02:18:49 sjboddie 15 -added collectinfo argument to some functions 16 -caught up with changes to browsetools (allowing nested classifications) 17 -added showtoppage format option 18 14 19 Revision 1.14 1999/07/21 05:01:09 sjboddie 15 20 fixed up wrapping of classificationlinks … … 219 224 // define all the macros which might be used by other actions 220 225 // to produce pages. 221 void documentaction::define_external_macros (displayclass &disp, cgiargsclass &args, 222 recptproto *collectproto, ostream &logout) { 226 void documentaction::define_external_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 227 cgiargsclass &args, recptproto *collectproto, 228 ostream &logout) { 223 229 224 230 // define_external_macros sets the following macros: … … 278 284 } 279 285 286 bool showtoppage = true; 287 text_tmap::const_iterator it = collectinfo.format.find("showtoppage"); 288 if ((it != collectinfo.format.end()) && ((*it).second == "false")) showtoppage = false; 289 280 290 // do a call to translate OIDs if required 281 291 request.filterName = "NullFilter"; 282 292 request.filterResultOptions = FROID; 283 if ( needs_translating (arg_d)) {293 if ((!arg_d.empty()) && (needs_translating (arg_d) || !showtoppage)) { 284 294 request.docSet.insert (arg_d); 295 request.fields.push_back ("classifytype"); 296 request.filterResultOptions = FRmetadata; 297 request.getParents = true; 285 298 collectproto->filter (collection, request, response, err, logout); 286 299 arg_d = response.docInfo[0].OID; 287 request.docSet.erase (request.docSet.begin(), request.docSet.end()); 300 301 text_t &classifytype = response.docInfo[0].metadata[0].values[0]; 302 if (classifytype.empty() || classifytype == "book") 303 if (!showtoppage && is_top (arg_d)) arg_d += ".fc"; 304 305 request.clear(); 288 306 disp.setmacro ("cgiargd", "Global", arg_d); 289 307 } … … 391 409 // define all the macros which are related to pages generated 392 410 // by this action 393 void documentaction::define_internal_macros (displayclass &disp, cgiargsclass &args, 394 recptproto *collectproto, ostream &logout) { 411 void documentaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp, 412 cgiargsclass &args, recptproto *collectproto, 413 ostream &logout) { 395 414 396 415 // define_internal_macros sets the following macros: … … 420 439 // to the archivedir metadata element 421 440 422 423 441 // can't do anything if collectproto is null (i.e. no collection was specified) 424 442 if (collectproto == NULL) return; 425 443 426 disp.setmacro("random", "document", rand());427 444 428 445 text_tarray metadata; … … 431 448 text_t &arg_cl = args["cl"]; 432 449 text_t &collection = args["c"]; 450 451 disp.setmacro("random", "document", rand()); 433 452 434 453 metadata.push_back ("Title"); … … 461 480 text_t &classifytype = response.docInfo[0].metadata[1].values[0]; 462 481 if (classifytype.empty()) classifytype = "Book"; // defaults to Book 463 if ((classifytype == "Book") || (classifytype == "Hierarchy")) 464 set_arrow_macros (arg_d, classifytype, disp, collectproto, collection, logout); 482 if ((classifytype == "Book") || (classifytype == "Hierarchy")) { 483 bool showtoppage = true; 484 text_tmap::const_iterator it = collectinfo.format.find("showtoppage"); 485 if ((it != collectinfo.format.end()) && ((*it).second == "false")) showtoppage = false; 486 set_arrow_macros (arg_d, classifytype, showtoppage, disp, 487 collectproto, collection, logout); 488 } 465 489 466 490 if (args["u"] != "1") { … … 572 596 } 573 597 574 bool documentaction::do_action (cgiargsclass &args, recptproto *collectproto, 575 displayclass &disp, outconvertclass &outconvert, 576 ostream &textout, ostream &logout) { 598 bool documentaction::do_action (cgiargsclass &args, const ColInfoResponse_t &collectinfo, 599 recptproto *collectproto, displayclass &disp, 600 outconvertclass &outconvert, ostream &textout, 601 ostream &logout) { 577 602 578 603 if (collectproto == NULL) { … … 586 611 FilterResponse_t response; 587 612 text_t toptitle, toptype, thistype, formatstring; 588 613 bool cover = false; 614 589 615 text_t &collection = args["c"]; 590 616 text_t &arg_d = args["d"]; … … 612 638 } 613 639 640 text_tmap::const_iterator it = collectinfo.format.find(toptype + toptitle); 641 if (it != collectinfo.format.end()) formatstring = (*it).second; 642 it = collectinfo.format.find("cover"); 643 if (it != collectinfo.format.end()) cover = true; 644 614 645 // output the table of contents 615 646 if (!arg_d.empty()) { 616 647 617 648 if (toptype == "Hierarchy") 618 hierarchy_toc (thistype, args, collectproto,619 649 output_toc (thistype, formatstring, args, cover, collectproto, 650 disp, outconvert, textout, logout); 620 651 else 621 // Book is the default for a document level toc - AZList, List and 622 // DateList don't make sense for document level 652 // Book is the default for a document level toc 623 653 book_toc (args, collectproto, disp, 624 654 outconvert, textout, logout); 655 625 656 } else { 626 627 // see if we can find a formatstring for this type of toc 628 ColInfoResponse_t collectinfo; 629 comerror_t err; 630 collectproto->get_collectinfo (collection, collectinfo, err, logout); 631 if (err == noError) { 632 text_tmap::const_iterator it = collectinfo.format.find(toptype + toptitle); 633 if (it != collectinfo.format.end()) formatstring = (*it).second; 634 } 635 636 if (toptype == "Hierarchy") 637 hierarchy_toc (thistype, args, collectproto, 638 disp, outconvert, textout, logout); 639 else if (toptype == "DateList") 640 datelist_toc (thistype, formatstring, args, collectproto, 641 disp, outconvert, textout, logout); 642 else 643 // List is the default for a classification level toc - Book doesn't make 644 // sense for classification level 645 list_toc (thistype, formatstring, args, collectproto, 657 // Book should never used at classification level (I think;) 658 output_toc (thistype, formatstring, args, false, collectproto, 646 659 disp, outconvert, textout, logout); 647 660 }
Note:
See TracChangeset
for help on using the changeset viewer.