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

    r1149 r1342  
    22 *
    33 * buildaction.cpp -- building collections
    4  * Copyright (C) 1999  DigiLib Systems Limited, New Zealand
     4 * Copyright (C) 1999  The New Zealand Digital Library Project
    55 *
    66 * A component of the Greenstone digital library software
     
    2424 *********************************************************************/
    2525
    26 #if !defined(__WIN32__) || defined(__GNUC__)
    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
     
    105102  // make sure we know about a receptionist
    106103  if (recpt == NULL) {
    107     logout << "The page action does not contain information\n"
     104    logout << "The build action does not contain information\n"
    108105           << "about any receptionists. The method set_receptionist\n"
    109106           << "was probably not called from the module which instantiated\n"
    110            << "this page action.\n";
     107           << "this build action.\n";
    111108    return;
    112109  }
     
    119116  text_t fullnamelist = "var fullnamelist = new Array(";
    120117  text_t dirnamelist  = "var dirnamelist = new Array(";
    121   text_t fullnamemenu = (text_t)"<input type=hidden name=\"bc1fullnameindex\""
    122                         +" value=\"_bcargfullnameindex_\">\n"
    123                         +"<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";
    124121  int rcount = 1;
    125122  int fcount = 1;
     
    149146    while (collist_here != collist_end) {
    150147
    151       ColInfoResponse_t cinfo;
    152       (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
    153       if (err == noError) {
     148      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
     149      if (cinfo != NULL) {
    154150        text_t collectionname = *collist_here;
    155         if (!cinfo.collectionmeta["collectionname"].empty())
     151        if (!cinfo->collectionmeta["collectionname"].empty())
    156152          {
    157153        // get collection name from the collection cfg file
    158         collectionname = cinfo.collectionmeta["collectionname"];
     154        collectionname = cinfo->collectionmeta["collectionname"];
    159155          }
    160156        else
     
    172168        dirnamelist += (text_t)"\"" + *collist_here + "\"";
    173169
    174         fullnamemenu += (text_t)"<option value=\"" + collectionname + "\"";
    175         if (args["bc1dirname"] == "")
     170        fullnamemenu += "<option value=\"" + collectionname;
     171        fullnamemenu.push_back ('"');
     172        if (args["bc1dirname"].empty())
    176173          {
    177174        if ((rcount==1) && (ccount==1))
     
    205202        if (args["bca"]=="buildcol")
    206203          {
    207         if (((args["bc1dirname"]=="") && (rcount==1) && (ccount==1))
     204        if (((args["bc1dirname"].empty()) && (rcount==1) && (ccount==1))
    208205            || (args["bc1dirname"]==*collist_here))
    209206          {
    210             disp.setmacro("bcargingsdlarea","build",cinfo.building["ingsdlarea"]);
    211             disp.setmacro("bcargcopydir","build",cinfo.building["copydir"]);
     207            disp.setmacro("bcargingsdlarea","build",cinfo->building["ingsdlarea"]);
     208            disp.setmacro("bcargcopydir","build",cinfo->building["copydir"]);
    212209           
    213             if (cinfo.buildDate==0) // not built
     210            if (cinfo->buildDate==0) // not built
    214211              {
    215212            // assume that's because this is the first build ever for the collection
     
    243240    }
    244241
    245   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"))
    246244    {
    247245      disp.setmacro ("dirnamelist", "build", dirnamelist);
     
    271269    text_t bc1name = substr(args_entry.begin()+3,args_entry.end());
    272270    text_t cached_cgiarg = "bcarg" + bc1name;
    273     disp.setmacro(cached_cgiarg,"build",args[args_entry]);
     271    disp.setmacro(cached_cgiarg, "build", dm_safe(args[args_entry]));
    274272      }
    275273    args_here++;
     
    291289      text_t cfg_fname
    292290    = filename_cat(gsdlhome, "collect", dirname, "etc", "collect.cfg");
     291
     292#ifdef GSDL_USE_IOS_H
    293293      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate);
     294#else
     295      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in);
     296#endif
     297
    294298      if (cfg_ifs)
    295299    { 
     
    325329
    326330      // read in collect.bld
    327       text_t bld_fname = filename_cat(gsdlhome, "log", dirname+ ".bld");
     331      text_t bld_fname = filename_cat(gsdlhome, "etc", dirname+ ".bld");
     332
     333#ifdef GSDL_USE_IOS_H
    328334      ifstream bld_ifs (bld_fname.getcstr(), ios::in | ios::nocreate);
     335#else
     336      ifstream bld_ifs (bld_fname.getcstr(), ios::in);
     337#endif
     338
    329339      if (bld_ifs)
    330340    {
     
    430440                   ostream &logout) {
    431441
    432 
    433 
    434 
    435442  text_tarray wizard_split;
    436443  const text_t wizard = (args["wizard"].empty()) ? "buildcol" : args["wizard"];
     
    447454  else
    448455    {
    449       text_t dirname = (args["bc1dirname"] == "") ? (text_t)"unknown" : args["bc1dirname"];
     456      text_t dirname = (args["bc1dirname"] == "") ?
     457    "unknown" : args["bc1dirname"];
     458
    450459      text_t tmpname = dirname+"_XXXXXX";
    451460      char *cstr_tmpname = tmpname.getcstr();
    452       if (mktemp(cstr_tmpname)==NULL)
     461
     462      if (GSDL_MKTEMP (cstr_tmpname)==NULL)
    453463    logout << "Failed to create temporary filename" << endl;
    454464
     
    462472 
    463473      textout << outconvert << disp << headmess << content << "_build:framefooter_\n";
    464       text_t cmd = filename_cat(gsdlhome, "cgi-bin", "webpage_buildcol.pl");
    465       cmd += " gsdlhome=\""+gsdlhome+"\" httpbuild=\""+args["httpbuild"]+"\"";
    466       cmd += " bc1copydata=\""+args["bc1copydata"]+"\"";
    467       cmd += " bc1doimport=\""+args["bc1doimport"]+"\"";
    468       cmd += " bc1dobuild=\""+args["bc1dobuild"]+"\"";
    469       cmd += " bc1dirname=\""+args["bc1dirname"]+"\" bc1tmpname=\""+tmpname+"\" &";
    470      
    471       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;
    472495    }
    473496
Note: See TracChangeset for help on using the changeset viewer.