1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * statusaction.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: statusaction.cpp 1253 2000-06-29 00:22:59Z sjboddie $
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 | /*
|
---|
29 | $Log$
|
---|
30 | Revision 1.28 2000/06/29 00:22:59 sjboddie
|
---|
31 | added new numsections field to collection info and made the statusaction
|
---|
32 | recognize it
|
---|
33 |
|
---|
34 | Revision 1.27 2000/05/12 03:09:24 sjboddie
|
---|
35 | minor modifications to get web library compiling under VC++ 6.0
|
---|
36 |
|
---|
37 | Revision 1.26 2000/04/19 22:30:23 sjboddie
|
---|
38 | tidied up status pages and end-user collection building
|
---|
39 |
|
---|
40 | Revision 1.25 2000/02/29 21:00:31 sjboddie
|
---|
41 | fixed some compiler warnings
|
---|
42 |
|
---|
43 | Revision 1.24 1999/12/06 01:13:02 sjboddie
|
---|
44 | macrofiles is now a set to allow for multiple gsdlhomes
|
---|
45 |
|
---|
46 | Revision 1.23 1999/11/09 02:26:20 sjboddie
|
---|
47 | added some new(ish) options
|
---|
48 |
|
---|
49 | Revision 1.22 1999/11/01 21:55:27 sjboddie
|
---|
50 | changes to arguments of many functions
|
---|
51 |
|
---|
52 | Revision 1.21 1999/10/19 03:23:46 davidb
|
---|
53 | Collection building support through web pages
|
---|
54 | and internal and external link handling for collection documents
|
---|
55 |
|
---|
56 | Revision 1.20 1999/10/18 20:10:41 sjboddie
|
---|
57 | don't want to use authentication to reach status page (usersaction still
|
---|
58 | uses authentication)
|
---|
59 |
|
---|
60 | Revision 1.19 1999/09/07 23:09:40 rjmcnab
|
---|
61 | removed some compiler warnings
|
---|
62 |
|
---|
63 | Revision 1.18 1999/09/07 04:57:00 sjboddie
|
---|
64 | added GPL notice
|
---|
65 |
|
---|
66 | Revision 1.17 1999/09/03 09:53:46 rjmcnab
|
---|
67 | Output more configuration options for the receptionist.
|
---|
68 |
|
---|
69 | Revision 1.16 1999/09/02 00:28:42 rjmcnab
|
---|
70 | removed dependancy on GSDL_GSDLHOME
|
---|
71 |
|
---|
72 | Revision 1.15 1999/07/30 02:24:42 sjboddie
|
---|
73 | added collectinfo argument to some functions
|
---|
74 |
|
---|
75 | Revision 1.14 1999/07/13 23:26:07 rjmcnab
|
---|
76 | Added support for authenaction and usersaction
|
---|
77 |
|
---|
78 | Revision 1.13 1999/06/08 04:29:39 sjboddie
|
---|
79 | added argsinfo to the call to check_cgiargs to make it easy to set
|
---|
80 | args to their default if they're found to be screwed up
|
---|
81 |
|
---|
82 | Revision 1.12 1999/04/06 22:20:35 rjmcnab
|
---|
83 | Got browsefilter working.
|
---|
84 |
|
---|
85 | Revision 1.11 1999/03/31 23:44:49 rjmcnab
|
---|
86 | Altered the protocol so that the metadata is part of the filter.
|
---|
87 |
|
---|
88 | Revision 1.10 1999/03/16 04:47:03 rjmcnab
|
---|
89 | Changed the list of arguments on the argument page to be the info list
|
---|
90 | not the current args list (there are some arguments which don't have
|
---|
91 | a default so they never make it onto the args list).
|
---|
92 |
|
---|
93 | Revision 1.9 1999/03/11 01:26:02 rjmcnab
|
---|
94 | Fixed a few small formatting things.
|
---|
95 |
|
---|
96 | Revision 1.8 1999/03/11 00:12:30 rjmcnab
|
---|
97 | Started using status.dm to handle the bulky text. Made the status
|
---|
98 | action use frames and added some more information.
|
---|
99 |
|
---|
100 | Revision 1.7 1999/03/09 21:00:47 rjmcnab
|
---|
101 | Reorganised the statusaction, added more functions to comtypes.
|
---|
102 |
|
---|
103 | Revision 1.6 1999/02/25 21:59:02 rjmcnab
|
---|
104 |
|
---|
105 | Merged sources.
|
---|
106 |
|
---|
107 | Revision 1.5 1999/02/21 22:33:58 rjmcnab
|
---|
108 |
|
---|
109 | Lots of stuff :-)
|
---|
110 |
|
---|
111 | Revision 1.4 1999/02/12 02:40:18 sjboddie
|
---|
112 |
|
---|
113 | Added page action
|
---|
114 |
|
---|
115 | Revision 1.3 1999/02/11 23:07:00 sjboddie
|
---|
116 |
|
---|
117 | extended the status action
|
---|
118 |
|
---|
119 | Revision 1.2 1999/02/11 01:24:06 rjmcnab
|
---|
120 |
|
---|
121 | Fixed a few compiler warnings.
|
---|
122 |
|
---|
123 | Revision 1.1 1999/02/11 01:01:27 rjmcnab
|
---|
124 |
|
---|
125 | Initial revision.
|
---|
126 |
|
---|
127 | */
|
---|
128 |
|
---|
129 |
|
---|
130 | #include "statusaction.h"
|
---|
131 | #include "fileutil.h"
|
---|
132 | #include "htmlutils.h"
|
---|
133 | #include <assert.h>
|
---|
134 |
|
---|
135 |
|
---|
136 | void statusaction::output_frameset (cgiargsclass &/*args*/, displayclass &disp,
|
---|
137 | outconvertclass &outconvert,
|
---|
138 | ostream &textout, ostream &/*logout*/) {
|
---|
139 | textout << outconvert << disp << "_status:frameset_\n";
|
---|
140 | }
|
---|
141 |
|
---|
142 | void statusaction::output_select (cgiargsclass &/*args*/, displayclass &disp,
|
---|
143 | outconvertclass &outconvert,
|
---|
144 | ostream &textout, ostream &/*logout*/) {
|
---|
145 | textout << outconvert << disp << "_status:header_(selector)\n"
|
---|
146 | "_status:select_\n"
|
---|
147 | "_status:footer_\n";
|
---|
148 | }
|
---|
149 |
|
---|
150 | void statusaction::output_welcome (cgiargsclass &/*args*/, recptprotolistclass *protos,
|
---|
151 | displayclass &disp, outconvertclass &outconvert,
|
---|
152 | ostream &textout, ostream &logout) {
|
---|
153 |
|
---|
154 | textout << outconvert << disp
|
---|
155 | << "_status:infoheader_(_titlewelcome_)\n"
|
---|
156 | << "_status:welcome_"
|
---|
157 | << "<center><table width=_pagewidth_>\n"
|
---|
158 | << "<th align=left>abbrev.</th><th align=left>collection</th>"
|
---|
159 | << "<th align=left>public?</th><th align=left>running?</th></tr>\n";
|
---|
160 |
|
---|
161 | recptprotolistclass::iterator rprotolist_here = protos->begin();
|
---|
162 | recptprotolistclass::iterator rprotolist_end = protos->end();
|
---|
163 | while (rprotolist_here != rprotolist_end) {
|
---|
164 | if ((*rprotolist_here).p != NULL) {
|
---|
165 | text_t protoname = (*rprotolist_here).p->get_protocol_name();
|
---|
166 | text_tarray collist;
|
---|
167 | comerror_t err;
|
---|
168 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
169 | if (err == noError) {
|
---|
170 | text_tarray::iterator collist_here = collist.begin();
|
---|
171 | text_tarray::iterator collist_end = collist.end();
|
---|
172 |
|
---|
173 | while (collist_here != collist_end) {
|
---|
174 |
|
---|
175 | textout << outconvert << disp
|
---|
176 | << "<tr><td><a href=\"_gwcgi_?e=_compressedoptions_&a=status&sp=collectioninfo&pr="
|
---|
177 | << protoname
|
---|
178 | << "&c="
|
---|
179 | << *collist_here
|
---|
180 | << "\">"
|
---|
181 | << *collist_here
|
---|
182 | << "</a></td>";
|
---|
183 |
|
---|
184 | ColInfoResponse_t cinfo;
|
---|
185 | (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
|
---|
186 | if (err == noError) {
|
---|
187 | text_t collname = *collist_here;
|
---|
188 | text_tmap::iterator it = cinfo.collectionmeta.find("collectionname");
|
---|
189 | if (it != cinfo.collectionmeta.end()) collname = (*it).second;
|
---|
190 |
|
---|
191 | textout << "<td>";
|
---|
192 | if (cinfo.buildDate > 0)
|
---|
193 | textout << outconvert << disp
|
---|
194 | << "<a href=\"_httppagex_(about)&c=" << *collist_here
|
---|
195 | << "\" target=_top>";
|
---|
196 |
|
---|
197 | textout << outconvert << disp << collname;
|
---|
198 |
|
---|
199 | if (cinfo.buildDate > 0) textout << "</a>";
|
---|
200 |
|
---|
201 | textout << "</td>";
|
---|
202 |
|
---|
203 | if (cinfo.isPublic) textout << "<td>yes</td>";
|
---|
204 | else textout << "<td>no</td>";
|
---|
205 |
|
---|
206 | if (cinfo.buildDate > 0)
|
---|
207 | textout << outconvert << "<td>yes</td>";
|
---|
208 | else
|
---|
209 | textout << "<td>no</td>";
|
---|
210 |
|
---|
211 | } else {
|
---|
212 | textout << "<td></td><td></td><td></td>";
|
---|
213 | }
|
---|
214 |
|
---|
215 | textout << "</tr>\n";
|
---|
216 | collist_here ++;
|
---|
217 | }
|
---|
218 | }
|
---|
219 | }
|
---|
220 | rprotolist_here ++;
|
---|
221 | }
|
---|
222 |
|
---|
223 | textout << "</table></center>\n";
|
---|
224 | textout << outconvert << disp << "_status:infofooter_\n";
|
---|
225 | }
|
---|
226 |
|
---|
227 | void statusaction::output_generalinfo (cgiargsclass &/*args*/, displayclass &disp,
|
---|
228 | outconvertclass &outconvert,
|
---|
229 | ostream &textout, ostream &/*logout*/) {
|
---|
230 | if (recpt == NULL) return;
|
---|
231 | const recptconf &rcinfo = recpt->get_configinfo ();
|
---|
232 |
|
---|
233 | textout << outconvert << disp << "_status:infoheader_(General Information)\n";
|
---|
234 | textout << outconvert
|
---|
235 | << "<h2>General information</h2>\n"
|
---|
236 | << "<table>\n"
|
---|
237 | << "<tr valign=top><th>gsdlhome</th><td>\"" << rcinfo.gsdlhome
|
---|
238 | << "\"</td></tr>\n"
|
---|
239 | << "<tr valign=top><th>collection</th><td>\"" << rcinfo.collection
|
---|
240 | << "\"</td></tr>\n"
|
---|
241 | << "<tr valign=top><th>collectdir</th><td>\"" << rcinfo.collectdir
|
---|
242 | << "\"</td></tr>\n"
|
---|
243 | << "<tr valign=top><th>httpprefix</th><td>\"" << rcinfo.httpprefix
|
---|
244 | << "\"</td></tr>\n"
|
---|
245 | << "<tr valign=top><th>httpimg</th><td>\"" << rcinfo.httpimg
|
---|
246 | << "\"</td></tr>\n"
|
---|
247 | << "<tr valign=top><th>gwcgi</th><td>\"" << rcinfo.gwcgi
|
---|
248 | << "\"</td></tr>\n";
|
---|
249 |
|
---|
250 | // macrofiles
|
---|
251 | textout << outconvert << "<tr valign=top><th>macrofiles</th><td>";
|
---|
252 | text_tset::const_iterator macrohere = rcinfo.macrofiles.begin ();
|
---|
253 | text_tset::const_iterator macroend = rcinfo.macrofiles.end ();
|
---|
254 | bool macrofirst = true;
|
---|
255 | while (macrohere != macroend) {
|
---|
256 | if (!macrofirst) textout << outconvert << ", ";
|
---|
257 | macrofirst = false;
|
---|
258 | textout << outconvert << "\"" << *macrohere << "\"";
|
---|
259 | macrohere++;
|
---|
260 | }
|
---|
261 | textout << outconvert << "</td></tr>\n";
|
---|
262 |
|
---|
263 | // saveconf
|
---|
264 | textout << outconvert << "<tr valign=top><th>saveconf</th><td>\"" << rcinfo.saveconf
|
---|
265 | << "\"</td></tr>\n";
|
---|
266 |
|
---|
267 | // usecookies
|
---|
268 | textout << outconvert << "<tr valign=top><th>usecookies</th><td>\"";
|
---|
269 | if (rcinfo.usecookies) textout << outconvert << "true";
|
---|
270 | else textout << outconvert << "false";
|
---|
271 | textout << outconvert << "\"</td></tr>\n";
|
---|
272 |
|
---|
273 | // logcgiargs
|
---|
274 | textout << outconvert << "<tr valign=top><th>logcgiargs</th><td>\"";
|
---|
275 | if (rcinfo.logcgiargs) textout << outconvert << "true";
|
---|
276 | else textout << outconvert << "false";
|
---|
277 | textout << outconvert << "\"</td></tr>\n";
|
---|
278 |
|
---|
279 | // pageparams
|
---|
280 | textout << outconvert << "<tr valign=top><th>pageparams</th><td>";
|
---|
281 | text_tmap::const_iterator params_here = rcinfo.pageparams.begin();
|
---|
282 | text_tmap::const_iterator params_end = rcinfo.pageparams.end();
|
---|
283 | bool params_first = true;
|
---|
284 | while (params_here != params_end) {
|
---|
285 | if (!params_first) textout << outconvert << ", ";
|
---|
286 | params_first = false;
|
---|
287 | textout << outconvert << "\"" << (*params_here).first << "\" != \""
|
---|
288 | << (*params_here).second << "\"";
|
---|
289 |
|
---|
290 | params_here++;
|
---|
291 | }
|
---|
292 | textout << outconvert << "</td></tr>\n";
|
---|
293 |
|
---|
294 | // macroprecedence
|
---|
295 | textout << outconvert << "<tr valign=top><th>macroprecedence</th><td>\"" << rcinfo.macroprecedence
|
---|
296 | << "\"</td></tr>\n";
|
---|
297 |
|
---|
298 | // arguments
|
---|
299 | cgiargsinfoclass *rcargsinfo = recpt->get_cgiargsinfo_ptr ();
|
---|
300 | if (rcargsinfo != NULL) {
|
---|
301 | textout << outconvert << "<tr valign=top><th>arguments</th><td>";
|
---|
302 |
|
---|
303 | cgiargsinfoclass::const_iterator argsinfohere = rcargsinfo->begin ();
|
---|
304 | cgiargsinfoclass::const_iterator argsinfoend = rcargsinfo->end ();
|
---|
305 | bool argsinfofirst = true;
|
---|
306 | while (argsinfohere != argsinfoend) {
|
---|
307 | if (!argsinfofirst) textout << outconvert << ", ";
|
---|
308 | argsinfofirst = false;
|
---|
309 | textout << outconvert << "\"" << (*argsinfohere).second.shortname << "\"";
|
---|
310 | argsinfohere++;
|
---|
311 | }
|
---|
312 |
|
---|
313 | textout << outconvert << "</td></tr>\n";
|
---|
314 | }
|
---|
315 |
|
---|
316 | // actions
|
---|
317 | actionmapclass *actions = recpt->get_actionmap_ptr();
|
---|
318 | if (actions != NULL) {
|
---|
319 | textout << outconvert << "<tr valign=top><th>actions</th><td>";
|
---|
320 |
|
---|
321 | actionptrmap::iterator actionshere = actions->begin ();
|
---|
322 | actionptrmap::iterator actionsend = actions->end ();
|
---|
323 | bool actionsfirst = true;
|
---|
324 | while (actionshere != actionsend) {
|
---|
325 | if (!actionsfirst) textout << outconvert << ", ";
|
---|
326 | actionsfirst = false;
|
---|
327 | assert ((*actionshere).second.a != NULL);
|
---|
328 | if ((*actionshere).second.a != NULL) {
|
---|
329 | textout << outconvert << "\"" << (*actionshere).second.a->get_action_name() << "\"";
|
---|
330 | }
|
---|
331 | actionshere++;
|
---|
332 | }
|
---|
333 |
|
---|
334 | textout << outconvert << "</td></tr>\n";
|
---|
335 | }
|
---|
336 |
|
---|
337 | // protocols
|
---|
338 | recptprotolistclass *protocols = recpt->get_recptprotolist_ptr ();
|
---|
339 | if (protocols != NULL) {
|
---|
340 | textout << outconvert << "<tr valign=top><th>protocols</th><td>";
|
---|
341 |
|
---|
342 | recptprotolistclass::iterator protohere = protocols->begin ();
|
---|
343 | recptprotolistclass::iterator protoend = protocols->end ();
|
---|
344 | bool protofirst = true;
|
---|
345 | while (protohere != protoend) {
|
---|
346 | if (!protofirst) textout << outconvert << ", ";
|
---|
347 | protofirst = false;
|
---|
348 | if ((*protohere).p != NULL) {
|
---|
349 | textout << outconvert << "\"" << (*protohere).p->get_protocol_name() << "\"";
|
---|
350 | }
|
---|
351 | protohere++;
|
---|
352 | }
|
---|
353 |
|
---|
354 | textout << outconvert << "</td></tr>\n";
|
---|
355 | }
|
---|
356 |
|
---|
357 | // converters
|
---|
358 | convertinfoclass *converters = recpt->get_convertinfo_ptr ();
|
---|
359 | if (converters != NULL) {
|
---|
360 | textout << outconvert << "<tr valign=top><th>converters</th><td>";
|
---|
361 |
|
---|
362 | convertinfoclass::iterator converthere = converters->begin ();
|
---|
363 | convertinfoclass::iterator convertend = converters->end ();
|
---|
364 | bool convertfirst = true;
|
---|
365 | while (converthere != convertend) {
|
---|
366 | if (!convertfirst) textout << outconvert << ", ";
|
---|
367 | convertfirst = false;
|
---|
368 | textout << outconvert << "\"" << (*converthere).second.name << "\"";
|
---|
369 | converthere++;
|
---|
370 | }
|
---|
371 |
|
---|
372 | textout << outconvert << "</td></tr>\n";
|
---|
373 | }
|
---|
374 |
|
---|
375 | textout << outconvert << disp << "</table>\n_status:infofooter_\n";
|
---|
376 | }
|
---|
377 |
|
---|
378 | void statusaction::output_argumentinfo (cgiargsclass &args, displayclass &disp,
|
---|
379 | outconvertclass &outconvert,
|
---|
380 | ostream &textout, ostream &/*logout*/) {
|
---|
381 | if (recpt == NULL) return;
|
---|
382 | cgiargsinfoclass *rcargsinfo = recpt->get_cgiargsinfo_ptr ();
|
---|
383 | if (rcargsinfo == NULL) return;
|
---|
384 |
|
---|
385 | textout << outconvert << disp << "_status:infoheader_(Argument Information)\n";
|
---|
386 | textout << outconvert
|
---|
387 | << "<h2>Argument information</h2>\n"
|
---|
388 | << "<table>";
|
---|
389 |
|
---|
390 | // argument information
|
---|
391 | textout << outconvert << "<tr valign=top><th>short name</th><th>long name</th>"
|
---|
392 | << "<th>multiple char?</th>"
|
---|
393 | << "<th>multiple value?</th>"
|
---|
394 | << "<th>default</th><th>default status</th><th>saved args</th>"
|
---|
395 | << "<th>current value</th></tr>\n";
|
---|
396 |
|
---|
397 |
|
---|
398 | cgiargsinfoclass::const_iterator argsinfohere = rcargsinfo->begin();
|
---|
399 | cgiargsinfoclass::const_iterator argsinfoend = rcargsinfo->end();
|
---|
400 | text_t *arg_value;
|
---|
401 | while (argsinfohere != argsinfoend) {
|
---|
402 | const cgiarginfo &ainfo = (*argsinfohere).second;
|
---|
403 | textout << outconvert
|
---|
404 | << "<tr valign=top><td>" << ainfo.shortname << "</td>\n";
|
---|
405 |
|
---|
406 | textout << outconvert << "<td>" << ainfo.longname << "</td>\n";
|
---|
407 | if (ainfo.multiplechar) textout << outconvert << "<td>yes</td>\n";
|
---|
408 | else textout << outconvert << "<td>no</td>\n";
|
---|
409 | if (ainfo.multiplevalue) textout << outconvert << "<td>yes</td>\n";
|
---|
410 | else textout << outconvert << "<td>no</td>\n";
|
---|
411 | textout << outconvert << "<td>" << ainfo.argdefault << "</td>\n";
|
---|
412 | switch (ainfo.defaultstatus) {
|
---|
413 | case cgiarginfo::none: textout << outconvert << "<td>none</td>\n"; break;
|
---|
414 | case cgiarginfo::weak: textout << outconvert << "<td>weak</td>\n"; break;
|
---|
415 | case cgiarginfo::good: textout << outconvert << "<td>good</td>\n"; break;
|
---|
416 | case cgiarginfo::config: textout << outconvert << "<td>config</td>\n"; break;
|
---|
417 | case cgiarginfo::imperative: textout << outconvert << "<td>imperative</td>\n"; break;
|
---|
418 | }
|
---|
419 | switch (ainfo.savedarginfo) {
|
---|
420 | case cgiarginfo::mustnot: textout << outconvert << "<td>mustnot</td>\n"; break;
|
---|
421 | case cgiarginfo::can: textout << outconvert << "<td>can</td>\n"; break;
|
---|
422 | case cgiarginfo::must: textout << outconvert << "<td>must</td>\n"; break;
|
---|
423 | }
|
---|
424 |
|
---|
425 | arg_value = args.getarg (ainfo.shortname);
|
---|
426 | if (arg_value == NULL) textout << outconvert << "<td></td></tr>\n";
|
---|
427 | else textout << outconvert << "<td>\"" << *arg_value << "\"</td></tr>\n";
|
---|
428 |
|
---|
429 | argsinfohere ++;
|
---|
430 | }
|
---|
431 |
|
---|
432 | textout << outconvert << disp << "</table>\n_status:infofooter_\n";
|
---|
433 | }
|
---|
434 |
|
---|
435 | void statusaction::output_actioninfo (cgiargsclass &/*args*/, displayclass &disp,
|
---|
436 | outconvertclass &outconvert,
|
---|
437 | ostream &textout, ostream &/*logout*/) {
|
---|
438 | if (recpt == NULL) return;
|
---|
439 | actionmapclass *actions = recpt->get_actionmap_ptr();
|
---|
440 |
|
---|
441 | textout << outconvert << disp << "_status:infoheader_(Action Information)\n";
|
---|
442 | textout << outconvert
|
---|
443 | << "<h2>Action information</h2>\n"
|
---|
444 | << "<table>";
|
---|
445 |
|
---|
446 | // action information
|
---|
447 | if (actions != NULL) {
|
---|
448 | textout << outconvert
|
---|
449 | << "<tr><th>action name</th><th>cgi arguments</th></tr>\n";
|
---|
450 |
|
---|
451 | actionptrmap::iterator actionshere = actions->begin ();
|
---|
452 | actionptrmap::iterator actionsend = actions->end ();
|
---|
453 | while (actionshere != actionsend) {
|
---|
454 | assert ((*actionshere).second.a != NULL);
|
---|
455 | if ((*actionshere).second.a != NULL) {
|
---|
456 | textout << outconvert
|
---|
457 | << "<tr><td>" << (*actionshere).second.a->get_action_name()
|
---|
458 | << "</td><td>";
|
---|
459 |
|
---|
460 | cgiargsinfoclass argsinfo = (*actionshere).second.a->getargsinfo();
|
---|
461 | cgiargsinfoclass::const_iterator argsinfohere = argsinfo.begin ();
|
---|
462 | cgiargsinfoclass::const_iterator argsinfoend = argsinfo.end ();
|
---|
463 | bool aifirst = true;
|
---|
464 | while (argsinfohere != argsinfoend) {
|
---|
465 | if (!aifirst) textout << outconvert << ", ";
|
---|
466 | aifirst = false;
|
---|
467 | textout << outconvert << (*argsinfohere).second.shortname;
|
---|
468 | argsinfohere++;
|
---|
469 | }
|
---|
470 |
|
---|
471 | textout << outconvert << "</td></tr>\n";
|
---|
472 | }
|
---|
473 | actionshere++;
|
---|
474 | }
|
---|
475 | }
|
---|
476 |
|
---|
477 | textout << outconvert << disp << "</table>\n_status:infofooter_\n";
|
---|
478 | }
|
---|
479 |
|
---|
480 | void statusaction::output_protocolinfo (cgiargsclass &/*args*/, displayclass &disp,
|
---|
481 | outconvertclass &outconvert,
|
---|
482 | ostream &textout, ostream &logout) {
|
---|
483 | if (recpt == NULL) return;
|
---|
484 | const recptconf &rcinfo = recpt->get_configinfo ();
|
---|
485 | bool colspecific = !rcinfo.collection.empty();
|
---|
486 | bool unreachablecol = false;
|
---|
487 |
|
---|
488 | recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr ();
|
---|
489 | if (rprotolist == NULL) return;
|
---|
490 |
|
---|
491 | textout << outconvert << disp << "_status:infoheader_(Protocol Information)\n";
|
---|
492 | textout << outconvert
|
---|
493 | << "<h2>Protocol information</h2>\n"
|
---|
494 | << "<table>\n"
|
---|
495 | << "<tr><th>protocol</th><th>collections</th></tr>\n";
|
---|
496 |
|
---|
497 | text_t protoname;
|
---|
498 | recptprotolistclass::iterator rprotolist_here = rprotolist->begin();
|
---|
499 | recptprotolistclass::iterator rprotolist_end = rprotolist->end();
|
---|
500 | while (rprotolist_here != rprotolist_end) {
|
---|
501 | if ((*rprotolist_here).p != NULL) {
|
---|
502 | protoname = (*rprotolist_here).p->get_protocol_name();
|
---|
503 | textout << outconvert
|
---|
504 | << "<tr><td>"
|
---|
505 | << protoname
|
---|
506 | << "</td><td>";
|
---|
507 |
|
---|
508 | text_tarray collist;
|
---|
509 | comerror_t err;
|
---|
510 | (*rprotolist_here).p->get_collection_list (collist, err, logout);
|
---|
511 | if (err == noError) {
|
---|
512 | text_tarray::iterator collist_here = collist.begin();
|
---|
513 | text_tarray::iterator collist_end = collist.end();
|
---|
514 | bool first = true;
|
---|
515 | while (collist_here != collist_end) {
|
---|
516 | if (!first) textout << outconvert << ", ";
|
---|
517 | first = false;
|
---|
518 |
|
---|
519 | if (colspecific && *collist_here != rcinfo.collection) {
|
---|
520 | unreachablecol = true;
|
---|
521 | textout << outconvert << "\"" << *collist_here << "\"";
|
---|
522 | } else {
|
---|
523 | textout << outconvert << disp
|
---|
524 | << "\"<a href=\"_gwcgi_?e=_compressedoptions_&a=status&sp=collectioninfo&pr="
|
---|
525 | << protoname
|
---|
526 | << "&c="
|
---|
527 | << *collist_here
|
---|
528 | << "\">"
|
---|
529 | << *collist_here
|
---|
530 | << "</a>\"";
|
---|
531 | }
|
---|
532 |
|
---|
533 | collist_here++;
|
---|
534 | }
|
---|
535 |
|
---|
536 | } else {
|
---|
537 | textout << outconvert << "Error (" << get_comerror_string (err)
|
---|
538 | << ") while getting collect list\n";
|
---|
539 | }
|
---|
540 |
|
---|
541 | textout << outconvert
|
---|
542 | << "</td></tr>\n";
|
---|
543 | }
|
---|
544 |
|
---|
545 | rprotolist_here++;
|
---|
546 | }
|
---|
547 |
|
---|
548 | textout << outconvert << "</table>\n";
|
---|
549 | if (unreachablecol) {
|
---|
550 | textout << outconvert
|
---|
551 | << "<b>Warning:</b> the receptionist is running in collection specific\n"
|
---|
552 | << "mode making some of the collections unreachable.\n";
|
---|
553 | }
|
---|
554 | textout << outconvert << disp << "_status:infofooter_\n";
|
---|
555 | }
|
---|
556 |
|
---|
557 | void statusaction::output_collectioninfo (cgiargsclass &args, displayclass &disp,
|
---|
558 | outconvertclass &outconvert,
|
---|
559 | ostream &textout, ostream &logout) {
|
---|
560 | if (recpt == NULL) return;
|
---|
561 |
|
---|
562 | textout << outconvert << disp << "_status:infoheader_(Collection info)\n";
|
---|
563 | textout << outconvert << "<h2>Collection info</h2>\n";
|
---|
564 |
|
---|
565 | // get the list of protocols
|
---|
566 | recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr ();
|
---|
567 | if (rprotolist == NULL) return;
|
---|
568 |
|
---|
569 | // look for the desired protocol
|
---|
570 | text_t &arg_pr = args["pr"];
|
---|
571 | text_t &arg_c = args["c"];
|
---|
572 | recptproto *rproto = NULL;
|
---|
573 | recptprotolistclass::iterator rprotolist_here = rprotolist->begin();
|
---|
574 | recptprotolistclass::iterator rprotolist_end = rprotolist->end();
|
---|
575 | while (rprotolist_here != rprotolist_end) {
|
---|
576 | rproto = (*rprotolist_here).p;
|
---|
577 | if (rproto != NULL && rproto->get_protocol_name() == arg_pr) {
|
---|
578 | // see if the protocol has the collection
|
---|
579 | bool hascollection;
|
---|
580 | comerror_t err;
|
---|
581 | rproto->has_collection (arg_c, hascollection, err, logout);
|
---|
582 | if (err == noError && hascollection) break;
|
---|
583 | }
|
---|
584 | rprotolist_here++;
|
---|
585 | }
|
---|
586 |
|
---|
587 | if (rprotolist_here == rprotolist_end) {
|
---|
588 | textout << outconvert << "Protocol \"" << arg_pr << "\" with collection \""
|
---|
589 | << arg_c << "\" was not found\n";
|
---|
590 |
|
---|
591 | } else {
|
---|
592 | // rproto can't be NULL to get here
|
---|
593 | ColInfoResponse_t collectinfo;
|
---|
594 | comerror_t err;
|
---|
595 |
|
---|
596 | rproto->get_collectinfo (arg_c, collectinfo, err, logout);
|
---|
597 | if (err == noError) {
|
---|
598 | textout << outconvert << "<table>\n"
|
---|
599 | << "<tr><th>collection name</th><td>\""
|
---|
600 | << collectinfo.shortInfo.name
|
---|
601 | << "\"</td></tr>\n"
|
---|
602 |
|
---|
603 | << "<tr><th>host</th><td>\""
|
---|
604 | << collectinfo.shortInfo.host
|
---|
605 | << "\"</td></tr>\n"
|
---|
606 |
|
---|
607 | << "<tr><th>port</th><td>\""
|
---|
608 | << collectinfo.shortInfo.port
|
---|
609 | << "\"</td></tr>\n"
|
---|
610 |
|
---|
611 | << "<tr><th>is public?</th><td>";
|
---|
612 | if (collectinfo.isPublic) textout << outconvert << "true";
|
---|
613 | else textout << outconvert << "false";
|
---|
614 | textout << outconvert
|
---|
615 | << "</td></tr>\n"
|
---|
616 |
|
---|
617 | << "<tr><th>is beta?</th><td>";
|
---|
618 | if (collectinfo.isBeta) textout << outconvert << "true";
|
---|
619 | else textout << outconvert << "false";
|
---|
620 | textout << outconvert
|
---|
621 | << "</td></tr>\n"
|
---|
622 |
|
---|
623 | << "<tr><th>build date</th><td>\""
|
---|
624 | << collectinfo.buildDate
|
---|
625 | << "\"</td></tr>\n"
|
---|
626 |
|
---|
627 | << "<tr><th>interface languages</th><td>";
|
---|
628 | text_tarray::iterator languages_here = collectinfo.languages.begin();
|
---|
629 | text_tarray::iterator languages_end = collectinfo.languages.end();
|
---|
630 | bool languages_first = true;
|
---|
631 | while (languages_here != languages_end) {
|
---|
632 | if (!languages_first) textout << outconvert << ", ";
|
---|
633 | languages_first = false;
|
---|
634 | textout << outconvert << "\"" << *languages_here << "\"";
|
---|
635 | languages_here++;
|
---|
636 | }
|
---|
637 |
|
---|
638 | textout << "<tr><th valign=top>collection metadata</th><td><table>\n";
|
---|
639 | text_tmap::iterator meta_here = collectinfo.collectionmeta.begin();
|
---|
640 | text_tmap::iterator meta_end = collectinfo.collectionmeta.end();
|
---|
641 | while (meta_here != meta_end) {
|
---|
642 | textout << outconvert << "<tr><td>" << (*meta_here).first
|
---|
643 | << "</td><td>" << (*meta_here).second << "</td></tr>\n";
|
---|
644 | meta_here ++;
|
---|
645 | }
|
---|
646 | textout << "</table></td></tr>\n";
|
---|
647 |
|
---|
648 | textout << "<tr><th valign=top>format info</th><td><table>\n";
|
---|
649 | text_tmap::iterator format_here = collectinfo.format.begin();
|
---|
650 | text_tmap::iterator format_end = collectinfo.format.end();
|
---|
651 | while (format_here != format_end) {
|
---|
652 | textout << outconvert << "<tr><td>" << (*format_here).first
|
---|
653 | << "</td><td>" << html_safe((*format_here).second) << "</td></tr>\n";
|
---|
654 | format_here ++;
|
---|
655 | }
|
---|
656 | textout << "</table></td></tr>\n";
|
---|
657 |
|
---|
658 | textout << "<tr><th valign=top>building info</th><td><table>\n";
|
---|
659 | text_tmap::iterator building_here = collectinfo.building.begin();
|
---|
660 | text_tmap::iterator building_end = collectinfo.building.end();
|
---|
661 | while (building_here != building_end) {
|
---|
662 | textout << outconvert << "<tr><td>" << (*building_here).first
|
---|
663 | << "</td><td>" << (*building_here).second << "</td></tr>\n";
|
---|
664 | building_here ++;
|
---|
665 | }
|
---|
666 | textout << "</table></td></tr>\n";
|
---|
667 |
|
---|
668 | textout << outconvert
|
---|
669 | << "</td></tr>\n"
|
---|
670 |
|
---|
671 | << "<tr><th>number of documents</th><td>\""
|
---|
672 | << collectinfo.numDocs
|
---|
673 | << "\"</td></tr>\n"
|
---|
674 |
|
---|
675 | << "<tr><th>number of sections</th><td>\""
|
---|
676 | << collectinfo.numSections
|
---|
677 | << "\"</td></tr>\n"
|
---|
678 |
|
---|
679 | << "<tr><th>number of words</th><td>\""
|
---|
680 | << collectinfo.numWords
|
---|
681 | << "\"</td></tr>\n"
|
---|
682 |
|
---|
683 | << "<tr><th>number of bytes</th><td>\""
|
---|
684 | << collectinfo.numBytes
|
---|
685 | << "\"</td></tr>\n"
|
---|
686 |
|
---|
687 | << "<tr><th>preferred receptionist</th><td>\""
|
---|
688 | << collectinfo.receptionist
|
---|
689 | << "\"</td></tr>\n"
|
---|
690 |
|
---|
691 | << "</table>";
|
---|
692 |
|
---|
693 | } else {
|
---|
694 | textout << outconvert << "Error (" << get_comerror_string (err)
|
---|
695 | << ") while getting collect information\n";
|
---|
696 | }
|
---|
697 |
|
---|
698 |
|
---|
699 | InfoFiltersResponse_t filterinfo;
|
---|
700 | InfoFilterOptionsRequest_t filteroptions_request;
|
---|
701 | InfoFilterOptionsResponse_t filteroptions;
|
---|
702 | rproto->get_filterinfo (arg_c, filterinfo, err, logout);
|
---|
703 | if (err == noError) {
|
---|
704 | text_tset::iterator filternames_here = filterinfo.filterNames.begin();
|
---|
705 | text_tset::iterator filternames_end = filterinfo.filterNames.end();
|
---|
706 | while (filternames_here != filternames_end) {
|
---|
707 | textout << outconvert
|
---|
708 | << "<hr>\n"
|
---|
709 | << "<h3>Filter options for \"" << (*filternames_here) << "\"</h3>\n"
|
---|
710 | << "<table>\n"
|
---|
711 | << "<tr><th>option name</th><th>type</th><th>repeatable</th>"
|
---|
712 | << "<th>default value</th><th>valid values</th></tr>\n";
|
---|
713 |
|
---|
714 | filteroptions_request.clear();
|
---|
715 | filteroptions_request.filterName = *filternames_here;
|
---|
716 | rproto->get_filteroptions (arg_c, filteroptions_request,
|
---|
717 | filteroptions, err, logout);
|
---|
718 | if (err == noError) {
|
---|
719 | FilterOption_tmap::iterator filteropt_here =
|
---|
720 | filteroptions.filterOptions.begin();
|
---|
721 | FilterOption_tmap::iterator filteropt_end =
|
---|
722 | filteroptions.filterOptions.end();
|
---|
723 | while (filteropt_here != filteropt_end) {
|
---|
724 | textout << outconvert
|
---|
725 | << "<tr><td>\""
|
---|
726 | << (*filteropt_here).second.name
|
---|
727 | << "\"</td>\n"
|
---|
728 |
|
---|
729 | << "<td>";
|
---|
730 | text_t type_string;
|
---|
731 | switch ((*filteropt_here).second.type) {
|
---|
732 | case FilterOption_t::booleant: type_string = "boolean"; break;
|
---|
733 | case FilterOption_t::integert: type_string = "integer"; break;
|
---|
734 | case FilterOption_t::enumeratedt: type_string = "enumerated"; break;
|
---|
735 | case FilterOption_t::stringt: type_string = "string"; break;
|
---|
736 | }
|
---|
737 | textout << outconvert
|
---|
738 | << type_string
|
---|
739 | << "</td>\n"
|
---|
740 |
|
---|
741 | << "<td>";
|
---|
742 | text_t repeat_string;
|
---|
743 | switch ((*filteropt_here).second.repeatable) {
|
---|
744 | case FilterOption_t::onePerQuery: repeat_string = "one per query"; break;
|
---|
745 | case FilterOption_t::onePerTerm: repeat_string = "one per term"; break;
|
---|
746 | case FilterOption_t::nPerTerm: repeat_string = "n per term"; break;
|
---|
747 | }
|
---|
748 | textout << outconvert
|
---|
749 | << repeat_string
|
---|
750 | << "</td>\n"
|
---|
751 |
|
---|
752 | << "<td>\""
|
---|
753 | << (*filteropt_here).second.defaultValue
|
---|
754 | << "\"</td>\n"
|
---|
755 |
|
---|
756 | << "<td>";
|
---|
757 |
|
---|
758 | text_tarray::iterator valid_here =
|
---|
759 | (*filteropt_here).second.validValues.begin();
|
---|
760 | text_tarray::iterator valid_end =
|
---|
761 | (*filteropt_here).second.validValues.end();
|
---|
762 | bool valid_first = true;
|
---|
763 | while (valid_here != valid_end) {
|
---|
764 | if (!valid_first) textout << outconvert << ", ";
|
---|
765 | valid_first = false;
|
---|
766 | textout << outconvert << "\"" << *valid_here << "\"";
|
---|
767 | valid_here++;
|
---|
768 | }
|
---|
769 | textout << outconvert
|
---|
770 | << "</td></tr>\n";
|
---|
771 |
|
---|
772 | filteropt_here++;
|
---|
773 | }
|
---|
774 |
|
---|
775 | textout << outconvert
|
---|
776 | << "</table>\n";
|
---|
777 |
|
---|
778 | } else {
|
---|
779 | textout << outconvert << "Error (" << get_comerror_string (err)
|
---|
780 | << ") while getting filter option information\n";
|
---|
781 | }
|
---|
782 |
|
---|
783 | filternames_here++;
|
---|
784 | }
|
---|
785 |
|
---|
786 | } else {
|
---|
787 | textout << outconvert << "Error (" << get_comerror_string (err)
|
---|
788 | << ") while getting filter information\n";
|
---|
789 | }
|
---|
790 | }
|
---|
791 |
|
---|
792 | textout << outconvert << disp << "_status:infofooter_\n";
|
---|
793 | }
|
---|
794 |
|
---|
795 | void statusaction::output_initlog (cgiargsclass &/*args*/, displayclass &disp,
|
---|
796 | outconvertclass &outconvert,
|
---|
797 | ostream &textout, ostream &/*logout*/) {
|
---|
798 | if (recpt == NULL) return;
|
---|
799 | const recptconf &rcinfo = recpt->get_configinfo ();
|
---|
800 | text_t initfilename = filename_cat (rcinfo.gsdlhome, "etc", "initout.txt");
|
---|
801 | char *cinitfilename = initfilename.getcstr();
|
---|
802 | if (cinitfilename == NULL) return;
|
---|
803 |
|
---|
804 | textout << outconvert << disp << "_status:infoheader_(Init log)\n";
|
---|
805 | textout << outconvert << "<h2>Init log</h2>\n";
|
---|
806 |
|
---|
807 | #ifdef GSDL_USE_IOS_H
|
---|
808 | ifstream initin (cinitfilename, ios::in | ios::nocreate);
|
---|
809 | #else
|
---|
810 | ifstream initin (cinitfilename, ios::in);
|
---|
811 | #endif
|
---|
812 |
|
---|
813 | delete cinitfilename;
|
---|
814 | if (initin) {
|
---|
815 | textout << outconvert << "<p>The initialisation error log, "
|
---|
816 | << initfilename << ", contains the\n";
|
---|
817 | textout << outconvert << "following information:\n\n";
|
---|
818 | text_t errorpage = "<p><pre>\n";
|
---|
819 |
|
---|
820 | char c;
|
---|
821 | initin.get(c);
|
---|
822 | while (!initin.eof ()) {
|
---|
823 | errorpage.push_back(c);
|
---|
824 | initin.get(c);
|
---|
825 | }
|
---|
826 |
|
---|
827 | errorpage += "</pre>\n";
|
---|
828 | initin.close();
|
---|
829 | textout << outconvert << errorpage;
|
---|
830 |
|
---|
831 | } else {
|
---|
832 | textout << outconvert << "Couldn't read initialisation error log, "
|
---|
833 | << initfilename << ".\n";
|
---|
834 | }
|
---|
835 |
|
---|
836 | textout << outconvert << disp << "_status:infofooter_\n";
|
---|
837 | }
|
---|
838 |
|
---|
839 | void statusaction::output_errorlog (cgiargsclass &/*args*/, displayclass &disp,
|
---|
840 | outconvertclass &outconvert,
|
---|
841 | ostream &textout, ostream &logout) {
|
---|
842 | if (recpt == NULL) return;
|
---|
843 | const recptconf &rcinfo = recpt->get_configinfo ();
|
---|
844 | text_t errfilename = filename_cat (rcinfo.gsdlhome, "etc", "errout.txt");
|
---|
845 | char *cerrfilename = errfilename.getcstr();
|
---|
846 | if (cerrfilename == NULL) return;
|
---|
847 |
|
---|
848 | textout << outconvert << disp << "_status:infoheader_(Error log)\n";
|
---|
849 | textout << outconvert << "<h2>Error log</h2>\n";
|
---|
850 | logout << flush;
|
---|
851 |
|
---|
852 | #ifdef GSDL_USE_IOS_H
|
---|
853 | ifstream errin (cerrfilename, ios::in | ios::nocreate);
|
---|
854 | #else
|
---|
855 | ifstream errin (cerrfilename, ios::in);
|
---|
856 | #endif
|
---|
857 |
|
---|
858 | delete cerrfilename;
|
---|
859 | if (errin) {
|
---|
860 | textout << outconvert << "<p>The error log, "
|
---|
861 | << errfilename << ", contains the\n";
|
---|
862 | textout << outconvert << "following information:\n\n";
|
---|
863 | text_t errorpage = "<p><pre>\n";
|
---|
864 |
|
---|
865 | char c;
|
---|
866 | errin.get(c);
|
---|
867 | while (!errin.eof ()) {
|
---|
868 | errorpage.push_back(c);
|
---|
869 | errin.get(c);
|
---|
870 | }
|
---|
871 |
|
---|
872 | errorpage += "</pre>\n";
|
---|
873 | errin.close();
|
---|
874 | textout << outconvert << errorpage;
|
---|
875 |
|
---|
876 | } else {
|
---|
877 | textout << outconvert << "Couldn't read error log, "
|
---|
878 | << errfilename << ".\n";
|
---|
879 | }
|
---|
880 |
|
---|
881 | textout << outconvert << disp << "_status:infofooter_\n";
|
---|
882 | }
|
---|
883 |
|
---|
884 | void statusaction::output_errorpage (outconvertclass &outconvert,
|
---|
885 | ostream &textout, ostream &/*logout*/,
|
---|
886 | text_t message) {
|
---|
887 | textout << outconvert
|
---|
888 | << "<html>\n"
|
---|
889 | << "<head>\n"
|
---|
890 | << "<title>Error</title>\n"
|
---|
891 | << "</head>\n"
|
---|
892 | << "<body bgcolor=\"#ffffff\" text=\"#000000\" link=\"#006666\" "
|
---|
893 | << "alink=\"#cc9900\" vlink=\"#666633\">\n"
|
---|
894 | << "<h2>Oops!</h2>\n"
|
---|
895 | << message
|
---|
896 | << "\n</body>\n"
|
---|
897 | << "</html>\n";
|
---|
898 | return;
|
---|
899 | }
|
---|
900 |
|
---|
901 |
|
---|
902 |
|
---|
903 | statusaction::statusaction () {
|
---|
904 | disabled = true;
|
---|
905 | recpt = NULL;
|
---|
906 |
|
---|
907 | // this action uses cgi variable "a"
|
---|
908 | cgiarginfo arg_ainfo;
|
---|
909 | arg_ainfo.shortname = "a";
|
---|
910 | arg_ainfo.longname = "action";
|
---|
911 | arg_ainfo.multiplechar = true;
|
---|
912 | arg_ainfo.defaultstatus = cgiarginfo::weak;
|
---|
913 | arg_ainfo.argdefault = "status";
|
---|
914 | arg_ainfo.savedarginfo = cgiarginfo::must;
|
---|
915 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
916 |
|
---|
917 | // "sp" -- status page
|
---|
918 | arg_ainfo.shortname = "sp";
|
---|
919 | arg_ainfo.longname = "status page";
|
---|
920 | arg_ainfo.multiplechar = true;
|
---|
921 | arg_ainfo.defaultstatus = cgiarginfo::good;
|
---|
922 | arg_ainfo.argdefault = "frameset";
|
---|
923 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
924 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
925 |
|
---|
926 | // "pr" -- protocol
|
---|
927 | arg_ainfo.shortname = "pr";
|
---|
928 | arg_ainfo.longname = "protocol";
|
---|
929 | arg_ainfo.multiplechar = true;
|
---|
930 | arg_ainfo.defaultstatus = cgiarginfo::none;
|
---|
931 | arg_ainfo.argdefault = "";
|
---|
932 | arg_ainfo.savedarginfo = cgiarginfo::can;
|
---|
933 | argsinfo.addarginfo (NULL, arg_ainfo);
|
---|
934 | }
|
---|
935 |
|
---|
936 | statusaction::~statusaction () {
|
---|
937 | }
|
---|
938 |
|
---|
939 | bool statusaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &/*args*/,
|
---|
940 | ostream &/*logout*/) {
|
---|
941 | return true;
|
---|
942 | }
|
---|
943 |
|
---|
944 | void statusaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
|
---|
945 | response_t &response, text_t &response_data,
|
---|
946 | ostream &/*logout*/) {
|
---|
947 | response = content;
|
---|
948 | response_data = "text/html";
|
---|
949 | }
|
---|
950 |
|
---|
951 | bool statusaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
|
---|
952 | browsermapclass * /*browsers*/, displayclass &disp,
|
---|
953 | outconvertclass &outconvert, ostream &textout,
|
---|
954 | ostream &logout) {
|
---|
955 | // make sure the status function is enabled
|
---|
956 | if (disabled) {
|
---|
957 | output_errorpage (outconvert, textout, logout,
|
---|
958 | "The status action is disabled. "
|
---|
959 | "See the documentation (what documentation!) on how "
|
---|
960 | "to enable it.");
|
---|
961 | return true;
|
---|
962 | }
|
---|
963 |
|
---|
964 | // make sure we know about a receptionist
|
---|
965 | if (recpt == NULL) {
|
---|
966 | output_errorpage (outconvert, textout, logout,
|
---|
967 | "The status action does not contain information\n"
|
---|
968 | "about any receptionists. The method set_receptionist\n"
|
---|
969 | "was probably not called from the module which instantiated\n"
|
---|
970 | "this status action.\n");
|
---|
971 | return true;
|
---|
972 | }
|
---|
973 |
|
---|
974 | // check to make sure status.dm was read in
|
---|
975 | const recptconf &rcinfo = recpt->get_configinfo ();
|
---|
976 | text_tset::const_iterator macrohere = rcinfo.macrofiles.begin ();
|
---|
977 | text_tset::const_iterator macroend = rcinfo.macrofiles.end ();
|
---|
978 | while (macrohere != macroend) {
|
---|
979 | if (*macrohere == "status.dm") break;
|
---|
980 | macrohere++;
|
---|
981 | }
|
---|
982 | if (macrohere == macroend) {
|
---|
983 | output_errorpage (outconvert, textout, logout,
|
---|
984 | "The status.dm file was not read in. This macro file is\n"
|
---|
985 | "needed to display configuration and status information.\n");
|
---|
986 | return true;
|
---|
987 | }
|
---|
988 |
|
---|
989 | // output the required status page
|
---|
990 | text_t &arg_sp = args["sp"];
|
---|
991 | if (arg_sp == "frameset") output_frameset (args, disp, outconvert, textout, logout);
|
---|
992 | else if (arg_sp == "select") output_select (args, disp, outconvert, textout, logout);
|
---|
993 | else if (arg_sp == "welcome") output_welcome (args, protos, disp, outconvert, textout, logout);
|
---|
994 | else if (arg_sp == "generalinfo") output_generalinfo (args, disp, outconvert, textout, logout);
|
---|
995 | else if (arg_sp == "argumentinfo") output_argumentinfo (args, disp, outconvert, textout, logout);
|
---|
996 | else if (arg_sp == "actioninfo") output_actioninfo (args, disp, outconvert, textout, logout);
|
---|
997 | else if (arg_sp == "protocolinfo") output_protocolinfo (args, disp, outconvert, textout, logout);
|
---|
998 | else if (arg_sp == "collectioninfo") output_collectioninfo (args, disp, outconvert, textout, logout);
|
---|
999 | else if (arg_sp == "initlog") output_initlog (args, disp, outconvert, textout, logout);
|
---|
1000 | else if (arg_sp == "errorlog") output_errorlog (args, disp, outconvert, textout, logout);
|
---|
1001 | else {
|
---|
1002 | output_errorpage (outconvert, textout, logout,
|
---|
1003 | "Unknown page \"" + arg_sp + "\".\n");
|
---|
1004 | }
|
---|
1005 |
|
---|
1006 | return true;
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | void statusaction::configure (const text_t &key, const text_tarray &cfgline) {
|
---|
1010 | if ((key == "status") && (cfgline.size() == 1) &&
|
---|
1011 | (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {
|
---|
1012 | disabled = false;
|
---|
1013 | } else {
|
---|
1014 | // call the parent class to deal with the things which
|
---|
1015 | // are not dealt with here
|
---|
1016 | action::configure (key, cfgline);
|
---|
1017 | }
|
---|
1018 | }
|
---|
1019 |
|
---|