Changeset 4936
- Timestamp:
- 2003-07-16T09:04:05+12:00 (21 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r4906 r4936 82 82 } 83 83 84 text_t get_cover_image () { 85 return "_httpcollimg_/{Or}{[parent(Top):archivedir],[archivedir]}/cover.jpg"; 86 } 84 87 85 88 // at the moment this just writes out the html to display … … 94 97 if (args["d"].empty()) return; 95 98 96 textout << outconvert << disp << 97 "<img src=\"_httpcollimg_/_thisOID_/cover.jpg\"><br>\n"; 99 textout << outconvert << disp << "<img src=\"" << get_cover_image() << "\"><br>\n"; 98 100 } 99 101 -
trunk/gsdl/src/recpt/browsetools.h
r2805 r4936 77 77 outconvertclass &outconvert, ostream &textout, 78 78 ostream &logout); 79 79 80 text_t get_cover_image (); 81 80 82 void output_cover_image (cgiargsclass &args, recptproto *collectproto, 81 83 displayclass &disp, outconvertclass &outconvert, -
trunk/gsdl/src/recpt/documentaction.cpp
r4906 r4936 25 25 26 26 #include <string.h> 27 #include <sstream> 28 27 29 #include "documentaction.h" 28 30 #include "browsetools.h" … … 416 418 // _httppagehome_ overridden home url if html collections have own homepage 417 419 418 // _usability_ -a macro for remote usability reporting420 // _usability_ a macro for remote usability reporting 419 421 420 422 // must have a valid collection server to continue 423 421 424 text_t &collection = args["c"]; 422 425 if (collection.empty()) return; … … 630 633 631 634 // must have a valid collection server to continue 632 text_t &collection = args["c"]; 635 636 text_t &collection = args["c"]; 633 637 if (collection.empty()) return; 634 638 recptproto *collectproto = protos->getrecptproto (collection, logout); … … 692 696 //call function in formattools.cpp which will return the text of the 693 697 //related documents in a vertical list. This is the default format. 698 694 699 if (get_info (arg_d, collection, metadata, options, false, collectproto, response, logout)) 695 700 relation += get_related_docs(collection, collectproto, response.docInfo[0], logout); 696 701 697 702 //set macro to be the related document string 703 698 704 disp.setmacro ("relateddoc", "document", relation); 699 705 } … … 837 843 << "</html>\n"; 838 844 } else { 839 output_document (OID, args, collectproto, disp, outconvert, textout, logout);845 output_document (OID, args, collectproto, browsers, disp, outconvert, textout, logout); 840 846 } 841 847 return true; … … 861 867 if (!args["d"].empty()) { 862 868 textout << outconvert << "<p>\n"; 863 output_document (OID, args, collectproto, disp, outconvert, textout, logout);869 output_document (OID, args, collectproto, browsers, disp, outconvert, textout, logout); 864 870 } 865 871 … … 872 878 const TermInfo_tarray &terminfo, const text_t &OID, 873 879 bool highlight, int hastxt, int wanttext, 874 text_t &collection, recptproto *collectproto, 875 displayclass &disp, outconvertclass &outconvert,876 o stream &textout, ostream &logout,877 cgiargsclass &args) {880 text_t &collection, recptproto *collectproto, 881 browsermapclass *browsers, displayclass &disp, 882 outconvertclass &outconvert, ostream &textout, 883 ostream &logout, cgiargsclass &args) { 878 884 879 885 DocumentRequest_t docrequest; … … 901 907 text_tmap options; 902 908 options["text"] = docresponse.doc; 909 options["DocImage"] = get_cover_image(); 910 911 ostringstream tmpstr(ostringstream::binary); 912 if (args["gc"] == "1") { 913 expanded_contents (args, 0, false, browsers, formatinfo, 914 collectproto, disp, outconvert, tmpstr, 915 logout); 916 } else { 917 contracted_contents (args, 0, false, browsers, formatinfo, 918 collectproto, disp, outconvert, tmpstr, logout); 919 } 920 text_t tmp = (char *)(tmpstr.str().c_str()); 921 int len = tmp.size(); 922 char *ctmp = tmp.getcstr(); 923 utf8inconvertclass utf82text_t; 924 utf82text_t.setinput(ctmp, len); 925 convertclass::status_t status; 926 utf82text_t.convert(tmp, status); 927 options["DocTOC"] = tmp; 928 delete ctmp; 929 930 options["DocumentButtonDetach"] = "_document:imagedetach_"; 931 if (args["hl"] == "1") { 932 options["DocumentButtonHighlight"] = "_document:imagenohighlight_"; 933 } else { 934 options["DocumentButtonHighlight"] = "_document:imagehighlight_"; 935 } 936 if (args["gc"] == "1") { 937 options["DocumentButtonExpandContents"] = "_document:imagecontracttoc_"; 938 } else { 939 options["DocumentButtonExpandContents"] = "_document:imageexpandtoc_"; 940 } 941 if (args["gt"] == "1") { 942 options["DocumentButtonExpandText"] = "_document:imagecontracttext_"; 943 } else { 944 options["DocumentButtonExpandText"] = "_document:imageexpandtext_"; 945 } 946 903 947 text_t doctext 904 948 = get_formatted_string (collection, collectproto, docinfo, disp, … … 916 960 917 961 void documentaction::output_document (const text_t &OID, cgiargsclass &args, 918 recptproto *collectproto, displayclass &disp,919 outconvertclass &outconvert, ostream &textout,920 ostream & logout) {962 recptproto *collectproto, browsermapclass *browsers, 963 displayclass &disp, outconvertclass &outconvert, 964 ostream &textout, ostream &logout) { 921 965 FilterResponse_t inforesponse; 922 966 FilterResponse_t queryresponse; … … 930 974 // if we have a query string and highlighting is turned on we need 931 975 // to redo the query to get the terms for highlighting 976 932 977 if (!args["q"].empty() && args.getintarg("hl")) { 933 978 FilterRequest_t request; … … 972 1017 output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo, 973 1018 OID, highlight, hastxt, wanttext, collection, collectproto, 974 disp, outconvert, textout, logout, args);1019 browsers, disp, outconvert, textout, logout, args); 975 1020 976 1021 … … 1015 1060 output_text (thisdocinfo, formatlistptr, queryresponse.termInfo, 1016 1061 OID, highlight, hastxt, wanttext, collection, 1017 collectproto, disp, outconvert, textout, logout, args);1062 collectproto, browsers, disp, outconvert, textout, logout, args); 1018 1063 1019 1064 } … … 1032 1077 output_text (*sechere, formatlistptr, queryresponse.termInfo, 1033 1078 (*sechere).OID, highlight, shastxt, wanttext, collection, 1034 collectproto, disp, outconvert, textout, logout, args);1079 collectproto, browsers, disp, outconvert, textout, logout, args); 1035 1080 count ++; 1036 1081 sechere ++; -
trunk/gsdl/src/recpt/documentaction.h
r4893 r4936 32 32 #include "formattools.h" 33 33 #include "receptionist.h" 34 #include "browserclass.h" 34 35 35 36 class documentaction : public action { … … 55 56 bool highlight, int hastxt, int wanttext, 56 57 text_t &collection, recptproto *collectproto, 57 displayclass &disp, outconvertclass &outconvert,58 o stream &textout, ostream &logout,59 cgiargsclass &args);58 browsermapclass *browsers, displayclass &disp, 59 outconvertclass &outconvert, ostream &textout, 60 ostream &logout, cgiargsclass &args); 60 61 61 62 virtual void output_document (const text_t &OID, cgiargsclass &args, 62 recptproto *collectproto, displayclass &disp,63 outconvertclass &outconvert, ostream &textout,64 ostream & logout);63 recptproto *collectproto, browsermapclass *browsers, 64 displayclass &disp, outconvertclass &outconvert, 65 ostream &textout, ostream &logout); 65 66 66 67 void set_arrow_macros (cgiargsclass &args, recptproto *collectproto, -
trunk/gsdl/src/recpt/formattools.cpp
r4906 r4936 540 540 formatlistptr->command = comSummary; 541 541 542 else if (meta == "DocImage") 543 formatlistptr->command = comImage; 544 545 else if (meta == "DocTOC") 546 formatlistptr->command = comTOC; 547 548 else if (meta == "DocumentButtonDetach") 549 formatlistptr->command = comDocumentButtonDetach; 550 551 else if (meta == "DocumentButtonHighlight") 552 formatlistptr->command = comDocumentButtonHighlight; 553 554 else if (meta == "DocumentButtonExpandContents") 555 formatlistptr->command = comDocumentButtonExpandContents; 556 557 else if (meta == "DocumentButtonExpandText") 558 formatlistptr->command = comDocumentButtonExpandText; 559 542 560 else { 543 561 formatlistptr->command = comMeta; … … 939 957 } 940 958 941 959 static text_t expand_metadata(const text_t &metavalue, const text_t& collection, 960 recptproto* collectproto, ResultDocInfo_t &docinfo, 961 displayclass &disp, text_tmap &options, 962 ostream &logout) { 963 964 if (includes_metadata(metavalue)) 965 { 966 // text has embedded metadata in it => expand it 967 FilterRequest_t request; 968 FilterResponse_t response; 969 970 request.getParents = false; 971 972 format_t *expanded_formatlistptr = new format_t(); 973 parse_formatstring (metavalue, expanded_formatlistptr, 974 request.fields, request.getParents); 975 976 // retrieve metadata 977 get_info(docinfo.OID, collection, request.fields, request.getParents, 978 collectproto, response, logout); 979 980 if (!response.docInfo.empty()) 981 { 982 text_t expanded_metavalue 983 = get_formatted_string(collection, collectproto, 984 response.docInfo[0], disp, expanded_formatlistptr, 985 options, logout); 986 987 return expanded_metavalue; 988 } 989 else 990 { 991 return metavalue; 992 } 993 } 994 else 995 { 996 return metavalue; 997 } 998 } 942 999 943 1000 text_t format_string (const text_t& collection, recptproto* collectproto, … … 949 1006 950 1007 switch (formatlistptr->command) { 951 case comText: 952 return formatlistptr->text; 953 case comLink: 954 return options["link"]; 955 case comEndLink: 956 if (options["link"].empty()) return ""; 957 else return "</a>"; 958 case comHref: 959 return get_href(options["link"]); 960 case comIcon: 961 return options["icon"]; 962 case comNum: 963 return docinfo.result_num; 964 case comRel: //if [RelatedDocuments] appears in format string, collect relation data 965 return get_related_docs(collection, collectproto, docinfo, logout); 966 case comSummary: 967 return format_summary(collection, collectproto, docinfo, disp, options, logout); 968 case comMeta: 969 970 { 971 const text_t& metavalue = get_meta (docinfo, formatlistptr->meta); 972 973 if (includes_metadata(metavalue)) 1008 case comText: 1009 return formatlistptr->text; 1010 case comLink: 1011 return options["link"]; 1012 case comEndLink: 1013 if (options["link"].empty()) return ""; 1014 else return "</a>"; 1015 case comHref: 1016 return get_href(options["link"]); 1017 case comIcon: 1018 return options["icon"]; 1019 case comNum: 1020 return docinfo.result_num; 1021 case comRel: //if [RelatedDocuments] appears in format string, collect relation data 1022 return get_related_docs(collection, collectproto, docinfo, logout); 1023 case comSummary: 1024 return format_summary(collection, collectproto, docinfo, disp, options, logout); 1025 case comMeta: 974 1026 { 975 // text has embedded metadata in it => expand it 976 FilterRequest_t request; 977 FilterResponse_t response; 978 979 request.getParents = false; 980 981 format_t *expanded_formatlistptr = new format_t(); 982 parse_formatstring (metavalue, expanded_formatlistptr, 983 request.fields, request.getParents); 984 985 // retrieve metadata 986 get_info(docinfo.OID, collection, request.fields, request.getParents, 987 collectproto, response, logout); 988 989 if (!response.docInfo.empty()) 990 { 991 text_t expanded_metavalue 992 = get_formatted_string(collection, collectproto, 993 response.docInfo[0], disp, expanded_formatlistptr, 994 options, logout); 995 996 return expanded_metavalue; 997 } 998 else 999 { 1000 return metavalue; 1001 } 1027 const text_t& metavalue = get_meta (docinfo, formatlistptr->meta); 1028 return expand_metadata(metavalue, collection, collectproto, docinfo, disp, options, logout); 1002 1029 } 1003 else 1004 { 1005 return metavalue; 1006 } 1007 } 1008 case comDoc: 1009 return options["text"]; 1010 case comHighlight: 1011 if (options["highlight"] == "1") return "<b>"; 1012 break; 1013 case comEndHighlight: 1014 if (options["highlight"] == "1") return "</b>"; 1015 break; 1016 case comIf: 1017 return get_if (collection, collectproto, docinfo, disp, 1018 formatlistptr->decision, formatlistptr->ifptr, 1019 formatlistptr->elseptr, options, logout); 1020 case comOr: 1021 return get_or (collection,collectproto, docinfo, disp, formatlistptr->orptr, 1022 options, logout); 1030 case comDoc: 1031 return options["text"]; 1032 case comImage: 1033 return expand_metadata(options["DocImage"], collection, collectproto, docinfo, disp, options, logout); 1034 case comTOC: 1035 return options["DocTOC"]; 1036 case comDocumentButtonDetach: 1037 return options["DocumentButtonDetach"]; 1038 case comDocumentButtonHighlight: 1039 return options["DocumentButtonHighlight"]; 1040 case comDocumentButtonExpandContents: 1041 return options["DocumentButtonExpandContents"]; 1042 case comDocumentButtonExpandText: 1043 return options["DocumentButtonExpandText"]; 1044 case comHighlight: 1045 if (options["highlight"] == "1") return "<b>"; 1046 break; 1047 case comEndHighlight: 1048 if (options["highlight"] == "1") return "</b>"; 1049 break; 1050 case comIf: 1051 return get_if (collection, collectproto, docinfo, disp, 1052 formatlistptr->decision, formatlistptr->ifptr, 1053 formatlistptr->elseptr, options, logout); 1054 case comOr: 1055 return get_or (collection,collectproto, docinfo, disp, formatlistptr->orptr, 1056 options, logout); 1023 1057 } 1024 1058 return ""; -
trunk/gsdl/src/recpt/formattools.h
r4906 r4936 34 34 35 35 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, 36 comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary, comTOC, comImage}; 36 comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary, 37 comTOC, comImage, comDocumentButtonDetach, comDocumentButtonHighlight, 38 comDocumentButtonExpandContents, comDocumentButtonExpandText}; 37 39 enum pcommand_t {pNone, pImmediate, pTop, pAll}; 38 40 enum dcommand_t {dMeta, dText}; -
trunk/gsdl/src/recpt/vlistbrowserclass.cpp
r4906 r4936 27 27 #include <assert.h> 28 28 #include "OIDtools.h" 29 #include "browsetools.h" 29 30 30 31 vlistbrowserclass::vlistbrowserclass () { … … 88 89 if (highlight) options["highlight"] = "1"; 89 90 else options["highlight"] = "0"; 91 options["DocImage"] = get_cover_image(); 90 92 textout << outconvert << disp 91 93 << get_formatted_string (collection, collectproto, … … 137 139 options["icon"] = icon; 138 140 options["highlight"] = "0"; 139 141 options["DocImage"] = get_cover_image(); 142 140 143 if ( thissection != endsection ) { // only if there are results (else corrupts display) 141 144 fstring = get_formatted_string (collection, collectproto, *thissection, … … 166 169 if (highlight) options["highlight"] = "1"; 167 170 else options["highlight"] = "0"; 171 options["DocImage"] = get_cover_image(); 168 172 169 173 textout << outconvert << disp
Note:
See TracChangeset
for help on using the changeset viewer.