1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * browsetools.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: browsetools.cpp 624 1999-09-23 10:09:17Z sjboddie $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*
|
---|
29 | $Log$
|
---|
30 | Revision 1.23 1999/09/23 10:09:17 sjboddie
|
---|
31 | made some changes so AZLists within other classifications are
|
---|
32 | handled properly
|
---|
33 |
|
---|
34 | Revision 1.22 1999/09/07 23:06:58 rjmcnab
|
---|
35 | removed some compiler warnings.
|
---|
36 |
|
---|
37 | Revision 1.21 1999/09/07 04:56:52 sjboddie
|
---|
38 | added GPL notice
|
---|
39 |
|
---|
40 | Revision 1.20 1999/08/25 04:46:58 sjboddie
|
---|
41 | fixed bug
|
---|
42 |
|
---|
43 | Revision 1.19 1999/08/13 04:18:04 sjboddie
|
---|
44 | fixed some typos
|
---|
45 |
|
---|
46 | Revision 1.18 1999/08/10 22:42:21 sjboddie
|
---|
47 | added more format options to document tocs - there are now just two
|
---|
48 | types of toc - standard (Hierarchical) and document (as in books)
|
---|
49 |
|
---|
50 | Revision 1.17 1999/08/09 02:12:07 sjboddie
|
---|
51 | made it so dates may be only 4 digits (i.e. year only)
|
---|
52 |
|
---|
53 | Revision 1.16 1999/07/30 02:16:10 sjboddie
|
---|
54 | -added ability to display nested classifications (expanded versions
|
---|
55 | of nested classifications has yet to be done).
|
---|
56 | -changed set_arrow_macros slightly to fit in with new showtoppage
|
---|
57 | format option
|
---|
58 |
|
---|
59 | Revision 1.15 1999/07/21 05:01:56 sjboddie
|
---|
60 | wrote handler for DateList classification
|
---|
61 |
|
---|
62 | Revision 1.14 1999/07/20 02:58:15 sjboddie
|
---|
63 | got List and AZList classifications using format strings - tidied
|
---|
64 | up a bit
|
---|
65 |
|
---|
66 | Revision 1.13 1999/07/07 05:44:25 sjboddie
|
---|
67 | Made some changes to allow for new way classifiers work (i.e. you can
|
---|
68 | now have classifiers containing other classifiers). At present there's
|
---|
69 | only a special case for dealing with the hdl 'magazine' section. A bit
|
---|
70 | of a redesign is needed to get it completely flexible
|
---|
71 |
|
---|
72 | Revision 1.12 1999/07/01 03:47:49 rjmcnab
|
---|
73 | Fixed a small warning.
|
---|
74 |
|
---|
75 | Revision 1.11 1999/06/27 21:49:01 sjboddie
|
---|
76 | fixed a couple of version conflicts - tidied up some small things
|
---|
77 |
|
---|
78 | Revision 1.10 1999/06/26 01:07:21 rjmcnab
|
---|
79 | Fixed a small "bug" -- well I probably just covered another one...
|
---|
80 |
|
---|
81 | Revision 1.9 1999/06/24 05:12:15 sjboddie
|
---|
82 | lots of small changes
|
---|
83 |
|
---|
84 | Revision 1.8 1999/06/17 03:06:53 sjboddie
|
---|
85 | got detach button working properly - the close book icon is now disabled
|
---|
86 | when page is detached as the javascript close() function I was using is
|
---|
87 | too unreliable over different browsers
|
---|
88 | note that in my last comment I meant the "cl" arg (not the "c" arg).
|
---|
89 |
|
---|
90 | Revision 1.7 1999/06/16 23:53:14 sjboddie
|
---|
91 | tidied a few things up. documentaction::define_external_macros now
|
---|
92 | resets the "c" arg if it's set to something stupid by the .xx suffixes
|
---|
93 |
|
---|
94 | Revision 1.6 1999/06/16 04:03:47 sjboddie
|
---|
95 | Now sets "cl" arg to "search" when going to a document from a search
|
---|
96 | results page. This allows the close book icon (in hierarchy toc) to
|
---|
97 | take you back to the results page if that's where you came from.
|
---|
98 | If you got to the document page somehow other than from a
|
---|
99 | classification or a search (i.e. if "cl" isn't set) then the close
|
---|
100 | book icon is disabled
|
---|
101 |
|
---|
102 | Revision 1.5 1999/06/16 03:11:25 sjboddie
|
---|
103 | get_info() now takes a getParents argument
|
---|
104 |
|
---|
105 | Revision 1.4 1999/05/10 03:40:26 sjboddie
|
---|
106 | lots of changes - slowly getting document action sorted out
|
---|
107 |
|
---|
108 | Revision 1.3 1999/04/30 01:59:39 sjboddie
|
---|
109 | lots of stuff - getting documentaction working (documentaction replaces
|
---|
110 | old browseaction)
|
---|
111 |
|
---|
112 | Revision 1.2 1999/03/29 02:14:29 sjboddie
|
---|
113 |
|
---|
114 | More changes to browseaction
|
---|
115 |
|
---|
116 | Revision 1.1 1999/03/25 03:10:15 sjboddie
|
---|
117 |
|
---|
118 | new library for browse stuff
|
---|
119 |
|
---|
120 | */
|
---|
121 |
|
---|
122 |
|
---|
123 | #include "browsetools.h"
|
---|
124 | #include "OIDtools.h"
|
---|
125 |
|
---|
126 | // simply checks to see if formatstring begins with a <td> tag
|
---|
127 | static bool is_table_content (const text_t &formatstring) {
|
---|
128 | text_t::const_iterator here = formatstring.begin();
|
---|
129 | text_t::const_iterator end = formatstring.end();
|
---|
130 |
|
---|
131 | while (here != end) {
|
---|
132 | if (*here != ' ') {
|
---|
133 | if (*here == '<') {
|
---|
134 | if ((*(here+1) == 't' || *(here+1) == 'T') &&
|
---|
135 | (*(here+2) == 'd' || *(here+2) == 'D') &&
|
---|
136 | (*(here+3) == '>' || *(here+3) == ' '))
|
---|
137 | return true;
|
---|
138 | } else return false;
|
---|
139 | }
|
---|
140 | here ++;
|
---|
141 | }
|
---|
142 | return false;
|
---|
143 | }
|
---|
144 |
|
---|
145 | static bool is_table_content (const format_t *formatlistptr) {
|
---|
146 |
|
---|
147 | if (formatlistptr == NULL) return false;
|
---|
148 |
|
---|
149 | if (formatlistptr->command == comText)
|
---|
150 | return is_table_content (formatlistptr->text);
|
---|
151 |
|
---|
152 | return false;
|
---|
153 | }
|
---|
154 |
|
---|
155 |
|
---|
156 | // output_controls displays the detach, expand/contract contents,
|
---|
157 | // expand/contract text and highlighting/no highlighting buttons
|
---|
158 | static void output_controls (cgiargsclass &args, const text_tarray &ibuttons,
|
---|
159 | recptproto * /*collectproto*/, displayclass &disp,
|
---|
160 | outconvertclass &outconvert, ostream &textout,
|
---|
161 | ostream &/*logout*/) {
|
---|
162 |
|
---|
163 | if (args["u"] != "1") {
|
---|
164 |
|
---|
165 | FilterResponse_t response;
|
---|
166 | text_tarray metadata;
|
---|
167 | text_tarray buttons;
|
---|
168 |
|
---|
169 | text_tarray::const_iterator here = ibuttons.begin();
|
---|
170 | text_tarray::const_iterator end = ibuttons.end();
|
---|
171 |
|
---|
172 | while (here != end) {
|
---|
173 |
|
---|
174 | if (*here == "Detach")
|
---|
175 | buttons.push_back ("_document:imagedetach_");
|
---|
176 | else if (*here == "Highlight") {
|
---|
177 | if (args["hl"] == "1")
|
---|
178 | buttons.push_back ("_document:imagenohighlight_");
|
---|
179 | else
|
---|
180 | buttons.push_back ("_document:imagehighlight_");
|
---|
181 | } else if (*here == "Expand Contents") {
|
---|
182 | if (args["gc"] == "1")
|
---|
183 | buttons.push_back ("_document:imagecontracttoc_");
|
---|
184 | else
|
---|
185 | buttons.push_back ("_document:imageexpandtoc_");
|
---|
186 | } else if (*here == "Expand Text") {
|
---|
187 | if (args.getintarg("gt"))
|
---|
188 | buttons.push_back ("_document:imagecontracttext_");
|
---|
189 | else
|
---|
190 | buttons.push_back ("_document:imageexpandtext_");
|
---|
191 | }
|
---|
192 | here ++;
|
---|
193 | }
|
---|
194 |
|
---|
195 | here = buttons.begin();
|
---|
196 | end = buttons.end();
|
---|
197 | int count = 0;
|
---|
198 | while (here != end) {
|
---|
199 | if ((count != 0) && ((count % 3) == 0)) textout << "<br>\n";
|
---|
200 | textout << outconvert << disp << *here;
|
---|
201 | count ++;
|
---|
202 | here ++;
|
---|
203 | }
|
---|
204 | }
|
---|
205 | }
|
---|
206 |
|
---|
207 |
|
---|
208 | // at the moment this just writes out the html to display
|
---|
209 | // the cover image (assuming it's called cover.jpg)
|
---|
210 | // this whole thing should be done with a call to the collection
|
---|
211 | // server which would send a link to the cover image if there
|
---|
212 | // was one otherwise send title, author and stuff
|
---|
213 | static void output_cover_image (cgiargsclass &args, recptproto * /*collectproto*/,
|
---|
214 | displayclass &disp, outconvertclass &outconvert,
|
---|
215 | ostream &textout, ostream &/*logout*/) {
|
---|
216 |
|
---|
217 | if (args["d"].empty()) return;
|
---|
218 |
|
---|
219 | textout << outconvert << disp <<
|
---|
220 | "<img src=\"_httpcollection_/archives/_thisOID_/cover.jpg\"><br>\n";
|
---|
221 | }
|
---|
222 |
|
---|
223 |
|
---|
224 |
|
---|
225 | /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
---|
226 | Functions for generating a document type tables of contents. These aren't really tables of
|
---|
227 | contents at all, just a title, some navigation buttons and arrows and maybe a page ? of ?
|
---|
228 | type thing. These should only be called for document level tocs (i.e. when the "d" argument
|
---|
229 | is set) as I don't think it makes sense to display top level classifications in this way.
|
---|
230 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
|
---|
231 |
|
---|
232 | void output_document_toc (cgiargsclass &args, const formatinfo_t &formatinfo,
|
---|
233 | recptproto *collectproto, displayclass &disp,
|
---|
234 | outconvertclass &outconvert, ostream &textout,
|
---|
235 | ostream &logout) {
|
---|
236 |
|
---|
237 | text_t &arg_d = args["d"];
|
---|
238 | if (arg_d.empty()) return;
|
---|
239 |
|
---|
240 | text_tarray metadata;
|
---|
241 | FilterResponse_t response;
|
---|
242 | bool getParents = false;
|
---|
243 | ResultDocInfo_t docinfo;
|
---|
244 | text_t &collection = args["c"];
|
---|
245 | int gt = args.getintarg("gt");
|
---|
246 |
|
---|
247 | bool istop = is_top (arg_d);
|
---|
248 |
|
---|
249 | format_t *formatlistptr = new format_t();
|
---|
250 | parse_formatstring (formatinfo.DocumentHeading, formatlistptr, metadata, getParents);
|
---|
251 |
|
---|
252 | text_tarray OIDs;
|
---|
253 | OIDs.push_back (arg_d);
|
---|
254 | if (formatinfo.DocumentArrowsTop && !gt && !istop)
|
---|
255 | OIDs.push_back (arg_d + ".pr.lc");
|
---|
256 |
|
---|
257 | metadata.push_back ("Title");
|
---|
258 | int metasize = metadata.size();
|
---|
259 |
|
---|
260 | if (get_info (OIDs, collection, metadata, getParents, collectproto, response, logout)) {
|
---|
261 |
|
---|
262 | text_t &thistitle = response.docInfo[0].metadata[metasize-1].values.back();
|
---|
263 | text_t last_sib_title;
|
---|
264 | if (formatinfo.DocumentArrowsTop && !gt && !istop) {
|
---|
265 | if (response.docInfo.size() == 1)
|
---|
266 | last_sib_title = response.docInfo[0].metadata[metasize-1].values.back();
|
---|
267 | else
|
---|
268 | last_sib_title = response.docInfo[1].metadata[metasize-1].values.back();
|
---|
269 | }
|
---|
270 |
|
---|
271 | textout
|
---|
272 | << "\n<!-- Table of Contents produced by browsetools::output_document_toc -->\n\n";
|
---|
273 |
|
---|
274 | textout << outconvert << disp
|
---|
275 | << "<p><center>\n"
|
---|
276 | << "<table cellpadding=0 cellspacing=0 width=_pagewidth_>\n"
|
---|
277 | << "<tr valign=top><td>\n";
|
---|
278 |
|
---|
279 | // top arrows and page ? of ? title
|
---|
280 | if (formatinfo.DocumentArrowsTop && !gt) {
|
---|
281 |
|
---|
282 | // previous arrow
|
---|
283 | textout << outconvert << disp << "<table><tr valign=top>\n"
|
---|
284 | << "<td align=left>_document:prevarrow_</td>\n";
|
---|
285 |
|
---|
286 | // page ? of ? text
|
---|
287 | textout << "<td align=center>\n";
|
---|
288 |
|
---|
289 | if (!istop && is_number (thistitle) && is_number (last_sib_title))
|
---|
290 | textout << outconvert << disp << "_document:page_" << thistitle
|
---|
291 | << "_document:of_" << last_sib_title;
|
---|
292 |
|
---|
293 | else
|
---|
294 | textout << outconvert << thistitle;
|
---|
295 |
|
---|
296 | // next arrow
|
---|
297 | textout << outconvert << disp << "</td>\n<td align=right>_document:nextarrow_</td>\n</table>\n";
|
---|
298 | }
|
---|
299 |
|
---|
300 | // goto line
|
---|
301 | if (formatinfo.DocumentGoTo)
|
---|
302 | textout << outconvert << disp << "_document:gotoform_";
|
---|
303 |
|
---|
304 | // control buttons
|
---|
305 | output_controls (args, formatinfo.DocumentButtons, collectproto,
|
---|
306 | disp, outconvert, textout, logout);
|
---|
307 | textout << "</td>\n";
|
---|
308 |
|
---|
309 | // heading
|
---|
310 | textout << outconvert << "\n<td valign=top>\n"
|
---|
311 | << get_formatted_string (response.docInfo[0], formatlistptr);
|
---|
312 |
|
---|
313 | textout << "</td></tr></table></center>\n";
|
---|
314 | textout << "\n<!-- end of Table of Contents -->\n";
|
---|
315 | }
|
---|
316 | }
|
---|
317 |
|
---|
318 |
|
---|
319 | /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
---|
320 | Functions for generating a "Hierarchy" type table of contents. These can be used either
|
---|
321 | at top classification level or at document level (the difference being that a cover
|
---|
322 | image and control buttons may be displayed at document level).
|
---|
323 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
|
---|
324 |
|
---|
325 | // prototypes
|
---|
326 |
|
---|
327 | static void output_contracted_hierarchy_toc (const text_t &classifytype, text_t &formatstring,
|
---|
328 | cgiargsclass &args, recptproto *collectproto,
|
---|
329 | displayclass &disp, outconvertclass &outconvert,
|
---|
330 | ostream &textout, ostream &logout);
|
---|
331 |
|
---|
332 | static void output_expanded_hierarchy_toc (cgiargsclass &args, recptproto *collectproto,
|
---|
333 | displayclass &disp, outconvertclass &outconvert,
|
---|
334 | ostream &textout, ostream &logout);
|
---|
335 |
|
---|
336 | static void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents,
|
---|
337 | int &tabcount, displayclass &disp, recptproto *collectproto,
|
---|
338 | format_t *formatlistptr, outconvertclass &outconvert,
|
---|
339 | ostream &textout, ostream &logout);
|
---|
340 |
|
---|
341 | static void output_siblings_toc (const text_t &classifytype, cgiargsclass &args,
|
---|
342 | const FilterResponse_t &siblings, int &tabcount,
|
---|
343 | displayclass &disp, format_t *formatlistptr,
|
---|
344 | outconvertclass &outconvert, ostream &textout,
|
---|
345 | ostream &logout);
|
---|
346 |
|
---|
347 | static void output_stdlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
|
---|
348 | ResultDocInfo_tarray::const_iterator &end, bool intable,
|
---|
349 | displayclass &disp, format_t *formatlistptr,
|
---|
350 | outconvertclass &outconvert, ostream &textout);
|
---|
351 |
|
---|
352 | static void output_azlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
|
---|
353 | ResultDocInfo_tarray::const_iterator &end, bool intable,
|
---|
354 | displayclass &disp, format_t *formatlistptr,
|
---|
355 | outconvertclass &outconvert, ostream &textout);
|
---|
356 |
|
---|
357 | static void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
|
---|
358 | ResultDocInfo_tarray::const_iterator &end, bool intable,
|
---|
359 | displayclass &disp, format_t *formatlistptr,
|
---|
360 | outconvertclass &outconvert, ostream &textout);
|
---|
361 |
|
---|
362 |
|
---|
363 | void output_standard_toc (const text_t &classifytype, const formatinfo_t &formatinfo,
|
---|
364 | text_t &formatstring, cgiargsclass &args,
|
---|
365 | recptproto *collectproto, displayclass &disp,
|
---|
366 | outconvertclass &outconvert, ostream &textout,
|
---|
367 | ostream &logout) {
|
---|
368 |
|
---|
369 | bool havecontrols = false;
|
---|
370 |
|
---|
371 | textout << "\n<!-- Table of Contents produced by browsetools::output_standard_toc -->\n\n";
|
---|
372 |
|
---|
373 | // get the cover image (if there is one) and the control buttons
|
---|
374 | // if we're inside a book
|
---|
375 | if (!args["d"].empty()) {
|
---|
376 | textout << "<p><table cellpadding=0 cellspacing=0><tr>\n";
|
---|
377 | textout << "<td valign=top width=200>\n";
|
---|
378 | if (formatinfo.DocumentImages)
|
---|
379 | output_cover_image (args, collectproto, disp, outconvert, textout, logout);
|
---|
380 | output_controls (args, formatinfo.DocumentButtons, collectproto, disp,
|
---|
381 | outconvert, textout, logout);
|
---|
382 | textout << "</td><td valign=top>\n";
|
---|
383 | havecontrols = true;
|
---|
384 | }
|
---|
385 |
|
---|
386 | // get table of contents
|
---|
387 | textout << "<table>\n";
|
---|
388 |
|
---|
389 | if (args.getintarg("gc"))
|
---|
390 | output_expanded_hierarchy_toc(args, collectproto, disp, outconvert, textout, logout);
|
---|
391 | else
|
---|
392 | output_contracted_hierarchy_toc(classifytype, formatstring, args, collectproto,
|
---|
393 | disp, outconvert, textout, logout);
|
---|
394 |
|
---|
395 | textout << "</table>\n";
|
---|
396 |
|
---|
397 | if (havecontrols) textout << "</td></tr></table>\n";
|
---|
398 |
|
---|
399 | textout << "\n<!-- end of Table of Contents -->\n";
|
---|
400 | }
|
---|
401 |
|
---|
402 |
|
---|
403 | void output_contracted_hierarchy_toc (const text_t &classifytype, text_t &formatstring,
|
---|
404 | cgiargsclass &args, recptproto *collectproto,
|
---|
405 | displayclass &disp, outconvertclass &outconvert,
|
---|
406 | ostream &textout, ostream &logout) {
|
---|
407 |
|
---|
408 | int tabcount = 0;
|
---|
409 | text_tarray parents, metadata;
|
---|
410 | FilterResponse_t fsiblings, fparents;
|
---|
411 | bool getParents = false;
|
---|
412 |
|
---|
413 | text_t &arg_d = args["d"];
|
---|
414 | text_t OID = arg_d;
|
---|
415 | if (OID.empty()) {
|
---|
416 | // if classifytype is an AZList we need to jump to
|
---|
417 | // the first child
|
---|
418 | if (classifytype == "AZList") OID = args["cl"] + ".fc";
|
---|
419 | else OID = args["cl"];
|
---|
420 | }
|
---|
421 |
|
---|
422 | text_t &collection = args["c"];
|
---|
423 |
|
---|
424 | // if format string is empty use the default
|
---|
425 | if (formatstring.empty())
|
---|
426 | formatstring = "<td valign=top nowrap>[link][icon][/link]</td><td>{Or}{[Title],Untitled}</td>";
|
---|
427 |
|
---|
428 | format_t *formatlistptr = new format_t();
|
---|
429 | parse_formatstring (formatstring, formatlistptr, metadata, getParents);
|
---|
430 |
|
---|
431 | metadata.push_back ("Date");
|
---|
432 | metadata.push_back ("hastxt");
|
---|
433 | metadata.push_back ("haschildren");
|
---|
434 | metadata.push_back ("doctype");
|
---|
435 | metadata.push_back ("classifytype");
|
---|
436 |
|
---|
437 | if (has_children (OID, collection, collectproto, logout)) {
|
---|
438 | get_parents_array (OID + ".fc", parents);
|
---|
439 |
|
---|
440 | if (!get_children (OID, collection, metadata, getParents,
|
---|
441 | collectproto, fsiblings, logout))
|
---|
442 | return;
|
---|
443 | } else {
|
---|
444 | get_parents_array (OID, parents);
|
---|
445 | if (!get_children (OID + ".pr", collection, metadata,
|
---|
446 | getParents, collectproto, fsiblings, logout))
|
---|
447 | return;
|
---|
448 | }
|
---|
449 | if (!get_info (parents, collection, metadata, false, collectproto, fparents, logout)) return;
|
---|
450 |
|
---|
451 | if (!fparents.docInfo.empty())
|
---|
452 | output_parents_toc(args, fparents, tabcount, disp, collectproto,
|
---|
453 | formatlistptr, outconvert, textout, logout);
|
---|
454 |
|
---|
455 | if (!fsiblings.docInfo.empty())
|
---|
456 | output_siblings_toc (classifytype, args, fsiblings, tabcount, disp,
|
---|
457 | formatlistptr, outconvert, textout, logout);
|
---|
458 | }
|
---|
459 |
|
---|
460 | void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents,
|
---|
461 | int &tabcount, displayclass &disp, recptproto *collectproto,
|
---|
462 | format_t *formatlistptr, outconvertclass &outconvert,
|
---|
463 | ostream &textout, ostream &logout) {
|
---|
464 |
|
---|
465 | text_t tab, icon;
|
---|
466 | text_t &arg_cl = args["cl"];
|
---|
467 | text_t &arg_d = args["d"];
|
---|
468 | int numcols = parents.docInfo.size() + 1;
|
---|
469 |
|
---|
470 | bool intable = is_table_content (formatlistptr);
|
---|
471 |
|
---|
472 | ResultDocInfo_tarray::const_iterator thisparent = parents.docInfo.begin();
|
---|
473 | ResultDocInfo_tarray::const_iterator end = parents.docInfo.end();
|
---|
474 |
|
---|
475 | int len = (*thisparent).metadata.size();
|
---|
476 | // const text_t &classifytype = (*thisparent).metadata[len-1].values[0];
|
---|
477 |
|
---|
478 | // don't want top level of any classifications to be displayed
|
---|
479 | if (arg_d.empty() && thisparent != end) {thisparent ++; numcols --;}
|
---|
480 |
|
---|
481 | // don't want second level of classifications using classification links
|
---|
482 | // if ((classifytype == "AZList" || classifytype == "DateList") && (thisparent != end))
|
---|
483 | // {thisparent ++; numcols --;}
|
---|
484 |
|
---|
485 | // the tab line
|
---|
486 | if (thisparent != end) {
|
---|
487 | text_t coltabs;
|
---|
488 | for (int i = 0; i < numcols; i ++) coltabs += "_document:tab_";
|
---|
489 | textout << outconvert << disp << "<tr>" << coltabs << "<td></td></tr>\n";
|
---|
490 | }
|
---|
491 |
|
---|
492 | bool first = true;
|
---|
493 | while (thisparent != end) {
|
---|
494 |
|
---|
495 | text_t link;
|
---|
496 | bool azlist = false;
|
---|
497 | // set azlist if we're in an AZList section (i.e. immediate parent
|
---|
498 | // has classifytype of AZList
|
---|
499 | if (!first && (*(thisparent-1)).metadata[len-1].values[0] == "AZList")
|
---|
500 | azlist = true;
|
---|
501 |
|
---|
502 | const text_t &doctype = (*thisparent).metadata[len-2].values.back();
|
---|
503 | bool thissection = false;
|
---|
504 |
|
---|
505 | if (!azlist) {
|
---|
506 | // set up icon and pointer
|
---|
507 | icon = "_document:icon";
|
---|
508 | if ((doctype != "classify") && ((*thisparent).OID == arg_d))
|
---|
509 | icon += "arrow";
|
---|
510 | if (doctype == "classify") icon += "openbookshelf_";
|
---|
511 | else if (is_top((*thisparent).OID)) icon += "openbook_";
|
---|
512 | else icon += "openfolder_";
|
---|
513 |
|
---|
514 | // set up the link
|
---|
515 | link = "<a href=\"_httpdocument_";
|
---|
516 | if (is_top((*thisparent).OID) && args.getintarg("x")) link = "<a name=top>";
|
---|
517 | else
|
---|
518 | if (doctype == "classify") link += "&cl=" + (*thisparent).OID + ".pr\">";
|
---|
519 | else
|
---|
520 | if (is_top ((*thisparent).OID))
|
---|
521 | if (arg_cl.empty())
|
---|
522 | link = "<a name=top>";
|
---|
523 | else if (arg_cl == "search")
|
---|
524 | link = "<a href=\"_httpquery_\">";
|
---|
525 | else
|
---|
526 | link += "&cl=" + arg_cl + "\">";
|
---|
527 | else link += "&cl=" + arg_cl + "&d=" + (*thisparent).OID + ".pr\">";
|
---|
528 | }
|
---|
529 |
|
---|
530 | if (tabcount == 1) textout << "<td></td>\n";
|
---|
531 | else if (tabcount > 1) textout << "<td colspan=" << tabcount << "></td>";
|
---|
532 |
|
---|
533 | if ((numcols-tabcount) == 1) textout << "<td>";
|
---|
534 | else if ((numcols-tabcount) > 1) textout << "<td colspan="
|
---|
535 | << (numcols-tabcount) << ">";
|
---|
536 |
|
---|
537 | if (intable) textout << "<table><tr>";
|
---|
538 |
|
---|
539 | if (azlist) {
|
---|
540 | FilterResponse_t response;
|
---|
541 | // AZLists rely on Title metadata
|
---|
542 | text_tarray metadata;
|
---|
543 | metadata.push_back ("Title");
|
---|
544 |
|
---|
545 | // need to get siblings of this classification
|
---|
546 | if (get_children ((*(thisparent-1)).OID, args["c"], metadata, false,
|
---|
547 | collectproto, response, logout)) {
|
---|
548 |
|
---|
549 | ResultDocInfo_tarray::const_iterator thissib = response.docInfo.begin();
|
---|
550 | ResultDocInfo_tarray::const_iterator endsib = response.docInfo.end();
|
---|
551 |
|
---|
552 | while (thissib != endsib) {
|
---|
553 | link = "<a href=\"_httpdocument_&cl=" + (*thissib).OID + "\">";
|
---|
554 | const text_t &title = (*thissib).metadata[0].values.back();
|
---|
555 | if ((*thissib).OID == (*thisparent).OID)
|
---|
556 | textout << outconvert << disp << "<b>" << title << "</b>\n";
|
---|
557 | else textout << outconvert << disp << link << title << "</a>\n";
|
---|
558 | thissib ++;
|
---|
559 | }
|
---|
560 | }
|
---|
561 | } else {
|
---|
562 | textout << outconvert << disp
|
---|
563 | << get_formatted_string (*thisparent, formatlistptr, link, icon);
|
---|
564 | }
|
---|
565 |
|
---|
566 | if (intable) textout << "</tr></table>";
|
---|
567 | textout << "</td></tr>\n";
|
---|
568 |
|
---|
569 | first = false;
|
---|
570 | tabcount ++;
|
---|
571 | thisparent ++;
|
---|
572 | }
|
---|
573 | }
|
---|
574 |
|
---|
575 |
|
---|
576 | void output_siblings_toc (const text_t &classifytype, cgiargsclass &args,
|
---|
577 | const FilterResponse_t &siblings, int &tabcount,
|
---|
578 | displayclass &disp, format_t *formatlistptr,
|
---|
579 | outconvertclass &outconvert, ostream &textout,
|
---|
580 | ostream &/*logout*/) {
|
---|
581 |
|
---|
582 | bool intable = is_table_content (formatlistptr);
|
---|
583 |
|
---|
584 | ResultDocInfo_tarray::const_iterator thissibling = siblings.docInfo.begin();
|
---|
585 | ResultDocInfo_tarray::const_iterator sibend = siblings.docInfo.end();
|
---|
586 |
|
---|
587 | if (thissibling == sibend) return;
|
---|
588 |
|
---|
589 | // tabbing
|
---|
590 | if (tabcount) {
|
---|
591 | if (tabcount == 1) textout << "<tr><td></td>\n";
|
---|
592 | else if (tabcount > 1) textout << "<tr><td colspan=" << tabcount << "></td>";
|
---|
593 | textout << "<td><table>\n";
|
---|
594 | }
|
---|
595 |
|
---|
596 | if (!intable) textout << "<tr><td>\n";
|
---|
597 |
|
---|
598 | if (classifytype == "DateList")
|
---|
599 | output_datelist (args, thissibling, sibend, intable, disp,
|
---|
600 | formatlistptr, outconvert, textout);
|
---|
601 | else
|
---|
602 | output_stdlist (args, thissibling, sibend, intable, disp,
|
---|
603 | formatlistptr, outconvert, textout);
|
---|
604 |
|
---|
605 | if (!intable) textout << "</td></tr></table>\n";
|
---|
606 | if (tabcount) textout << "</table></td></tr>\n";
|
---|
607 | }
|
---|
608 |
|
---|
609 | void output_stdlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
|
---|
610 | ResultDocInfo_tarray::const_iterator &end, bool intable,
|
---|
611 | displayclass &disp, format_t *formatlistptr,
|
---|
612 | outconvertclass &outconvert, ostream &textout) {
|
---|
613 |
|
---|
614 | text_t icon;
|
---|
615 | int count = 1;
|
---|
616 | int gt = args.getintarg("gt");
|
---|
617 | text_t &arg_cl = args["cl"];
|
---|
618 | text_t &arg_d = args["d"];
|
---|
619 |
|
---|
620 | while (here != end) {
|
---|
621 |
|
---|
622 | int len = (*here).metadata.size();
|
---|
623 | const text_t &doctype = (*here).metadata[len-2].values.back();
|
---|
624 | const text_t &hastxt = (*here).metadata[len-4].values.back();
|
---|
625 | const text_t &haschildren = (*here).metadata[len-3].values.back();
|
---|
626 |
|
---|
627 | // set up icon and pointer
|
---|
628 | icon = "_document:icon";
|
---|
629 | if (doctype == "classify") {
|
---|
630 | if (((*here).OID == arg_cl) && (hastxt == "1"))
|
---|
631 | icon += "arrow";
|
---|
632 | } else if ((*here).OID == arg_d) icon += "arrow";
|
---|
633 |
|
---|
634 | if (haschildren == "0") icon += "smalltext_";
|
---|
635 | else if (doctype == "classify") icon += "closedbookshelf_";
|
---|
636 | else if (is_top((*here).OID)) icon += "closedbook_";
|
---|
637 | else icon += "closedfolder_";
|
---|
638 |
|
---|
639 | // set up link
|
---|
640 | text_t link = "<a href=\"_httpdocument_";
|
---|
641 | if (doctype == "classify") link += "&cl=" + (*here).OID + "\">";
|
---|
642 | else link += "&cl=" + arg_cl + "&d=" + (*here).OID + "\">";
|
---|
643 | if (gt) {
|
---|
644 | link = "<a href=\"#" + text_t(count) + "\">";
|
---|
645 | count ++;
|
---|
646 | }
|
---|
647 |
|
---|
648 | if (intable) textout << "<tr>";
|
---|
649 |
|
---|
650 | textout << outconvert << disp
|
---|
651 | << get_formatted_string (*here, formatlistptr, link, icon) << "\n";
|
---|
652 |
|
---|
653 | if (intable) textout << "</tr>";
|
---|
654 |
|
---|
655 | here ++;
|
---|
656 | }
|
---|
657 | }
|
---|
658 |
|
---|
659 |
|
---|
660 | void output_azlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
|
---|
661 | ResultDocInfo_tarray::const_iterator &end, bool intable,
|
---|
662 | displayclass &disp, format_t *formatlistptr,
|
---|
663 | outconvertclass &outconvert, ostream &textout) {
|
---|
664 |
|
---|
665 | int count = 1;
|
---|
666 | int gt = args.getintarg("gt");
|
---|
667 | text_t &arg_cl = args["cl"];
|
---|
668 | text_t &arg_d = args["d"];
|
---|
669 | text_t link;
|
---|
670 |
|
---|
671 | if (intable) textout << "<tr><td>";
|
---|
672 |
|
---|
673 | while (here != end) {
|
---|
674 |
|
---|
675 | bool thissec = false;
|
---|
676 | int len = (*here).metadata.size();
|
---|
677 | const text_t &doctype = (*here).metadata[len-2].values.back();
|
---|
678 | const text_t &hastxt = (*here).metadata[len-4].values.back();
|
---|
679 | // AZLists are assumed to use Title metadata
|
---|
680 | const text_t &title = (*here).metadata[len-6].values.back();
|
---|
681 |
|
---|
682 | // bail on this document if it has no title
|
---|
683 | if (title.empty()) continue;
|
---|
684 |
|
---|
685 | if (doctype == "classify") {
|
---|
686 | if ((*here).OID == arg_cl) thissec = true;
|
---|
687 | } else if ((*here).OID == arg_d) thissec = true;
|
---|
688 |
|
---|
689 | // set up link
|
---|
690 | if (!thissec) {
|
---|
691 | link = "<a href=\"_httpdocument_";
|
---|
692 | if (doctype == "classify") link += "&cl=" + (*here).OID + "\">";
|
---|
693 | else link += "&cl=" + arg_cl + "&d=" + (*here).OID + "\">";
|
---|
694 | if (gt) {
|
---|
695 | link = "<a href=\"#" + text_t(count) + "\">";
|
---|
696 | count ++;
|
---|
697 | }
|
---|
698 | }
|
---|
699 |
|
---|
700 | if (thissec)
|
---|
701 | textout << outconvert << disp << "<b>" << title << "</b>\n";
|
---|
702 | else
|
---|
703 | textout << outconvert << disp << link << title << "</a>\n";
|
---|
704 |
|
---|
705 | here ++;
|
---|
706 | }
|
---|
707 |
|
---|
708 | if (intable) textout << "</td></tr>";
|
---|
709 | }
|
---|
710 |
|
---|
711 | void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
|
---|
712 | ResultDocInfo_tarray::const_iterator &end, bool intable,
|
---|
713 | displayclass &disp, format_t *formatlistptr,
|
---|
714 | outconvertclass &outconvert, ostream &textout) {
|
---|
715 |
|
---|
716 | text_t lastyear = "0000";
|
---|
717 | text_t lastmonth = "00";
|
---|
718 |
|
---|
719 | while (here != end) {
|
---|
720 |
|
---|
721 | int len = (*here).metadata.size();
|
---|
722 | const text_t &doctype = (*here).metadata[len-2].values.back();
|
---|
723 | const text_t &date = (*here).metadata[len-5].values.back();
|
---|
724 |
|
---|
725 | // bail on this document if it has no date
|
---|
726 | if (date.empty()) continue;
|
---|
727 |
|
---|
728 | text_t::const_iterator datebegin = date.begin();
|
---|
729 | int datesize = date.size();
|
---|
730 |
|
---|
731 | if (datesize < 4) continue;
|
---|
732 | text_t thisyear = substr (datebegin, datebegin+4);
|
---|
733 | text_t thismonth = "00";
|
---|
734 | if (datesize >= 6)
|
---|
735 | thismonth = substr (datebegin+4, datebegin+6);
|
---|
736 |
|
---|
737 | text_t link = "<a href=\"_httpdocument_&cl=";
|
---|
738 | text_t icon = "_document:iconclosedbook_";
|
---|
739 |
|
---|
740 | if (doctype == "classify") {
|
---|
741 | icon = "_document:iconclosedbookshelf_";
|
---|
742 | link += (*here).OID + "\">";
|
---|
743 | } else link += args["cl"] + "&d=" + (*here).OID + "\">";
|
---|
744 |
|
---|
745 | textout << "<tr>\n";
|
---|
746 |
|
---|
747 | if (thisyear != lastyear) {
|
---|
748 | textout << outconvert << "<td><b>" << thisyear << "</b></td>";
|
---|
749 | lastyear = thisyear;
|
---|
750 | } else
|
---|
751 | textout << "<td></td>";
|
---|
752 |
|
---|
753 | if (thismonth != lastmonth) {
|
---|
754 | textout << outconvert << disp << ("<td><b>_textmonth" + thismonth + "_</b></td>");
|
---|
755 | lastmonth = thismonth;
|
---|
756 | } else
|
---|
757 | textout << "<td></td>";
|
---|
758 |
|
---|
759 | if (!intable) textout << "<td>\n";
|
---|
760 |
|
---|
761 | textout << outconvert << disp
|
---|
762 | << get_formatted_string (*here, formatlistptr, link, icon) << "\n";
|
---|
763 |
|
---|
764 | if (!intable) textout << "</td>";
|
---|
765 |
|
---|
766 | textout << "</tr>\n";
|
---|
767 |
|
---|
768 | here ++;
|
---|
769 | }
|
---|
770 | }
|
---|
771 |
|
---|
772 | void output_expanded_hierarchy_toc (cgiargsclass &args, recptproto *collectproto,
|
---|
773 | displayclass &disp, outconvertclass &outconvert,
|
---|
774 | ostream &textout, ostream &logout) {
|
---|
775 |
|
---|
776 | text_t OID, topOID, classifytype, icon;
|
---|
777 | FilterResponse_t response;
|
---|
778 | int tabcols=0, totalcols=0, lasttabcols=0;
|
---|
779 |
|
---|
780 | int gt = args.getintarg("gt");
|
---|
781 | text_t doclink = "<a href=\"_httpdocument_&cl=";
|
---|
782 |
|
---|
783 | text_t &arg_d = args["d"];
|
---|
784 | text_t &arg_cl = args["cl"];
|
---|
785 |
|
---|
786 | if (arg_d.empty()) {
|
---|
787 | if (arg_cl.empty()) return;
|
---|
788 | OID = arg_cl;
|
---|
789 | topOID = OID; // don't always want to expand from top if expanding classifications
|
---|
790 | classifytype = "classify";
|
---|
791 | } else {
|
---|
792 | OID = arg_d;
|
---|
793 | get_top (arg_d, topOID);
|
---|
794 | classifytype = "Document";
|
---|
795 | }
|
---|
796 |
|
---|
797 | // Get OIDs and metadata of all topOIDs contents (and topOID itself)
|
---|
798 | text_tarray metadata;
|
---|
799 | metadata.push_back ("Title");
|
---|
800 | metadata.push_back ("haschildren");
|
---|
801 | metadata.push_back ("doctype");
|
---|
802 | // metadata.push_back ("hastxt");
|
---|
803 |
|
---|
804 | get_contents (topOID, classifytype, metadata, totalcols,
|
---|
805 | args["c"], collectproto, response, logout);
|
---|
806 | int excess = countchar (topOID.begin(), topOID.end(), '.');
|
---|
807 | totalcols -= excess;
|
---|
808 |
|
---|
809 | // allow for pointer
|
---|
810 | if (classifytype == "Document" && !gt) totalcols += 2;
|
---|
811 | else totalcols += 1;
|
---|
812 |
|
---|
813 | ResultDocInfo_tarray::const_iterator thissection = response.docInfo.begin();
|
---|
814 | ResultDocInfo_tarray::const_iterator lastsection = response.docInfo.end();
|
---|
815 |
|
---|
816 | int count = 1;
|
---|
817 | while (thissection != lastsection) {
|
---|
818 |
|
---|
819 | const text_t &title = (*thissection).metadata[0].values[0];
|
---|
820 | const int haschildren = (*thissection).metadata[1].values[0].getint();
|
---|
821 | const text_t &doctype = (*thissection).metadata[2].values[0];
|
---|
822 |
|
---|
823 | text_t icontabs, tab, pointer;
|
---|
824 |
|
---|
825 | // set up icon
|
---|
826 | icon = "_document:iconsmalltext_";
|
---|
827 | if (is_top((*thissection).OID))
|
---|
828 | if (classifytype == "Document") icon = "_document:iconopenbook_";
|
---|
829 | else
|
---|
830 | if (doctype == "classify") icon = "_document:iconopenbookshelf_";
|
---|
831 | else icon = "_document:iconclosedbook_";
|
---|
832 | else if (haschildren)
|
---|
833 | if (classifytype == "Document") icon = "_document:iconopenfolder_";
|
---|
834 | else icon = "_document:iconopenbookshelf_";
|
---|
835 |
|
---|
836 | // set up tabbing
|
---|
837 | if ((classifytype == "classify") && (doctype != "classify"))
|
---|
838 | tabcols = lasttabcols + 1;
|
---|
839 | else {
|
---|
840 | tabcols = countchar ((*thissection).OID.begin(), (*thissection).OID.end(), '.');
|
---|
841 | lasttabcols = tabcols;
|
---|
842 | }
|
---|
843 | tabcols -= excess;
|
---|
844 |
|
---|
845 | for (int i = 0; i < tabcols; i++)
|
---|
846 | icontabs += "_document:icontab_";
|
---|
847 |
|
---|
848 | // set up pointer
|
---|
849 | if (classifytype == "Document" && !gt) {
|
---|
850 | if ((*thissection).OID == OID) pointer = "_document:iconpointer_";
|
---|
851 | else pointer = "_document:icontab_";
|
---|
852 | tabcols ++;
|
---|
853 | }
|
---|
854 |
|
---|
855 | int colsremaining = totalcols - tabcols;
|
---|
856 |
|
---|
857 | if (tabcols > 0) {
|
---|
858 | tab = "<td";
|
---|
859 | if (tabcols > 1) tab += " colspan=" + text_t(tabcols);
|
---|
860 | tab += ">" + icontabs + pointer + "</td>";
|
---|
861 | }
|
---|
862 |
|
---|
863 | textout << outconvert << disp << "<tr>" << tab << "<td>";
|
---|
864 |
|
---|
865 | if ((classifytype == "Document") && (is_top((*thissection).OID)) &&
|
---|
866 | (args.getintarg("x")))
|
---|
867 | textout << outconvert << disp << icon << "</td><td";
|
---|
868 |
|
---|
869 | else {
|
---|
870 | if (!gt) {
|
---|
871 | const text_t &thisOID = (*thissection).OID;
|
---|
872 | text_t link;
|
---|
873 | if (is_top (thisOID))
|
---|
874 | if (classifytype == "classify")
|
---|
875 | link = doclink + arg_cl + "&d=" + thisOID + "\">";
|
---|
876 | else
|
---|
877 | if (arg_cl.empty())
|
---|
878 | link.clear();
|
---|
879 | else if (arg_cl == "search")
|
---|
880 | link = "<a href=\"_httpquery_\">";
|
---|
881 | else
|
---|
882 | link = doclink + arg_cl + "\">";
|
---|
883 | else
|
---|
884 | if (haschildren)
|
---|
885 | if (classifytype == "classify")
|
---|
886 | link = doclink + thisOID + ".pr\">";
|
---|
887 | else
|
---|
888 | link = doclink + arg_cl + "&d=" + thisOID + ".pr\">";
|
---|
889 | else
|
---|
890 | if (classifytype == "classify")
|
---|
891 | link = doclink + thisOID + "\">";
|
---|
892 | else
|
---|
893 | link = doclink + arg_cl + "&d=" + thisOID + "\">";
|
---|
894 |
|
---|
895 | textout << outconvert << disp << link;
|
---|
896 | } else {
|
---|
897 | textout << "<a href=\"#" << count << "\">";
|
---|
898 | count ++;
|
---|
899 | }
|
---|
900 |
|
---|
901 | textout << outconvert << disp << icon << "</a></td><td";
|
---|
902 | }
|
---|
903 | if (colsremaining > 1) textout << " colspan=" << colsremaining;
|
---|
904 | textout << outconvert << disp << ">" << title << "</td></tr>\n";
|
---|
905 |
|
---|
906 | thissection ++;
|
---|
907 | }
|
---|
908 | }
|
---|
909 |
|
---|
910 | /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
---|
911 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
|
---|
912 |
|
---|
913 | // set_arrow_macros sets the _httpprevarrow_ and _httpnextarrow_ macros
|
---|
914 | // it shouldn't be called if OID is the top level of a book
|
---|
915 | // as the "hasprevious" and "hasnext" metadata won't be set
|
---|
916 | // when the filter can't get OIDs parent info - one day I'll
|
---|
917 | // fix this ;-)
|
---|
918 | void set_arrow_macros (const text_t &OID, const text_t &classifytype,
|
---|
919 | bool showtoppage, displayclass &disp,
|
---|
920 | recptproto *collectproto, const text_t &collection,
|
---|
921 | ostream &logout) {
|
---|
922 |
|
---|
923 | if (OID.empty()) return;
|
---|
924 |
|
---|
925 | text_tarray metadata;
|
---|
926 | FilterResponse_t response;
|
---|
927 |
|
---|
928 | metadata.push_back ("haschildren");
|
---|
929 | metadata.push_back ("hasnext");
|
---|
930 | metadata.push_back ("hasprevious");
|
---|
931 | // get "haschildren", "hasnext" and "hasprevious" metadata for OID
|
---|
932 | if (get_info (OID, collection, metadata, false, collectproto, response, logout)) {
|
---|
933 |
|
---|
934 | text_t haschildren = response.docInfo[0].metadata[0].values[0];
|
---|
935 | text_t hasnext = response.docInfo[0].metadata[1].values[0];
|
---|
936 | text_t hasprevious = response.docInfo[0].metadata[2].values[0];
|
---|
937 |
|
---|
938 | if ((classifytype == "Hierarchy") || (classifytype == "Book")) {
|
---|
939 | if (haschildren == "1")
|
---|
940 | disp.setmacro ("httpnextarrow", "document",
|
---|
941 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.fc,_httpdocument_&cl=_cgiargcl_.fc)");
|
---|
942 | else if (hasnext == "1")
|
---|
943 | disp.setmacro ("httpnextarrow", "document",
|
---|
944 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ns,_httpdocument_&cl=_cgiargcl_.ns)");
|
---|
945 | else {
|
---|
946 | // see if parent has younger siblings
|
---|
947 | if (get_info (OID + ".pr", collection, metadata, false, collectproto, response, logout)) {
|
---|
948 | if (!response.docInfo[0].metadata.empty() &&
|
---|
949 | response.docInfo[0].metadata[1].values[0] == "1")
|
---|
950 | disp.setmacro ("httpnextarrow", "document",
|
---|
951 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.pr.ns,_httpdocument_&cl=_cgiargcl_.pr.ns)");
|
---|
952 | }
|
---|
953 | }
|
---|
954 |
|
---|
955 | if (hasprevious == "1") {
|
---|
956 | // see if OIDs older sibling has children
|
---|
957 | if (get_info (OID + ".ps", collection, metadata, false, collectproto, response, logout)) {
|
---|
958 | if (response.docInfo[0].metadata[0].values[0] == "1")
|
---|
959 | disp.setmacro ("httpprevarrow", "document",
|
---|
960 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps.lc,_httpdocument_&cl=_cgiargcl_.ps.lc)");
|
---|
961 | else
|
---|
962 | disp.setmacro ("httpprevarrow", "document",
|
---|
963 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps,_httpdocument_&cl=_cgiargcl_.ps)");
|
---|
964 | }
|
---|
965 | } else if (showtoppage && !is_top (OID))
|
---|
966 | disp.setmacro ("httpprevarrow", "document",
|
---|
967 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.pr,_httpdocument_&cl=_cgiargcl_.pr)");
|
---|
968 | }
|
---|
969 |
|
---|
970 | else {
|
---|
971 | if (hasnext == "1")
|
---|
972 | disp.setmacro ("httpnextarrow", "document",
|
---|
973 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ns,_httpdocument_&cl=_cgiargcl_.ns)");
|
---|
974 | if (hasprevious == "1")
|
---|
975 | disp.setmacro ("httpprevarrow", "document",
|
---|
976 | "_If_(_cgiargd_,_httpdocument_&cl=_cgiargcl_&d=_cgiargd_.ps,_httpdocument_&cl=_cgiargcl_.ps)");
|
---|
977 | }
|
---|
978 | }
|
---|
979 | }
|
---|