Changeset 159 for trunk/gsdl/src/recpt


Ignore:
Timestamp:
1999-02-12T12:07:00+13:00 (25 years ago)
Author:
sjboddie
Message:

extended the status action

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/receptionist.h

    r155 r159  
    114114  text_t get_compressed_arg (const cgiargsclass &args);
    115115
     116  // returns a pointer to the action list
     117  actionmapclass *get_actionmap_ptr () {return &actions;}
     118
    116119protected:
    117120  text_t gsdlhome;
  • trunk/gsdl/src/recpt/statusaction.cpp

    r158 r159  
    1212/*
    1313   $Log$
     14   Revision 1.3  1999/02/11 23:07:00  sjboddie
     15
     16   extended the status action
     17
    1418   Revision 1.2  1999/02/11 01:24:06  rjmcnab
    1519
     
    2428
    2529#include "statusaction.h"
    26 
     30#include <assert.h>
    2731
    2832statusaction::statusaction () {
     
    5660}
    5761
    58 bool statusaction::do_action (cgiargsclass &/*args*/, outconvertclass &outconvert,
     62bool statusaction::do_action (cgiargsclass &args, outconvertclass &outconvert,
    5963                  ostream &textout, ostream &/*logout*/) {
    6064  textout << outconvert << "<html>\n";
     
    9498    if (!macrofirst) textout << outconvert << ", ";
    9599    macrofirst = false;
    96     textout << outconvert << "\"" << *macrohere << "\"";;
     100    textout << outconvert << "\"" << *macrohere << "\"";
    97101    macrohere++;
    98102      }
    99103
    100 
    101104      textout << outconvert << "</td></tr>\n";
     105      textout << outconvert << "<tr><th valign=top>current args</th><td>\n";
     106      textout << outconvert << "<table><tr><td><em>arg name</em></td>"
     107          << "<td><em>value</em></td></tr>\n";
     108     
     109      cgiargsclass::const_iterator argshere = args.begin();
     110      cgiargsclass::const_iterator argsend = args.end();
     111     
     112      while (argshere != argsend) {
     113    textout << outconvert << "<tr><td>" << (*argshere).first << "</td><td>"
     114        << (*argshere).second << "</td></tr>\n";
     115    argshere ++;
     116      }
     117
     118      textout << outconvert << "</table></td></tr>\n";
     119      textout << outconvert << "<tr valign=top><th>actions</th><td>\n<table>";
     120
     121      actionmapclass *actions = recpt->get_actionmap_ptr();
     122      actionptrmap::iterator here = actions->begin ();
     123      actionptrmap::iterator end = actions->end ();
     124      while (here != end) {
     125    assert ((*here).second.a != NULL);
     126    if ((*here).second.a != NULL) {
     127     
     128      textout << outconvert << "<tr><th colspan=5>" << (*here).second.a->get_action_name() << "</th></tr>\n";
     129      textout << outconvert << "<tr><td colspan=5><b>arguments</b></td></tr>\n";
     130      textout << outconvert << "<tr><td><em>short name</em></td><td><em>long name</em></td>\n";
     131      textout << outconvert << "<td><em>default</em></td><td><em>default status</em></td>";
     132      textout << outconvert << "<td><em>saved arg</em></td></tr>\n";
     133     
     134      cgiargsinfoclass argsinfo = (*here).second.a->getargsinfo();
     135     
     136      cgiargsinfoclass::const_iterator argsinfohere = argsinfo.begin ();
     137      cgiargsinfoclass::const_iterator argsinfoend = argsinfo.end ();
     138
     139      while (argsinfohere != argsinfoend) {
     140        textout << outconvert << "<tr><td>" << (*argsinfohere).second.shortname << "</td>\n";
     141        textout << outconvert << "<td>" << (*argsinfohere).second.longname << "</td>\n";
     142        textout << outconvert << "<td>" << (*argsinfohere).second.argdefault << "</td>\n";
     143        switch ((*argsinfohere).second.defaultstatus) {
     144        case 0: textout << outconvert << "<td>none</td>\n"; break;
     145        case 1: textout << outconvert << "<td>weak</td>\n"; break;
     146        case 2: textout << outconvert << "<td>good</td>\n"; break;
     147        case 3: textout << outconvert << "<td>config</td>\n"; break;
     148        case 4: textout << outconvert << "<td>imperitave</td>\n"; break;
     149        default: textout << outconvert << "<td></td>\n";
     150        }
     151        switch ((*argsinfohere).second.savedarginfo) {
     152        case 0: textout << outconvert << "<td>mustnot</td></tr>\n"; break;
     153        case 1: textout << outconvert << "<td>can</td></tr>\n"; break;
     154        case 2: textout << outconvert << "<td>must</td></tr>\n"; break;
     155        default: textout << outconvert << "<td></td></tr>\n";
     156        }
     157        argsinfohere++;
     158      }
     159    }
     160    here++;
     161      }
     162     
     163      textout << outconvert << "</table></td></tr>\n";
    102164      textout << outconvert << "</table>\n";
    103165    }
    104166  }
     167
     168  ifstream initin (GSDL_GSDLHOME "/etc/initout.txt");
     169  if (initin) {
     170    textout << outconvert << "<p>The initialisation error log, " GSDL_GSDLHOME "/etc/initout.txt, contains the\n";
     171    textout << outconvert << "following information:\n\n";
     172    text_t errorpage = "<p><pre>\n";
     173
     174    char c;
     175    initin.get(c);
     176    while (!initin.eof ()) {
     177      errorpage.push_back(c);
     178      initin.get(c);
     179    }
     180   
     181    errorpage += "</pre>\n";
     182    initin.close();
     183    textout << outconvert << errorpage;
     184
     185  } else {
     186    textout << outconvert << "Couldn't read initialisation error log, " GSDL_GSDLHOME "/etc/initout.txt.\n";
     187  }
     188
    105189  textout << outconvert << "</body>\n";
    106190  textout << outconvert << "</html>\n";
Note: See TracChangeset for help on using the changeset viewer.