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/buildaction.cpp

    r1000 r1279  
    2424 *********************************************************************/
    2525
    26 #ifndef __WIN32__
    27 #include <unistd.h>
    28 #endif
    29 
    3026#include "OIDtools.h"
    3127#include "fileutil.h"
    3228#include "htmlutils.h"
     29#include "gsdltools.h"
    3330#include "buildaction.h"
    3431
     
    8077bool buildaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args,
    8178                 ostream &/*logout*/) {
    82   if ((args["bca"] != "buildstatus") && (args["bca"] != "collog"))
     79
     80  text_t &arg_bca = args["bca"];
     81  if (!((arg_bca == "buildstatus") || (arg_bca == "collog") || (arg_bca == "blankpage")
     82    || ((arg_bca == "buildcol") && (args["wizard"] == "buildexec"))))
    8383    {
    8484      // authenticate the user if authentication is avaiable
     
    102102  // make sure we know about a receptionist
    103103  if (recpt == NULL) {
    104     logout << "The page action does not contain information\n"
     104    logout << "The build action does not contain information\n"
    105105           << "about any receptionists. The method set_receptionist\n"
    106106           << "was probably not called from the module which instantiated\n"
    107            << "this page action.\n";
     107           << "this build action.\n";
    108108    return;
    109109  }
     
    116116  text_t fullnamelist = "var fullnamelist = new Array(";
    117117  text_t dirnamelist  = "var dirnamelist = new Array(";
    118   text_t fullnamemenu = (text_t)"<input type=hidden name=\"bc1fullnameindex\""
    119                         +" value=\"_bcargfullnameindex_\">\n"
    120                         +"<select name=\"bc1fullnamemenu\" onChange=fullnameindex_changed()>\n";
     118  text_t fullnamemenu = "<input type=hidden name=\"bc1fullnameindex\"";
     119  fullnamemenu += " value=\"_bcargfullnameindex_\">\n";
     120  fullnamemenu += "<select name=\"bc1fullnamemenu\" onChange=fullnameindex_changed()>\n";
    121121  int rcount = 1;
    122122  int fcount = 1;
     
    146146    while (collist_here != collist_end) {
    147147
    148       ColInfoResponse_t cinfo;
    149       (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
    150       if (err == noError) {
     148      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
     149      if (cinfo != NULL) {
    151150        text_t collectionname = *collist_here;
    152         if (!cinfo.collectionmeta["collectionname"].empty())
     151        if (!cinfo->collectionmeta["collectionname"].empty())
    153152          {
    154153        // get collection name from the collection cfg file
    155         collectionname = cinfo.collectionmeta["collectionname"];
     154        collectionname = cinfo->collectionmeta["collectionname"];
    156155          }
    157156        else
     
    169168        dirnamelist += (text_t)"\"" + *collist_here + "\"";
    170169
    171         fullnamemenu += (text_t)"<option value=\"" + collectionname + "\"";
    172         if (args["bc1dirname"] == "")
     170        fullnamemenu += "<option value=\"" + collectionname;
     171        fullnamemenu.push_back ('"');
     172        if (args["bc1dirname"].empty())
    173173          {
    174174        if ((rcount==1) && (ccount==1))
     
    202202        if (args["bca"]=="buildcol")
    203203          {
    204         if (((args["bc1dirname"]=="") && (rcount==1) && (ccount==1))
     204        if (((args["bc1dirname"].empty()) && (rcount==1) && (ccount==1))
    205205            || (args["bc1dirname"]==*collist_here))
    206206          {
    207             disp.setmacro("bcargingsdlarea","build",cinfo.building["ingsdlarea"]);
    208             disp.setmacro("bcargcopydir","build",cinfo.building["copydir"]);
     207            disp.setmacro("bcargingsdlarea","build",cinfo->building["ingsdlarea"]);
     208            disp.setmacro("bcargcopydir","build",cinfo->building["copydir"]);
    209209           
    210             if (cinfo.buildDate==0) // not built
     210            if (cinfo->buildDate==0) // not built
    211211              {
    212212            // assume that's because this is the first build ever for the collection
     
    240240    }
    241241
    242   if ((args["bca"]=="delcol") || (args["bca"]=="editcol") || (args["bca"]=="buildcol") || (args["bca"]=="collog"))
     242  if ((args["bca"]=="delcol") || (args["bca"]=="editcol") ||
     243      (args["bca"]=="buildcol") || (args["bca"]=="collog"))
    243244    {
    244245      disp.setmacro ("dirnamelist", "build", dirnamelist);
     
    268269    text_t bc1name = substr(args_entry.begin()+3,args_entry.end());
    269270    text_t cached_cgiarg = "bcarg" + bc1name;
    270     disp.setmacro(cached_cgiarg,"build",args[args_entry]);
     271    disp.setmacro(cached_cgiarg, "build", dm_safe(args[args_entry]));
    271272      }
    272273    args_here++;
     
    288289      text_t cfg_fname
    289290    = filename_cat(gsdlhome, "collect", dirname, "etc", "collect.cfg");
     291
     292#ifdef GSDL_USE_IOS_H
    290293      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate);
     294#else
     295      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in);
     296#endif
     297
    291298      if (cfg_ifs)
    292299    { 
     
    323330      // read in collect.bld
    324331      text_t bld_fname = filename_cat(gsdlhome, "log", dirname+ ".bld");
     332
     333#ifdef GSDL_USE_IOS_H
    325334      ifstream bld_ifs (bld_fname.getcstr(), ios::in | ios::nocreate);
     335#else
     336      ifstream bld_ifs (bld_fname.getcstr(), ios::in);
     337#endif
     338
    326339      if (bld_ifs)
    327340    {
     
    427440                   ostream &logout) {
    428441
    429 
    430 
    431 
    432442  text_tarray wizard_split;
    433   const text_t& wizard = (args["wizard"]=="") ? (text_t)"buildcol" : args["wizard"];
     443  const text_t wizard = (args["wizard"].empty()) ? "buildcol" : args["wizard"];
    434444  splitchar(wizard.begin(),wizard.end(),':',wizard_split);
    435   const text_t& wizard_last = wizard_split.back();
     445  const text_t wizard_last = wizard_split.back();
    436446 
    437447  if (wizard_last != "buildframe")
     
    444454  else
    445455    {
    446       text_t dirname = (args["bc1dirname"] == "") ? (text_t)"unknown" : args["bc1dirname"];
     456      text_t dirname = (args["bc1dirname"] == "") ?
     457    "unknown" : args["bc1dirname"];
     458
    447459      text_t tmpname = dirname+"_XXXXXX";
    448       if (mktemp(tmpname.getcstr())==NULL)
    449     {
    450       logout << "Failed to create temporary filename" << endl;
    451     }
     460      char *cstr_tmpname = tmpname.getcstr();
     461
     462      if (GSDL_MKTEMP (cstr_tmpname)==NULL)
     463    logout << "Failed to create temporary filename" << endl;
     464
     465      delete cstr_tmpname;
     466
    452467      disp.setmacro("bcargtmpname","build",tmpname);
    453468
     
    457472 
    458473      textout << outconvert << disp << headmess << content << "_build:framefooter_\n";
    459       text_t cmd = filename_cat(gsdlhome, "cgi-bin", "webpage_buildcol.pl");
    460       cmd += " gsdlhome=\""+args["gsdlhome"]+"\" httpbuild=\""+args["httpbuild"]+"\"";
    461       cmd += " bc1copydata=\""+args["bc1copydata"]+"\"";
    462       cmd += " bc1doimport=\""+args["bc1doimport"]+"\"";
    463       cmd += " bc1dobuild=\""+args["bc1dobuild"]+"\"";
    464       cmd += " bc1dirname=\""+args["bc1dirname"]+"\" bc1tmpname=\""+tmpname+"\" &";
    465      
    466       system(cmd.getcstr());
     474      text_t cmd = "perl \"" +
     475    filename_cat(gsdlhome, "cgi-bin", "webpage_buildcol.pl") + "\"";
     476      cmd += " \"httpbuild="+args["httpbuild"]+"\"";
     477      cmd += " \"bc1copydata="+args["bc1copydata"]+"\"";
     478      cmd += " \"bc1doimport="+args["bc1doimport"]+"\"";
     479      cmd += " \"bc1dobuild="+args["bc1dobuild"]+"\"";
     480      cmd += " \"bc1dirname="+args["bc1dirname"]+"\" \"bc1tmpname="+tmpname+"\"";
     481      // run webpage_buildcol.pl in background on unix systems
     482#if !defined (__WIN32__)
     483      cmd += " &";
     484#endif
     485
     486      char *cstr_cmd = cmd.getcstr();
     487
     488#if defined (__WIN32__)
     489      gsdl_system (cstr_cmd, logout);
     490#else
     491      system (cstr_cmd);
     492#endif
     493
     494      delete cstr_cmd;
    467495    }
    468496
Note: See TracChangeset for help on using the changeset viewer.