1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * pageaction.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: pageaction.cpp 875 2000-01-26 20:11:04Z sjboddie $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*
|
---|
29 | $Log$
|
---|
30 | Revision 1.25 2000/01/26 20:11:04 sjboddie
|
---|
31 | added some collection specific help text
|
---|
32 |
|
---|
33 | Revision 1.24 2000/01/25 22:31:09 sjboddie
|
---|
34 | more hacky changes to get preferences to be a bit smarter
|
---|
35 |
|
---|
36 | Revision 1.23 2000/01/24 22:59:57 sjboddie
|
---|
37 | changes to set macros differently for preferences page depending
|
---|
38 | on type of collection - pageaction is getting kind of hacky - should
|
---|
39 | tidy it up some day
|
---|
40 |
|
---|
41 | Revision 1.22 1999/11/25 23:01:09 sjboddie
|
---|
42 | now need to be able to handle it if no collection is selected
|
---|
43 |
|
---|
44 | Revision 1.21 1999/11/03 22:50:13 sjboddie
|
---|
45 | now defaults to home page
|
---|
46 |
|
---|
47 | Revision 1.20 1999/11/01 21:58:02 sjboddie
|
---|
48 | changes to arguments of many functions, now pass list of protocols
|
---|
49 | instead of just that for this collection
|
---|
50 |
|
---|
51 | Revision 1.19 1999/10/19 21:59:09 sjboddie
|
---|
52 | bug in generating "how to find information" text for about pages
|
---|
53 |
|
---|
54 | Revision 1.18 1999/10/19 03:23:44 davidb
|
---|
55 | Collection building support through web pages
|
---|
56 | and internal and external link handling for collection documents
|
---|
57 |
|
---|
58 | Revision 1.17 1999/10/14 23:04:44 sjboddie
|
---|
59 | some hacks to make nzdl home page look right
|
---|
60 |
|
---|
61 | Revision 1.16 1999/10/10 08:14:09 sjboddie
|
---|
62 | - metadata now returns mp rather than array
|
---|
63 | - redesigned browsing support (although it's not finished so
|
---|
64 | won't currently work ;-)
|
---|
65 |
|
---|
66 | Revision 1.15 1999/09/17 04:46:05 sjboddie
|
---|
67 | fixed a couple of problems with 'unknown' classifier
|
---|
68 |
|
---|
69 | Revision 1.14 1999/09/07 23:08:09 rjmcnab
|
---|
70 | Removed some compiler warnings
|
---|
71 |
|
---|
72 | Revision 1.13 1999/09/07 04:56:57 sjboddie
|
---|
73 | added GPL notice
|
---|
74 |
|
---|
75 | Revision 1.12 1999/09/02 00:26:43 rjmcnab
|
---|
76 | made the p cgi argument always saved in the compressed arguments
|
---|
77 |
|
---|
78 | Revision 1.11 1999/08/25 04:48:43 sjboddie
|
---|
79 | changes to the home and about pages
|
---|
80 |
|
---|
81 | Revision 1.10 1999/08/11 23:29:43 sjboddie
|
---|
82 | added support for html classifier (i.e. the hp argument)
|
---|
83 |
|
---|
84 | Revision 1.9 1999/08/03 03:29:47 sjboddie
|
---|
85 | added ability to set receptionist from collect.cfg
|
---|
86 |
|
---|
87 | Revision 1.8 1999/07/30 02:24:44 sjboddie
|
---|
88 | added collectinfo argument to some functions
|
---|
89 |
|
---|
90 | Revision 1.7 1999/06/24 05:12:24 sjboddie
|
---|
91 | lots of small changes
|
---|
92 |
|
---|
93 | Revision 1.6 1999/06/10 00:39:16 sjboddie
|
---|
94 | navigation bar is no longer written out for every page (it should
|
---|
95 | be included in the _content_ macro of pages wanting to display it).
|
---|
96 |
|
---|
97 | Revision 1.5 1999/06/08 04:29:35 sjboddie
|
---|
98 | added argsinfo to the call to check_cgiargs to make it easy to set
|
---|
99 | args to their default if they're found to be screwed up
|
---|
100 |
|
---|
101 | Revision 1.4 1999/02/28 20:00:14 rjmcnab
|
---|
102 |
|
---|
103 |
|
---|
104 | Fixed a few things.
|
---|
105 |
|
---|
106 | Revision 1.3 1999/02/25 21:58:58 rjmcnab
|
---|
107 |
|
---|
108 | Merged sources.
|
---|
109 |
|
---|
110 | Revision 1.2 1999/02/21 22:33:54 rjmcnab
|
---|
111 |
|
---|
112 | Lots of stuff :-)
|
---|
113 |
|
---|
114 | Revision 1.1 1999/02/12 02:40:17 sjboddie
|
---|
115 |
|
---|
116 | Added page action
|
---|
117 |
|
---|
118 | */
|
---|
119 |
|
---|
120 | #include "OIDtools.h"
|
---|
121 | #include "pageaction.h"
|
---|
122 | #include "receptionist.h"
|
---|
123 | #include <time.h>
|
---|
124 |
|
---|
125 | pageaction::pageaction () {
|
---|
126 |
|
---|
127 | recpt = NULL;
|
---|
128 |
|
---|
129 | // this action uses cgi variables "a", "p", and "hp"
|
---|
130 | cgiarginfo arg_ainfo;
|
---|
131 | arg_ainfo.shortname = "a";
|
---|
132 | arg_ainfo.longname = "action";
|
---|
133 | arg_ainfo.multiplechar = true;
|
---|
134 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
135 | arg_ainfo.argdefault = "p";
|
---|
136 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
137 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
138 |
|
---|
139 | arg_ainfo.shortname = "p";
|
---|
140 | arg_ainfo.longname = "page";
|
---|
141 | arg_ainfo.multiplechar = true;
|
---|
142 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
143 | arg_ainfo.argdefault = "home";
|
---|
144 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
145 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
146 |
|
---|
147 | arg_ainfo.shortname = "hp";
|
---|
148 | arg_ainfo.longname = "html page";
|
---|
149 | arg_ainfo.multiplechar = true;
|
---|
150 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
151 | arg_ainfo.argdefault = "";
|
---|
152 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
153 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
154 | }
|
---|
155 |
|
---|
156 | pageaction::~pageaction () {
|
---|
157 | }
|
---|
158 |
|
---|
159 | bool pageaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &/*args*/,
|
---|
160 | ostream &/*logout*/) {
|
---|
161 | // don't want to check anything yet.
|
---|
162 | return true;
|
---|
163 | }
|
---|
164 |
|
---|
165 | void pageaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
|
---|
166 | response_t &response,text_t &response_data,
|
---|
167 | ostream &/*logout*/) {
|
---|
168 | response = content;
|
---|
169 | response_data = "text/html";
|
---|
170 | }
|
---|
171 |
|
---|
172 | void pageaction::set_homeextra_macro (displayclass &disp, recptprotolistclass *protos,
|
---|
173 | ostream &logout) {
|
---|
174 |
|
---|
175 | text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n";
|
---|
176 |
|
---|
177 | recptprotolistclass::iterator rprotolist_here = protos->begin();
|
---|
178 | recptprotolistclass::iterator rprotolist_end = protos->end();
|
---|
179 | while (rprotolist_here != rprotolist_end) {
|
---|
180 | if ((*rprotolist_here).p != NULL) {
|
---|
181 |
|
---|
182 | text_tarray collist;
|
---|
183 | comerror_t err;
|
---|
184 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
185 | if (err == noError) {
|
---|
186 | text_tarray::iterator collist_here = collist.begin();
|
---|
187 | text_tarray::iterator collist_end = collist.end();
|
---|
188 |
|
---|
189 | int row1 = 7;
|
---|
190 | int row2 = 5;
|
---|
191 | int count = 1;
|
---|
192 | while (collist_here != collist_end) {
|
---|
193 |
|
---|
194 | if (*collist_here == "niupepa")
|
---|
195 | homeextra += "<p><a href=\"_httpmusiclibrary_\">_iconmusiclibrary_</a>\n";
|
---|
196 |
|
---|
197 | ColInfoResponse_t cinfo;
|
---|
198 | (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
|
---|
199 |
|
---|
200 | if (err == noError) {
|
---|
201 | if (cinfo.isPublic && (cinfo.buildDate > 0)) {
|
---|
202 |
|
---|
203 | FilterResponse_t response;
|
---|
204 | text_tset metadata;
|
---|
205 | metadata.insert ("collectionname");
|
---|
206 | metadata.insert ("iconcollection");
|
---|
207 | metadata.insert ("iconcollectionsmall");
|
---|
208 | text_t collectionname = *collist_here;
|
---|
209 | text_t alt = collectionname;
|
---|
210 | if (get_info ("collection", *collist_here, metadata, false,
|
---|
211 | (*rprotolist_here).p, response, logout)) {
|
---|
212 | if (!response.docInfo[0].metadata["collectionname"].values[0].empty())
|
---|
213 | alt = response.docInfo[0].metadata["collectionname"].values[0];
|
---|
214 |
|
---|
215 | if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty())
|
---|
216 | collectionname = "<img width=150 border=1 src=\""
|
---|
217 | + response.docInfo[0].metadata["iconcollectionsmall"].values[0]
|
---|
218 | + "\" alt=\"" + alt + "\">";
|
---|
219 | else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty())
|
---|
220 | collectionname = "<img width=150 border=1 src=\""
|
---|
221 | + response.docInfo[0].metadata["iconcollection"].values[0]
|
---|
222 | + "\" alt=\"" + alt + "\">";
|
---|
223 | else collectionname = alt;
|
---|
224 | }
|
---|
225 |
|
---|
226 | if ((count == 1) || (count == (row1+1)) || (count == ((row1+row2)+1)))
|
---|
227 | homeextra += "<td align=center>";
|
---|
228 | else homeextra += "<p>";
|
---|
229 | text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">";
|
---|
230 | if (*collist_here == "chinese")
|
---|
231 | link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">";
|
---|
232 | if (*collist_here == "arabic")
|
---|
233 | link = "<a href=\"_gwcgi_?a=p&p=about&w=a&c=" + *collist_here + "\">";
|
---|
234 |
|
---|
235 | if (!cinfo.receptionist.empty())
|
---|
236 | link = "<a href=\"" + cinfo.receptionist + "\">";
|
---|
237 |
|
---|
238 | homeextra += link + collectionname + "</a>\n";
|
---|
239 |
|
---|
240 | if ((count == row1) || (count == (row1+row2)))
|
---|
241 | homeextra += "</td>";
|
---|
242 |
|
---|
243 | count ++;
|
---|
244 | }
|
---|
245 | }
|
---|
246 |
|
---|
247 | collist_here ++;
|
---|
248 | }
|
---|
249 | homeextra += "</tr></table></center>\n";
|
---|
250 | disp.setmacro ("homeextra", "home", homeextra);
|
---|
251 | }
|
---|
252 | }
|
---|
253 | rprotolist_here ++;
|
---|
254 | }
|
---|
255 | }
|
---|
256 |
|
---|
257 | void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
258 | recptprotolistclass *protos, ostream &logout) {
|
---|
259 |
|
---|
260 | // define_internal_macros sets the following macros:
|
---|
261 |
|
---|
262 | // _numdocs_ the number of documents in the collection
|
---|
263 |
|
---|
264 | // _builddate_ the date last built
|
---|
265 |
|
---|
266 |
|
---|
267 | // if page is "home"
|
---|
268 | // _homeextra_ this is the list of available collections and collection info
|
---|
269 | // to be displayed on the home page
|
---|
270 |
|
---|
271 |
|
---|
272 | // if page is "preferences"
|
---|
273 | // _collectionoption_ collections to search/browse (if cross-collection-searching is on)
|
---|
274 |
|
---|
275 | // _htmloptions_ set to _htmloptionson_ if DocumentUseHTML is set
|
---|
276 |
|
---|
277 | // _PreferencesDocsFromWeb_ set to 1 if corresponding format option is set
|
---|
278 |
|
---|
279 | // _languageoption_ interface languages to select from (dependant on PreferenceLanguages)
|
---|
280 |
|
---|
281 | // _encodingoption_ will be overridden to "" if chinese language interface isn't specified
|
---|
282 |
|
---|
283 | // if page is "about"
|
---|
284 | // _textsubcollections_ the text on which subcollections make up the collection (if
|
---|
285 | // cross-collection searching is being used
|
---|
286 |
|
---|
287 | // _textbrowseoptions_ the 'how to find information' text in the about and help pages
|
---|
288 |
|
---|
289 | // _numbrowseoptions_ the number of browsing options
|
---|
290 |
|
---|
291 |
|
---|
292 | // if page is "help"
|
---|
293 | // _textbrowseoptions_ the 'how to find information' text in the about and help pages
|
---|
294 |
|
---|
295 | // _numbrowseoptions_ the number of browsing options
|
---|
296 |
|
---|
297 | // _topicreadingdocs_ this section of the help text differs depending on what type of
|
---|
298 | // _textreadingdocs_ collection it is (e.g. html collection, bibliographic collection etc.)
|
---|
299 | // _texthelpreadingdocs_
|
---|
300 |
|
---|
301 |
|
---|
302 | text_t &arg_p = args["p"];
|
---|
303 | text_t &arg_c = args["c"];
|
---|
304 | ColInfoResponse_t cinfo;
|
---|
305 | comerror_t err;
|
---|
306 |
|
---|
307 | recptproto* collectproto = protos->getrecptproto (arg_c, logout);
|
---|
308 | if (collectproto != NULL) {
|
---|
309 | collectproto->get_collectinfo (arg_c, cinfo, err, logout);
|
---|
310 |
|
---|
311 | disp.setmacro ("numdocs", "Global", cinfo.numDocs);
|
---|
312 | unsigned long current_time = time(NULL);
|
---|
313 | unsigned long builddate = (current_time - cinfo.buildDate) / 86400;
|
---|
314 | disp.setmacro ("builddate", "Global", builddate);
|
---|
315 | }
|
---|
316 |
|
---|
317 | if (arg_p == "home") set_homeextra_macro (disp, protos, logout);
|
---|
318 |
|
---|
319 | else if (arg_p == "preferences") {
|
---|
320 |
|
---|
321 | // _collectionoption_
|
---|
322 |
|
---|
323 | if (args["ccs"] == "1" && collectproto != NULL && (cinfo.ccsCols.size() > 1)) {
|
---|
324 | text_t collectionoption = "_textcollectionoption_";
|
---|
325 | text_tarray::const_iterator col_here = cinfo.ccsCols.begin();
|
---|
326 | text_tarray::const_iterator col_end = cinfo.ccsCols.end();
|
---|
327 | while (col_here != col_end) {
|
---|
328 | text_t colname;
|
---|
329 | if (*col_here == arg_c) {
|
---|
330 | colname = cinfo.collectionmeta["collectionname"];
|
---|
331 | } else {
|
---|
332 | ColInfoResponse_t this_cinfo;
|
---|
333 | collectproto->get_collectinfo (*col_here, this_cinfo, err, logout);
|
---|
334 | colname = this_cinfo.collectionmeta["collectionname"];
|
---|
335 | }
|
---|
336 |
|
---|
337 | collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
|
---|
338 | *col_here + "\" onClick=\"updatecc(\'" + *col_here + "\');\"> " +
|
---|
339 | colname + "<br>\n";
|
---|
340 | col_here ++;
|
---|
341 | }
|
---|
342 |
|
---|
343 | disp.setmacro ("collectionoption", "preferences", collectionoption);
|
---|
344 | }
|
---|
345 |
|
---|
346 | // _htmloptions_
|
---|
347 |
|
---|
348 | text_tmap::const_iterator it = cinfo.format.find ("DocumentUseHTML");
|
---|
349 | if ((it != cinfo.format.end()) && ((*it).second == "true")) {
|
---|
350 | disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
|
---|
351 |
|
---|
352 |
|
---|
353 | // _PreferenceDocsFromWeb_
|
---|
354 |
|
---|
355 | it = cinfo.format.find ("PreferenceDocsFromWeb");
|
---|
356 | if ((it == cinfo.format.end()) || ((*it).second == "true"))
|
---|
357 | disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
|
---|
358 | }
|
---|
359 |
|
---|
360 | // _languageoption_
|
---|
361 | // this is kind of a hack (another one!!). note that there're potential
|
---|
362 | // problems here as no checking is done anywhere to make sure language
|
---|
363 | // is set to a valid value. this does allow us to set which languages
|
---|
364 | // should go in the preference selection box (from collect.cfg) however
|
---|
365 | // and that's sufficient for current requirements
|
---|
366 |
|
---|
367 | // currently supported languages (_languageoption_ will default to all
|
---|
368 | // these languages unless PreferenceLanguages is set
|
---|
369 | text_tarray languages;
|
---|
370 | languages.push_back ("en");
|
---|
371 | languages.push_back ("mi");
|
---|
372 | languages.push_back ("zh");
|
---|
373 | text_tarray::const_iterator this_lang = languages.begin();
|
---|
374 | text_tarray::const_iterator end_lang = languages.end();
|
---|
375 |
|
---|
376 | text_t languageoption = "_textlanguage_\n<select name=\"l\" onChange=\"updatel();\">\n";
|
---|
377 | it = cinfo.format.find ("PreferenceLanguages");
|
---|
378 | if ((it != cinfo.format.end()) && (!(*it).second.empty())) {
|
---|
379 | text_tset pref_langs;
|
---|
380 | splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
|
---|
381 | if (pref_langs.size() > 1) {
|
---|
382 | while (this_lang != end_lang) {
|
---|
383 | if (pref_langs.find(*this_lang) != pref_langs.end())
|
---|
384 | languageoption += "_" + *this_lang + "languageoption_\n";
|
---|
385 | this_lang ++;
|
---|
386 | }
|
---|
387 | languageoption += "</select>\n";
|
---|
388 | disp.setmacro ("languageoption", "preferences", languageoption);
|
---|
389 | }
|
---|
390 |
|
---|
391 | // _encodingoption_
|
---|
392 |
|
---|
393 | if (pref_langs.find("zh") == pref_langs.end())
|
---|
394 | disp.setmacro ("encodingoption", "preferences", "");
|
---|
395 |
|
---|
396 | } else {
|
---|
397 | while (this_lang != end_lang) {
|
---|
398 | languageoption += "_" + *this_lang + "languageoption_\n";
|
---|
399 | this_lang ++;
|
---|
400 | }
|
---|
401 | languageoption += "</select>\n";
|
---|
402 | disp.setmacro ("languageoption", "preferences", languageoption);
|
---|
403 | }
|
---|
404 |
|
---|
405 | } else if (arg_p == "about" || arg_p == "help") {
|
---|
406 | if (collectproto == NULL) return;
|
---|
407 |
|
---|
408 | // _textbrowseoptions_ and _numbrowseoptions_
|
---|
409 |
|
---|
410 | FilterResponse_t response;
|
---|
411 | text_tset metadata;
|
---|
412 | metadata.insert ("Title");
|
---|
413 | bool getParents = false;
|
---|
414 | get_children ("", args["c"], metadata, getParents, collectproto, response, logout);
|
---|
415 |
|
---|
416 | disp.setmacro ("numbrowseoptions", "help", response.docInfo.size()+1);
|
---|
417 |
|
---|
418 | ResultDocInfo_tarray::iterator here = response.docInfo.begin();
|
---|
419 | ResultDocInfo_tarray::iterator end = response.docInfo.end();
|
---|
420 |
|
---|
421 | // we're assuming that we've always got a search button
|
---|
422 | text_t shorttext = "<ul><li>_textSearchshort_\n";
|
---|
423 | text_t longtext = "_textSearchlong_";
|
---|
424 |
|
---|
425 | while (here != end) {
|
---|
426 | text_t title = (*here).metadata["Title"].values[0];
|
---|
427 |
|
---|
428 | text_t stext, ltext;
|
---|
429 | disp.expandstring ("help", "_text" + title + "short_", stext);
|
---|
430 | if (stext == ("_text" + title + "short_")) {
|
---|
431 | shorttext += "<li>_help:textdefaultshorttext_";
|
---|
432 | longtext += "_help:textdefaultlongtext_";
|
---|
433 | } else {
|
---|
434 | shorttext += "<li>" + stext;
|
---|
435 | longtext += "_help:text" + title + "long_";
|
---|
436 | }
|
---|
437 |
|
---|
438 | here ++;
|
---|
439 | }
|
---|
440 | shorttext += "</ul>\n";
|
---|
441 | if (response.docInfo.size() > 1) disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
|
---|
442 | else disp.setmacro ("textbrowseoptions", "help", longtext);
|
---|
443 |
|
---|
444 | if (arg_p == "help") {
|
---|
445 |
|
---|
446 | // _topicreadingdocs_ _textreadingdocs_ _texthelpreadingdocs_
|
---|
447 |
|
---|
448 | // if HTML collection there's no how to read document text
|
---|
449 | text_tmap::const_iterator it = cinfo.format.find ("HelpNoDocs");
|
---|
450 | if ((it != cinfo.format.end()) && ((*it).second == "true")) {
|
---|
451 | disp.setmacro ("topicreadingdocs", "help", "");
|
---|
452 | disp.setmacro ("texthelpreadingdocs", "help", "");
|
---|
453 | }
|
---|
454 | it = cinfo.format.find ("HelpBibDocs");
|
---|
455 | if ((it != cinfo.format.end()) && ((*it).second == "true")) {
|
---|
456 | disp.setmacro ("texthelpreadingdocs", "help", "_bibtexthelpreadingdocs_");
|
---|
457 | disp.setmacro ("textreadingdocs", "help", "_bibtextreadingdocs_");
|
---|
458 | }
|
---|
459 | it = cinfo.format.find ("HelpBookDocs");
|
---|
460 | if ((it != cinfo.format.end()) && ((*it).second == "true")) {
|
---|
461 | disp.setmacro ("texthelpreadingdocs", "help", "_booktexthelpreadingdocs_");
|
---|
462 | disp.setmacro ("textreadingdocs", "help", "_booktextreadingdocs_");
|
---|
463 | }
|
---|
464 |
|
---|
465 | }
|
---|
466 | if (arg_p == "about") {
|
---|
467 |
|
---|
468 | // _textsubcollections_
|
---|
469 | if (args["ccs"] == "1" && (cinfo.ccsCols.size() > 1)) {
|
---|
470 | text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo.ccsCols.size()) + ")";
|
---|
471 | text_tarray::const_iterator here = cinfo.ccsCols.begin();
|
---|
472 | text_tarray::const_iterator end = cinfo.ccsCols.end();
|
---|
473 | bool first = true;
|
---|
474 | while (here != end) {
|
---|
475 | if (*here == arg_c) {
|
---|
476 | if (!first) textsubcollections += "<br>";
|
---|
477 | textsubcollections += "\n" + cinfo.collectionmeta["collectionname"] + "\n";
|
---|
478 | } else {
|
---|
479 | ColInfoResponse_t this_cinfo;
|
---|
480 | collectproto->get_collectinfo (*here, this_cinfo, err, logout);
|
---|
481 | if (err == noError) {
|
---|
482 | if (!first) textsubcollections += "<br>";
|
---|
483 | textsubcollections += "\n" + this_cinfo.collectionmeta["collectionname"] + "\n";
|
---|
484 | }
|
---|
485 | }
|
---|
486 | first = false;
|
---|
487 | here ++;
|
---|
488 | }
|
---|
489 | textsubcollections += "_textsubcols2_";
|
---|
490 | disp.setmacro ("textsubcollections", "about", textsubcollections);
|
---|
491 | }
|
---|
492 | }
|
---|
493 | }
|
---|
494 | }
|
---|
495 |
|
---|
496 | bool pageaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
|
---|
497 | browsermapclass * /*browsers*/, displayclass &disp,
|
---|
498 | outconvertclass &outconvert, ostream &textout,
|
---|
499 | ostream &/*logout*/) {
|
---|
500 |
|
---|
501 | text_t &arg_p = args["p"];
|
---|
502 |
|
---|
503 | textout << outconvert << disp << ("_" + arg_p + ":header_\n")
|
---|
504 | << ("_" + arg_p + ":content_\n")
|
---|
505 | << ("_" + arg_p + ":footer_\n");
|
---|
506 |
|
---|
507 | return true;
|
---|
508 | }
|
---|