- Timestamp:
- 2000-08-25T12:57:05+12:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/OIDtools.cpp
r1347 r1443 84 84 comerror_t err; 85 85 FilterRequest_t request; 86 request.clear(); 86 87 87 88 request.filterName = "NullFilter"; -
trunk/gsdl/src/recpt/browsetools.cpp
r1285 r1443 114 114 return; 115 115 116 textout << outconvert << disp << get_formatted_string (response.docInfo[0], formatlistptr); 116 textout << outconvert << disp 117 << get_formatted_string (args["c"],collectproto, 118 response.docInfo[0], formatlistptr, 119 logout); 117 120 } 118 121 … … 488 491 if (haschildren) { 489 492 bool use_table = is_table_content (formatlistptr); 490 bptr->output_section_group (response, args, "", tabcount, formatlistptr, use_table, 493 // collection used to be "" // **** // check with Stef!!!! 494 bptr->output_section_group (response, args, args["c"], tabcount, formatlistptr, use_table, 491 495 metadata, getParents, collectproto, disp, outconvert, 492 496 textout, logout); -
trunk/gsdl/src/recpt/datelistbrowserclass.cpp
r1285 r1443 58 58 59 59 int datelistbrowserclass::output_section_group (FilterResponse_t §ions, cgiargsclass &args, 60 const text_t & /*collection*/, int colnumber, format_t *formatlistptr,60 const text_t &collection, int colnumber, format_t *formatlistptr, 61 61 bool use_table, text_tset &/*metadata*/, bool &/*getParents*/, 62 recptproto * /*collectproto*/, displayclass &disp,63 outconvertclass &outconvert, ostream &textout, ostream & /*logout*/) {62 recptproto * collectproto, displayclass &disp, 63 outconvertclass &outconvert, ostream &textout, ostream &logout) { 64 64 65 65 text_t lastyear = "0000"; … … 125 125 126 126 textout << outconvert << disp 127 << get_formatted_string (*thissection, formatlistptr, link, icon) << "\n"; 127 << get_formatted_string (collection, collectproto, 128 *thissection, formatlistptr, 129 link, icon, false, 130 logout) << "\n"; 128 131 129 132 if (!use_table) textout << "</td>"; -
trunk/gsdl/src/recpt/documentaction.cpp
r1419 r1443 718 718 719 719 if (wanttext != 1) { 720 text_t doctext = get_formatted_string (docinfo, formatlistptr, docresponse.doc); 720 text_t doctext 721 = get_formatted_string (collection, collectproto, 722 docinfo, formatlistptr, docresponse.doc, 723 logout); 721 724 722 725 if (highlight) -
trunk/gsdl/src/recpt/extlinkaction.cpp
r1285 r1443 113 113 // _nexturl_ link to external page 114 114 // _prevdoc_ link to previous document 115 115 // disp.setmacro("nexturl", "extlink", cgi_safe(args["href"])); 116 // problem in whist, above line changed. Perhaps decode_cgi_arg ?? 117 // see also HTML plugin 116 118 disp.setmacro("nexturl", "extlink", args["href"]); 117 119 disp.setmacro("prevdoc", "extlink", args["d"]); -
trunk/gsdl/src/recpt/formattools.cpp
r1285 r1443 26 26 #include "formattools.h" 27 27 #include "cgiutils.h" 28 #include "OIDtools.h" 29 28 30 #include <assert.h> 29 31 30 32 // a few function prototypes 31 static text_t format_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 33 static text_t format_string (const text_t& collection, recptproto* collectproto, 34 ResultDocInfo_t &docinfo, format_t *formatlistptr, 32 35 const text_t &link, const text_t &icon, 33 const text_t &text, bool highlight );36 const text_t &text, bool highlight, ostream& logout); 34 37 35 38 static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end, … … 269 272 } 270 273 if (parse_action (++here, end, formatlistptr, metadata, getParents)) { 274 271 275 formatlistptr->nextptr = new format_t(); 272 276 formatlistptr = formatlistptr->nextptr; … … 324 328 else return false; 325 329 326 int curlycount = 0;327 330 int commacount = 0; 328 331 text_t text; … … 333 336 if (here != end) text.push_back(*here); 334 337 335 } else if (*here == '{') {curlycount ++; text.push_back(*here);} 336 else if (*here == '}' && curlycount > 0) { 337 curlycount --; 338 text.push_back(*here); 339 } 340 341 else if ((*here == ',' || *here == '}') && curlycount <= 0) { 338 } 339 340 else if (*here == ',' || *here == '}' || *here == '{') { 342 341 343 342 if (formatlistptr->command == comOr) { 344 343 // the {Or}{this, or this, or this, or this} statement 345 // or'ed statements may be either [metadata] or plain text346 344 format_t *or_ptr; 347 345 … … 358 356 } 359 357 360 text_t::const_iterator beginbracket = text.begin(); 361 text_t::const_iterator endbracket = (text.end() - 1); 362 if ((*beginbracket == '[') && (*endbracket == ']')) { 363 // it's metadata 364 text_t meta = substr (beginbracket+1, endbracket); 365 parse_meta (meta, or_ptr, metadata, getParents); 366 367 } else { 368 parse_string (text, or_ptr, metadata, getParents); 369 } 358 if (!text.empty()) 359 { 360 if (!parse_string(text, or_ptr, metadata, getParents)) { return false; } 361 } 362 363 if (*here == '{') 364 { 365 // Supports: {Or}{[Booktitle],[Title],{If}{[XXXX],aaa,bbb}} 366 // but not : {Or}{[Booktitle],[Title]{If}{[XXXX],aaa,bbb}} 367 // The latter can always be re-written: 368 // {Or}{[Booktitle],{If}{[Title],[Title]{If}{[XXXX],aaa,bbb}}} 369 370 if (!text.empty()) // already used up allocated format_t 371 { 372 // => allocate new one for detected action 373 or_ptr->nextptr = new format_t(); 374 or_ptr = or_ptr->nextptr; 375 } 376 if (!parse_action(++here, end, or_ptr, metadata, getParents)) 377 { 378 return false; 379 } 380 } 381 else 382 { 383 if (*here == '}') break; 384 } 370 385 text.clear(); 371 386 … … 374 389 if (commacount == 0) { 375 390 // If decision only supports metadata at present 376 391 377 392 // remove the surrounding square brackets 378 393 text_t::const_iterator beginbracket = text.begin(); … … 385 400 } 386 401 387 } else if (commacount == 1) { 388 formatlistptr->ifptr = new format_t(); 389 parse_string (text, formatlistptr->ifptr, metadata, getParents); 390 commacount ++; 391 text.clear(); 402 } else { 403 format_t** nextlistptr = NULL; 404 if (commacount == 1) { 405 nextlistptr = &formatlistptr->ifptr; 406 } else if (commacount == 2 ) { 407 nextlistptr = &formatlistptr->elseptr; 408 } else { 409 return false; 410 } 411 412 if (!text.empty()) { 413 if (*nextlistptr == NULL) { 414 *nextlistptr = new format_t(); 415 } else { 416 417 // skip to the end of any format_t statements already added 418 while ((*nextlistptr)->nextptr != NULL) 419 { 420 nextlistptr = &(*nextlistptr)->nextptr; 421 } 422 423 (*nextlistptr)->nextptr = new format_t(); 424 nextlistptr = &(*nextlistptr)->nextptr; 425 } 426 427 if (!parse_string (text, *nextlistptr, metadata, getParents)) 428 { 429 return false; 430 } 431 text.clear(); 432 } 392 433 393 } else if (commacount == 2) { 394 formatlistptr->elseptr = new format_t(); 395 parse_string (text, formatlistptr->elseptr, metadata, getParents); 396 commacount ++; 397 text.clear(); 434 if (*here == '{') 435 { 436 if (*nextlistptr == NULL) { 437 *nextlistptr = new format_t(); 438 } else { 439 (*nextlistptr)->nextptr = new format_t(); 440 nextlistptr = &(*nextlistptr)->nextptr; 441 } 442 443 if (!parse_action(++here, end, *nextlistptr, metadata, getParents)) 444 { 445 return false; 446 } 447 } 448 else 449 { 450 if (*here == '}') break; 451 commacount ++; 452 } 398 453 } 399 454 } 400 if (*here == '}') break;401 455 402 456 } else text.push_back(*here); … … 493 547 } 494 548 495 static text_t get_or (ResultDocInfo_t &docinfo, format_t *orptr, 549 static text_t get_or (const text_t& collection, recptproto* collectproto, 550 ResultDocInfo_t &docinfo, format_t *orptr, 496 551 const text_t &link, const text_t &icon, 497 const text_t &text, bool highlight) { 552 const text_t &text, bool highlight, 553 ostream& logout) { 498 554 499 555 text_t tmp; 500 556 while (orptr != NULL) { 501 557 502 tmp = format_string (docinfo, orptr, link, icon, text, highlight); 558 tmp = format_string (collection,collectproto, docinfo,orptr, 559 link,icon,text,highlight, logout); 503 560 if (!tmp.empty()) return tmp; 504 561 … … 508 565 } 509 566 510 static text_t get_if (ResultDocInfo_t &docinfo, const decision_t &decision, 567 static text_t get_if (const text_t& collection, recptproto* collectproto, 568 ResultDocInfo_t &docinfo, const decision_t &decision, 511 569 format_t *ifptr, format_t *elseptr, const text_t &link, 512 const text_t &icon, const text_t &text, bool highlight) { 570 const text_t &icon, const text_t &text, bool highlight, 571 ostream& logout) 572 { 513 573 514 574 // not much of a choice yet ... … … 516 576 if (get_meta (docinfo, decision.meta) != "") { 517 577 if (ifptr != NULL) 518 return get_formatted_string (docinfo, ifptr, link, icon, text, highlight); 578 return get_formatted_string (collection,collectproto, docinfo,ifptr, 579 link,icon,text,highlight, logout); 519 580 } 520 581 else { 521 582 if (elseptr != NULL) 522 return get_formatted_string (docinfo, elseptr, link, icon, text, highlight); 583 return get_formatted_string (collection,collectproto, docinfo,elseptr, 584 link,icon,text,highlight, logout); 523 585 } 524 586 } … … 526 588 } 527 589 528 text_t format_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 590 bool includes_metadata(const text_t& text) 591 { 592 text_t::const_iterator here = text.begin(); 593 text_t::const_iterator end = text.end(); 594 while (here != end) { 595 if (*here == '[') return true; 596 here ++; 597 } 598 599 return false; 600 } 601 602 text_t format_string (const text_t& collection, recptproto* collectproto, 603 ResultDocInfo_t &docinfo, format_t *formatlistptr, 529 604 const text_t &link, const text_t &icon, 530 const text_t &text, bool highlight) { 605 const text_t &text, bool highlight, 606 ostream& logout) { 531 607 532 608 if (formatlistptr == NULL) return ""; … … 545 621 return docinfo.result_num; 546 622 case comMeta: 547 return get_meta (docinfo, formatlistptr->meta); 623 624 { 625 const text_t& metavalue = get_meta (docinfo, formatlistptr->meta); 626 627 if (includes_metadata(metavalue)) 628 { 629 // text has embedded metadata in it => expand it 630 FilterRequest_t request; 631 FilterResponse_t response; 632 633 request.getParents = false; 634 635 format_t *expanded_formatlistptr = new format_t(); 636 parse_formatstring (metavalue, expanded_formatlistptr, 637 request.fields, request.getParents); 638 639 // retrieve metadata 640 get_info(docinfo.OID, collection, request.fields, request.getParents, 641 collectproto, response, logout); 642 643 if (!response.docInfo.empty()) 644 { 645 text_t expanded_metavalue 646 = get_formatted_string(collection,collectproto, 647 response.docInfo[0],expanded_formatlistptr, 648 link,icon,highlight, 649 logout); 650 651 return expanded_metavalue; 652 } 653 else 654 { 655 return metavalue; 656 } 657 } 658 else 659 { 660 return metavalue; 661 } 662 } 548 663 case comDoc: 549 664 return text; … … 555 670 break; 556 671 case comIf: 557 return get_if (docinfo, formatlistptr->decision, formatlistptr->ifptr, 558 formatlistptr->elseptr, link, icon, text, highlight); 672 return get_if (collection, collectproto, 673 docinfo, formatlistptr->decision, formatlistptr->ifptr, 674 formatlistptr->elseptr, link, icon, text, highlight, 675 logout); 559 676 case comOr: 560 return get_or (docinfo, formatlistptr->orptr, link, icon, text, highlight); 677 return get_or (collection,collectproto, docinfo,formatlistptr->orptr, 678 link,icon,text,highlight, logout); 561 679 } 562 680 return ""; … … 564 682 565 683 566 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 567 const text_t &link, const text_t &icon) { 568 569 text_t text; 684 685 686 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 687 ResultDocInfo_t& docinfo, format_t* formatlistptr, 688 const text_t& link, const text_t& icon, 689 const text_t& text, const bool highlight, 690 ostream& logout) { 570 691 571 692 text_t ft; 572 while (formatlistptr != NULL) { 573 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 574 formatlistptr = formatlistptr->nextptr; 575 } 693 while (formatlistptr != NULL) 694 { 695 ft += format_string (collection, collectproto, docinfo, formatlistptr, 696 link, icon, text, highlight, logout); 697 formatlistptr = formatlistptr->nextptr; 698 } 699 576 700 return ft; 577 701 } 578 702 579 580 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr) { 703 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 704 ResultDocInfo_t &docinfo, format_t *formatlistptr, 705 const text_t &link, const text_t &icon, 706 const bool highlight, 707 ostream& logout) { 708 709 text_t text = ""; 710 711 return get_formatted_string(collection, collectproto, docinfo, formatlistptr, 712 link, icon, text, highlight, logout); 713 } 714 715 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 716 ResultDocInfo_t &docinfo, format_t *formatlistptr, 717 const text_t& text, 718 ostream& logout) { 581 719 582 720 text_t link = "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">"; 583 721 text_t icon = "_icontext_"; 584 text_t text; 585 586 text_t ft; 587 while (formatlistptr != NULL) { 588 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 589 formatlistptr = formatlistptr->nextptr; 590 } 591 return ft; 592 } 593 594 595 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 596 const text_t &text) { 597 598 text_t link = "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">"; 599 text_t icon = "_icontext_"; 600 601 text_t ft; 602 while (formatlistptr != NULL) { 603 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 604 formatlistptr = formatlistptr->nextptr; 605 } 606 return ft; 607 } 608 609 610 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 611 const text_t &link, const text_t &icon, const text_t &text) { 612 613 text_t ft; 614 while (formatlistptr != NULL) { 615 ft += format_string (docinfo, formatlistptr, link, icon, text, false); 616 formatlistptr = formatlistptr->nextptr; 617 } 618 return ft; 619 } 620 621 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 622 const text_t &link, const text_t &icon, bool highlight) { 623 624 text_t text, ft; 625 while (formatlistptr != NULL) { 626 ft += format_string (docinfo, formatlistptr, link, icon, text, highlight); 627 formatlistptr = formatlistptr->nextptr; 628 } 629 return ft; 630 } 631 632 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 633 const text_t &link, const text_t &icon, 634 const text_t &text, bool highlight) { 635 636 text_t ft; 637 while (formatlistptr != NULL) { 638 ft += format_string (docinfo, formatlistptr, link, icon, text, highlight); 639 formatlistptr = formatlistptr->nextptr; 640 } 641 return ft; 642 } 722 bool highlight = false; 723 724 return get_formatted_string(collection, collectproto, docinfo, formatlistptr, 725 link, icon, text, highlight, logout); 726 } 727 728 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 729 ResultDocInfo_t &docinfo, format_t *formatlistptr, 730 ostream& logout) { 731 732 text_t text = ""; 733 734 return get_formatted_string(collection, collectproto, docinfo, formatlistptr, 735 text, logout); 736 } 737 -
trunk/gsdl/src/recpt/formattools.h
r1285 r1443 30 30 #include "text_t.h" 31 31 #include "comtypes.h" 32 #include "recptproto.h" 32 33 33 34 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, … … 99 100 text_tset &metadata, bool &getParents); 100 101 101 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,102 const text_t &link, const text_t &icon);103 102 104 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr); 103 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 104 ResultDocInfo_t &docinfo, format_t *formatlistptr, 105 const text_t &link, const text_t &icon, 106 const text_t& t, const bool highlight, 107 ostream& logout); 105 108 106 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 107 const text_t &text); 109 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 110 ResultDocInfo_t &docinfo, format_t *formatlistptr, 111 const text_t &link, const text_t &icon, 112 const bool highlight, 113 ostream& logout); 108 114 109 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 110 const text_t &link, const text_t &icon, const text_t &text); 115 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 116 ResultDocInfo_t &docinfo, format_t *formatlistptr, 117 const text_t &text, 118 ostream& logout); 111 119 112 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr, 113 const text_t &link, const text_t &icon, bool highlight); 120 text_t get_formatted_string (const text_t& collection, recptproto* collectproto, 121 ResultDocInfo_t &docinfo, format_t *formatlistptr, 122 ostream& logout); 114 123 115 text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,116 const text_t &link, const text_t &icon,117 const text_t &text, bool highlight);118 124 119 125 120 126 #endif 127 128 -
trunk/gsdl/src/recpt/hlistbrowserclass.cpp
r1285 r1443 82 82 83 83 int hlistbrowserclass::output_section_group (ResultDocInfo_t §ion, cgiargsclass &args, 84 const text_t &/*collection*/, int colnumber,84 const text_t& collection, int colnumber, 85 85 format_t *formatlistptr, bool use_table, 86 86 text_tset &metadata, bool &getParents, … … 136 136 137 137 textout << outconvert << disp 138 << get_formatted_string (*tsibling, formatlistptr, link, icon, highlight); 138 << get_formatted_string (collection, collectproto, 139 *tsibling, formatlistptr, link, icon, highlight, 140 logout); 139 141 140 142 textout << "</td>\n"; -
trunk/gsdl/src/recpt/vlistbrowserclass.cpp
r1285 r1443 52 52 format_t *formatlistptr, bool use_table, 53 53 text_tset &/*metadata*/, bool &/*getParents*/, 54 recptproto * /*collectproto*/, displayclass &disp,54 recptproto * collectproto, displayclass &disp, 55 55 outconvertclass &outconvert, ostream &textout, 56 ostream &/*logout*/) {56 ostream& logout) { 57 57 58 58 text_t link, icon; … … 80 80 } 81 81 82 textout << outconvert << disp << get_formatted_string (section, formatlistptr, 83 link, icon, highlight); 82 textout << outconvert << disp 83 << get_formatted_string (collection, collectproto, 84 section, formatlistptr, 85 link, icon, highlight, logout); 84 86 85 87 if (use_table || colnumber > 0) textout << "</tr></table>\n"; … … 92 94 format_t *formatlistptr, bool use_table, 93 95 text_tset &/*metadata*/, bool &/*getParents*/, 94 recptproto * /*collectproto*/, displayclass &disp,96 recptproto * collectproto, displayclass &disp, 95 97 outconvertclass &outconvert, ostream &textout, 96 ostream &/*logout*/) {98 ostream& logout) { 97 99 98 100 text_t link, icon; … … 129 131 130 132 if (use_table || colnumber > 0) textout << "<tr valign=top>"; 131 textout << outconvert << disp << get_formatted_string (*thissection, formatlistptr, 132 link, icon, highlight); 133 textout << outconvert << disp 134 << get_formatted_string (collection, collectproto, 135 *thissection, formatlistptr, 136 link, icon, highlight, logout); 137 133 138 if (use_table || colnumber > 0) textout << "</tr>"; 134 139 textout << "\n";
Note:
See TracChangeset
for help on using the changeset viewer.