[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 |
|
---|
[4905] | 26 | // Changelog:
|
---|
| 27 |
|
---|
| 28 | // 11th July 2003:
|
---|
| 29 |
|
---|
| 30 | // Added 3 functions to deal with the collection style
|
---|
| 31 | // A deciding function and then 2 functions that actually
|
---|
| 32 | // do the work for us, either images or pulldown.
|
---|
| 33 |
|
---|
| 34 |
|
---|
[471] | 35 | #include "OIDtools.h"
|
---|
[160] | 36 | #include "pageaction.h"
|
---|
[172] | 37 | #include "receptionist.h"
|
---|
[2767] | 38 | #include "fileutil.h"
|
---|
[2785] | 39 | #include "gsdltools.h"
|
---|
[11986] | 40 | #include "querytools.h"
|
---|
[284] | 41 | #include <time.h>
|
---|
[160] | 42 |
|
---|
[284] | 43 | pageaction::pageaction () {
|
---|
[160] | 44 |
|
---|
[1759] | 45 | status_disabled = true;
|
---|
| 46 | collector_disabled = true;
|
---|
[11998] | 47 | depositor_disabled = true;
|
---|
[3774] | 48 | translator_disabled = true;
|
---|
[7762] | 49 | gliapplet_disabled = true;
|
---|
[284] | 50 | recpt = NULL;
|
---|
| 51 |
|
---|
[452] | 52 | // this action uses cgi variables "a", "p", and "hp"
|
---|
[160] | 53 | cgiarginfo arg_ainfo;
|
---|
| 54 | arg_ainfo.shortname = "a";
|
---|
| 55 | arg_ainfo.longname = "action";
|
---|
| 56 | arg_ainfo.multiplechar = true;
|
---|
| 57 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
[165] | 58 | arg_ainfo.argdefault = "p";
|
---|
[160] | 59 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
| 60 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
| 61 |
|
---|
| 62 | arg_ainfo.shortname = "p";
|
---|
| 63 | arg_ainfo.longname = "page";
|
---|
| 64 | arg_ainfo.multiplechar = true;
|
---|
| 65 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
[771] | 66 | arg_ainfo.argdefault = "home";
|
---|
[511] | 67 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
[160] | 68 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
[452] | 69 |
|
---|
| 70 | arg_ainfo.shortname = "hp";
|
---|
| 71 | arg_ainfo.longname = "html page";
|
---|
| 72 | arg_ainfo.multiplechar = true;
|
---|
| 73 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
[7441] | 74 | arg_ainfo.argdefault = g_EmptyText;
|
---|
[452] | 75 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
| 76 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
[2415] | 77 |
|
---|
| 78 | arg_ainfo.shortname = "bp";
|
---|
| 79 | arg_ainfo.longname = "set preferences button";
|
---|
| 80 | arg_ainfo.multiplechar = true;
|
---|
| 81 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
[7441] | 82 | arg_ainfo.argdefault = g_EmptyText;
|
---|
[2415] | 83 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
| 84 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
[2664] | 85 |
|
---|
| 86 | // the "u" argument will disable the search facility, remove links to the
|
---|
| 87 | // home and preferences pages, and disable the DocumentButton buttons
|
---|
| 88 | // (for use when generating static html versions of collections)
|
---|
| 89 | arg_ainfo.shortname = "u";
|
---|
| 90 | arg_ainfo.longname = "static page";
|
---|
| 91 | arg_ainfo.multiplechar = false;
|
---|
| 92 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
| 93 | arg_ainfo.argdefault = "0";
|
---|
| 94 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
| 95 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
[160] | 96 | }
|
---|
| 97 |
|
---|
| 98 | pageaction::~pageaction () {
|
---|
| 99 | }
|
---|
| 100 |
|
---|
[2415] | 101 | bool pageaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args,
|
---|
[3546] | 102 | recptprotolistclass * /*protos*/, ostream &/*logout*/) {
|
---|
[2415] | 103 |
|
---|
| 104 | if (args["p"] == "preferences" && !args["bp"].empty()) {
|
---|
| 105 | if (args["hd"] != "0") args["hd"] = args["hdn"];
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[160] | 108 | return true;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
[761] | 111 | void pageaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
|
---|
| 112 | response_t &response,text_t &response_data,
|
---|
| 113 | ostream &/*logout*/) {
|
---|
[160] | 114 | response = content;
|
---|
| 115 | response_data = "text/html";
|
---|
| 116 | }
|
---|
| 117 |
|
---|
[4905] | 118 | // This function helps decide whether we want a
|
---|
| 119 | // images or pulldown style collection display
|
---|
| 120 | // We refer to the macro files for the options
|
---|
| 121 | // for images or pulldown menu and use that to
|
---|
| 122 | // switch to the appropriate function to do the job
|
---|
| 123 |
|
---|
| 124 | // Aly Dharshi
|
---|
| 125 | // 11th July 2003
|
---|
| 126 |
|
---|
| 127 | void pageaction::homepagestyle(displayclass &disp, recptprotolistclass *protos,
|
---|
| 128 | cgiargsclass &args, ostream &logout)
|
---|
| 129 | {
|
---|
| 130 |
|
---|
| 131 | const recptconf &configinfo = recpt->get_configinfo();
|
---|
| 132 |
|
---|
| 133 | if (configinfo.HomePageType == "images") {
|
---|
| 134 | home_images(disp, protos, args, configinfo, logout);
|
---|
| 135 |
|
---|
| 136 | } else
|
---|
| 137 | {
|
---|
| 138 | home_pulldown(disp, protos, args, configinfo, logout);
|
---|
| 139 | }
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | // This function allows for the Greenstone
|
---|
| 143 | // collection to be displayed in a pull down
|
---|
| 144 | // menu similar to that in documentaction.cpp
|
---|
| 145 |
|
---|
| 146 | // Aly Dharshi
|
---|
| 147 | // 11th July 2003
|
---|
| 148 |
|
---|
| 149 | void pageaction::home_pulldown(displayclass &disp, recptprotolistclass *protos,
|
---|
| 150 | cgiargsclass &args, const recptconf &configinfo,
|
---|
| 151 | ostream &logout) {
|
---|
| 152 |
|
---|
| 153 | text_t homeextra = "<form method=\"get\" name=\"browse\">\n";
|
---|
| 154 | homeextra += "<select name=\"collections\" onChange=\"location.href=";
|
---|
| 155 | homeextra += "document.browse.collections.options[document.browse.collections.selectedIndex].value\">\n";
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 | recptprotolistclass::iterator rprotolist_here = protos->begin();
|
---|
| 159 | recptprotolistclass::iterator rprotolist_end = protos->end();
|
---|
| 160 | while (rprotolist_here != rprotolist_end) {
|
---|
| 161 | if ((*rprotolist_here).p != NULL) {
|
---|
| 162 |
|
---|
| 163 | text_tarray collist;
|
---|
| 164 | comerror_t err;
|
---|
| 165 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
| 166 | if (err == noError) {
|
---|
| 167 | text_tarray::iterator collist_here = collist.begin();
|
---|
| 168 | text_tarray::iterator collist_end = collist.end();
|
---|
| 169 |
|
---|
| 170 | int count = 0;
|
---|
| 171 | bool first = true;
|
---|
| 172 | while (collist_here != collist_end) {
|
---|
| 173 | ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
|
---|
| 174 |
|
---|
| 175 | if (cinfo != NULL) {
|
---|
| 176 | if (cinfo->isPublic && (cinfo->buildDate > 0)) {
|
---|
| 177 |
|
---|
[9931] | 178 | text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]);
|
---|
| 179 | if (collectionname.empty()) {
|
---|
| 180 | collectionname = *collist_here;
|
---|
[7130] | 181 | }
|
---|
[4905] | 182 |
|
---|
| 183 | comerror_t err;
|
---|
[7441] | 184 | text_t optsite = g_EmptyText;
|
---|
[4905] | 185 | text_t site_name = (*rprotolist_here).p->get_site_name (err);
|
---|
[10873] | 186 | if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
|
---|
[4905] | 187 |
|
---|
[11986] | 188 | text_t link = "_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here;
|
---|
[10873] | 189 | link += "&l=" + args["l"] + "&w=" + args["w"];
|
---|
[4905] | 190 |
|
---|
| 191 | // We are "dynamically" overriding so to speak the
|
---|
| 192 | // link to the collection aka receptionist.
|
---|
| 193 |
|
---|
| 194 | if (!cinfo->receptionist.empty())
|
---|
| 195 | link = cinfo->receptionist;
|
---|
| 196 |
|
---|
| 197 |
|
---|
| 198 | homeextra += "<option value=\"" + link + "\"";
|
---|
| 199 | homeextra += ">" + collectionname + "</option>\n";
|
---|
| 200 |
|
---|
| 201 | }
|
---|
| 202 |
|
---|
[9620] | 203 | ++collist_here;
|
---|
[4905] | 204 | }
|
---|
| 205 |
|
---|
| 206 | }
|
---|
| 207 | }
|
---|
[9620] | 208 | ++rprotolist_here;
|
---|
[4905] | 209 | }
|
---|
| 210 |
|
---|
| 211 | }
|
---|
| 212 | homeextra += "</select>\n";
|
---|
| 213 | homeextra += "</form>\n";
|
---|
| 214 |
|
---|
| 215 | disp.setmacro ("homeextra", "home", homeextra);
|
---|
| 216 | }
|
---|
| 217 |
|
---|
| 218 | // originally called set_homeextra_macro
|
---|
| 219 | // this function displays the Greenstone
|
---|
| 220 | // main page as usual with the graphics for
|
---|
| 221 | // the collections.
|
---|
| 222 |
|
---|
| 223 | // Aly Dharshi
|
---|
| 224 | // 11th July 2003
|
---|
| 225 |
|
---|
| 226 | void pageaction::home_images(displayclass &disp, recptprotolistclass *protos,
|
---|
| 227 | cgiargsclass &args, const recptconf &configinfo,
|
---|
| 228 | ostream &logout) {
|
---|
| 229 |
|
---|
[10873] | 230 | text_t homeextra = "<table class=\"collections\"><tr valign=\"top\">\n";
|
---|
[1276] | 231 | bool found_valid_col = false;
|
---|
[761] | 232 | recptprotolistclass::iterator rprotolist_here = protos->begin();
|
---|
| 233 | recptprotolistclass::iterator rprotolist_end = protos->end();
|
---|
| 234 | while (rprotolist_here != rprotolist_end) {
|
---|
| 235 | if ((*rprotolist_here).p != NULL) {
|
---|
| 236 |
|
---|
| 237 | text_tarray collist;
|
---|
| 238 | comerror_t err;
|
---|
| 239 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
| 240 | if (err == noError) {
|
---|
| 241 | text_tarray::iterator collist_here = collist.begin();
|
---|
| 242 | text_tarray::iterator collist_end = collist.end();
|
---|
[1247] | 243 |
|
---|
| 244 | int count = 0;
|
---|
| 245 | bool first = true;
|
---|
[761] | 246 | while (collist_here != collist_end) {
|
---|
[1270] | 247 | ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
|
---|
[761] | 248 |
|
---|
[1270] | 249 | if (cinfo != NULL) {
|
---|
| 250 | if (cinfo->isPublic && (cinfo->buildDate > 0)) {
|
---|
[1912] | 251 |
|
---|
[1276] | 252 | found_valid_col = true;
|
---|
[9931] | 253 | text_t collectionname = *collist_here;
|
---|
| 254 | text_t alt = cinfo->get_collectionmeta("collectionname", args["l"]);
|
---|
| 255 | if (alt.empty()) {
|
---|
| 256 | alt = collectionname;
|
---|
[7130] | 257 | }
|
---|
[9931] | 258 |
|
---|
| 259 | // url to image: try iconcollectionsmall, then iconcollection
|
---|
| 260 | text_t iconurl = cinfo->get_collectionmeta("iconcollectionsmall", args["l"]);
|
---|
| 261 | if (iconurl.empty()) {
|
---|
| 262 | iconurl = cinfo->get_collectionmeta("iconcollection", args["l"]);
|
---|
| 263 | }
|
---|
| 264 |
|
---|
| 265 | if (!iconurl.empty()) {
|
---|
[761] | 266 |
|
---|
[9931] | 267 | // check to see URL is local to colserver
|
---|
| 268 | text_t::iterator iconurl_head = iconurl.begin();
|
---|
| 269 | text_t iconhead = substr(iconurl_head,iconurl_head+16);
|
---|
| 270 | if (iconhead=="_httpcollection_") {
|
---|
| 271 |
|
---|
| 272 | // local and using _httpcollection_
|
---|
| 273 | text_t icontail = substr(iconurl_head+16,iconurl.end());
|
---|
| 274 | iconurl = "http://" + cinfo->httpdomain
|
---|
| 275 | + cinfo->httpprefix + "/collect/"
|
---|
| 276 | + *collist_here + "/" + icontail;
|
---|
[1877] | 277 | }
|
---|
[9931] | 278 | else if (iconurl[0]=='/') {
|
---|
| 279 |
|
---|
| 280 | // local but with full path
|
---|
| 281 | iconurl = "http://" + cinfo->httpdomain + iconurl;
|
---|
| 282 | }
|
---|
[7130] | 283 |
|
---|
[9931] | 284 | collectionname
|
---|
[11095] | 285 | = "<img width=\"150\" src=\"" + iconurl + "\" alt=\"" + alt + "\">";
|
---|
[9931] | 286 | } else {
|
---|
| 287 | collectionname = alt;
|
---|
[761] | 288 | }
|
---|
[9931] | 289 |
|
---|
[4905] | 290 | if ((count%configinfo.HomePageCols == 0) && (!first))
|
---|
[10873] | 291 | homeextra += "</tr><tr valign=\"top\">\n";
|
---|
[970] | 292 |
|
---|
[2113] | 293 | comerror_t err;
|
---|
[7441] | 294 | text_t optsite = g_EmptyText;
|
---|
[2113] | 295 | text_t site_name = (*rprotolist_here).p->get_site_name (err);
|
---|
[10873] | 296 | if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
|
---|
[1860] | 297 |
|
---|
[11986] | 298 | text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here;
|
---|
[10873] | 299 | link += "&l=" + args["l"] + "&w=" + args["w"] + "\">";
|
---|
[9931] | 300 |
|
---|
[1270] | 301 | if (!cinfo->receptionist.empty())
|
---|
| 302 | link = "<a href=\"" + cinfo->receptionist + "\">";
|
---|
[761] | 303 |
|
---|
[1247] | 304 | homeextra += "<td>" + link + collectionname + "</a></td>\n";
|
---|
[761] | 305 |
|
---|
[9620] | 306 | ++count;
|
---|
[1247] | 307 | first = false;
|
---|
[761] | 308 | }
|
---|
| 309 | }
|
---|
[9620] | 310 | ++collist_here;
|
---|
[761] | 311 | }
|
---|
[1347] | 312 |
|
---|
[9620] | 313 | for (; count%configinfo.HomePageCols != 0; ++count) homeextra += "<td></td>\n";
|
---|
[761] | 314 | }
|
---|
| 315 | }
|
---|
[10873] | 316 | homeextra += "</tr>\n<tr>\n";
|
---|
[9620] | 317 | ++rprotolist_here;
|
---|
[761] | 318 | }
|
---|
[1276] | 319 |
|
---|
| 320 | if (!found_valid_col) {
|
---|
| 321 | homeextra += "<td>No valid (i.e. built and public) collections are available</td>\n";
|
---|
| 322 | }
|
---|
[10873] | 323 | homeextra += "</tr></table>\n";
|
---|
[1276] | 324 | disp.setmacro ("homeextra", "home", homeextra);
|
---|
[761] | 325 | }
|
---|
| 326 |
|
---|
[9931] | 327 | void pageaction::set_collectionlist_macro (displayclass &disp,
|
---|
| 328 | recptprotolistclass *protos,
|
---|
| 329 | cgiargsclass &args,
|
---|
[2329] | 330 | ostream &logout) {
|
---|
| 331 |
|
---|
| 332 | text_t collectionlist;
|
---|
| 333 | int count = 0;
|
---|
| 334 |
|
---|
| 335 | recptprotolistclass::iterator rprotolist_here = protos->begin();
|
---|
| 336 | recptprotolistclass::iterator rprotolist_end = protos->end();
|
---|
| 337 | while (rprotolist_here != rprotolist_end) {
|
---|
| 338 | if ((*rprotolist_here).p != NULL) {
|
---|
| 339 |
|
---|
| 340 | text_tarray collist;
|
---|
| 341 | comerror_t err;
|
---|
| 342 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
| 343 | if (err == noError) {
|
---|
| 344 | text_tarray::iterator collist_here = collist.begin();
|
---|
| 345 | text_tarray::iterator collist_end = collist.end();
|
---|
| 346 |
|
---|
| 347 | while (collist_here != collist_end) {
|
---|
| 348 | ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
|
---|
| 349 |
|
---|
| 350 | if (cinfo != NULL) {
|
---|
| 351 | if (cinfo->isPublic && (cinfo->buildDate > 0)) {
|
---|
| 352 |
|
---|
[9620] | 353 | ++count;
|
---|
[2329] | 354 |
|
---|
[9931] | 355 | text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]);
|
---|
| 356 | if (collectionname.empty()) {
|
---|
| 357 | collectionname = *collist_here;
|
---|
[2329] | 358 | }
|
---|
| 359 |
|
---|
| 360 | comerror_t err;
|
---|
[7441] | 361 | text_t optsite = g_EmptyText;
|
---|
[2329] | 362 | text_t site_name = (*rprotolist_here).p->get_site_name (err);
|
---|
[10873] | 363 | if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
|
---|
[2329] | 364 |
|
---|
[11986] | 365 | text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + "\">";
|
---|
[2329] | 366 |
|
---|
| 367 | if (!cinfo->receptionist.empty())
|
---|
| 368 | link = "<a href=\"" + cinfo->receptionist + "\">";
|
---|
| 369 |
|
---|
| 370 | collectionlist += "<li>" + link + collectionname + "</a>\n";
|
---|
| 371 | }
|
---|
| 372 | }
|
---|
[9620] | 373 | ++collist_here;
|
---|
[2329] | 374 | }
|
---|
| 375 | }
|
---|
| 376 | }
|
---|
[9620] | 377 | ++rprotolist_here;
|
---|
[2329] | 378 | }
|
---|
| 379 |
|
---|
| 380 | if (count == 1) {
|
---|
[3047] | 381 | collectionlist = "<p>_text1coll_\n<ul>" +
|
---|
[2329] | 382 | collectionlist + "</ul>\n";
|
---|
| 383 | } else if (count > 1) {
|
---|
[3047] | 384 | collectionlist = "<p>_textmorecolls_(" + text_t(count) +
|
---|
| 385 | ")\n<ul>" + collectionlist + "</ul>\n";
|
---|
[2329] | 386 | }
|
---|
| 387 |
|
---|
| 388 | disp.setmacro ("collectionlist", "homehelp", collectionlist);
|
---|
| 389 | }
|
---|
| 390 |
|
---|
[2767] | 391 | void pageaction::set_documentation_macro (displayclass &disp) {
|
---|
| 392 |
|
---|
| 393 | text_t documentation;
|
---|
| 394 | text_t docsdir = filename_cat(gsdlhome, "docs");
|
---|
| 395 |
|
---|
| 396 | if (file_exists(filename_cat(docsdir, "User.pdf"))) {
|
---|
[11149] | 397 | documentation += "<tr valign=middle><td><a href=\"_httpdocs_/User.pdf\">_iconpdf_"
|
---|
[2767] | 398 | "</a></td><td>_textuserguide_</td></tr>";
|
---|
| 399 | }
|
---|
| 400 |
|
---|
| 401 | if (file_exists(filename_cat(docsdir, "Install.pdf"))) {
|
---|
[11149] | 402 | documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Install.pdf\">_iconpdf_"
|
---|
[2767] | 403 | "</a></td><td>_textinstallerguide_</td></tr>";
|
---|
| 404 | }
|
---|
| 405 |
|
---|
| 406 | if (file_exists(filename_cat(docsdir, "Develop.pdf"))) {
|
---|
[11149] | 407 | documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Develop.pdf\">_iconpdf_"
|
---|
[2767] | 408 | "</a></td><td>_textdeveloperguide_</td></tr>";
|
---|
| 409 | }
|
---|
| 410 |
|
---|
| 411 | if (file_exists(filename_cat(docsdir, "Paper.pdf"))) {
|
---|
[11149] | 412 | documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Paper.pdf\">_iconpdf_"
|
---|
[2767] | 413 | "</a></td><td>_textpaperguide_</td></tr>";
|
---|
| 414 | }
|
---|
[7149] | 415 |
|
---|
| 416 | if (file_exists(filename_cat(docsdir, "Organize.pdf"))) {
|
---|
[11149] | 417 | documentation += "<tr valign=middle><td><a href=\"_httpdocs_/Organize.pdf\">_iconpdf_"
|
---|
[7149] | 418 | "</a></td><td>_textorganizerguide_</td></tr>";
|
---|
| 419 | }
|
---|
[2767] | 420 |
|
---|
| 421 | if (!documentation.empty()) {
|
---|
| 422 | disp.setmacro("documentation", "docs", "<p>\n<table border=0>\n" + documentation + "\n</table>\n");
|
---|
| 423 | }
|
---|
| 424 | }
|
---|
| 425 |
|
---|
[2785] | 426 | void pageaction::set_macro_to_file_contents (displayclass &disp, const text_t ¯oname,
|
---|
| 427 | const text_t &packagename, const text_t &filename) {
|
---|
| 428 |
|
---|
| 429 | text_t filecontent;
|
---|
| 430 | char *filenamec = filename.getcstr();
|
---|
| 431 | ifstream file_in (filenamec);
|
---|
[9633] | 432 | delete []filenamec;
|
---|
[2785] | 433 | if (file_in) {
|
---|
| 434 | char c;
|
---|
| 435 | file_in.get(c);
|
---|
| 436 | while (!file_in.eof ()) {
|
---|
| 437 | if (c == '\n') filecontent += "<br>";
|
---|
| 438 | filecontent.push_back(c);
|
---|
| 439 | file_in.get(c);
|
---|
| 440 | }
|
---|
| 441 | file_in.close();
|
---|
| 442 | }
|
---|
| 443 | disp.setmacro (macroname, packagename, dm_safe(filecontent));
|
---|
| 444 | }
|
---|
| 445 |
|
---|
[3625] | 446 | void pageaction::set_language_encoding_macros(displayclass &disp, cgiargsclass &args,
|
---|
| 447 | recptprotolistclass *protos, ColInfoResponse_t *cinfo,
|
---|
| 448 | ostream &logout) {
|
---|
| 449 | // _languageoption_
|
---|
| 450 | // Create the "interface language" selection box for the preferences
|
---|
| 451 | // pages. You can use something like "format PreferenceLanguages
|
---|
| 452 | // en|fr|zn" from within a collect.cfg file to use only a subset of
|
---|
| 453 | // the available languages for any given collection (for
|
---|
| 454 | // collection-specific preferences pages). This facility is kind of
|
---|
| 455 | // ugly though and should be replaced by something better when the
|
---|
| 456 | // configuration files are tidied up (as should all the other
|
---|
| 457 | // "format Preference..." options).
|
---|
| 458 | text_t &arg_l = args["l"];
|
---|
| 459 | const recptconf &configinfo = recpt->get_configinfo();
|
---|
| 460 | // put languages in another map to sort them by longname
|
---|
| 461 | text_tmap languages;
|
---|
| 462 | languageinfo_tmap::const_iterator thislang = configinfo.languages.begin();
|
---|
| 463 | languageinfo_tmap::const_iterator endlang = configinfo.languages.end();
|
---|
| 464 | while (thislang != endlang) {
|
---|
| 465 | languages[(*thislang).second.longname] = (*thislang).first;
|
---|
[9620] | 466 | ++thislang;
|
---|
[3625] | 467 | }
|
---|
| 468 | text_tmap::iterator tlang = languages.begin();
|
---|
| 469 | text_tmap::iterator elang = languages.end();
|
---|
| 470 |
|
---|
| 471 | text_t languageoption;
|
---|
| 472 | bool collection_specific = false;
|
---|
| 473 |
|
---|
| 474 | if (cinfo != NULL) {
|
---|
| 475 | text_tmap::const_iterator it = cinfo->format.find ("PreferenceLanguages");
|
---|
| 476 | if ((it != cinfo->format.end()) && (!(*it).second.empty())) {
|
---|
| 477 | collection_specific = true;
|
---|
| 478 | text_tset pref_langs;
|
---|
| 479 | splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
|
---|
| 480 | if (pref_langs.size() > 1) {
|
---|
| 481 | while (tlang != elang) {
|
---|
| 482 | if (pref_langs.find((*tlang).second) != pref_langs.end()) {
|
---|
| 483 | languageoption += "<option value=\"" + (*tlang).second + "\"";
|
---|
| 484 | if ((*tlang).second == arg_l) languageoption += " selected";
|
---|
[7706] | 485 | languageoption += ">" + (*tlang).first + "</option>\n";
|
---|
[3625] | 486 | }
|
---|
[9620] | 487 | ++tlang;
|
---|
[3625] | 488 | }
|
---|
| 489 | }
|
---|
| 490 | }
|
---|
| 491 | }
|
---|
| 492 |
|
---|
| 493 | if (!collection_specific) {
|
---|
| 494 | while (tlang != elang) {
|
---|
| 495 | languageoption += "<option value=\"" + (*tlang).second + "\"";
|
---|
| 496 | if ((*tlang).second == arg_l) languageoption += " selected";
|
---|
[7706] | 497 | languageoption += ">" + (*tlang).first + "</option>\n";
|
---|
[9620] | 498 | ++tlang;
|
---|
[3625] | 499 | }
|
---|
| 500 | }
|
---|
| 501 |
|
---|
| 502 | if (!languageoption.empty()) {
|
---|
| 503 | languageoption = "<select name=\"l\" onChange=\"updatel();\">\n" + languageoption;
|
---|
| 504 | languageoption += "</select>\n";
|
---|
| 505 | disp.setmacro ("languageoption", args["p"], languageoption);
|
---|
| 506 | }
|
---|
| 507 |
|
---|
| 508 | // _encodingoption_
|
---|
| 509 | // create the "encoding" selection box for the preferences page
|
---|
| 510 | if (configinfo.encodings.size() > 1) {
|
---|
| 511 | text_t &arg_w = args["w"];
|
---|
| 512 | text_t encodingoption;
|
---|
| 513 | text_tmap::const_iterator thisenc = configinfo.encodings.begin();
|
---|
| 514 | text_tmap::const_iterator endenc = configinfo.encodings.end();
|
---|
| 515 | while (thisenc != endenc) {
|
---|
| 516 | encodingoption += "<option value=\"" + (*thisenc).second + "\"";
|
---|
| 517 | if ((*thisenc).second == arg_w) encodingoption += " selected";
|
---|
[7706] | 518 | encodingoption += ">" + (*thisenc).first + "</option>\n";
|
---|
[9620] | 519 | ++thisenc;
|
---|
[3625] | 520 | }
|
---|
| 521 |
|
---|
| 522 | encodingoption = "<select name=\"w\" onChange=\"updatew();\">\n" + encodingoption;
|
---|
| 523 | encodingoption += "</select>\n";
|
---|
| 524 | disp.setmacro ("encodingoption", args["p"], encodingoption);
|
---|
[9676] | 525 | } else if (configinfo.encodings.size() == 1) {
|
---|
| 526 | text_t encodingoption;
|
---|
| 527 | text_tmap::const_iterator thisenc = configinfo.encodings.begin();
|
---|
| 528 | encodingoption = (*thisenc).first;
|
---|
| 529 | disp.setmacro ("encodingoption", args["p"], encodingoption);
|
---|
| 530 | } else { // size == 0. shouldn't really happen, but allow it
|
---|
| 531 | disp.setmacro ("encodingoption", args["p"], "None");
|
---|
[3625] | 532 | }
|
---|
[9676] | 533 |
|
---|
[3625] | 534 | }
|
---|
| 535 |
|
---|
[11986] | 536 |
|
---|
[761] | 537 | void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
|
---|
| 538 | recptprotolistclass *protos, ostream &logout) {
|
---|
| 539 |
|
---|
[284] | 540 | // define_internal_macros sets the following macros:
|
---|
| 541 |
|
---|
[866] | 542 | // _numdocs_ the number of documents in the collection
|
---|
| 543 |
|
---|
| 544 | // _builddate_ the date last built
|
---|
| 545 |
|
---|
[471] | 546 | // if page is "home"
|
---|
| 547 | // _homeextra_ this is the list of available collections and collection info
|
---|
| 548 | // to be displayed on the home page
|
---|
[284] | 549 |
|
---|
[471] | 550 |
|
---|
[866] | 551 | // if page is "preferences"
|
---|
| 552 | // _collectionoption_ collections to search/browse (if cross-collection-searching is on)
|
---|
| 553 |
|
---|
| 554 | // _htmloptions_ set to _htmloptionson_ if DocumentUseHTML is set
|
---|
| 555 |
|
---|
[867] | 556 | // _PreferencesDocsFromWeb_ set to 1 if corresponding format option is set
|
---|
[866] | 557 |
|
---|
[3625] | 558 |
|
---|
| 559 | // if page is "preferences" or "homepref"
|
---|
[867] | 560 | // _languageoption_ interface languages to select from (dependant on PreferenceLanguages)
|
---|
| 561 |
|
---|
[1856] | 562 | // _encodingoption_ encodings to select from
|
---|
[867] | 563 |
|
---|
[3625] | 564 |
|
---|
[471] | 565 | // if page is "about"
|
---|
[866] | 566 | // _textsubcollections_ the text on which subcollections make up the collection (if
|
---|
| 567 | // cross-collection searching is being used
|
---|
[471] | 568 |
|
---|
| 569 | // _textbrowseoptions_ the 'how to find information' text in the about and help pages
|
---|
| 570 |
|
---|
| 571 | // _numbrowseoptions_ the number of browsing options
|
---|
| 572 |
|
---|
[2415] | 573 | // _prefschanged_ will be set to _textprefschanged_ if the "set preferences" button
|
---|
| 574 | // was pressed
|
---|
[471] | 575 |
|
---|
[4774] | 576 | // _aboutqueryform_ will be set to "" if the collection isn't searchable
|
---|
[2415] | 577 |
|
---|
[471] | 578 | // if page is "help"
|
---|
| 579 | // _textbrowseoptions_ the 'how to find information' text in the about and help pages
|
---|
| 580 |
|
---|
| 581 | // _numbrowseoptions_ the number of browsing options
|
---|
| 582 |
|
---|
[875] | 583 | // _topicreadingdocs_ this section of the help text differs depending on what type of
|
---|
| 584 | // _textreadingdocs_ collection it is (e.g. html collection, bibliographic collection etc.)
|
---|
| 585 | // _texthelpreadingdocs_
|
---|
| 586 |
|
---|
[3812] | 587 | // if page is "home" or "homehelp"
|
---|
[1759] | 588 | // _textgocollector_ set to "" if collector is disabled in main.cfg
|
---|
[11998] | 589 | // _textgodepositor_ set to "" if depositor is disabled in main.cfg
|
---|
[1759] | 590 | // _textgoadmin_ set to "" if status is disabled in main.cfg
|
---|
[3774] | 591 | // _textgotranslator_ set to "" if translator is disabled in main.cfg
|
---|
[7762] | 592 | // _textgogliapplet_ set to "" if gliapplet is disabled in main.cfg
|
---|
[1759] | 593 |
|
---|
[2329] | 594 |
|
---|
| 595 | // if page is "homehelp"
|
---|
| 596 | // _collectionlist_ list of available collections to be displayed on the homehelp page
|
---|
[2767] | 597 |
|
---|
[471] | 598 |
|
---|
[2767] | 599 | // if page is "docs"
|
---|
| 600 | // _documentation_ links to PDF documents if they're available
|
---|
| 601 |
|
---|
[2785] | 602 |
|
---|
| 603 | // if page is "bsummary"
|
---|
| 604 | // _importlog_ set to contents of collections import.log file
|
---|
| 605 | // _faillog_ set to contents of collections fail.log file
|
---|
| 606 |
|
---|
[2767] | 607 |
|
---|
[1270] | 608 | if (recpt == NULL) {
|
---|
| 609 | logout << "ERROR (pageaction::define_internal_macros): This action does not contain\n"
|
---|
| 610 | << " information about any receptionists. The method set_receptionist was\n"
|
---|
| 611 | << " probably not called from the module which instantiated this action.\n";
|
---|
| 612 | return;
|
---|
| 613 | }
|
---|
| 614 |
|
---|
[471] | 615 | text_t &arg_p = args["p"];
|
---|
[866] | 616 | text_t &arg_c = args["c"];
|
---|
[1270] | 617 | ColInfoResponse_t *cinfo = NULL;
|
---|
[471] | 618 |
|
---|
[866] | 619 | recptproto* collectproto = protos->getrecptproto (arg_c, logout);
|
---|
[793] | 620 | if (collectproto != NULL) {
|
---|
[1270] | 621 | cinfo = recpt->get_collectinfo_ptr (collectproto, arg_c, logout);
|
---|
[2370] | 622 |
|
---|
[7432] | 623 | disp.setmacro ("numdocs", displayclass::defaultpackage, cinfo->numDocs);
|
---|
[793] | 624 | unsigned long current_time = time(NULL);
|
---|
[1270] | 625 | unsigned long builddate = (current_time - cinfo->buildDate) / 86400;
|
---|
[7432] | 626 | disp.setmacro ("builddate", displayclass::defaultpackage, builddate);
|
---|
[2370] | 627 |
|
---|
| 628 | text_t numbytes;
|
---|
| 629 | if ((cinfo->numBytes/(1024*1024)) > 1) {
|
---|
| 630 | numbytes = (text_t)(cinfo->numBytes/(1024*1024)) + " Mb";
|
---|
| 631 | } else if ((cinfo->numBytes/1024) > 1) {
|
---|
| 632 | numbytes = (text_t)(cinfo->numBytes/1024) + " kb";
|
---|
| 633 | } else {
|
---|
| 634 | numbytes = (text_t)cinfo->numBytes + " bytes";
|
---|
| 635 | }
|
---|
[7432] | 636 | disp.setmacro("numbytes", displayclass::defaultpackage, numbytes);
|
---|
[11986] | 637 |
|
---|
| 638 | // set up ct, qt, qto
|
---|
| 639 | set_query_type_args(cinfo, args);
|
---|
| 640 |
|
---|
[793] | 641 | }
|
---|
[11986] | 642 |
|
---|
[2782] | 643 | //setting _queryformcontent_ so that the query interface is consistent.
|
---|
[3880] | 644 | //also adding usability button if necessary
|
---|
[5509] | 645 | if (arg_p == "about") {
|
---|
| 646 | if (cinfo == NULL) {
|
---|
[7432] | 647 | disp.setmacro("cvariable", displayclass::defaultpackage, arg_c);
|
---|
[5509] | 648 | disp.setmacro("content", arg_p, "<p>_textbadcollection_<p>");
|
---|
| 649 | return;
|
---|
| 650 | }
|
---|
| 651 | else {
|
---|
[6810] | 652 |
|
---|
[2785] | 653 | text_tmap::iterator check = cinfo->format.find("QueryInterface");
|
---|
| 654 | if(check != cinfo->format.end()){
|
---|
| 655 | if((*check).second=="DateSearch"){
|
---|
[5633] | 656 | text_t current = "_datesearch_";
|
---|
| 657 | disp.setmacro("optdatesearch","query",current);
|
---|
[2785] | 658 | }
|
---|
[2782] | 659 | }
|
---|
[3880] | 660 | check = cinfo->format.find("Usability");
|
---|
| 661 | if(check != cinfo->format.end()){
|
---|
[11356] | 662 | disp.setmacro("usability", displayclass::defaultpackage, "_usablink_");
|
---|
[7432] | 663 | disp.setmacro("usabinterface", displayclass::defaultpackage, ("_usab"+(*check).second+"_"));
|
---|
| 664 | disp.setmacro("usabilityscript", displayclass::defaultpackage, "_usabshowscript_");
|
---|
[3880] | 665 | }
|
---|
[2782] | 666 | }
|
---|
| 667 | }
|
---|
[9931] | 668 |
|
---|
| 669 |
|
---|
[3812] | 670 | if (arg_p == "home" || arg_p == "homehelp") {
|
---|
[1759] | 671 | if (status_disabled) disp.setmacro ("textgoadmin", "home", "");
|
---|
| 672 | if (collector_disabled) disp.setmacro ("textgocollector", "home", "");
|
---|
[11998] | 673 | if (depositor_disabled) disp.setmacro ("textgodepositor", "home", "");
|
---|
[3774] | 674 | if (translator_disabled) disp.setmacro ("textgotranslator", "home", "");
|
---|
[3625] | 675 |
|
---|
[3812] | 676 | if (arg_p == "home") {
|
---|
[4905] | 677 | homepagestyle (disp, protos, args, logout);
|
---|
[3812] | 678 | } else if (arg_p == "homehelp") {
|
---|
[9931] | 679 | set_collectionlist_macro (disp, protos, args, logout);
|
---|
[3812] | 680 | }
|
---|
| 681 |
|
---|
[7762] | 682 | } else if (arg_p == "gli") {
|
---|
| 683 | if (gliapplet_disabled) disp.setmacro ("gliapplet", "gli", "");
|
---|
| 684 |
|
---|
[3625] | 685 | } else if (arg_p == "homepref") {
|
---|
[2782] | 686 |
|
---|
[3625] | 687 | // set _languageoption_ and _encodingoption_
|
---|
| 688 | set_language_encoding_macros(disp, args, protos, cinfo, logout);
|
---|
| 689 |
|
---|
| 690 | } else if (arg_p == "preferences") {
|
---|
[6810] | 691 |
|
---|
[5513] | 692 | if (cinfo == NULL) {
|
---|
[7432] | 693 | disp.setmacro("cvariable", displayclass::defaultpackage, arg_c);
|
---|
[5513] | 694 | disp.setmacro("content", arg_p, "<p>_textbadcollection_<p>");
|
---|
| 695 | return;
|
---|
| 696 | }
|
---|
| 697 |
|
---|
[2105] | 698 | if (collectproto == NULL) {return;}
|
---|
[3625] | 699 |
|
---|
| 700 | // set _languageoption_ and _encodingoption_
|
---|
| 701 | set_language_encoding_macros(disp, args, protos, cinfo, logout);
|
---|
| 702 |
|
---|
[866] | 703 | // _collectionoption_
|
---|
[2785] | 704 | if ((args["ccs"] == "1") && (cinfo->ccsCols.size() > 1)) {
|
---|
[866] | 705 | text_t collectionoption = "_textcollectionoption_";
|
---|
[1270] | 706 | text_tarray::const_iterator col_here = cinfo->ccsCols.begin();
|
---|
| 707 | text_tarray::const_iterator col_end = cinfo->ccsCols.end();
|
---|
[905] | 708 | int count = 0;
|
---|
[866] | 709 | while (col_here != col_end) {
|
---|
| 710 | text_t colname;
|
---|
| 711 | if (*col_here == arg_c) {
|
---|
[9931] | 712 | colname = cinfo->get_collectionmeta("collectionname", args["l"]);
|
---|
[866] | 713 | } else {
|
---|
[1270] | 714 | ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout);
|
---|
[9620] | 715 | if (this_cinfo == NULL) {++col_here; continue;}
|
---|
[9931] | 716 | colname = this_cinfo->get_collectionmeta("collectionname", args["l"]);
|
---|
[866] | 717 | }
|
---|
[9931] | 718 | if (colname.empty()) {
|
---|
| 719 | colname = *col_here;
|
---|
| 720 | }
|
---|
[9620] | 721 | ++count;
|
---|
[866] | 722 | collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
|
---|
| 723 | *col_here + "\" onClick=\"updatecc(\'" + *col_here + "\');\"> " +
|
---|
| 724 | colname + "<br>\n";
|
---|
[9620] | 725 | ++col_here;
|
---|
[866] | 726 | }
|
---|
[905] | 727 |
|
---|
| 728 | if (count > 1)
|
---|
| 729 | disp.setmacro ("collectionoption", "preferences", collectionoption);
|
---|
[866] | 730 | }
|
---|
| 731 |
|
---|
| 732 | // _htmloptions_
|
---|
| 733 |
|
---|
[1270] | 734 | text_tmap::const_iterator it = cinfo->format.find ("DocumentUseHTML");
|
---|
| 735 | if ((it != cinfo->format.end()) && ((*it).second == "true")) {
|
---|
[866] | 736 | disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
|
---|
| 737 |
|
---|
[867] | 738 |
|
---|
| 739 | // _PreferenceDocsFromWeb_
|
---|
| 740 |
|
---|
[1270] | 741 | it = cinfo->format.find ("PreferenceDocsFromWeb");
|
---|
| 742 | if ((it == cinfo->format.end()) || ((*it).second == "true"))
|
---|
[867] | 743 | disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
|
---|
| 744 | }
|
---|
| 745 |
|
---|
[2415] | 746 | // _prefschanged_
|
---|
| 747 | if (!args["bp"].empty()) {
|
---|
| 748 | disp.setmacro ("prefschanged", "preferences", "_textprefschanged_");
|
---|
| 749 | }
|
---|
[867] | 750 |
|
---|
[866] | 751 | } else if (arg_p == "about" || arg_p == "help") {
|
---|
[761] | 752 | if (collectproto == NULL) return;
|
---|
[5225] | 753 |
|
---|
| 754 | comerror_t err;
|
---|
| 755 | bool has_search_button = true;
|
---|
| 756 | collectproto->is_searchable(args["c"], has_search_button, err, logout);
|
---|
| 757 | if (err != noError) has_search_button = true;
|
---|
[761] | 758 |
|
---|
[471] | 759 | // _textbrowseoptions_ and _numbrowseoptions_
|
---|
[761] | 760 |
|
---|
[471] | 761 | FilterResponse_t response;
|
---|
[649] | 762 | text_tset metadata;
|
---|
| 763 | metadata.insert ("Title");
|
---|
[6810] | 764 | //****************
|
---|
| 765 | metadata.insert ("childtype");
|
---|
| 766 | //****************
|
---|
[471] | 767 | bool getParents = false;
|
---|
[7432] | 768 | get_children ("", args["c"], args["l"], metadata, getParents, collectproto, response, logout);
|
---|
[471] | 769 |
|
---|
[5225] | 770 | int numbrowseoptions = response.docInfo.size();
|
---|
| 771 | if (has_search_button) numbrowseoptions += 1;
|
---|
| 772 | disp.setmacro ("numbrowseoptions", "help", numbrowseoptions);
|
---|
[471] | 773 |
|
---|
[649] | 774 | ResultDocInfo_tarray::iterator here = response.docInfo.begin();
|
---|
| 775 | ResultDocInfo_tarray::iterator end = response.docInfo.end();
|
---|
[471] | 776 |
|
---|
[11958] | 777 | text_t helptext;
|
---|
[5225] | 778 | if (has_search_button) {
|
---|
[11958] | 779 | helptext = "<ul><li>_textSearchhelp_\n";
|
---|
[5225] | 780 | }
|
---|
[471] | 781 |
|
---|
[6810] | 782 | // ********************************
|
---|
| 783 | int classifiernumber = 0;
|
---|
| 784 | bool collage = false;
|
---|
| 785 |
|
---|
[471] | 786 | while (here != end) {
|
---|
[6810] | 787 |
|
---|
[9620] | 788 | ++classifiernumber;
|
---|
[6810] | 789 | text_t childtype = (*here).metadata["childtype"].values[0];
|
---|
| 790 | if (childtype == "Collage" && arg_p == "about") {
|
---|
| 791 | // get the classifier number
|
---|
| 792 | disp.setmacro ("classifier", "about", classifiernumber);
|
---|
| 793 | disp.setmacro ("aboutCollage", "about", "_collageapplet_");
|
---|
| 794 | collage = true;
|
---|
| 795 | }
|
---|
[9620] | 796 | ++here;
|
---|
[6810] | 797 | }
|
---|
| 798 | if (! collage)
|
---|
| 799 | disp.setmacro ("aboutCollage", "about", "_collageempty_");
|
---|
| 800 |
|
---|
| 801 | // ********************************
|
---|
| 802 |
|
---|
| 803 | here = response.docInfo.begin();
|
---|
| 804 |
|
---|
| 805 | while (here != end) {
|
---|
| 806 |
|
---|
[649] | 807 | text_t title = (*here).metadata["Title"].values[0];
|
---|
[6810] | 808 |
|
---|
[11958] | 809 | text_t stext;
|
---|
| 810 | disp.expandstring ("help", "_text" + title + "help_", stext);
|
---|
| 811 | if (stext == ("_text" + title + "help_")) {
|
---|
| 812 | text_t ltext, ttext;
|
---|
| 813 | disp.expandstring("Global", "_label"+title+"_", ltext);
|
---|
| 814 | if (ltext == ("_label"+title+"_")) {
|
---|
| 815 | ltext = title;
|
---|
| 816 | }
|
---|
| 817 | disp.expandstring("Global", "_text"+title+"_", ttext);
|
---|
| 818 | if (ttext == ("_text"+title+"_")) {
|
---|
| 819 | ttext = title;
|
---|
| 820 | }
|
---|
| 821 | helptext += "<li>_help:textdefaulthelp_("+ttext+","+ltext+")";
|
---|
[649] | 822 | } else {
|
---|
[11958] | 823 | helptext += "<li>_help:text" + title + "help_";
|
---|
[649] | 824 | }
|
---|
[729] | 825 |
|
---|
[9620] | 826 | ++here;
|
---|
[471] | 827 | }
|
---|
[11958] | 828 | helptext += "</ul>\n";
|
---|
| 829 | disp.setmacro ("textbrowseoptions", "help", helptext);
|
---|
[866] | 830 |
|
---|
[11356] | 831 | if (arg_p == "help") {
|
---|
| 832 | // do we need to add in the datesearch help??
|
---|
| 833 | text_tmap::iterator check = cinfo->format.find("QueryInterface");
|
---|
| 834 | if(check != cinfo->format.end()){
|
---|
| 835 | if((*check).second=="DateSearch"){
|
---|
| 836 | text_t current = "_datesearch_";
|
---|
| 837 | disp.setmacro("optdatesearchhelp","help","_datesearchhelp_");
|
---|
| 838 | disp.setmacro("optdatesearchhelpcontents","help","_datesearchhelpcontents_");
|
---|
| 839 | }
|
---|
| 840 | }
|
---|
| 841 |
|
---|
| 842 | }
|
---|
| 843 |
|
---|
[866] | 844 | if (arg_p == "about") {
|
---|
| 845 |
|
---|
| 846 | // _textsubcollections_
|
---|
[1270] | 847 | if (args["ccs"] == "1" && (cinfo->ccsCols.size() > 1)) {
|
---|
| 848 | text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo->ccsCols.size()) + ")";
|
---|
| 849 | text_tarray::const_iterator here = cinfo->ccsCols.begin();
|
---|
| 850 | text_tarray::const_iterator end = cinfo->ccsCols.end();
|
---|
[867] | 851 | bool first = true;
|
---|
[905] | 852 | int count = 0;
|
---|
[866] | 853 | while (here != end) {
|
---|
| 854 | if (*here == arg_c) {
|
---|
[867] | 855 | if (!first) textsubcollections += "<br>";
|
---|
[9931] | 856 | textsubcollections += "\n" + cinfo->get_collectionmeta("collectionname", args["l"]) + "\n";
|
---|
[866] | 857 | } else {
|
---|
[1270] | 858 | ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout);
|
---|
[9620] | 859 | if (this_cinfo == NULL) {++here; continue;}
|
---|
[905] | 860 | if (!first) textsubcollections += "<br>";
|
---|
[9931] | 861 | textsubcollections += "\n" + this_cinfo->get_collectionmeta("collectionname", args["l"]) + "\n";
|
---|
[866] | 862 | }
|
---|
[9620] | 863 | ++count;
|
---|
[867] | 864 | first = false;
|
---|
[9620] | 865 | ++here;
|
---|
[866] | 866 | }
|
---|
| 867 | textsubcollections += "_textsubcols2_";
|
---|
[4774] | 868 | if (count > 1) {
|
---|
[905] | 869 | disp.setmacro ("textsubcollections", "about", textsubcollections);
|
---|
[4774] | 870 | }
|
---|
[866] | 871 | }
|
---|
[4774] | 872 |
|
---|
| 873 | comerror_t err;
|
---|
| 874 | bool issearchable = true;
|
---|
| 875 | collectproto->is_searchable(args["c"], issearchable, err, logout);
|
---|
| 876 | if (err != noError) issearchable = true;
|
---|
| 877 | outconvertclass t;
|
---|
[11986] | 878 | if (!issearchable ) {
|
---|
[4774] | 879 | disp.setmacro ("aboutqueryform", "about", "");
|
---|
| 880 | }
|
---|
[866] | 881 | }
|
---|
[2329] | 882 |
|
---|
[2767] | 883 | } else if (arg_p == "docs") {
|
---|
| 884 |
|
---|
| 885 | set_documentation_macro (disp);
|
---|
| 886 |
|
---|
[2785] | 887 | } else if (arg_p == "bsummary" && !arg_c.empty()) {
|
---|
| 888 |
|
---|
| 889 | set_macro_to_file_contents (disp, "importlog", "bsummary",
|
---|
| 890 | filename_cat(gsdlhome, "collect", arg_c, "etc", "import.log"));
|
---|
| 891 | set_macro_to_file_contents (disp, "faillog", "bsummary",
|
---|
| 892 | filename_cat(gsdlhome, "collect", arg_c, "etc", "fail.log"));
|
---|
[471] | 893 | }
|
---|
[284] | 894 | }
|
---|
| 895 |
|
---|
[761] | 896 | bool pageaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
|
---|
| 897 | browsermapclass * /*browsers*/, displayclass &disp,
|
---|
[421] | 898 | outconvertclass &outconvert, ostream &textout,
|
---|
| 899 | ostream &/*logout*/) {
|
---|
[173] | 900 |
|
---|
[172] | 901 | text_t &arg_p = args["p"];
|
---|
[160] | 902 |
|
---|
[172] | 903 | textout << outconvert << disp << ("_" + arg_p + ":header_\n")
|
---|
[266] | 904 | << ("_" + arg_p + ":content_\n")
|
---|
[172] | 905 | << ("_" + arg_p + ":footer_\n");
|
---|
| 906 |
|
---|
[160] | 907 | return true;
|
---|
| 908 | }
|
---|
[1759] | 909 |
|
---|
| 910 | void pageaction::configure (const text_t &key, const text_tarray &cfgline) {
|
---|
| 911 | if ((key == "status") && (cfgline.size() == 1) &&
|
---|
| 912 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
| 913 | status_disabled = false;
|
---|
| 914 | } else if ((key == "collector") && (cfgline.size() == 1) &&
|
---|
| 915 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
| 916 | collector_disabled = false;
|
---|
[11998] | 917 | }
|
---|
| 918 | else if ((key == "depositor") && (cfgline.size() == 1) &&
|
---|
[3774] | 919 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
[11998] | 920 | depositor_disabled = false;
|
---|
| 921 | }
|
---|
| 922 | else if ((key == "translator") && (cfgline.size() == 1) &&
|
---|
| 923 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
[3774] | 924 | translator_disabled = false;
|
---|
[7762] | 925 | } else if ((key == "gliapplet") && (cfgline.size() == 1) &&
|
---|
| 926 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
| 927 | gliapplet_disabled = false;
|
---|
| 928 | }
|
---|
| 929 | else {
|
---|
[1759] | 930 | // call the parent class to deal with the things which
|
---|
| 931 | // are not dealt with here
|
---|
| 932 | action::configure (key, cfgline);
|
---|
| 933 | }
|
---|
| 934 | }
|
---|
[3880] | 935 |
|
---|
| 936 |
|
---|
| 937 |
|
---|
| 938 |
|
---|
| 939 |
|
---|
| 940 |
|
---|
| 941 |
|
---|
| 942 |
|
---|
| 943 |
|
---|
| 944 |
|
---|