[12044] | 1 |
|
---|
| 2 | /**********************************************************************
|
---|
| 3 | *
|
---|
| 4 | * browsetools.cpp --
|
---|
| 5 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
| 6 | *
|
---|
| 7 | * A component of the Greenstone digital library software
|
---|
| 8 | * from the New Zealand Digital Library Project at the
|
---|
| 9 | * University of Waikato, New Zealand.
|
---|
| 10 | *
|
---|
| 11 | * This program is free software; you can redistribute it and/or modify
|
---|
| 12 | * it under the terms of the GNU General Public License as published by
|
---|
| 13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | * (at your option) any later version.
|
---|
| 15 | *
|
---|
| 16 | * This program is distributed in the hope that it will be useful,
|
---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | * GNU General Public License for more details.
|
---|
| 20 | *
|
---|
| 21 | * You should have received a copy of the GNU General Public License
|
---|
| 22 | * along with this program; if not, write to the Free Software
|
---|
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 24 | *
|
---|
| 25 | * $Id: browsetoolsclass.cpp 12183 2006-07-12 09:48:07Z sjboddie $
|
---|
| 26 | *
|
---|
| 27 | *********************************************************************/
|
---|
| 28 |
|
---|
| 29 | #include "browsetoolsclass.h"
|
---|
| 30 | #include "OIDtools.h"
|
---|
| 31 | #include "gsdlunicode.h"
|
---|
| 32 |
|
---|
| 33 | #if defined(GSDL_USE_IOS_H)
|
---|
| 34 | # if defined(__WIN32__)
|
---|
| 35 | # include <strstrea.h> // vc4
|
---|
| 36 | # else
|
---|
| 37 | # include <strstream.h>
|
---|
| 38 | # endif
|
---|
| 39 | #else
|
---|
| 40 | # include <sstream>
|
---|
| 41 | #endif
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | browsetoolsclass::browsetoolsclass()
|
---|
| 45 | {
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | browsetoolsclass::~browsetoolsclass()
|
---|
| 49 | {
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | // output_controls displays the detach, expand/contract contents,
|
---|
| 53 | // expand/contract text and highlighting/no highlighting buttons
|
---|
| 54 |
|
---|
| 55 | void browsetoolsclass::output_controls(cgiargsclass &args, const text_tarray &ibuttons,
|
---|
| 56 | recptproto *collectproto, displayclass &disp,
|
---|
| 57 | outconvertclass &outconvert, ostream &textout,
|
---|
| 58 | ostream &logout)
|
---|
| 59 | {
|
---|
| 60 | if (args["u"] != "1") {
|
---|
| 61 |
|
---|
| 62 | FilterResponse_t response;
|
---|
| 63 | text_tarray metadata;
|
---|
| 64 | text_tarray buttons;
|
---|
| 65 |
|
---|
| 66 | text_tarray::const_iterator here = ibuttons.begin();
|
---|
| 67 | text_tarray::const_iterator end = ibuttons.end();
|
---|
| 68 |
|
---|
| 69 | while (here != end) {
|
---|
| 70 |
|
---|
| 71 | if (*here == "Detach")
|
---|
| 72 | buttons.push_back ("_document:imagedetach_");
|
---|
| 73 | else if (*here == "Highlight") {
|
---|
| 74 | if (args["hl"] == "1")
|
---|
| 75 | buttons.push_back ("_document:imagenohighlight_");
|
---|
| 76 | else
|
---|
| 77 | buttons.push_back ("_document:imagehighlight_");
|
---|
| 78 | } else if (*here == "Expand Contents") {
|
---|
| 79 | if (args["gc"] == "1")
|
---|
| 80 | buttons.push_back ("_document:imagecontracttoc_");
|
---|
| 81 | else
|
---|
| 82 | buttons.push_back ("_document:imageexpandtoc_");
|
---|
| 83 | } else if (*here == "Expand Text") {
|
---|
| 84 | if (args.getintarg("gt"))
|
---|
| 85 | buttons.push_back ("_document:imagecontracttext_");
|
---|
| 86 | else
|
---|
| 87 | buttons.push_back ("_document:imageexpandtext_");
|
---|
| 88 | }
|
---|
| 89 | ++here;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | here = buttons.begin();
|
---|
| 93 | end = buttons.end();
|
---|
| 94 | while (here != end) {
|
---|
| 95 | textout << outconvert << disp << *here;
|
---|
| 96 | ++here;
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | text_t browsetoolsclass::get_cover_image()
|
---|
| 102 | {
|
---|
| 103 | return "_httpcollimg_/{Or}{[parent(Top):archivedir],[archivedir]}/cover.jpg";
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | // at the moment this just writes out the html to display
|
---|
| 107 | // the cover image (assuming it's called cover.jpg)
|
---|
| 108 | // this whole thing should be done with a call to the collection
|
---|
| 109 | // server which would send a link to the cover image if there
|
---|
| 110 | // was one otherwise send title, author and stuff
|
---|
| 111 | void browsetoolsclass::output_cover_image(cgiargsclass &args, recptproto *collectproto,
|
---|
| 112 | displayclass &disp, outconvertclass &outconvert,
|
---|
| 113 | ostream &textout, ostream &logout)
|
---|
| 114 | {
|
---|
| 115 | if (args["d"].empty()) return;
|
---|
| 116 |
|
---|
| 117 | textout << outconvert << disp << "<img alt=\"\" onError=\"src='_httpimg_/blank.gif'\" src=\"_httpcollimg_/_thisOID_/cover.jpg\">\n";
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | void browsetoolsclass::output_titles(cgiargsclass &args, recptproto *collectproto,
|
---|
| 121 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 122 | displayclass &disp, outconvertclass &outconvert,
|
---|
| 123 | ostream &textout, ostream &logout)
|
---|
| 124 | {
|
---|
| 125 | if (args["d"].empty()) return;
|
---|
| 126 |
|
---|
| 127 | text_tset metadata;
|
---|
| 128 | bool getParents;
|
---|
| 129 | FilterResponse_t response;
|
---|
| 130 |
|
---|
| 131 | format_t *formatlistptr = new format_t();
|
---|
| 132 | parse_formatstring (formatinfo.DocumentHeading, formatlistptr, metadata, getParents);
|
---|
| 133 |
|
---|
| 134 | if (!get_info (args["d"], args["c"], args["l"], metadata, getParents, collectproto, response, logout))
|
---|
| 135 | return;
|
---|
| 136 |
|
---|
| 137 | text_tmap options;
|
---|
| 138 | if (formatinfo.AllowExtendedOptions) {
|
---|
| 139 | load_extended_options(options, args, browsermap, formatinfo,
|
---|
| 140 | collectproto, disp, outconvert, logout);
|
---|
| 141 | }
|
---|
| 142 | textout << outconvert << disp
|
---|
| 143 | << get_formatted_string (args["c"],collectproto, response.docInfo[0], disp,
|
---|
| 144 | formatlistptr, options, logout);
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | void browsetoolsclass::recurse_contents(ResultDocInfo_t §ion, cgiargsclass &args, bool fulltoc,
|
---|
| 148 | browserclass *bptr, text_tset &metadata, bool &getParents,
|
---|
| 149 | format_t *formatlistptr, format_tmap &formatlistmap,
|
---|
| 150 | formatinfo_t &formatinfo, browsermapclass *browsermap,
|
---|
| 151 | int tabcount, recptproto *collectproto, displayclass &disp,
|
---|
| 152 | outconvertclass &outconvert, ostream &textout, ostream &logout)
|
---|
| 153 | {
|
---|
| 154 | text_t formatstring;
|
---|
| 155 |
|
---|
| 156 | bool is_classify = false;
|
---|
| 157 | if (args["d"].empty() || fulltoc) is_classify = true;
|
---|
| 158 |
|
---|
| 159 | // output this section
|
---|
| 160 | bool use_table = is_table_content (formatlistptr);
|
---|
| 161 | tabcount += bptr->output_section_group (section, args, args["c"], tabcount, formatlistptr, use_table,
|
---|
| 162 | metadata, getParents, collectproto, disp, outconvert,
|
---|
| 163 | textout, logout);
|
---|
| 164 |
|
---|
| 165 | text_t classification;
|
---|
| 166 | if (!is_classify) classification = "Document";
|
---|
| 167 | else get_top (args["cl"], classification);
|
---|
| 168 |
|
---|
| 169 | int haschildren = section.metadata["haschildren"].values[0].getint();
|
---|
| 170 | const text_t &doctype = section.metadata["doctype"].values[0];
|
---|
| 171 | text_t classifytype = section.metadata["childtype"].values[0];
|
---|
| 172 | // HLists and DateLists are displayed as VLists when contents
|
---|
| 173 | // are expanded, Paged documents are displayed as HLists
|
---|
| 174 | if (classifytype == "HList" || classifytype == "DateList") classifytype = "VList";
|
---|
| 175 | if (classifytype == "Paged") classifytype = "HList";
|
---|
| 176 |
|
---|
| 177 | // recurse through children
|
---|
| 178 | if ((haschildren == 1) && (!is_classify || fulltoc || doctype == "classify")) {
|
---|
| 179 |
|
---|
| 180 | // get browser for displaying children
|
---|
| 181 | bptr = browsermap->getbrowser (classifytype);
|
---|
| 182 | bptr->load_metadata_defaults (metadata);
|
---|
| 183 |
|
---|
| 184 | // get the formatstring if there is one
|
---|
| 185 | if (!get_formatstring (classification, classifytype,
|
---|
| 186 | formatinfo.formatstrings, formatstring))
|
---|
| 187 | formatstring = bptr->get_default_formatstring();
|
---|
| 188 |
|
---|
| 189 | format_tmap::const_iterator it = formatlistmap.find (formatstring);
|
---|
| 190 | // check if formatlistptr is cached
|
---|
| 191 | if (it != formatlistmap.end()) formatlistptr = (*it).second;
|
---|
| 192 | else {
|
---|
| 193 | formatlistptr = new format_t();
|
---|
| 194 | parse_formatstring (formatstring, formatlistptr, metadata, getParents);
|
---|
| 195 | formatlistmap[formatstring] = formatlistptr;
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | FilterResponse_t tmp;
|
---|
| 199 | get_children (section.OID, args["c"], args["l"], metadata, getParents, collectproto, tmp, logout);
|
---|
| 200 | ResultDocInfo_tarray::iterator thisdoc = tmp.docInfo.begin();
|
---|
| 201 | ResultDocInfo_tarray::iterator lastdoc = tmp.docInfo.end();
|
---|
| 202 |
|
---|
| 203 | while (thisdoc != lastdoc) {
|
---|
| 204 | recurse_contents (*thisdoc, args, fulltoc, bptr, metadata, getParents,
|
---|
| 205 | formatlistptr, formatlistmap, formatinfo, browsermap,
|
---|
| 206 | tabcount, collectproto, disp, outconvert, textout, logout);
|
---|
| 207 | ++thisdoc;
|
---|
| 208 | }
|
---|
| 209 | }
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 |
|
---|
| 213 | // expanded_contents recurses through all contents. there's a special case
|
---|
| 214 | // for an HList when contents are expanded (i.e. it's displayed as a VList)
|
---|
| 215 | //
|
---|
[12183] | 216 | // if we're inside a document we expand all contents from the top (unless
|
---|
| 217 | // expand_from_current_level is true), if we're at classification level we'll just
|
---|
| 218 | // expand out those contents below the current one
|
---|
[12044] | 219 |
|
---|
| 220 | void browsetoolsclass::expanded_contents(cgiargsclass &args, int tabcount, bool fulltoc,
|
---|
| 221 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 222 | recptproto *collectproto, displayclass &disp,
|
---|
| 223 | outconvertclass &outconvert, ostream &textout,
|
---|
[12183] | 224 | ostream &logout, bool expand_from_current_level)
|
---|
[12044] | 225 | {
|
---|
| 226 | if (args["d"].empty() && args["cl"].empty()) return;
|
---|
| 227 | text_t OID;
|
---|
| 228 |
|
---|
| 229 | FilterResponse_t response;
|
---|
| 230 | bool getParents = false;
|
---|
| 231 | text_tset metadata;
|
---|
| 232 | text_t classifytype, classification, formatstring;
|
---|
| 233 |
|
---|
[12183] | 234 | if (!args["d"].empty())
|
---|
| 235 | {
|
---|
| 236 | // document level
|
---|
| 237 | if (fulltoc)
|
---|
| 238 | {
|
---|
| 239 | get_top(args["cl"], OID);
|
---|
| 240 | classification = OID;
|
---|
| 241 | }
|
---|
| 242 | else
|
---|
| 243 | {
|
---|
| 244 | classification = "Document";
|
---|
| 245 | if (expand_from_current_level)
|
---|
| 246 | {
|
---|
| 247 | OID = args["d"];
|
---|
| 248 | }
|
---|
| 249 | else
|
---|
| 250 | {
|
---|
| 251 | // Always expand document level from top, unless
|
---|
| 252 | // expand_from_current_level is true.
|
---|
| 253 | get_top(args["d"], OID);
|
---|
| 254 | }
|
---|
| 255 | }
|
---|
[12044] | 256 | }
|
---|
[12183] | 257 | else
|
---|
| 258 | {
|
---|
| 259 | // classification level
|
---|
| 260 | OID = args["cl"];
|
---|
| 261 | get_top(args["cl"], classification);
|
---|
[12044] | 262 | }
|
---|
| 263 |
|
---|
| 264 | // get classifytype of this level
|
---|
| 265 | text_t tOID;
|
---|
| 266 | if (is_top(OID)) {
|
---|
| 267 | classifytype = "thistype";
|
---|
| 268 | tOID = OID;
|
---|
| 269 | } else {
|
---|
| 270 | classifytype = "childtype";
|
---|
| 271 | tOID = get_parent (OID);
|
---|
| 272 | }
|
---|
| 273 | metadata.insert (classifytype);
|
---|
| 274 |
|
---|
| 275 | if (!get_info (tOID, args["c"], args["l"], metadata, getParents, collectproto, response, logout))
|
---|
| 276 | return;
|
---|
| 277 | classifytype = response.docInfo[0].metadata[classifytype].values[0];
|
---|
| 278 | // if we still don't have a classifytype we'll use the default
|
---|
| 279 | if (classifytype.empty()) {
|
---|
| 280 | browserclass *bptr = browsermap->get_default_browser ();
|
---|
| 281 | classifytype = bptr->get_browser_name ();
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | // HLists are displayed as VLists when contents are expanded,
|
---|
| 285 | // Paged documents are displayed as HLists
|
---|
| 286 | if (classifytype == "HList") {
|
---|
| 287 | classifytype = "VList";
|
---|
| 288 | text_t pOID = get_parent (OID);
|
---|
| 289 | if (!pOID.empty()) {
|
---|
| 290 | OID = pOID;
|
---|
| 291 | // this is assuming that top levels are always 'Invisible' !!!
|
---|
| 292 | if (is_top (OID)) classifytype = "Invisible";
|
---|
| 293 | }
|
---|
| 294 | }
|
---|
| 295 | if (classifytype == "Paged") classifytype = "HList";
|
---|
| 296 |
|
---|
| 297 | metadata.erase (metadata.begin(), metadata.end());
|
---|
| 298 |
|
---|
| 299 | // metadata elements needed by recurse_contents
|
---|
| 300 | metadata.insert ("childtype");
|
---|
| 301 | metadata.insert ("doctype");
|
---|
| 302 | metadata.insert ("haschildren");
|
---|
| 303 |
|
---|
| 304 | // load up metadata array with browser defaults
|
---|
| 305 | browserclass *bptr = browsermap->getbrowser (classifytype);
|
---|
| 306 | bptr->load_metadata_defaults (metadata);
|
---|
| 307 |
|
---|
| 308 | // get the formatstring if there is one or use the browsers default
|
---|
| 309 | if (!get_formatstring (classification, classifytype,
|
---|
| 310 | formatinfo.formatstrings, formatstring))
|
---|
| 311 | formatstring = bptr->get_default_formatstring();
|
---|
| 312 |
|
---|
| 313 | format_t *formatlistptr = new format_t();
|
---|
| 314 | parse_formatstring (formatstring, formatlistptr, metadata, getParents);
|
---|
| 315 |
|
---|
| 316 | // protocol call
|
---|
| 317 | if (!get_info (OID, args["c"], args["l"], metadata, getParents, collectproto, response, logout))
|
---|
| 318 | return;
|
---|
| 319 |
|
---|
| 320 | format_tmap formatlistmap;
|
---|
| 321 | formatlistmap[formatstring] = formatlistptr;
|
---|
| 322 |
|
---|
| 323 | recurse_contents (response.docInfo[0], args, fulltoc, bptr, metadata,
|
---|
| 324 | getParents, formatlistptr, formatlistmap, formatinfo, browsermap,
|
---|
| 325 | tabcount, collectproto, disp, outconvert, textout, logout);
|
---|
| 326 |
|
---|
| 327 | // clean up format list pointers
|
---|
| 328 | format_tmap::const_iterator here = formatlistmap.begin();
|
---|
| 329 | format_tmap::const_iterator end = formatlistmap.end();
|
---|
| 330 | while (here != end) {
|
---|
| 331 | delete (*here).second;
|
---|
| 332 | ++here;
|
---|
| 333 | }
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | void browsetoolsclass::load_formatstring(const text_t &classifytype, text_tset &metadata,
|
---|
| 337 | bool &getParents, const text_t &classification,
|
---|
| 338 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 339 | format_tmap &formatlistmap)
|
---|
| 340 | {
|
---|
| 341 | text_t formatstring;
|
---|
| 342 |
|
---|
| 343 | // load up metadata array with browser defaults
|
---|
| 344 | browserclass *bptr = browsermap->getbrowser (classifytype);
|
---|
| 345 | bptr->load_metadata_defaults (metadata);
|
---|
| 346 |
|
---|
| 347 | // get the formatstring if there is one or use the browsers default
|
---|
| 348 | if (!get_formatstring (classification, classifytype,
|
---|
| 349 | formatinfo.formatstrings, formatstring))
|
---|
| 350 | formatstring = bptr->get_default_formatstring();
|
---|
| 351 |
|
---|
| 352 | // see if it's cached
|
---|
| 353 | format_tmap::const_iterator it = formatlistmap.find (formatstring);
|
---|
| 354 | if (it == formatlistmap.end()) {
|
---|
| 355 | format_t *formatlistptr = new format_t();
|
---|
| 356 | parse_formatstring (formatstring, formatlistptr, metadata, getParents);
|
---|
| 357 | formatlistmap[formatstring] = formatlistptr;
|
---|
| 358 | }
|
---|
| 359 | }
|
---|
| 360 |
|
---|
| 361 | void browsetoolsclass::load_formatstrings(FilterResponse_t &response, text_tset &metadata,
|
---|
| 362 | bool &getParents, const text_t &classification,
|
---|
| 363 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 364 | format_tmap &formatlistmap)
|
---|
| 365 | {
|
---|
| 366 | text_tset cache;
|
---|
| 367 |
|
---|
| 368 | ResultDocInfo_tarray::iterator thisdoc = response.docInfo.begin();
|
---|
| 369 | ResultDocInfo_tarray::iterator lastdoc = response.docInfo.end();
|
---|
| 370 |
|
---|
| 371 | while (thisdoc != lastdoc) {
|
---|
| 372 |
|
---|
| 373 | if (is_top ((*thisdoc).OID)) {
|
---|
| 374 | load_formatstring ((*thisdoc).metadata["thistype"].values[0], metadata,
|
---|
| 375 | getParents, classification, browsermap, formatinfo,
|
---|
| 376 | formatlistmap);
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | // sometimes childtype is not set - why??
|
---|
| 380 | if ((*thisdoc).metadata.find("childtype") != (*thisdoc).metadata.end()) {
|
---|
| 381 | text_t &childtype = (*thisdoc).metadata["childtype"].values[0];
|
---|
| 382 |
|
---|
| 383 | text_tset::const_iterator it = cache.find (childtype);
|
---|
| 384 | if (it == cache.end()) {
|
---|
| 385 | load_formatstring (childtype, metadata, getParents, classification,
|
---|
| 386 | browsermap, formatinfo, formatlistmap);
|
---|
| 387 | cache.insert (childtype);
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 | ++thisdoc;
|
---|
| 391 | }
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | void browsetoolsclass::output_parents(FilterResponse_t &response, cgiargsclass &args,
|
---|
| 395 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 396 | format_tmap &formatlistmap, const text_t &classification,
|
---|
| 397 | int &tabcount, text_tset &metadata, bool &getParents,
|
---|
| 398 | recptproto *collectproto, displayclass &disp,
|
---|
| 399 | outconvertclass &outconvert, ostream &textout,
|
---|
| 400 | ostream &logout)
|
---|
| 401 | {
|
---|
| 402 | format_t *formatlistptr = NULL;
|
---|
| 403 | text_t classifytype, formatstring;
|
---|
| 404 | bool use_table, first = true;
|
---|
| 405 | ResultDocInfo_tarray::iterator thisparent = response.docInfo.begin();
|
---|
| 406 | ResultDocInfo_tarray::iterator lastparent = response.docInfo.end();
|
---|
| 407 | while (thisparent != lastparent) {
|
---|
| 408 |
|
---|
| 409 | // get classifytype of this level
|
---|
| 410 | if (is_top ((*thisparent).OID)) classifytype = (*thisparent).metadata["thistype"].values[0];
|
---|
| 411 | else if (!first && (*(thisparent-1)).metadata.find("childtype") != (*(thisparent-1)).metadata.end()) classifytype = (*(thisparent-1)).metadata["childtype"].values[0];
|
---|
| 412 |
|
---|
| 413 | // if we still don't have a classifytype we'll use the default
|
---|
| 414 | if (classifytype.empty()) {
|
---|
| 415 | browserclass *bptr = browsermap->get_default_browser ();
|
---|
| 416 | classifytype = bptr->get_browser_name ();
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | browserclass *bptr = browsermap->getbrowser (classifytype);
|
---|
| 420 |
|
---|
| 421 | // get the formatstring if there is one or use the browsers default
|
---|
| 422 | if (!get_formatstring (classification, classifytype,
|
---|
| 423 | formatinfo.formatstrings, formatstring))
|
---|
| 424 | formatstring = bptr->get_default_formatstring();
|
---|
| 425 |
|
---|
| 426 | // see if it's cached
|
---|
| 427 | format_tmap::const_iterator it = formatlistmap.find (formatstring);
|
---|
| 428 | if (it != formatlistmap.end()) formatlistptr = (*it).second;
|
---|
| 429 | else {
|
---|
| 430 | logout << "browsetools error\n";
|
---|
| 431 | return;
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 | use_table = is_table_content (formatlistptr);
|
---|
| 435 | tabcount += bptr->output_section_group (*thisparent, args, args["c"], tabcount, formatlistptr,
|
---|
| 436 | use_table, metadata, getParents, collectproto,
|
---|
| 437 | disp, outconvert, textout, logout);
|
---|
| 438 | first = false;
|
---|
| 439 | ++thisparent;
|
---|
| 440 | }
|
---|
| 441 | }
|
---|
| 442 |
|
---|
| 443 | void browsetoolsclass::contracted_contents(cgiargsclass &args, int tabcount, bool fulltoc,
|
---|
| 444 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 445 | recptproto *collectproto, displayclass &disp,
|
---|
| 446 | outconvertclass &outconvert, ostream &textout,
|
---|
| 447 | ostream &logout)
|
---|
| 448 | {
|
---|
| 449 | FilterResponse_t response;
|
---|
| 450 | text_tset metadata;
|
---|
| 451 | bool getParents = false;
|
---|
| 452 | text_t formatstring;
|
---|
| 453 | text_tarray parents;
|
---|
| 454 | text_t OID = args["d"];
|
---|
| 455 | text_t classification = "Document";
|
---|
| 456 |
|
---|
| 457 | // if we're not outputting the TOC for a valid OID, then we should be giving
|
---|
| 458 | // the TOC of a classification
|
---|
| 459 | if (OID.empty()) {
|
---|
| 460 | OID = args["cl"];
|
---|
| 461 | get_top (OID, classification);
|
---|
| 462 | }
|
---|
| 463 | // if we're to give the full TOC of a document, get the parent for the whole
|
---|
| 464 | // document now
|
---|
| 465 | else if (fulltoc)
|
---|
| 466 | get_top (args["cl"], classification);
|
---|
| 467 |
|
---|
| 468 | bool haschildren = has_children (OID, args["c"], args["l"], collectproto, logout);
|
---|
| 469 |
|
---|
| 470 | if ((!args["d"].empty()) && fulltoc)
|
---|
| 471 | get_parents_array (args["cl"] + ".fc", parents);
|
---|
| 472 | if (haschildren) get_parents_array (OID + ".fc", parents);
|
---|
| 473 | else get_parents_array (OID, parents);
|
---|
| 474 |
|
---|
| 475 | if (!parents.empty()) {
|
---|
| 476 | // get classifytypes of each parent
|
---|
| 477 | metadata.insert ("thistype");
|
---|
| 478 | metadata.insert ("childtype");
|
---|
| 479 | metadata.insert("mdtype");
|
---|
| 480 |
|
---|
| 481 | if (!get_info (parents, args["c"], args["l"], metadata, getParents, collectproto, response, logout))
|
---|
| 482 | return;
|
---|
| 483 |
|
---|
| 484 | // get formatstrings for all parents
|
---|
| 485 | format_tmap formatlistmap;
|
---|
| 486 | load_formatstrings (response, metadata, getParents, classification,
|
---|
| 487 | browsermap, formatinfo, formatlistmap);
|
---|
| 488 |
|
---|
| 489 | if (!get_info (parents, args["c"], args["l"], metadata, getParents, collectproto, response, logout))
|
---|
| 490 | return;
|
---|
| 491 |
|
---|
| 492 | // display each parent
|
---|
| 493 | output_parents (response, args, browsermap, formatinfo, formatlistmap,
|
---|
| 494 | classification, tabcount, metadata, getParents,
|
---|
| 495 | collectproto, disp, outconvert, textout, logout);
|
---|
| 496 |
|
---|
| 497 | metadata.erase (metadata.begin(), metadata.end());
|
---|
| 498 |
|
---|
| 499 | // clean up cached format list pointers
|
---|
| 500 | format_tmap::const_iterator here = formatlistmap.begin();
|
---|
| 501 | format_tmap::const_iterator end = formatlistmap.end();
|
---|
| 502 | while (here != end) {
|
---|
| 503 | delete (*here).second;
|
---|
| 504 | ++here;
|
---|
| 505 | }
|
---|
| 506 | }
|
---|
| 507 |
|
---|
| 508 | // get childrens classifytype
|
---|
| 509 | text_t classifytype;
|
---|
| 510 | int numparents = response.docInfo.size();
|
---|
| 511 | if (!parents.empty() && (response.docInfo[numparents-1].metadata.find("childtype") != response.docInfo[numparents-1].metadata.end()))
|
---|
| 512 | classifytype = response.docInfo[numparents-1].metadata["childtype"].values[0];
|
---|
| 513 | else {
|
---|
| 514 | // use the default
|
---|
| 515 | browserclass *bptr = browsermap->get_default_browser ();
|
---|
| 516 | classifytype = bptr->get_browser_name ();
|
---|
| 517 | }
|
---|
| 518 |
|
---|
| 519 | // load up metadata array with browser defaults
|
---|
| 520 | browserclass *bptr = browsermap->getbrowser (classifytype);
|
---|
| 521 | bptr->load_metadata_defaults (metadata);
|
---|
| 522 |
|
---|
| 523 | if (classifytype == "DateList") {
|
---|
| 524 | // get the mdtype
|
---|
| 525 | text_t datelist = "Date";
|
---|
| 526 | if (!parents.empty() && (response.docInfo[0].metadata.find("mdtype") != response.docInfo[0].metadata.end())) {
|
---|
| 527 | datelist = response.docInfo[0].metadata["mdtype"].values[0];
|
---|
| 528 | }
|
---|
| 529 | args.setarg("dm", datelist);
|
---|
| 530 | text_tarray dates;
|
---|
| 531 | splitchar(datelist.begin(), datelist.end(), ',', dates);
|
---|
| 532 | text_tarray::iterator begin = dates.begin();
|
---|
| 533 | text_tarray::iterator end = dates.end();
|
---|
| 534 | while (begin!= end) {
|
---|
| 535 | metadata.insert(*begin);
|
---|
| 536 | begin++;
|
---|
| 537 | }
|
---|
| 538 |
|
---|
| 539 | }
|
---|
| 540 |
|
---|
| 541 | // get the formatstring if there is one or use the browsers default
|
---|
| 542 | if (!get_formatstring (classification, classifytype,
|
---|
| 543 | formatinfo.formatstrings, formatstring))
|
---|
| 544 | formatstring = bptr->get_default_formatstring();
|
---|
| 545 |
|
---|
| 546 | format_t *formatlistptr = new format_t();
|
---|
| 547 | parse_formatstring (formatstring, formatlistptr, metadata, getParents);
|
---|
| 548 |
|
---|
| 549 | if (haschildren)
|
---|
| 550 | get_children (OID, args["c"], args["l"], metadata, getParents,
|
---|
| 551 | collectproto, response, logout);
|
---|
| 552 | else if (!is_top(OID)) {
|
---|
| 553 | get_children (OID + ".pr", args["c"], args["l"], metadata, getParents,
|
---|
| 554 | collectproto, response, logout);
|
---|
| 555 | haschildren = true;
|
---|
| 556 | }
|
---|
| 557 |
|
---|
| 558 | // display children
|
---|
| 559 | if (haschildren) {
|
---|
| 560 | bool use_table = is_table_content (formatlistptr);
|
---|
| 561 | bptr->output_section_group (response, args, args["c"], tabcount, formatlistptr, use_table,
|
---|
| 562 | metadata, getParents, collectproto, disp, outconvert,
|
---|
| 563 | textout, logout);
|
---|
| 564 | }
|
---|
| 565 | delete formatlistptr;
|
---|
| 566 | }
|
---|
| 567 |
|
---|
| 568 | /**
|
---|
| 569 | * This function outputs contents of a classifier to the reader
|
---|
| 570 | * including parent levels
|
---|
| 571 | */
|
---|
| 572 | void browsetoolsclass::expand_show_contents(cgiargsclass &args, int tabcount, bool fulltoc,
|
---|
| 573 | browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 574 | recptproto *collectproto, displayclass &disp,
|
---|
| 575 | outconvertclass &outconvert, ostream &textout,
|
---|
| 576 | ostream &logout)
|
---|
| 577 | {
|
---|
| 578 | int coloffset = 0;
|
---|
| 579 | text_tarray parents;
|
---|
| 580 | FilterResponse_t response;
|
---|
| 581 | text_t OID = args["d"];
|
---|
| 582 | if (OID.empty()) OID = args["cl"];
|
---|
| 583 |
|
---|
| 584 | bool haschildren = has_children(OID, args["c"], args["l"], collectproto, logout);
|
---|
| 585 |
|
---|
| 586 | // get parents list
|
---|
| 587 | if (!is_top(OID)) get_parents_array(OID, parents);
|
---|
| 588 | if (args["d"].empty() || haschildren || parents.empty()) parents.push_back(OID);
|
---|
| 589 |
|
---|
| 590 | // if inside a book top title is needed
|
---|
| 591 | if (!args["d"].empty())
|
---|
| 592 | {
|
---|
| 593 | coloffset = 1;
|
---|
| 594 | text_t classification, classifytype, formatstring, topOID = parents[0];
|
---|
| 595 | text_tset metadata;
|
---|
| 596 | format_t *formatlistptr = new format_t();
|
---|
| 597 | bool use_table, getParents = false;
|
---|
| 598 |
|
---|
| 599 | get_top(args["cl"], classification);
|
---|
| 600 |
|
---|
| 601 | // getting information about top OID
|
---|
| 602 | metadata.insert("thistype");
|
---|
| 603 |
|
---|
| 604 | get_info(topOID, args["c"], args["l"], metadata, getParents, collectproto, response, logout);
|
---|
| 605 | if (!response.docInfo[0].metadata["thistype"].values.empty())
|
---|
| 606 | {
|
---|
| 607 | classifytype = response.docInfo[0].metadata["thistype"].values[0];
|
---|
| 608 | }
|
---|
| 609 |
|
---|
| 610 | browserclass *bptr = browsermap->getbrowser (classifytype);
|
---|
| 611 |
|
---|
| 612 | if (classifytype.empty())
|
---|
| 613 | {
|
---|
| 614 | bptr = browsermap->get_default_browser();
|
---|
| 615 | }
|
---|
| 616 |
|
---|
| 617 | // get the formatstring if there is one or use the browsers default
|
---|
| 618 | if (!get_formatstring(classification, classifytype, formatinfo.formatstrings, formatstring))
|
---|
| 619 | {
|
---|
| 620 | formatstring = bptr->get_default_formatstring();
|
---|
| 621 | }
|
---|
| 622 |
|
---|
| 623 | parse_formatstring(formatstring, formatlistptr, metadata, getParents);
|
---|
| 624 |
|
---|
| 625 | metadata.insert("doctype");
|
---|
| 626 | metadata.insert("haschildren");
|
---|
| 627 |
|
---|
| 628 | get_info(topOID, args["c"], args["l"], metadata, getParents, collectproto, response, logout);
|
---|
| 629 |
|
---|
| 630 | // ouput top OID section
|
---|
| 631 | use_table = is_table_content(formatlistptr);
|
---|
| 632 | bptr->output_section_group(response.docInfo[0], args, args["c"], tabcount, formatlistptr, use_table,
|
---|
| 633 | metadata, getParents, collectproto, disp, outconvert, textout, logout);
|
---|
| 634 | }
|
---|
| 635 |
|
---|
| 636 | recurse_contents_levels(parents, args, coloffset, tabcount, fulltoc, browsermap,
|
---|
| 637 | formatinfo, collectproto, disp, outconvert, textout, logout);
|
---|
| 638 | }
|
---|
| 639 |
|
---|
| 640 | void browsetoolsclass::recurse_contents_levels(text_tarray &parents, cgiargsclass &args, int coloffset, int tabcount,
|
---|
| 641 | bool fulltoc, browsermapclass *browsermap, formatinfo_t &formatinfo,
|
---|
| 642 | recptproto *collectproto, displayclass &disp, outconvertclass &outconvert,
|
---|
| 643 | ostream &textout, ostream &logout)
|
---|
| 644 | {
|
---|
| 645 | FilterResponse_t response;
|
---|
| 646 | text_tset metadata;
|
---|
| 647 | text_t OID, formatstring, classification, classifytype;;
|
---|
| 648 | bool use_table, getParents = false;
|
---|
| 649 | int haschildren = 0;
|
---|
| 650 | format_t *formatlistptr = new format_t();
|
---|
| 651 |
|
---|
| 652 | // display children for last level
|
---|
| 653 | if (tabcount == (parents.size() - 1))
|
---|
| 654 | {
|
---|
| 655 | // setting metadata fields
|
---|
| 656 | metadata.insert ("thistype");
|
---|
| 657 | metadata.insert ("childtype");
|
---|
| 658 | metadata.insert ("haschildren");
|
---|
| 659 |
|
---|
| 660 | OID = parents[tabcount];
|
---|
| 661 | get_info(OID, args["c"], args["l"], metadata, getParents, collectproto, response, logout);
|
---|
| 662 | get_top(OID, classification);
|
---|
| 663 |
|
---|
| 664 | if (!response.docInfo.empty())
|
---|
| 665 | {
|
---|
| 666 | haschildren = response.docInfo[0].metadata["haschildren"].values[0].getint();
|
---|
| 667 | }
|
---|
| 668 |
|
---|
| 669 | // get childrens classifytype
|
---|
| 670 | if (!response.docInfo.empty())
|
---|
| 671 | {
|
---|
| 672 | classifytype = response.docInfo[0].metadata["childtype"].values[0];
|
---|
| 673 | }
|
---|
| 674 | else
|
---|
| 675 | {
|
---|
| 676 | // use the default
|
---|
| 677 | browserclass *bptr = browsermap->get_default_browser();
|
---|
| 678 | classifytype = bptr->get_browser_name();
|
---|
| 679 | }
|
---|
| 680 |
|
---|
| 681 | // load up metadata array with browser defaults
|
---|
| 682 | browserclass *bptr = browsermap->getbrowser(classifytype);
|
---|
| 683 | bptr->load_metadata_defaults(metadata);
|
---|
| 684 |
|
---|
| 685 | // get the formatstring if there is one or use the browsers default
|
---|
| 686 | if (!get_formatstring(classification, classifytype, formatinfo.formatstrings, formatstring))
|
---|
| 687 | {
|
---|
| 688 | formatstring = bptr->get_default_formatstring();
|
---|
| 689 | }
|
---|
| 690 |
|
---|
| 691 | parse_formatstring(formatstring, formatlistptr, metadata, getParents);
|
---|
| 692 |
|
---|
| 693 | if (haschildren)
|
---|
| 694 | {
|
---|
| 695 | get_children(OID, args["c"], args["l"], metadata, getParents,
|
---|
| 696 | collectproto, response, logout);
|
---|
| 697 | }
|
---|
| 698 | else if (!is_top(OID))
|
---|
| 699 | {
|
---|
| 700 | get_children(OID + ".pr", args["c"], args["l"], metadata, getParents,
|
---|
| 701 | collectproto, response, logout);
|
---|
| 702 | haschildren = true;
|
---|
| 703 | }
|
---|
| 704 |
|
---|
| 705 | // display children
|
---|
| 706 | if (haschildren)
|
---|
| 707 | {
|
---|
| 708 | use_table = is_table_content (formatlistptr);
|
---|
| 709 | bptr->output_section_group(response, args, args["c"], coloffset + tabcount, formatlistptr, use_table,
|
---|
| 710 | metadata, getParents, collectproto, disp, outconvert, textout, logout);
|
---|
| 711 | }
|
---|
| 712 | }
|
---|
| 713 | else
|
---|
| 714 | {
|
---|
| 715 | text_t pOID;
|
---|
| 716 | OID = parents[tabcount];
|
---|
| 717 | get_top(OID, classification);
|
---|
| 718 |
|
---|
| 719 | // load metadata fields
|
---|
| 720 | metadata.insert("thistype");
|
---|
| 721 | metadata.insert("childtype");
|
---|
| 722 | metadata.insert("haschildren");
|
---|
| 723 | metadata.insert("doctype");
|
---|
| 724 |
|
---|
| 725 | if (tabcount) pOID = parents[tabcount-1];
|
---|
| 726 | else pOID = OID;
|
---|
| 727 | get_info(pOID, args["c"], args["l"], metadata, getParents, collectproto, response, logout);
|
---|
| 728 |
|
---|
| 729 | // get classifytype of this level
|
---|
| 730 | if (is_top (pOID)) classifytype = response.docInfo[0].metadata["childtype"].values[0];
|
---|
| 731 | else classifytype = response.docInfo[0].metadata["thistype"].values[0];
|
---|
| 732 |
|
---|
| 733 | // if we still don't have a classifytype we'll use the default
|
---|
| 734 | if (classifytype.empty())
|
---|
| 735 | {
|
---|
| 736 | browserclass *bptr = browsermap->get_default_browser();
|
---|
| 737 | classifytype = bptr->get_browser_name();
|
---|
| 738 | }
|
---|
| 739 |
|
---|
| 740 | browserclass *bptr = browsermap->getbrowser (classifytype);
|
---|
| 741 |
|
---|
| 742 | // get the formatstring if there is one or use the browsers default
|
---|
| 743 | if (!get_formatstring (classification, classifytype, formatinfo.formatstrings, formatstring))
|
---|
| 744 | {
|
---|
| 745 | formatstring = bptr->get_default_formatstring();
|
---|
| 746 | }
|
---|
| 747 |
|
---|
| 748 | // parse format string
|
---|
| 749 | parse_formatstring(formatstring, formatlistptr, metadata, getParents);
|
---|
| 750 |
|
---|
| 751 | use_table = is_table_content(formatlistptr);
|
---|
| 752 |
|
---|
| 753 | get_children(OID, args["c"], args["l"], metadata, getParents, collectproto, response, logout);
|
---|
| 754 |
|
---|
| 755 | ResultDocInfo_tarray::iterator thissibling = response.docInfo.begin();
|
---|
| 756 | ResultDocInfo_tarray::iterator lastsibling = response.docInfo.end();
|
---|
| 757 |
|
---|
| 758 | while (thissibling != lastsibling)
|
---|
| 759 | {
|
---|
| 760 | bptr->output_section_group(*thissibling, args, args["c"], coloffset + tabcount, formatlistptr,
|
---|
| 761 | use_table, metadata, getParents, collectproto,
|
---|
| 762 | disp, outconvert, textout, logout);
|
---|
| 763 |
|
---|
| 764 | if ((*thissibling).OID == parents[tabcount+1])
|
---|
| 765 | {
|
---|
| 766 | recurse_contents_levels(parents, args, coloffset, tabcount+1, fulltoc, browsermap,
|
---|
| 767 | formatinfo, collectproto, disp, outconvert,textout, logout);
|
---|
| 768 | }
|
---|
| 769 | ++thissibling;
|
---|
| 770 | }
|
---|
| 771 | }
|
---|
| 772 | delete formatlistptr;
|
---|
| 773 | }
|
---|
| 774 |
|
---|
| 775 | /**
|
---|
| 776 | * This function outputs the contents of a classifier list to the reader -
|
---|
| 777 | * the document will in fact be empty, so this does the "real" output
|
---|
| 778 | */
|
---|
| 779 | void browsetoolsclass::output_toc(cgiargsclass &args, browsermapclass *browsermap,
|
---|
| 780 | formatinfo_t &formatinfo, recptproto *collectproto,
|
---|
| 781 | displayclass &disp, outconvertclass &outconvert,
|
---|
| 782 | ostream &textout, ostream &logout)
|
---|
| 783 | {
|
---|
| 784 | if (!args["d"].empty() && formatinfo.AllowExtendedOptions) {
|
---|
| 785 | // If AllowExtendedOptions is set and we're viewing a document,
|
---|
| 786 | // DocumentButtons, DocumentContent, and DocumentImages are effectively
|
---|
| 787 | // disabled. We just output the DocumentHeading format string and
|
---|
| 788 | // return
|
---|
| 789 | output_titles(args, collectproto, browsermap, formatinfo, disp, outconvert, textout, logout);
|
---|
| 790 | return;
|
---|
| 791 | }
|
---|
| 792 |
|
---|
| 793 | int tabcount = 0;
|
---|
| 794 | bool fulltoc = false;
|
---|
| 795 | text_t cl_top, full_toc;
|
---|
| 796 | if (args["cl"] != "search") {
|
---|
| 797 | // see if there's a FullTOC string
|
---|
| 798 | get_top (args["cl"], cl_top);
|
---|
| 799 | if (get_formatstring (cl_top, "FullTOC", formatinfo.formatstrings, full_toc))
|
---|
| 800 | if (full_toc == "true") fulltoc = true;
|
---|
| 801 | }
|
---|
| 802 |
|
---|
| 803 | // get the cover image (if there is one) and the control buttons
|
---|
| 804 | // if we're inside a book
|
---|
| 805 | if ((!fulltoc) && (!args["d"].empty())) {
|
---|
| 806 | if (formatinfo.DocumentImages) {
|
---|
| 807 | textout << outconvert << "<div class=\"heading_image\">\n";
|
---|
| 808 | output_cover_image(args, collectproto, disp, outconvert, textout, logout);
|
---|
| 809 | textout << outconvert << "</div>\n";
|
---|
| 810 | } else if (formatinfo.DocumentTitles) {
|
---|
| 811 | textout << outconvert << "<div class=\"heading_title\">\n";
|
---|
| 812 | output_titles(args, collectproto, browsermap, formatinfo, disp, outconvert, textout, logout);
|
---|
| 813 | textout << outconvert << "</div>\n";
|
---|
| 814 | }
|
---|
| 815 | textout << outconvert << "<div class=\"buttons\" id=\"toc_buttons\">\n";
|
---|
| 816 | if (args["u"] != "1") {
|
---|
| 817 | output_controls (args, formatinfo.DocumentButtons, collectproto, disp,
|
---|
| 818 | outconvert, textout, logout);
|
---|
| 819 | }
|
---|
| 820 | textout << outconvert << "</div>\n\n";
|
---|
| 821 | }
|
---|
| 822 |
|
---|
| 823 | if (formatinfo.DocumentContents || args["d"].empty()) {
|
---|
| 824 | if (args["d"].empty()) {
|
---|
| 825 | textout << outconvert << "<div id=\""<<cl_top<<"\" class=\"toc\">\n";
|
---|
| 826 | } else {
|
---|
| 827 | textout << outconvert << "<div class=\"toc\">\n";
|
---|
| 828 |
|
---|
| 829 | }
|
---|
[12183] | 830 | if (args.getintarg("gc") == 1)
|
---|
| 831 | {
|
---|
| 832 | // expanded table of contents
|
---|
| 833 | expanded_contents(args, tabcount, fulltoc, browsermap, formatinfo,
|
---|
| 834 | collectproto, disp, outconvert, textout, logout, false);
|
---|
| 835 | }
|
---|
| 836 | else if (args.getintarg("gc") == 2)
|
---|
| 837 | {
|
---|
| 838 | // expand visible levels of table of contents
|
---|
| 839 | expand_show_contents(args, tabcount, fulltoc, browsermap, formatinfo,
|
---|
| 840 | collectproto, disp, outconvert, textout, logout);
|
---|
| 841 | }
|
---|
| 842 | else
|
---|
| 843 | {
|
---|
| 844 | // contracted table of contents
|
---|
| 845 | contracted_contents(args, tabcount, fulltoc, browsermap, formatinfo,
|
---|
| 846 | collectproto, disp, outconvert, textout, logout);
|
---|
| 847 | }
|
---|
[12044] | 848 | textout << outconvert << "</div>\n";
|
---|
| 849 | }
|
---|
| 850 | }
|
---|
| 851 |
|
---|
| 852 | void browsetoolsclass::load_extended_options(text_tmap &options, cgiargsclass &args, browsermapclass *browsers,
|
---|
| 853 | formatinfo_t &formatinfo, recptproto *collectproto,
|
---|
| 854 | displayclass &disp, outconvertclass &outconvert, ostream &logout)
|
---|
| 855 | {
|
---|
| 856 | options["DocImage"] = get_cover_image();
|
---|
| 857 |
|
---|
| 858 | #if defined(GSDL_USE_IOS_H)
|
---|
| 859 | ostrstream *tmpstr = new ostrstream();
|
---|
| 860 | #else
|
---|
| 861 | ostringstream *tmpstr = new ostringstream(ostringstream::binary);
|
---|
| 862 | #endif
|
---|
| 863 |
|
---|
| 864 | if (args["gc"] == "1")
|
---|
| 865 | {
|
---|
| 866 | expanded_contents(args, 0, false, browsers, formatinfo, collectproto,
|
---|
[12183] | 867 | disp, outconvert, *tmpstr, logout, false);
|
---|
[12044] | 868 | }
|
---|
| 869 | else
|
---|
| 870 | {
|
---|
| 871 | contracted_contents(args, 0, false, browsers, formatinfo,
|
---|
| 872 | collectproto, disp, outconvert, *tmpstr, logout);
|
---|
| 873 | }
|
---|
| 874 | #if defined(GSDL_USE_IOS_H)
|
---|
| 875 | char *t = tmpstr->str();
|
---|
| 876 | text_t tmp;
|
---|
| 877 | tmp.setcarr(t, tmpstr->pcount());
|
---|
| 878 | delete [] t;
|
---|
| 879 | #else
|
---|
| 880 | text_t tmp = (char *)(tmpstr->str().c_str());
|
---|
| 881 | #endif
|
---|
| 882 | int len = tmp.size();
|
---|
| 883 | char *ctmp = tmp.getcstr();
|
---|
| 884 | utf8inconvertclass utf82text_t;
|
---|
| 885 | utf82text_t.setinput(ctmp, len);
|
---|
| 886 | convertclass::status_t status;
|
---|
| 887 | utf82text_t.convert(tmp, status);
|
---|
| 888 | options["DocTOC"] = tmp;
|
---|
| 889 | delete []ctmp;
|
---|
| 890 | delete tmpstr;
|
---|
| 891 |
|
---|
| 892 | options["DocumentButtonDetach"] = "_document:imagedetach_";
|
---|
| 893 | if (args["hl"] == "1")
|
---|
| 894 | {
|
---|
| 895 | options["DocumentButtonHighlight"] = "_document:imagenohighlight_";
|
---|
| 896 | }
|
---|
| 897 | else
|
---|
| 898 | {
|
---|
| 899 | options["DocumentButtonHighlight"] = "_document:imagehighlight_";
|
---|
| 900 | }
|
---|
| 901 | if (args["gc"] == "1")
|
---|
| 902 | {
|
---|
| 903 | options["DocumentButtonExpandContents"] = "_document:imagecontracttoc_";
|
---|
| 904 | }
|
---|
| 905 | else
|
---|
| 906 | {
|
---|
| 907 | options["DocumentButtonExpandContents"] = "_document:imageexpandtoc_";
|
---|
| 908 | }
|
---|
| 909 | if (args["gt"] == "1")
|
---|
| 910 | {
|
---|
| 911 | options["DocumentButtonExpandText"] = "_document:imagecontracttext_";
|
---|
| 912 | }
|
---|
| 913 | else
|
---|
| 914 | {
|
---|
| 915 | options["DocumentButtonExpandText"] = "_document:imageexpandtext_";
|
---|
| 916 | }
|
---|
| 917 | }
|
---|