source: trunk/gsdl/src/recpt/browsetools.cpp@ 1266

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

Reverted back to old DocumentHeader, DocumentTitles, DocumentImages etc.
from DocumentColumns stuff. I'll move the DocumentColumns stuff to a
separate development branch (New_Config_Format-branch) for now. The plan
is to redesign the configuration file format a bit and limit the number of
distributions floating around that take different configuration formats).

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 24.2 KB
Line 
1
2/**********************************************************************
3 *
4 * browsetools.cpp --
5 * Copyright (C) 1999 The New Zealand Digital Library Project
6 *
7 * A component of the Greenstone digital library software
8 * from the New Zealand Digital Library Project at the
9 * University of Waikato, New Zealand.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * $Id: browsetools.cpp 1079 2000-04-07 04:40:45Z sjboddie $
26 *
27 *********************************************************************/
28
29/*
30 $Log$
31 Revision 1.42 2000/04/07 04:40:43 sjboddie
32 Reverted back to old DocumentHeader, DocumentTitles, DocumentImages etc.
33 from DocumentColumns stuff. I'll move the DocumentColumns stuff to a
34 separate development branch (New_Config_Format-branch) for now. The plan
35 is to redesign the configuration file format a bit and limit the number of
36 distributions floating around that take different configuration formats).
37
38 Revision 1.39 2000/02/25 02:28:43 sjboddie
39 caught up with assoc directory changes for displaying cover images
40
41 Revision 1.38 2000/02/17 02:42:24 sjboddie
42 minor stuff - fixed some cvs conflicts
43
44 Revision 1.37 2000/02/15 22:53:47 kjm18
45 search history stuff added.
46
47 Revision 1.36 2000/02/06 21:31:36 sjboddie
48 made some formerly static functions accessible from elsewhere (for
49 cstr receptionist)
50
51 Revision 1.35 2000/01/26 23:46:16 sjboddie
52 wrap every second button now (was every third)
53
54 Revision 1.34 1999/11/09 02:28:47 sjboddie
55 fixed minor bug in expanded contents
56
57 Revision 1.33 1999/10/30 22:22:26 sjboddie
58 added collection argument to browserclass output_section_group
59 functions -- moved table functions to formattools
60
61 Revision 1.32 1999/10/24 07:22:37 sjboddie
62 added a FullTOC option
63
64 Revision 1.31 1999/10/20 03:54:20 sjboddie
65 problem with expanded contents
66
67 Revision 1.30 1999/10/19 21:36:59 sjboddie
68 fixed bug in DocumentContents
69
70 Revision 1.29 1999/10/19 08:40:12 sjboddie
71 fixed some stupid compiler warnings on windows
72
73 Revision 1.28 1999/10/18 20:08:36 sjboddie
74 tidied up a few things
75
76 Revision 1.27 1999/10/15 03:31:42 sjboddie
77 oops, left out an '&'
78
79 Revision 1.26 1999/10/14 22:58:05 sjboddie
80 finished up on changes to browseing support - may still need some
81 tidying up
82
83 Revision 1.25 1999/10/10 08:14:04 sjboddie
84 - metadata now returns mp rather than array
85 - redesigned browsing support (although it's not finished so
86 won't currently work ;-)
87
88 Revision 1.24 1999/09/28 01:46:55 rjmcnab
89 removed some unused stuff
90
91 Revision 1.23 1999/09/23 10:09:17 sjboddie
92 made some changes so AZLists within other classifications are
93 handled properly
94
95 Revision 1.22 1999/09/07 23:06:58 rjmcnab
96 removed some compiler warnings.
97
98 Revision 1.21 1999/09/07 04:56:52 sjboddie
99 added GPL notice
100
101 Revision 1.20 1999/08/25 04:46:58 sjboddie
102 fixed bug
103
104 Revision 1.19 1999/08/13 04:18:04 sjboddie
105 fixed some typos
106
107 Revision 1.18 1999/08/10 22:42:21 sjboddie
108 added more format options to document tocs - there are now just two
109 types of toc - standard (Hierarchical) and document (as in books)
110
111 Revision 1.17 1999/08/09 02:12:07 sjboddie
112 made it so dates may be only 4 digits (i.e. year only)
113
114 Revision 1.16 1999/07/30 02:16:10 sjboddie
115 -added ability to display nested classifications (expanded versions
116 of nested classifications has yet to be done).
117 -changed set_arrow_macros slightly to fit in with new showtoppage
118 format option
119
120 Revision 1.15 1999/07/21 05:01:56 sjboddie
121 wrote handler for DateList classification
122
123 Revision 1.14 1999/07/20 02:58:15 sjboddie
124 got List and AZList classifications using format strings - tidied
125 up a bit
126
127 Revision 1.13 1999/07/07 05:44:25 sjboddie
128 Made some changes to allow for new way classifiers work (i.e. you can
129 now have classifiers containing other classifiers). At present there's
130 only a special case for dealing with the hdl 'magazine' section. A bit
131 of a redesign is needed to get it completely flexible
132
133 Revision 1.12 1999/07/01 03:47:49 rjmcnab
134 Fixed a small warning.
135
136 Revision 1.11 1999/06/27 21:49:01 sjboddie
137 fixed a couple of version conflicts - tidied up some small things
138
139 Revision 1.10 1999/06/26 01:07:21 rjmcnab
140 Fixed a small "bug" -- well I probably just covered another one...
141
142 Revision 1.9 1999/06/24 05:12:15 sjboddie
143 lots of small changes
144
145 Revision 1.8 1999/06/17 03:06:53 sjboddie
146 got detach button working properly - the close book icon is now disabled
147 when page is detached as the javascript close() function I was using is
148 too unreliable over different browsers
149 note that in my last comment I meant the "cl" arg (not the "c" arg).
150
151 Revision 1.7 1999/06/16 23:53:14 sjboddie
152 tidied a few things up. documentaction::define_external_macros now
153 resets the "c" arg if it's set to something stupid by the .xx suffixes
154
155 Revision 1.6 1999/06/16 04:03:47 sjboddie
156 Now sets "cl" arg to "search" when going to a document from a search
157 results page. This allows the close book icon (in hierarchy toc) to
158 take you back to the results page if that's where you came from.
159 If you got to the document page somehow other than from a
160 classification or a search (i.e. if "cl" isn't set) then the close
161 book icon is disabled
162
163 Revision 1.5 1999/06/16 03:11:25 sjboddie
164 get_info() now takes a getParents argument
165
166 Revision 1.4 1999/05/10 03:40:26 sjboddie
167 lots of changes - slowly getting document action sorted out
168
169 Revision 1.3 1999/04/30 01:59:39 sjboddie
170 lots of stuff - getting documentaction working (documentaction replaces
171 old browseaction)
172
173 Revision 1.2 1999/03/29 02:14:29 sjboddie
174
175 More changes to browseaction
176
177 Revision 1.1 1999/03/25 03:10:15 sjboddie
178
179 new library for browse stuff
180
181 */
182
183#include "browsetools.h"
184#include "OIDtools.h"
185
186
187// output_controls displays the detach, expand/contract contents,
188// expand/contract text and highlighting/no highlighting buttons
189
190void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
191 recptproto * /*collectproto*/, displayclass &disp,
192 outconvertclass &outconvert, ostream &textout,
193 ostream &/*logout*/) {
194
195 if (args["u"] != "1") {
196
197 FilterResponse_t response;
198 text_tarray metadata;
199 text_tarray buttons;
200
201 text_tarray::const_iterator here = ibuttons.begin();
202 text_tarray::const_iterator end = ibuttons.end();
203
204 while (here != end) {
205
206 if (*here == "Detach")
207 buttons.push_back ("_document:imagedetach_");
208 else if (*here == "Highlight") {
209 if (args["hl"] == "1")
210 buttons.push_back ("_document:imagenohighlight_");
211 else
212 buttons.push_back ("_document:imagehighlight_");
213 } else if (*here == "Expand Contents") {
214 if (args["gc"] == "1")
215 buttons.push_back ("_document:imagecontracttoc_");
216 else
217 buttons.push_back ("_document:imageexpandtoc_");
218 } else if (*here == "Expand Text") {
219 if (args.getintarg("gt"))
220 buttons.push_back ("_document:imagecontracttext_");
221 else
222 buttons.push_back ("_document:imageexpandtext_");
223 }
224 here ++;
225 }
226
227 here = buttons.begin();
228 end = buttons.end();
229 int count = 0;
230 while (here != end) {
231 if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";
232 textout << outconvert << disp << *here;
233 count ++;
234 here ++;
235 }
236 }
237}
238
239
240// at the moment this just writes out the html to display
241// the cover image (assuming it's called cover.jpg)
242// this whole thing should be done with a call to the collection
243// server which would send a link to the cover image if there
244// was one otherwise send title, author and stuff
245void output_cover_image (cgiargsclass &args, recptproto * /*collectproto*/,
246 displayclass &disp, outconvertclass &outconvert,
247 ostream &textout, ostream &/*logout*/) {
248
249 if (args["d"].empty()) return;
250
251 textout << outconvert << disp <<
252 "<img src=\"_httpcollimg_/_thisOID_/cover.jpg\"><br>\n";
253}
254
255void output_titles (cgiargsclass &args, recptproto *collectproto,
256 formatinfo_t &formatinfo, displayclass &disp,
257 outconvertclass &outconvert, ostream &textout,
258 ostream &logout) {
259
260 if (args["d"].empty()) return;
261
262 text_tset metadata;
263 bool getParents;
264 FilterResponse_t response;
265
266 format_t *formatlistptr = new format_t();
267 parse_formatstring (formatinfo.DocumentHeading, formatlistptr, metadata, getParents);
268
269 if (!get_info (args["d"], args["c"], metadata, getParents, collectproto, response, logout))
270 return;
271
272 textout << outconvert << disp << get_formatted_string (response.docInfo[0], formatlistptr);
273}
274
275
276static void recurse_contents (ResultDocInfo_t &section, cgiargsclass &args, bool fulltoc,
277 browserclass *bptr, text_tset &metadata, bool &getParents,
278 format_t *formatlistptr, format_tmap &formatlistmap,
279 formatinfo_t &formatinfo, browsermapclass *browsermap,
280 int tabcount, recptproto *collectproto, displayclass &disp,
281 outconvertclass &outconvert, ostream &textout, ostream &logout) {
282 text_t formatstring;
283
284 bool is_classify = false;
285 if (args["d"].empty() || fulltoc) is_classify = true;
286
287 // output this section
288 bool use_table = is_table_content (formatlistptr);
289 tabcount += bptr->output_section_group (section, args, "", tabcount, formatlistptr, use_table,
290 metadata, getParents, collectproto, disp, outconvert,
291 textout, logout);
292
293 text_t classification;
294 if (!is_classify) classification = "Document";
295 else get_top (args["cl"], classification);
296
297 int haschildren = section.metadata["haschildren"].values[0].getint();
298 const text_t &doctype = section.metadata["doctype"].values[0];
299 text_t classifytype = section.metadata["childtype"].values[0];
300 // HLists and DateLists are displayed as VLists when contents
301 // are expanded, Paged documents are displayed as HLists
302 if (classifytype == "HList" || classifytype == "DateList") classifytype = "VList";
303 if (classifytype == "Paged") classifytype = "HList";
304
305 // recurse through children
306 if ((haschildren == 1) && (!is_classify || fulltoc || doctype == "classify")) {
307
308 // get browser for displaying children
309 bptr = browsermap->getbrowser (classifytype);
310 bptr->load_metadata_defaults (metadata);
311
312 // get the formatstring if there is one
313 if (!get_formatstring (classification, classifytype,
314 formatinfo.formatstrings, formatstring))
315 formatstring = bptr->get_default_formatstring();
316
317 format_tmap::const_iterator it = formatlistmap.find (formatstring);
318 // check if formatlistptr is cached
319 if (it != formatlistmap.end()) formatlistptr = (*it).second;
320 else {
321 formatlistptr = new format_t();
322 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
323 formatlistmap[formatstring] = formatlistptr;
324 }
325
326 FilterResponse_t tmp;
327 get_children (section.OID, args["c"], metadata, getParents, collectproto, tmp, logout);
328 ResultDocInfo_tarray::iterator thisdoc = tmp.docInfo.begin();
329 ResultDocInfo_tarray::iterator lastdoc = tmp.docInfo.end();
330
331 while (thisdoc != lastdoc) {
332 recurse_contents (*thisdoc, args, fulltoc, bptr, metadata, getParents,
333 formatlistptr, formatlistmap, formatinfo, browsermap,
334 tabcount, collectproto, disp, outconvert, textout, logout);
335 thisdoc ++;
336 }
337 }
338}
339
340
341// expanded_contents recurses through all contents. there's a special case
342// for an HList when contents are expanded (i.e. it's displayed as a VList)
343//
344// if we're inside a document we expand all contents from the top,
345// if we're at classification level we'll just expand out those contents below
346// the current one
347
348void expanded_contents (cgiargsclass &args, int tabcount, bool fulltoc,
349 browsermapclass *browsermap, formatinfo_t &formatinfo,
350 recptproto *collectproto, displayclass &disp,
351 outconvertclass &outconvert, ostream &textout,
352 ostream &logout) {
353
354 if (args["d"].empty() && args["cl"].empty()) return;
355 text_t OID;
356
357 FilterResponse_t response;
358 bool getParents = false;
359 text_tset metadata;
360 text_t classifytype, classification, formatstring;
361
362 if (!args["d"].empty()) {
363 // document level
364 if (fulltoc) {
365 get_top (args["cl"], OID);
366 classification = OID;
367 }
368 else {
369 // always expand document level from top
370 get_top (args["d"], OID);
371 classification = "Document";
372 }
373 } else {
374 // classification level
375 OID = args["cl"];
376 get_top (args["cl"], classification);
377 }
378
379 // get classifytype of this level
380 text_t tOID;
381 if (is_top(OID)) {
382 classifytype = "thistype";
383 tOID = OID;
384 } else {
385 classifytype = "childtype";
386 tOID = get_parent (OID);
387 }
388 metadata.insert (classifytype);
389
390 if (!get_info (tOID, args["c"], metadata, getParents, collectproto, response, logout))
391 return;
392 classifytype = response.docInfo[0].metadata[classifytype].values[0];
393 // if we still don't have a classifytype we'll use the default
394 if (classifytype.empty()) {
395 browserclass *bptr = browsermap->get_default_browser ();
396 classifytype = bptr->get_browser_name ();
397 }
398
399 // HLists are displayed as VLists when contents are expanded,
400 // Paged documents are displayed as HLists
401 if (classifytype == "HList") {
402 classifytype = "VList";
403 text_t pOID = get_parent (OID);
404 if (!pOID.empty()) {
405 OID = pOID;
406 // this is assuming that top levels are always 'Invisible' !!!
407 if (is_top (OID)) classifytype = "Invisible";
408 }
409 }
410 if (classifytype == "Paged") classifytype = "HList";
411
412 metadata.erase (metadata.begin(), metadata.end());
413
414 // metadata elements needed by recurse_contents
415 metadata.insert ("childtype");
416 metadata.insert ("doctype");
417 metadata.insert ("haschildren");
418
419 // load up metadata array with browser defaults
420 browserclass *bptr = browsermap->getbrowser (classifytype);
421 bptr->load_metadata_defaults (metadata);
422
423 // get the formatstring if there is one or use the browsers default
424 if (!get_formatstring (classification, classifytype,
425 formatinfo.formatstrings, formatstring))
426 formatstring = bptr->get_default_formatstring();
427
428 format_t *formatlistptr = new format_t();
429 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
430
431 // protocol call
432 if (!get_info (OID, args["c"], metadata, getParents, collectproto, response, logout))
433 return;
434
435 format_tmap formatlistmap;
436 formatlistmap[formatstring] = formatlistptr;
437
438 recurse_contents (response.docInfo[0], args, fulltoc, bptr, metadata,
439 getParents, formatlistptr, formatlistmap, formatinfo, browsermap,
440 tabcount, collectproto, disp, outconvert, textout, logout);
441
442 // clean up format list pointers
443 format_tmap::const_iterator here = formatlistmap.begin();
444 format_tmap::const_iterator end = formatlistmap.end();
445 while (here != end) {
446 delete (*here).second;
447 here ++;
448 }
449}
450
451
452static void load_formatstring (const text_t &classifytype, text_tset &metadata,
453 bool &getParents, const text_t &classification,
454 browsermapclass *browsermap, formatinfo_t &formatinfo,
455 format_tmap &formatlistmap) {
456 text_t formatstring;
457
458 // load up metadata array with browser defaults
459 browserclass *bptr = browsermap->getbrowser (classifytype);
460 bptr->load_metadata_defaults (metadata);
461
462 // get the formatstring if there is one or use the browsers default
463 if (!get_formatstring (classification, classifytype,
464 formatinfo.formatstrings, formatstring))
465 formatstring = bptr->get_default_formatstring();
466
467 // see if it's cached
468 format_tmap::const_iterator it = formatlistmap.find (formatstring);
469 if (it == formatlistmap.end()) {
470 format_t *formatlistptr = new format_t();
471 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
472 formatlistmap[formatstring] = formatlistptr;
473 }
474}
475
476static void load_formatstrings (FilterResponse_t &response, text_tset &metadata,
477 bool &getParents, const text_t &classification,
478 browsermapclass *browsermap, formatinfo_t &formatinfo,
479 format_tmap &formatlistmap) {
480
481 text_tset cache;
482
483 ResultDocInfo_tarray::iterator thisdoc = response.docInfo.begin();
484 ResultDocInfo_tarray::iterator lastdoc = response.docInfo.end();
485
486 while (thisdoc != lastdoc) {
487
488 if (is_top ((*thisdoc).OID))
489 load_formatstring ((*thisdoc).metadata["thistype"].values[0], metadata,
490 getParents, classification, browsermap, formatinfo,
491 formatlistmap);
492
493 text_t &childtype = (*thisdoc).metadata["childtype"].values[0];
494 text_tset::const_iterator it = cache.find (childtype);
495 if (it == cache.end()) {
496 load_formatstring (childtype, metadata, getParents, classification,
497 browsermap, formatinfo, formatlistmap);
498 cache.insert (childtype);
499 }
500 thisdoc ++;
501 }
502}
503
504static void output_parents (FilterResponse_t &response, cgiargsclass &args,
505 browsermapclass *browsermap, formatinfo_t &formatinfo,
506 format_tmap &formatlistmap, const text_t &classification,
507 int &tabcount, text_tset &metadata, bool &getParents,
508 recptproto *collectproto, displayclass &disp,
509 outconvertclass &outconvert, ostream &textout,
510 ostream &logout) {
511
512 format_t *formatlistptr = NULL;
513 text_t classifytype, formatstring;
514 bool use_table, first = true;
515 ResultDocInfo_tarray::iterator thisparent = response.docInfo.begin();
516 ResultDocInfo_tarray::iterator lastparent = response.docInfo.end();
517 while (thisparent != lastparent) {
518
519 // get classifytype of this level
520 if (is_top ((*thisparent).OID)) classifytype = (*thisparent).metadata["thistype"].values[0];
521 else if (!first) classifytype = (*(thisparent-1)).metadata["childtype"].values[0];
522
523 // if we still don't have a classifytype we'll use the default
524 if (classifytype.empty()) {
525 browserclass *bptr = browsermap->get_default_browser ();
526 classifytype = bptr->get_browser_name ();
527 }
528
529 browserclass *bptr = browsermap->getbrowser (classifytype);
530
531 // get the formatstring if there is one or use the browsers default
532 if (!get_formatstring (classification, classifytype,
533 formatinfo.formatstrings, formatstring))
534 formatstring = bptr->get_default_formatstring();
535
536 // see if it's cached
537 format_tmap::const_iterator it = formatlistmap.find (formatstring);
538 if (it != formatlistmap.end()) formatlistptr = (*it).second;
539 else {
540 logout << "browsetools error\n";
541 return;
542 }
543
544 use_table = is_table_content (formatlistptr);
545 tabcount += bptr->output_section_group (*thisparent, args, "", tabcount, formatlistptr,
546 use_table, metadata, getParents, collectproto,
547 disp, outconvert, textout, logout);
548 first = false;
549 thisparent ++;
550 }
551}
552
553void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc,
554 browsermapclass *browsermap, formatinfo_t &formatinfo,
555 recptproto *collectproto, displayclass &disp,
556 outconvertclass &outconvert, ostream &textout,
557 ostream &logout) {
558
559 FilterResponse_t response;
560 text_tset metadata;
561 bool getParents = false;
562 text_t formatstring;
563 text_tarray parents;
564 text_t OID = args["d"];
565 text_t classification = "Document";
566 if (OID.empty()) {
567 OID = args["cl"];
568 get_top (OID, classification);
569 } else if (fulltoc)
570 get_top (args["cl"], classification);
571
572 bool haschildren = has_children (OID, args["c"], collectproto, logout);
573
574 if ((!args["d"].empty()) && fulltoc)
575 get_parents_array (args["cl"] + ".fc", parents);
576 if (haschildren) get_parents_array (OID + ".fc", parents);
577 else get_parents_array (OID, parents);
578
579 if (!parents.empty()) {
580 // get classifytypes of each parent
581 metadata.insert ("thistype");
582 metadata.insert ("childtype");
583
584 if (!get_info (parents, args["c"], metadata, getParents, collectproto, response, logout))
585 return;
586
587 // get formatstrings for all parents
588 format_tmap formatlistmap;
589 load_formatstrings (response, metadata, getParents, classification,
590 browsermap, formatinfo, formatlistmap);
591
592 if (!get_info (parents, args["c"], metadata, getParents, collectproto, response, logout))
593 return;
594
595 // display each parent
596 output_parents (response, args, browsermap, formatinfo, formatlistmap,
597 classification, tabcount, metadata, getParents,
598 collectproto, disp, outconvert, textout, logout);
599
600 metadata.erase (metadata.begin(), metadata.end());
601
602 // clean up cached format list pointers
603 format_tmap::const_iterator here = formatlistmap.begin();
604 format_tmap::const_iterator end = formatlistmap.end();
605 while (here != end) {
606 delete (*here).second;
607 here ++;
608 }
609 }
610
611 // get childrens classifytype
612 text_t classifytype;
613 int numparents = response.docInfo.size();
614 if (!parents.empty())
615 classifytype = response.docInfo[numparents-1].metadata["childtype"].values[0];
616 else {
617 // use the default
618 browserclass *bptr = browsermap->get_default_browser ();
619 classifytype = bptr->get_browser_name ();
620 }
621
622 // load up metadata array with browser defaults
623 browserclass *bptr = browsermap->getbrowser (classifytype);
624 bptr->load_metadata_defaults (metadata);
625
626 // get the formatstring if there is one or use the browsers default
627 if (!get_formatstring (classification, classifytype,
628 formatinfo.formatstrings, formatstring))
629 formatstring = bptr->get_default_formatstring();
630
631 format_t *formatlistptr = new format_t();
632 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
633
634 if (haschildren)
635 get_children (OID, args["c"], metadata, getParents,
636 collectproto, response, logout);
637 else if (!is_top(OID)) {
638 get_children (OID + ".pr", args["c"], metadata, getParents,
639 collectproto, response, logout);
640 haschildren = true;
641 }
642
643 // display children
644 if (haschildren) {
645 bool use_table = is_table_content (formatlistptr);
646 bptr->output_section_group (response, args, "", tabcount, formatlistptr, use_table,
647 metadata, getParents, collectproto, disp, outconvert,
648 textout, logout);
649 }
650
651 delete formatlistptr;
652}
653
654void output_toc (cgiargsclass &args, browsermapclass *browsermap,
655 formatinfo_t &formatinfo, recptproto *collectproto,
656 displayclass &disp, outconvertclass &outconvert,
657 ostream &textout, ostream &logout) {
658
659 int tabcount = 0;
660 bool havecontrols = false;
661 bool fulltoc = false;
662
663 if (args["cl"] != "search") {
664 // see if there's a FullTOC string
665 text_t cl_top, full_toc;
666 get_top (args["cl"], cl_top);
667 if (get_formatstring (cl_top, "FullTOC", formatinfo.formatstrings, full_toc))
668 if (full_toc == "true") fulltoc = true;
669 }
670
671 // get the cover image (if there is one) and the control buttons
672 // if we're inside a book
673 if ((!fulltoc) && (!args["d"].empty())) {
674 textout << "<p><table cellpadding=0 cellspacing=0><tr>\n";
675 textout << "<td valign=top";
676 if (formatinfo.DocumentContents) textout << " width=200>\n";
677 else textout << " width=100%>\n";
678 if (formatinfo.DocumentImages)
679 output_cover_image (args, collectproto, disp, outconvert, textout, logout);
680 else if (formatinfo.DocumentTitles)
681 output_titles (args, collectproto, formatinfo, disp, outconvert, textout, logout);
682 output_controls (args, formatinfo.DocumentButtons, collectproto, disp,
683 outconvert, textout, logout);
684 textout << "</td><td valign=top>\n";
685 havecontrols = true;
686 }
687
688 if (formatinfo.DocumentContents || args["d"].empty()) {
689 if (args.getintarg("gc") == 1) {
690
691 // expanded table of contents
692 expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo,
693 collectproto, disp, outconvert, textout, logout);
694 } else {
695
696 // contracted table of contents
697 contracted_contents (args, tabcount, fulltoc, browsermap, formatinfo,
698 collectproto, disp, outconvert, textout, logout);
699 }
700 }
701
702 if (havecontrols) textout << "</td></tr></table>\n";
703}
704
705
706
Note: See TracBrowser for help on using the repository browser.