Changeset 1059 for trunk/gsdl/src
- Timestamp:
- 2000-04-03T19:28:25+12:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 6 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 } -
trunk/gsdl/src/recpt/browsetools.h
r941 r1059 40 40 typedef map<text_t, format_t*, lttext_t> format_tmap; 41 41 42 void expanded_contents (cgiargsclass &args, int tabcount, bool fulltoc,43 browsermapclass *browsermap, formatinfo_t &formatinfo,44 recptproto *collectproto, displayclass &disp,45 outconvertclass &outconvert, ostream &textout,46 ostream &logout);47 48 void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc,49 browsermapclass *browsermap, formatinfo_t &formatinfo,50 recptproto *collectproto, displayclass &disp,51 outconvertclass &outconvert, ostream &textout,52 ostream &logout);53 54 42 void output_toc (cgiargsclass &args, browsermapclass *browsermap, 55 formatinfo_t &formatinfo, recptproto *collectproto,43 text_tmap &formatstrings, recptproto *collectproto, 56 44 displayclass &disp, outconvertclass &outconvert, 57 45 ostream &textout, ostream &logout); 58 46 59 void output_titles (cgiargsclass &args, recptproto *collectproto,60 formatinfo_t &formatinfo, displayclass &disp,61 outconvertclass &outconvert, ostream &textout,62 ostream &logout);63 64 void output_controls (cgiargsclass &args, const text_tarray &ibuttons,65 recptproto *collectproto, displayclass &disp,66 outconvertclass &outconvert, ostream &textout,67 ostream &logout);68 69 void output_cover_image (cgiargsclass &args, recptproto *collectproto,70 displayclass &disp, outconvertclass &outconvert,71 ostream &textout, ostream &logout);72 73 74 47 #endif -
trunk/gsdl/src/recpt/documentaction.cpp
r1048 r1059 28 28 /* 29 29 $Log$ 30 Revision 1.36 2000/04/03 07:26:28 sjboddie 31 replaced old DocumentIcon and DocumentContents format options 32 with DocumentColumn stuff 33 30 34 Revision 1.35 2000/03/31 03:04:31 nzdl 31 35 tidied up some of the browsing code - replaced DocumentImages, … … 289 293 290 294 documentaction::~documentaction () { 295 } 296 297 298 // output_controls displays the detach, expand/contract contents, 299 // expand/contract text and highlighting/no highlighting buttons 300 void documentaction::output_controls (cgiargsclass &args, const text_tarray &ibuttons, 301 recptproto * /*collectproto*/, displayclass &disp, 302 outconvertclass &outconvert, ostream &textout, 303 ostream &/*logout*/) { 304 305 if (args["u"] != "1") { 306 307 FilterResponse_t response; 308 text_tarray metadata; 309 text_tarray buttons; 310 311 text_tarray::const_iterator here = ibuttons.begin(); 312 text_tarray::const_iterator end = ibuttons.end(); 313 314 while (here != end) { 315 316 if (*here == "Detach") 317 buttons.push_back ("_document:imagedetach_"); 318 else if (*here == "Highlight") { 319 if (args["hl"] == "1") 320 buttons.push_back ("_document:imagenohighlight_"); 321 else 322 buttons.push_back ("_document:imagehighlight_"); 323 } else if (*here == "Expand Contents") { 324 if (args["gc"] == "1") 325 buttons.push_back ("_document:imagecontracttoc_"); 326 else 327 buttons.push_back ("_document:imageexpandtoc_"); 328 } else if (*here == "Expand Text") { 329 if (args.getintarg("gt")) 330 buttons.push_back ("_document:imagecontracttext_"); 331 else 332 buttons.push_back ("_document:imageexpandtext_"); 333 } 334 here ++; 335 } 336 337 here = buttons.begin(); 338 end = buttons.end(); 339 int count = 0; 340 while (here != end) { 341 if ((count != 0) && ((count % 2) == 0)) textout << "<br>\n"; 342 textout << outconvert << disp << *here; 343 count ++; 344 here ++; 345 } 346 } 347 } 348 349 void documentaction::output_formatstring (const text_t &OID, const text_t &collection, 350 recptproto *collectproto, const text_t &formatstring, 351 displayclass &disp, outconvertclass &outconvert, 352 ostream &textout, ostream &logout) { 353 354 if (OID.empty()) return; 355 356 text_tset metadata; 357 bool getParents; 358 FilterResponse_t response; 359 360 format_t *formatlistptr = new format_t(); 361 parse_formatstring (formatstring, formatlistptr, metadata, getParents); 362 363 if (!get_info (OID, collection, metadata, getParents, collectproto, response, logout)) 364 return; 365 366 textout << outconvert << disp << get_formatted_string (response.docInfo[0], formatlistptr); 367 } 368 369 // output_headerstring outputs a formatstring that may contain the 370 // [Buttons] and [TOC] elements. It separates these elements out, 371 // calling output_controls and output_toc respectively to process 372 // the special elements. Calls output_formatstring to process the 373 // remaining bits of formatstring 374 void documentaction::output_headerstring (cgiargsclass &args, recptproto *collectproto, 375 const text_t &formatstring, browsermapclass *browsers, 376 displayclass &disp, outconvertclass &outconvert, 377 ostream &textout, ostream &logout) { 378 379 text_t &OID = args["d"]; 380 if (OID.empty()) OID = args["cl"]; 381 text_t &collection = args["c"]; 382 383 text_t::const_iterator here = formatstring.begin(); 384 text_t::const_iterator end = formatstring.end(); 385 386 text_t currentstring; 387 while (here != end) { 388 if ((*here == '[') && (*(here+1) == 'B') && (*(here+2) == 'u') && 389 (*(here+3) == 't') && (*(here+4) == 't') && (*(here+5) == 'o') && 390 (*(here+6) == 'n') && (*(here+7) == 's') && (*(here+8) == ']')) { 391 here += 8; 392 if (!currentstring.empty()) { 393 output_formatstring (OID, collection, collectproto, currentstring, 394 disp, outconvert, textout, logout); 395 currentstring.clear(); 396 } 397 398 output_controls (args, formatinfo.DocumentButtons, collectproto, 399 disp, outconvert, textout, logout); 400 401 } else if ((*here == '[') && (*(here+1) == 'T') && (*(here+2) == 'O') && 402 (*(here+3) == 'C') && (*(here+4) == ']')) { 403 here += 4; 404 if (!currentstring.empty()) { 405 output_formatstring (OID, collection, collectproto, currentstring, 406 disp, outconvert, textout, logout); 407 currentstring.clear(); 408 } 409 410 output_toc (args, browsers, formatinfo.formatstrings, collectproto, 411 disp, outconvert, textout, logout); 412 413 } else { 414 currentstring.push_back (*here); 415 } 416 417 here ++; 418 } 419 420 if (!currentstring.empty()) 421 output_formatstring (OID, collection, collectproto, currentstring, 422 disp, outconvert, textout, logout); 291 423 } 292 424 … … 608 740 609 741 while (format_here != format_end) { 610 if ((*format_here).first == "DocumentIcon") 611 formatinfo.DocumentIcon = (*format_here).second; 612 else if (((*format_here).first == "DocumentContents") && 613 ((*format_here).second == "false")) 614 formatinfo.DocumentContents = false; 742 if ((*format_here).first == "DocumentColumns") 743 formatinfo.DocumentColumns = (*format_here).second; 744 else if ((*format_here).first == "DocumentColumnsTotalWidth") 745 formatinfo.DocumentColumnsTotalWidth = (*format_here).second; 746 else if ((*format_here).first == "DocumentColumnLeft") 747 formatinfo.DocumentColumnLeft = (*format_here).second; 748 else if ((*format_here).first == "DocumentColumnLeftWidth") 749 formatinfo.DocumentColumnLeftWidth = (*format_here).second; 750 else if ((*format_here).first == "DocumentColumnRight") 751 formatinfo.DocumentColumnRight = (*format_here).second; 615 752 else if (((*format_here).first == "DocumentArrowsBottom") && 616 753 ((*format_here).second == "false")) … … 840 977 textout << outconvert << disp << "_document:header_\n" 841 978 << "_document:content_\n"; 842 843 // output the table of contents 844 output_toc (args, browsers, formatinfo, collectproto, 845 disp, outconvert, textout, logout); 979 980 // currently only display header information at document level, 981 // this should probably be changed to handle stuff like CL1Columns 982 if (!args["d"].empty()) { 983 textout << outconvert << disp 984 << "<p><center><table width=_pagewidth_><tr>\n" 985 << "<td valign=top"; 986 if (formatinfo.DocumentColumns == "2") { 987 textout << outconvert << disp 988 << " width=" << formatinfo.DocumentColumnLeftWidth << ">\n"; 989 output_headerstring (args, collectproto, formatinfo.DocumentColumnLeft, 990 browsers, disp, outconvert, textout, logout); 991 textout << "\n</td><td valign=top>\n"; 992 output_headerstring (args, collectproto, formatinfo.DocumentColumnRight, 993 browsers, disp, outconvert, textout, logout); 994 } else { 995 textout << " width=100%>\n"; 996 output_headerstring (args, collectproto, formatinfo.DocumentColumnLeft, 997 browsers, disp, outconvert, textout, logout); 998 } 999 textout << "\n</td></tr></table></center>\n"; 1000 } else { 1001 // classification level 1002 output_toc (args, browsers, formatinfo.formatstrings, collectproto, 1003 disp, outconvert, textout, logout); 1004 } 846 1005 847 1006 // output the document text … … 1089 1248 textout << outconvert << disp << buffer; 1090 1249 } 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 -
trunk/gsdl/src/recpt/documentaction.h
r928 r1059 40 40 41 41 receptionist *recpt; 42 43 void output_controls (cgiargsclass &args, const text_tarray &ibuttons, 44 recptproto *collectproto, displayclass &disp, 45 outconvertclass &outconvert, ostream &textout, 46 ostream &logout); 47 48 void output_formatstring (const text_t &OID, const text_t &collection, 49 recptproto *collectproto, const text_t &formatstring, 50 displayclass &disp, outconvertclass &outconvert, 51 ostream &textout, ostream &logout); 52 53 void output_headerstring (cgiargsclass &args, recptproto *collectproto, 54 const text_t &formatstring, browsermapclass *browsers, 55 displayclass &disp, outconvertclass &outconvert, 56 ostream &textout, ostream &logout); 42 57 43 58 bool get_link (cgiargsclass &args, recptprotolistclass *protos, -
trunk/gsdl/src/recpt/formattools.cpp
r1048 r1059 28 28 /* 29 29 $Log$ 30 Revision 1.19 2000/04/03 07:28:24 sjboddie 31 replaced old DocumentIcon and DocumentContents format options 32 with DocumentColumn stuff 33 30 34 Revision 1.18 2000/03/31 03:04:31 nzdl 31 35 tidied up some of the browsing code - replaced DocumentImages, … … 128 132 129 133 void formatinfo_t::clear() { 130 DocumentIcon = "{Or}{[parent(Top):Title],[Title],untitled}<br>"; 131 DocumentContents = true; 134 DocumentColumns = "2"; 135 DocumentColumnsTotalWidth = "_pagewidth_"; 136 DocumentColumnLeft = "[Title]<br>[Buttons]"; 137 DocumentColumnLeftWidth = "200"; 138 DocumentColumnRight = "[TOC]"; 132 139 DocumentArrowsBottom = true; 133 140 DocumentButtons.erase (DocumentButtons.begin(), DocumentButtons.end()); -
trunk/gsdl/src/recpt/formattools.h
r1048 r1059 76 76 formatinfo_t () {clear();} 77 77 78 text_t DocumentIcon; 79 bool DocumentContents; 78 text_t DocumentColumns; 79 text_t DocumentColumnsTotalWidth; 80 text_t DocumentColumnLeft; 81 text_t DocumentColumnLeftWidth; 82 text_t DocumentColumnRight; 80 83 bool DocumentArrowsBottom; 81 84 text_tarray DocumentButtons;
Note:
See TracChangeset
for help on using the changeset viewer.