Ignore:
Timestamp:
2000-08-03T14:49:41+12:00 (24 years ago)
Author:
johnmcp
Message:

Relatively stable z39.50 implementation now, merged with the mgpp source.
(Still needs a decent interface and query language though...)

File:
1 edited

Legend:

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

    r1129 r1342  
    2222 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    2323 *
    24  * $Id$
    25  *
    2624 *********************************************************************/
    27 
    28 /*
    29    $Log$
    30    Revision 1.26  2000/04/19 22:30:23  sjboddie
    31    tidied up status pages and end-user collection building
    32 
    33    Revision 1.25  2000/02/29 21:00:31  sjboddie
    34    fixed some compiler warnings
    35 
    36    Revision 1.24  1999/12/06 01:13:02  sjboddie
    37    macrofiles is now a set to allow for multiple gsdlhomes
    38 
    39    Revision 1.23  1999/11/09 02:26:20  sjboddie
    40    added some new(ish) options
    41 
    42    Revision 1.22  1999/11/01 21:55:27  sjboddie
    43    changes to arguments of many functions
    44 
    45    Revision 1.21  1999/10/19 03:23:46  davidb
    46    Collection building support through web pages
    47    and internal and external link handling for collection documents
    48 
    49    Revision 1.20  1999/10/18 20:10:41  sjboddie
    50    don't want to use authentication to reach status page (usersaction still
    51    uses authentication)
    52 
    53    Revision 1.19  1999/09/07 23:09:40  rjmcnab
    54    removed some compiler warnings
    55 
    56    Revision 1.18  1999/09/07 04:57:00  sjboddie
    57    added GPL notice
    58 
    59    Revision 1.17  1999/09/03 09:53:46  rjmcnab
    60    Output more configuration options for the receptionist.
    61 
    62    Revision 1.16  1999/09/02 00:28:42  rjmcnab
    63    removed dependancy on GSDL_GSDLHOME
    64 
    65    Revision 1.15  1999/07/30 02:24:42  sjboddie
    66    added collectinfo argument to some functions
    67 
    68    Revision 1.14  1999/07/13 23:26:07  rjmcnab
    69    Added support for authenaction and usersaction
    70 
    71    Revision 1.13  1999/06/08 04:29:39  sjboddie
    72    added argsinfo to the call to check_cgiargs to make it easy to set
    73    args to their default if they're found to be screwed up
    74 
    75    Revision 1.12  1999/04/06 22:20:35  rjmcnab
    76    Got browsefilter working.
    77 
    78    Revision 1.11  1999/03/31 23:44:49  rjmcnab
    79    Altered the protocol so that the metadata is part of the filter.
    80 
    81    Revision 1.10  1999/03/16 04:47:03  rjmcnab
    82    Changed the list of arguments on the argument page to be the info list
    83    not the current args list (there are some arguments which don't have
    84    a default so they never make it onto the args list).
    85 
    86    Revision 1.9  1999/03/11 01:26:02  rjmcnab
    87    Fixed a few small formatting things.
    88 
    89    Revision 1.8  1999/03/11 00:12:30  rjmcnab
    90    Started using status.dm to handle the bulky text. Made the status
    91    action use frames and added some more information.
    92 
    93    Revision 1.7  1999/03/09 21:00:47  rjmcnab
    94    Reorganised the statusaction, added more functions to comtypes.
    95 
    96    Revision 1.6  1999/02/25 21:59:02  rjmcnab
    97 
    98    Merged sources.
    99 
    100    Revision 1.5  1999/02/21 22:33:58  rjmcnab
    101 
    102    Lots of stuff :-)
    103 
    104    Revision 1.4  1999/02/12 02:40:18  sjboddie
    105 
    106    Added page action
    107 
    108    Revision 1.3  1999/02/11 23:07:00  sjboddie
    109 
    110    extended the status action
    111 
    112    Revision 1.2  1999/02/11 01:24:06  rjmcnab
    113 
    114    Fixed a few compiler warnings.
    115 
    116    Revision 1.1  1999/02/11 01:01:27  rjmcnab
    117 
    118    Initial revision.
    119 
    120  */
    121 
    12225
    12326#include "statusaction.h"
     
    14447                   displayclass &disp, outconvertclass &outconvert,
    14548                   ostream &textout, ostream &logout) {
     49
     50  if (recpt == NULL) return;
    14651
    14752  textout << outconvert << disp
     
    17580            << "</a></td>";
    17681
    177       ColInfoResponse_t cinfo;
    178       (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
    179       if (err == noError) {
     82      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
     83      if (cinfo != NULL) {
    18084        text_t collname = *collist_here;
    181         text_tmap::iterator it = cinfo.collectionmeta.find("collectionname");
    182         if (it != cinfo.collectionmeta.end()) collname = (*it).second;
     85        text_tmap::iterator it = cinfo->collectionmeta.find("collectionname");
     86        if (it != cinfo->collectionmeta.end()) collname = (*it).second;
    18387
    18488        textout << "<td>";
    185         if (cinfo.buildDate > 0)
     89        if (cinfo->buildDate > 0)
    18690          textout << outconvert << disp
    18791              << "<a href=\"_httppagex_(about)&c=" << *collist_here
    188               << "\" target=_top>";
     92              << "\" target=\\_top>";
    18993
    19094        textout << outconvert << disp << collname;
    19195
    192         if (cinfo.buildDate > 0) textout << "</a>";
     96        if (cinfo->buildDate > 0) textout << "</a>";
    19397
    19498        textout << "</td>";
    19599
    196         if (cinfo.isPublic) textout << "<td>yes</td>";
     100        if (cinfo->isPublic) textout << "<td>yes</td>";
    197101        else textout << "<td>no</td>";
    198102       
    199         if (cinfo.buildDate > 0)
     103        if (cinfo->buildDate > 0)
    200104          textout << outconvert << "<td>yes</td>";
    201105        else
     
    328232  }
    329233 
     234  // browsers
     235  browsermapclass *browsers = recpt->get_browsermap_ptr();
     236  if (browsers != NULL) {
     237    textout << outconvert << "<tr valign=top><th>browsers</th><td>";
     238   
     239    browserptrmap::iterator browsershere = browsers->begin ();
     240    browserptrmap::iterator browsersend = browsers->end ();
     241    bool browsersfirst = true;
     242    while (browsershere != browsersend) {
     243      if (!browsersfirst) textout << outconvert << ", ";
     244      browsersfirst = false;
     245      assert ((*browsershere).second.b != NULL);
     246      if ((*browsershere).second.b != NULL) {
     247    textout << outconvert << "\"" << (*browsershere).second.b->get_browser_name() << "\"";
     248      }
     249      browsershere++;
     250    }
     251   
     252    textout << outconvert << "</td></tr>\n";
     253  }
     254
    330255  // protocols
    331256  recptprotolistclass *protocols = recpt->get_recptprotolist_ptr ();
     
    471396}
    472397
     398void statusaction::output_browserinfo (cgiargsclass &/*args*/, displayclass &disp,
     399                       outconvertclass &outconvert,
     400                       ostream &textout, ostream &/*logout*/) {
     401  if (recpt == NULL) return;
     402  browsermapclass *browsers = recpt->get_browsermap_ptr();
     403
     404  textout << outconvert << disp << "_status:infoheader_(Browser Information)\n";
     405  textout << outconvert
     406      << "<h2>Browser information</h2>\n"
     407      << "<table>";
     408
     409  // browser information
     410  if (browsers != NULL) {
     411    textout << outconvert
     412        << "<tr><th>browser name</th><th>default formatstring</th></tr>\n";
     413   
     414    browserptrmap::iterator browsershere = browsers->begin ();
     415    browserptrmap::iterator browsersend = browsers->end ();
     416    while (browsershere != browsersend) {
     417      assert ((*browsershere).second.b != NULL);
     418      if ((*browsershere).second.b != NULL) {
     419    textout << outconvert
     420        << "<tr><td>" << (*browsershere).second.b->get_browser_name()
     421        << "</td><td>" << html_safe ((*browsershere).second.b->get_default_formatstring())
     422        << "</td></tr>\n";
     423      }
     424      browsershere++;
     425    }
     426  }
     427 
     428  textout << outconvert << disp << "</table>\n_status:infofooter_\n";
     429}
     430
    473431void statusaction::output_protocolinfo (cgiargsclass &/*args*/, displayclass &disp,
    474432                    outconvertclass &outconvert,
     
    584542  } else {
    585543    // rproto can't be NULL to get here
    586     ColInfoResponse_t collectinfo;
    587     comerror_t err;
    588 
    589     rproto->get_collectinfo (arg_c, collectinfo, err, logout);
    590     if (err == noError) {
     544    ColInfoResponse_t *collectinfo = recpt->get_collectinfo_ptr (rproto, arg_c, logout);
     545    if (collectinfo != NULL) {
    591546      textout << outconvert << "<table>\n"
    592547          << "<tr><th>collection name</th><td>\""
    593           << collectinfo.shortInfo.name
     548          << collectinfo->shortInfo.name
    594549          << "\"</td></tr>\n"
    595550
    596551          << "<tr><th>host</th><td>\""
    597           << collectinfo.shortInfo.host
     552          << collectinfo->shortInfo.host
    598553          << "\"</td></tr>\n"
    599554
    600555          << "<tr><th>port</th><td>\""
    601           << collectinfo.shortInfo.port
     556          << collectinfo->shortInfo.port
    602557          << "\"</td></tr>\n"
    603558
    604559          << "<tr><th>is public?</th><td>";
    605       if (collectinfo.isPublic) textout << outconvert << "true";
     560      if (collectinfo->isPublic) textout << outconvert << "true";
    606561      else textout << outconvert << "false";
    607562      textout << outconvert
     
    609564
    610565          << "<tr><th>is beta?</th><td>";
    611       if (collectinfo.isBeta) textout << outconvert << "true";
     566      if (collectinfo->isBeta) textout << outconvert << "true";
    612567      else textout << outconvert << "false";
    613568      textout << outconvert
     
    615570
    616571          << "<tr><th>build date</th><td>\""
    617           << collectinfo.buildDate
     572          << collectinfo->buildDate
    618573          << "\"</td></tr>\n"
    619574
    620575          << "<tr><th>interface languages</th><td>";
    621       text_tarray::iterator languages_here = collectinfo.languages.begin();
    622       text_tarray::iterator languages_end = collectinfo.languages.end();
     576      text_tarray::iterator languages_here = collectinfo->languages.begin();
     577      text_tarray::iterator languages_end = collectinfo->languages.end();
    623578      bool languages_first = true;
    624579      while (languages_here != languages_end) {
     
    630585
    631586      textout << "<tr><th valign=top>collection metadata</th><td><table>\n";
    632       text_tmap::iterator meta_here = collectinfo.collectionmeta.begin();
    633       text_tmap::iterator meta_end = collectinfo.collectionmeta.end();
     587      text_tmap::iterator meta_here = collectinfo->collectionmeta.begin();
     588      text_tmap::iterator meta_end = collectinfo->collectionmeta.end();
    634589      while (meta_here != meta_end) {
    635590    textout << outconvert << "<tr><td>" << (*meta_here).first
     
    640595
    641596      textout << "<tr><th valign=top>format info</th><td><table>\n";
    642       text_tmap::iterator format_here = collectinfo.format.begin();
    643       text_tmap::iterator format_end = collectinfo.format.end();
     597      text_tmap::iterator format_here = collectinfo->format.begin();
     598      text_tmap::iterator format_end = collectinfo->format.end();
    644599      while (format_here != format_end) {
    645600    textout << outconvert << "<tr><td>" << (*format_here).first
     
    650605
    651606      textout << "<tr><th valign=top>building info</th><td><table>\n";
    652       text_tmap::iterator building_here = collectinfo.building.begin();
    653       text_tmap::iterator building_end = collectinfo.building.end();
     607      text_tmap::iterator building_here = collectinfo->building.begin();
     608      text_tmap::iterator building_end = collectinfo->building.end();
    654609      while (building_here != building_end) {
    655610    textout << outconvert << "<tr><td>" << (*building_here).first
     
    663618
    664619          << "<tr><th>number of documents</th><td>\""
    665           << collectinfo.numDocs
     620          << collectinfo->numDocs
    666621          << "\"</td></tr>\n"
    667622
     623          << "<tr><th>number of sections</th><td>\""
     624          << collectinfo->numSections
     625          << "\"</td></tr>\n"
     626
    668627          << "<tr><th>number of words</th><td>\""
    669           << collectinfo.numWords
     628          << collectinfo->numWords
    670629          << "\"</td></tr>\n"
    671630
    672631          << "<tr><th>number of bytes</th><td>\""
    673           << collectinfo.numBytes
     632          << collectinfo->numBytes
    674633          << "\"</td></tr>\n"
    675634
    676635          << "<tr><th>preferred receptionist</th><td>\""
    677           << collectinfo.receptionist
     636          << collectinfo->receptionist
    678637          << "\"</td></tr>\n"
    679638
     
    681640     
    682641    } else {
    683       textout << outconvert << "Error (" << get_comerror_string (err)
    684           << ") while getting collect information\n";
     642      textout << "ERROR (statusaction::output_collectioninfo): while getting collect information\n";
    685643    }
    686644
     
    689647    InfoFilterOptionsRequest_t filteroptions_request;
    690648    InfoFilterOptionsResponse_t filteroptions;
     649    comerror_t err;
    691650    rproto->get_filterinfo (arg_c, filterinfo, err, logout);
    692651    if (err == noError) {
     
    794753  textout << outconvert << "<h2>Init log</h2>\n";
    795754
     755#ifdef GSDL_USE_IOS_H
    796756  ifstream initin (cinitfilename, ios::in | ios::nocreate);
     757#else
     758  ifstream initin (cinitfilename, ios::in);
     759#endif
     760
    797761  delete cinitfilename;
    798762  if (initin) {
     
    834798  logout << flush;
    835799
     800#ifdef GSDL_USE_IOS_H
    836801  ifstream errin (cerrfilename, ios::in | ios::nocreate);
     802#else
     803  ifstream errin (cerrfilename, ios::in);
     804#endif
     805
    837806  delete cerrfilename;
    838807  if (errin) {
     
    974943  else if (arg_sp == "argumentinfo") output_argumentinfo (args, disp, outconvert, textout, logout);
    975944  else if (arg_sp == "actioninfo") output_actioninfo (args, disp, outconvert, textout, logout);
     945  else if (arg_sp == "browserinfo") output_browserinfo (args, disp, outconvert, textout, logout);
    976946  else if (arg_sp == "protocolinfo") output_protocolinfo (args, disp, outconvert, textout, logout);
    977947  else if (arg_sp == "collectioninfo") output_collectioninfo (args, disp, outconvert, textout, logout);
     
    996966  }
    997967}
    998 
Note: See TracChangeset for help on using the changeset viewer.