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