Changeset 624
- Timestamp:
- 1999-09-23T22:09:17+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r541 r624 28 28 /* 29 29 $Log$ 30 Revision 1.23 1999/09/23 10:09:17 sjboddie 31 made some changes so AZLists within other classifications are 32 handled properly 33 30 34 Revision 1.22 1999/09/07 23:06:58 rjmcnab 31 35 removed some compiler warnings. … … 331 335 332 336 static void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents, 333 int &tabcount, displayclass &disp, 337 int &tabcount, displayclass &disp, recptproto *collectproto, 334 338 format_t *formatlistptr, outconvertclass &outconvert, 335 339 ostream &textout, ostream &logout); … … 345 349 displayclass &disp, format_t *formatlistptr, 346 350 outconvertclass &outconvert, ostream &textout); 351 352 static void output_azlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here, 353 ResultDocInfo_tarray::const_iterator &end, bool intable, 354 displayclass &disp, format_t *formatlistptr, 355 outconvertclass &outconvert, ostream &textout); 347 356 348 357 static void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here, … … 404 413 text_t &arg_d = args["d"]; 405 414 text_t OID = arg_d; 406 if (OID.empty()) OID = args["cl"]; 415 if (OID.empty()) { 416 // if classifytype is an AZList we need to jump to 417 // the first child 418 if (classifytype == "AZList") OID = args["cl"] + ".fc"; 419 else OID = args["cl"]; 420 } 421 407 422 text_t &collection = args["c"]; 408 423 … … 430 445 if (!get_children (OID + ".pr", collection, metadata, 431 446 getParents, collectproto, fsiblings, logout)) 432 447 return; 433 448 } 434 449 if (!get_info (parents, collection, metadata, false, collectproto, fparents, logout)) return; 435 450 436 451 if (!fparents.docInfo.empty()) 437 output_parents_toc(args, fparents, tabcount, disp, 452 output_parents_toc(args, fparents, tabcount, disp, collectproto, 438 453 formatlistptr, outconvert, textout, logout); 439 454 … … 444 459 445 460 void output_parents_toc (cgiargsclass &args, const FilterResponse_t &parents, 446 int &tabcount, displayclass &disp, 461 int &tabcount, displayclass &disp, recptproto *collectproto, 447 462 format_t *formatlistptr, outconvertclass &outconvert, 448 ostream &textout, ostream & /*logout*/) {463 ostream &textout, ostream &logout) { 449 464 450 465 text_t tab, icon; … … 459 474 460 475 int len = (*thisparent).metadata.size(); 461 const text_t &classifytype = (*thisparent).metadata[len-1].values[0];476 // const text_t &classifytype = (*thisparent).metadata[len-1].values[0]; 462 477 463 478 // don't want top level of any classifications to be displayed … … 465 480 466 481 // don't want second level of classifications using classification links 467 if ((classifytype == "AZList" || classifytype == "DateList") && (thisparent != end))468 {thisparent ++; numcols --;}482 // if ((classifytype == "AZList" || classifytype == "DateList") && (thisparent != end)) 483 // {thisparent ++; numcols --;} 469 484 470 485 // the tab line … … 475 490 } 476 491 492 bool first = true; 477 493 while (thisparent != end) { 478 494 495 text_t link; 496 bool azlist = false; 497 // set azlist if we're in an AZList section (i.e. immediate parent 498 // has classifytype of AZList 499 if (!first && (*(thisparent-1)).metadata[len-1].values[0] == "AZList") 500 azlist = true; 501 479 502 const text_t &doctype = (*thisparent).metadata[len-2].values.back(); 480 481 // set up icon and pointer 482 icon = "_document:icon"; 483 if ((doctype != "classify") && ((*thisparent).OID == arg_d)) 484 icon += "arrow"; 485 if (doctype == "classify") icon += "openbookshelf_"; 486 else if (is_top((*thisparent).OID)) icon += "openbook_"; 487 else icon += "openfolder_"; 488 503 bool thissection = false; 504 505 if (!azlist) { 506 // set up icon and pointer 507 icon = "_document:icon"; 508 if ((doctype != "classify") && ((*thisparent).OID == arg_d)) 509 icon += "arrow"; 510 if (doctype == "classify") icon += "openbookshelf_"; 511 else if (is_top((*thisparent).OID)) icon += "openbook_"; 512 else icon += "openfolder_"; 513 514 // set up the link 515 link = "<a href=\"_httpdocument_"; 516 if (is_top((*thisparent).OID) && args.getintarg("x")) link = "<a name=top>"; 517 else 518 if (doctype == "classify") link += "&cl=" + (*thisparent).OID + ".pr\">"; 519 else 520 if (is_top ((*thisparent).OID)) 521 if (arg_cl.empty()) 522 link = "<a name=top>"; 523 else if (arg_cl == "search") 524 link = "<a href=\"_httpquery_\">"; 525 else 526 link += "&cl=" + arg_cl + "\">"; 527 else link += "&cl=" + arg_cl + "&d=" + (*thisparent).OID + ".pr\">"; 528 } 529 489 530 if (tabcount == 1) textout << "<td></td>\n"; 490 531 else if (tabcount > 1) textout << "<td colspan=" << tabcount << "></td>"; 491 492 // set up the link 493 text_t link = "<a href=\"_httpdocument_"; 494 if (is_top((*thisparent).OID) && args.getintarg("x")) link = "<a name=top>"; 495 else 496 if (doctype == "classify") link += "&cl=" + (*thisparent).OID + ".pr\">"; 497 else 498 if (is_top ((*thisparent).OID)) 499 if (arg_cl.empty()) 500 link = "<a name=top>"; 501 else if (arg_cl == "search") 502 link = "<a href=\"_httpquery_\">"; 503 else 504 link += "&cl=" + arg_cl + "\">"; 505 else link += "&cl=" + arg_cl + "&d=" + (*thisparent).OID + ".pr\">"; 506 532 507 533 if ((numcols-tabcount) == 1) textout << "<td>"; 508 534 else if ((numcols-tabcount) > 1) textout << "<td colspan=" … … 510 536 511 537 if (intable) textout << "<table><tr>"; 512 513 textout << outconvert << disp 514 << get_formatted_string (*thisparent, formatlistptr, link, icon); 538 539 if (azlist) { 540 FilterResponse_t response; 541 // AZLists rely on Title metadata 542 text_tarray metadata; 543 metadata.push_back ("Title"); 544 545 // need to get siblings of this classification 546 if (get_children ((*(thisparent-1)).OID, args["c"], metadata, false, 547 collectproto, response, logout)) { 548 549 ResultDocInfo_tarray::const_iterator thissib = response.docInfo.begin(); 550 ResultDocInfo_tarray::const_iterator endsib = response.docInfo.end(); 551 552 while (thissib != endsib) { 553 link = "<a href=\"_httpdocument_&cl=" + (*thissib).OID + "\">"; 554 const text_t &title = (*thissib).metadata[0].values.back(); 555 if ((*thissib).OID == (*thisparent).OID) 556 textout << outconvert << disp << "<b>" << title << "</b>\n"; 557 else textout << outconvert << disp << link << title << "</a>\n"; 558 thissib ++; 559 } 560 } 561 } else { 562 textout << outconvert << disp 563 << get_formatted_string (*thisparent, formatlistptr, link, icon); 564 } 515 565 516 566 if (intable) textout << "</tr></table>"; 517 567 textout << "</td></tr>\n"; 518 568 569 first = false; 519 570 tabcount ++; 520 571 thisparent ++; … … 606 657 } 607 658 659 660 void output_azlist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here, 661 ResultDocInfo_tarray::const_iterator &end, bool intable, 662 displayclass &disp, format_t *formatlistptr, 663 outconvertclass &outconvert, ostream &textout) { 664 665 int count = 1; 666 int gt = args.getintarg("gt"); 667 text_t &arg_cl = args["cl"]; 668 text_t &arg_d = args["d"]; 669 text_t link; 670 671 if (intable) textout << "<tr><td>"; 672 673 while (here != end) { 674 675 bool thissec = false; 676 int len = (*here).metadata.size(); 677 const text_t &doctype = (*here).metadata[len-2].values.back(); 678 const text_t &hastxt = (*here).metadata[len-4].values.back(); 679 // AZLists are assumed to use Title metadata 680 const text_t &title = (*here).metadata[len-6].values.back(); 681 682 // bail on this document if it has no title 683 if (title.empty()) continue; 684 685 if (doctype == "classify") { 686 if ((*here).OID == arg_cl) thissec = true; 687 } else if ((*here).OID == arg_d) thissec = true; 688 689 // set up link 690 if (!thissec) { 691 link = "<a href=\"_httpdocument_"; 692 if (doctype == "classify") link += "&cl=" + (*here).OID + "\">"; 693 else link += "&cl=" + arg_cl + "&d=" + (*here).OID + "\">"; 694 if (gt) { 695 link = "<a href=\"#" + text_t(count) + "\">"; 696 count ++; 697 } 698 } 699 700 if (thissec) 701 textout << outconvert << disp << "<b>" << title << "</b>\n"; 702 else 703 textout << outconvert << disp << link << title << "</a>\n"; 704 705 here ++; 706 } 707 708 if (intable) textout << "</td></tr>"; 709 } 608 710 609 711 void output_datelist (cgiargsclass &args, ResultDocInfo_tarray::const_iterator &here,
Note:
See TracChangeset
for help on using the changeset viewer.