Changeset 412 for trunk/gsdl/src/recpt
- Timestamp:
- 1999-07-21T17:01:56+12:00 (25 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/browsetools.cpp
r404 r412 12 12 /* 13 13 $Log$ 14 Revision 1.15 1999/07/21 05:01:56 sjboddie 15 wrote handler for DateList classification 16 14 17 Revision 1.14 1999/07/20 02:58:15 sjboddie 15 18 got List and AZList classifications using format strings - tidied … … 775 778 icon = "_document:iconclosedbookshelf_"; 776 779 link += (*sechere).OID + "\">"; 777 } else { 778 link += arg_cl + "&d=" + (*sechere).OID + "\">"; 779 } 780 } else link += arg_cl + "&d=" + (*sechere).OID + "\">"; 781 780 782 if (intable) textout << "<tr>\n"; 781 783 … … 798 800 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ 799 801 800 void datelist_toc (const text_t &/*classifytype*/, const text_t &/*classifytitle*/, 801 const text_t &/*formatstring*/, cgiargsclass &/*args*/, recptproto */*collectproto*/, 802 displayclass &/*disp*/, outconvertclass &/*outconvert*/, 803 ostream &/*textout*/, ostream &/*logout*/) { 804 } 802 // prototypes 803 804 static void output_datelist (text_t &formatstring, cgiargsclass &args, 805 recptproto *collectproto, displayclass &disp, 806 outconvertclass &outconvert, ostream &textout, 807 ostream &logout); 808 809 810 811 void datelist_toc (const text_t &/*classifytype*/, text_t &formatstring, 812 cgiargsclass &args, recptproto *collectproto, 813 displayclass &disp, outconvertclass &outconvert, 814 ostream &textout, ostream &logout) { 815 816 textout 817 << "\n<!-- Table of Contents produced by browsetools::datelist_toc -->\n\n" 818 << "<table cellspacing=10>\n"; 819 820 output_datelist (formatstring, args, collectproto, 821 disp, outconvert, textout, logout); 822 823 textout << "</table>\n" 824 << "<!-- end of Table of Contents -->\n"; 825 } 826 827 void output_datelist (text_t &formatstring, cgiargsclass &args, 828 recptproto *collectproto, displayclass &disp, 829 outconvertclass &outconvert, ostream &textout, 830 ostream &logout) { 831 832 text_tarray metadata; 833 bool getParents = false; 834 FilterResponse_t response; 835 836 text_t &arg_cl = args["cl"]; 837 838 // if format string is empty use the default 839 if (formatstring.empty()) 840 formatstring = "<td valign=top nowrap>[link][icon][/link]</td><td>{Or}{[Title],Untitled}</td>"; 841 842 bool intable = is_table_content (formatstring); 843 844 format_t *formatlistptr = new format_t(); 845 parse_formatstring (formatstring, formatlistptr, metadata, getParents); 846 metadata.push_back ("doctype"); // need this to decide which icon to use 847 metadata.push_back ("Date"); 848 849 if (get_children (arg_cl, args["c"], metadata, getParents, 850 collectproto, response, logout)) { 851 852 ResultDocInfo_tarray::const_iterator sechere = response.docInfo.begin(); 853 ResultDocInfo_tarray::const_iterator secend = response.docInfo.end(); 854 855 text_t lastyear = "0000"; 856 text_t lastmonth = "00"; 857 858 while (sechere != secend) { 859 860 // grab date and doctype off end of metadata 861 const MetadataInfo_t &metadate = *(sechere->metadata.end()-1); 862 const text_t &date = metadate.values.back(); 863 const MetadataInfo_t &metadoctype = *(sechere->metadata.end()-2); 864 const text_t &doctype = metadoctype.values.back(); 865 866 // bail on this document if it has no date 867 if (date.empty()) continue; 868 869 text_t::const_iterator datebegin = date.begin(); 870 871 text_t link = "<a href=\"_httpdocument_&cl="; 872 text_t icon = "_document:iconclosedbook_"; 873 874 if (doctype == "classify") { 875 icon = "_document:iconclosedbookshelf_"; 876 link += (*sechere).OID + "\">"; 877 } else link += arg_cl + "&d=" + (*sechere).OID + "\">"; 878 879 text_t thisyear = substr (datebegin, datebegin+4); 880 text_t thismonth = substr (datebegin+4, datebegin+6); 881 882 textout << "<tr>\n"; 883 884 if (thisyear != lastyear) { 885 textout << outconvert << "<td><b>" << thisyear << "</b></td>"; 886 lastyear = thisyear; 887 } else 888 textout << "<td></td>"; 889 890 if (thismonth != lastmonth) { 891 textout << outconvert << disp << ("<td><b>_textmonth" + thismonth + "_</b></td>"); 892 lastmonth = thismonth; 893 } else 894 textout << "<td></td>"; 895 896 if (!intable) textout << "<td>\n"; 897 898 textout << outconvert << disp 899 << get_formatted_string (*sechere, formatlistptr, link, icon) << "\n"; 900 901 if (!intable) textout << "</td>"; 902 903 textout << "</tr>\n"; 904 905 sechere ++; 906 } 907 } 908 } 909 910 805 911 806 912 -
trunk/gsdl/src/recpt/browsetools.h
r404 r412 42 42 ostream &textout, ostream &logout); 43 43 44 void datelist_toc (const text_t &classifytype, const text_t &classifytitle,45 c onst text_t &formatstring, cgiargsclass &args, recptproto *collectproto,44 void datelist_toc (const text_t &classifytype, text_t &formatstring, 45 cgiargsclass &args, recptproto *collectproto, 46 46 displayclass &disp, outconvertclass &outconvert, 47 47 ostream &textout, ostream &logout);
Note:
See TracChangeset
for help on using the changeset viewer.