Changeset 1485 for trunk/gsdl/src/recpt/collectoraction.cpp
- Timestamp:
- 2000-08-31T20:07:53+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.