source: trunk/gsdl/src/recpt/pageaction.cpp@ 2782

Last change on this file since 2782 was 2782, checked in by dmm9, 23 years ago

setting up modified query interface in pageaction (for about page)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 23.8 KB
Line 
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 *********************************************************************/
25
26#include "OIDtools.h"
27#include "pageaction.h"
28#include "receptionist.h"
29#include "fileutil.h"
30#include <time.h>
31
32pageaction::pageaction () {
33
34 status_disabled = true;
35 collector_disabled = true;
36 recpt = NULL;
37
38 // this action uses cgi variables "a", "p", and "hp"
39 cgiarginfo arg_ainfo;
40 arg_ainfo.shortname = "a";
41 arg_ainfo.longname = "action";
42 arg_ainfo.multiplechar = true;
43 arg_ainfo.defaultstatus = cgiarginfo::weak;
44 arg_ainfo.argdefault = "p";
45 arg_ainfo.savedarginfo = cgiarginfo::must;
46 argsinfo.addarginfo (NULL, arg_ainfo);
47
48 arg_ainfo.shortname = "p";
49 arg_ainfo.longname = "page";
50 arg_ainfo.multiplechar = true;
51 arg_ainfo.defaultstatus = cgiarginfo::weak;
52 arg_ainfo.argdefault = "home";
53 arg_ainfo.savedarginfo = cgiarginfo::must;
54 argsinfo.addarginfo (NULL, arg_ainfo);
55
56 arg_ainfo.shortname = "hp";
57 arg_ainfo.longname = "html page";
58 arg_ainfo.multiplechar = true;
59 arg_ainfo.defaultstatus = cgiarginfo::weak;
60 arg_ainfo.argdefault = "";
61 arg_ainfo.savedarginfo = cgiarginfo::mustnot;
62 argsinfo.addarginfo (NULL, arg_ainfo);
63
64 arg_ainfo.shortname = "bp";
65 arg_ainfo.longname = "set preferences button";
66 arg_ainfo.multiplechar = true;
67 arg_ainfo.defaultstatus = cgiarginfo::weak;
68 arg_ainfo.argdefault = "";
69 arg_ainfo.savedarginfo = cgiarginfo::mustnot;
70 argsinfo.addarginfo (NULL, arg_ainfo);
71
72 // the "u" argument will disable the search facility, remove links to the
73 // home and preferences pages, and disable the DocumentButton buttons
74 // (for use when generating static html versions of collections)
75 arg_ainfo.shortname = "u";
76 arg_ainfo.longname = "static page";
77 arg_ainfo.multiplechar = false;
78 arg_ainfo.defaultstatus = cgiarginfo::weak;
79 arg_ainfo.argdefault = "0";
80 arg_ainfo.savedarginfo = cgiarginfo::mustnot;
81 argsinfo.addarginfo (NULL, arg_ainfo);
82}
83
84pageaction::~pageaction () {
85}
86
87bool pageaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args,
88 ostream &/*logout*/) {
89
90 if (args["p"] == "preferences" && !args["bp"].empty()) {
91 if (args["hd"] != "0") args["hd"] = args["hdn"];
92 }
93
94 return true;
95}
96
97void pageaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
98 response_t &response,text_t &response_data,
99 ostream &/*logout*/) {
100 response = content;
101 response_data = "text/html";
102}
103
104void pageaction::set_homeextra_macro (displayclass &disp, recptprotolistclass *protos,
105 ostream &logout) {
106 text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n";
107 bool found_valid_col = false;
108
109 recptprotolistclass::iterator rprotolist_here = protos->begin();
110 recptprotolistclass::iterator rprotolist_end = protos->end();
111 while (rprotolist_here != rprotolist_end) {
112 if ((*rprotolist_here).p != NULL) {
113
114 text_tarray collist;
115 comerror_t err;
116 (*rprotolist_here).p->get_collection_list (collist, err, logout);
117 if (err == noError) {
118 text_tarray::iterator collist_here = collist.begin();
119 text_tarray::iterator collist_end = collist.end();
120
121 int count = 0;
122 bool first = true;
123 while (collist_here != collist_end) {
124 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
125
126 if (cinfo != NULL) {
127 if (cinfo->isPublic && (cinfo->buildDate > 0)) {
128
129 text_t coll_type = "&ct=";
130 if (cinfo->buildType == "mgpp") {
131 coll_type += "1";
132 }
133 else {
134 coll_type += "0";
135 }
136 found_valid_col = true;
137 FilterResponse_t response;
138 text_tset metadata;
139 metadata.insert ("collectionname");
140 metadata.insert ("iconcollection");
141 metadata.insert ("iconcollectionsmall");
142 text_t collectionname = *collist_here;
143 text_t alt = collectionname;
144
145 if (get_info ("collection", *collist_here, metadata, false,
146 (*rprotolist_here).p, response, logout)) {
147 if (!response.docInfo[0].metadata["collectionname"].values[0].empty())
148 alt = response.docInfo[0].metadata["collectionname"].values[0];
149
150 text_t iconurl;
151 iconurl.clear();
152
153 if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty()) {
154 iconurl = response.docInfo[0].metadata["iconcollectionsmall"].values[0];
155 } else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty()) {
156 iconurl = response.docInfo[0].metadata["iconcollection"].values[0];
157 }
158
159 if (!iconurl.empty())
160 {
161 // check to see URL is local to colserver
162 text_t::iterator iconurl_head = iconurl.begin();
163 text_t iconhead = substr(iconurl_head,iconurl_head+16);
164 if (iconhead=="_httpcollection_")
165 {
166 // local and using _httpcollection_
167 text_t icontail = substr(iconurl_head+16,iconurl.end());
168 iconurl = "http://" + cinfo->httpdomain
169 + cinfo->httpprefix + "/collect/"
170 + *collist_here + "/" + icontail;
171 }
172 else if (iconurl[0]=='/')
173 {
174 // local but with full path
175 iconurl = "http://" + cinfo->httpdomain + iconurl;
176 }
177
178 collectionname
179 = "<img width=150 border=1 src=\"" + iconurl + "\" alt=\"" + alt + "\">";
180 }
181 else
182 {
183 collectionname = alt;
184 }
185
186 }
187 if ((count%3 == 0) && (!first))
188 homeextra += "</tr><tr valign=top>\n";
189
190 comerror_t err;
191 text_t optsite = "";
192 text_t site_name = (*rprotolist_here).p->get_site_name (err);
193 if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
194
195 text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + coll_type+"\">";
196
197 if (!cinfo->receptionist.empty())
198 link = "<a href=\"" + cinfo->receptionist + "\">";
199
200 homeextra += "<td>" + link + collectionname + "</a></td>\n";
201
202 count ++;
203 first = false;
204 }
205 }
206 collist_here ++;
207 }
208
209 for (; count%3 != 0; count ++) homeextra += "<td></td>\n";
210 }
211 }
212 homeextra += "</td></tr>\n<tr>\n";
213 rprotolist_here ++;
214 }
215
216 if (!found_valid_col) {
217 homeextra += "<td>No valid (i.e. built and public) collections are available</td>\n";
218 }
219 homeextra += "</tr></table></center>\n";
220 disp.setmacro ("homeextra", "home", homeextra);
221}
222
223void pageaction::set_collectionlist_macro (displayclass &disp, recptprotolistclass *protos,
224 ostream &logout) {
225
226 text_t collectionlist;
227 int count = 0;
228
229 recptprotolistclass::iterator rprotolist_here = protos->begin();
230 recptprotolistclass::iterator rprotolist_end = protos->end();
231 while (rprotolist_here != rprotolist_end) {
232 if ((*rprotolist_here).p != NULL) {
233
234 text_tarray collist;
235 comerror_t err;
236 (*rprotolist_here).p->get_collection_list (collist, err, logout);
237 if (err == noError) {
238 text_tarray::iterator collist_here = collist.begin();
239 text_tarray::iterator collist_end = collist.end();
240
241 while (collist_here != collist_end) {
242 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
243
244 if (cinfo != NULL) {
245 if (cinfo->isPublic && (cinfo->buildDate > 0)) {
246
247 count ++;
248
249 text_t coll_type = "&ct=";
250 if (cinfo->buildType == "mgpp") {
251 coll_type += "1";
252 }
253 else {
254 coll_type += "0";
255 }
256 FilterResponse_t response;
257 text_tset metadata;
258 metadata.insert ("collectionname");
259 text_t collectionname = *collist_here;
260
261 if (get_info ("collection", *collist_here, metadata, false,
262 (*rprotolist_here).p, response, logout)) {
263 if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) {
264 collectionname = response.docInfo[0].metadata["collectionname"].values[0];
265 }
266 }
267
268 comerror_t err;
269 text_t optsite = "";
270 text_t site_name = (*rprotolist_here).p->get_site_name (err);
271 if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
272
273 text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + coll_type+"\">";
274
275 if (!cinfo->receptionist.empty())
276 link = "<a href=\"" + cinfo->receptionist + "\">";
277
278 collectionlist += "<li>" + link + collectionname + "</a>\n";
279 }
280 }
281 collist_here ++;
282 }
283 }
284 }
285 rprotolist_here ++;
286 }
287
288 if (count == 1) {
289 collectionlist = "<p>This Greenstone installation contains 1 collection\n<ul>" +
290 collectionlist + "</ul>\n";
291 } else if (count > 1) {
292 collectionlist = "<p>This Greenstone installation contains " + text_t(count) +
293 " collections\n<ul>" + collectionlist + "</ul>\n";
294 }
295
296 disp.setmacro ("collectionlist", "homehelp", collectionlist);
297}
298
299void pageaction::set_documentation_macro (displayclass &disp) {
300
301 text_t documentation;
302 text_t docsdir = filename_cat(gsdlhome, "docs");
303
304 if (file_exists(filename_cat(docsdir, "User.pdf"))) {
305 documentation += "<tr valign=middle><td><a href=\"_httpdocs_/User.pdf\">_iconpdf_"
306 "</a></td><td>_textuserguide_</td></tr>";
307 }
308
309 if (file_exists(filename_cat(docsdir, "Install.pdf"))) {
310 documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Install.pdf\">_iconpdf_"
311 "</a></td><td>_textinstallerguide_</td></tr>";
312 }
313
314 if (file_exists(filename_cat(docsdir, "Develop.pdf"))) {
315 documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Develop.pdf\">_iconpdf_"
316 "</a></td><td>_textdeveloperguide_</td></tr>";
317 }
318
319 if (file_exists(filename_cat(docsdir, "Paper.pdf"))) {
320 documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Paper.pdf\">_iconpdf_"
321 "</a></td><td>_textpaperguide_</td></tr>";
322 }
323
324 if (!documentation.empty()) {
325 disp.setmacro("documentation", "docs", "<p>\n<table border=0>\n" + documentation + "\n</table>\n");
326 }
327}
328
329void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
330 recptprotolistclass *protos, ostream &logout) {
331
332 // define_internal_macros sets the following macros:
333
334 // _numdocs_ the number of documents in the collection
335
336 // _builddate_ the date last built
337
338 // if page is "home"
339 // _homeextra_ this is the list of available collections and collection info
340 // to be displayed on the home page
341
342
343 // if page is "preferences"
344 // _collectionoption_ collections to search/browse (if cross-collection-searching is on)
345
346 // _htmloptions_ set to _htmloptionson_ if DocumentUseHTML is set
347
348 // _PreferencesDocsFromWeb_ set to 1 if corresponding format option is set
349
350 // _languageoption_ interface languages to select from (dependant on PreferenceLanguages)
351
352 // _encodingoption_ encodings to select from
353
354 // if page is "about"
355 // _textsubcollections_ the text on which subcollections make up the collection (if
356 // cross-collection searching is being used
357
358 // _textbrowseoptions_ the 'how to find information' text in the about and help pages
359
360 // _numbrowseoptions_ the number of browsing options
361
362 // _prefschanged_ will be set to _textprefschanged_ if the "set preferences" button
363 // was pressed
364
365
366 // if page is "help"
367 // _textbrowseoptions_ the 'how to find information' text in the about and help pages
368
369 // _numbrowseoptions_ the number of browsing options
370
371 // _topicreadingdocs_ this section of the help text differs depending on what type of
372 // _textreadingdocs_ collection it is (e.g. html collection, bibliographic collection etc.)
373 // _texthelpreadingdocs_
374
375 // _textgocollector_ set to "" if collector is disabled in main.cfg
376 // _textgoadmin_ set to "" if status is disabled in main.cfg
377
378
379 // if page is "homehelp"
380 // _collectionlist_ list of available collections to be displayed on the homehelp page
381
382
383 // if page is "docs"
384 // _documentation_ links to PDF documents if they're available
385
386
387 if (recpt == NULL) {
388 logout << "ERROR (pageaction::define_internal_macros): This action does not contain\n"
389 << " information about any receptionists. The method set_receptionist was\n"
390 << " probably not called from the module which instantiated this action.\n";
391 return;
392 }
393
394 text_t &arg_p = args["p"];
395 text_t &arg_c = args["c"];
396 ColInfoResponse_t *cinfo = NULL;
397
398 recptproto* collectproto = protos->getrecptproto (arg_c, logout);
399 if (collectproto != NULL) {
400 cinfo = recpt->get_collectinfo_ptr (collectproto, arg_c, logout);
401
402 disp.setmacro ("numdocs", "Global", cinfo->numDocs);
403 unsigned long current_time = time(NULL);
404 unsigned long builddate = (current_time - cinfo->buildDate) / 86400;
405 disp.setmacro ("builddate", "Global", builddate);
406
407 text_t numbytes;
408 if ((cinfo->numBytes/(1024*1024)) > 1) {
409 numbytes = (text_t)(cinfo->numBytes/(1024*1024)) + " Mb";
410 } else if ((cinfo->numBytes/1024) > 1) {
411 numbytes = (text_t)(cinfo->numBytes/1024) + " kb";
412 } else {
413 numbytes = (text_t)cinfo->numBytes + " bytes";
414 }
415 disp.setmacro("numbytes", "Global", numbytes);
416 }
417
418 //setting _queryformcontent_ so that the query interface is consistent.
419 if(arg_p == "about"){
420 text_t collection = args["c"];
421 //check that the protocol is alive
422 recptproto* colproto = protos->getrecptproto (collection, logout);
423 if(colproto == NULL) {
424 logout << "ERROR: Null collection protocol trying to query"
425 << collection.getcstr() << "\n";
426 return;
427 }
428
429 //check the collection is responding/in place
430 ColInfoResponse_t *colinfo = recpt->get_collectinfo_ptr(colproto, collection,
431 logout);
432 if(colinfo == NULL){
433 logout << "ERROR: Null returned for get_collectinfo_ptr on "
434 << collection.getcstr() << "in queryaction::define_query_interface\n";
435 return;
436 }
437
438
439 text_tmap::iterator check = colinfo->format.find("QueryInterface");
440 if(check != colinfo->format.end()){
441 if((*check).second=="DateSearch"){
442 text_t current = "_basicqueryform_ _datesearch_";
443
444 disp.setmacro("queryformcontent","query",current);
445 }
446 }
447 }
448
449
450
451 if (arg_p == "home") {
452 set_homeextra_macro (disp, protos, logout);
453 if (status_disabled) disp.setmacro ("textgoadmin", "home", "");
454 if (collector_disabled) disp.setmacro ("textgocollector", "home", "");
455 }
456
457
458
459
460 else if (arg_p == "preferences") {
461 if (collectproto == NULL) {return;}
462 // _collectionoption_
463
464 if (args["ccs"] == "1" && collectproto != NULL && (cinfo->ccsCols.size() > 1)) {
465 text_t collectionoption = "_textcollectionoption_";
466 text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
467 text_tarray::const_iterator col_end = cinfo->ccsCols.end();
468 int count = 0;
469 while (col_here != col_end) {
470 text_t colname;
471 if (*col_here == arg_c) {
472 colname = cinfo->collectionmeta["collectionname"];
473 } else {
474 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout);
475 if (this_cinfo == NULL) {col_here ++; continue;}
476 colname = this_cinfo->collectionmeta["collectionname"];
477 }
478
479 count ++;
480 collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
481 *col_here + "\" onClick=\"updatecc(\'" + *col_here + "\');\"> " +
482 colname + "<br>\n";
483 col_here ++;
484 }
485
486 if (count > 1)
487 disp.setmacro ("collectionoption", "preferences", collectionoption);
488 }
489
490 // _htmloptions_
491
492 text_tmap::const_iterator it = cinfo->format.find ("DocumentUseHTML");
493 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
494 disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
495
496
497 // _PreferenceDocsFromWeb_
498
499 it = cinfo->format.find ("PreferenceDocsFromWeb");
500 if ((it == cinfo->format.end()) || ((*it).second == "true"))
501 disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
502 }
503
504 // _languageoption_
505 // Create the "interface language" selection box for the preferences page.
506 // You can use something like "format PreferenceLanguages en|fr|zn" from within
507 // a collect.cfg file to use only a subset of the available languages for
508 // any given collection. This facility is kind of ugly though and should be
509 // replaced by something better when the configuration files are tidied up (as
510 // should all the other "format Preference..." options).
511
512 text_t &arg_l = args["l"];
513 const recptconf &configinfo = recpt->get_configinfo();
514 // put languages in another map to sort them by longname
515 text_tmap languages;
516 languageinfo_tmap::const_iterator thislang = configinfo.languages.begin();
517 languageinfo_tmap::const_iterator endlang = configinfo.languages.end();
518 while (thislang != endlang) {
519 languages[(*thislang).second.longname] = (*thislang).first;
520 thislang++;
521 }
522 text_tmap::iterator tlang = languages.begin();
523 text_tmap::iterator elang = languages.end();
524
525 text_t languageoption;
526 it = cinfo->format.find ("PreferenceLanguages");
527 if ((it != cinfo->format.end()) && (!(*it).second.empty())) {
528 text_tset pref_langs;
529 splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
530 if (pref_langs.size() > 1) {
531 while (tlang != elang) {
532 if (pref_langs.find((*tlang).second) != pref_langs.end()) {
533 languageoption += "<option value=\"" + (*tlang).second + "\"";
534 if ((*tlang).second == arg_l) languageoption += " selected";
535 languageoption += ">" + (*tlang).first + "\n";
536 }
537 tlang ++;
538 }
539 }
540
541 } else {
542 while (tlang != elang) {
543 languageoption += "<option value=\"" + (*tlang).second + "\"";
544 if ((*tlang).second == arg_l) languageoption += " selected";
545 languageoption += ">" + (*tlang).first + "\n";
546 tlang ++;
547 }
548 }
549 if (!languageoption.empty()) {
550 languageoption = "<select name=\"l\" onChange=\"updatel();\">\n" + languageoption;
551 languageoption += "</select>\n";
552 disp.setmacro ("languageoption", "preferences", languageoption);
553 }
554
555 // _encodingoption_
556 // create the "encoding" selection box for the preferences page
557 if (configinfo.encodings.size() > 1) {
558 text_t &arg_w = args["w"];
559 text_t encodingoption;
560 text_tmap::const_iterator thisenc = configinfo.encodings.begin();
561 text_tmap::const_iterator endenc = configinfo.encodings.end();
562 while (thisenc != endenc) {
563 encodingoption += "<option value=\"" + (*thisenc).second + "\"";
564 if ((*thisenc).second == arg_w) encodingoption += " selected";
565 encodingoption += ">" + (*thisenc).first + "\n";
566 thisenc ++;
567 }
568
569 encodingoption = "<select name=\"w\" onChange=\"updatew();\">\n" + encodingoption;
570 encodingoption += "</select>\n";
571 disp.setmacro ("encodingoption", "preferences", encodingoption);
572 }
573
574 // _prefschanged_
575 if (!args["bp"].empty()) {
576 disp.setmacro ("prefschanged", "preferences", "_textprefschanged_");
577 }
578
579 } else if (arg_p == "about" || arg_p == "help") {
580 if (collectproto == NULL) return;
581
582 // _textbrowseoptions_ and _numbrowseoptions_
583
584 FilterResponse_t response;
585 text_tset metadata;
586 metadata.insert ("Title");
587 bool getParents = false;
588 get_children ("", args["c"], metadata, getParents, collectproto, response, logout);
589
590 disp.setmacro ("numbrowseoptions", "help", response.docInfo.size()+1);
591
592 ResultDocInfo_tarray::iterator here = response.docInfo.begin();
593 ResultDocInfo_tarray::iterator end = response.docInfo.end();
594
595 // we're assuming that we've always got a search button
596 text_t shorttext = "<ul><li>_textSearchshort_\n";
597 text_t longtext = "_textSearchlong_";
598
599 while (here != end) {
600 text_t title = (*here).metadata["Title"].values[0];
601
602 text_t stext, ltext;
603 disp.expandstring ("help", "_text" + title + "short_", stext);
604 if (stext == ("_text" + title + "short_")) {
605 shorttext += "<li>_help:textdefaultshorttext_";
606 longtext += "_help:textdefaultlongtext_";
607 } else {
608 shorttext += "<li>_help:text" + title + "short_";
609 longtext += "_help:text" + title + "long_";
610 }
611
612 here ++;
613 }
614 shorttext += "</ul>\n";
615 if (response.docInfo.size() > 1) disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
616 else disp.setmacro ("textbrowseoptions", "help", longtext);
617
618 if (arg_p == "help") {
619
620 // _topicreadingdocs_ _textreadingdocs_ _texthelpreadingdocs_
621
622 // if HTML collection there's no how to read document text
623 text_tmap::const_iterator it = cinfo->format.find ("HelpNoDocs");
624 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
625 disp.setmacro ("topicreadingdocs", "help", "");
626 disp.setmacro ("texthelpreadingdocs", "help", "");
627 }
628 it = cinfo->format.find ("HelpBibDocs");
629 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
630 disp.setmacro ("texthelpreadingdocs", "help", "_bibtexthelpreadingdocs_");
631 disp.setmacro ("textreadingdocs", "help", "_bibtextreadingdocs_");
632 }
633 it = cinfo->format.find ("HelpBookDocs");
634 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
635 disp.setmacro ("texthelpreadingdocs", "help", "_booktexthelpreadingdocs_");
636 disp.setmacro ("textreadingdocs", "help", "_booktextreadingdocs_");
637 }
638
639 }
640 if (arg_p == "about") {
641
642 // _textsubcollections_
643 if (args["ccs"] == "1" && (cinfo->ccsCols.size() > 1)) {
644 text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo->ccsCols.size()) + ")";
645 text_tarray::const_iterator here = cinfo->ccsCols.begin();
646 text_tarray::const_iterator end = cinfo->ccsCols.end();
647 bool first = true;
648 int count = 0;
649 while (here != end) {
650 if (*here == arg_c) {
651 if (!first) textsubcollections += "<br>";
652 textsubcollections += "\n" + cinfo->collectionmeta["collectionname"] + "\n";
653 } else {
654 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout);
655 if (this_cinfo == NULL) {here ++; continue;}
656 if (!first) textsubcollections += "<br>";
657 textsubcollections += "\n" + this_cinfo->collectionmeta["collectionname"] + "\n";
658 }
659 count ++;
660 first = false;
661 here ++;
662 }
663 textsubcollections += "_textsubcols2_";
664 if (count > 1)
665 disp.setmacro ("textsubcollections", "about", textsubcollections);
666 }
667 }
668
669 } else if (arg_p == "homehelp") {
670
671 set_collectionlist_macro (disp, protos, logout);
672
673 } else if (arg_p == "docs") {
674
675 set_documentation_macro (disp);
676
677 }
678}
679
680bool pageaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
681 browsermapclass * /*browsers*/, displayclass &disp,
682 outconvertclass &outconvert, ostream &textout,
683 ostream &/*logout*/) {
684
685 text_t &arg_p = args["p"];
686
687 textout << outconvert << disp << ("_" + arg_p + ":header_\n")
688 << ("_" + arg_p + ":content_\n")
689 << ("_" + arg_p + ":footer_\n");
690
691 return true;
692}
693
694void pageaction::configure (const text_t &key, const text_tarray &cfgline) {
695 if ((key == "status") && (cfgline.size() == 1) &&
696 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
697 status_disabled = false;
698 } else if ((key == "collector") && (cfgline.size() == 1) &&
699 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
700 collector_disabled = false;
701 } else {
702 // call the parent class to deal with the things which
703 // are not dealt with here
704 action::configure (key, cfgline);
705 }
706}
Note: See TracBrowser for help on using the repository browser.