source: trunk/niupepa/src/recpt/niupepahlistbrowserclass.cpp@ 5800

Last change on this file since 5800 was 1945, checked in by nzdl, 23 years ago

updated niupepa collection

  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/**********************************************************************
2 *
3 * niupepahlistbrowserclass.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: niupepahlistbrowserclass.cpp 1945 2001-02-11 22:55:37Z nzdl $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
30 Revision 1.4 2001/02/11 22:55:37 nzdl
31 updated niupepa collection
32
33 Revision 1.3 2000/09/08 03:17:08 nzdl
34 updated niupepa collection
35
36 Revision 1.2 2000/03/22 02:00:13 nzdl
37 updated niupepa collection
38
39 Revision 1.1.1.1 2000/03/08 20:44:50 sjboddie
40 added niupepa to CVS
41
42
43 */
44
45
46#include "niupepahlistbrowserclass.h"
47#include <assert.h>
48#include "OIDtools.h"
49
50niupepahlistbrowserclass::niupepahlistbrowserclass () {
51}
52
53niupepahlistbrowserclass::~niupepahlistbrowserclass () {
54}
55
56
57// overridden for niupepa so CL2 (date classification) wraps in the correct place
58// should probably do this in a more general way some time
59int niupepahlistbrowserclass::output_section_group (ResultDocInfo_t &section, cgiargsclass &args,
60 const text_t &collection, int colnumber,
61 format_t *formatlistptr, bool use_table,
62 text_tset &metadata, bool &getParents,
63 recptproto *collectproto, displayclass &disp,
64 outconvertclass &outconvert, ostream &textout,
65 ostream &logout) {
66
67 // expanded contents are going to cause some nasty recursions
68 // so we'll only continue if being passed the current section
69 if ((args["gc"] == 1) && (section.OID != args["d"])) return 0;
70
71 // get all siblings
72 FilterResponse_t response;
73 text_t &arg_cl = args["cl"];
74 get_children (section.OID + ".pr", args["c"], metadata, getParents,
75 collectproto, response, logout);
76
77
78 if (use_table || colnumber > 0) {
79 textout << "<table><tr><td>";
80 // get tab size
81 text_t tab; int itab;
82 disp.expandstring ("Global", "_tabwidth_", tab);
83 itab = tab.getint();
84 if (colnumber > 0) textout << outconvert << disp
85 << "<img src=\"_httpimg_/space.gif\" width="
86 << (itab*colnumber) << ">";
87 textout << "</td>\n";
88 }
89
90 textout << "<center><table cellspacing=0><tr>\n";
91
92 ResultDocInfo_tarray::iterator tsibling = response.docInfo.begin();
93 ResultDocInfo_tarray::iterator esibling = response.docInfo.end();
94
95 text_t icon, link;
96 int scount = 1;
97 while (tsibling != esibling) {
98
99 bool highlight = false;
100 textout << "<td";
101 // if (!((scount >= 3 && scount <= 8) || (scount >= 10 && scount <= 18) ||
102 // (scount >= 22 && scount <= 26) || (scount >= 28 && scount <= 29))) {
103 if (scount == 1 || scount == 2 || scount == 9 || scount == 19 || scount == 20 || scount == 21 ||
104 scount == 29 || scount == 30 || scount == 32 || scount == 33 || scount == 34 || scount == 37 ||
105 scount == 47 || scount == 48 || scount == 52 || scount == 53 || scount == 54 || scount == 55 ||
106 scount == 56 || scount == 57 || scount == 58 || scount == 59 || scount == 60) {
107
108 // xxxx-xxxx year ranges require colspan=2
109 textout << " colspan=2";
110 }
111 textout << ">";
112
113 text_t &doctype = (*tsibling).metadata["doctype"].values[0];
114
115 if ((*tsibling).OID == section.OID) {
116 link.clear();
117 highlight = true;
118 } else {
119 link = "<a href=\"_httpdocument_";
120 if (doctype == "classify")
121 link += "&cl=" + (*tsibling).OID + "\">";
122 else
123 link += "&cl=" + arg_cl + "&d=" + (*tsibling).OID + "\">";
124 }
125
126 textout << outconvert << disp
127 << get_formatted_string (collection, collectproto, *tsibling, disp,
128 formatlistptr, link, icon, highlight, logout);
129
130 textout << "</td>\n";
131 if (scount == 12 || scount == 24 || scount == 34 || scount == 47 || scount == 56)
132 textout << "</tr><tr>\n";
133
134 tsibling ++;
135 scount ++;
136 }
137
138 textout << "<td colspan=2></td></tr></table></center>\n";
139 if (use_table || colnumber > 0) textout << "</tr></table>\n";
140 return 0;
141}
142
Note: See TracBrowser for help on using the repository browser.