Changeset 1059 for trunk/gsdl/src/recpt/browsetools.cpp
- Timestamp:
- 2000-04-03T19:28:25+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r1048 r1059 29 29 /* 30 30 $Log$ 31 Revision 1.41 2000/04/03 07:25:02 sjboddie 32 replaced old DocumentIcon and DocumentContents format options 33 with DocumentColumn stuff 34 31 35 Revision 1.40 2000/03/31 03:04:30 nzdl 32 36 tidied up some of the browsing code - replaced DocumentImages, … … 182 186 183 187 184 // output_controls displays the detach, expand/contract contents,185 // expand/contract text and highlighting/no highlighting buttons186 187 void output_controls (cgiargsclass &args, const text_tarray &ibuttons,188 recptproto * /*collectproto*/, displayclass &disp,189 outconvertclass &outconvert, ostream &textout,190 ostream &/*logout*/) {191 192 if (args["u"] != "1") {193 194 FilterResponse_t response;195 text_tarray metadata;196 text_tarray buttons;197 198 text_tarray::const_iterator here = ibuttons.begin();199 text_tarray::const_iterator end = ibuttons.end();200 201 while (here != end) {202 203 if (*here == "Detach")204 buttons.push_back ("_document:imagedetach_");205 else if (*here == "Highlight") {206 if (args["hl"] == "1")207 buttons.push_back ("_document:imagenohighlight_");208 else209 buttons.push_back ("_document:imagehighlight_");210 } else if (*here == "Expand Contents") {211 if (args["gc"] == "1")212 buttons.push_back ("_document:imagecontracttoc_");213 else214 buttons.push_back ("_document:imageexpandtoc_");215 } else if (*here == "Expand Text") {216 if (args.getintarg("gt"))217 buttons.push_back ("_document:imagecontracttext_");218 else219 buttons.push_back ("_document:imageexpandtext_");220 }221 here ++;222 }223 224 here = buttons.begin();225 end = buttons.end();226 int count = 0;227 while (here != end) {228 if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n";229 textout << outconvert << disp << *here;230 count ++;231 here ++;232 }233 }234 }235 236 237 // at the moment this just writes out the html to display238 // the cover image (assuming it's called cover.jpg)239 // this whole thing should be done with a call to the collection240 // server which would send a link to the cover image if there241 // was one otherwise send title, author and stuff242 void output_cover_image (cgiargsclass &args, recptproto * /*collectproto*/,243 displayclass &disp, outconvertclass &outconvert,244 ostream &textout, ostream &/*logout*/) {245 246 if (args["d"].empty()) return;247 248 textout << outconvert << disp <<249 "<img src=\"_httpcollimg_/_thisOID_/cover.jpg\"><br>\n";250 }251 252 void output_titles (cgiargsclass &args, recptproto *collectproto,253 formatinfo_t &formatinfo, displayclass &disp,254 outconvertclass &outconvert, ostream &textout,255 ostream &logout) {256 257 if (args["d"].empty()) return;258 259 text_tset metadata;260 bool getParents;261 FilterResponse_t response;262 263 format_t *formatlistptr = new format_t();264 parse_formatstring (formatinfo.DocumentIcon, formatlistptr, metadata, getParents);265 266 if (!get_info (args["d"], args["c"], metadata, getParents, collectproto, response, logout))267 return;268 269 textout << outconvert << disp << get_formatted_string (response.docInfo[0], formatlistptr);270 }271 272 273 188 static void recurse_contents (ResultDocInfo_t §ion, cgiargsclass &args, bool fulltoc, 274 189 browserclass *bptr, text_tset &metadata, bool &getParents, 275 190 format_t *formatlistptr, format_tmap &formatlistmap, 276 formatinfo_t &formatinfo, browsermapclass *browsermap,191 text_tmap &formatstrings, browsermapclass *browsermap, 277 192 int tabcount, recptproto *collectproto, displayclass &disp, 278 193 outconvertclass &outconvert, ostream &textout, ostream &logout) { … … 308 223 309 224 // get the formatstring if there is one 310 if (!get_formatstring (classification, classifytype, 311 formatinfo.formatstrings, formatstring)) 225 if (!get_formatstring (classification, classifytype, formatstrings, formatstring)) 312 226 formatstring = bptr->get_default_formatstring(); 313 227 … … 328 242 while (thisdoc != lastdoc) { 329 243 recurse_contents (*thisdoc, args, fulltoc, bptr, metadata, getParents, 330 formatlistptr, formatlistmap, format info, browsermap,244 formatlistptr, formatlistmap, formatstrings, browsermap, 331 245 tabcount, collectproto, disp, outconvert, textout, logout); 332 246 thisdoc ++; … … 343 257 // the current one 344 258 345 void expanded_contents (cgiargsclass &args, int tabcount, bool fulltoc,346 browsermapclass *browsermap, formatinfo_t &formatinfo,347 recptproto *collectproto, displayclass &disp,348 outconvertclass &outconvert, ostream &textout,349 ostream &logout) {259 static void expanded_contents (cgiargsclass &args, int tabcount, bool fulltoc, 260 browsermapclass *browsermap, text_tmap &formatstrings, 261 recptproto *collectproto, displayclass &disp, 262 outconvertclass &outconvert, ostream &textout, 263 ostream &logout) { 350 264 351 265 if (args["d"].empty() && args["cl"].empty()) return; … … 419 333 420 334 // get the formatstring if there is one or use the browsers default 421 if (!get_formatstring (classification, classifytype, 422 formatinfo.formatstrings, formatstring)) 335 if (!get_formatstring (classification, classifytype, formatstrings, formatstring)) 423 336 formatstring = bptr->get_default_formatstring(); 424 337 … … 434 347 435 348 recurse_contents (response.docInfo[0], args, fulltoc, bptr, metadata, 436 getParents, formatlistptr, formatlistmap, format info, browsermap,349 getParents, formatlistptr, formatlistmap, formatstrings, browsermap, 437 350 tabcount, collectproto, disp, outconvert, textout, logout); 438 351 … … 449 362 static void load_formatstring (const text_t &classifytype, text_tset &metadata, 450 363 bool &getParents, const text_t &classification, 451 browsermapclass *browsermap, formatinfo_t &formatinfo,364 browsermapclass *browsermap, text_tmap &formatstrings, 452 365 format_tmap &formatlistmap) { 453 366 text_t formatstring; … … 458 371 459 372 // get the formatstring if there is one or use the browsers default 460 if (!get_formatstring (classification, classifytype, 461 formatinfo.formatstrings, formatstring)) 373 if (!get_formatstring (classification, classifytype, formatstrings, formatstring)) 462 374 formatstring = bptr->get_default_formatstring(); 463 375 … … 473 385 static void load_formatstrings (FilterResponse_t &response, text_tset &metadata, 474 386 bool &getParents, const text_t &classification, 475 browsermapclass *browsermap, formatinfo_t &formatinfo,387 browsermapclass *browsermap, text_tmap &formatstrings, 476 388 format_tmap &formatlistmap) { 477 389 … … 485 397 if (is_top ((*thisdoc).OID)) 486 398 load_formatstring ((*thisdoc).metadata["thistype"].values[0], metadata, 487 getParents, classification, browsermap, format info,399 getParents, classification, browsermap, formatstrings, 488 400 formatlistmap); 489 401 … … 492 404 if (it == cache.end()) { 493 405 load_formatstring (childtype, metadata, getParents, classification, 494 browsermap, format info, formatlistmap);406 browsermap, formatstrings, formatlistmap); 495 407 cache.insert (childtype); 496 408 } … … 500 412 501 413 static void output_parents (FilterResponse_t &response, cgiargsclass &args, 502 browsermapclass *browsermap, formatinfo_t &formatinfo,414 browsermapclass *browsermap, text_tmap &formatstrings, 503 415 format_tmap &formatlistmap, const text_t &classification, 504 416 int &tabcount, text_tset &metadata, bool &getParents, … … 527 439 528 440 // get the formatstring if there is one or use the browsers default 529 if (!get_formatstring (classification, classifytype, 530 formatinfo.formatstrings, formatstring)) 441 if (!get_formatstring (classification, classifytype, formatstrings, formatstring)) 531 442 formatstring = bptr->get_default_formatstring(); 532 443 … … 548 459 } 549 460 550 void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc,551 browsermapclass *browsermap, formatinfo_t &formatinfo,552 553 554 461 static void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc, 462 browsermapclass *browsermap, text_tmap &formatstrings, 463 recptproto *collectproto, displayclass &disp, 464 outconvertclass &outconvert, ostream &textout, 465 ostream &logout) { 555 466 556 467 FilterResponse_t response; … … 585 496 format_tmap formatlistmap; 586 497 load_formatstrings (response, metadata, getParents, classification, 587 browsermap, format info, formatlistmap);498 browsermap, formatstrings, formatlistmap); 588 499 589 500 if (!get_info (parents, args["c"], metadata, getParents, collectproto, response, logout)) … … 591 502 592 503 // display each parent 593 output_parents (response, args, browsermap, format info, formatlistmap,504 output_parents (response, args, browsermap, formatstrings, formatlistmap, 594 505 classification, tabcount, metadata, getParents, 595 506 collectproto, disp, outconvert, textout, logout); … … 622 533 623 534 // get the formatstring if there is one or use the browsers default 624 if (!get_formatstring (classification, classifytype, 625 formatinfo.formatstrings, formatstring)) 535 if (!get_formatstring (classification, classifytype, formatstrings, formatstring)) 626 536 formatstring = bptr->get_default_formatstring(); 627 537 … … 650 560 651 561 void output_toc (cgiargsclass &args, browsermapclass *browsermap, 652 formatinfo_t &formatinfo, recptproto *collectproto,562 text_tmap &formatstrings, recptproto *collectproto, 653 563 displayclass &disp, outconvertclass &outconvert, 654 564 ostream &textout, ostream &logout) { 655 565 656 566 int tabcount = 0; 657 bool havecontrols = false;658 567 bool fulltoc = false; 659 568 … … 662 571 text_t cl_top, full_toc; 663 572 get_top (args["cl"], cl_top); 664 if (get_formatstring (cl_top, "FullTOC", format info.formatstrings, full_toc))573 if (get_formatstring (cl_top, "FullTOC", formatstrings, full_toc)) 665 574 if (full_toc == "true") fulltoc = true; 666 575 } 667 668 // get the cover image (if there is one) and the control buttons 669 // if we're inside a book 670 if ((!fulltoc) && (!args["d"].empty())) { 671 textout << outconvert << disp 672 << "<p><center><table width=_pagewidth_><tr>\n" 673 << "<td valign=top"; 674 if (formatinfo.DocumentContents) textout << " width=200>\n"; 675 else textout << " width=100%>\n"; 676 if (formatinfo.DocumentIcon == "true") 677 output_cover_image (args, collectproto, disp, outconvert, textout, logout); 678 else if (formatinfo.DocumentIcon != "false") 679 output_titles (args, collectproto, formatinfo, disp, outconvert, textout, logout); 680 output_controls (args, formatinfo.DocumentButtons, collectproto, disp, 681 outconvert, textout, logout); 682 textout << "</td><td valign=top>\n"; 683 havecontrols = true; 684 } 685 686 if (formatinfo.DocumentContents || args["d"].empty()) { 687 if (args.getintarg("gc") == 1) { 576 577 if (args["gc"] == 1) { 688 578 689 // expanded table of contents 690 expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo, 579 // expanded table of contents 580 expanded_contents (args, tabcount, fulltoc, browsermap, formatstrings, 581 collectproto, disp, outconvert, textout, logout); 582 } else { 583 584 // contracted table of contents 585 contracted_contents (args, tabcount, fulltoc, browsermap, formatstrings, 691 586 collectproto, disp, outconvert, textout, logout); 692 } else { 693 694 // contracted table of contents 695 contracted_contents (args, tabcount, fulltoc, browsermap, formatinfo, 696 collectproto, disp, outconvert, textout, logout); 697 } 698 } 699 700 if (havecontrols) textout << "</td></tr></table></center>\n"; 701 } 702 703 704 587 } 588 }
Note:
See TracChangeset
for help on using the changeset viewer.