Changeset 2805 for trunk/gsdl/src/recpt/browsetools.cpp
- Timestamp:
- 2001-10-26T18:39:42+13:00 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r2664 r2805 534 534 textout, logout); 535 535 } 536 537 536 delete formatlistptr; 537 } 538 539 /** 540 * This function outputs contents of a classifier to the reader 541 * including parent levels 542 */ 543 void expand_show_contents (cgiargsclass &args, int tabcount, bool fulltoc, 544 browsermapclass *browsermap, formatinfo_t &formatinfo, 545 recptproto *collectproto, displayclass &disp, 546 outconvertclass &outconvert, ostream &textout, 547 ostream &logout) 548 { 549 550 int coloffset = 0; 551 text_tarray parents; 552 FilterResponse_t response; 553 text_t OID = args["d"]; 554 if (OID.empty()) OID = args["cl"]; 555 556 bool haschildren = has_children (OID, args["c"], collectproto, logout); 557 558 // get parents list 559 if (!is_top(OID)) get_parents_array (OID, parents); 560 if (args["d"].empty() || haschildren || parents.empty()) 561 parents.push_back(OID); 562 563 // if inside a book top title is needed 564 if (!args["d"].empty()) { 565 566 coloffset = 1; 567 text_t classification, classifytype, formatstring, topOID = parents[0]; 568 text_tset metadata; 569 format_t *formatlistptr = new format_t(); 570 bool use_table, getParents = false; 571 572 get_top (args["cl"], classification); 573 574 // getting information about top OID 575 metadata.insert ("thistype"); 576 577 get_info ( topOID, args["c"], metadata, getParents, collectproto, response, logout); 578 if (!response.docInfo[0].metadata["thistype"].values.empty()) 579 classifytype = response.docInfo[0].metadata["thistype"].values[0]; 580 581 browserclass *bptr = browsermap->getbrowser (classifytype); 582 583 if (classifytype.empty()) { 584 bptr = browsermap->get_default_browser(); 585 } 586 587 // get the formatstring if there is one or use the browsers default 588 if (!get_formatstring (classification, classifytype, 589 formatinfo.formatstrings, formatstring)) 590 formatstring = bptr->get_default_formatstring(); 591 592 parse_formatstring (formatstring, formatlistptr, metadata, getParents); 593 594 metadata.insert ("doctype"); 595 metadata.insert ("haschildren"); 596 597 get_info (topOID, args["c"], metadata, getParents, collectproto, response, logout); 598 599 // ouput top OID section 600 use_table = is_table_content (formatlistptr); 601 bptr->output_section_group (response.docInfo[0], args, "", tabcount, formatlistptr, use_table, 602 metadata, getParents, collectproto, disp, outconvert, textout, logout); 603 604 } 605 606 recurse_contents_levels (parents, args, coloffset, tabcount, fulltoc, browsermap, 607 formatinfo, collectproto, disp, outconvert, textout, logout); 608 609 textout << "</table></td></tr></table>\n"; 610 } 611 612 void recurse_contents_levels (text_tarray &parents, 613 cgiargsclass &args, int coloffset, int tabcount, bool fulltoc, 614 browsermapclass *browsermap, formatinfo_t &formatinfo, 615 recptproto *collectproto, displayclass &disp, 616 outconvertclass &outconvert, ostream &textout, 617 ostream &logout) 618 { 619 FilterResponse_t response; 620 text_tset metadata; 621 text_t OID, formatstring, classification, classifytype;; 622 bool use_table, getParents = false; 623 int haschildren = 0; 624 format_t *formatlistptr = new format_t(); 625 626 // display children for last level 627 if (tabcount == (parents.size() - 1)) { 628 629 logout << "@@@lastlevel@@@\n"; 630 // setting metadata fields 631 metadata.insert ("thistype"); 632 metadata.insert ("childtype"); 633 metadata.insert ("haschildren"); 634 635 OID = parents[tabcount]; 636 get_info (OID, args["c"], metadata, getParents, collectproto, response, logout); 637 get_top (OID, classification); 638 639 if (!response.docInfo.empty()) 640 haschildren = response.docInfo[0].metadata["haschildren"].values[0].getint(); 641 642 // get childrens classifytype 643 if (!response.docInfo.empty()) 644 classifytype = response.docInfo[0].metadata["childtype"].values[0]; 645 else { 646 // use the default 647 browserclass *bptr = browsermap->get_default_browser (); 648 classifytype = bptr->get_browser_name (); 649 } 650 651 // load up metadata array with browser defaults 652 browserclass *bptr = browsermap->getbrowser (classifytype); 653 bptr->load_metadata_defaults (metadata); 654 655 // get the formatstring if there is one or use the browsers default 656 if (!get_formatstring (classification, classifytype, 657 formatinfo.formatstrings, formatstring)) 658 formatstring = bptr->get_default_formatstring(); 659 660 parse_formatstring (formatstring, formatlistptr, metadata, getParents); 661 662 if (haschildren) 663 get_children (OID, args["c"], metadata, getParents, 664 collectproto, response, logout); 665 else if (!is_top(OID)) { 666 get_children (OID + ".pr", args["c"], metadata, getParents, 667 collectproto, response, logout); 668 haschildren = true; 669 } 670 671 // display children 672 if (haschildren) { 673 use_table = is_table_content (formatlistptr); 674 bptr->output_section_group (response, args, args["c"], coloffset + tabcount, formatlistptr, use_table, 675 metadata, getParents, collectproto, disp, outconvert, 676 textout, logout); 677 } 678 679 } else { 680 681 text_t pOID; 682 OID = parents[tabcount]; 683 get_top (OID, classification); 684 685 // load metadata fields 686 metadata.insert ("thistype"); 687 metadata.insert ("childtype"); 688 metadata.insert ("haschildren"); 689 metadata.insert ("doctype"); 690 691 if (tabcount) pOID = parents[tabcount-1]; 692 else pOID = OID; 693 get_info (pOID, args["c"], metadata, getParents, collectproto, response, logout); 694 695 // get classifytype of this level 696 if (is_top (pOID)) classifytype = response.docInfo[0].metadata["childtype"].values[0]; 697 else classifytype = response.docInfo[0].metadata["thistype"].values[0]; 698 699 // if we still don't have a classifytype we'll use the default 700 if (classifytype.empty()) { 701 browserclass *bptr = browsermap->get_default_browser (); 702 classifytype = bptr->get_browser_name (); 703 } 704 705 browserclass *bptr = browsermap->getbrowser (classifytype); 706 707 // get the formatstring if there is one or use the browsers default 708 if (!get_formatstring (classification, classifytype, 709 formatinfo.formatstrings, formatstring)) 710 formatstring = bptr->get_default_formatstring(); 711 712 713 // parse format string 714 parse_formatstring (formatstring, formatlistptr, metadata, getParents); 715 716 use_table = is_table_content (formatlistptr); 717 718 get_children (OID, args["c"], metadata, getParents, collectproto, response, logout); 719 720 ResultDocInfo_tarray::iterator thissibling = response.docInfo.begin(); 721 ResultDocInfo_tarray::iterator lastsibling = response.docInfo.end(); 722 723 while (thissibling != lastsibling) { 724 725 logout << "@@@level:@@@" << tabcount << "\n"; 726 727 bptr->output_section_group (*thissibling, args, args["c"], coloffset + tabcount, formatlistptr, 728 use_table, metadata, getParents, collectproto, 729 disp, outconvert, textout, logout); 730 731 if ((*thissibling).OID == parents[tabcount+1]) { 732 recurse_contents_levels (parents, args, coloffset, tabcount+1, fulltoc, browsermap, 733 formatinfo, collectproto, disp, outconvert,textout, logout); 734 } 735 736 thissibling ++; 737 } 738 } 739 delete formatlistptr; 538 740 } 539 741 … … 585 787 expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo, 586 788 collectproto, disp, outconvert, textout, logout); 587 } else { 789 } else if (args.getintarg("gc") == 2) { 790 791 // expand visible levels of table of contents 792 expand_show_contents(args, tabcount, fulltoc, browsermap, formatinfo, 793 collectproto, disp, outconvert, textout, logout); 794 } else { 588 795 589 796 // contracted table of contents … … 604 811 } 605 812 606
Note:
See TracChangeset
for help on using the changeset viewer.