[160] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * pageaction.cpp --
|
---|
| 4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
| 5 | *
|
---|
[533] | 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.
|
---|
[160] | 9 | *
|
---|
[533] | 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 | *
|
---|
[160] | 24 | *********************************************************************/
|
---|
| 25 |
|
---|
[471] | 26 | #include "OIDtools.h"
|
---|
[160] | 27 | #include "pageaction.h"
|
---|
[172] | 28 | #include "receptionist.h"
|
---|
[284] | 29 | #include <time.h>
|
---|
[160] | 30 |
|
---|
[284] | 31 | pageaction::pageaction () {
|
---|
[160] | 32 |
|
---|
[1759] | 33 | status_disabled = true;
|
---|
| 34 | collector_disabled = true;
|
---|
[284] | 35 | recpt = NULL;
|
---|
| 36 |
|
---|
[452] | 37 | // this action uses cgi variables "a", "p", and "hp"
|
---|
[160] | 38 | cgiarginfo arg_ainfo;
|
---|
| 39 | arg_ainfo.shortname = "a";
|
---|
| 40 | arg_ainfo.longname = "action";
|
---|
| 41 | arg_ainfo.multiplechar = true;
|
---|
| 42 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
[165] | 43 | arg_ainfo.argdefault = "p";
|
---|
[160] | 44 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
| 45 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
| 46 |
|
---|
| 47 | arg_ainfo.shortname = "p";
|
---|
| 48 | arg_ainfo.longname = "page";
|
---|
| 49 | arg_ainfo.multiplechar = true;
|
---|
| 50 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
[771] | 51 | arg_ainfo.argdefault = "home";
|
---|
[511] | 52 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
[160] | 53 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
[452] | 54 |
|
---|
| 55 | arg_ainfo.shortname = "hp";
|
---|
| 56 | arg_ainfo.longname = "html page";
|
---|
| 57 | arg_ainfo.multiplechar = true;
|
---|
| 58 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
| 59 | arg_ainfo.argdefault = "";
|
---|
| 60 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
| 61 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
[160] | 62 | }
|
---|
| 63 |
|
---|
| 64 | pageaction::~pageaction () {
|
---|
| 65 | }
|
---|
| 66 |
|
---|
[261] | 67 | bool pageaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &/*args*/,
|
---|
| 68 | ostream &/*logout*/) {
|
---|
[160] | 69 | // don't want to check anything yet.
|
---|
| 70 | return true;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
[761] | 73 | void pageaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
|
---|
| 74 | response_t &response,text_t &response_data,
|
---|
| 75 | ostream &/*logout*/) {
|
---|
[160] | 76 | response = content;
|
---|
| 77 | response_data = "text/html";
|
---|
| 78 | }
|
---|
| 79 |
|
---|
[761] | 80 | void pageaction::set_homeextra_macro (displayclass &disp, recptprotolistclass *protos,
|
---|
| 81 | ostream &logout) {
|
---|
[421] | 82 |
|
---|
[761] | 83 | text_t homeextra = "<center><table width=_pagewidth_><tr valign=top>\n";
|
---|
[1276] | 84 | bool found_valid_col = false;
|
---|
[761] | 85 |
|
---|
| 86 | recptprotolistclass::iterator rprotolist_here = protos->begin();
|
---|
| 87 | recptprotolistclass::iterator rprotolist_end = protos->end();
|
---|
| 88 | while (rprotolist_here != rprotolist_end) {
|
---|
| 89 | if ((*rprotolist_here).p != NULL) {
|
---|
| 90 |
|
---|
| 91 | text_tarray collist;
|
---|
| 92 | comerror_t err;
|
---|
| 93 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
| 94 | if (err == noError) {
|
---|
| 95 | text_tarray::iterator collist_here = collist.begin();
|
---|
| 96 | text_tarray::iterator collist_end = collist.end();
|
---|
[1247] | 97 |
|
---|
| 98 | int count = 0;
|
---|
| 99 | bool first = true;
|
---|
[761] | 100 | while (collist_here != collist_end) {
|
---|
[1270] | 101 | ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
|
---|
[761] | 102 |
|
---|
[1270] | 103 | if (cinfo != NULL) {
|
---|
| 104 | if (cinfo->isPublic && (cinfo->buildDate > 0)) {
|
---|
[761] | 105 |
|
---|
[1276] | 106 | found_valid_col = true;
|
---|
[761] | 107 | FilterResponse_t response;
|
---|
| 108 | text_tset metadata;
|
---|
| 109 | metadata.insert ("collectionname");
|
---|
| 110 | metadata.insert ("iconcollection");
|
---|
| 111 | metadata.insert ("iconcollectionsmall");
|
---|
| 112 | text_t collectionname = *collist_here;
|
---|
| 113 | text_t alt = collectionname;
|
---|
| 114 | if (get_info ("collection", *collist_here, metadata, false,
|
---|
| 115 | (*rprotolist_here).p, response, logout)) {
|
---|
| 116 | if (!response.docInfo[0].metadata["collectionname"].values[0].empty())
|
---|
| 117 | alt = response.docInfo[0].metadata["collectionname"].values[0];
|
---|
| 118 |
|
---|
| 119 | if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty())
|
---|
[1759] | 120 | collectionname = "<img width=150 border=1 src=\""
|
---|
| 121 | + response.docInfo[0].metadata["iconcollectionsmall"].values[0]
|
---|
| 122 | + "\" alt=\"" + alt + "\">";
|
---|
[761] | 123 | else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty())
|
---|
| 124 | collectionname = "<img width=150 border=1 src=\""
|
---|
| 125 | + response.docInfo[0].metadata["iconcollection"].values[0]
|
---|
| 126 | + "\" alt=\"" + alt + "\">";
|
---|
| 127 | else collectionname = alt;
|
---|
| 128 | }
|
---|
[1247] | 129 | if ((count%3 == 0) && (!first))
|
---|
| 130 | homeextra += "</tr><tr valign=top>\n";
|
---|
[970] | 131 |
|
---|
[761] | 132 | text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">";
|
---|
| 133 | if (*collist_here == "chinese")
|
---|
| 134 | link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">";
|
---|
[866] | 135 | if (*collist_here == "arabic")
|
---|
[1247] | 136 | link = "<a href=\"_gwcgi_?a=p&p=about&l=ar&nw=u&c=" + *collist_here + "\">";
|
---|
[761] | 137 |
|
---|
[1270] | 138 | if (!cinfo->receptionist.empty())
|
---|
| 139 | link = "<a href=\"" + cinfo->receptionist + "\">";
|
---|
[761] | 140 |
|
---|
[1247] | 141 | homeextra += "<td>" + link + collectionname + "</a></td>\n";
|
---|
[761] | 142 |
|
---|
| 143 | count ++;
|
---|
[1247] | 144 | first = false;
|
---|
[761] | 145 | }
|
---|
| 146 | }
|
---|
| 147 | collist_here ++;
|
---|
| 148 | }
|
---|
[1347] | 149 |
|
---|
| 150 | // disp.setmacro ("homeextra", "home", homeextra);
|
---|
[1247] | 151 | for (; count%3 != 0; count ++) homeextra += "<td></td>\n";
|
---|
[761] | 152 | }
|
---|
| 153 | }
|
---|
[1347] | 154 | homeextra += "</td></tr>\n<tr>\n";
|
---|
[761] | 155 | rprotolist_here ++;
|
---|
| 156 | }
|
---|
[1276] | 157 |
|
---|
| 158 | if (!found_valid_col) {
|
---|
| 159 | homeextra += "<td>No valid (i.e. built and public) collections are available</td>\n";
|
---|
| 160 | }
|
---|
| 161 | homeextra += "</tr></table></center>\n";
|
---|
| 162 | disp.setmacro ("homeextra", "home", homeextra);
|
---|
[761] | 163 | }
|
---|
| 164 |
|
---|
| 165 | void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
| 166 | recptprotolistclass *protos, ostream &logout) {
|
---|
| 167 |
|
---|
[284] | 168 | // define_internal_macros sets the following macros:
|
---|
| 169 |
|
---|
[866] | 170 | // _numdocs_ the number of documents in the collection
|
---|
| 171 |
|
---|
| 172 | // _builddate_ the date last built
|
---|
| 173 |
|
---|
| 174 |
|
---|
[471] | 175 | // if page is "home"
|
---|
| 176 | // _homeextra_ this is the list of available collections and collection info
|
---|
| 177 | // to be displayed on the home page
|
---|
[284] | 178 |
|
---|
[471] | 179 |
|
---|
[866] | 180 | // if page is "preferences"
|
---|
| 181 | // _collectionoption_ collections to search/browse (if cross-collection-searching is on)
|
---|
| 182 |
|
---|
| 183 | // _htmloptions_ set to _htmloptionson_ if DocumentUseHTML is set
|
---|
| 184 |
|
---|
[867] | 185 | // _PreferencesDocsFromWeb_ set to 1 if corresponding format option is set
|
---|
[866] | 186 |
|
---|
[867] | 187 | // _languageoption_ interface languages to select from (dependant on PreferenceLanguages)
|
---|
| 188 |
|
---|
| 189 | // _encodingoption_ will be overridden to "" if chinese language interface isn't specified
|
---|
| 190 |
|
---|
[471] | 191 | // if page is "about"
|
---|
[866] | 192 | // _textsubcollections_ the text on which subcollections make up the collection (if
|
---|
| 193 | // cross-collection searching is being used
|
---|
[471] | 194 |
|
---|
| 195 | // _textbrowseoptions_ the 'how to find information' text in the about and help pages
|
---|
| 196 |
|
---|
| 197 | // _numbrowseoptions_ the number of browsing options
|
---|
| 198 |
|
---|
| 199 |
|
---|
| 200 | // if page is "help"
|
---|
| 201 | // _textbrowseoptions_ the 'how to find information' text in the about and help pages
|
---|
| 202 |
|
---|
| 203 | // _numbrowseoptions_ the number of browsing options
|
---|
| 204 |
|
---|
[875] | 205 | // _topicreadingdocs_ this section of the help text differs depending on what type of
|
---|
| 206 | // _textreadingdocs_ collection it is (e.g. html collection, bibliographic collection etc.)
|
---|
| 207 | // _texthelpreadingdocs_
|
---|
| 208 |
|
---|
[1759] | 209 | // _textgocollector_ set to "" if collector is disabled in main.cfg
|
---|
| 210 | // _textgoadmin_ set to "" if status is disabled in main.cfg
|
---|
| 211 |
|
---|
[471] | 212 |
|
---|
[1270] | 213 | if (recpt == NULL) {
|
---|
| 214 | logout << "ERROR (pageaction::define_internal_macros): This action does not contain\n"
|
---|
| 215 | << " information about any receptionists. The method set_receptionist was\n"
|
---|
| 216 | << " probably not called from the module which instantiated this action.\n";
|
---|
| 217 | return;
|
---|
| 218 | }
|
---|
| 219 |
|
---|
[471] | 220 | text_t &arg_p = args["p"];
|
---|
[866] | 221 | text_t &arg_c = args["c"];
|
---|
[1270] | 222 | ColInfoResponse_t *cinfo = NULL;
|
---|
[471] | 223 |
|
---|
[866] | 224 | recptproto* collectproto = protos->getrecptproto (arg_c, logout);
|
---|
[793] | 225 | if (collectproto != NULL) {
|
---|
[1270] | 226 | cinfo = recpt->get_collectinfo_ptr (collectproto, arg_c, logout);
|
---|
[866] | 227 |
|
---|
[1270] | 228 | disp.setmacro ("numdocs", "Global", cinfo->numDocs);
|
---|
[793] | 229 | unsigned long current_time = time(NULL);
|
---|
[1270] | 230 | unsigned long builddate = (current_time - cinfo->buildDate) / 86400;
|
---|
[793] | 231 | disp.setmacro ("builddate", "Global", builddate);
|
---|
| 232 | }
|
---|
| 233 |
|
---|
[1759] | 234 | if (arg_p == "home") {
|
---|
| 235 | set_homeextra_macro (disp, protos, logout);
|
---|
| 236 | if (status_disabled) disp.setmacro ("textgoadmin", "home", "");
|
---|
| 237 | if (collector_disabled) disp.setmacro ("textgocollector", "home", "");
|
---|
| 238 | }
|
---|
[284] | 239 |
|
---|
[866] | 240 | else if (arg_p == "preferences") {
|
---|
| 241 |
|
---|
| 242 | // _collectionoption_
|
---|
| 243 |
|
---|
[1270] | 244 | if (args["ccs"] == "1" && collectproto != NULL && (cinfo->ccsCols.size() > 1)) {
|
---|
[866] | 245 | text_t collectionoption = "_textcollectionoption_";
|
---|
[1270] | 246 | text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
|
---|
| 247 | text_tarray::const_iterator col_end = cinfo->ccsCols.end();
|
---|
[905] | 248 | int count = 0;
|
---|
[866] | 249 | while (col_here != col_end) {
|
---|
| 250 | text_t colname;
|
---|
| 251 | if (*col_here == arg_c) {
|
---|
[1270] | 252 | colname = cinfo->collectionmeta["collectionname"];
|
---|
[866] | 253 | } else {
|
---|
[1270] | 254 | ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout);
|
---|
| 255 | if (this_cinfo == NULL) {col_here ++; continue;}
|
---|
| 256 | colname = this_cinfo->collectionmeta["collectionname"];
|
---|
[866] | 257 | }
|
---|
| 258 |
|
---|
[905] | 259 | count ++;
|
---|
[866] | 260 | collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
|
---|
| 261 | *col_here + "\" onClick=\"updatecc(\'" + *col_here + "\');\"> " +
|
---|
| 262 | colname + "<br>\n";
|
---|
| 263 | col_here ++;
|
---|
| 264 | }
|
---|
[905] | 265 |
|
---|
| 266 | if (count > 1)
|
---|
| 267 | disp.setmacro ("collectionoption", "preferences", collectionoption);
|
---|
[866] | 268 | }
|
---|
| 269 |
|
---|
| 270 | // _htmloptions_
|
---|
| 271 |
|
---|
[1270] | 272 | text_tmap::const_iterator it = cinfo->format.find ("DocumentUseHTML");
|
---|
| 273 | if ((it != cinfo->format.end()) && ((*it).second == "true")) {
|
---|
[866] | 274 | disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
|
---|
| 275 |
|
---|
[867] | 276 |
|
---|
| 277 | // _PreferenceDocsFromWeb_
|
---|
| 278 |
|
---|
[1270] | 279 | it = cinfo->format.find ("PreferenceDocsFromWeb");
|
---|
| 280 | if ((it == cinfo->format.end()) || ((*it).second == "true"))
|
---|
[867] | 281 | disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | // _languageoption_
|
---|
| 285 | // this is kind of a hack (another one!!). note that there're potential
|
---|
| 286 | // problems here as no checking is done anywhere to make sure language
|
---|
| 287 | // is set to a valid value. this does allow us to set which languages
|
---|
| 288 | // should go in the preference selection box (from collect.cfg) however
|
---|
| 289 | // and that's sufficient for current requirements
|
---|
[866] | 290 |
|
---|
[867] | 291 | // currently supported languages (_languageoption_ will default to all
|
---|
| 292 | // these languages unless PreferenceLanguages is set
|
---|
| 293 | text_tarray languages;
|
---|
| 294 | languages.push_back ("en");
|
---|
[1212] | 295 | languages.push_back ("fr");
|
---|
[1033] | 296 | languages.push_back ("de");
|
---|
[1212] | 297 | languages.push_back ("es");
|
---|
[867] | 298 | languages.push_back ("mi");
|
---|
| 299 | languages.push_back ("zh");
|
---|
[1234] | 300 | languages.push_back ("ar");
|
---|
[1460] | 301 | languages.push_back ("pt");
|
---|
[1535] | 302 | languages.push_back ("nl");
|
---|
[867] | 303 | text_tarray::const_iterator this_lang = languages.begin();
|
---|
| 304 | text_tarray::const_iterator end_lang = languages.end();
|
---|
| 305 |
|
---|
| 306 | text_t languageoption = "_textlanguage_\n<select name=\"l\" onChange=\"updatel();\">\n";
|
---|
[1270] | 307 | it = cinfo->format.find ("PreferenceLanguages");
|
---|
| 308 | if ((it != cinfo->format.end()) && (!(*it).second.empty())) {
|
---|
[867] | 309 | text_tset pref_langs;
|
---|
| 310 | splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
|
---|
| 311 | if (pref_langs.size() > 1) {
|
---|
| 312 | while (this_lang != end_lang) {
|
---|
| 313 | if (pref_langs.find(*this_lang) != pref_langs.end())
|
---|
| 314 | languageoption += "_" + *this_lang + "languageoption_\n";
|
---|
| 315 | this_lang ++;
|
---|
| 316 | }
|
---|
| 317 | languageoption += "</select>\n";
|
---|
| 318 | disp.setmacro ("languageoption", "preferences", languageoption);
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | // _encodingoption_
|
---|
| 322 |
|
---|
| 323 | if (pref_langs.find("zh") == pref_langs.end())
|
---|
| 324 | disp.setmacro ("encodingoption", "preferences", "");
|
---|
| 325 |
|
---|
| 326 | } else {
|
---|
| 327 | while (this_lang != end_lang) {
|
---|
| 328 | languageoption += "_" + *this_lang + "languageoption_\n";
|
---|
| 329 | this_lang ++;
|
---|
| 330 | }
|
---|
| 331 | languageoption += "</select>\n";
|
---|
| 332 | disp.setmacro ("languageoption", "preferences", languageoption);
|
---|
| 333 | }
|
---|
| 334 |
|
---|
[866] | 335 | } else if (arg_p == "about" || arg_p == "help") {
|
---|
[761] | 336 | if (collectproto == NULL) return;
|
---|
| 337 |
|
---|
[471] | 338 | // _textbrowseoptions_ and _numbrowseoptions_
|
---|
[761] | 339 |
|
---|
[471] | 340 | FilterResponse_t response;
|
---|
[649] | 341 | text_tset metadata;
|
---|
| 342 | metadata.insert ("Title");
|
---|
[471] | 343 | bool getParents = false;
|
---|
| 344 | get_children ("", args["c"], metadata, getParents, collectproto, response, logout);
|
---|
| 345 |
|
---|
| 346 | disp.setmacro ("numbrowseoptions", "help", response.docInfo.size()+1);
|
---|
| 347 |
|
---|
[649] | 348 | ResultDocInfo_tarray::iterator here = response.docInfo.begin();
|
---|
| 349 | ResultDocInfo_tarray::iterator end = response.docInfo.end();
|
---|
[471] | 350 |
|
---|
| 351 | // we're assuming that we've always got a search button
|
---|
| 352 | text_t shorttext = "<ul><li>_textSearchshort_\n";
|
---|
| 353 | text_t longtext = "_textSearchlong_";
|
---|
| 354 |
|
---|
| 355 | while (here != end) {
|
---|
[649] | 356 | text_t title = (*here).metadata["Title"].values[0];
|
---|
[604] | 357 |
|
---|
[649] | 358 | text_t stext, ltext;
|
---|
[729] | 359 | disp.expandstring ("help", "_text" + title + "short_", stext);
|
---|
[649] | 360 | if (stext == ("_text" + title + "short_")) {
|
---|
[729] | 361 | shorttext += "<li>_help:textdefaultshorttext_";
|
---|
| 362 | longtext += "_help:textdefaultlongtext_";
|
---|
[649] | 363 | } else {
|
---|
[1667] | 364 | shorttext += "<li>_help:text" + title + "short_";
|
---|
[729] | 365 | longtext += "_help:text" + title + "long_";
|
---|
[649] | 366 | }
|
---|
[729] | 367 |
|
---|
[471] | 368 | here ++;
|
---|
| 369 | }
|
---|
| 370 | shorttext += "</ul>\n";
|
---|
[867] | 371 | if (response.docInfo.size() > 1) disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
|
---|
| 372 | else disp.setmacro ("textbrowseoptions", "help", longtext);
|
---|
[866] | 373 |
|
---|
[875] | 374 | if (arg_p == "help") {
|
---|
| 375 |
|
---|
| 376 | // _topicreadingdocs_ _textreadingdocs_ _texthelpreadingdocs_
|
---|
| 377 |
|
---|
| 378 | // if HTML collection there's no how to read document text
|
---|
[1270] | 379 | text_tmap::const_iterator it = cinfo->format.find ("HelpNoDocs");
|
---|
| 380 | if ((it != cinfo->format.end()) && ((*it).second == "true")) {
|
---|
[875] | 381 | disp.setmacro ("topicreadingdocs", "help", "");
|
---|
| 382 | disp.setmacro ("texthelpreadingdocs", "help", "");
|
---|
| 383 | }
|
---|
[1270] | 384 | it = cinfo->format.find ("HelpBibDocs");
|
---|
| 385 | if ((it != cinfo->format.end()) && ((*it).second == "true")) {
|
---|
[875] | 386 | disp.setmacro ("texthelpreadingdocs", "help", "_bibtexthelpreadingdocs_");
|
---|
| 387 | disp.setmacro ("textreadingdocs", "help", "_bibtextreadingdocs_");
|
---|
| 388 | }
|
---|
[1270] | 389 | it = cinfo->format.find ("HelpBookDocs");
|
---|
| 390 | if ((it != cinfo->format.end()) && ((*it).second == "true")) {
|
---|
[875] | 391 | disp.setmacro ("texthelpreadingdocs", "help", "_booktexthelpreadingdocs_");
|
---|
| 392 | disp.setmacro ("textreadingdocs", "help", "_booktextreadingdocs_");
|
---|
| 393 | }
|
---|
| 394 |
|
---|
| 395 | }
|
---|
[866] | 396 | if (arg_p == "about") {
|
---|
| 397 |
|
---|
| 398 | // _textsubcollections_
|
---|
[1270] | 399 | if (args["ccs"] == "1" && (cinfo->ccsCols.size() > 1)) {
|
---|
| 400 | text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo->ccsCols.size()) + ")";
|
---|
| 401 | text_tarray::const_iterator here = cinfo->ccsCols.begin();
|
---|
| 402 | text_tarray::const_iterator end = cinfo->ccsCols.end();
|
---|
[867] | 403 | bool first = true;
|
---|
[905] | 404 | int count = 0;
|
---|
[866] | 405 | while (here != end) {
|
---|
| 406 | if (*here == arg_c) {
|
---|
[867] | 407 | if (!first) textsubcollections += "<br>";
|
---|
[1270] | 408 | textsubcollections += "\n" + cinfo->collectionmeta["collectionname"] + "\n";
|
---|
[866] | 409 | } else {
|
---|
[1270] | 410 | ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout);
|
---|
| 411 | if (this_cinfo == NULL) {here ++; continue;}
|
---|
[905] | 412 | if (!first) textsubcollections += "<br>";
|
---|
[1270] | 413 | textsubcollections += "\n" + this_cinfo->collectionmeta["collectionname"] + "\n";
|
---|
[866] | 414 | }
|
---|
[905] | 415 | count ++;
|
---|
[867] | 416 | first = false;
|
---|
[866] | 417 | here ++;
|
---|
| 418 | }
|
---|
| 419 | textsubcollections += "_textsubcols2_";
|
---|
[905] | 420 | if (count > 1)
|
---|
| 421 | disp.setmacro ("textsubcollections", "about", textsubcollections);
|
---|
[866] | 422 | }
|
---|
| 423 | }
|
---|
[471] | 424 | }
|
---|
[284] | 425 | }
|
---|
| 426 |
|
---|
[761] | 427 | bool pageaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
|
---|
| 428 | browsermapclass * /*browsers*/, displayclass &disp,
|
---|
[421] | 429 | outconvertclass &outconvert, ostream &textout,
|
---|
| 430 | ostream &/*logout*/) {
|
---|
[173] | 431 |
|
---|
[172] | 432 | text_t &arg_p = args["p"];
|
---|
[160] | 433 |
|
---|
[172] | 434 | textout << outconvert << disp << ("_" + arg_p + ":header_\n")
|
---|
[266] | 435 | << ("_" + arg_p + ":content_\n")
|
---|
[172] | 436 | << ("_" + arg_p + ":footer_\n");
|
---|
| 437 |
|
---|
[160] | 438 | return true;
|
---|
| 439 | }
|
---|
[1759] | 440 |
|
---|
| 441 | void pageaction::configure (const text_t &key, const text_tarray &cfgline) {
|
---|
| 442 | if ((key == "status") && (cfgline.size() == 1) &&
|
---|
| 443 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
| 444 | status_disabled = false;
|
---|
| 445 | } else if ((key == "collector") && (cfgline.size() == 1) &&
|
---|
| 446 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
| 447 | collector_disabled = false;
|
---|
| 448 | } else {
|
---|
| 449 | // call the parent class to deal with the things which
|
---|
| 450 | // are not dealt with here
|
---|
| 451 | action::configure (key, cfgline);
|
---|
| 452 | }
|
---|
| 453 | }
|
---|