[891] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * cstrdocaction.cpp --
|
---|
| 4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
| 5 | *
|
---|
| 6 | * A component of the Greenstone digital library software
|
---|
| 7 | * from the New Zealand Digital Library Project at the
|
---|
| 8 | * University of Waikato, New Zealand.
|
---|
| 9 | *
|
---|
| 10 | * This program is free software; you can redistribute it and/or modify
|
---|
| 11 | * it under the terms of the GNU General Public License as published by
|
---|
| 12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 13 | * (at your option) any later version.
|
---|
| 14 | *
|
---|
| 15 | * This program is distributed in the hope that it will be useful,
|
---|
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 18 | * GNU General Public License for more details.
|
---|
| 19 | *
|
---|
| 20 | * You should have received a copy of the GNU General Public License
|
---|
| 21 | * along with this program; if not, write to the Free Software
|
---|
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 23 | *
|
---|
| 24 | * $Id: cstrdocaction.cpp 911 2000-02-06 21:27:04Z sjboddie $
|
---|
| 25 | *
|
---|
| 26 | *********************************************************************/
|
---|
| 27 |
|
---|
| 28 | /*
|
---|
| 29 | $Log$
|
---|
[911] | 30 | Revision 1.2 2000/02/06 21:25:21 sjboddie
|
---|
| 31 | updated cstr
|
---|
[891] | 32 |
|
---|
| 33 | Revision 1.1 1999/09/07 21:49:42 sjboddie
|
---|
| 34 | new cstr receptionist
|
---|
| 35 |
|
---|
| 36 | */
|
---|
| 37 |
|
---|
| 38 |
|
---|
| 39 | #include <string.h>
|
---|
| 40 | #include "cstrdocaction.h"
|
---|
| 41 | #include "cstrbrowsetools.h"
|
---|
[911] | 42 | #include "browsetools.h"
|
---|
[891] | 43 | #include "OIDtools.h"
|
---|
| 44 | #include "querytools.h"
|
---|
| 45 | #include "unitool.h"
|
---|
| 46 |
|
---|
| 47 | cstrdocaction::cstrdocaction () {
|
---|
| 48 | // this action uses cgi variable "gg" and "gga" as well as
|
---|
| 49 | // those used by the standard documentaction
|
---|
| 50 |
|
---|
| 51 | cgiarginfo arg_ainfo;
|
---|
| 52 |
|
---|
| 53 | // in this action "gg" is the format of the
|
---|
| 54 | // document to view (i.e. "text", "postscript", "abstract", "figures", or "facsimiles")
|
---|
| 55 | arg_ainfo.shortname = "gg";
|
---|
| 56 | arg_ainfo.longname = "document format";
|
---|
| 57 | arg_ainfo.multiplechar = true;
|
---|
| 58 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
| 59 | arg_ainfo.argdefault = "text";
|
---|
| 60 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
| 61 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
| 62 |
|
---|
| 63 | // in this action "gga" is the path to the postscript
|
---|
| 64 | // when "gg" == "postscript
|
---|
| 65 | arg_ainfo.shortname = "gga";
|
---|
| 66 | arg_ainfo.longname = "postscript path";
|
---|
| 67 | arg_ainfo.multiplechar = true;
|
---|
| 68 | arg_ainfo.defaultstatus = cgiarginfo::none;
|
---|
| 69 | arg_ainfo.argdefault = "";
|
---|
| 70 | arg_ainfo.savedarginfo = cgiarginfo::mustnot;
|
---|
| 71 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
| 72 |
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | cstrdocaction::~cstrdocaction () {
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | void cstrdocaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass * /*protos*/,
|
---|
| 80 | response_t &response,text_t &response_data,
|
---|
| 81 | ostream &/*logout*/) {
|
---|
| 82 |
|
---|
| 83 | if (args["gg"] == "postscript") {
|
---|
| 84 | response = location;
|
---|
| 85 | response_data = args["gga"];
|
---|
| 86 | } else {
|
---|
| 87 | response = content;
|
---|
| 88 | response_data = "text/html";
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | void cstrdocaction::set_java_macros (cgiargsclass &args, displayclass &disp) {
|
---|
| 94 |
|
---|
[911] | 95 | text_t javaimagescontent = "<!----java images content------->\n_javaextras__javapostscript_";
|
---|
[891] | 96 |
|
---|
| 97 | text_t &arg_gg = args["gg"];
|
---|
| 98 | if (arg_gg == "text")
|
---|
| 99 | javaimagescontent += "_javaabstract__javafigures_";
|
---|
| 100 | else if (arg_gg == "abstract")
|
---|
| 101 | javaimagescontent += "_javafigures__javaviewtext_";
|
---|
| 102 | else if (arg_gg == "figures")
|
---|
| 103 | javaimagescontent += "_javaabstract__javaviewtext_";
|
---|
| 104 | else if (arg_gg == "facsimiles")
|
---|
| 105 | javaimagescontent += "_javaabstract__javaviewtext__javafigures_";
|
---|
| 106 |
|
---|
| 107 | int arg_gt = args.getintarg("gt");
|
---|
| 108 | // int arg_gc = args.getintarg("gc");
|
---|
| 109 | int arg_hl = args.getintarg("hl");
|
---|
| 110 |
|
---|
| 111 | text_tarray::const_iterator button_here = formatinfo.DocumentButtons.begin();
|
---|
| 112 | text_tarray::const_iterator button_end = formatinfo.DocumentButtons.end();
|
---|
| 113 |
|
---|
| 114 | while (button_here != button_end) {
|
---|
| 115 | if (*button_here == "Detach")
|
---|
| 116 | javaimagescontent += "_javadetach_";
|
---|
| 117 | else if (*button_here == "Expand Text" && arg_gg == "text") {
|
---|
| 118 | if (arg_gt == 1)
|
---|
| 119 | javaimagescontent += "_javacontracttext__javacontinue_";
|
---|
| 120 | else if (arg_gt == 2)
|
---|
| 121 | javaimagescontent += "_javacontracttext_";
|
---|
| 122 | else
|
---|
| 123 | javaimagescontent += "_javaexpandtext_";
|
---|
| 124 | // } else if (*button_here == "Expand Contents") {
|
---|
| 125 | // if (arg_gc == 1)
|
---|
| 126 | // javaimagescontent += "_javacontractcontents_";
|
---|
| 127 | // else
|
---|
| 128 | // javaimagescontent += "_javaexpandcontents_";
|
---|
| 129 | } else if (*button_here == "Highlight" && arg_gg == "text") {
|
---|
| 130 | if (arg_hl == 1)
|
---|
| 131 | javaimagescontent += "_javanohighlighting_";
|
---|
| 132 | else
|
---|
| 133 | javaimagescontent += "_javahighlighting_";
|
---|
| 134 | }
|
---|
| 135 | button_here ++;
|
---|
| 136 | }
|
---|
[911] | 137 | javaimagescontent += "<!--end java img content--->\n";
|
---|
[891] | 138 | disp.setmacro ("javaimagescontent", "document", javaimagescontent);
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 |
|
---|
| 143 | /*
|
---|
| 144 | // define all the macros which are related to pages generated
|
---|
| 145 | // by this action. we also load up the formatinfo structure
|
---|
| 146 | // here (it's used in do_action as well as here)
|
---|
| 147 | void cstrdocaction::define_internal_macros (const ColInfoResponse_t &collectinfo, displayclass &disp,
|
---|
| 148 | cgiargsclass &args, recptproto *collectproto,
|
---|
| 149 | ostream &logout) {
|
---|
| 150 |
|
---|
| 151 | // define_internal_macros sets the following macros:
|
---|
| 152 |
|
---|
| 153 | // _pagetitle_ the title to be displayed at the top of the browser window
|
---|
| 154 |
|
---|
| 155 | // _imagethispage_ the title image to be displayed at top right of page
|
---|
| 156 |
|
---|
| 157 | // _classificationlinks_ the links between classifications to be displayed
|
---|
| 158 | // at top of list or datelist classifications
|
---|
| 159 |
|
---|
| 160 | // _httpprevarrow_ these are set if next or previous arrows
|
---|
| 161 | // _httpnextarrow_ are to be used - (i.e. if it's an AZList or a DateList
|
---|
| 162 | // classifytype at a top level or if it's a Book or a
|
---|
| 163 | // Hierarchy classifytype at document level
|
---|
| 164 |
|
---|
| 165 | // _navarrows_ this may be overridden to "" when format option
|
---|
| 166 | // DocumentArrowsBottom is false
|
---|
| 167 |
|
---|
| 168 | // _header_ the header macro is overridden if we're not at a top level
|
---|
| 169 | // classification to remove the title block
|
---|
| 170 |
|
---|
| 171 | // _javaimagescontent_ this is the javascript code to shove in to make the
|
---|
| 172 | // flashy buttons work
|
---|
| 173 |
|
---|
| 174 | // _thisOID_ the OID (directory) of the current document - this corresponds
|
---|
| 175 | // to the archivedir metadata element
|
---|
| 176 |
|
---|
| 177 | // can't do anything if collectproto is null (i.e. no collection was specified)
|
---|
| 178 | if (collectproto == NULL) return;
|
---|
| 179 |
|
---|
| 180 | text_tarray metadata;
|
---|
| 181 | FilterResponse_t response;
|
---|
| 182 | text_t &arg_d = args["d"];
|
---|
| 183 | text_t &arg_cl = args["cl"];
|
---|
| 184 | text_t &collection = args["c"];
|
---|
| 185 | int gt = args.getintarg("gt");
|
---|
| 186 | load_formatinfo (collectinfo.format, gt);
|
---|
| 187 |
|
---|
| 188 | // don't want arrows or goto if we're in figures or facsimiles
|
---|
| 189 | if (args["gg"] != "text") {
|
---|
| 190 | formatinfo.DocumentArrowsBottom = false;
|
---|
| 191 | formatinfo.DocumentArrowsTop = false;
|
---|
| 192 | formatinfo.DocumentGoTo = false;
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | if (!formatinfo.DocumentArrowsBottom)
|
---|
| 196 | disp.setmacro("navarrows", "document", "");
|
---|
| 197 |
|
---|
| 198 | metadata.push_back ("Title");
|
---|
| 199 | metadata.push_back ("classifytype");
|
---|
| 200 | metadata.push_back ("archivedir");
|
---|
| 201 |
|
---|
| 202 | if (!arg_d.empty()) {
|
---|
| 203 | // we're at document level
|
---|
| 204 |
|
---|
| 205 | // get metadata for this document and it's parents
|
---|
| 206 | if (get_info (arg_d, collection, metadata, true, collectproto, response, logout)) {
|
---|
| 207 | disp.setmacro ("header", "document", "_textheader_");
|
---|
| 208 |
|
---|
[911] | 209 | disp.setmacro ("thisOID", "Global", response.docInfo[0].metadata["archivedir"].values[0]);
|
---|
[891] | 210 |
|
---|
[911] | 211 | text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
|
---|
[891] | 212 | if (classifytype.empty()) classifytype = "Book"; // defaults to Book
|
---|
| 213 |
|
---|
| 214 | // set arrow macros if required
|
---|
| 215 | if (((classifytype == "Book") && (formatinfo.DocumentArrowsTop || formatinfo.DocumentArrowsBottom)) ||
|
---|
| 216 | ((classifytype == "Hierarchy") && formatinfo.DocumentArrowsBottom))
|
---|
| 217 | set_arrow_macros (arg_d, classifytype, formatinfo.DocumentTopPages,
|
---|
| 218 | disp, collectproto, collection, logout);
|
---|
| 219 |
|
---|
| 220 | if (args["u"] != "1")
|
---|
| 221 | set_java_macros (args, disp);
|
---|
| 222 |
|
---|
| 223 | }
|
---|
| 224 | } else {
|
---|
| 225 | if (!arg_cl.empty()) {
|
---|
| 226 |
|
---|
| 227 | // get metadata for top level classification
|
---|
| 228 | text_t classtop;
|
---|
| 229 | get_top (arg_cl, classtop);
|
---|
| 230 | if (get_info (classtop, collection, metadata, false, collectproto, response, logout)) {
|
---|
| 231 |
|
---|
[911] | 232 | text_t &title = response.docInfo[0].metadata["Title"].values[0];
|
---|
| 233 | text_t &classifytype = response.docInfo[0].metadata["classifytype"].values[0];
|
---|
[891] | 234 |
|
---|
| 235 | disp.setmacro ("pagetitle", "document", "_text" + title + "page_");
|
---|
| 236 | disp.setmacro ("imagethispage", "document", "_icon" + title + "page_");
|
---|
| 237 |
|
---|
| 238 | // now get the metadata for each child of top level
|
---|
| 239 | // so we can generate the _classificationlinks_ and arrow macros
|
---|
| 240 | // (if they're required by the current classification type)
|
---|
| 241 |
|
---|
| 242 | if ((classifytype == "AZList") || (classifytype == "DateList"))
|
---|
| 243 | get_classificationlinks (arg_cl, collection, collectproto, disp, logout);
|
---|
| 244 |
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 | }
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | */
|
---|
| 251 |
|
---|
| 252 | void cstrdocaction::output_document (const text_t &OID, cgiargsclass &args,
|
---|
| 253 | recptproto *collectproto, displayclass &disp,
|
---|
| 254 | outconvertclass &outconvert, ostream &textout,
|
---|
| 255 | ostream &logout) {
|
---|
| 256 | FilterResponse_t inforesponse;
|
---|
| 257 | text_tset metadata;
|
---|
| 258 | bool getParents = false;
|
---|
| 259 | text_t &collection = args["c"];
|
---|
| 260 | text_t &arg_gg = args["gg"];
|
---|
| 261 |
|
---|
| 262 | if (arg_gg == "abstract") {
|
---|
| 263 | metadata.insert ("Description");
|
---|
| 264 | text_t top;
|
---|
| 265 | get_top (OID, top);
|
---|
| 266 | if (get_info (top, collection, metadata, getParents, collectproto, inforesponse, logout)) {
|
---|
| 267 | text_t &description = inforesponse.docInfo[0].metadata["Description"].values[0];
|
---|
| 268 |
|
---|
| 269 | if (!description.empty())
|
---|
| 270 | textout << outconvert << disp << "<p>\n" << description << "\n";
|
---|
| 271 | else
|
---|
| 272 | textout << outconvert << disp << "_textnoabstract_";
|
---|
| 273 | }
|
---|
| 274 | } else if (arg_gg == "figures") {
|
---|
| 275 | metadata.insert ("figures");
|
---|
| 276 | text_t top;
|
---|
| 277 | get_top (OID, top);
|
---|
| 278 | if (get_info (top, collection, metadata, false, collectproto, inforesponse, logout)) {
|
---|
| 279 | text_t &figures = inforesponse.docInfo[0].metadata["figures"].values[0];
|
---|
| 280 |
|
---|
| 281 | if (!figures.empty()) {
|
---|
| 282 | text_tarray figure_array;
|
---|
| 283 | splitchar (figures.begin(), figures.end(), ',', figure_array);
|
---|
| 284 | text_tarray::const_iterator this_figure = figure_array.begin();
|
---|
| 285 | text_tarray::const_iterator end_figure = figure_array.end();
|
---|
| 286 | while (this_figure != end_figure) {
|
---|
| 287 | textout << outconvert << disp
|
---|
[911] | 288 | << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/"
|
---|
[891] | 289 | << *this_figure << "\"></center>\n";
|
---|
| 290 | this_figure ++;
|
---|
| 291 | }
|
---|
| 292 | } else {
|
---|
| 293 | textout << outconvert << disp << "_textnofigures_";
|
---|
| 294 | }
|
---|
| 295 | }
|
---|
| 296 | } else if (arg_gg == "facsimiles") {
|
---|
| 297 | metadata.insert ("facsimiles");
|
---|
| 298 | text_t top;
|
---|
| 299 | get_top (OID, top);
|
---|
| 300 | if (get_info (top, collection, metadata, false, collectproto, inforesponse, logout)) {
|
---|
| 301 | text_t &facsimiles = inforesponse.docInfo[0].metadata["facsimiles"].values[0];
|
---|
| 302 |
|
---|
| 303 | if (!facsimiles.empty()) {
|
---|
| 304 | text_tarray facs_array;
|
---|
| 305 | splitchar (facsimiles.begin(), facsimiles.end(), ',', facs_array);
|
---|
| 306 | text_tarray::const_iterator this_facs = facs_array.begin();
|
---|
| 307 | text_tarray::const_iterator end_facs = facs_array.end();
|
---|
| 308 | while (this_facs != end_facs) {
|
---|
| 309 | textout << outconvert << disp
|
---|
[911] | 310 | << "<p><center><img border=1 src=\"_httpcollimg_/_thisOID_/"
|
---|
[891] | 311 | << *this_facs << "\"></center>\n";
|
---|
| 312 | this_facs ++;
|
---|
| 313 | }
|
---|
| 314 | } else {
|
---|
| 315 | textout << outconvert << disp << "_textnofacsimiles_";
|
---|
| 316 | }
|
---|
| 317 | }
|
---|
| 318 |
|
---|
| 319 | } else {
|
---|
| 320 |
|
---|
| 321 | FilterResponse_t queryresponse;
|
---|
| 322 | bool highlight = false;
|
---|
| 323 | int wanttext = 0;
|
---|
| 324 | int arg_gt = args.getintarg("gt");
|
---|
| 325 |
|
---|
| 326 | // if we have a query string and highlighting is turned on we need
|
---|
| 327 | // to redo the query to get the terms for highlighting
|
---|
| 328 | if (!args["q"].empty() && args.getintarg("hl")) {
|
---|
| 329 | FilterRequest_t request;
|
---|
| 330 | request.filterResultOptions = FRmatchTerms;
|
---|
| 331 | comerror_t err;
|
---|
| 332 | text_t formattedstring = args["q"];
|
---|
| 333 | format_querystring(formattedstring, args.getintarg("b"));
|
---|
| 334 | set_queryfilter_options (request, formattedstring, args);
|
---|
| 335 | collectproto->filter (args["c"], request, queryresponse, err, logout);
|
---|
| 336 | if (err != noError) {
|
---|
| 337 | outconvertclass text_t2ascii;
|
---|
| 338 | logout << text_t2ascii
|
---|
| 339 | << "documentaction::output_document: call to QueryFilter failed "
|
---|
| 340 | << "for " << args["c"] << " collection (" << get_comerror_string (err) << ")\n";
|
---|
| 341 | highlight = false;
|
---|
| 342 | } else {
|
---|
| 343 | highlight = true;
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | }
|
---|
| 347 |
|
---|
| 348 | format_t *formatlistptr = new format_t();
|
---|
| 349 | parse_formatstring (formatinfo.DocumentText, formatlistptr, metadata, getParents);
|
---|
| 350 |
|
---|
| 351 | metadata.insert ("hastxt");
|
---|
| 352 | metadata.insert ("haschildren");
|
---|
| 353 |
|
---|
| 354 | if (formatinfo.DocumentText == "[Text]")
|
---|
| 355 | wanttext = 1;
|
---|
| 356 | else {
|
---|
| 357 | char *docformat = formatinfo.DocumentText.getcstr();
|
---|
| 358 | if (strstr (docformat, "[Text]") != NULL)
|
---|
| 359 | wanttext = 2;
|
---|
| 360 | delete docformat;
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | if (get_info (OID, collection, metadata, getParents, collectproto, inforesponse, logout)) {
|
---|
| 364 | int hastxt = inforesponse.docInfo[0].metadata["hastxt"].values[0].getint();
|
---|
| 365 | int haschildren = inforesponse.docInfo[0].metadata["haschildren"].values[0].getint();
|
---|
| 366 |
|
---|
| 367 | if (arg_gt == 0) {
|
---|
| 368 | output_text (inforesponse.docInfo[0], formatlistptr, queryresponse.termInfo,
|
---|
| 369 | OID, highlight, hastxt, wanttext, collection, collectproto,
|
---|
| 370 | disp, outconvert, textout, logout);
|
---|
| 371 |
|
---|
| 372 |
|
---|
| 373 | } else {
|
---|
| 374 |
|
---|
| 375 | ResultDocInfo_t thisdocinfo = inforesponse.docInfo[0];
|
---|
| 376 |
|
---|
| 377 | // text is to be expanded
|
---|
| 378 | text_t exOID = OID;
|
---|
| 379 | if (haschildren != 1) exOID = get_parent (OID);
|
---|
| 380 | if (exOID.empty()) exOID = OID;
|
---|
| 381 |
|
---|
| 382 | // if we're not in a document (i.e. we're in a top level classification)
|
---|
| 383 | // we need to pass the "classify" string to get_contents so that it
|
---|
| 384 | // doesn't recurse all the way through each document in the classification
|
---|
| 385 | bool is_classify = false;
|
---|
| 386 | if (args["d"].empty()) is_classify = true;
|
---|
| 387 |
|
---|
| 388 | get_contents (exOID, is_classify, metadata, collection,
|
---|
| 389 | collectproto, inforesponse, logout);
|
---|
| 390 |
|
---|
| 391 | ResultDocInfo_tarray::iterator sechere = inforesponse.docInfo.begin();
|
---|
| 392 | ResultDocInfo_tarray::iterator secend = inforesponse.docInfo.end();
|
---|
| 393 |
|
---|
| 394 | if (arg_gt == 1) {
|
---|
| 395 | // check if there are more than 10 sections containing text to be expanded -
|
---|
| 396 | // if there are output warning message - this isn't a great way to do this
|
---|
| 397 | // since the sections may be very large or very small - one day I'll fix it
|
---|
| 398 | // -- Stefan.
|
---|
| 399 | int seccount = 0;
|
---|
| 400 | while (sechere != secend) {
|
---|
| 401 | int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
|
---|
| 402 | if (shastxt == 1) seccount ++;
|
---|
| 403 | if (seccount > 10) break;
|
---|
| 404 | sechere ++;
|
---|
| 405 | }
|
---|
| 406 | if (seccount > 10) {
|
---|
| 407 | // more than 10 sections so output warning message and text
|
---|
| 408 | // for current section only
|
---|
| 409 | textout << outconvert << disp << "_document:textltwarning_";
|
---|
| 410 |
|
---|
| 411 | output_text (thisdocinfo, formatlistptr, queryresponse.termInfo,
|
---|
| 412 | OID, highlight, hastxt, wanttext, collection,
|
---|
| 413 | collectproto, disp, outconvert, textout, logout);
|
---|
| 414 |
|
---|
| 415 | }
|
---|
| 416 | else arg_gt = 2;
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | if (arg_gt == 2) {
|
---|
| 420 | // get the text for each section
|
---|
| 421 | sechere = inforesponse.docInfo.begin();
|
---|
| 422 | int count = 0;
|
---|
| 423 | while (sechere != secend) {
|
---|
| 424 | textout << outconvert << disp << "\n<p><a name=" << count << "></a>\n";
|
---|
| 425 |
|
---|
| 426 | int shastxt = (*sechere).metadata["hastxt"].values[0].getint();
|
---|
| 427 |
|
---|
| 428 | output_text (*sechere, formatlistptr, queryresponse.termInfo,
|
---|
| 429 | (*sechere).OID, highlight, shastxt, wanttext, collection,
|
---|
| 430 | collectproto, disp, outconvert, textout, logout);
|
---|
| 431 | count ++;
|
---|
| 432 | sechere ++;
|
---|
| 433 | }
|
---|
| 434 | }
|
---|
| 435 | }
|
---|
| 436 | }
|
---|
| 437 | delete formatlistptr;
|
---|
| 438 | }
|
---|
| 439 | }
|
---|
[911] | 440 |
|
---|
| 441 |
|
---|
| 442 | bool cstrdocaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
| 443 | browsermapclass *browsers, displayclass &disp,
|
---|
| 444 | outconvertclass &outconvert, ostream &textout,
|
---|
| 445 | ostream &logout) {
|
---|
| 446 |
|
---|
| 447 |
|
---|
| 448 | // must have a valid collection server
|
---|
| 449 | recptproto *collectproto = protos->getrecptproto (args["c"], logout);
|
---|
| 450 | if (collectproto == NULL) {
|
---|
| 451 | logout << "cstrdocaction::do_action called with NULL collectproto\n";
|
---|
| 452 | textout << outconvert << disp << "_document:header_\n"
|
---|
| 453 | << "Error: Attempt to get document without setting collection\n"
|
---|
| 454 | << "_document:footer_\n";
|
---|
| 455 | } else {
|
---|
| 456 |
|
---|
| 457 | text_t OID = args["d"];
|
---|
| 458 | if (OID.empty()) OID = args["cl"];
|
---|
| 459 | if (OID.empty()) {
|
---|
| 460 | textout << outconvert << disp << "Document contains no data_document:footer_\n";
|
---|
| 461 | return true;
|
---|
| 462 | }
|
---|
| 463 |
|
---|
| 464 | textout << outconvert << disp << "_document:header_\n"
|
---|
| 465 | << "_document:content_\n";
|
---|
| 466 |
|
---|
| 467 | if (args["d"].empty()) {
|
---|
| 468 | output_toc (args, browsers, formatinfo, collectproto,
|
---|
| 469 | disp, outconvert, textout, logout);
|
---|
| 470 | } else {
|
---|
| 471 | output_cstr_toc (args, browsers, formatinfo, collectproto,
|
---|
| 472 | disp, outconvert, textout, logout);
|
---|
| 473 |
|
---|
| 474 | textout << "<p>\n";
|
---|
| 475 | output_document (OID, args, collectproto, disp, outconvert, textout, logout);
|
---|
| 476 | }
|
---|
| 477 |
|
---|
| 478 | textout << outconvert << disp << "_document:footer_\n";
|
---|
| 479 | }
|
---|
| 480 | return true;
|
---|
| 481 | }
|
---|
| 482 |
|
---|
| 483 |
|
---|
| 484 |
|
---|
| 485 |
|
---|
| 486 |
|
---|
| 487 |
|
---|
| 488 |
|
---|
| 489 |
|
---|
| 490 |
|
---|
| 491 |
|
---|
| 492 |
|
---|
| 493 |
|
---|