Changeset 1437 for trunk/gsdl/src/recpt
- Timestamp:
- 2000-08-21T16:47:48+12:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/collectoraction.cpp
r1432 r1437 511 511 while (rprotolist_here != rprotolist_end) { 512 512 if ((*rprotolist_here).p != NULL) { 513 514 // don't include z39.50 collection 515 if ((*rprotolist_here).p->get_protocol_name () == "z3950proto") { 516 rprotolist_here ++; 517 continue; 518 } 519 513 520 text_tarray collist; 514 521 comerror_t err; … … 601 608 } 602 609 610 // set the _statusline_ macro 611 void collectoraction::set_statusline (displayclass &disp, const text_t &collection, ostream &logout) { 612 613 // the build command creates .bld.download, .bld.import, and .bld.build files (in that 614 // order) and deletes them (also in that order) when each stage is complete. the .bld 615 // file is the concatenation of all these files. 616 text_t bld_file = filename_cat (gsdlhome, "tmp", collection + ".bld"); 617 text_t statusline; 618 619 if (file_exists (bld_file + ".download")) { 620 statusline = "Downloading files ...<br>"; 621 statusline += file_tail (bld_file + ".download"); 622 } else if (file_exists (bld_file + ".import")) { 623 statusline = "Importing collection ...<br>"; 624 statusline += file_tail (bld_file + ".import"); 625 } else if (file_exists (bld_file + ".build")) { 626 statusline = "Building collection ..."; 627 statusline += file_tail (bld_file + ".build"); 628 } else { 629 statusline += file_tail (bld_file); 630 } 631 632 disp.setmacro ("statusline", "collector", statusline); 633 634 } 635 603 636 void collectoraction::define_internal_macros (displayclass &disp, cgiargsclass &args, 604 637 recptprotolistclass *protos, ostream &logout) { … … 610 643 // collection" page 611 644 // _cfgfile_ -- if displaying the "configure collection" page 645 // _statusline_ -- if displaying the bildstatus page 646 // _pagebanner_ -- may be set to _collector:plainbanner_ for some pages 612 647 613 648 text_t &collector_page = args["cp"]; … … 617 652 // set _pagescriptextra_ macro to _cpagescriptextra_ 618 653 disp.setmacro ("pagescriptextra", "collector", "_" + collector_page + "scriptextra_"); 654 655 // set _pagebanner_ for those pages that don't want a fancy header (e.g. those 656 // displayed in frames 657 if (collector_page == "bildstatus") { 658 disp.setmacro ("pagebanner", "collector", "_plainbanner_"); 659 } 619 660 620 661 // set the collectorbar macro … … 696 737 if (collector_page == "conf") 697 738 set_cfgfile (disp, args["bc1dirname"], logout); 739 if (collector_page == "bildstatus") 740 set_statusline (disp, args["bc1dirname"], logout); 698 741 } 699 742 … … 705 748 text_t &collector_page = args["cp"]; 706 749 text_t &collection = args["bc1dirname"]; 707 text_t message;708 709 if (do_mkcol) {710 // execute mkcol.pl (do_mkcol is set from within check_cgiargs)711 text_t mkcol_cmd = "perl ";712 mkcol_cmd += filename_cat (gsdlhome, "bin", "script", "mkcol.pl");713 mkcol_cmd += " -creator \"" + args["bc1contactemail"] + "\"";714 mkcol_cmd += " -title \"" + args["bc1fullname"] + "\"";715 mkcol_cmd += " -about \"" + carriage_replace (args["bc1aboutdesc"], 0) + "\" ";716 mkcol_cmd += collection;717 char *mkcol_cmdc = mkcol_cmd.getcstr();718 system (mkcol_cmdc);719 delete mkcol_cmdc;720 721 // make sure it went ok722 text_t cfgfile = filename_cat (gsdlhome, "collect", collection,723 "etc", "collect.cfg");724 if (!file_writable (cfgfile)) message = "mkcolfail";725 do_mkcol = false; // reset for fast-cgi726 }727 750 728 751 if (collector_page == "bild") { … … 759 782 #endif 760 783 delete build_cmdc; 761 } 762 763 if (args["bc1dodelete"] == "1") { 764 // delete bcidirname collection 765 if (collection_protected (collection)) { 766 message = "delinvalid"; 767 784 785 // don't want header and stuff for build page as it uses frames 786 textout << outconvert << disp << ("_collector:bildcontent_\n"); 787 788 } else { 789 790 // not bild page 791 792 text_t message; 793 794 if (do_mkcol) { 795 // execute mkcol.pl (do_mkcol is set from within check_cgiargs) 796 text_t mkcol_cmd = "perl "; 797 mkcol_cmd += filename_cat (gsdlhome, "bin", "script", "mkcol.pl"); 798 mkcol_cmd += " -creator \"" + args["bc1contactemail"] + "\""; 799 mkcol_cmd += " -title \"" + args["bc1fullname"] + "\""; 800 mkcol_cmd += " -about \"" + carriage_replace (args["bc1aboutdesc"], 0) + "\" "; 801 mkcol_cmd += collection; 802 char *mkcol_cmdc = mkcol_cmd.getcstr(); 803 system (mkcol_cmdc); 804 delete mkcol_cmdc; 805 806 // make sure it went ok 807 text_t cfgfile = filename_cat (gsdlhome, "collect", collection, 808 "etc", "collect.cfg"); 809 if (!file_writable (cfgfile)) message = "mkcolfail"; 810 do_mkcol = false; // reset for fast-cgi 811 } 812 813 if (args["bc1dodelete"] == "1") { 814 // delete bcidirname collection 815 if (collection_protected (collection)) { 816 message = "delinvalid"; 817 818 } else { 819 820 text_t delete_cmd = "perl " + filename_cat (gsdlhome, "bin", "script", "delcol.pl"); 821 delete_cmd += " -f " + collection; 822 char *delete_cmdc = delete_cmd.getcstr(); 823 int rv = system (delete_cmdc); 824 delete delete_cmdc; 825 if (rv != 0) { 826 // deletion failed -- permissions? 827 message = "delpermission"; 828 } else { 829 message = "delsuccess"; 830 } 831 } 832 } 833 834 if (clone_failed) { 835 // clone_failed is set from check_cgiargs if an attempt was made 836 // to clone an invalid collection 837 message = "clonefail"; 838 clone_failed = false; 839 } 840 841 if (message.empty()) { 842 textout << outconvert << disp << ("_collector:header_\n") 843 << ("_collector:" + collector_page + "content_\n") 844 << ("_collector:footer_\n"); 768 845 } else { 769 770 text_t delete_cmd = "perl " + filename_cat (gsdlhome, "bin", "script", "delcol.pl"); 771 delete_cmd += " -f " + collection; 772 char *delete_cmdc = delete_cmd.getcstr(); 773 int rv = system (delete_cmdc); 774 delete delete_cmdc; 775 if (rv != 0) { 776 // deletion failed -- permissions? 777 message = "delpermission"; 778 } else { 779 message = "delsuccess"; 780 } 781 } 782 } 783 784 if (clone_failed) { 785 // clone_failed is set from check_cgiargs if an attempt was made 786 // to clone an invalid collection 787 message = "clonefail"; 788 clone_failed = false; 789 } 790 791 if (message.empty()) { 792 textout << outconvert << disp << ("_collector:header_\n") 793 << ("_collector:" + collector_page + "content_\n") 794 << ("_collector:footer_\n"); 795 } else { 796 textout << outconvert << disp << ("_collector:header_\n") 797 << ("_collector:" + message + "content_\n") 798 << ("_collector:footer_\n"); 799 } 800 846 textout << outconvert << disp << ("_collector:header_\n") 847 << ("_collector:" + message + "content_\n") 848 << ("_collector:footer_\n"); 849 } 850 } 801 851 return true; 802 852 } -
trunk/gsdl/src/recpt/collectoraction.h
r1432 r1437 50 50 void set_cfgfile (displayclass &disp, const text_t &dirname, ostream &logout); 51 51 52 void set_statusline (displayclass &disp, const text_t &collection, ostream &logout); 53 52 54 void update_cfgfile_clone (cgiargsclass &args, ostream &logout); 53 55
Note:
See TracChangeset
for help on using the changeset viewer.