Changeset 1941 for trunk/gsdl/src/recpt/documentaction.cpp
- Timestamp:
- 2001-02-09T15:41:33+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/documentaction.cpp
r1860 r1941 144 144 arg_ainfo.savedarginfo = cgiarginfo::must; 145 145 argsinfo.addarginfo (NULL, arg_ainfo); 146 147 //rd is whether a document will be displayed 148 //with a relevant document list 149 arg_ainfo.shortname = "rd"; 150 arg_ainfo.longname = "include relevant documents"; 151 arg_ainfo.multiplechar = false; 152 arg_ainfo.defaultstatus = cgiarginfo::weak; 153 arg_ainfo.argdefault = "0"; 154 arg_ainfo.savedarginfo = cgiarginfo::must; 155 argsinfo.addarginfo (NULL, arg_ainfo); 156 146 157 } 147 158 … … 183 194 if (xinfo != NULL) args["x"] = xinfo->argdefault; 184 195 } 196 197 //checks whether rd arg is valid 198 int arg_rd = args.getintarg("rd"); 199 if (arg_rd != 0 && arg_rd != 1) { 200 logout << "Warning: \"rd\" argument out of range (" << arg_rd << ")\n"; 201 cgiarginfo *rdinfo = argsinfo.getarginfo ("rd"); 202 if (rdinfo != NULL) args["rd"] = rdinfo->argdefault; 203 } 204 185 205 186 206 return true; … … 490 510 '|', formatinfo.DocumentButtons); 491 511 else if ((*format_here).first == "DocumentText") 492 formatinfo.DocumentText = (*format_here).second; 512 formatinfo.DocumentText = (*format_here).second; 513 else if ((*format_here).first == "RelatedDocuments") 514 formatinfo.RelatedDocuments = (*format_here).second; 493 515 else if (((*format_here).first == "DocumentUseHTML") && 494 516 ((*format_here).second == "true")) … … 565 587 options.push_back(opt); 566 588 } 567 589 590 //do not display relation metadata 591 disp.setmacro ("relateddoc", "document", ""); 592 593 //if preferences indicate relevant docs should be collected 594 //and there is no particular format specified then display 595 //this default format. 596 if(args["rd"] == "1" && formatinfo.RelatedDocuments.empty()){ 597 598 text_t relation = ""; //string for displaying relation metadata 599 600 //call function in formattools.cpp which will return the text of the 601 //related documents in a vertical list. This is the default format. 602 if (get_info (arg_d, collection, metadata, options, false, collectproto, response, logout)) 603 relation += get_related_docs(collection, collectproto, response.docInfo[0], logout); 604 605 //set macro to be the related document string 606 disp.setmacro ("relateddoc", "document", relation); 607 } 608 609 568 610 // get metadata for this document and it's parents 569 611 if (get_info (arg_d, collection, metadata, options, 570 612 true, collectproto, response, logout)) { 613 571 614 disp.setmacro ("header", "document", "_textheader_"); 572 615 573 616 text_tarray pagetitlearray; 574 617 if (!response.docInfo[0].metadata["Title"].values[0].empty()) 575 618 pagetitlearray.push_back (response.docInfo[0].metadata["Title"].values[0]); 619 576 620 if (args["gt"] != "1") { 577 621 MetadataInfo_t *parenttitle = response.docInfo[0].metadata["Title"].parent; … … 627 671 } 628 672 629 // Add a macro to display the phind classifier (if appropriate) 673 //if the document is not a document from a collection 674 //we must set the macro to be an empty string 675 disp.setmacro ("relateddoc", "document", ""); 676 677 // Add a macro to display the phind classifier (if appropriate) 630 678 text_t &childtype = response.docInfo[0].metadata["childtype"].values[0]; 631 679 if (childtype == "Phind") { … … 642 690 outconvertclass &outconvert, ostream &textout, 643 691 ostream &logout) { 644 645 692 646 693 // must have a valid collection server 647 694 recptproto *collectproto = protos->getrecptproto (args["c"], logout); … … 660 707 } 661 708 709 662 710 if (formatinfo.DocumentUseHTML) { 663 711 … … 682 730 } 683 731 732 684 733 textout << outconvert << disp << "_document:header_\n" 685 734 << "_document:content_\n"; 686 735 687 736 // output the table of contents 737 logout << "formatinfo.RelatedDocs: " << formatinfo.RelatedDocuments.getcstr() << endl; 688 738 output_toc (args, browsers, formatinfo, collectproto, 689 739 disp, outconvert, textout, logout); 690 740 741 //output the related documents (may be the empty string) 742 //will not output the docs if a format string is specified 743 textout << outconvert << disp << "_document:relateddoc_\n"; 744 691 745 // output the document text 692 746 textout << "<p>\n"; … … 774 828 } 775 829 830 776 831 format_t *formatlistptr = new format_t(); 777 832 parse_formatstring (formatinfo.DocumentText, formatlistptr, metadata, getParents); … … 779 834 metadata.insert ("hastxt"); 780 835 metadata.insert ("haschildren"); 781 836 782 837 if (formatinfo.DocumentText == "[Text]") 783 838 wanttext = 1;
Note:
See TracChangeset
for help on using the changeset viewer.