Changeset 4906
- Timestamp:
- 2003-07-12T08:58:10+12:00 (21 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r4867 r4906 115 115 return; 116 116 117 text_tmap options; // no options 117 118 textout << outconvert << disp 118 << get_formatted_string (args["c"],collectproto, 119 response.docInfo[0], disp, formatlistptr, 120 logout); 119 << get_formatted_string (args["c"],collectproto, response.docInfo[0], disp, 120 formatlistptr, options, logout); 121 121 } 122 122 … … 145 145 146 146 //get the format string from formattools.cpp 147 text_tmap options; // no options 147 148 text_t relateddocs = get_formatted_string (args["c"],collectproto, response.docInfo[0], 148 disp, formatlistptr, logout);149 disp, formatlistptr, options, logout); 149 150 //output the related documents 150 151 textout << outconvert << disp << relateddocs; -
trunk/gsdl/src/recpt/datelistbrowserclass.cpp
r3666 r4906 123 123 124 124 if (!use_table) textout << outconvert << "<td>\n"; 125 125 126 text_tmap options; 127 options["link"] = link; 128 options["icon"] = icon; 129 options["highlight"] = "0"; 126 130 textout << outconvert << disp 127 131 << get_formatted_string (collection, collectproto, 128 132 *thissection, disp, formatlistptr, 129 link, icon, false, 130 logout) << "\n"; 133 options, logout) << "\n"; 131 134 132 135 if (!use_table) textout << outconvert << "</td>"; -
trunk/gsdl/src/recpt/documentaction.cpp
r4893 r4906 899 899 900 900 if (wanttext != 1) { 901 text_tmap options; 902 options["text"] = docresponse.doc; 901 903 text_t doctext 902 = get_formatted_string (collection, collectproto, 903 docinfo, disp, formatlistptr, docresponse.doc, 904 logout); 904 = get_formatted_string (collection, collectproto, docinfo, disp, 905 formatlistptr, options, logout); 905 906 906 907 if (highlight) { -
trunk/gsdl/src/recpt/formattools.cpp
r4868 r4906 32 32 33 33 // a few function prototypes 34 34 35 static text_t format_string (const text_t& collection, recptproto* collectproto, 35 36 ResultDocInfo_t &docinfo, displayclass &disp, 36 format_t *formatlistptr, 37 const text_t &link, const text_t &icon, 38 const text_t &text, bool highlight, ostream& logout); 37 format_t *formatlistptr, text_tmap &options, 38 ostream& logout); 39 39 40 40 static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end, 41 41 format_t *formatlistptr, text_tset &metadata, bool &getParents); 42 42 43 text_t format_summary (const text_t& collection, recptproto* collectproto, 44 ResultDocInfo_t &docinfo, displayclass &disp, 45 const text_t &text, bool highlight, 46 ostream& logout); 43 static text_t format_summary (const text_t& collection, recptproto* collectproto, 44 ResultDocInfo_t &docinfo, displayclass &disp, 45 text_tmap &options, ostream& logout); 47 46 48 47 … … 866 865 static text_t get_or (const text_t& collection, recptproto* collectproto, 867 866 ResultDocInfo_t &docinfo, displayclass &disp, 868 format_t *orptr, 869 const text_t &link, const text_t &icon, 870 const text_t &text, bool highlight, 867 format_t *orptr, text_tmap &options, 871 868 ostream& logout) { 872 869 … … 875 872 876 873 tmp = format_string (collection,collectproto, docinfo, disp, orptr, 877 link, icon, text, highlight, logout);874 options, logout); 878 875 if (!tmp.empty()) return tmp; 879 876 … … 886 883 ResultDocInfo_t &docinfo, displayclass &disp, 887 884 const decision_t &decision, 888 format_t *ifptr, format_t *elseptr, const text_t &link, 889 const text_t &icon, const text_t &text, bool highlight, 890 ostream& logout) 885 format_t *ifptr, format_t *elseptr, 886 text_tmap &options, ostream& logout) 891 887 { 892 888 … … 897 893 if (ifptr != NULL) 898 894 return get_formatted_string (collection,collectproto, docinfo, disp, ifptr, 899 link, icon, text, highlight, logout);895 options, logout); 900 896 } 901 897 else { 902 898 if (elseptr != NULL) 903 899 return get_formatted_string (collection,collectproto, docinfo, disp, elseptr, 904 link, icon, text, highlight, logout);900 options, logout); 905 901 } 906 902 } … … 920 916 if (ifptr != NULL) 921 917 return get_formatted_string (collection, collectproto, docinfo, disp, ifptr, 922 link, icon, text, highlight, logout);918 options, logout); 923 919 } else { 924 920 if (elseptr != NULL) 925 921 return get_formatted_string (collection, collectproto, docinfo, disp, elseptr, 926 link, icon, text, highlight, logout);922 options, logout); 927 923 } 928 924 } … … 947 943 text_t format_string (const text_t& collection, recptproto* collectproto, 948 944 ResultDocInfo_t &docinfo, displayclass &disp, 949 format_t *formatlistptr, 950 const text_t &link, const text_t &icon, 951 const text_t &text, bool highlight, 945 format_t *formatlistptr, text_tmap &options, 952 946 ostream& logout) { 953 947 … … 958 952 return formatlistptr->text; 959 953 case comLink: 960 return link;954 return options["link"]; 961 955 case comEndLink: 962 if ( link.empty()) return "";956 if (options["link"].empty()) return ""; 963 957 else return "</a>"; 964 958 case comHref: 965 return get_href( link);959 return get_href(options["link"]); 966 960 case comIcon: 967 return icon;961 return options["icon"]; 968 962 case comNum: 969 963 return docinfo.result_num; … … 971 965 return get_related_docs(collection, collectproto, docinfo, logout); 972 966 case comSummary: 973 return format_summary(collection, collectproto,docinfo,disp,text,highlight,logout);967 return format_summary(collection, collectproto, docinfo, disp, options, logout); 974 968 case comMeta: 975 969 … … 998 992 = get_formatted_string(collection, collectproto, 999 993 response.docInfo[0], disp, expanded_formatlistptr, 1000 link, icon, highlight, logout);994 options, logout); 1001 995 1002 996 return expanded_metavalue; … … 1013 1007 } 1014 1008 case comDoc: 1015 return text;1009 return options["text"]; 1016 1010 case comHighlight: 1017 if ( highlight) return "<b>";1011 if (options["highlight"] == "1") return "<b>"; 1018 1012 break; 1019 1013 case comEndHighlight: 1020 if ( highlight) return "</b>";1014 if (options["highlight"] == "1") return "</b>"; 1021 1015 break; 1022 1016 case comIf: 1023 1017 return get_if (collection, collectproto, docinfo, disp, 1024 1018 formatlistptr->decision, formatlistptr->ifptr, 1025 formatlistptr->elseptr, link, icon, text, highlight, 1026 logout); 1019 formatlistptr->elseptr, options, logout); 1027 1020 case comOr: 1028 1021 return get_or (collection,collectproto, docinfo, disp, formatlistptr->orptr, 1029 link, icon, text, highlight, logout);1022 options, logout); 1030 1023 } 1031 1024 return ""; 1032 }1033 1034 1035 1036 1037 text_t get_formatted_string (const text_t& collection, recptproto* collectproto,1038 ResultDocInfo_t& docinfo, displayclass &disp,1039 format_t* formatlistptr,1040 const text_t& link, const text_t& icon,1041 const text_t& text, const bool highlight,1042 ostream& logout) {1043 1044 text_t ft;1045 while (formatlistptr != NULL)1046 {1047 ft += format_string (collection, collectproto, docinfo, disp, formatlistptr,1048 link, icon, text, highlight, logout);1049 formatlistptr = formatlistptr->nextptr;1050 }1051 1052 return ft;1053 1025 } 1054 1026 1055 1027 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 1056 1028 ResultDocInfo_t &docinfo, displayclass &disp, 1057 format_t *formatlistptr, 1058 const text_t &link, const text_t &icon, 1059 const bool highlight, 1029 format_t *formatlistptr, text_tmap &options, 1060 1030 ostream& logout) { 1061 1031 1062 text_t text = ""; 1063 1064 return get_formatted_string(collection, collectproto, docinfo, disp, formatlistptr, 1065 link, icon, text, highlight, logout); 1066 } 1067 1068 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 1069 ResultDocInfo_t &docinfo, displayclass &disp, 1070 format_t *formatlistptr, 1071 const text_t& text, 1072 ostream& logout) { 1073 1074 text_t link = "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">"; 1075 text_t icon = "_icontext_"; 1076 bool highlight = false; 1077 1078 return get_formatted_string(collection, collectproto, docinfo, disp, formatlistptr, 1079 link, icon, text, highlight, logout); 1080 } 1081 1082 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 1083 ResultDocInfo_t &docinfo, displayclass &disp, 1084 format_t *formatlistptr, 1085 ostream& logout) { 1086 1087 text_t text = ""; 1088 1089 return get_formatted_string(collection, collectproto, docinfo, disp, formatlistptr, 1090 text, logout); 1032 text_t ft; 1033 while (formatlistptr != NULL) 1034 { 1035 ft += format_string (collection, collectproto, docinfo, disp, formatlistptr, 1036 options, logout); 1037 formatlistptr = formatlistptr->nextptr; 1038 } 1039 1040 return ft; 1091 1041 } 1092 1042 … … 1097 1047 1098 1048 text_t format_summary (const text_t& collection, recptproto* collectproto, 1099 ResultDocInfo_t &docinfo, displayclass &disp, 1100 const text_t &text, bool highlight, 1101 ostream& logout) { 1049 ResultDocInfo_t &docinfo, displayclass &disp, 1050 text_tmap &options, ostream& logout) { 1102 1051 1103 1052 // GRB: added code here to ensure that the cstr (and other collections) … … 1111 1060 1112 1061 text_t textToSummarise, query; 1113 if( text.empty()) { // get document text1114 1115 1116 1117 1118 1119 1062 if(options["text"].empty()) { // get document text 1063 DocumentRequest_t docrequest; 1064 DocumentResponse_t docresponse; 1065 comerror_t err; 1066 docrequest.OID = docinfo.OID; 1067 collectproto->get_document (collection, docrequest, docresponse, err, logout); 1068 textToSummarise = docresponse.doc; 1120 1069 } else // in practice, this would not happen, because text is only 1121 1070 // loaded with the [Text] command 1122 textToSummarise = text;1071 textToSummarise = options["text"]; 1123 1072 disp.expandstring("_cgiargq_",query); 1124 1073 return summarise(textToSummarise,query,80); -
trunk/gsdl/src/recpt/formattools.h
r4868 r4906 34 34 35 35 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, 36 comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary };36 comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary, comTOC, comImage}; 37 37 enum pcommand_t {pNone, pImmediate, pTop, pAll}; 38 38 enum dcommand_t {dMeta, dText}; … … 119 119 120 120 121 text_t get_formatted_string (const text_t& collection, recptproto* collectproto,122 ResultDocInfo_t &docinfo, displayclass &disp,123 format_t *formatlistptr,124 const text_t &link, const text_t &icon,125 const text_t& t, const bool highlight,126 ostream& logout);127 121 128 122 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 129 123 ResultDocInfo_t &docinfo, displayclass &disp, 130 format_t *formatlistptr, 131 const text_t &link, const text_t &icon, 132 const bool highlight, 124 format_t *formatlistptr, text_tmap &options, 133 125 ostream& logout); 134 135 text_t get_formatted_string (const text_t& collection, recptproto* collectproto,136 ResultDocInfo_t &docinfo, displayclass &disp,137 format_t *formatlistptr,138 const text_t &text,139 ostream& logout);140 141 text_t get_formatted_string (const text_t& collection, recptproto* collectproto,142 ResultDocInfo_t &docinfo, displayclass &disp,143 format_t *formatlistptr, ostream& logout);144 145 146 126 147 127 #endif -
trunk/gsdl/src/recpt/hlistbrowserclass.cpp
r3666 r4906 135 135 } 136 136 137 text_tmap options; 138 options["link"] = link; 139 options["icon"] = icon; 140 if (highlight) options["highlight"] = "1"; 141 else options["highlight"] = "0"; 142 137 143 text_t fmt_str=get_formatted_string (collection, collectproto, 138 144 *tsibling, disp, formatlistptr, 139 link, icon, highlight, logout);145 options, logout); 140 146 141 147 /* this is awful. Someone please come up with a better way to prevent -
trunk/gsdl/src/recpt/vlistbrowserclass.cpp
r4829 r4906 83 83 } 84 84 85 text_tmap options; 86 options["link"] = link; 87 options["icon"] = icon; 88 if (highlight) options["highlight"] = "1"; 89 else options["highlight"] = "0"; 85 90 textout << outconvert << disp 86 91 << get_formatted_string (collection, collectproto, 87 92 section, disp, formatlistptr, 88 link, icon, highlight, logout);93 options, logout); 89 94 90 95 if (use_table || colnumber > 0) textout << outconvert << "</tr></table>\n"; … … 127 132 int item = 0, perline;; // set perline to 1 normally 128 133 text_t fstring; 134 135 text_tmap options; 136 options["link"] = link; 137 options["icon"] = icon; 138 options["highlight"] = "0"; 139 129 140 if ( thissection != endsection ) { // only if there are results (else corrupts display) 130 fstring = 131 get_formatted_string (collection, collectproto, 132 *thissection, disp, formatlistptr, link, icon, false, logout); 141 fstring = get_formatted_string (collection, collectproto, *thissection, 142 disp, formatlistptr, options, logout); 133 143 // if format string 134 144 // has <td><t (e.g. <td><table>) then … … 152 162 textout << outconvert << "<tr valign=top>\n"; 153 163 164 options["link"] = link; 165 options["icon"] = icon; 166 if (highlight) options["highlight"] = "1"; 167 else options["highlight"] = "0"; 168 154 169 textout << outconvert << disp 155 170 << " " << get_formatted_string (collection, collectproto, *thissection, disp, 156 formatlistptr, link, icon, highlight, logout);171 formatlistptr, options, logout); 157 172 158 173 if ((item >= perline && use_table) || colnumber > 0) {
Note:
See TracChangeset
for help on using the changeset viewer.