source: branches/New_Config_Format-branch/gsdl/src/recpt/documentaction.cpp@ 1279

Last change on this file since 1279 was 1279, checked in by sjboddie, 24 years ago

merged changes to trunk into New_Config_Format branch

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 43.3 KB
Line 
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 * $Id: documentaction.cpp 1279 2000-07-12 22:21:53Z sjboddie $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
30 Revision 1.37.2.3 2000/07/12 22:21:37 sjboddie
31 merged changes to trunk into New_Config_Format branch
32
33
34 Revision 1.39 2000/07/05 21:49:31 sjboddie
35 Receptionist now caches collection information to avoid making multiple
36 get_collectinfo calls to collection server
37
38 Revision 1.37.2.2 2000/06/30 00:46:16 nzdl
39 caught New_Config_Format-branch up with changes to trunk
40
41 Revision 1.38 2000/05/04 05:18:46 sjboddie
42 attempting to get end-user collection building to work under windows
43
44 Revision 1.37.2.1 2000/04/09 23:16:46 sjboddie
45 Added DocumentColumns stuff to New_Config_Format-branch branch
46
47 Revision 1.37 2000/04/07 04:40:44 sjboddie
48 Reverted back to old DocumentHeader, DocumentTitles, DocumentImages etc.
49 from DocumentColumns stuff. I'll move the DocumentColumns stuff to a
50 separate development branch (New_Config_Format-branch) for now. The plan
51 is to redesign the configuration file format a bit and limit the number of
52 distributions floating around that take different configuration formats).
53
54 Revision 1.36 2000/04/03 07:26:28 sjboddie
55 replaced old DocumentIcon and DocumentContents format options
56 with DocumentColumn stuff
57
58 Revision 1.35 2000/03/31 03:04:31 nzdl
59 tidied up some of the browsing code - replaced DocumentImages,
60 DocumentTitles and DocumentHeading with DocumentIcon
61
62 Revision 1.34 2000/02/15 22:53:49 kjm18
63 search history stuff added.
64
65 Revision 1.33 2000/02/13 20:40:05 sjboddie
66 now dm_safe _thisOID_ macro
67
68 Revision 1.32 2000/01/25 22:39:15 sjboddie
69 added DocumentUseHTML - tidied some things up (and messed up some others)
70
71 Revision 1.31 1999/11/13 08:57:00 sjboddie
72 fixed bug in last changes
73
74 Revision 1.30 1999/11/01 21:54:27 sjboddie
75 changes for cross-collection searching - changes to arguments
76 of many functions
77
78 Revision 1.29 1999/10/24 07:23:40 sjboddie
79 added FullTOC option
80
81 Revision 1.28 1999/10/19 03:23:42 davidb
82 Collection building support through web pages
83 and internal and external link handling for collection documents
84
85 Revision 1.27 1999/10/14 23:00:53 sjboddie
86 finished changes to browsing support
87
88 Revision 1.26 1999/10/10 08:14:06 sjboddie
89 - metadata now returns mp rather than array
90 - redesigned browsing support (although it's not finished so
91 won't currently work ;-)
92
93 Revision 1.25 1999/09/17 04:46:05 sjboddie
94 fixed a couple of problems with 'unknown' classifier
95
96 Revision 1.24 1999/09/17 04:00:26 sjboddie
97 tidied up navigation bar to produce a default "unknown" button if
98 it comes across metadata it can't display
99
100 Revision 1.23 1999/09/07 04:56:54 sjboddie
101 added GPL notice
102
103 Revision 1.22 1999/08/20 01:00:22 sjboddie
104 split some of the larger functions up to simplify the creation of
105 collection specific receptionists
106
107 Revision 1.21 1999/08/11 23:28:03 sjboddie
108 -added support for html classifier
109 - removed _random_ macro - now use _blank for detach page
110
111 Revision 1.20 1999/08/10 23:16:39 sjboddie
112 a couple of small changes to get format options DocumentArrowsBottom
113 and DocumentArrowsTop working correctly
114
115 Revision 1.19 1999/08/10 22:40:01 sjboddie
116 added some more format options including the ability to format the
117 document text
118
119 Revision 1.18 1999/08/09 04:25:18 sjboddie
120 moved OID translation stuff from documentaction::define_external_macros
121 to receptionist
122
123 Revision 1.17 1999/08/09 02:13:53 sjboddie
124 fixed small bug in ShowSectionTitles
125
126 Revision 1.16 1999/08/03 03:30:47 sjboddie
127 a few small changes related to new format options
128
129 Revision 1.15 1999/07/30 02:18:49 sjboddie
130 -added collectinfo argument to some functions
131 -caught up with changes to browsetools (allowing nested classifications)
132 -added showtoppage format option
133
134 Revision 1.14 1999/07/21 05:01:09 sjboddie
135 fixed up wrapping of classificationlinks
136
137 Revision 1.13 1999/07/20 02:59:54 sjboddie
138 List and AZList classifications now use format strings
139
140 Revision 1.12 1999/07/16 00:19:01 sjboddie
141 some changes to the way quoted queries are handled
142
143 Revision 1.11 1999/07/07 05:47:41 sjboddie
144 changed around the way browsetools works
145
146 Revision 1.10 1999/06/29 01:46:44 sjboddie
147 now sets a _navigationbar_ macro even if there aren't any
148 classifications (it will just have the 'search' button
149
150 Revision 1.9 1999/06/27 22:05:58 sjboddie
151 now set a _thisOID_ macro for use in displaying images
152
153 Revision 1.8 1999/06/24 05:12:20 sjboddie
154 lots of small changes
155
156 Revision 1.7 1999/06/17 03:06:58 sjboddie
157 got detach button working properly - the close book icon is now disabled
158 when page is detached as the javascript close() function I was using is
159 too unreliable over different browsers
160 note that in my last comment I meant the "cl" arg (not the "c" arg).
161
162 Revision 1.6 1999/06/16 23:53:15 sjboddie
163 tidied a few things up. documentaction::define_external_macros now
164 resets the "c" arg if it's set to something stupid by the .xx suffixes
165
166 Revision 1.5 1999/06/16 03:10:49 sjboddie
167 define_internal_macros() now sets _pagetitle_ macro to document's title
168 (including parents of current document)
169
170 Revision 1.4 1999/06/15 01:55:29 sjboddie
171 - got text highlighting working
172 - got multiple collections working (now outputs error message if an
173 attempt is made to get a document when the "c" arg isn't set.
174
175 Revision 1.3 1999/06/08 04:29:37 sjboddie
176 added argsinfo to the call to check_cgiargs to make it easy to set
177 args to their default if they're found to be screwed up
178
179 Revision 1.2 1999/05/10 03:40:35 sjboddie
180 lots of changes - slowly getting document action sorted out
181
182 Revision 1.1 1999/04/30 01:59:40 sjboddie
183 lots of stuff - getting documentaction working (documentaction replaces
184 old browseaction)
185
186 Revision 1.2 1999/03/29 02:14:27 sjboddie
187
188 More changes to browseaction
189
190 Revision 1.1 1999/03/25 03:09:40 sjboddie
191
192 subjectbrowseaction became browseaction
193
194
195 */
196
197
198#include <string.h>
199#include "documentaction.h"
200#include "browsetools.h"
201#include "OIDtools.h"
202#include "querytools.h"
203#include "unitool.h"
204#include "gsdltools.h"
205
206documentaction::documentaction () {
207 recpt = NULL;
208
209
210 // this action uses cgi variables "a", "d", "cl",
211 // "x", "gc", "gt", "gp", and "hl"
212 cgiarginfo arg_ainfo;
213 arg_ainfo.shortname = "a";
214 arg_ainfo.longname = "action";
215 arg_ainfo.multiplechar = true;
216 arg_ainfo.defaultstatus = cgiarginfo::weak;
217 arg_ainfo.argdefault = "p";
218 arg_ainfo.savedarginfo = cgiarginfo::must;
219 argsinfo.addarginfo (NULL, arg_ainfo);
220
221 arg_ainfo.shortname = "d";
222 arg_ainfo.longname = "document OID";
223 arg_ainfo.multiplechar = true;
224 arg_ainfo.defaultstatus = cgiarginfo::none;
225 arg_ainfo.argdefault = "";
226 arg_ainfo.savedarginfo = cgiarginfo::can;
227 argsinfo.addarginfo (NULL, arg_ainfo);
228
229 // whether or not a document should be retrieved from the
230 // library or the Web.
231 arg_ainfo.shortname = "il";
232 arg_ainfo.longname = "internal link preference";
233 arg_ainfo.multiplechar = false;
234 arg_ainfo.defaultstatus = cgiarginfo::weak;
235 arg_ainfo.argdefault = "l";
236 arg_ainfo.savedarginfo = cgiarginfo::must;
237 argsinfo.addarginfo (NULL, arg_ainfo);
238
239 arg_ainfo.shortname = "cl";
240 arg_ainfo.longname = "classification OID";
241 arg_ainfo.multiplechar = true;
242 arg_ainfo.defaultstatus = cgiarginfo::none;
243 arg_ainfo.argdefault = "";
244 arg_ainfo.savedarginfo = cgiarginfo::can;
245 argsinfo.addarginfo (NULL, arg_ainfo);
246
247 // in this action "gc" controls the expand/contract
248 // contents function
249 arg_ainfo.shortname = "gc";
250 arg_ainfo.longname = "expand contents";
251 arg_ainfo.multiplechar = false;
252 arg_ainfo.defaultstatus = cgiarginfo::weak;
253 arg_ainfo.argdefault = "0";
254 arg_ainfo.savedarginfo = cgiarginfo::can;
255 argsinfo.addarginfo (NULL, arg_ainfo);
256
257 // in this action "gt" controls the expand/contract
258 // text function 0 = not expanded, 1 = expand unless
259 // there are more than 10 sections containing text,
260 // 2 = expand all
261 arg_ainfo.shortname = "gt";
262 arg_ainfo.longname = "expand text";
263 arg_ainfo.multiplechar = false;
264 arg_ainfo.defaultstatus = cgiarginfo::weak;
265 arg_ainfo.argdefault = "0";
266 arg_ainfo.savedarginfo = cgiarginfo::can;
267 argsinfo.addarginfo (NULL, arg_ainfo);
268
269 // in this action "gp" is the "go to page" control
270 // used by the Book type of toc
271 arg_ainfo.shortname = "gp";
272 arg_ainfo.longname = "go to page";
273 arg_ainfo.multiplechar = true;
274 arg_ainfo.defaultstatus = cgiarginfo::none;
275 arg_ainfo.argdefault = "";
276 arg_ainfo.savedarginfo = cgiarginfo::mustnot;
277 argsinfo.addarginfo (NULL, arg_ainfo);
278
279 // in this action "hl" is the "highlighting on/
280 // highlighting off control
281 arg_ainfo.shortname = "hl";
282 arg_ainfo.longname = "highlighting on/off";
283 arg_ainfo.multiplechar = false;
284 arg_ainfo.defaultstatus = cgiarginfo::weak;
285 arg_ainfo.argdefault = "1";
286 arg_ainfo.savedarginfo = cgiarginfo::must;
287 argsinfo.addarginfo (NULL, arg_ainfo);
288
289 // "x" is 0 normally or 1 if page
290 // has been "detached"
291 arg_ainfo.shortname = "x";
292 arg_ainfo.longname = "detached page";
293 arg_ainfo.multiplechar = false;
294 arg_ainfo.defaultstatus = cgiarginfo::weak;
295 arg_ainfo.argdefault = "0";
296 arg_ainfo.savedarginfo = cgiarginfo::must;
297 argsinfo.addarginfo (NULL, arg_ainfo);
298
299 // f arg is set to 1 if document is to
300 // be displayed in a frame
301 arg_ainfo.shortname = "f";
302 arg_ainfo.longname = "frame";
303 arg_ainfo.multiplechar = false;
304 arg_ainfo.defaultstatus = cgiarginfo::weak;
305 arg_ainfo.argdefault = "0";
306 arg_ainfo.savedarginfo = cgiarginfo::mustnot;
307 argsinfo.addarginfo (NULL, arg_ainfo);
308
309 // fc arg is "1" if search bar is to be included (i.e. if "fc" == 1
310 // the httpdocument macro will include "&f=1"
311 arg_ainfo.shortname = "fc";
312 arg_ainfo.longname = "include search bar";
313 arg_ainfo.multiplechar = false;
314 arg_ainfo.defaultstatus = cgiarginfo::weak;
315 arg_ainfo.argdefault = "1";
316 arg_ainfo.savedarginfo = cgiarginfo::must;
317 argsinfo.addarginfo (NULL, arg_ainfo);
318}
319
320documentaction::~documentaction () {
321}
322
323
324// output_controls displays the detach, expand/contract contents,
325// expand/contract text and highlighting/no highlighting buttons
326void documentaction::output_controls (cgiargsclass &args, const text_tarray &ibuttons,
327 recptproto * /*collectproto*/, displayclass &disp,
328 outconvertclass &outconvert, ostream &textout,
329 ostream &/*logout*/) {
330
331 if (args["u"] != "1") {
332
333 FilterResponse_t response;
334 text_tarray metadata;
335 text_tarray buttons;
336
337 text_tarray::const_iterator here = ibuttons.begin();
338 text_tarray::const_iterator end = ibuttons.end();
339
340 while (here != end) {
341
342 if (*here == "Detach")
343 buttons.push_back ("_document:imagedetach_");
344 else if (*here == "Highlight") {
345 if (args["hl"] == "1")
346 buttons.push_back ("_document:imagenohighlight_");
347 else
348 buttons.push_back ("_document:imagehighlight_");
349 } else if (*here == "Expand Contents") {
350 if (args["gc"] == "1")
351 buttons.push_back ("_document:imagecontracttoc_");
352 else
353 buttons.push_back ("_document:imageexpandtoc_");
354 } else if (*here == "Expand Text") {
355 if (args.getintarg("gt"))
356 buttons.push_back ("_document:imagecontracttext_");
357 else
358 buttons.push_back ("_document:imageexpandtext_");
359 }
360 here ++;
361 }
362
363 here = buttons.begin();
364 end = buttons.end();
365 int count = 0;
366 while (here != end) {
367 if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";
368 textout << outconvert << disp << *here;
369 count ++;
370 here ++;
371 }
372 }
373}
374
375void documentaction::output_formatstring (const text_t &OID, const text_t &collection,
376 recptproto *collectproto, const text_t &formatstring,
377 displayclass &disp, outconvertclass &outconvert,
378 ostream &textout, ostream &logout) {
379
380 if (OID.empty()) return;
381
382 text_tset metadata;
383 bool getParents;
384 FilterResponse_t response;
385
386 format_t *formatlistptr = new format_t();
387 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
388
389 if (!get_info (OID, collection, metadata, getParents, collectproto, response, logout))
390 return;
391
392 textout << outconvert << disp << get_formatted_string (response.docInfo[0], formatlistptr);
393}
394
395// output_headerstring outputs a formatstring that may contain the
396// [Buttons] and [TOC] elements. It separates these elements out,
397// calling output_controls and output_toc respectively to process
398// the special elements. Calls output_formatstring to process the
399// remaining bits of formatstring
400void documentaction::output_headerstring (cgiargsclass &args, recptproto *collectproto,
401 const text_t &formatstring, browsermapclass *browsers,
402 displayclass &disp, outconvertclass &outconvert,
403 ostream &textout, ostream &logout) {
404
405 text_t &OID = args["d"];
406 if (OID.empty()) OID = args["cl"];
407 text_t &collection = args["c"];
408
409 text_t::const_iterator here = formatstring.begin();
410 text_t::const_iterator end = formatstring.end();
411
412 text_t currentstring;
413 while (here != end) {
414 if ((*here == '[') && (*(here+1) == 'B') && (*(here+2) == 'u') &&
415 (*(here+3) == 't') && (*(here+4) == 't') && (*(here+5) == 'o') &&
416 (*(here+6) == 'n') && (*(here+7) == 's') && (*(here+8) == ']')) {
417 here += 8;
418 if (!currentstring.empty()) {
419 output_formatstring (OID, collection, collectproto, currentstring,
420 disp, outconvert, textout, logout);
421 currentstring.clear();
422 }
423
424 output_controls (args, formatinfo.DocumentButtons, collectproto,
425 disp, outconvert, textout, logout);
426
427 } else if ((*here == '[') && (*(here+1) == 'T') && (*(here+2) == 'O') &&
428 (*(here+3) == 'C') && (*(here+4) == ']')) {
429 here += 4;
430 if (!currentstring.empty()) {
431 output_formatstring (OID, collection, collectproto, currentstring,
432 disp, outconvert, textout, logout);
433 currentstring.clear();
434 }
435
436 output_toc (args, browsers, formatinfo.formatstrings, collectproto,
437 disp, outconvert, textout, logout);
438
439 } else {
440 currentstring.push_back (*here);
441 }
442
443 here ++;
444 }
445
446 if (!currentstring.empty())
447 output_formatstring (OID, collection, collectproto, currentstring,
448 disp, outconvert, textout, logout);
449}
450
451bool documentaction::check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
452 ostream &logout) {
453
454 // check gc argument
455 int arg_gc = args.getintarg("gc");
456 if (arg_gc != 0 && arg_gc != 1) {
457 logout << "Warning: \"gc\" argument out of range (" << arg_gc << ")\n";
458 cgiarginfo *gcinfo = argsinfo.getarginfo ("gc");
459 if (gcinfo != NULL) args["gc"] = gcinfo->argdefault;
460 }
461
462 // check gt argument (may be either 0, 1 or 2)
463 int arg_gt = args.getintarg("gt");
464 if (arg_gt != 0 && arg_gt != 1 && arg_gt != 2) {
465 logout << "Warning: \"gt\" argument out of range (" << arg_gt << ")\n";
466 cgiarginfo *gtinfo = argsinfo.getarginfo ("gt");
467 if (gtinfo != NULL) args["gt"] = gtinfo->argdefault;
468 }
469
470 // check hl argument
471 int arg_hl = args.getintarg("hl");
472 if (arg_hl != 0 && arg_hl != 1) {
473 logout << "Warning: \"hl\" argument out of range (" << arg_hl << ")\n";
474 cgiarginfo *hlinfo = argsinfo.getarginfo ("hl");
475 if (hlinfo != NULL) args["hl"] = hlinfo->argdefault;
476 }
477
478 // check x argument
479 int arg_x = args.getintarg("x");
480 if (arg_x != 0 && arg_x != 1) {
481 logout << "Warning: \"x\" argument out of range (" << arg_x << ")\n";
482 cgiarginfo *xinfo = argsinfo.getarginfo ("x");
483 if (xinfo != NULL) args["x"] = xinfo->argdefault;
484 }
485
486 return true;
487}
488
489void documentaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
490 response_t &response,text_t &response_data,
491 ostream &logout) {
492
493 if ((args["il"] == "w") && (!args["d"].empty())) {
494
495 recptproto* collectproto = protos->getrecptproto (args["c"], logout);
496 if (collectproto != NULL) {
497
498 text_tset metadata;
499 FilterResponse_t filt_response;
500 text_t top;
501
502 metadata.insert ("URL");
503
504 // get metadata for parent document
505 get_top (args["d"], top);
506 if (get_info (top, args["c"], metadata, false, collectproto, filt_response, logout)) {
507 text_t url = filt_response.docInfo[0].metadata["URL"].values[0];
508
509 response = location;
510 response_data = url;
511 return;
512 } else {
513 // error, no URL
514 logout << "Error: documentaction::get_cgihead_info failed on get_info" << endl;
515 }
516 }
517 }
518 response = content;
519 response_data = "text/html";
520}
521
522// set_widthtspace calculates how wide the spaces in the nav bar should
523// be and sets the appropriate macro
524void documentaction::set_spacemacro (displayclass &disp, FilterResponse_t &response) {
525
526 text_t width;
527 int twidth, swidth, iwidth = 0;
528
529 int numc = response.docInfo.size();
530 ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
531 ResultDocInfo_tarray::iterator docend = response.docInfo.end();
532
533 disp.expandstring ("Global", "_pagewidth_", width);
534 twidth = width.getint();
535
536 disp.expandstring ("query", "_searchwidth_", width);
537 iwidth += width.getint();
538
539
540
541 while (dochere != docend) {
542 const text_t &title = (*dochere).metadata["Title"].values[0];
543
544 disp.expandstring ("document", "_" + title + "width_", width);
545 if (width == ("_" + title + "width_"))
546 disp.expandstring ("document", "_defaultwidth_", width);
547 iwidth += width.getint();
548 dochere ++;
549 }
550 if ((twidth - iwidth) < numc) swidth = 2;
551 else {
552 swidth = twidth - iwidth;
553 if (numc > 0) swidth = swidth / numc;
554 }
555 disp.setmacro ("widthtspace", "Global", swidth);
556}
557
558// set_navbarmacros sets _navigationbar_, _javaimagesnavbar_ and _httpbrowseXXX_ macros
559// reponse contains 1 metadata field (Title)
560void documentaction::set_navbarmacros (displayclass &disp, FilterResponse_t &response,
561 cgiargsclass &args) {
562
563 text_t javaimagesnavbar, topparent;
564 text_t &arg_d = args["d"];
565 text_t navigationbar = "<!-- Navigation Bar -->\n";
566
567 get_top (args["cl"], topparent);
568 int numc = response.docInfo.size();
569 ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
570 ResultDocInfo_tarray::iterator docend = response.docInfo.end();
571
572 navigationbar += "<nobr>\n";
573 if (args["a"] == "q") {
574 navigationbar += "_icontabsearchgreen_";
575 } else {
576 navigationbar += "_imagesearch_";
577 javaimagesnavbar = "_javasearch_";
578 }
579
580
581 if (numc == 0) navigationbar += "_imagespacer_";
582
583 while (dochere != docend) {
584 text_t title = (*dochere).metadata["Title"].values[0];
585
586 bool unknown = false;
587
588 // test the _XXXwidth_ macro to see if image macros are
589 // defined for this type of classification - if not we'll
590 // just display the text
591 text_t tmpwidth;
592 disp.expandstring ("document", "_" + title + "width_", tmpwidth);
593 if (tmpwidth == ("_" + title + "width_")) unknown = true;
594
595 // if we're inside a document all the classification buttons should be enabled
596 if (arg_d.empty() && ((*dochere).OID == topparent)) {
597 if (unknown) navigationbar += "_imagespacer_&nbsp;" + title + "&nbsp;";
598 else navigationbar += "_imagespacer__icontab" + title + "green_";
599 } else {
600
601 // set the _httpbrowseXXX_ macro for this classification
602 if (unknown) navigationbar += "_imagespacer_&nbsp;<a href=\"_httpdocument_&cl=" +
603 (*dochere).OID + "\">" + title + "</a>&nbsp;";
604 else {
605 navigationbar += "_imagespacer__image" + title + "_";
606 disp.setmacro ("httpbrowse" + title, "Global", "_httpdocument_&cl=" + (*dochere).OID);
607 }
608 }
609 if (!unknown) javaimagesnavbar += "_java" + title + "_";
610 dochere ++;
611 }
612 navigationbar += "\n</nobr>\n";
613 navigationbar += "<!-- End of Navigation Bar -->\n";
614 disp.setmacro ("navigationbar", "Global", navigationbar);
615 if (args.getintarg("v") == 0)
616 disp.setmacro ("javaimagesnavbar", "Global", javaimagesnavbar);
617}
618
619// define all the macros which might be used by other actions
620// to produce pages.
621void documentaction::define_external_macros (displayclass &disp, cgiargsclass &args,
622 recptprotolistclass *protos, ostream &logout) {
623
624 // define_external_macros sets the following macros:
625
626 // _navigationbar_ this is the navigation bar containing the search button
627 // and any classification buttons - it goes at the top of
628 // most pages. for now we're assuming that there'll always
629 // be a search button - we should probably check that there
630 // is a query action before making this assumption
631
632 // _httpbrowseXXX_ the http macros for each classification (i.e. if there
633 // are Title and Creator classifications _httpbrowseTitle_
634 // and _httpbrowseCreator_ will be set
635
636 // _javaimagesnavbar_ this is the javascript code to shove in to make the
637 // flashy images used by _navigationbar_ work
638
639 // _widthtspace_ the width of the spacers between buttons in navigation
640 // bar
641
642 // _httpdocument_ has '&f=1' added if displaying document inside a frame
643
644 // _gsdltop_ macro to replace _top targets with
645
646 // _httppagehome_ overridden home url if html collections have own homepage
647
648 // must have a valid collection server to continue
649 text_t &collection = args["c"];
650 if (collection.empty()) return;
651 recptproto *collectproto = protos->getrecptproto (collection, logout);
652 if (collectproto == NULL) return;
653
654 if (recpt == NULL) {
655 logout << "ERROR (documentaction::define_external_macros): This action does not contain\n"
656 << " information about any receptionists. The method set_receptionist was\n"
657 << " probably not called from the module which instantiated this action.\n";
658 return;
659 }
660
661 outconvertclass text_t2ascii;
662 comerror_t err;
663 InfoFiltersResponse_t filterinfo;
664 FilterResponse_t response;
665 text_tset metadata;
666
667 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, collection, logout);
668 if (cinfo == NULL) {
669 logout << "ERROR (documentaction::define_external_macros): get_collectinfo_ptr returned NULL\n";
670 return;
671 }
672 load_formatinfo (cinfo->format, args.getintarg("gt"));
673
674 if (formatinfo.DocumentUseHTML) {
675
676 // frame stuff
677 if (args["fc"] == "1") {
678 text_t httpdocument;
679 disp.expandstring ("Global", "_httpdocument_", httpdocument);
680 httpdocument += "&f=1";
681 disp.setmacro ("httpdocument", "Global", httpdocument);
682 disp.setmacro ("gsdltop", "Global", "documenttop");
683 }
684 text_tmap::iterator it = cinfo->format.find ("homepage");
685 if (it != cinfo->format.end()) {
686 text_t httppagehome;
687 if (get_link (args, protos, (*it).second, httppagehome, logout))
688 disp.setmacro ("httppagehome", "Global", httppagehome);
689 }
690 }
691
692 // don't want navigation bar if page is 'detached'
693 if (!args.getintarg("x")) {
694
695 collectproto->get_filterinfo (collection, filterinfo, err, logout);
696 if (err == noError) {
697 // check that there's a browse filter
698 if (filterinfo.filterNames.find ("BrowseFilter") != filterinfo.filterNames.end()) {
699
700 metadata.insert ("Title");
701 bool getParents = false;
702 get_children ("", collection, metadata, getParents, collectproto, response, logout);
703
704 // calculate width of spacers and set _widthtspace_ macro
705 if (args.getintarg("v") == 0) set_spacemacro (disp, response);
706
707 // set _navigationbar_ and _javaimagesnavbar_ macros
708 set_navbarmacros (disp, response, args);
709
710 }
711 } else {
712 logout << text_t2ascii
713 << "Error (documentaction::define_external_macros()) in call to get_filterinfo() "
714 << get_comerror_string (err);
715 }
716 }
717}
718
719bool documentaction::get_link (cgiargsclass &args, recptprotolistclass *protos,
720 const text_t &inlink, text_t &outlink, ostream &logout) {
721
722 FilterResponse_t response;
723 text_tset metadata;
724 metadata.insert ("section");
725
726 // check current collection first
727 recptproto *collectproto = protos->getrecptproto (args["c"], logout);
728
729 if (get_info (inlink, args["c"], metadata, false, collectproto, response, logout)) {
730 if (!response.docInfo[0].metadata["section"].values[0].empty()) {
731 outlink = "_httpdocument_&d=" + response.docInfo[0].metadata["section"].values[0];
732 return true;
733 }
734 }
735
736 // check all the other enabled collections
737
738 if (args["ccs"] == "1" && !args["cc"].empty()) {
739 text_tarray collections;
740 splitchar (args["cc"].begin(), args["cc"].end(), ',', collections);
741
742 text_tarray::const_iterator col_here = collections.begin();
743 text_tarray::const_iterator col_end = collections.end();
744
745 while (col_here != col_end) {
746
747 // don't need to check current collection again
748 if (*col_here == args["c"]) {col_here ++; continue;}
749
750 collectproto = protos->getrecptproto (*col_here, logout);
751
752 if (get_info (inlink, *col_here, metadata, false, collectproto, response, logout)) {
753 if (!response.docInfo[0].metadata["section"].values[0].empty()) {
754 outlink = "_httpdocument_&c=" + *col_here + "&d=" +
755 response.docInfo[0].metadata["section"].values[0];
756 return true;
757 }
758 }
759 col_here ++;
760 }
761 }
762 return false;
763}
764
765void documentaction::load_formatinfo (const text_tmap &colformat, int gt) {
766
767 formatinfo.clear();
768 text_tmap::const_iterator format_here = colformat.begin();
769 text_tmap::const_iterator format_end = colformat.end();
770
771 while (format_here != format_end) {
772 if ((*format_here).first == "DocumentColumns")
773 formatinfo.DocumentColumns = (*format_here).second;
774 else if ((*format_here).first == "DocumentColumnsTotalWidth")
775 formatinfo.DocumentColumnsTotalWidth = (*format_here).second;
776 else if ((*format_here).first == "DocumentColumnLeft")
777 formatinfo.DocumentColumnLeft = (*format_here).second;
778 else if ((*format_here).first == "DocumentColumnLeftWidth")
779 formatinfo.DocumentColumnLeftWidth = (*format_here).second;
780 else if ((*format_here).first == "DocumentColumnRight")
781 formatinfo.DocumentColumnRight = (*format_here).second;
782 else if (((*format_here).first == "DocumentArrowsBottom") &&
783 ((*format_here).second == "false"))
784 formatinfo.DocumentArrowsBottom = false;
785 else if ((*format_here).first == "DocumentButtons")
786 splitchar ((*format_here).second.begin(), (*format_here).second.end(),
787 '|', formatinfo.DocumentButtons);
788 else if ((*format_here).first == "DocumentText")
789 formatinfo.DocumentText = (*format_here).second;
790 else if (((*format_here).first == "DocumentUseHTML") &&
791 ((*format_here).second == "true"))
792 formatinfo.DocumentUseHTML = true;
793 else
794 formatinfo.formatstrings[(*format_here).first] = (*format_here).second;
795
796 format_here ++;
797 }
798
799 // never want arrows when text is expanded
800 if (gt) formatinfo.DocumentArrowsBottom = false;
801}
802
803void documentaction::set_java_macros (cgiargsclass &args, displayclass &disp) {
804
805 text_t javaimagescontent = "_javaextras_";
806
807 int arg_gt = args.getintarg("gt");
808 int arg_gc = args.getintarg("gc");
809 int arg_hl = args.getintarg("hl");
810
811 text_tarray::const_iterator button_here = formatinfo.DocumentButtons.begin();
812 text_tarray::const_iterator button_end = formatinfo.DocumentButtons.end();
813
814 while (button_here != button_end) {
815 if (*button_here == "Detach")
816 javaimagescontent += "_javadetach_";
817 else if (*button_here == "Expand Text") {
818 if (arg_gt == 1)
819 javaimagescontent += "_javacontracttext__javacontinue_";
820 else if (arg_gt == 2)
821 javaimagescontent += "_javacontracttext_";
822 else
823 javaimagescontent += "_javaexpandtext_";
824 } else if (*button_here == "Expand Contents") {
825 if (arg_gc == 1)
826 javaimagescontent += "_javacontractcontents_";
827 else
828 javaimagescontent += "_javaexpandcontents_";
829 } else if (*button_here == "Highlight") {
830 if (arg_hl == 1)
831 javaimagescontent += "_javanohighlighting_";
832 else
833 javaimagescontent += "_javahighlighting_";
834 }
835 button_here ++;
836 }
837 disp.setmacro ("javaimagescontent", "document", javaimagescontent);
838}
839
840
841// define all the macros which are related to pages generated
842// by this action. we also load up the formatinfo structure
843// here (it's used in do_action as well as here)
844void documentaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
845 recptprotolistclass *protos, ostream &logout) {
846
847 // define_internal_macros sets the following macros:
848
849 // _pagetitle_ the title to be displayed at the top of the browser window
850
851 // _imagethispage_ the title image to be displayed at top right of page
852
853 // _navarrows_ this may be overridden to "" when format option
854 // DocumentArrowsBottom is false
855
856 // _header_ the header macro is overridden if we're not at a top level
857 // classification to remove the title block
858
859 // _javaimagescontent_ this is the javascript code to shove in to make the
860 // flashy buttons work
861
862 // _thisOID_ the OID (directory) of the current document - this corresponds
863 // to the archivedir metadata element
864
865 // must have a valid collection server to continue
866 text_t &collection = args["c"];
867 if (collection.empty()) return;
868 recptproto *collectproto = protos->getrecptproto (collection, logout);
869 if (collectproto == NULL) return;
870
871 text_tset metadata;
872 FilterResponse_t response;
873 text_t &arg_d = args["d"];
874 text_t &arg_cl = args["cl"];
875
876 if (!formatinfo.DocumentArrowsBottom)
877 disp.setmacro("navarrows", "document", "");
878
879 metadata.insert ("Title");
880
881 bool fulltoc = false;
882
883 if (args["cl"] != "search") {
884 // see if there's a FullTOC string
885 text_t cl_top, full_toc;
886 get_top (arg_cl, cl_top);
887 if (get_formatstring (cl_top, "FullTOC", formatinfo.formatstrings, full_toc))
888 if (full_toc == "true") fulltoc = true;
889 }
890
891 if (!arg_d.empty() && !fulltoc) {
892 // we're at document level
893
894 metadata.insert ("archivedir");
895
896 // get metadata for this document and it's parents
897 if (get_info (arg_d, collection, metadata, true, collectproto, response, logout)) {
898 disp.setmacro ("header", "document", "_textheader_");
899
900 text_tarray pagetitlearray;
901 if (!response.docInfo[0].metadata["Title"].values[0].empty())
902 pagetitlearray.push_back (response.docInfo[0].metadata["Title"].values[0]);
903 if (args["gt"] != "1") {
904 MetadataInfo_t *parenttitle = response.docInfo[0].metadata["Title"].parent;
905 while (parenttitle != NULL) {
906 if (!parenttitle->values[0].empty())
907 pagetitlearray.push_back (parenttitle->values[0]);
908 parenttitle = parenttitle->parent;
909 }
910 }
911 reverse (pagetitlearray.begin(), pagetitlearray.end());
912 text_t pagetitle;
913 joinchar (pagetitlearray, ": ", pagetitle);
914 disp.setmacro ("pagetitle", "document", pagetitle);
915
916 if (is_top (arg_d))
917 disp.setmacro ("thisOID", "Global", dm_safe(response.docInfo[0].metadata["archivedir"].values[0]));
918 else {
919 MetadataInfo_t *parentad = response.docInfo[0].metadata["archivedir"].parent;
920 text_t thisOID;
921 while (parentad != NULL) {
922 thisOID = parentad->values[0];
923 parentad = parentad->parent;
924 }
925 disp.setmacro ("thisOID", "Global", dm_safe(thisOID));
926 }
927
928 if (args["u"] != "1")
929 set_java_macros (args, disp);
930
931 }
932 } else {
933 if (!arg_cl.empty()) {
934
935 // get metadata for top level classification
936 text_t classtop;
937 get_top (arg_cl, classtop);
938 if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
939
940 text_t &title = response.docInfo[0].metadata["Title"].values[0];
941 bool unknown = false;
942
943 // test the _XXXwidth_ macro to see if image macros are
944 // defined for this type of classification - if not we'll
945 // just display the text
946 text_t tmp;
947 disp.expandstring ("document", "_" + title + "width_", tmp);
948 if (tmp == ("_" + title + "width_")) unknown = true;
949
950 if (unknown) {
951 disp.setmacro ("pagetitle", "document", title);
952 disp.setmacro ("imagethispage", "document", "<h2>" + title + "</h2>");
953 } else {
954 disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
955 disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
956 }
957 }
958 }
959 }
960}
961
962
963bool documentaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
964 browsermapclass *browsers, displayclass &disp,
965 outconvertclass &outconvert, ostream &textout,
966 ostream &logout) {
967
968
969 // must have a valid collection server
970 recptproto *collectproto = protos->getrecptproto (args["c"], logout);
971 if (collectproto == NULL) {
972 logout << "documentaction::do_action called with NULL collectproto\n";
973 textout << outconvert << disp << "_document:header_\n"
974 << "Error: Attempt to get document without setting collection\n"
975 << "_document:footer_\n";
976 } else {
977
978 text_t OID = args["d"];
979 if (OID.empty()) OID = args["cl"];
980 if (OID.empty()) {
981 textout << outconvert << disp << "Document contains no data_document:footer_\n";
982 return true;
983 }
984
985 if (formatinfo.DocumentUseHTML) {
986
987 if (!args["d"].empty()) {
988 if (args["f"] == "1") {
989 textout << outconvert << disp
990 << "<html><head></head>\n"
991 << "<frameset rows=\"68,*\" noresize border=0>\n"
992 << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=p&p=nav\">\n"
993 << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=d&d="
994 << args["d"] << "\">"
995 << "<noframes>\n"
996 << "<p>You must have a frame enabled browser to view this.</p>\n"
997 << "</noframes>\n"
998 << "</frameset>\n"
999 << "</html>\n";
1000 } else {
1001 output_document (OID, args, collectproto, disp, outconvert, textout, logout);
1002 }
1003 return true;
1004 }
1005 }
1006
1007 textout << outconvert << disp << "_document:header_\n"
1008 << "_document:content_\n";
1009
1010 // currently only display header information at document level,
1011 // this should probably be changed to handle stuff like CL1Columns
1012 if (!args["d"].empty()) {
1013 textout << outconvert << disp
1014 << "<p><center><table width=_pagewidth_><tr>\n"
1015 << "<td valign=top";
1016 if (formatinfo.DocumentColumns == "2") {
1017 textout << outconvert << disp
1018 << " width=" << formatinfo.DocumentColumnLeftWidth << ">\n";
1019 output_headerstring (args, collectproto, formatinfo.DocumentColumnLeft,
1020 browsers, disp, outconvert, textout, logout);
1021 textout << "\n</td><td valign=top>\n";
1022 output_headerstring (args, collectproto, formatinfo.DocumentColumnRight,
1023 browsers, disp, outconvert, textout, logout);
1024 } else {
1025 textout << " width=100%>\n";
1026 output_headerstring (args, collectproto, formatinfo.DocumentColumnLeft,
1027 browsers, disp, outconvert, textout, logout);
1028 }
1029 textout << "\n</td></tr></table></center>\n";
1030 } else {
1031 // classification level
1032 output_toc (args, browsers, formatinfo.formatstrings, collectproto,
1033 disp, outconvert, textout, logout);
1034 }
1035
1036 // output the document text
1037 textout << "<p>\n";
1038 output_document (OID, args, collectproto, disp, outconvert, textout, logout);
1039
1040 textout << outconvert << disp << "_document:footer_\n";
1041 }
1042 return true;
1043}
1044
1045void documentaction::output_text (ResultDocInfo_t &docinfo, format_t *formatlistptr,
1046 const TermInfo_tarray &terminfo, const text_t &OID,
1047 bool highlight, int hastxt, int wanttext,
1048 text_t &collection, recptproto *collectproto,
1049 displayclass &disp, outconvertclass &outconvert,
1050 ostream &textout, ostream &logout) {
1051
1052 DocumentRequest_t docrequest;
1053 DocumentResponse_t docresponse;
1054 comerror_t err;
1055
1056 if (hastxt == 1) {
1057
1058 if (wanttext) {
1059 // get the text
1060 docrequest.OID = OID;
1061 collectproto->get_document (collection, docrequest, docresponse, err, logout);
1062
1063 // cut down on overhead by not using formattools if we only want the text
1064 // (wanttext will equal 2 if we want text and other stuff too)
1065 if (wanttext == 1)
1066 if (highlight)
1067 highlighttext(docresponse.doc, terminfo, disp, outconvert, textout, logout);
1068 else
1069 textout << outconvert << disp << docresponse.doc;
1070 }
1071
1072 if (wanttext != 1) {
1073 text_t doctext = get_formatted_string (docinfo, formatlistptr, docresponse.doc);
1074
1075 if (highlight)
1076 highlighttext(doctext, terminfo, disp, outconvert, textout, logout);
1077 else
1078 textout << outconvert << disp << doctext;
1079 }
1080 }
1081}
1082
1083
1084void documentaction::output_document (const text_t &OID, cgiargsclass &args,
1085 recptproto *collectproto, displayclass &disp,
1086 outconvertclass &outconvert, ostream &textout,
1087 ostream &logout) {
1088 FilterResponse_t inforesponse;
1089 FilterResponse_t queryresponse;
1090 text_tset metadata;
1091 bool getParents = false;
1092 bool highlight = false;
1093 int wanttext = 0;
1094 int arg_gt = args.getintarg("gt");
1095 text_t &collection = args["c"];
1096
1097 // if we have a query string and highlighting is turned on we need
1098 // to redo the query to get the terms for highlighting
1099 if (!args["q"].empty() && args.getintarg("hl")) {
1100 FilterRequest_t request;
1101 comerror_t err;
1102 request.filterResultOptions = FRmatchTerms;
1103 text_t formattedstring = args["q"];
1104 format_querystring (formattedstring, args.getintarg("b"));
1105 set_queryfilter_options (request, formattedstring, args);
1106 collectproto->filter (args["c"], request, queryresponse, err, logout);
1107 if (err != noError) {
1108 outconvertclass text_t2ascii;
1109 logout << text_t2ascii
1110 << "documentaction::output_document: call to QueryFilter failed "
1111 << "for " << args["c"] << " collection (" << get_comerror_string (err) << ")\n";
1112 highlight = false;
1113 } else {
1114 highlight = true;
1115 }
1116 }
1117
1118 format_t *formatlistptr = new format_t();
1119 parse_formatstring (formatinfo.DocumentText, formatlistptr, metadata, getParents);
1120
1121 metadata.insert ("hastxt");
1122 metadata.insert ("haschildren");
1123
1124 if (formatinfo.DocumentText == "[Text]")
1125 wanttext = 1;
1126 else {
1127 char *docformat = formatinfo.DocumentText.getcstr();
1128 if (strstr (docformat, "[Text]") != NULL)
1129 wanttext = 2;
1130 delete docformat;
1131 }
1132
1133 if (get_info (OID, collection, metadata, getParents, collectproto, inforesponse, logout)) {
1134 int hastxt = inforesponse.docInfo[0].metadata["hastxt"].values[0].getint();
1135 int haschildren = inforesponse.docInfo[0].metadata["haschildren"].values[0].getint();
1136
1137 if (arg_gt == 0) {
1138 output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo,
1139 OID, highlight, hastxt, wanttext, collection, collectproto,
1140 disp, outconvert, textout, logout);
1141
1142
1143 } else {
1144
1145 ResultDocInfo_t thisdocinfo = inforesponse.docInfo[0];
1146
1147 // text is to be expanded
1148 text_t exOID = OID;
1149 if (haschildren != 1) exOID = get_parent (OID);
1150 if (exOID.empty()) exOID = OID;
1151
1152 // if we're not in a document (i.e. we're in a top level classification)
1153 // we need to pass "is_classify = true" to get_contents so that it
1154 // doesn't recurse all the way through each document in the classification
1155 bool is_classify = false;
1156 if (args["d"].empty()) is_classify = true;
1157
1158 get_contents (exOID, is_classify, metadata, collection,
1159 collectproto, inforesponse, logout);
1160
1161 ResultDocInfo_tarray::iterator sechere = inforesponse.docInfo.begin();
1162 ResultDocInfo_tarray::iterator secend = inforesponse.docInfo.end();
1163
1164 if (arg_gt == 1) {
1165 // check if there are more than 10 sections containing text to be expanded -
1166 // if there are output warning message - this isn't a great way to do this
1167 // since the sections may be very large or very small - one day I'll fix it
1168 // -- Stefan.
1169 int seccount = 0;
1170 while (sechere != secend) {
1171 int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
1172 if (shastxt == 1) seccount ++;
1173 if (seccount > 10) break;
1174 sechere ++;
1175 }
1176 if (seccount > 10) {
1177 // more than 10 sections so output warning message and text
1178 // for current section only
1179 textout << outconvert << disp << "_document:textltwarning_";
1180
1181 output_text (thisdocinfo, formatlistptr, queryresponse.termInfo,
1182 OID, highlight, hastxt, wanttext, collection,
1183 collectproto, disp, outconvert, textout, logout);
1184
1185 }
1186 else arg_gt = 2;
1187 }
1188
1189 if (arg_gt == 2) {
1190 // get the text for each section
1191 sechere = inforesponse.docInfo.begin();
1192 int count = 0;
1193 while (sechere != secend) {
1194 textout << outconvert << disp << "\n<p><a name=" << count << "></a>\n";
1195
1196 int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
1197
1198 output_text (*sechere, formatlistptr, queryresponse.termInfo,
1199 (*sechere).OID, highlight, shastxt, wanttext, collection,
1200 collectproto, disp, outconvert, textout, logout);
1201 count ++;
1202 sechere ++;
1203 }
1204 }
1205 }
1206 }
1207 delete formatlistptr;
1208}
1209
1210// highlighttext highlights query terms in text string and outputs the resulting text string
1211void documentaction::highlighttext(text_t &text, const TermInfo_tarray &terms,
1212 displayclass &disp, outconvertclass &outconvert,
1213 ostream &textout, ostream &/*logout*/) {
1214
1215 text_tmap allterms;
1216 text_tmap::const_iterator it;
1217
1218 // first load all the term variations into a map
1219 TermInfo_tarray::const_iterator this_term = terms.begin();
1220 TermInfo_tarray::const_iterator last_term = terms.end();
1221 while (this_term != last_term) {
1222 text_tarray::const_iterator this_var = (*this_term).matchTerms.begin();
1223 text_tarray::const_iterator last_var = (*this_term).matchTerms.end();
1224 while (this_var != last_var) {
1225 allterms[*this_var] = 1;
1226 this_var ++;
1227 }
1228 this_term ++;
1229 }
1230
1231 // get the text to start and end a hightlight
1232 text_t starthighlight = "<b><u>";
1233 text_t endhighlight = "</u></b>";
1234 if (disp.isdefaultmacro("Global", "starthighlight"))
1235 disp.expandstring("Global", "_starthighlight_", starthighlight);
1236 if (disp.isdefaultmacro("Global", "endhighlight"))
1237 disp.expandstring("Global", "_endhighlight_", endhighlight);
1238
1239
1240 text_t::iterator here = text.begin();
1241 text_t::iterator end = text.end();
1242 text_t word, buffer;
1243 while (here != end) {
1244 if (is_unicode_letdig(*here)) {
1245 // not word boundary
1246 word.push_back(*here);
1247 here++;
1248
1249 } else {
1250 // found word boundary
1251 // add last word if there was one
1252 if (!word.empty()) {
1253 it = allterms.find(word);
1254 if (it != allterms.end()) {
1255 word = starthighlight + word + endhighlight;
1256 }
1257 buffer += word;
1258 word.clear();
1259 }
1260
1261 if (*here == '<') {
1262 // skip over rest of html tag
1263 while ((here != end) && (*here != '>')) {
1264 buffer.push_back(*here);
1265 here++;
1266 }
1267 }
1268
1269 buffer.push_back(*here);
1270 here++;
1271
1272 if (buffer.size() > 1024) {
1273 textout << outconvert << disp << buffer;
1274 buffer.clear();
1275 }
1276 }
1277 }
1278 textout << outconvert << disp << buffer;
1279}
Note: See TracBrowser for help on using the repository browser.