1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * documentaction.cpp --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 | #include <string.h>
|
---|
27 | #include "documentaction.h"
|
---|
28 | #include "browsetools.h"
|
---|
29 | #include "OIDtools.h"
|
---|
30 | #include "querytools.h"
|
---|
31 | #include "unitool.h"
|
---|
32 | #include "gsdltools.h"
|
---|
33 | #include "highlighttext.h"
|
---|
34 |
|
---|
35 | documentaction::documentaction () {
|
---|
36 | recpt = NULL;
|
---|
37 |
|
---|
38 |
|
---|
39 | // this action uses cgi variables "a", "d", "cl",
|
---|
40 | // "x", "gc", "gt", "gp", and "hl"
|
---|
41 | cgiarginfo arg_ainfo;
|
---|
42 | arg_ainfo.shortname = "a";
|
---|
43 | arg_ainfo.longname = "action";
|
---|
44 | arg_ainfo.multiplechar = true;
|
---|
45 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
46 | arg_ainfo.argdefault = "p";
|
---|
47 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
48 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
49 |
|
---|
50 | arg_ainfo.shortname = "d";
|
---|
51 | arg_ainfo.longname = "document OID";
|
---|
52 | arg_ainfo.multiplechar = true;
|
---|
53 | arg_ainfo.defaultstatus = cgiarginfo::none;
|
---|
54 | arg_ainfo.argdefault = "";
|
---|
55 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
56 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
57 |
|
---|
58 | // whether or not a document should be retrieved from the
|
---|
59 | // library or the Web.
|
---|
60 | arg_ainfo.shortname = "il";
|
---|
61 | arg_ainfo.longname = "internal link preference";
|
---|
62 | arg_ainfo.multiplechar = false;
|
---|
63 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
64 | arg_ainfo.argdefault = "l";
|
---|
65 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
66 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
67 |
|
---|
68 | arg_ainfo.shortname = "cl";
|
---|
69 | arg_ainfo.longname = "classification OID";
|
---|
70 | arg_ainfo.multiplechar = true;
|
---|
71 | arg_ainfo.defaultstatus = cgiarginfo::none;
|
---|
72 | arg_ainfo.argdefault = "";
|
---|
73 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
74 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
75 |
|
---|
76 | // in this action "gc" controls the expand/contract
|
---|
77 | // contents function
|
---|
78 | arg_ainfo.shortname = "gc";
|
---|
79 | arg_ainfo.longname = "expand contents";
|
---|
80 | arg_ainfo.multiplechar = false;
|
---|
81 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
82 | arg_ainfo.argdefault = "0";
|
---|
83 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
84 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
85 |
|
---|
86 | // in this action "gt" controls the expand/contract
|
---|
87 | // text function 0 = not expanded, 1 = expand unless
|
---|
88 | // there are more than 10 sections containing text,
|
---|
89 | // 2 = expand all
|
---|
90 | arg_ainfo.shortname = "gt";
|
---|
91 | arg_ainfo.longname = "expand text";
|
---|
92 | arg_ainfo.multiplechar = false;
|
---|
93 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
94 | arg_ainfo.argdefault = "0";
|
---|
95 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
96 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
97 |
|
---|
98 | // in this action "gp" is the "go to page" control
|
---|
99 | // used by the Book type of toc
|
---|
100 | arg_ainfo.shortname = "gp";
|
---|
101 | arg_ainfo.longname = "go to page";
|
---|
102 | arg_ainfo.multiplechar = true;
|
---|
103 | arg_ainfo.defaultstatus = cgiarginfo::none;
|
---|
104 | arg_ainfo.argdefault = "";
|
---|
105 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
106 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
107 |
|
---|
108 | // in this action "hl" is the "highlighting on/
|
---|
109 | // highlighting off control ("hl" == "2" is a
|
---|
110 | // special case that forces phrase highlighting
|
---|
111 | // to be used even if the query string doesn't
|
---|
112 | // appear to be a phrase)
|
---|
113 | arg_ainfo.shortname = "hl";
|
---|
114 | arg_ainfo.longname = "highlighting on/off";
|
---|
115 | arg_ainfo.multiplechar = false;
|
---|
116 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
117 | arg_ainfo.argdefault = "1";
|
---|
118 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
119 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
120 |
|
---|
121 | // "x" is 0 normally or 1 if page
|
---|
122 | // has been "detached"
|
---|
123 | arg_ainfo.shortname = "x";
|
---|
124 | arg_ainfo.longname = "detached page";
|
---|
125 | arg_ainfo.multiplechar = false;
|
---|
126 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
127 | arg_ainfo.argdefault = "0";
|
---|
128 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
129 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
130 |
|
---|
131 | // f arg is set to 1 if document is to
|
---|
132 | // be displayed in a frame
|
---|
133 | arg_ainfo.shortname = "f";
|
---|
134 | arg_ainfo.longname = "frame";
|
---|
135 | arg_ainfo.multiplechar = false;
|
---|
136 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
137 | arg_ainfo.argdefault = "0";
|
---|
138 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
139 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
140 |
|
---|
141 | // fc arg is "1" if search bar is to be included (i.e. if "fc" == 1
|
---|
142 | // the httpdocument macro will include "&f=1"
|
---|
143 | arg_ainfo.shortname = "fc";
|
---|
144 | arg_ainfo.longname = "include search bar";
|
---|
145 | arg_ainfo.multiplechar = false;
|
---|
146 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
147 | arg_ainfo.argdefault = "1";
|
---|
148 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
149 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
150 |
|
---|
151 | //rd is whether a document will be displayed
|
---|
152 | //with a relevant document list
|
---|
153 | arg_ainfo.shortname = "rd";
|
---|
154 | arg_ainfo.longname = "include relevant documents";
|
---|
155 | arg_ainfo.multiplechar = false;
|
---|
156 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
157 | arg_ainfo.argdefault = "0";
|
---|
158 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
159 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
160 |
|
---|
161 | }
|
---|
162 |
|
---|
163 | documentaction::~documentaction () {
|
---|
164 | }
|
---|
165 |
|
---|
166 | bool documentaction::check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
|
---|
167 | recptprotolistclass * /*protos*/, ostream &logout) {
|
---|
168 |
|
---|
169 | // check gc argument
|
---|
170 | int arg_gc = args.getintarg("gc");
|
---|
171 | if (arg_gc < 0 || arg_gc > 2) {
|
---|
172 | logout << "Warning: \"gc\" argument out of range (" << arg_gc << ")\n";
|
---|
173 | cgiarginfo *gcinfo = argsinfo.getarginfo ("gc");
|
---|
174 | if (gcinfo != NULL) args["gc"] = gcinfo->argdefault;
|
---|
175 | }
|
---|
176 |
|
---|
177 | // check gt argument (may be either 0, 1 or 2)
|
---|
178 | int arg_gt = args.getintarg("gt");
|
---|
179 | if (arg_gt != 0 && arg_gt != 1 && arg_gt != 2) {
|
---|
180 | logout << "Warning: \"gt\" argument out of range (" << arg_gt << ")\n";
|
---|
181 | cgiarginfo *gtinfo = argsinfo.getarginfo ("gt");
|
---|
182 | if (gtinfo != NULL) args["gt"] = gtinfo->argdefault;
|
---|
183 | }
|
---|
184 |
|
---|
185 | // check hl argument
|
---|
186 | int arg_hl = args.getintarg("hl");
|
---|
187 | if (arg_hl < 0 || arg_hl > 2) {
|
---|
188 | logout << "Warning: \"hl\" argument out of range (" << arg_hl << ")\n";
|
---|
189 | cgiarginfo *hlinfo = argsinfo.getarginfo ("hl");
|
---|
190 | if (hlinfo != NULL) args["hl"] = hlinfo->argdefault;
|
---|
191 | }
|
---|
192 |
|
---|
193 | // check x argument
|
---|
194 | int arg_x = args.getintarg("x");
|
---|
195 | if (arg_x != 0 && arg_x != 1) {
|
---|
196 | logout << "Warning: \"x\" argument out of range (" << arg_x << ")\n";
|
---|
197 | cgiarginfo *xinfo = argsinfo.getarginfo ("x");
|
---|
198 | if (xinfo != NULL) args["x"] = xinfo->argdefault;
|
---|
199 | }
|
---|
200 |
|
---|
201 | //checks whether rd arg is valid
|
---|
202 | int arg_rd = args.getintarg("rd");
|
---|
203 | if (arg_rd != 0 && arg_rd != 1) {
|
---|
204 | logout << "Warning: \"rd\" argument out of range (" << arg_rd << ")\n";
|
---|
205 | cgiarginfo *rdinfo = argsinfo.getarginfo ("rd");
|
---|
206 | if (rdinfo != NULL) args["rd"] = rdinfo->argdefault;
|
---|
207 | }
|
---|
208 |
|
---|
209 |
|
---|
210 | return true;
|
---|
211 | }
|
---|
212 |
|
---|
213 | void documentaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
|
---|
214 | response_t &response,text_t &response_data,
|
---|
215 | ostream &logout) {
|
---|
216 |
|
---|
217 | if ((args["il"] == "w") && (!args["d"].empty())) {
|
---|
218 |
|
---|
219 | recptproto* collectproto = protos->getrecptproto (args["c"], logout);
|
---|
220 | if (collectproto != NULL) {
|
---|
221 |
|
---|
222 | text_tset metadata;
|
---|
223 | FilterResponse_t filt_response;
|
---|
224 | text_t top;
|
---|
225 |
|
---|
226 | metadata.insert ("URL");
|
---|
227 |
|
---|
228 | // get metadata for parent document
|
---|
229 | get_top (args["d"], top);
|
---|
230 | if (get_info (top, args["c"], metadata, false, collectproto, filt_response, logout)) {
|
---|
231 | text_t url = filt_response.docInfo[0].metadata["URL"].values[0];
|
---|
232 |
|
---|
233 | response = location;
|
---|
234 | response_data = url;
|
---|
235 | return;
|
---|
236 | } else {
|
---|
237 | // error, no URL
|
---|
238 | logout << "Error: documentaction::get_cgihead_info failed on get_info" << endl;
|
---|
239 | }
|
---|
240 | }
|
---|
241 | }
|
---|
242 | response = content;
|
---|
243 | response_data = "text/html";
|
---|
244 | }
|
---|
245 |
|
---|
246 | // set_widthtspace calculates how wide the spaces in the nav bar should
|
---|
247 | // be and sets the appropriate macro
|
---|
248 | void documentaction::set_spacemacro (displayclass &disp, FilterResponse_t &response) {
|
---|
249 |
|
---|
250 | text_t width;
|
---|
251 | int twidth, swidth, iwidth = 0;
|
---|
252 |
|
---|
253 | int numc = response.docInfo.size();
|
---|
254 | ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
|
---|
255 | ResultDocInfo_tarray::iterator docend = response.docInfo.end();
|
---|
256 |
|
---|
257 | disp.expandstring ("Global", "_pagewidth_", width);
|
---|
258 | twidth = width.getint();
|
---|
259 |
|
---|
260 | disp.expandstring ("query", "_searchwidth_", width);
|
---|
261 | iwidth += width.getint();
|
---|
262 |
|
---|
263 |
|
---|
264 |
|
---|
265 | while (dochere != docend) {
|
---|
266 | const text_t &title = (*dochere).metadata["Title"].values[0];
|
---|
267 |
|
---|
268 | disp.expandstring ("document", "_" + title + "width_", width);
|
---|
269 | if (width == ("_" + title + "width_"))
|
---|
270 | disp.expandstring ("document", "_defaultwidth_", width);
|
---|
271 | iwidth += width.getint();
|
---|
272 | dochere ++;
|
---|
273 | }
|
---|
274 | if ((twidth - iwidth) < numc) swidth = 2;
|
---|
275 | else {
|
---|
276 | swidth = twidth - iwidth;
|
---|
277 | if (numc > 0) swidth = swidth / numc;
|
---|
278 | }
|
---|
279 | disp.setmacro ("widthtspace", "Global", swidth);
|
---|
280 | }
|
---|
281 |
|
---|
282 | // set_navbarmacros sets _navigationbar_ and _httpbrowseXXX_ macros
|
---|
283 | // reponse contains 1 metadata field (Title)
|
---|
284 | void documentaction::set_navbarmacros (displayclass &disp, FilterResponse_t &response,
|
---|
285 | cgiargsclass &args) {
|
---|
286 |
|
---|
287 | text_t topparent;
|
---|
288 | text_t &arg_d = args["d"];
|
---|
289 | text_t navigationbar = "<!-- Navigation Bar -->\n";
|
---|
290 |
|
---|
291 | get_top (args["cl"], topparent);
|
---|
292 | int numc = response.docInfo.size();
|
---|
293 | ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
|
---|
294 | ResultDocInfo_tarray::iterator docend = response.docInfo.end();
|
---|
295 |
|
---|
296 | navigationbar += "<nobr>\n";
|
---|
297 | if (args["a"] == "q") {
|
---|
298 | navigationbar += "_icontabsearchgreen_";
|
---|
299 | } else {
|
---|
300 | navigationbar += "_imagesearch_";
|
---|
301 | }
|
---|
302 |
|
---|
303 |
|
---|
304 | if (numc == 0) navigationbar += "_imagespacer_";
|
---|
305 |
|
---|
306 | while (dochere != docend) {
|
---|
307 | text_t title = (*dochere).metadata["Title"].values[0];
|
---|
308 |
|
---|
309 | bool unknown = false;
|
---|
310 |
|
---|
311 | // test the _XXXwidth_ macro to see if image macros are
|
---|
312 | // defined for this type of classification - if not we'll
|
---|
313 | // just display the text
|
---|
314 | text_t tmpwidth;
|
---|
315 | disp.expandstring ("document", "_" + title + "width_", tmpwidth);
|
---|
316 | if (tmpwidth == ("_" + title + "width_")) unknown = true;
|
---|
317 |
|
---|
318 | // if we're inside a document all the classification buttons should be enabled
|
---|
319 | if (arg_d.empty() && ((*dochere).OID == topparent)) {
|
---|
320 | if (unknown) navigationbar += "_imagespacer_ " + title + " ";
|
---|
321 | else navigationbar += "_imagespacer__icontab" + title + "green_";
|
---|
322 | } else {
|
---|
323 |
|
---|
324 | // set the _httpbrowseXXX_ macro for this classification
|
---|
325 | if (unknown) navigationbar += "_imagespacer_ <a href=\"_httpdocument_&cl=" +
|
---|
326 | (*dochere).OID + "\">" + title + "</a> ";
|
---|
327 | else {
|
---|
328 | navigationbar += "_imagespacer__image" + title + "_";
|
---|
329 | disp.setmacro ("httpbrowse" + title, "Global", "_httpdocument_&cl=" + (*dochere).OID);
|
---|
330 | }
|
---|
331 | }
|
---|
332 | dochere ++;
|
---|
333 | }
|
---|
334 | navigationbar += "\n</nobr>\n";
|
---|
335 | navigationbar += "<!-- End of Navigation Bar -->\n";
|
---|
336 | disp.setmacro ("navigationbar", "Global", navigationbar);
|
---|
337 | }
|
---|
338 |
|
---|
339 | // define all the macros which might be used by other actions
|
---|
340 | // to produce pages.
|
---|
341 | void documentaction::define_external_macros (displayclass &disp, cgiargsclass &args,
|
---|
342 | recptprotolistclass *protos, ostream &logout) {
|
---|
343 |
|
---|
344 | // define_external_macros sets the following macros:
|
---|
345 |
|
---|
346 | // _navigationbar_ this is the navigation bar containing the search button
|
---|
347 | // and any classification buttons - it goes at the top of
|
---|
348 | // most pages. for now we're assuming that there'll always
|
---|
349 | // be a search button - we should probably check that there
|
---|
350 | // is a query action before making this assumption
|
---|
351 |
|
---|
352 | // _httpbrowseXXX_ the http macros for each classification (i.e. if there
|
---|
353 | // are Title and Creator classifications _httpbrowseTitle_
|
---|
354 | // and _httpbrowseCreator_ will be set
|
---|
355 |
|
---|
356 | // _widthtspace_ the width of the spacers between buttons in navigation
|
---|
357 | // bar
|
---|
358 |
|
---|
359 | // _httpdocument_ has '&f=1' added if displaying document inside a frame
|
---|
360 |
|
---|
361 | // _gsdltop_ macro to replace _top targets with
|
---|
362 |
|
---|
363 | // _httppagehome_ overridden home url if html collections have own homepage
|
---|
364 |
|
---|
365 | // must have a valid collection server to continue
|
---|
366 | text_t &collection = args["c"];
|
---|
367 | if (collection.empty()) return;
|
---|
368 | recptproto *collectproto = protos->getrecptproto (collection, logout);
|
---|
369 | if (collectproto == NULL) return;
|
---|
370 |
|
---|
371 | if (recpt == NULL) {
|
---|
372 | logout << "ERROR (documentaction::define_external_macros): This action does not contain\n"
|
---|
373 | << " information about any receptionists. The method set_receptionist was\n"
|
---|
374 | << " probably not called from the module which instantiated this action.\n";
|
---|
375 | return;
|
---|
376 | }
|
---|
377 |
|
---|
378 | outconvertclass text_t2ascii;
|
---|
379 | comerror_t err;
|
---|
380 | InfoFiltersResponse_t filterinfo;
|
---|
381 | FilterResponse_t response;
|
---|
382 | text_tset metadata;
|
---|
383 |
|
---|
384 | // get info on current collection and load up formatinfo
|
---|
385 | // I'd prefer not to do this here as we're getting
|
---|
386 | // collection info every time (and probably also getting
|
---|
387 | // it in other places some of the time) - One day I'll
|
---|
388 | // fix it ... maybe - Stefan.
|
---|
389 | ColInfoResponse_t cinfo;
|
---|
390 |
|
---|
391 | collectproto->get_collectinfo (collection, cinfo, err, logout);
|
---|
392 | load_formatinfo (cinfo.format, args.getintarg("gt"));
|
---|
393 | // ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, collection, logout);
|
---|
394 | // if (cinfo == NULL) {
|
---|
395 | // logout << "ERROR (documentaction::define_external_macros): get_collectinfo_ptr returned NULL\n";
|
---|
396 | // return;
|
---|
397 | // }
|
---|
398 | //load_formatinfo (cinfo->format, args.getintarg("gt"));
|
---|
399 |
|
---|
400 | if (formatinfo.DocumentUseHTML) {
|
---|
401 |
|
---|
402 | // frame stuff
|
---|
403 | if (args["fc"] == "1") {
|
---|
404 | text_t httpdocument;
|
---|
405 | disp.expandstring ("Global", "_httpdocument_", httpdocument);
|
---|
406 | httpdocument += "&f=1";
|
---|
407 | disp.setmacro ("httpdocument", "Global", httpdocument);
|
---|
408 | disp.setmacro ("gsdltop", "Global", "documenttop");
|
---|
409 | formatinfo.DocumentText = "[Text]";
|
---|
410 | }
|
---|
411 | text_tmap::iterator it = cinfo.format.find ("homepage");
|
---|
412 | if (it != cinfo.format.end()) {
|
---|
413 | text_t httppagehome;
|
---|
414 | if (get_link (args, protos, (*it).second, httppagehome, logout))
|
---|
415 | disp.setmacro ("httppagehome", "Global", httppagehome);
|
---|
416 | }
|
---|
417 | }
|
---|
418 |
|
---|
419 | // don't want navigation bar if page is 'detached'
|
---|
420 | if (!args.getintarg("x")) {
|
---|
421 |
|
---|
422 | collectproto->get_filterinfo (collection, filterinfo, err, logout);
|
---|
423 | if (err == noError) {
|
---|
424 | // check that there's a browse filter
|
---|
425 | if (filterinfo.filterNames.find ("BrowseFilter") != filterinfo.filterNames.end()) {
|
---|
426 |
|
---|
427 | metadata.insert ("Title");
|
---|
428 | bool getParents = false;
|
---|
429 | get_children ("", collection, metadata, getParents, collectproto, response, logout);
|
---|
430 |
|
---|
431 | // calculate width of spacers and set _widthtspace_ macro
|
---|
432 | if (args.getintarg("v") == 0) set_spacemacro (disp, response);
|
---|
433 |
|
---|
434 | // set _navigationbar_ macro
|
---|
435 | set_navbarmacros (disp, response, args);
|
---|
436 |
|
---|
437 | }
|
---|
438 | } else {
|
---|
439 | logout << text_t2ascii
|
---|
440 | << "Error (documentaction::define_external_macros()) in call to get_filterinfo() "
|
---|
441 | << get_comerror_string (err);
|
---|
442 | }
|
---|
443 | }
|
---|
444 | }
|
---|
445 |
|
---|
446 | bool documentaction::get_link (cgiargsclass &args, recptprotolistclass *protos,
|
---|
447 | const text_t &inlink, text_t &outlink, ostream &logout) {
|
---|
448 |
|
---|
449 | FilterResponse_t response;
|
---|
450 | text_tset metadata;
|
---|
451 | metadata.insert ("section");
|
---|
452 |
|
---|
453 | // check current collection first
|
---|
454 | recptproto *collectproto = protos->getrecptproto (args["c"], logout);
|
---|
455 |
|
---|
456 | if (get_info (inlink, args["c"], metadata, false, collectproto, response, logout)) {
|
---|
457 | if (!response.docInfo[0].metadata["section"].values[0].empty()) {
|
---|
458 | outlink = "_httpdocument_&d=" + response.docInfo[0].metadata["section"].values[0];
|
---|
459 | return true;
|
---|
460 | }
|
---|
461 | }
|
---|
462 |
|
---|
463 | // check all the other enabled collections
|
---|
464 |
|
---|
465 | if (args["ccs"] == "1" && !args["cc"].empty()) {
|
---|
466 | text_tarray collections;
|
---|
467 | splitchar (args["cc"].begin(), args["cc"].end(), ',', collections);
|
---|
468 |
|
---|
469 | text_tarray::const_iterator col_here = collections.begin();
|
---|
470 | text_tarray::const_iterator col_end = collections.end();
|
---|
471 |
|
---|
472 | while (col_here != col_end) {
|
---|
473 |
|
---|
474 | // don't need to check current collection again
|
---|
475 | if (*col_here == args["c"]) {col_here ++; continue;}
|
---|
476 |
|
---|
477 | collectproto = protos->getrecptproto (*col_here, logout);
|
---|
478 |
|
---|
479 | if (get_info (inlink, *col_here, metadata, false, collectproto, response, logout)) {
|
---|
480 | if (!response.docInfo[0].metadata["section"].values[0].empty()) {
|
---|
481 | outlink = "_httpdocument_&c=" + *col_here + "&d=" +
|
---|
482 | response.docInfo[0].metadata["section"].values[0];
|
---|
483 | return true;
|
---|
484 | }
|
---|
485 | }
|
---|
486 | col_here ++;
|
---|
487 | }
|
---|
488 | }
|
---|
489 | return false;
|
---|
490 | }
|
---|
491 |
|
---|
492 | void documentaction::load_formatinfo (const text_tmap &colformat, int gt) {
|
---|
493 |
|
---|
494 | formatinfo.clear();
|
---|
495 | text_tmap::const_iterator format_here = colformat.begin();
|
---|
496 | text_tmap::const_iterator format_end = colformat.end();
|
---|
497 |
|
---|
498 | while (format_here != format_end) {
|
---|
499 | if (((*format_here).first == "DocumentImages") &&
|
---|
500 | ((*format_here).second == "true"))
|
---|
501 | formatinfo.DocumentImages = true;
|
---|
502 | else if (((*format_here).first == "DocumentTitles") &&
|
---|
503 | ((*format_here).second == "false"))
|
---|
504 | formatinfo.DocumentTitles = false;
|
---|
505 | else if ((*format_here).first == "DocumentHeading")
|
---|
506 | formatinfo.DocumentHeading = (*format_here).second;
|
---|
507 | else if (((*format_here).first == "DocumentContents") &&
|
---|
508 | ((*format_here).second == "false"))
|
---|
509 | formatinfo.DocumentContents = false;
|
---|
510 | else if (((*format_here).first == "DocumentArrowsBottom") &&
|
---|
511 | ((*format_here).second == "false"))
|
---|
512 | formatinfo.DocumentArrowsBottom = false;
|
---|
513 | else if ((*format_here).first == "DocumentButtons")
|
---|
514 | splitchar ((*format_here).second.begin(), (*format_here).second.end(),
|
---|
515 | '|', formatinfo.DocumentButtons);
|
---|
516 | else if ((*format_here).first == "DocumentText")
|
---|
517 | formatinfo.DocumentText = (*format_here).second;
|
---|
518 | else if ((*format_here).first == "RelatedDocuments")
|
---|
519 | formatinfo.RelatedDocuments = (*format_here).second;
|
---|
520 | else if (((*format_here).first == "DocumentUseHTML") &&
|
---|
521 | ((*format_here).second == "true"))
|
---|
522 | formatinfo.DocumentUseHTML = true;
|
---|
523 | else
|
---|
524 | formatinfo.formatstrings[(*format_here).first] = (*format_here).second;
|
---|
525 |
|
---|
526 | format_here ++;
|
---|
527 | }
|
---|
528 |
|
---|
529 | // never want arrows when text is expanded
|
---|
530 | if (gt) formatinfo.DocumentArrowsBottom = false;
|
---|
531 | }
|
---|
532 |
|
---|
533 |
|
---|
534 | // define all the macros which are related to pages generated
|
---|
535 | // by this action. we also load up the formatinfo structure
|
---|
536 | // here (it's used in do_action as well as here)
|
---|
537 | void documentaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
538 | recptprotolistclass *protos, ostream &logout) {
|
---|
539 |
|
---|
540 | // define_internal_macros sets the following macros:
|
---|
541 |
|
---|
542 | // _pagetitle_ the title to be displayed at the top of the browser window
|
---|
543 |
|
---|
544 | // _imagethispage_ the title image to be displayed at top right of page
|
---|
545 |
|
---|
546 | // _navarrows_ this may be overridden to "" when format option
|
---|
547 | // DocumentArrowsBottom is false
|
---|
548 |
|
---|
549 | // _header_ the header macro is overridden if we're not at a top level
|
---|
550 | // classification to remove the title block
|
---|
551 |
|
---|
552 | // _thisOID_ the OID (directory) of the current document - this corresponds
|
---|
553 | // to the archivedir metadata element
|
---|
554 |
|
---|
555 | // must have a valid collection server to continue
|
---|
556 | text_t &collection = args["c"];
|
---|
557 | if (collection.empty()) return;
|
---|
558 | recptproto *collectproto = protos->getrecptproto (collection, logout);
|
---|
559 | if (collectproto == NULL) return;
|
---|
560 |
|
---|
561 | text_tset metadata;
|
---|
562 | FilterResponse_t response;
|
---|
563 | text_t &arg_d = args["d"];
|
---|
564 | text_t &arg_cl = args["cl"];
|
---|
565 |
|
---|
566 | if (!formatinfo.DocumentArrowsBottom)
|
---|
567 | disp.setmacro("navarrows", "document", "");
|
---|
568 |
|
---|
569 | metadata.insert ("Title");
|
---|
570 |
|
---|
571 | bool fulltoc = false;
|
---|
572 |
|
---|
573 | if (args["cl"] != "search") {
|
---|
574 | // see if there's a FullTOC string
|
---|
575 | text_t cl_top, full_toc;
|
---|
576 | get_top (arg_cl, cl_top);
|
---|
577 | if (get_formatstring (cl_top, "FullTOC", formatinfo.formatstrings, full_toc))
|
---|
578 | if (full_toc == "true") fulltoc = true;
|
---|
579 | }
|
---|
580 |
|
---|
581 | if (!arg_d.empty() && !fulltoc) {
|
---|
582 | // we're at document level
|
---|
583 |
|
---|
584 | metadata.insert ("archivedir");
|
---|
585 |
|
---|
586 | comerror_t err;
|
---|
587 | OptionValue_tarray options;
|
---|
588 | // we need to do the query again for the z3950proto
|
---|
589 | if (collectproto->get_protocol_name(err)=="z3950proto") {
|
---|
590 | OptionValue_t opt;
|
---|
591 | opt.name="Term";opt.value=args["q"];options.push_back(opt);
|
---|
592 | opt.name="QueryType";
|
---|
593 | opt.value=(args.getintarg("t")) ? "ranked" : "boolean";
|
---|
594 | options.push_back(opt);
|
---|
595 | opt.name="Index";opt.value=args["h"];options.push_back(opt);
|
---|
596 | }
|
---|
597 |
|
---|
598 | //do not display relation metadata
|
---|
599 | disp.setmacro ("relateddoc", "document", "");
|
---|
600 |
|
---|
601 | //if preferences indicate relevant docs should be collected
|
---|
602 | //and there is no particular format specified then display
|
---|
603 | //this default format.
|
---|
604 | if(args["rd"] == "1" && formatinfo.RelatedDocuments.empty()){
|
---|
605 |
|
---|
606 | text_t relation = ""; //string for displaying relation metadata
|
---|
607 |
|
---|
608 | //call function in formattools.cpp which will return the text of the
|
---|
609 | //related documents in a vertical list. This is the default format.
|
---|
610 | if (get_info (arg_d, collection, metadata, options, false, collectproto, response, logout))
|
---|
611 | relation += get_related_docs(collection, collectproto, response.docInfo[0], logout);
|
---|
612 |
|
---|
613 | //set macro to be the related document string
|
---|
614 | disp.setmacro ("relateddoc", "document", relation);
|
---|
615 | }
|
---|
616 |
|
---|
617 |
|
---|
618 | // get metadata for this document and it's parents
|
---|
619 | if (get_info (arg_d, collection, metadata, options,
|
---|
620 | true, collectproto, response, logout)) {
|
---|
621 |
|
---|
622 | disp.setmacro ("header", "document", "_textheader_");
|
---|
623 |
|
---|
624 | text_tarray pagetitlearray;
|
---|
625 | if (!response.docInfo[0].metadata["Title"].values[0].empty())
|
---|
626 | pagetitlearray.push_back (response.docInfo[0].metadata["Title"].values[0]);
|
---|
627 |
|
---|
628 | if (args["gt"] != "1") {
|
---|
629 | MetadataInfo_t *parenttitle = response.docInfo[0].metadata["Title"].parent;
|
---|
630 | while (parenttitle != NULL) {
|
---|
631 | if (!parenttitle->values[0].empty())
|
---|
632 | pagetitlearray.push_back (parenttitle->values[0]);
|
---|
633 | parenttitle = parenttitle->parent;
|
---|
634 | }
|
---|
635 | }
|
---|
636 | reverse (pagetitlearray.begin(), pagetitlearray.end());
|
---|
637 | text_t pagetitle;
|
---|
638 | joinchar (pagetitlearray, ": ", pagetitle);
|
---|
639 | disp.setmacro ("pagetitle", "document", pagetitle);
|
---|
640 |
|
---|
641 | if (is_top (arg_d))
|
---|
642 | disp.setmacro ("thisOID", "Global", dm_safe(response.docInfo[0].metadata["archivedir"].values[0]));
|
---|
643 | else {
|
---|
644 | MetadataInfo_t *parentad = response.docInfo[0].metadata["archivedir"].parent;
|
---|
645 | text_t thisOID;
|
---|
646 | while (parentad != NULL) {
|
---|
647 | thisOID = parentad->values[0];
|
---|
648 | parentad = parentad->parent;
|
---|
649 | }
|
---|
650 | disp.setmacro ("thisOID", "Global", dm_safe(thisOID));
|
---|
651 | }
|
---|
652 | }
|
---|
653 | } else {
|
---|
654 | if (!arg_cl.empty()) {
|
---|
655 |
|
---|
656 | // get metadata for top level classification
|
---|
657 | text_t classtop;
|
---|
658 | get_top (arg_cl, classtop);
|
---|
659 | metadata.insert ("childtype");
|
---|
660 | metadata.insert ("parameters");
|
---|
661 |
|
---|
662 | if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
|
---|
663 |
|
---|
664 | text_t &title = response.docInfo[0].metadata["Title"].values[0];
|
---|
665 | bool unknown = false;
|
---|
666 |
|
---|
667 | // test the _XXXwidth_ macro to see if image macros are
|
---|
668 | // defined for this type of classification - if not we'll
|
---|
669 | // just display the text
|
---|
670 | text_t tmp;
|
---|
671 | disp.expandstring ("document", "_" + title + "width_", tmp);
|
---|
672 | if (tmp == ("_" + title + "width_")) unknown = true;
|
---|
673 |
|
---|
674 | if (unknown) {
|
---|
675 | disp.setmacro ("pagetitle", "document", title);
|
---|
676 | disp.setmacro ("imagethispage", "document", "<h2>" + title + "</h2>");
|
---|
677 | } else {
|
---|
678 | disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
|
---|
679 | disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
|
---|
680 | }
|
---|
681 |
|
---|
682 | //if the document is not a document from a collection
|
---|
683 | //we must set the macro to be an empty string
|
---|
684 | disp.setmacro ("relateddoc", "document", "");
|
---|
685 |
|
---|
686 | // Add macros specific to the Phind lassifier
|
---|
687 | text_t &childtype = response.docInfo[0].metadata["childtype"].values[0];
|
---|
688 | if (childtype == "Phind") {
|
---|
689 |
|
---|
690 | // First, a macro to display the phind classifier
|
---|
691 | disp.setmacro ("phindclassifier", "document", "_phindapplet_");
|
---|
692 |
|
---|
693 | // Next, macros that control the way the classifier is displayed
|
---|
694 | text_t parameters = response.docInfo[0].metadata["parameters"].values[0];
|
---|
695 |
|
---|
696 | // extract key=value pairs and set as macros
|
---|
697 | text_t::iterator here = parameters.begin();
|
---|
698 | text_t::iterator end = parameters.end();
|
---|
699 | text_t key, value;
|
---|
700 |
|
---|
701 | while (here != end) {
|
---|
702 | // get the next key and value pair
|
---|
703 | here = getdelimitstr (here, end, '=', key);
|
---|
704 | here = getdelimitstr (here, end, ';', value);
|
---|
705 |
|
---|
706 | // store this key=value pair
|
---|
707 | if (!key.empty() && !value.empty()) {
|
---|
708 | disp.setmacro (key, "document", value);
|
---|
709 | }
|
---|
710 | }
|
---|
711 | } // end if (childtype == "Phind")
|
---|
712 | }
|
---|
713 | } // end if (!arg_cl.empty()) {
|
---|
714 | }
|
---|
715 | }
|
---|
716 |
|
---|
717 |
|
---|
718 | bool documentaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
719 | browsermapclass *browsers, displayclass &disp,
|
---|
720 | outconvertclass &outconvert, ostream &textout,
|
---|
721 | ostream &logout) {
|
---|
722 |
|
---|
723 | // must have a valid collection server
|
---|
724 | recptproto *collectproto = protos->getrecptproto (args["c"], logout);
|
---|
725 | if (collectproto == NULL) {
|
---|
726 | logout << "documentaction::do_action called with NULL collectproto\n";
|
---|
727 | textout << outconvert << disp << "_document:header_\n"
|
---|
728 | << "Error: Attempt to get document without setting collection\n"
|
---|
729 | << "_document:footer_\n";
|
---|
730 | } else {
|
---|
731 |
|
---|
732 | text_t OID = args["d"];
|
---|
733 | if (OID.empty()) OID = args["cl"];
|
---|
734 | if (OID.empty()) {
|
---|
735 | textout << outconvert << disp << "Document contains no data_document:footer_\n";
|
---|
736 | return true;
|
---|
737 | }
|
---|
738 |
|
---|
739 |
|
---|
740 | if (formatinfo.DocumentUseHTML && !args["d"].empty()) {
|
---|
741 |
|
---|
742 | if (args["f"] == "1") {
|
---|
743 | textout << outconvert << disp
|
---|
744 | << "<html><head></head>\n"
|
---|
745 | << "<frameset rows=\"68,*\" noresize border=0>\n"
|
---|
746 | << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=p&p=nav\">\n"
|
---|
747 | << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=d&d="
|
---|
748 | << args["d"] << "\">"
|
---|
749 | << "<noframes>\n"
|
---|
750 | << "<p>You must have a frame enabled browser to view this.</p>\n"
|
---|
751 | << "</noframes>\n"
|
---|
752 | << "</frameset>\n"
|
---|
753 | << "</html>\n";
|
---|
754 | } else {
|
---|
755 | output_document (OID, args, collectproto, disp, outconvert, textout, logout);
|
---|
756 | }
|
---|
757 | return true;
|
---|
758 | }
|
---|
759 |
|
---|
760 |
|
---|
761 | textout << outconvert << disp << "_document:header_\n"
|
---|
762 | << "_document:content_\n";
|
---|
763 |
|
---|
764 | // output the table of contents
|
---|
765 | output_toc (args, browsers, formatinfo, collectproto,
|
---|
766 | disp, outconvert, textout, logout);
|
---|
767 |
|
---|
768 | //output the related documents (may be the empty string)
|
---|
769 | //will not output the docs if a format string is specified
|
---|
770 | textout << outconvert << disp << "_document:relateddoc_\n";
|
---|
771 |
|
---|
772 | // output the document text
|
---|
773 | if (!args["d"].empty()) {
|
---|
774 | textout << outconvert << "<p>\n";
|
---|
775 | output_document (OID, args, collectproto, disp, outconvert, textout, logout);
|
---|
776 | }
|
---|
777 |
|
---|
778 | textout << outconvert << disp << "_document:footer_\n";
|
---|
779 | }
|
---|
780 | return true;
|
---|
781 | }
|
---|
782 |
|
---|
783 | void documentaction::output_text (ResultDocInfo_t &docinfo, format_t *formatlistptr,
|
---|
784 | const TermInfo_tarray &terminfo, const text_t &OID,
|
---|
785 | bool highlight, int hastxt, int wanttext,
|
---|
786 | text_t &collection, recptproto *collectproto,
|
---|
787 | displayclass &disp, outconvertclass &outconvert,
|
---|
788 | ostream &textout, ostream &logout,
|
---|
789 | cgiargsclass &args) {
|
---|
790 |
|
---|
791 | DocumentRequest_t docrequest;
|
---|
792 | DocumentResponse_t docresponse;
|
---|
793 | comerror_t err;
|
---|
794 |
|
---|
795 | if (hastxt == 1) {
|
---|
796 |
|
---|
797 | if (wanttext) {
|
---|
798 | // get the text
|
---|
799 | docrequest.OID = OID;
|
---|
800 | collectproto->get_document (collection, docrequest, docresponse, err, logout);
|
---|
801 |
|
---|
802 | // cut down on overhead by not using formattools if we only want the text
|
---|
803 | // (wanttext will equal 2 if we want text and other stuff too)
|
---|
804 | if (wanttext == 1)
|
---|
805 | if (highlight) {
|
---|
806 | highlighttext(docresponse.doc, args, terminfo, disp, outconvert, textout);
|
---|
807 | } else {
|
---|
808 | textout << outconvert << disp << docresponse.doc;
|
---|
809 | }
|
---|
810 | }
|
---|
811 |
|
---|
812 | if (wanttext != 1) {
|
---|
813 | text_t doctext
|
---|
814 | = get_formatted_string (collection, collectproto,
|
---|
815 | docinfo, disp, formatlistptr, docresponse.doc,
|
---|
816 | logout);
|
---|
817 |
|
---|
818 | if (highlight) {
|
---|
819 | highlighttext(doctext, args, terminfo, disp, outconvert, textout);
|
---|
820 | } else {
|
---|
821 | textout << outconvert << disp << doctext;
|
---|
822 | }
|
---|
823 | }
|
---|
824 | }
|
---|
825 | }
|
---|
826 |
|
---|
827 |
|
---|
828 | void documentaction::output_document (const text_t &OID, cgiargsclass &args,
|
---|
829 | recptproto *collectproto, displayclass &disp,
|
---|
830 | outconvertclass &outconvert, ostream &textout,
|
---|
831 | ostream &logout) {
|
---|
832 | FilterResponse_t inforesponse;
|
---|
833 | FilterResponse_t queryresponse;
|
---|
834 | text_tset metadata;
|
---|
835 | bool getParents = false;
|
---|
836 | bool highlight = false;
|
---|
837 | int wanttext = 0;
|
---|
838 | int arg_gt = args.getintarg("gt");
|
---|
839 | text_t &collection = args["c"];
|
---|
840 |
|
---|
841 | // if we have a query string and highlighting is turned on we need
|
---|
842 | // to redo the query to get the terms for highlighting
|
---|
843 | if (!args["q"].empty() && args.getintarg("hl")) {
|
---|
844 | FilterRequest_t request;
|
---|
845 | comerror_t err;
|
---|
846 | request.filterResultOptions = FRmatchTerms;
|
---|
847 | text_t formattedstring = args["q"];
|
---|
848 | format_querystring (formattedstring, args.getintarg("b"));
|
---|
849 | set_queryfilter_options (request, formattedstring, args);
|
---|
850 | collectproto->filter (args["c"], request, queryresponse, err, logout);
|
---|
851 | if (err != noError) {
|
---|
852 | outconvertclass text_t2ascii;
|
---|
853 | logout << text_t2ascii
|
---|
854 | << "documentaction::output_document: call to QueryFilter failed "
|
---|
855 | << "for " << args["c"] << " collection (" << get_comerror_string (err) << ")\n";
|
---|
856 | highlight = false;
|
---|
857 | } else {
|
---|
858 | highlight = true;
|
---|
859 | }
|
---|
860 | }
|
---|
861 |
|
---|
862 |
|
---|
863 | format_t *formatlistptr = new format_t();
|
---|
864 | parse_formatstring (formatinfo.DocumentText, formatlistptr, metadata, getParents);
|
---|
865 |
|
---|
866 | metadata.insert ("hastxt");
|
---|
867 | metadata.insert ("haschildren");
|
---|
868 |
|
---|
869 | if (formatinfo.DocumentText == "[Text]")
|
---|
870 | wanttext = 1;
|
---|
871 | else {
|
---|
872 | char *docformat = formatinfo.DocumentText.getcstr();
|
---|
873 | if (strstr (docformat, "[Text]") != NULL)
|
---|
874 | wanttext = 2;
|
---|
875 | delete docformat;
|
---|
876 | }
|
---|
877 |
|
---|
878 | if (get_info (OID, collection, metadata, getParents, collectproto, inforesponse, logout)) {
|
---|
879 | int hastxt = inforesponse.docInfo[0].metadata["hastxt"].values[0].getint();
|
---|
880 | int haschildren = inforesponse.docInfo[0].metadata["haschildren"].values[0].getint();
|
---|
881 |
|
---|
882 | if (arg_gt == 0) {
|
---|
883 | output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo,
|
---|
884 | OID, highlight, hastxt, wanttext, collection, collectproto,
|
---|
885 | disp, outconvert, textout, logout, args);
|
---|
886 |
|
---|
887 |
|
---|
888 | } else {
|
---|
889 |
|
---|
890 | ResultDocInfo_t thisdocinfo = inforesponse.docInfo[0];
|
---|
891 |
|
---|
892 | // text is to be expanded
|
---|
893 | text_t exOID = OID;
|
---|
894 | if (haschildren != 1) exOID = get_parent (OID);
|
---|
895 | if (exOID.empty()) exOID = OID;
|
---|
896 |
|
---|
897 | // if we're not in a document (i.e. we're in a top level classification)
|
---|
898 | // we need to pass "is_classify = true" to get_contents so that it
|
---|
899 | // doesn't recurse all the way through each document in the classification
|
---|
900 | bool is_classify = false;
|
---|
901 | if (args["d"].empty()) is_classify = true;
|
---|
902 |
|
---|
903 | get_contents (exOID, is_classify, metadata, collection,
|
---|
904 | collectproto, inforesponse, logout);
|
---|
905 |
|
---|
906 | ResultDocInfo_tarray::iterator sechere = inforesponse.docInfo.begin();
|
---|
907 | ResultDocInfo_tarray::iterator secend = inforesponse.docInfo.end();
|
---|
908 |
|
---|
909 | if (arg_gt == 1) {
|
---|
910 | // check if there are more than 10 sections containing text to be expanded -
|
---|
911 | // if there are output warning message - this isn't a great way to do this
|
---|
912 | // since the sections may be very large or very small - one day I'll fix it
|
---|
913 | // -- Stefan.
|
---|
914 | int seccount = 0;
|
---|
915 | while (sechere != secend) {
|
---|
916 | int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
|
---|
917 | if (shastxt == 1) seccount ++;
|
---|
918 | if (seccount > 10) break;
|
---|
919 | sechere ++;
|
---|
920 | }
|
---|
921 | if (seccount > 10) {
|
---|
922 | // more than 10 sections so output warning message and text
|
---|
923 | // for current section only
|
---|
924 | textout << outconvert << disp << "_document:textltwarning_";
|
---|
925 |
|
---|
926 | output_text (thisdocinfo, formatlistptr, queryresponse.termInfo,
|
---|
927 | OID, highlight, hastxt, wanttext, collection,
|
---|
928 | collectproto, disp, outconvert, textout, logout, args);
|
---|
929 |
|
---|
930 | }
|
---|
931 | else arg_gt = 2;
|
---|
932 | }
|
---|
933 |
|
---|
934 | if (arg_gt == 2) {
|
---|
935 | // get the text for each section
|
---|
936 | sechere = inforesponse.docInfo.begin();
|
---|
937 | int count = 0;
|
---|
938 | while (sechere != secend) {
|
---|
939 | textout << outconvert << disp << "\n<p><a name=" << (*sechere).OID << "></a>\n";
|
---|
940 |
|
---|
941 | int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
|
---|
942 |
|
---|
943 | output_text (*sechere, formatlistptr, queryresponse.termInfo,
|
---|
944 | (*sechere).OID, highlight, shastxt, wanttext, collection,
|
---|
945 | collectproto, disp, outconvert, textout, logout, args);
|
---|
946 | count ++;
|
---|
947 | sechere ++;
|
---|
948 | }
|
---|
949 | }
|
---|
950 | }
|
---|
951 | }
|
---|
952 | delete formatlistptr;
|
---|
953 | }
|
---|