Changeset 822 for trunk


Ignore:
Timestamp:
1999-12-13T15:21:27+13:00 (24 years ago)
Author:
davidb
Message:

Added viewable log for collection building.

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

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/buildaction.cpp

    r760 r822  
    2828#include "OIDtools.h"
    2929#include "fileutil.h"
     30#include "htmlutils.h"
    3031#include "buildaction.h"
    3132#include "gsdlhome.h"
     
    7879bool buildaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args,
    7980                 ostream &/*logout*/) {
    80   if (args["bca"] != "buildstatus")
     81  if ((args["bca"] != "buildstatus") && (args["bca"] != "collog"))
    8182    {
    8283      // authenticate the user if authentication is avaiable
     
    9798void buildaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
    9899                      recptprotolistclass *protos, ostream &logout) {
     100
     101  // make sure we know about a receptionist
     102  if (recpt == NULL) {
     103    logout << "The page action does not contain information\n"
     104           << "about any receptionists. The method set_receptionist\n"
     105           <<   "was probably not called from the module which instantiated\n"
     106           <<   "this page action.\n";
     107    return;
     108  }
     109
     110  recptprotolistclass *rprotolist = recpt->get_recptprotolist_ptr ();
     111  if (rprotolist == NULL) return;
     112 
     113  const recptconf &rcinfo = recpt->get_configinfo ();
    99114
    100115  // build up javascript and HTML code useful in web forms
     
    226241    }
    227242
    228   if ((args["bca"]=="delcol") || (args["bca"]=="editcol") || (args["bca"]=="buildcol"))
     243  if ((args["bca"]=="delcol") || (args["bca"]=="editcol") || (args["bca"]=="buildcol") || (args["bca"]=="collog"))
    229244    {
    230245      disp.setmacro ("dirnamelist", "build", dirnamelist);
     
    259274  }
    260275
     276  // set macro cfgperm based on whether config file can be read or no
     277  text_t dirname = (args["bc1dirname"] == "") ? first_dirname : args["bc1dirname"];
     278  text_t cfg_fname = filename_cat(rcinfo.gsdlhome,"collect",dirname,"etc","collect.cfg");
     279  text_t cfgperm = (file_writable(cfg_fname)) ? "read/write" : "readonly";
     280  disp.setmacro("cfgperm","build",cfgperm);
     281
    261282  // if edit collection, read in collect.cfg file
    262283  if (args["bca"]=="editcol")
     
    270291      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate);
    271292      if (cfg_ifs)
    272     {
     293    { 
     294      // read in collect.cfg     
    273295      text_t cfg_text = "";
    274296     
     
    277299      while (!cfg_ifs.eof ()) {
    278300        cfg_text.push_back(c);
     301        if (c=='\\') { cfg_text.push_back('\\'); }
    279302        cfg_ifs.get(c);
    280303      }
    281304   
    282305      cfg_ifs.close();
     306      if (cfgperm=="readonly") cfg_text = html_safe(cfg_text);
    283307
    284308      // define it as a macro
     
    291315    }
    292316    }
     317
     318  // if view log, read in collect.bld file
     319  if (args["bca"]=="collog")
     320    {
     321      text_t dirname
     322    = (args["bc1dirname"] == "") ? first_dirname : args["bc1dirname"];
     323
     324      // read in collect.bld
     325      text_t bld_fname = filename_cat(rcinfo.gsdlhome,"log",dirname+".bld");
     326      ifstream bld_ifs (bld_fname.getcstr(), ios::in | ios::nocreate);
     327      if (bld_ifs)
     328    {
     329      text_t bld_text = "";
     330     
     331      char c;
     332      bld_ifs.get(c);
     333      while (!bld_ifs.eof ()) {
     334        bld_text.push_back(c);
     335        if (c=='\\') { bld_text.push_back('\\'); }
     336        bld_ifs.get(c);
     337      }
     338   
     339      bld_ifs.close();
     340      bld_text = html_safe(bld_text);
     341
     342      // define it as a macro
     343      disp.setmacro("bldfile","build",bld_text);
     344    }
     345      else
     346    {
     347      text_t error_mess = "Log file currently empty.";
     348      disp.setmacro("bldfile","build",error_mess);
     349    }
     350    }
    293351}
    294352
     
    313371  else if (args["bca"] == "delcol") {
    314372    return do_delcol (args, disp, outconvert, textout, logout);
     373  }
     374  else if (args["bca"] == "collog") {
     375    return do_collog (args, disp, outconvert, textout, logout);
    315376  }
    316377  else if (args["bca"] == "mess") {
     
    426487
    427488
     489bool buildaction::do_collog  (cgiargsclass &/*args*/, displayclass &disp,
     490                outconvertclass &outconvert, ostream &textout,
     491                ostream &/*logout*/) {
     492  textout << outconvert << disp << ("_build:header_(_build:headmesscollog_)\n")
     493      << ("_build:contentcollog_\n")
     494      << ("_build:wizardfooter_\n");
     495
     496  return true;
     497}
     498
    428499bool buildaction::do_mess  (cgiargsclass &args, displayclass &disp,
    429500                outconvertclass &outconvert, ostream &textout,
  • trunk/gsdl/src/recpt/buildaction.h

    r760 r822  
    4141  text_t get_action_name () {return "bc";}
    4242 
     43  void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
     44
    4345  bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
    4446              ostream &logout);
     
    7880          ostream &logout);
    7981
     82  bool do_collog (cgiargsclass &args, displayclass &disp,
     83          outconvertclass &outconvert, ostream &textout,
     84          ostream &logout);
     85
    8086  bool do_mess (cgiargsclass &args, displayclass &disp,
    8187        outconvertclass &outconvert, ostream &textout,
Note: See TracChangeset for help on using the changeset viewer.