/********************************************************************** * * statusaction.cpp -- * Copyright (C) 1999 The New Zealand Digital Library Project * * A component of the Greenstone digital library software * from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *********************************************************************/ #include "statusaction.h" #include "fileutil.h" #include "htmlutils.h" #include void statusaction::output_frameset (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { textout << outconvert << disp << "_status:frameset_\n"; } void statusaction::output_select (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { textout << outconvert << disp << "_status:header_(selector)\n" "_status:select_\n" "_status:footer_\n"; } void statusaction::output_welcome (cgiargsclass &/*args*/, recptprotolistclass *protos, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { if (recpt == NULL) return; textout << outconvert << disp << "_status:infoheader_(_titlewelcome_)\n" << "_status:welcome_" << "
\n" << "" << "\n"; recptprotolistclass::iterator rprotolist_here = protos->begin(); recptprotolistclass::iterator rprotolist_end = protos->end(); while (rprotolist_here != rprotolist_end) { if ((*rprotolist_here).p != NULL) { text_t protoname = (*rprotolist_here).p->get_protocol_name(); text_tarray collist; comerror_t err; (*rprotolist_here).p->get_collection_list (collist, err, logout); if (err == noError) { text_tarray::iterator collist_here = collist.begin(); text_tarray::iterator collist_end = collist.end(); while (collist_here != collist_end) { textout << outconvert << disp << ""; ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout); if (cinfo != NULL) { text_t collname = *collist_here; text_tmap::iterator it = cinfo->collectionmeta.find("collectionname"); if (it != cinfo->collectionmeta.end()) collname = (*it).second; textout << ""; if (cinfo->isPublic) textout << ""; else textout << ""; if (cinfo->buildDate > 0) textout << outconvert << ""; else textout << ""; } else { textout << ""; } textout << "\n"; collist_here ++; } } } rprotolist_here ++; } textout << "
abbrev.collectionpublic?running?
" << *collist_here << ""; if (cinfo->buildDate > 0) textout << outconvert << disp << ""; textout << outconvert << disp << collname; if (cinfo->buildDate > 0) textout << ""; textout << "yesnoyesno
\n"; textout << outconvert << disp << "_status:infofooter_\n"; } void statusaction::output_generalinfo (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { if (recpt == NULL) return; const recptconf &rcinfo = recpt->get_configinfo (); textout << outconvert << disp << "_status:infoheader_(General Information)\n"; textout << outconvert << "

General information

\n" << "\n" << "\n" << "\n" << "\n" << "\n" << "\n" << "\n"; // macrofiles textout << outconvert << "\n"; // saveconf textout << outconvert << "\n"; // usecookies textout << outconvert << "\n"; // logcgiargs textout << outconvert << "\n"; // pageparams textout << outconvert << "\n"; // macroprecedence textout << outconvert << "\n"; // arguments cgiargsinfoclass *rcargsinfo = recpt->get_cgiargsinfo_ptr (); if (rcargsinfo != NULL) { textout << outconvert << "\n"; } // actions actionmapclass *actions = recpt->get_actionmap_ptr(); if (actions != NULL) { textout << outconvert << "\n"; } // browsers browsermapclass *browsers = recpt->get_browsermap_ptr(); if (browsers != NULL) { textout << outconvert << "\n"; } // protocols recptprotolistclass *protocols = recpt->get_recptprotolist_ptr (); if (protocols != NULL) { textout << outconvert << "\n"; } // converters convertinfoclass *converters = recpt->get_convertinfo_ptr (); if (converters != NULL) { textout << outconvert << "\n"; } textout << outconvert << disp << "
gsdlhome\"" << rcinfo.gsdlhome << "\"
collection\"" << rcinfo.collection << "\"
collectdir\"" << rcinfo.collectdir << "\"
httpprefix\"" << rcinfo.httpprefix << "\"
httpimg\"" << rcinfo.httpimg << "\"
gwcgi\"" << rcinfo.gwcgi << "\"
macrofiles"; text_tset::const_iterator macrohere = rcinfo.macrofiles.begin (); text_tset::const_iterator macroend = rcinfo.macrofiles.end (); bool macrofirst = true; while (macrohere != macroend) { if (!macrofirst) textout << outconvert << ", "; macrofirst = false; textout << outconvert << "\"" << *macrohere << "\""; macrohere++; } textout << outconvert << "
saveconf\"" << rcinfo.saveconf << "\"
usecookies\""; if (rcinfo.usecookies) textout << outconvert << "true"; else textout << outconvert << "false"; textout << outconvert << "\"
logcgiargs\""; if (rcinfo.logcgiargs) textout << outconvert << "true"; else textout << outconvert << "false"; textout << outconvert << "\"
pageparams"; text_tmap::const_iterator params_here = rcinfo.pageparams.begin(); text_tmap::const_iterator params_end = rcinfo.pageparams.end(); bool params_first = true; while (params_here != params_end) { if (!params_first) textout << outconvert << ", "; params_first = false; textout << outconvert << "\"" << (*params_here).first << "\" != \"" << (*params_here).second << "\""; params_here++; } textout << outconvert << "
macroprecedence\"" << rcinfo.macroprecedence << "\"
arguments"; cgiargsinfoclass::const_iterator argsinfohere = rcargsinfo->begin (); cgiargsinfoclass::const_iterator argsinfoend = rcargsinfo->end (); bool argsinfofirst = true; while (argsinfohere != argsinfoend) { if (!argsinfofirst) textout << outconvert << ", "; argsinfofirst = false; textout << outconvert << "\"" << (*argsinfohere).second.shortname << "\""; argsinfohere++; } textout << outconvert << "
actions"; actionptrmap::iterator actionshere = actions->begin (); actionptrmap::iterator actionsend = actions->end (); bool actionsfirst = true; while (actionshere != actionsend) { if (!actionsfirst) textout << outconvert << ", "; actionsfirst = false; assert ((*actionshere).second.a != NULL); if ((*actionshere).second.a != NULL) { textout << outconvert << "\"" << (*actionshere).second.a->get_action_name() << "\""; } actionshere++; } textout << outconvert << "
browsers"; browserptrmap::iterator browsershere = browsers->begin (); browserptrmap::iterator browsersend = browsers->end (); bool browsersfirst = true; while (browsershere != browsersend) { if (!browsersfirst) textout << outconvert << ", "; browsersfirst = false; assert ((*browsershere).second.b != NULL); if ((*browsershere).second.b != NULL) { textout << outconvert << "\"" << (*browsershere).second.b->get_browser_name() << "\""; } browsershere++; } textout << outconvert << "
protocols"; recptprotolistclass::iterator protohere = protocols->begin (); recptprotolistclass::iterator protoend = protocols->end (); bool protofirst = true; while (protohere != protoend) { if (!protofirst) textout << outconvert << ", "; protofirst = false; if ((*protohere).p != NULL) { textout << outconvert << "\"" << (*protohere).p->get_protocol_name() << "\""; } protohere++; } textout << outconvert << "
converters"; convertinfoclass::iterator converthere = converters->begin (); convertinfoclass::iterator convertend = converters->end (); bool convertfirst = true; while (converthere != convertend) { if (!convertfirst) textout << outconvert << ", "; convertfirst = false; textout << outconvert << "\"" << (*converthere).second.name << "\""; converthere++; } textout << outconvert << "
\n_status:infofooter_\n"; } void statusaction::output_argumentinfo (cgiargsclass &args, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { if (recpt == NULL) return; cgiargsinfoclass *rcargsinfo = recpt->get_cgiargsinfo_ptr (); if (rcargsinfo == NULL) return; textout << outconvert << disp << "_status:infoheader_(Argument Information)\n"; textout << outconvert << "

Argument information

\n" << ""; // argument information textout << outconvert << "" << "" << "" << "" << "\n"; cgiargsinfoclass::const_iterator argsinfohere = rcargsinfo->begin(); cgiargsinfoclass::const_iterator argsinfoend = rcargsinfo->end(); text_t *arg_value; while (argsinfohere != argsinfoend) { const cgiarginfo &ainfo = (*argsinfohere).second; textout << outconvert << "\n"; textout << outconvert << "\n"; if (ainfo.multiplechar) textout << outconvert << "\n"; else textout << outconvert << "\n"; if (ainfo.multiplevalue) textout << outconvert << "\n"; else textout << outconvert << "\n"; textout << outconvert << "\n"; switch (ainfo.defaultstatus) { case cgiarginfo::none: textout << outconvert << "\n"; break; case cgiarginfo::weak: textout << outconvert << "\n"; break; case cgiarginfo::good: textout << outconvert << "\n"; break; case cgiarginfo::config: textout << outconvert << "\n"; break; case cgiarginfo::imperative: textout << outconvert << "\n"; break; } switch (ainfo.savedarginfo) { case cgiarginfo::mustnot: textout << outconvert << "\n"; break; case cgiarginfo::can: textout << outconvert << "\n"; break; case cgiarginfo::must: textout << outconvert << "\n"; break; } arg_value = args.getarg (ainfo.shortname); if (arg_value == NULL) textout << outconvert << "\n"; else textout << outconvert << "\n"; argsinfohere ++; } textout << outconvert << disp << "
short namelong namemultiple char?multiple value?defaultdefault statussaved argscurrent value
" << ainfo.shortname << "" << ainfo.longname << "yesnoyesno" << ainfo.argdefault << "noneweakgoodconfigimperativemustnotcanmust
\"" << *arg_value << "\"
\n_status:infofooter_\n"; } void statusaction::output_actioninfo (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { if (recpt == NULL) return; actionmapclass *actions = recpt->get_actionmap_ptr(); textout << outconvert << disp << "_status:infoheader_(Action Information)\n"; textout << outconvert << "

Action information

\n" << ""; // action information if (actions != NULL) { textout << outconvert << "\n"; actionptrmap::iterator actionshere = actions->begin (); actionptrmap::iterator actionsend = actions->end (); while (actionshere != actionsend) { assert ((*actionshere).second.a != NULL); if ((*actionshere).second.a != NULL) { textout << outconvert << "\n"; } actionshere++; } } textout << outconvert << disp << "
action namecgi arguments
" << (*actionshere).second.a->get_action_name() << ""; cgiargsinfoclass argsinfo = (*actionshere).second.a->getargsinfo(); cgiargsinfoclass::const_iterator argsinfohere = argsinfo.begin (); cgiargsinfoclass::const_iterator argsinfoend = argsinfo.end (); bool aifirst = true; while (argsinfohere != argsinfoend) { if (!aifirst) textout << outconvert << ", "; aifirst = false; textout << outconvert << (*argsinfohere).second.shortname; argsinfohere++; } textout << outconvert << "
\n_status:infofooter_\n"; } void statusaction::output_browserinfo (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { if (recpt == NULL) return; browsermapclass *browsers = recpt->get_browsermap_ptr(); textout << outconvert << disp << "_status:infoheader_(Browser Information)\n"; textout << outconvert << "

Browser information

\n" << ""; // browser information if (browsers != NULL) { textout << outconvert << "\n"; browserptrmap::iterator browsershere = browsers->begin (); browserptrmap::iterator browsersend = browsers->end (); while (browsershere != browsersend) { assert ((*browsershere).second.b != NULL); if ((*browsershere).second.b != NULL) { textout << outconvert << "\n"; } browsershere++; } } textout << outconvert << disp << "
browser namedefault formatstring
" << (*browsershere).second.b->get_browser_name() << "" << html_safe ((*browsershere).second.b->get_default_formatstring()) << "
\n_status:infofooter_\n"; } void statusaction::output_protocolinfo (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { if (recpt == NULL) return; const recptconf &rcinfo = recpt->get_configinfo (); bool colspecific = !rcinfo.collection.empty(); bool unreachablecol = false; recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr (); if (rprotolist == NULL) return; textout << outconvert << disp << "_status:infoheader_(Protocol Information)\n"; textout << outconvert << "

Protocol information

\n" << "\n" << "\n"; text_t protoname; recptprotolistclass::iterator rprotolist_here = rprotolist->begin(); recptprotolistclass::iterator rprotolist_end = rprotolist->end(); while (rprotolist_here != rprotolist_end) { if ((*rprotolist_here).p != NULL) { protoname = (*rprotolist_here).p->get_protocol_name(); textout << outconvert << "\n"; } rprotolist_here++; } textout << outconvert << "
protocolcollections
" << protoname << ""; text_tarray collist; comerror_t err; (*rprotolist_here).p->get_collection_list (collist, err, logout); if (err == noError) { text_tarray::iterator collist_here = collist.begin(); text_tarray::iterator collist_end = collist.end(); bool first = true; while (collist_here != collist_end) { if (!first) textout << outconvert << ", "; first = false; if (colspecific && *collist_here != rcinfo.collection) { unreachablecol = true; textout << outconvert << "\"" << *collist_here << "\""; } else { textout << outconvert << disp << "\"" << *collist_here << "\""; } collist_here++; } } else { textout << outconvert << "Error (" << get_comerror_string (err) << ") while getting collect list\n"; } textout << outconvert << "
\n"; if (unreachablecol) { textout << outconvert << "Warning: the receptionist is running in collection specific\n" << "mode making some of the collections unreachable.\n"; } textout << outconvert << disp << "_status:infofooter_\n"; } void statusaction::output_collectioninfo (cgiargsclass &args, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { if (recpt == NULL) return; textout << outconvert << disp << "_status:infoheader_(Collection info)\n"; textout << outconvert << "

Collection info

\n"; // get the list of protocols recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr (); if (rprotolist == NULL) return; // look for the desired protocol text_t &arg_pr = args["pr"]; text_t &arg_c = args["c"]; recptproto *rproto = NULL; recptprotolistclass::iterator rprotolist_here = rprotolist->begin(); recptprotolistclass::iterator rprotolist_end = rprotolist->end(); while (rprotolist_here != rprotolist_end) { rproto = (*rprotolist_here).p; if (rproto != NULL && rproto->get_protocol_name() == arg_pr) { // see if the protocol has the collection bool hascollection; comerror_t err; rproto->has_collection (arg_c, hascollection, err, logout); if (err == noError && hascollection) break; } rprotolist_here++; } if (rprotolist_here == rprotolist_end) { textout << outconvert << "Protocol \"" << arg_pr << "\" with collection \"" << arg_c << "\" was not found\n"; } else { // rproto can't be NULL to get here ColInfoResponse_t *collectinfo = recpt->get_collectinfo_ptr (rproto, arg_c, logout); if (collectinfo != NULL) { textout << outconvert << "\n" << "\n" << "\n" << "\n" << "\n" << "\n" << "\n" << "\n"; textout << "\n"; textout << "\n"; textout << outconvert << "\n" << "\n" << "\n" << "\n" << "\n" << "\n" << "
collection name\"" << collectinfo->shortInfo.name << "\"
host\"" << collectinfo->shortInfo.host << "\"
port\"" << collectinfo->shortInfo.port << "\"
is public?"; if (collectinfo->isPublic) textout << outconvert << "true"; else textout << outconvert << "false"; textout << outconvert << "
is beta?"; if (collectinfo->isBeta) textout << outconvert << "true"; else textout << outconvert << "false"; textout << outconvert << "
build date\"" << collectinfo->buildDate << "\"
interface languages"; text_tarray::iterator languages_here = collectinfo->languages.begin(); text_tarray::iterator languages_end = collectinfo->languages.end(); bool languages_first = true; while (languages_here != languages_end) { if (!languages_first) textout << outconvert << ", "; languages_first = false; textout << outconvert << "\"" << *languages_here << "\""; languages_here++; } textout << "
collection metadata\n"; text_tmap::iterator meta_here = collectinfo->collectionmeta.begin(); text_tmap::iterator meta_end = collectinfo->collectionmeta.end(); while (meta_here != meta_end) { textout << outconvert << "\n"; meta_here ++; } textout << "
" << (*meta_here).first << "" << (*meta_here).second << "
format info\n"; text_tmap::iterator format_here = collectinfo->format.begin(); text_tmap::iterator format_end = collectinfo->format.end(); while (format_here != format_end) { textout << outconvert << "\n"; format_here ++; } textout << "
" << (*format_here).first << "" << html_safe((*format_here).second) << "
building info\n"; text_tmap::iterator building_here = collectinfo->building.begin(); text_tmap::iterator building_end = collectinfo->building.end(); while (building_here != building_end) { textout << outconvert << "\n"; building_here ++; } textout << "
" << (*building_here).first << "" << (*building_here).second << "
number of documents\"" << collectinfo->numDocs << "\"
number of sections\"" << collectinfo->numSections << "\"
number of words\"" << collectinfo->numWords << "\"
number of bytes\"" << collectinfo->numBytes << "\"
preferred receptionist\"" << collectinfo->receptionist << "\"
"; } else { textout << "ERROR (statusaction::output_collectioninfo): while getting collect information\n"; } InfoFiltersResponse_t filterinfo; InfoFilterOptionsRequest_t filteroptions_request; InfoFilterOptionsResponse_t filteroptions; comerror_t err; rproto->get_filterinfo (arg_c, filterinfo, err, logout); if (err == noError) { text_tset::iterator filternames_here = filterinfo.filterNames.begin(); text_tset::iterator filternames_end = filterinfo.filterNames.end(); while (filternames_here != filternames_end) { textout << outconvert << "
\n" << "

Filter options for \"" << (*filternames_here) << "\"

\n" << "\n" << "" << "\n"; filteroptions_request.clear(); filteroptions_request.filterName = *filternames_here; rproto->get_filteroptions (arg_c, filteroptions_request, filteroptions, err, logout); if (err == noError) { FilterOption_tmap::iterator filteropt_here = filteroptions.filterOptions.begin(); FilterOption_tmap::iterator filteropt_end = filteroptions.filterOptions.end(); while (filteropt_here != filteropt_end) { textout << outconvert << "\n" << "\n" << "\n" << "\n" << "\n"; filteropt_here++; } textout << outconvert << "
option nametyperepeatabledefault valuevalid values
\"" << (*filteropt_here).second.name << "\""; text_t type_string; switch ((*filteropt_here).second.type) { case FilterOption_t::booleant: type_string = "boolean"; break; case FilterOption_t::integert: type_string = "integer"; break; case FilterOption_t::enumeratedt: type_string = "enumerated"; break; case FilterOption_t::stringt: type_string = "string"; break; } textout << outconvert << type_string << ""; text_t repeat_string; switch ((*filteropt_here).second.repeatable) { case FilterOption_t::onePerQuery: repeat_string = "one per query"; break; case FilterOption_t::onePerTerm: repeat_string = "one per term"; break; case FilterOption_t::nPerTerm: repeat_string = "n per term"; break; } textout << outconvert << repeat_string << "\"" << (*filteropt_here).second.defaultValue << "\""; text_tarray::iterator valid_here = (*filteropt_here).second.validValues.begin(); text_tarray::iterator valid_end = (*filteropt_here).second.validValues.end(); bool valid_first = true; while (valid_here != valid_end) { if (!valid_first) textout << outconvert << ", "; valid_first = false; textout << outconvert << "\"" << *valid_here << "\""; valid_here++; } textout << outconvert << "
\n"; } else { textout << outconvert << "Error (" << get_comerror_string (err) << ") while getting filter option information\n"; } filternames_here++; } } else { textout << outconvert << "Error (" << get_comerror_string (err) << ") while getting filter information\n"; } } textout << outconvert << disp << "_status:infofooter_\n"; } void statusaction::output_initlog (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &/*logout*/) { if (recpt == NULL) return; const recptconf &rcinfo = recpt->get_configinfo (); text_t initfilename = filename_cat (rcinfo.gsdlhome, "etc", "initout.txt"); char *cinitfilename = initfilename.getcstr(); if (cinitfilename == NULL) return; textout << outconvert << disp << "_status:infoheader_(Init log)\n"; textout << outconvert << "

Init log

\n"; #ifdef GSDL_USE_IOS_H ifstream initin (cinitfilename, ios::in | ios::nocreate); #else ifstream initin (cinitfilename, ios::in); #endif delete cinitfilename; if (initin) { textout << outconvert << "

The initialisation error log, " << initfilename << ", contains the\n"; textout << outconvert << "following information:\n\n"; text_t errorpage = "

\n";
    
    char c;
    initin.get(c);
    while (!initin.eof ()) {
      errorpage.push_back(c);
      initin.get(c);
    }
    
    errorpage += "
\n"; initin.close(); textout << outconvert << errorpage; } else { textout << outconvert << "Couldn't read initialisation error log, " << initfilename << ".\n"; } textout << outconvert << disp << "_status:infofooter_\n"; } void statusaction::output_errorlog (cgiargsclass &/*args*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { if (recpt == NULL) return; const recptconf &rcinfo = recpt->get_configinfo (); text_t errfilename = filename_cat (rcinfo.gsdlhome, "etc", "errout.txt"); char *cerrfilename = errfilename.getcstr(); if (cerrfilename == NULL) return; textout << outconvert << disp << "_status:infoheader_(Error log)\n"; textout << outconvert << "

Error log

\n"; logout << flush; #ifdef GSDL_USE_IOS_H ifstream errin (cerrfilename, ios::in | ios::nocreate); #else ifstream errin (cerrfilename, ios::in); #endif delete cerrfilename; if (errin) { textout << outconvert << "

The error log, " << errfilename << ", contains the\n"; textout << outconvert << "following information:\n\n"; text_t errorpage = "

\n";

    char c;
    errin.get(c);
    while (!errin.eof ()) {
      errorpage.push_back(c);
      errin.get(c);
    }
    
    errorpage += "
\n"; errin.close(); textout << outconvert << errorpage; } else { textout << outconvert << "Couldn't read error log, " << errfilename << ".\n"; } textout << outconvert << disp << "_status:infofooter_\n"; } void statusaction::output_errorpage (outconvertclass &outconvert, ostream &textout, ostream &/*logout*/, text_t message) { textout << outconvert << "\n" << "\n" << "Error\n" << "\n" << "\n" << "

Oops!

\n" << message << "\n\n" << "\n"; return; } statusaction::statusaction () { disabled = true; recpt = NULL; // this action uses cgi variable "a" cgiarginfo arg_ainfo; arg_ainfo.shortname = "a"; arg_ainfo.longname = "action"; arg_ainfo.multiplechar = true; arg_ainfo.defaultstatus = cgiarginfo::weak; arg_ainfo.argdefault = "status"; arg_ainfo.savedarginfo = cgiarginfo::must; argsinfo.addarginfo (NULL, arg_ainfo); // "sp" -- status page arg_ainfo.shortname = "sp"; arg_ainfo.longname = "status page"; arg_ainfo.multiplechar = true; arg_ainfo.defaultstatus = cgiarginfo::good; arg_ainfo.argdefault = "frameset"; arg_ainfo.savedarginfo = cgiarginfo::can; argsinfo.addarginfo (NULL, arg_ainfo); // "pr" -- protocol arg_ainfo.shortname = "pr"; arg_ainfo.longname = "protocol"; arg_ainfo.multiplechar = true; arg_ainfo.defaultstatus = cgiarginfo::none; arg_ainfo.argdefault = ""; arg_ainfo.savedarginfo = cgiarginfo::can; argsinfo.addarginfo (NULL, arg_ainfo); } statusaction::~statusaction () { } bool statusaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &/*args*/, ostream &/*logout*/) { return true; } void statusaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/, response_t &response, text_t &response_data, ostream &/*logout*/) { response = content; response_data = "text/html"; } bool statusaction::do_action (cgiargsclass &args, recptprotolistclass *protos, browsermapclass * /*browsers*/, displayclass &disp, outconvertclass &outconvert, ostream &textout, ostream &logout) { // make sure the status function is enabled if (disabled) { output_errorpage (outconvert, textout, logout, "The status action is disabled. " "See the documentation (what documentation!) on how " "to enable it."); return true; } // make sure we know about a receptionist if (recpt == NULL) { output_errorpage (outconvert, textout, logout, "The status action does not contain information\n" "about any receptionists. The method set_receptionist\n" "was probably not called from the module which instantiated\n" "this status action.\n"); return true; } // check to make sure status.dm was read in const recptconf &rcinfo = recpt->get_configinfo (); text_tset::const_iterator macrohere = rcinfo.macrofiles.begin (); text_tset::const_iterator macroend = rcinfo.macrofiles.end (); while (macrohere != macroend) { if (*macrohere == "status.dm") break; macrohere++; } if (macrohere == macroend) { output_errorpage (outconvert, textout, logout, "The status.dm file was not read in. This macro file is\n" "needed to display configuration and status information.\n"); return true; } // output the required status page text_t &arg_sp = args["sp"]; if (arg_sp == "frameset") output_frameset (args, disp, outconvert, textout, logout); else if (arg_sp == "select") output_select (args, disp, outconvert, textout, logout); else if (arg_sp == "welcome") output_welcome (args, protos, disp, outconvert, textout, logout); else if (arg_sp == "generalinfo") output_generalinfo (args, disp, outconvert, textout, logout); else if (arg_sp == "argumentinfo") output_argumentinfo (args, disp, outconvert, textout, logout); else if (arg_sp == "actioninfo") output_actioninfo (args, disp, outconvert, textout, logout); else if (arg_sp == "browserinfo") output_browserinfo (args, disp, outconvert, textout, logout); else if (arg_sp == "protocolinfo") output_protocolinfo (args, disp, outconvert, textout, logout); else if (arg_sp == "collectioninfo") output_collectioninfo (args, disp, outconvert, textout, logout); else if (arg_sp == "initlog") output_initlog (args, disp, outconvert, textout, logout); else if (arg_sp == "errorlog") output_errorlog (args, disp, outconvert, textout, logout); else { output_errorpage (outconvert, textout, logout, "Unknown page \"" + arg_sp + "\".\n"); } return true; } void statusaction::configure (const text_t &key, const text_tarray &cfgline) { if ((key == "status") && (cfgline.size() == 1) && (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) { disabled = false; } else { // call the parent class to deal with the things which // are not dealt with here action::configure (key, cfgline); } }