Changeset 442 for trunk/gsdl/src/recpt/formattools.cpp
- Timestamp:
- 1999-08-11T10:38:09+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/formattools.cpp
r422 r442 12 12 /* 13 13 $Log$ 14 Revision 1.7 1999/08/10 22:38:08 sjboddie 15 added some more format options 16 14 17 Revision 1.6 1999/07/30 02:25:42 sjboddie 15 18 made format_date function global … … 42 45 // a few function prototypes 43 46 static text_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 44 const text_t &link, const text_t &icon );47 const text_t &link, const text_t &icon, const text_t &text); 45 48 46 49 static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end, … … 71 74 orptr = NULL; 72 75 }; 76 77 void formatinfo_t::clear() { 78 DocumentImages = false; 79 // note that DocumentTopPages is used in receptionist when translating 80 // OIDs. changing the default here may require changing it there too. 81 DocumentTopPages = true; 82 DocumentHeading = "{Or}{[parent(Top):Title],[Title],untitled}"; 83 DocumentArrowsTop = true; 84 DocumentArrowsBottom = true; 85 DocumentGoTo = true; 86 DocumentButtons.erase (DocumentButtons.begin(), DocumentButtons.end()); 87 DocumentButtons.push_back ("Detach"); 88 DocumentButtons.push_back ("Highlight"); 89 DocumentButtons.push_back ("Expand Text"); 90 DocumentButtons.push_back ("Expand Contents"); 91 DocumentText = "[Text]"; 92 } 93 73 94 74 95 // returns a date of form _textmonthnn_ 31, 1999 … … 167 188 else if (meta == "icon") 168 189 formatlistptr->command = comIcon; 190 191 else if (meta == "Text") 192 formatlistptr->command = comDoc; 169 193 170 194 else { … … 434 458 435 459 static text_t get_or (const ResultDocInfo_t &docinfo, format_t *orptr, 436 const text_t &link, const text_t &icon ) {460 const text_t &link, const text_t &icon, const text_t &text) { 437 461 438 462 text_t tmp; 439 463 while (orptr != NULL) { 440 464 441 tmp = format_string (docinfo, orptr, link, icon );465 tmp = format_string (docinfo, orptr, link, icon, text); 442 466 if (!tmp.empty()) return tmp; 443 467 … … 449 473 static text_t get_if (const ResultDocInfo_t &docinfo, const decision_t &decision, 450 474 format_t *ifptr, format_t *elseptr, const text_t &link, 451 const text_t &icon ) {475 const text_t &icon, const text_t &text) { 452 476 453 477 // not much of a choice yet ... … … 455 479 if (get_meta (docinfo, decision.meta) != "") { 456 480 if (ifptr != NULL) 457 return get_formatted_string (docinfo, ifptr, link, icon );481 return get_formatted_string (docinfo, ifptr, link, icon, text); 458 482 } 459 483 else { 460 484 if (elseptr != NULL) 461 return get_formatted_string (docinfo, elseptr, link, icon );485 return get_formatted_string (docinfo, elseptr, link, icon, text); 462 486 } 463 487 } … … 465 489 } 466 490 467 statictext_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr,468 const text_t &link, const text_t &icon) {491 text_t format_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 492 const text_t &link, const text_t &icon, const text_t &text) { 469 493 470 494 if (formatlistptr == NULL) return ""; … … 476 500 return link; 477 501 case comEndLink: 478 return "</a>"; 502 if (link.empty) return ""; 503 else return "</a>"; 479 504 case comIcon: 480 505 return icon; … … 483 508 case comMeta: 484 509 return get_meta (docinfo, formatlistptr->meta); 510 case comDoc: 511 return text; 485 512 case comIf: 486 513 return get_if (docinfo, formatlistptr->decision, formatlistptr->ifptr, 487 formatlistptr->elseptr, link, icon );514 formatlistptr->elseptr, link, icon, text); 488 515 case comOr: 489 return get_or (docinfo, formatlistptr->orptr, link, icon );516 return get_or (docinfo, formatlistptr->orptr, link, icon, text); 490 517 } 491 518 return ""; 492 519 } 493 494 520 495 521 … … 497 523 const text_t &link, const text_t &icon) { 498 524 525 text_t text; 526 499 527 text_t ft; 500 528 while (formatlistptr != NULL) { 501 ft += format_string (docinfo, formatlistptr, link, icon );529 ft += format_string (docinfo, formatlistptr, link, icon, text); 502 530 formatlistptr = formatlistptr->nextptr; 503 531 } … … 510 538 text_t link = "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">"; 511 539 text_t icon = "_icontext_"; 540 text_t text; 512 541 513 542 text_t ft; 514 543 while (formatlistptr != NULL) { 515 ft += format_string (docinfo, formatlistptr, link, icon );544 ft += format_string (docinfo, formatlistptr, link, icon, text); 516 545 formatlistptr = formatlistptr->nextptr; 517 546 } … … 520 549 521 550 522 523 551 text_t get_formatted_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 552 const text_t &text) { 553 554 text_t link = "<a href=\"_httpdocument_&cl=search&d=" + docinfo.OID + "\">"; 555 text_t icon = "_icontext_"; 556 557 text_t ft; 558 while (formatlistptr != NULL) { 559 ft += format_string (docinfo, formatlistptr, link, icon, text); 560 formatlistptr = formatlistptr->nextptr; 561 } 562 return ft; 563 } 564 565 566 text_t get_formatted_string (const ResultDocInfo_t &docinfo, format_t *formatlistptr, 567 const text_t &link, const text_t &icon, const text_t &text) { 568 569 text_t ft; 570 while (formatlistptr != NULL) { 571 ft += format_string (docinfo, formatlistptr, link, icon, text); 572 formatlistptr = formatlistptr->nextptr; 573 } 574 return ft; 575 } 576 577 578
Note:
See TracChangeset
for help on using the changeset viewer.