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

Last change on this file since 2767 was 2767, checked in by sjboddie, 23 years ago

altered the docs page to avoid broken links when documentation isn't
installed along with Greenstone

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 22.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 if (arg_p == "home") {
419 set_homeextra_macro (disp, protos, logout);
420 if (status_disabled) disp.setmacro ("textgoadmin", "home", "");
421 if (collector_disabled) disp.setmacro ("textgocollector", "home", "");
422 }
423
424 else if (arg_p == "preferences") {
425 if (collectproto == NULL) {return;}
426 // _collectionoption_
427
428 if (args["ccs"] == "1" && collectproto != NULL && (cinfo->ccsCols.size() > 1)) {
429 text_t collectionoption = "_textcollectionoption_";
430 text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
431 text_tarray::const_iterator col_end = cinfo->ccsCols.end();
432 int count = 0;
433 while (col_here != col_end) {
434 text_t colname;
435 if (*col_here == arg_c) {
436 colname = cinfo->collectionmeta["collectionname"];
437 } else {
438 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout);
439 if (this_cinfo == NULL) {col_here ++; continue;}
440 colname = this_cinfo->collectionmeta["collectionname"];
441 }
442
443 count ++;
444 collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
445 *col_here + "\" onClick=\"updatecc(\'" + *col_here + "\');\"> " +
446 colname + "<br>\n";
447 col_here ++;
448 }
449
450 if (count > 1)
451 disp.setmacro ("collectionoption", "preferences", collectionoption);
452 }
453
454 // _htmloptions_
455
456 text_tmap::const_iterator it = cinfo->format.find ("DocumentUseHTML");
457 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
458 disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
459
460
461 // _PreferenceDocsFromWeb_
462
463 it = cinfo->format.find ("PreferenceDocsFromWeb");
464 if ((it == cinfo->format.end()) || ((*it).second == "true"))
465 disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
466 }
467
468 // _languageoption_
469 // Create the "interface language" selection box for the preferences page.
470 // You can use something like "format PreferenceLanguages en|fr|zn" from within
471 // a collect.cfg file to use only a subset of the available languages for
472 // any given collection. This facility is kind of ugly though and should be
473 // replaced by something better when the configuration files are tidied up (as
474 // should all the other "format Preference..." options).
475
476 text_t &arg_l = args["l"];
477 const recptconf &configinfo = recpt->get_configinfo();
478 // put languages in another map to sort them by longname
479 text_tmap languages;
480 languageinfo_tmap::const_iterator thislang = configinfo.languages.begin();
481 languageinfo_tmap::const_iterator endlang = configinfo.languages.end();
482 while (thislang != endlang) {
483 languages[(*thislang).second.longname] = (*thislang).first;
484 thislang++;
485 }
486 text_tmap::iterator tlang = languages.begin();
487 text_tmap::iterator elang = languages.end();
488
489 text_t languageoption;
490 it = cinfo->format.find ("PreferenceLanguages");
491 if ((it != cinfo->format.end()) && (!(*it).second.empty())) {
492 text_tset pref_langs;
493 splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
494 if (pref_langs.size() > 1) {
495 while (tlang != elang) {
496 if (pref_langs.find((*tlang).second) != pref_langs.end()) {
497 languageoption += "<option value=\"" + (*tlang).second + "\"";
498 if ((*tlang).second == arg_l) languageoption += " selected";
499 languageoption += ">" + (*tlang).first + "\n";
500 }
501 tlang ++;
502 }
503 }
504
505 } else {
506 while (tlang != elang) {
507 languageoption += "<option value=\"" + (*tlang).second + "\"";
508 if ((*tlang).second == arg_l) languageoption += " selected";
509 languageoption += ">" + (*tlang).first + "\n";
510 tlang ++;
511 }
512 }
513 if (!languageoption.empty()) {
514 languageoption = "<select name=\"l\" onChange=\"updatel();\">\n" + languageoption;
515 languageoption += "</select>\n";
516 disp.setmacro ("languageoption", "preferences", languageoption);
517 }
518
519 // _encodingoption_
520 // create the "encoding" selection box for the preferences page
521 if (configinfo.encodings.size() > 1) {
522 text_t &arg_w = args["w"];
523 text_t encodingoption;
524 text_tmap::const_iterator thisenc = configinfo.encodings.begin();
525 text_tmap::const_iterator endenc = configinfo.encodings.end();
526 while (thisenc != endenc) {
527 encodingoption += "<option value=\"" + (*thisenc).second + "\"";
528 if ((*thisenc).second == arg_w) encodingoption += " selected";
529 encodingoption += ">" + (*thisenc).first + "\n";
530 thisenc ++;
531 }
532
533 encodingoption = "<select name=\"w\" onChange=\"updatew();\">\n" + encodingoption;
534 encodingoption += "</select>\n";
535 disp.setmacro ("encodingoption", "preferences", encodingoption);
536 }
537
538 // _prefschanged_
539 if (!args["bp"].empty()) {
540 disp.setmacro ("prefschanged", "preferences", "_textprefschanged_");
541 }
542
543 } else if (arg_p == "about" || arg_p == "help") {
544 if (collectproto == NULL) return;
545
546 // _textbrowseoptions_ and _numbrowseoptions_
547
548 FilterResponse_t response;
549 text_tset metadata;
550 metadata.insert ("Title");
551 bool getParents = false;
552 get_children ("", args["c"], metadata, getParents, collectproto, response, logout);
553
554 disp.setmacro ("numbrowseoptions", "help", response.docInfo.size()+1);
555
556 ResultDocInfo_tarray::iterator here = response.docInfo.begin();
557 ResultDocInfo_tarray::iterator end = response.docInfo.end();
558
559 // we're assuming that we've always got a search button
560 text_t shorttext = "<ul><li>_textSearchshort_\n";
561 text_t longtext = "_textSearchlong_";
562
563 while (here != end) {
564 text_t title = (*here).metadata["Title"].values[0];
565
566 text_t stext, ltext;
567 disp.expandstring ("help", "_text" + title + "short_", stext);
568 if (stext == ("_text" + title + "short_")) {
569 shorttext += "<li>_help:textdefaultshorttext_";
570 longtext += "_help:textdefaultlongtext_";
571 } else {
572 shorttext += "<li>_help:text" + title + "short_";
573 longtext += "_help:text" + title + "long_";
574 }
575
576 here ++;
577 }
578 shorttext += "</ul>\n";
579 if (response.docInfo.size() > 1) disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
580 else disp.setmacro ("textbrowseoptions", "help", longtext);
581
582 if (arg_p == "help") {
583
584 // _topicreadingdocs_ _textreadingdocs_ _texthelpreadingdocs_
585
586 // if HTML collection there's no how to read document text
587 text_tmap::const_iterator it = cinfo->format.find ("HelpNoDocs");
588 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
589 disp.setmacro ("topicreadingdocs", "help", "");
590 disp.setmacro ("texthelpreadingdocs", "help", "");
591 }
592 it = cinfo->format.find ("HelpBibDocs");
593 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
594 disp.setmacro ("texthelpreadingdocs", "help", "_bibtexthelpreadingdocs_");
595 disp.setmacro ("textreadingdocs", "help", "_bibtextreadingdocs_");
596 }
597 it = cinfo->format.find ("HelpBookDocs");
598 if ((it != cinfo->format.end()) && ((*it).second == "true")) {
599 disp.setmacro ("texthelpreadingdocs", "help", "_booktexthelpreadingdocs_");
600 disp.setmacro ("textreadingdocs", "help", "_booktextreadingdocs_");
601 }
602
603 }
604 if (arg_p == "about") {
605
606 // _textsubcollections_
607 if (args["ccs"] == "1" && (cinfo->ccsCols.size() > 1)) {
608 text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo->ccsCols.size()) + ")";
609 text_tarray::const_iterator here = cinfo->ccsCols.begin();
610 text_tarray::const_iterator end = cinfo->ccsCols.end();
611 bool first = true;
612 int count = 0;
613 while (here != end) {
614 if (*here == arg_c) {
615 if (!first) textsubcollections += "<br>";
616 textsubcollections += "\n" + cinfo->collectionmeta["collectionname"] + "\n";
617 } else {
618 ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout);
619 if (this_cinfo == NULL) {here ++; continue;}
620 if (!first) textsubcollections += "<br>";
621 textsubcollections += "\n" + this_cinfo->collectionmeta["collectionname"] + "\n";
622 }
623 count ++;
624 first = false;
625 here ++;
626 }
627 textsubcollections += "_textsubcols2_";
628 if (count > 1)
629 disp.setmacro ("textsubcollections", "about", textsubcollections);
630 }
631 }
632
633 } else if (arg_p == "homehelp") {
634
635 set_collectionlist_macro (disp, protos, logout);
636
637 } else if (arg_p == "docs") {
638
639 set_documentation_macro (disp);
640
641 }
642}
643
644bool pageaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
645 browsermapclass * /*browsers*/, displayclass &disp,
646 outconvertclass &outconvert, ostream &textout,
647 ostream &/*logout*/) {
648
649 text_t &arg_p = args["p"];
650
651 textout << outconvert << disp << ("_" + arg_p + ":header_\n")
652 << ("_" + arg_p + ":content_\n")
653 << ("_" + arg_p + ":footer_\n");
654
655 return true;
656}
657
658void pageaction::configure (const text_t &key, const text_tarray &cfgline) {
659 if ((key == "status") && (cfgline.size() == 1) &&
660 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
661 status_disabled = false;
662 } else if ((key == "collector") && (cfgline.size() == 1) &&
663 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
664 collector_disabled = false;
665 } else {
666 // call the parent class to deal with the things which
667 // are not dealt with here
668 action::configure (key, cfgline);
669 }
670}
Note: See TracBrowser for help on using the repository browser.