Changeset 1342 for branches/z3950-branch/gsdl/src/recpt/buildaction.cpp
- Timestamp:
- 2000-08-03T14:49:41+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/z3950-branch/gsdl/src/recpt/buildaction.cpp
r1149 r1342 2 2 * 3 3 * buildaction.cpp -- building collections 4 * Copyright (C) 1999 DigiLib Systems Limited, New Zealand4 * Copyright (C) 1999 The New Zealand Digital Library Project 5 5 * 6 6 * A component of the Greenstone digital library software … … 24 24 *********************************************************************/ 25 25 26 #if !defined(__WIN32__) || defined(__GNUC__)27 #include <unistd.h>28 #endif29 30 26 #include "OIDtools.h" 31 27 #include "fileutil.h" 32 28 #include "htmlutils.h" 29 #include "gsdltools.h" 33 30 #include "buildaction.h" 34 31 … … 105 102 // make sure we know about a receptionist 106 103 if (recpt == NULL) { 107 logout << "The pageaction does not contain information\n"104 logout << "The build action does not contain information\n" 108 105 << "about any receptionists. The method set_receptionist\n" 109 106 << "was probably not called from the module which instantiated\n" 110 << "this pageaction.\n";107 << "this build action.\n"; 111 108 return; 112 109 } … … 119 116 text_t fullnamelist = "var fullnamelist = new Array("; 120 117 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"; 124 121 int rcount = 1; 125 122 int fcount = 1; … … 149 146 while (collist_here != collist_end) { 150 147 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) { 154 150 text_t collectionname = *collist_here; 155 if (!cinfo .collectionmeta["collectionname"].empty())151 if (!cinfo->collectionmeta["collectionname"].empty()) 156 152 { 157 153 // get collection name from the collection cfg file 158 collectionname = cinfo .collectionmeta["collectionname"];154 collectionname = cinfo->collectionmeta["collectionname"]; 159 155 } 160 156 else … … 172 168 dirnamelist += (text_t)"\"" + *collist_here + "\""; 173 169 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()) 176 173 { 177 174 if ((rcount==1) && (ccount==1)) … … 205 202 if (args["bca"]=="buildcol") 206 203 { 207 if (((args["bc1dirname"] =="") && (rcount==1) && (ccount==1))204 if (((args["bc1dirname"].empty()) && (rcount==1) && (ccount==1)) 208 205 || (args["bc1dirname"]==*collist_here)) 209 206 { 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"]); 212 209 213 if (cinfo .buildDate==0) // not built210 if (cinfo->buildDate==0) // not built 214 211 { 215 212 // assume that's because this is the first build ever for the collection … … 243 240 } 244 241 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")) 246 244 { 247 245 disp.setmacro ("dirnamelist", "build", dirnamelist); … … 271 269 text_t bc1name = substr(args_entry.begin()+3,args_entry.end()); 272 270 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])); 274 272 } 275 273 args_here++; … … 291 289 text_t cfg_fname 292 290 = filename_cat(gsdlhome, "collect", dirname, "etc", "collect.cfg"); 291 292 #ifdef GSDL_USE_IOS_H 293 293 ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate); 294 #else 295 ifstream cfg_ifs (cfg_fname.getcstr(), ios::in); 296 #endif 297 294 298 if (cfg_ifs) 295 299 { … … 325 329 326 330 // 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 328 334 ifstream bld_ifs (bld_fname.getcstr(), ios::in | ios::nocreate); 335 #else 336 ifstream bld_ifs (bld_fname.getcstr(), ios::in); 337 #endif 338 329 339 if (bld_ifs) 330 340 { … … 430 440 ostream &logout) { 431 441 432 433 434 435 442 text_tarray wizard_split; 436 443 const text_t wizard = (args["wizard"].empty()) ? "buildcol" : args["wizard"]; … … 447 454 else 448 455 { 449 text_t dirname = (args["bc1dirname"] == "") ? (text_t)"unknown" : args["bc1dirname"]; 456 text_t dirname = (args["bc1dirname"] == "") ? 457 "unknown" : args["bc1dirname"]; 458 450 459 text_t tmpname = dirname+"_XXXXXX"; 451 460 char *cstr_tmpname = tmpname.getcstr(); 452 if (mktemp(cstr_tmpname)==NULL) 461 462 if (GSDL_MKTEMP (cstr_tmpname)==NULL) 453 463 logout << "Failed to create temporary filename" << endl; 454 464 … … 462 472 463 473 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; 472 495 } 473 496
Note:
See TracChangeset
for help on using the changeset viewer.