- Timestamp:
- 1999-12-13T15:21:27+13:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/buildaction.cpp
r760 r822 28 28 #include "OIDtools.h" 29 29 #include "fileutil.h" 30 #include "htmlutils.h" 30 31 #include "buildaction.h" 31 32 #include "gsdlhome.h" … … 78 79 bool buildaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args, 79 80 ostream &/*logout*/) { 80 if ( args["bca"] != "buildstatus")81 if ((args["bca"] != "buildstatus") && (args["bca"] != "collog")) 81 82 { 82 83 // authenticate the user if authentication is avaiable … … 97 98 void buildaction::define_internal_macros (displayclass &disp, cgiargsclass &args, 98 99 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 (); 99 114 100 115 // build up javascript and HTML code useful in web forms … … 226 241 } 227 242 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")) 229 244 { 230 245 disp.setmacro ("dirnamelist", "build", dirnamelist); … … 259 274 } 260 275 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 261 282 // if edit collection, read in collect.cfg file 262 283 if (args["bca"]=="editcol") … … 270 291 ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate); 271 292 if (cfg_ifs) 272 { 293 { 294 // read in collect.cfg 273 295 text_t cfg_text = ""; 274 296 … … 277 299 while (!cfg_ifs.eof ()) { 278 300 cfg_text.push_back(c); 301 if (c=='\\') { cfg_text.push_back('\\'); } 279 302 cfg_ifs.get(c); 280 303 } 281 304 282 305 cfg_ifs.close(); 306 if (cfgperm=="readonly") cfg_text = html_safe(cfg_text); 283 307 284 308 // define it as a macro … … 291 315 } 292 316 } 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 } 293 351 } 294 352 … … 313 371 else if (args["bca"] == "delcol") { 314 372 return do_delcol (args, disp, outconvert, textout, logout); 373 } 374 else if (args["bca"] == "collog") { 375 return do_collog (args, disp, outconvert, textout, logout); 315 376 } 316 377 else if (args["bca"] == "mess") { … … 426 487 427 488 489 bool 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 428 499 bool buildaction::do_mess (cgiargsclass &args, displayclass &disp, 429 500 outconvertclass &outconvert, ostream &textout, -
trunk/gsdl/src/recpt/buildaction.h
r760 r822 41 41 text_t get_action_name () {return "bc";} 42 42 43 void set_receptionist (receptionist *therecpt) {recpt=therecpt;} 44 43 45 bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args, 44 46 ostream &logout); … … 78 80 ostream &logout); 79 81 82 bool do_collog (cgiargsclass &args, displayclass &disp, 83 outconvertclass &outconvert, ostream &textout, 84 ostream &logout); 85 80 86 bool do_mess (cgiargsclass &args, displayclass &disp, 81 87 outconvertclass &outconvert, ostream &textout,
Note:
See TracChangeset
for help on using the changeset viewer.