Changeset 28991 for main/trunk/greenstone2/bin/script/gti.pl
- Timestamp:
- 2014-04-17T16:16:12+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/gti.pl
r28977 r28991 720 720 } 721 721 722 723 my $perllib_path = &util::filename_cat($gsdl_root_directory, "perllib"); # strings.properties 724 my $gliclasses_path = &util::filename_cat($gsdl_root_directory, "gli", "classes"); # dictionary.properties 725 my $os = $^O; 726 my $path_separator = ($^O =~ m/mswin/i) ? ";" : ":"; 727 my $xalan_path = &util::filename_cat($classpath, "xalan.jar"); 728 $classpath = "$perllib_path$path_separator$gliclasses_path$path_separator$classpath$path_separator$xalan_path"; 729 722 730 my $gli_help_directory = &util::filename_cat($gsdl_root_directory, "gli"); 723 731 $gli_help_directory = &util::filename_cat($gli_help_directory, "help"); … … 735 743 736 744 my $target_filepath = &util::filename_cat($gsdl_root_directory, $target_file); 737 745 746 # if gli/help/nl doesn't exist, create it by copying over gli/help/en/help.xml, then process the copied file 747 my ($tailname, $glihelp_lang_dir, $suffix) = &File::Basename::fileparse($target_filepath, "\\.[^\\.]+\$"); 748 if(!&FileUtils::directoryExists($glihelp_lang_dir)) { 749 750 # copy across the gli/help/en/help.xml into a new folder for the new language gli/help/<newlang> 751 my $en_glihelp_dir = &util::filename_cat($gli_help_directory, "en"); 752 my $en_helpxml_file = &util::filename_cat($en_glihelp_dir, "help.xml"); 753 &FileUtils::copyFilesRecursiveNoSVN($en_helpxml_file, $glihelp_lang_dir); 754 755 # In gli/help/<newlang>/help.xml, replace all occurrences of 756 # <Text id="1">This text in en will be removed for new langcode</Text> 757 # with <!-- Missing translation: 1 --> 758 open(FIN,"<$target_filepath") or &throw_fatal_error("Could not open $target_filepath for READING after creating it"); 759 my $help_xml_contents; 760 # Read in the entire contents of the file in one hit 761 sysread(FIN, $help_xml_contents, -s FIN); 762 close(FIN); 763 764 $help_xml_contents =~ s@<Text id="([^"]+?)">(.*?)</Text>@<!-- Missing translation: $1 -->@sg; 765 766 open(FOUT, ">$target_filepath") or &throw_fatal_error("Could not open $target_filepath for WRITING after creating it"); 767 print FOUT $help_xml_contents; 768 close(FOUT); 769 } 770 738 771 my $perl_exec = &util::get_perl_exec(); 739 772 my $java_exec = "java"; … … 741 774 $java_exec = &util::filename_cat($ENV{'JAVA_HOME'}, "bin", "java"); 742 775 } 743 744 my $cmd = "$java_exec -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_many_html_xsl_filepath $target_filepath | \"$perl_exec\" -S $split_script_filepath $target_file_directory"; 776 777 #my $cmd = "$java_exec -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_many_html_xsl_filepath $target_filepath | \"$perl_exec\" -S $split_script_filepath $target_file_directory"; 778 my $cmd = "$java_exec -DGSDLHOME=$gsdl_root_directory -cp $classpath ApplyXSLT $target_language_code $gen_many_html_xsl_filepath $target_filepath | \"$perl_exec\" -S $split_script_filepath $target_file_directory"; 779 #&throw_fatal_error("RAN gti command: $cmd"); 745 780 my $response = `$cmd`; 746 747 $cmd = "$java_exec -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_index_xml_xsl_filepath $target_filepath > " . $target_file_directory . "help_index.xml"; # 2>/dev/null"; 781 782 #$cmd = "$java_exec -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_index_xml_xsl_filepath $target_filepath > " . $target_file_directory . "help_index.xml"; # 2>/dev/null"; 783 $cmd = "$java_exec -cp $classpath -DGSDLHOME=$gsdl_root_directory ApplyXSLT $target_language_code $gen_index_xml_xsl_filepath $target_filepath > " . $target_file_directory . "help_index.xml"; # 2>/dev/null"; 748 784 $response = `$cmd`; 749 785 786 # create a gti/tmp folder, if one doesn't already exist, and store the downloadable zip file in there 787 my $tmpdir = &util::filename_cat($gsdl_root_directory, "tmp"); 788 if(!&FileUtils::directoryExists($tmpdir)) { 789 &FileUtils::makeDirectory($tmpdir); 790 } 750 791 #my $zip_file_path = "/greenstone/custom/gti/" . $target_language_code . "_GLIHelp.zip"; 751 my $zip_file_path = &util::filename_cat($ gsdl_root_directory, $target_language_code . "_GLIHelp.zip");792 my $zip_file_path = &util::filename_cat($tmpdir, $target_language_code . "_GLIHelp.zip"); 752 793 $cmd = "zip -rj $zip_file_path $target_file_directory -i \*.htm \*.xml"; 794 753 795 $response = `$cmd`; 754 796 }
Note:
See TracChangeset
for help on using the changeset viewer.