Changeset 870
- Timestamp:
- 2000-01-26T11:39:16+13:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/documentaction.cpp
r781 r870 28 28 /* 29 29 $Log$ 30 Revision 1.32 2000/01/25 22:39:15 sjboddie 31 added DocumentUseHTML - tidied some things up (and messed up some others) 32 30 33 Revision 1.31 1999/11/13 08:57:00 sjboddie 31 34 fixed bug in last changes … … 250 253 arg_ainfo.defaultstatus = cgiarginfo::weak; 251 254 arg_ainfo.argdefault = "0"; 255 arg_ainfo.savedarginfo = cgiarginfo::must; 256 argsinfo.addarginfo (NULL, arg_ainfo); 257 258 // f arg is set to 1 if document is to 259 // be displayed in a frame 260 arg_ainfo.shortname = "f"; 261 arg_ainfo.longname = "frame"; 262 arg_ainfo.multiplechar = false; 263 arg_ainfo.defaultstatus = cgiarginfo::weak; 264 arg_ainfo.argdefault = "0"; 265 arg_ainfo.savedarginfo = cgiarginfo::mustnot; 266 argsinfo.addarginfo (NULL, arg_ainfo); 267 268 // fc arg is "1" if search bar is to be included (i.e. if "fc" == 1 269 // the httpdocument macro will include "&f=1" 270 arg_ainfo.shortname = "fc"; 271 arg_ainfo.longname = "include search bar"; 272 arg_ainfo.multiplechar = false; 273 arg_ainfo.defaultstatus = cgiarginfo::weak; 274 arg_ainfo.argdefault = "1"; 252 275 arg_ainfo.savedarginfo = cgiarginfo::must; 253 276 argsinfo.addarginfo (NULL, arg_ainfo); … … 444 467 // bar 445 468 469 // _httpdocument_ has '&f=1' added if displaying document inside a frame 470 471 // _gsdltop_ macro to replace _top targets with 472 473 // _httppagehome_ overridden home url if html collections have own homepage 446 474 447 475 // must have a valid collection server to continue … … 456 484 FilterResponse_t response; 457 485 text_tset metadata; 486 487 488 // get info on current collection and load up formatinfo 489 // I'd prefer not to do this here as we're getting 490 // collection info every time (and probably also getting 491 // it in other places some of the time) - One day I'll 492 // fix it ... maybe - Stefan. 493 ColInfoResponse_t cinfo; 494 collectproto->get_collectinfo (collection, cinfo, err, logout); 495 load_formatinfo (cinfo.format, args.getintarg("gt")); 496 497 if (formatinfo.DocumentUseHTML) { 498 499 // frame stuff 500 if (args["fc"] == "1") { 501 text_t httpdocument; 502 disp.expandstring ("Global", "_httpdocument_", httpdocument); 503 httpdocument += "&f=1"; 504 disp.setmacro ("httpdocument", "Global", httpdocument); 505 disp.setmacro ("gsdltop", "Global", "documenttop"); 506 } 507 text_tmap::iterator it = cinfo.format.find ("homepage"); 508 if (it != cinfo.format.end()) { 509 text_t httppagehome; 510 if (get_link (args, protos, (*it).second, httppagehome, logout)) 511 disp.setmacro ("httppagehome", "Global", httppagehome); 512 } 513 } 458 514 459 515 // don't want navigation bar if page is 'detached' … … 481 537 } 482 538 } 539 } 540 541 bool documentaction::get_link (cgiargsclass &args, recptprotolistclass *protos, 542 const text_t &inlink, text_t &outlink, ostream &logout) { 543 544 FilterResponse_t response; 545 text_tset metadata; 546 metadata.insert ("section"); 547 548 // check current collection first 549 recptproto *collectproto = protos->getrecptproto (args["c"], logout); 550 551 if (get_info (inlink, args["c"], metadata, false, collectproto, response, logout)) { 552 if (!response.docInfo[0].metadata["section"].values[0].empty()) { 553 outlink = "_httpdocument_&d=" + response.docInfo[0].metadata["section"].values[0]; 554 return true; 555 } 556 } 557 558 // check all the other enabled collections 559 560 if (args["ccs"] == "1" && !args["cc"].empty()) { 561 text_tarray collections; 562 splitchar (args["cc"].begin(), args["cc"].end(), ',', collections); 563 564 text_tarray::const_iterator col_here = collections.begin(); 565 text_tarray::const_iterator col_end = collections.end(); 566 567 while (col_here != col_end) { 568 569 // don't need to check current collection again 570 if (*col_here == args["c"]) {col_here ++; continue;} 571 572 collectproto = protos->getrecptproto (*col_here, logout); 573 574 if (get_info (inlink, *col_here, metadata, false, collectproto, response, logout)) { 575 if (!response.docInfo[0].metadata["section"].values[0].empty()) { 576 outlink = "_httpdocument_&c=" + *col_here + "&d=" + 577 response.docInfo[0].metadata["section"].values[0]; 578 return true; 579 } 580 } 581 col_here ++; 582 } 583 } 584 return false; 483 585 } 484 586 … … 509 611 else if ((*format_here).first == "DocumentText") 510 612 formatinfo.DocumentText = (*format_here).second; 613 else if (((*format_here).first == "DocumentUseHTML") && 614 ((*format_here).second == "true")) 615 formatinfo.DocumentUseHTML = true; 511 616 else 512 617 formatinfo.formatstrings[(*format_here).first] = (*format_here).second; 513 618 514 619 format_here ++; 515 620 } 516 621 517 622 // never want arrows when text is expanded 518 if (gt) 519 formatinfo.DocumentArrowsBottom = false; 623 if (gt) formatinfo.DocumentArrowsBottom = false; 520 624 } 521 625 … … 582 686 // to the archivedir metadata element 583 687 584 585 688 // must have a valid collection server to continue 586 689 text_t &collection = args["c"]; … … 593 696 text_t &arg_d = args["d"]; 594 697 text_t &arg_cl = args["cl"]; 595 int gt = args.getintarg("gt");596 597 // get info on current collection and load up formatinfo598 ColInfoResponse_t cinfo;599 comerror_t err;600 collectproto->get_collectinfo (collection, cinfo, err, logout);601 load_formatinfo (cinfo.format, gt);602 698 603 699 if (!formatinfo.DocumentArrowsBottom) … … 628 724 if (!response.docInfo[0].metadata["Title"].values[0].empty()) 629 725 pagetitlearray.push_back (response.docInfo[0].metadata["Title"].values[0]); 630 if ( !gt) {726 if (args["gt"] != "1") { 631 727 MetadataInfo_t *parenttitle = response.docInfo[0].metadata["Title"].parent; 632 728 while (parenttitle != NULL) { … … 710 806 } 711 807 808 if (formatinfo.DocumentUseHTML) { 809 810 if (!args["d"].empty()) { 811 if (args["f"] == "1") { 812 textout << outconvert << disp 813 << "<html><head></head>\n" 814 << "<frameset rows=\"68,*\" noresize border=0>\n" 815 << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=p&p=nav\">\n" 816 << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=d&d=" 817 << args["d"] << "\">" 818 << "<noframes>\n" 819 << "<p>You must have a frame enabled browser to view this.</p>\n" 820 << "</noframes>\n" 821 << "</frameset>\n" 822 << "</html>\n"; 823 } else { 824 output_document (OID, args, collectproto, disp, outconvert, textout, logout); 825 } 826 return true; 827 } 828 } 829 712 830 textout << outconvert << disp << "_document:header_\n" 713 831 << "_document:content_\n"; 714 832 715 833 // output the table of contents 716 834 output_toc (args, browsers, formatinfo, collectproto, 717 835 disp, outconvert, textout, logout); 718 836 719 837 // output the document text 720 838 textout << "<p>\n"; -
trunk/gsdl/src/recpt/documentaction.h
r758 r870 40 40 41 41 receptionist *recpt; 42 43 bool get_link (cgiargsclass &args, recptprotolistclass *protos, 44 const text_t &inlink, text_t &outlink, ostream &logout); 42 45 43 46 void load_formatinfo (const text_tmap &colformat, int gt);
Note:
See TracChangeset
for help on using the changeset viewer.