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 1932 2001-02-08 02:40:23Z None $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*
|
---|
29 | $Log$
|
---|
30 | Revision 1.3 2000/09/08 03:17:08 nzdl
|
---|
31 | updated niupepa collection
|
---|
32 |
|
---|
33 | Revision 1.2 2000/03/22 02:00:13 nzdl
|
---|
34 | updated niupepa collection
|
---|
35 |
|
---|
36 | Revision 1.1.1.1 2000/03/08 20:44:50 sjboddie
|
---|
37 | added niupepa to CVS
|
---|
38 |
|
---|
39 |
|
---|
40 | */
|
---|
41 |
|
---|
42 |
|
---|
43 | #include "niupepahlistbrowserclass.h"
|
---|
44 | #include <assert.h>
|
---|
45 | #include "OIDtools.h"
|
---|
46 |
|
---|
47 | niupepahlistbrowserclass::niupepahlistbrowserclass () {
|
---|
48 | }
|
---|
49 |
|
---|
50 | niupepahlistbrowserclass::~niupepahlistbrowserclass () {
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | // overridden for niupepa so CL2 (date classification) wraps in the correct place
|
---|
55 | // should probably do this in a more general way some time
|
---|
56 | int niupepahlistbrowserclass::output_section_group (ResultDocInfo_t §ion, cgiargsclass &args,
|
---|
57 | const text_t &collection, int colnumber,
|
---|
58 | format_t *formatlistptr, bool use_table,
|
---|
59 | text_tset &metadata, bool &getParents,
|
---|
60 | recptproto *collectproto, displayclass &disp,
|
---|
61 | outconvertclass &outconvert, ostream &textout,
|
---|
62 | ostream &logout) {
|
---|
63 |
|
---|
64 | // expanded contents are going to cause some nasty recursions
|
---|
65 | // so we'll only continue if being passed the current section
|
---|
66 | if ((args["gc"] == 1) && (section.OID != args["d"])) return 0;
|
---|
67 |
|
---|
68 | // get all siblings
|
---|
69 | FilterResponse_t response;
|
---|
70 | text_t &arg_cl = args["cl"];
|
---|
71 | get_children (section.OID + ".pr", args["c"], metadata, getParents,
|
---|
72 | collectproto, response, logout);
|
---|
73 |
|
---|
74 |
|
---|
75 | if (use_table || colnumber > 0) {
|
---|
76 | textout << "<table><tr><td>";
|
---|
77 | // get tab size
|
---|
78 | text_t tab; int itab;
|
---|
79 | disp.expandstring ("Global", "_tabwidth_", tab);
|
---|
80 | itab = tab.getint();
|
---|
81 | if (colnumber > 0) textout << outconvert << disp
|
---|
82 | << "<img src=\"_httpimg_/space.gif\" width="
|
---|
83 | << (itab*colnumber) << ">";
|
---|
84 | textout << "</td>\n";
|
---|
85 | }
|
---|
86 |
|
---|
87 | textout << "<center><table cellspacing=0><tr>\n";
|
---|
88 |
|
---|
89 | ResultDocInfo_tarray::iterator tsibling = response.docInfo.begin();
|
---|
90 | ResultDocInfo_tarray::iterator esibling = response.docInfo.end();
|
---|
91 |
|
---|
92 | text_t icon, link;
|
---|
93 | int scount = 1;
|
---|
94 | while (tsibling != esibling) {
|
---|
95 |
|
---|
96 | bool highlight = false;
|
---|
97 | textout << "<td";
|
---|
98 | if (!((scount >= 3 && scount <= 8) || (scount >= 10 && scount <= 18) ||
|
---|
99 | (scount >= 22 && scount <= 26) || (scount >= 28 && scount <= 29))) {
|
---|
100 | // xxxx-xxxx year ranges require colspan=2
|
---|
101 | textout << " colspan=2";
|
---|
102 | }
|
---|
103 | textout << ">";
|
---|
104 |
|
---|
105 | text_t &doctype = (*tsibling).metadata["doctype"].values[0];
|
---|
106 |
|
---|
107 | if ((*tsibling).OID == section.OID) {
|
---|
108 | link.clear();
|
---|
109 | highlight = true;
|
---|
110 | } else {
|
---|
111 | link = "<a href=\"_httpdocument_";
|
---|
112 | if (doctype == "classify")
|
---|
113 | link += "&cl=" + (*tsibling).OID + "\">";
|
---|
114 | else
|
---|
115 | link += "&cl=" + arg_cl + "&d=" + (*tsibling).OID + "\">";
|
---|
116 | }
|
---|
117 |
|
---|
118 | textout << outconvert << disp
|
---|
119 | << get_formatted_string (collection, collectproto, *tsibling, formatlistptr,
|
---|
120 | link, icon, highlight, logout);
|
---|
121 |
|
---|
122 | textout << "</td>\n";
|
---|
123 | // if (scount == 10 || scount == 18)
|
---|
124 | if (scount == 12 || scount == 24 || scount == 34)
|
---|
125 | textout << "</tr><tr>\n";
|
---|
126 |
|
---|
127 | tsibling ++;
|
---|
128 | scount ++;
|
---|
129 | }
|
---|
130 |
|
---|
131 | textout << "<td colspan=2></td></tr></table></center>\n";
|
---|
132 | if (use_table || colnumber > 0) textout << "</tr></table>\n";
|
---|
133 | return 0;
|
---|
134 | }
|
---|
135 |
|
---|