Ignore:
Timestamp:
2000-07-13T10:21:53+12:00 (24 years ago)
Author:
sjboddie
Message:

merged changes to trunk into New_Config_Format branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/New_Config_Format-branch/gsdl/src/recpt/statusaction.cpp

    r995 r1279  
    2828/*
    2929   $Log$
     30   Revision 1.25.4.1  2000/07/12 22:21:46  sjboddie
     31   merged changes to trunk into New_Config_Format branch
     32
     33   Revision 1.31  2000/07/05 21:49:36  sjboddie
     34   Receptionist now caches collection information to avoid making multiple
     35   get_collectinfo calls to collection server
     36
     37   Revision 1.30  2000/07/03 22:26:27  nzdl
     38   fixed a few errors in the macro files (and one in some text printed out
     39   by the statusaction)
     40
     41   Revision 1.29  2000/06/29 02:47:21  sjboddie
     42   added browser info (i.e VList, HList etc.) to status pages
     43
     44   Revision 1.28  2000/06/29 00:22:59  sjboddie
     45   added new numsections field to collection info and made the statusaction
     46   recognize it
     47
     48   Revision 1.27  2000/05/12 03:09:24  sjboddie
     49   minor modifications to get web library compiling under VC++ 6.0
     50
     51   Revision 1.26  2000/04/19 22:30:23  sjboddie
     52   tidied up status pages and end-user collection building
     53
    3054   Revision 1.25  2000/02/29 21:00:31  sjboddie
    3155   fixed some compiler warnings
     
    116140
    117141 */
    118 
    119142
    120143#include "statusaction.h"
     
    138161}
    139162
    140 void statusaction::output_welcome (cgiargsclass &/*args*/, displayclass &disp,
    141                   outconvertclass &outconvert,
    142                   ostream &textout, ostream &/*logout*/) {
    143   textout << outconvert << disp << "_status:infoheader_(_titlewelcome_)\n"
    144     "_status:welcome_\n"
    145     "_status:infofooter_\n";
     163void statusaction::output_welcome (cgiargsclass &/*args*/, recptprotolistclass *protos,
     164                   displayclass &disp, outconvertclass &outconvert,
     165                   ostream &textout, ostream &logout) {
     166
     167  if (recpt == NULL) return;
     168
     169  textout << outconvert << disp
     170      << "_status:infoheader_(_titlewelcome_)\n"
     171      << "_status:welcome_"
     172      << "<center><table width=_pagewidth_>\n"
     173      << "<th align=left>abbrev.</th><th align=left>collection</th>"
     174      << "<th align=left>public?</th><th align=left>running?</th></tr>\n";
     175
     176  recptprotolistclass::iterator rprotolist_here = protos->begin();
     177  recptprotolistclass::iterator rprotolist_end = protos->end();
     178  while (rprotolist_here != rprotolist_end) {
     179    if ((*rprotolist_here).p != NULL) {
     180      text_t protoname = (*rprotolist_here).p->get_protocol_name();
     181      text_tarray collist;
     182      comerror_t err;
     183      (*rprotolist_here).p->get_collection_list (collist, err, logout);
     184      if (err == noError) {
     185    text_tarray::iterator collist_here = collist.begin();
     186    text_tarray::iterator collist_end = collist.end();
     187
     188    while (collist_here != collist_end) {
     189
     190        textout << outconvert << disp
     191            << "<tr><td><a href=\"_gwcgi_?e=_compressedoptions_&a=status&sp=collectioninfo&pr="
     192            << protoname
     193            << "&c="
     194            << *collist_here
     195            << "\">"
     196            << *collist_here
     197            << "</a></td>";
     198
     199      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
     200      if (cinfo != NULL) {
     201        text_t collname = *collist_here;
     202        text_tmap::iterator it = cinfo->collectionmeta.find("collectionname");
     203        if (it != cinfo->collectionmeta.end()) collname = (*it).second;
     204
     205        textout << "<td>";
     206        if (cinfo->buildDate > 0)
     207          textout << outconvert << disp
     208              << "<a href=\"_httppagex_(about)&c=" << *collist_here
     209              << "\" target=\\_top>";
     210
     211        textout << outconvert << disp << collname;
     212
     213        if (cinfo->buildDate > 0) textout << "</a>";
     214
     215        textout << "</td>";
     216
     217        if (cinfo->isPublic) textout << "<td>yes</td>";
     218        else textout << "<td>no</td>";
     219       
     220        if (cinfo->buildDate > 0)
     221          textout << outconvert << "<td>yes</td>";
     222        else
     223          textout << "<td>no</td>";
     224       
     225      } else {
     226        textout << "<td></td><td></td><td></td>";
     227      }
     228
     229      textout << "</tr>\n";
     230      collist_here ++;
     231    }
     232      }
     233    }
     234    rprotolist_here ++;
     235  }
     236
     237  textout << "</table></center>\n";
     238  textout << outconvert << disp << "_status:infofooter_\n";
    146239}
    147240
     
    256349  }
    257350 
     351  // browsers
     352  browsermapclass *browsers = recpt->get_browsermap_ptr();
     353  if (browsers != NULL) {
     354    textout << outconvert << "<tr valign=top><th>browsers</th><td>";
     355   
     356    browserptrmap::iterator browsershere = browsers->begin ();
     357    browserptrmap::iterator browsersend = browsers->end ();
     358    bool browsersfirst = true;
     359    while (browsershere != browsersend) {
     360      if (!browsersfirst) textout << outconvert << ", ";
     361      browsersfirst = false;
     362      assert ((*browsershere).second.b != NULL);
     363      if ((*browsershere).second.b != NULL) {
     364    textout << outconvert << "\"" << (*browsershere).second.b->get_browser_name() << "\"";
     365      }
     366      browsershere++;
     367    }
     368   
     369    textout << outconvert << "</td></tr>\n";
     370  }
     371
    258372  // protocols
    259373  recptprotolistclass *protocols = recpt->get_recptprotolist_ptr ();
     
    399513}
    400514
     515void statusaction::output_browserinfo (cgiargsclass &/*args*/, displayclass &disp,
     516                       outconvertclass &outconvert,
     517                       ostream &textout, ostream &/*logout*/) {
     518  if (recpt == NULL) return;
     519  browsermapclass *browsers = recpt->get_browsermap_ptr();
     520
     521  textout << outconvert << disp << "_status:infoheader_(Browser Information)\n";
     522  textout << outconvert
     523      << "<h2>Browser information</h2>\n"
     524      << "<table>";
     525
     526  // browser information
     527  if (browsers != NULL) {
     528    textout << outconvert
     529        << "<tr><th>browser name</th><th>default formatstring</th></tr>\n";
     530   
     531    browserptrmap::iterator browsershere = browsers->begin ();
     532    browserptrmap::iterator browsersend = browsers->end ();
     533    while (browsershere != browsersend) {
     534      assert ((*browsershere).second.b != NULL);
     535      if ((*browsershere).second.b != NULL) {
     536    textout << outconvert
     537        << "<tr><td>" << (*browsershere).second.b->get_browser_name()
     538        << "</td><td>" << html_safe ((*browsershere).second.b->get_default_formatstring())
     539        << "</td></tr>\n";
     540      }
     541      browsershere++;
     542    }
     543  }
     544 
     545  textout << outconvert << disp << "</table>\n_status:infofooter_\n";
     546}
     547
    401548void statusaction::output_protocolinfo (cgiargsclass &/*args*/, displayclass &disp,
    402549                    outconvertclass &outconvert,
     
    512659  } else {
    513660    // rproto can't be NULL to get here
    514     ColInfoResponse_t collectinfo;
    515     comerror_t err;
    516 
    517     rproto->get_collectinfo (arg_c, collectinfo, err, logout);
    518     if (err == noError) {
     661    ColInfoResponse_t *collectinfo = recpt->get_collectinfo_ptr (rproto, arg_c, logout);
     662    if (collectinfo != NULL) {
    519663      textout << outconvert << "<table>\n"
    520664          << "<tr><th>collection name</th><td>\""
    521           << collectinfo.shortInfo.name
     665          << collectinfo->shortInfo.name
    522666          << "\"</td></tr>\n"
    523667
    524668          << "<tr><th>host</th><td>\""
    525           << collectinfo.shortInfo.host
     669          << collectinfo->shortInfo.host
    526670          << "\"</td></tr>\n"
    527671
    528672          << "<tr><th>port</th><td>\""
    529           << collectinfo.shortInfo.port
     673          << collectinfo->shortInfo.port
    530674          << "\"</td></tr>\n"
    531675
    532676          << "<tr><th>is public?</th><td>";
    533       if (collectinfo.isPublic) textout << outconvert << "true";
     677      if (collectinfo->isPublic) textout << outconvert << "true";
    534678      else textout << outconvert << "false";
    535679      textout << outconvert
     
    537681
    538682          << "<tr><th>is beta?</th><td>";
    539       if (collectinfo.isBeta) textout << outconvert << "true";
     683      if (collectinfo->isBeta) textout << outconvert << "true";
    540684      else textout << outconvert << "false";
    541685      textout << outconvert
     
    543687
    544688          << "<tr><th>build date</th><td>\""
    545           << collectinfo.buildDate
     689          << collectinfo->buildDate
    546690          << "\"</td></tr>\n"
    547691
    548692          << "<tr><th>interface languages</th><td>";
    549       text_tarray::iterator languages_here = collectinfo.languages.begin();
    550       text_tarray::iterator languages_end = collectinfo.languages.end();
     693      text_tarray::iterator languages_here = collectinfo->languages.begin();
     694      text_tarray::iterator languages_end = collectinfo->languages.end();
    551695      bool languages_first = true;
    552696      while (languages_here != languages_end) {
     
    558702
    559703      textout << "<tr><th valign=top>collection metadata</th><td><table>\n";
    560       text_tmap::iterator meta_here = collectinfo.collectionmeta.begin();
    561       text_tmap::iterator meta_end = collectinfo.collectionmeta.end();
     704      text_tmap::iterator meta_here = collectinfo->collectionmeta.begin();
     705      text_tmap::iterator meta_end = collectinfo->collectionmeta.end();
    562706      while (meta_here != meta_end) {
    563707    textout << outconvert << "<tr><td>" << (*meta_here).first
     
    568712
    569713      textout << "<tr><th valign=top>format info</th><td><table>\n";
    570       text_tmap::iterator format_here = collectinfo.format.begin();
    571       text_tmap::iterator format_end = collectinfo.format.end();
     714      text_tmap::iterator format_here = collectinfo->format.begin();
     715      text_tmap::iterator format_end = collectinfo->format.end();
    572716      while (format_here != format_end) {
    573717    textout << outconvert << "<tr><td>" << (*format_here).first
     
    578722
    579723      textout << "<tr><th valign=top>building info</th><td><table>\n";
    580       text_tmap::iterator building_here = collectinfo.building.begin();
    581       text_tmap::iterator building_end = collectinfo.building.end();
     724      text_tmap::iterator building_here = collectinfo->building.begin();
     725      text_tmap::iterator building_end = collectinfo->building.end();
    582726      while (building_here != building_end) {
    583727    textout << outconvert << "<tr><td>" << (*building_here).first
     
    591735
    592736          << "<tr><th>number of documents</th><td>\""
    593           << collectinfo.numDocs
     737          << collectinfo->numDocs
    594738          << "\"</td></tr>\n"
    595739
     740          << "<tr><th>number of sections</th><td>\""
     741          << collectinfo->numSections
     742          << "\"</td></tr>\n"
     743
    596744          << "<tr><th>number of words</th><td>\""
    597           << collectinfo.numWords
     745          << collectinfo->numWords
    598746          << "\"</td></tr>\n"
    599747
    600748          << "<tr><th>number of bytes</th><td>\""
    601           << collectinfo.numBytes
     749          << collectinfo->numBytes
    602750          << "\"</td></tr>\n"
    603751
    604752          << "<tr><th>preferred receptionist</th><td>\""
    605           << collectinfo.receptionist
     753          << collectinfo->receptionist
    606754          << "\"</td></tr>\n"
    607755
     
    609757     
    610758    } else {
    611       textout << outconvert << "Error (" << get_comerror_string (err)
    612           << ") while getting collect information\n";
     759      textout << "ERROR (statusaction::output_collectioninfo): while getting collect information\n";
    613760    }
    614761
     
    617764    InfoFilterOptionsRequest_t filteroptions_request;
    618765    InfoFilterOptionsResponse_t filteroptions;
     766    comerror_t err;
    619767    rproto->get_filterinfo (arg_c, filterinfo, err, logout);
    620768    if (err == noError) {
     
    722870  textout << outconvert << "<h2>Init log</h2>\n";
    723871
     872#ifdef GSDL_USE_IOS_H
    724873  ifstream initin (cinitfilename, ios::in | ios::nocreate);
     874#else
     875  ifstream initin (cinitfilename, ios::in);
     876#endif
     877
    725878  delete cinitfilename;
    726879  if (initin) {
     
    762915  logout << flush;
    763916
     917#ifdef GSDL_USE_IOS_H
    764918  ifstream errin (cerrfilename, ios::in | ios::nocreate);
     919#else
     920  ifstream errin (cerrfilename, ios::in);
     921#endif
     922
    765923  delete cerrfilename;
    766924  if (errin) {
     
    8561014}
    8571015
    858 bool statusaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
     1016bool statusaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
    8591017                  browsermapclass * /*browsers*/, displayclass &disp,
    8601018                  outconvertclass &outconvert, ostream &textout,
     
    8981056  if (arg_sp == "frameset") output_frameset (args, disp, outconvert, textout, logout);
    8991057  else if (arg_sp == "select") output_select (args, disp, outconvert, textout, logout);
    900   else if (arg_sp == "welcome") output_welcome (args, disp, outconvert, textout, logout);
     1058  else if (arg_sp == "welcome") output_welcome (args, protos, disp, outconvert, textout, logout);
    9011059  else if (arg_sp == "generalinfo") output_generalinfo (args, disp, outconvert, textout, logout);
    9021060  else if (arg_sp == "argumentinfo") output_argumentinfo (args, disp, outconvert, textout, logout);
    9031061  else if (arg_sp == "actioninfo") output_actioninfo (args, disp, outconvert, textout, logout);
     1062  else if (arg_sp == "browserinfo") output_browserinfo (args, disp, outconvert, textout, logout);
    9041063  else if (arg_sp == "protocolinfo") output_protocolinfo (args, disp, outconvert, textout, logout);
    9051064  else if (arg_sp == "collectioninfo") output_collectioninfo (args, disp, outconvert, textout, logout);
Note: See TracChangeset for help on using the changeset viewer.