- Timestamp:
- 2000-08-31T20:07:53+12:00 (24 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/build
r1461 r1485 140 140 # we assume anything not beginning with http:// or ftp:// 141 141 # is a file or directory on the local file system. 142 $download_dir =~ s/^file: \/\///;142 $download_dir =~ s/^file:(\/\/)?//; 143 143 144 144 if (-e $download_dir) { -
trunk/gsdl/bin/script/filecopy.pl
r1454 r1485 54 54 my $full_importname 55 55 = &util::filename_cat($collectdir, $dirname, "import"); 56 57 print $out "full_importname: $full_importname\n";58 56 59 57 # split argv into 2 lists: files and directories -
trunk/gsdl/lib/fileutil.cpp
r1476 r1485 280 280 } 281 281 282 // returns the last line (or last 256 characters) 283 // of filename file 282 283 text_t file_tail (const text_t &filename, int numlines) { 284 if (numlines < 1) numlines = 1; 285 int numchars = 256*numlines; 286 287 text_tarray lines; 288 text_t ret; 289 290 char *filenamec = filename.getcstr(); 291 char linec[256]; 292 ifstream file_in (filenamec); 293 delete filenamec; 294 if (file_in) { 295 296 // this should be here to keep things reasonably fast 297 // when there's a long file to tail but I can't work out 298 // how to tell when it's rewound past the beginning of the file 299 // (which causes some problems) 300 301 // file_in.seekg (-numchars, ios::end); 302 303 while (!file_in.eof()) { 304 file_in.getline (linec, 256); 305 ret.setcstr(linec); 306 text_t::const_iterator here = ret.begin(); 307 text_t::const_iterator end = ret.end(); 308 // make sure line has content 309 while (here != end) { 310 if (*here != '\n' && *here != ' ') { 311 lines.push_back (ret); 312 break; 313 } 314 here ++; 315 } 316 } 317 file_in.close(); 318 } 319 320 ret.clear(); 321 int numlinesgot = lines.size(); 322 int sindex = 0; 323 if (numlinesgot > numlines) sindex = numlinesgot - numlines; 324 for (int i = sindex; i < numlinesgot; i++) { 325 ret += lines[i] + "\n"; 326 } 327 328 return ret; 329 } 330 331 // returns the last numlines lines (or last numlines*256 332 // characters) of file 333 /* 284 334 text_t file_tail (const text_t &filename) { 335 285 336 286 337 text_t return_str, tmpstr; 287 338 char *filenamec = filename.getcstr(); 288 339 char linec[256]; 289 290 340 291 341 ifstream file_in (filenamec); … … 313 363 return return_str; 314 364 } 315 365 */ 316 366 #ifdef __WIN32__ 317 367 … … 343 393 344 394 #endif 395 396 // read in file from filename and load into content 397 bool read_file (const text_t &filename, text_t &content) { 398 399 content.clear(); 400 401 char *filenamec = filename.getcstr(); 402 #ifdef GSDL_USE_IOS_H 403 ifstream file_in (filenamec, ios::in | ios::nocreate); 404 #else 405 ifstream file_in (filenamec, ios::in); 406 #endif 407 delete filenamec; 408 409 if (file_in) { 410 char c; 411 file_in.get(c); 412 while (!file_in.eof ()) { 413 content.push_back(c); 414 file_in.get(c); 415 } 416 file_in.close(); 417 } else { 418 return false; 419 } 420 return true; 421 } -
trunk/gsdl/lib/fileutil.h
r1456 r1485 53 53 bool file_copy (const text_t &fromfile, const text_t &tofile); 54 54 55 text_t file_tail (const text_t &filename );55 text_t file_tail (const text_t &filename, int numlines); 56 56 57 57 // returns true if directory created successfully 58 58 bool mk_dir (const text_t &dirname); 59 59 60 bool read_file (const text_t &filename, text_t &content); 61 60 62 #endif -
trunk/gsdl/macros/collect.dm
r1476 r1485 19 19 _gstimage_ [v=1] {<a href="_1_" target="\_top">_5_</a><br>} 20 20 21 22 23 21 # a plain header for those pages that need it (the _pagebanner_ macro 24 22 # will be set to this by the server for those pages. 25 23 _plainbanner_ {} 24 25 # dont want links to "help" or "preferences" pages from within 26 # collector 27 _javalinks_ {_imagehome_} 28 _javalinks_ [v=1] { 29 _imagehome_<br> 30 } 31 26 32 27 33 ####################################################################### … … 79 85 _httpconf_ {_gwcgi_?e=_compressedoptions_&cp=conf} 80 86 _httpbild_ {_gwcgi_?e=_compressedoptions_&cp=bild} 81 _httpview_ {_gwcgi_? e=_compressedoptions_&a=p&p=about&c=_cgiargbc1dirname_}87 _httpview_ {_gwcgi_?a=p&p=about&c=_cgiargbc1dirname_} 82 88 _httpdel_ {javascript:do_delete();} 83 89 … … 429 435 function check\_submit (gotopage) \{ 430 436 var form = document.collectorform; 431 if (form.bc1inputdir1.value.match(/^\\s*$/) && 432 form.bc1inputdir2.value.match(/^\\s*$/) && 433 form.bc1inputdir3.value.match(/^\\s*$/) && 434 form.bc1inputdir4.value.match(/^\\s*$/)) 437 var found = 0; 438 var i = 0; 439 if (!form.bc1inputdir1.value.match(/^\\s*$/)) \{ 440 if (!form.bc1inputdir1.value.match(/^\(http|ftp|file\):/)) \{ 441 i = form.sel1.selectedIndex; 442 form.bc1inputdir1.value = form.sel1.options[i].value + form.bc1inputdir1.value; 443 \} 444 found = 1; 445 \} 446 if (!form.bc1inputdir2.value.match(/^\\s*$/)) \{ 447 if (!form.bc1inputdir2.value.match(/^\(http|ftp|file\):/)) \{ 448 i = form.sel2.selectedIndex; 449 form.bc1inputdir2.value = form.sel2.options[i].value + form.bc1inputdir2.value; 450 \} 451 found = 1; 452 \} 453 if (!form.bc1inputdir3.value.match(/^\\s*$/)) \{ 454 if (!form.bc1inputdir3.value.match(/^\(http|ftp|file\):/)) \{ 455 i = form.sel3.selectedIndex; 456 form.bc1inputdir3.value = form.sel3.options[i].value + form.bc1inputdir3.value; 457 \} 458 found = 1; 459 \} 460 if (!form.bc1inputdir4.value.match(/^\\s*$/)) \{ 461 if (!form.bc1inputdir4.value.match(/^\(http|ftp|file\):/)) \{ 462 i = form.sel4.selectedIndex; 463 form.bc1inputdir4.value = form.sel4.options[i].value + form.bc1inputdir4.value; 464 \} 465 found = 1; 466 \} 467 468 if (!found) 435 469 \{ 436 470 alert("At least one input source must be specified"); … … 449 483 \} else \{ 450 484 form.bc1clonechanged.value = 0; 485 \} 486 menuchange(); 487 \} 488 489 function menuchange () \{ 490 var form = document.collectorform; 491 var warnlist = new Array (_warnindex_); 492 493 if (warnlist[form.bc1clonecol.selectedIndex] == 1) \{ 494 alert ("The collection you are cloning has a non-standard input file\\n" + 495 "format, and/or uses metadata specified in auxiliary files. If your\\n" + 496 "new input lacks this information, some browsing facilities may not\\n" + 497 "work properly."); 451 498 \} 452 499 \} … … 499 546 500 547 <h4>Input source:</h4> 501 <input type=text name="bc1inputdir1" value="_cgiargbc1inputdir1_" size=72>548 _typeselect_(1,file)<input type=text name="bc1inputdir1" value="_cgiargbc1inputdir1_" size=60> 502 549 <br> 503 <input type=text name="bc1inputdir2" value="_cgiargbc1inputdir2_" size=72>550 _typeselect_(2,http)<input type=text name="bc1inputdir2" value="_cgiargbc1inputdir2_" size=60> 504 551 <br> 505 <input type=text name="bc1inputdir3" value="_cgiargbc1inputdir3_" size=72>552 _typeselect_(3,ftp)<input type=text name="bc1inputdir3" value="_cgiargbc1inputdir3_" size=60> 506 553 <br> 507 <input type=text name="bc1inputdir4" value="_cgiargbc1inputdir4_" size=72>554 _typeselect_(4,file)<input type=text name="bc1inputdir4" value="_cgiargbc1inputdir4_" size=60> 508 555 <br> 509 556 <font color="#909090"> … … 525 572 526 573 <p>_iconblankbar_ 527 <p>Remember, you can always revisit a previous stage by clicking its yellow 528 button. 574 <p>Click one of the green buttons. If you are an advanced user you may want 575 to adjust the collection configuration. Alternatively, go straight to the 576 building stage. Remember, you can always revisit an earlier stage by 577 clicking its yellow button. 529 578 530 579 <p><center> … … 537 586 </form> 538 587 } 588 589 _typeselect_ {<select name="sel_1_"> 590 <option value="file://" _If_("_2_" eq "file",selected)>file:// 591 <option value="http://" _If_("_2_" eq "http",selected)>http:// 592 <option value="ftp://" _If_("_2_" eq "ftp",selected)>ftp:// 593 </select>} 539 594 540 595 _srcemenu_ {<input type=radio name=bc1clone onClick="clone_changed(1);" value=1 … … 622 677 <frameset rows="*,150" border=0> 623 678 <noframes><body bgcolor="#ffffff"> 624 <p>You must have a frame enabled browser to view this.</p> 679 <p>You must have a frame enabled browser to obtain feedback 680 on how the building process is progressing. The collection <i>will</i> 681 continue to build as normal however. 682 683 <table> 684 <tr valign=center><td> 685 To stop the building process at any time, click here. 686 <br>The collection you are working on will remain intact. 687 </td> 688 <td><input type="submit" value="stop building"></td> 689 </table> 690 625 691 </body> 626 692 </noframes> … … 681 747 status line below gives feedback on how the operation is progressing. 682 748 <p> 683 To stop the building process at any time, click here: 684 <input type="submit" value="stop building"> 749 750 <table> 751 <tr valign=center><td> 752 To stop the building process at any time, click here. 685 753 <br>The collection you are working on will remain intact. 754 </td> 755 <td><input type="submit" value="stop building"></td> 756 </table> 757 686 758 <p> 687 759 If you leave this page (and have not cancelled the building process with … … 814 886 <tr><td> 815 887 <p>An error has occurred while attempting to build your collection. 888 <br> The build log contains the following: 889 <p>_faillog_ 816 890 </td></tr> 817 891 </table></center> -
trunk/gsdl/src/recpt/collectoraction.cpp
r1474 r1485 251 251 // note that the "bildstatus" and "bildframe1" pages don't actually do anything 252 252 // functional so we don't need to worry about authenticating them (it's the 253 // underlying "bild" page that does the building (an ccreates the frameset))253 // underlying "bild" page that does the building (and creates the frameset)) 254 254 // This helps us overcome a bit of a problem we have with multiple pages trying 255 255 // to read from the key.db database at the same time. … … 324 324 // turned on). 325 325 update_cfgfile_clone (args, logout); 326 327 // if cloning has just been turned on we'll also copy the rest of the files 328 // (excluding collect.cfg which we've already done) from the cloned collections 329 // etc directory to the new collection. 330 if (args["bc1clone"] == "1") { 331 text_t clone_etc = filename_cat(gsdlhome, "collect", args["bc1clonecol"], "etc"); 332 text_t new_etc = filename_cat(get_collectdir(args), args["bc1dirname"], "etc"); 333 text_tarray files; 334 335 if (read_dir (clone_etc, files)) { 336 text_tarray::const_iterator here = files.begin(); 337 text_tarray::const_iterator end = files.end(); 338 while (here != end) { 339 if (*here != "collect.cfg" && *here != "collect.cfg.org") { 340 file_copy (filename_cat(clone_etc, *here), filename_cat(new_etc, *here)); 341 } 342 here ++; 343 } 344 } else { 345 outconvertclass text_t2ascii; 346 logout <<text_t2ascii << "collectoraction::check_cgiargs couldn't read from " 347 << clone_etc << " directory\n"; 348 } 349 } 326 350 } 327 351 … … 578 602 } 579 603 580 // set the _fullnamemenu_ macro 604 // set the _fullnamemenu_ macro (and _warnindex_ if we're on the "srce" page) 581 605 void collectoraction::set_fullnamemenu (displayclass &disp, cgiargsclass &args, 582 606 recptprotolistclass *protos, ostream &logout) { … … 633 657 dirnames.push_back(*collist_here); 634 658 fullnames.push_back(collectionname); 635 // check to see if the "collection"is writable659 // check to see if the collection is writable 636 660 if (collection_protected (*collist_here)) write_protected.push_back(true); 637 661 else write_protected.push_back(false); 662 638 663 if (*collist_here == currentname) selected_index = index; 639 640 664 index ++; 641 665 } … … 647 671 } 648 672 649 bool have_one = false; 673 bool first = true; 674 text_t warnindex; 650 675 text_t fullnamemenu = "<select name=\"bc1dirname\">\n"; 651 if (current_page == "srce") fullnamemenu = "<select name=\"bc1clonecol\" >\n";676 if (current_page == "srce") fullnamemenu = "<select name=\"bc1clonecol\" onChange=\"menuchange();\">\n"; 652 677 for (int i = 0; i < index; i ++) { 653 678 // don't want write protected collections in list on "change existing 654 679 // collection" page 655 680 if (write_protected[i] && current_page == "existing") continue; 656 have_one = true;657 681 fullnamemenu += "<option value=\"" + dirnames[i] + "\""; 658 682 if (i == selected_index) fullnamemenu += " selected"; … … 660 684 fullnamemenu += fullnames[i]; 661 685 if (write_protected[i]) fullnamemenu += " <b>(write protected)</b>"; 686 fullnamemenu.push_back ('\n'); 687 688 // add to Warnindex if collection uses any dubious plugins 689 // (if creating clone collection list) 690 if (current_page == "srce") { 691 if (!first) warnindex.push_back(','); 692 if (uses_weird_plugin (dirnames[i])) { 693 warnindex += text_t (1); 694 } else { 695 warnindex += text_t (0); 696 } 697 } 698 first = false; 662 699 } 663 700 fullnamemenu += "</select>\n"; 664 if (have_one) disp.setmacro ("fullnamemenu", "collector", fullnamemenu); 701 702 if (!first) { 703 disp.setmacro ("fullnamemenu", "collector", fullnamemenu); 704 if (current_page == "srce") 705 disp.setmacro ("warnindex", "collector", warnindex); 706 } 665 707 } 666 708 … … 718 760 if (file_exists (bld_file + ".download")) { 719 761 statusline = "Downloading files ...<br>\n"; 720 statusline += file_tail (bld_file + ".download" );762 statusline += file_tail (bld_file + ".download", 1); 721 763 } else if (file_exists (bld_file + ".import")) { 722 764 statusline = "Importing collection ...<br>\n"; 723 statusline += file_tail (bld_file + ".import" );765 statusline += file_tail (bld_file + ".import", 1); 724 766 } else if (file_exists (bld_file + ".build")) { 725 767 statusline = "Building collection ...<br>\n"; 726 statusline += file_tail (bld_file + ".build" );768 statusline += file_tail (bld_file + ".build", 1); 727 769 } else { 728 770 statusline += "creating collection ...<br>\n"; 729 statusline += file_tail (bld_file );771 statusline += file_tail (bld_file, 1); 730 772 } 731 773 … … 745 787 // _statusline_ -- if displaying the bildstatus page 746 788 // _header_ -- may be set for pages that require it 789 // _faillog_ - set to last 6 lines of .bld file if build failed 747 790 748 791 text_t &collector_page = args["cp"]; … … 797 840 collectorbar += get_button (collector_page, "green", "conf", true); 798 841 collectorbar += "<td>_icongreyarrow_</td>\n"; 799 collectorbar += get_button (collector_page, "gre y", "bild", false);842 collectorbar += get_button (collector_page, "green", "bild", true); 800 843 collectorbar += "<td>_icongreyarrow_</td>\n"; 801 844 collectorbar += get_button (collector_page, "grey", "view", false); … … 857 900 collectorbar += "<td>_icongreyarrow_</td>\n"; 858 901 collectorbar += get_button (collector_page, "grey", "view", false); 902 } 903 904 if (collector_page == "bildfail") { 905 text_t bldlog = filename_cat(gsdlhome, "tmp", args["bc1tmp"], args["bc1dirname"] + ".bld"); 906 text_t rawlog = file_tail (bldlog, 6); 907 // we'll shove in some <br> tags where \n's occur 908 text_t faillog; 909 text_t::const_iterator here = rawlog.begin(); 910 text_t::const_iterator end = rawlog.end(); 911 while (here != end) { 912 if (*here == '\n') faillog += "<br>"; 913 faillog.push_back (*here); 914 here ++; 915 } 916 disp.setmacro ("faillog", "collector", faillog); 859 917 } 860 918 … … 1229 1287 } 1230 1288 } 1289 1290 // checks to see if any of the plugins in pluginset occur in 1291 // collections configuration file 1292 bool collectoraction::uses_weird_plugin (const text_t &collection) { 1293 1294 text_tset pluginset; 1295 pluginset.insert ("HBPlug"); 1296 1297 text_t cfgfile_content; 1298 text_t cfgfile_name = filename_cat (gsdlhome, "collect", collection, "etc", "collect.cfg"); 1299 text_t pluginstr, pluginname; 1300 1301 if (read_file (cfgfile_name, cfgfile_content)) { 1302 text_t::const_iterator here = cfgfile_content.begin(); 1303 text_t::const_iterator end = cfgfile_content.end(); 1304 while (here != end) { 1305 here = findchar (here, end, 'p'); 1306 if (here == end) break; 1307 if ((here+6 < end) && (substr (here, here+6) == "plugin")) { 1308 getdelimitstr (here+6, end, '\n', pluginstr); 1309 text_t::const_iterator hp = pluginstr.begin(); 1310 text_t::const_iterator ep = pluginstr.end(); 1311 bool found = false; 1312 // remove any leading whitespace, trailing options etc. 1313 while (hp != ep) { 1314 if (*hp == '\t' || *hp == ' ' || *hp == '\n') { 1315 if (found) break; 1316 } else { 1317 pluginname.push_back (*hp); 1318 found = true; 1319 } 1320 hp ++; 1321 } 1322 text_tset::const_iterator it = pluginset.find (pluginname); 1323 if (it != pluginset.end()) return true; // found matching plugin 1324 pluginname.clear(); 1325 } 1326 here ++; 1327 } 1328 } 1329 return false; 1330 } -
trunk/gsdl/src/recpt/collectoraction.h
r1457 r1485 75 75 text_t get_collectdir (cgiargsclass &args); 76 76 77 bool collectoraction::uses_weird_plugin (const text_t &collection); 78 77 79 public: 78 80 collectoraction ();
Note:
See TracChangeset
for help on using the changeset viewer.