Index: main/trunk/greenstone2/bin/script/gti.pl
===================================================================
--- main/trunk/greenstone2/bin/script/gti.pl	(revision 30562)
+++ main/trunk/greenstone2/bin/script/gti.pl	(revision 30581)
@@ -103,6 +103,16 @@
         'source_file' => "greenstone3",
         'target_file' => "greenstone3"
+},
+
+# collection config display items of GS3 demo collections. Checked out as gs3-collection-configs
+# from http://svn.greenstone.org/main/trunk/gs3-collection-configs
+{ 'key' => "gs3colcfg",
+	'file_type' => "resource_bundle",
+	'source_file' => "gs3-collection-configs",
+	'target_file' => "gs3-collection-configs"
 }
 ];
+
+my @gs3_col_cfg_files = ("lucene-jdbm-demo", "solr-jdbm-demo");
 
 my @gs3_interface_files = ("interface_default", "ServiceRack", "metadata_names");
@@ -148,5 +158,5 @@
     if ($gti_command =~ /^get-all-chunks$/i) {
 		# Check that GS3 interface is the target
-		if ($module eq "gs3interface") {
+		if ($module eq "gs3interface" || $module eq "gs3colcfg") {
 			print &get_all_chunks_for_gs3(@gti_command_arguments);
 		} else {
@@ -155,5 +165,5 @@
     }
     elsif ($gti_command =~ /^get-first-n-chunks-requiring-work$/i) {
-		if ($module eq "gs3interface") {	   
+		if ($module eq "gs3interface" || $module eq "gs3colcfg") {	   
 			print &get_first_n_chunks_requiring_work_for_gs3(@gti_command_arguments);
 		} else {
@@ -162,5 +172,5 @@
     }
     elsif ($gti_command =~ /^get-uptodate-chunks$/i) {
-		if ($module eq "gs3interface") {	   
+		if ($module eq "gs3interface" || $module eq "gs3colcfg") {	   
 			print &get_uptodate_chunks_for_gs3(@gti_command_arguments);
 		} else {
@@ -397,7 +407,7 @@
 		my $target_file_name = "";
 		
-		if ($translation_file->{'key'} eq "gs3interface") {
+		if ($translation_file->{'key'} eq "gs3interface" || $translation_file->{'key'} eq "gs3colcfg") {
 			my (%source_file_key_to_text_mapping, %target_file_key_to_text_mapping, %source_file_key_to_last_update_date_mapping, %target_file_key_to_last_update_date_mapping ) = ();
-			&build_gs3_configuration($target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, \%source_file_key_to_last_update_date_mapping, \%target_file_key_to_last_update_date_mapping );    
+			&build_gs3_configuration($translation_file->{'key'}, $target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, \%source_file_key_to_last_update_date_mapping, \%target_file_key_to_last_update_date_mapping );    
 			
 			my @target_file_keys_requiring_translation = &determine_chunks_requiring_translation(\%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping);	    
@@ -491,5 +501,5 @@
     
     
-    if ($translation_file_key ne "gs3interface") {
+    if ($translation_file_key ne "gs3interface" && $translation_file_key ne "gs3colcfg") {
 		# Get (and check) the translation configuration
 		($source_file, $target_file, $translation_file_type) = &get_translation_configuration($target_language_code, $translation_file_key);
@@ -518,5 +528,5 @@
 		# Not needed in this case
 		my (%source_file_key_to_gti_command_mapping, %target_file_key_to_gti_command_mapping) = ();
-		&build_gs3_configuration($target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping,
+		&build_gs3_configuration($translation_file_key, $target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping,
 		\%source_file_key_to_gti_command_mapping, \%target_file_key_to_gti_command_mapping, 1);
     }
@@ -580,5 +590,5 @@
 	
     
-    if ($translation_file_key ne "gs3interface") {
+    if ($translation_file_key ne "gs3interface" && $translation_file_key ne "gs3colcfg") {
 		# Get (and check) the translation configuration
 		($source_file, $target_file, $translation_file_type)
@@ -597,5 +607,5 @@
     } 
     else {
-		&build_gs3_configuration($target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, 
+		&build_gs3_configuration($translation_file_key, $target_language_code, \%source_file_key_to_text_mapping, \%target_file_key_to_text_mapping, 
 		\%source_file_key_to_gti_comment_mapping, \%target_file_key_to_gti_comment_mapping, 1);
     }
@@ -700,8 +710,8 @@
     }
     
-    if ($translation_file_key ne "gs3interface") {
+    if ($translation_file_key ne "gs3interface" && $translation_file_key ne "gs3colcfg") {
 		eval "&write_translated_${translation_file_type}(\$source_file, \\\@source_file_lines, \\\%source_file_key_to_text_mapping, \$target_file, \\\@target_file_lines, \\\%target_file_key_to_text_mapping, \\\%target_file_key_to_gti_comment_mapping, \$target_language_code)";
     } else {
-		eval "&write_translated_gs3interface(\\\%source_file_key_to_text_mapping, \\\%target_file_key_to_text_mapping, \\\%target_file_key_to_gti_comment_mapping, \$target_language_code)";
+		eval "&write_translated_gs3interface(\$translation_file_key, \\\%source_file_key_to_text_mapping, \\\%target_file_key_to_text_mapping, \\\%target_file_key_to_gti_comment_mapping, \$target_language_code)";
     }
 }
@@ -1873,5 +1883,5 @@
     my %target_files_key_to_last_update_date_mapping = ();
 	
-    &build_gs3_configuration($target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);
+    &build_gs3_configuration($translation_file_key, $target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, \%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);
 	
     &log_message("Total number of source chunks: " . scalar(keys(%source_files_key_to_text_mapping)));
@@ -1902,5 +1912,5 @@
     my %target_files_key_to_last_update_date_mapping = ();
 	
-    &build_gs3_configuration($target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 
+    &build_gs3_configuration($translation_file_key, $target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 
 	\%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);
     
@@ -1925,5 +1935,4 @@
     # will generate a tar file containing a folder called "greenstone3" with the specified *.properties files
 
-    my $sourcedir = "greenstone3";
     my $zip = &FileUtils::filenameConcatenate("tmp", "gs3interface_".$target_language_code.".tar.gz");
     my $tar_cmd = "tar -cvzf $zip";
@@ -1934,6 +1943,47 @@
     chdir $gsdl_root_directory;
 
-    my $filelisting = "";
-    foreach my $interface_file (@gs3_interface_files) {
+    $tar_cmd .= " " . &get_gs3_zip_file_listing($target_language_code, "greenstone3", \@gs3_interface_files);
+    $tar_cmd .= " " . &get_gs3_zip_file_listing($target_language_code, "gs3-collection-configs", \@gs3_col_cfg_files);
+
+    # tar command will overwrite the previous version, but want to check we've created it
+    if(&FileUtils::fileExists($zip)) {
+	&FileUtils::removeFiles($zip);
+    }
+
+    #my $tar_result = system($tar_cmd); # works but then interface breaks
+    `$tar_cmd`;
+    my $tar_result = $?;
+
+    if(&FileUtils::fileExists($zip)) { ## if($tar_result == 0) {, # breaks the interface
+	$download_target_filepath = $zip;
+    } else {
+	&log_message("Unable to generate zip containing gs3interface files " . $download_target_filepath . "$!");
+    }
+
+    # change back to original working directory (cgi-bin/linux probably)
+    chdir $curdir;
+
+    # ************** END RUDIMENTARY VERSION OF DOWNLOADING LANGUAGE FILES FOR GS3 ************* #
+
+
+    my $xml_response = &create_xml_response_for_chunks_requiring_work($translation_file_key, $download_target_filepath, scalar(keys(%source_files_key_to_text_mapping)),
+	\@target_files_keys_requiring_translation, \@target_files_keys_requiring_updating,
+	$num_chunks_to_return, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping,
+	\%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);
+	
+    return $xml_response;
+}
+
+# helper function
+# gets the listing of gs3 files for a gs3 interface module (gs3interface, gs3colcfg) 
+# formatted correctly to go into a zip file
+sub get_gs3_zip_file_listing
+{
+   my $target_language_code = shift(@_);
+   my $sourcedir = shift(@_); 
+   my $files_array = shift(@_); # reference to an array of the interfaces files for the gs3 module
+
+   my $filelisting = "";
+   foreach my $interface_file (@$files_array) {
 
 	my $source_filepath = &FileUtils::filenameConcatenate($sourcedir, $interface_file.".properties");
@@ -1945,33 +1995,6 @@
 	}
     }
-    $tar_cmd .= " $filelisting";
-
-    # tar command will overwrite the previous version, but want to check we've created it
-    if(&FileUtils::fileExists($zip)) {
-	&FileUtils::removeFiles($zip);
-    }
-
-    #my $tar_result = system($tar_cmd); # works but then interface breaks
-    `$tar_cmd`;
-    my $tar_result = $?;
-
-    if(&FileUtils::fileExists($zip)) { ## if($tar_result == 0) {, # breaks the interface
-	$download_target_filepath = $zip;
-    } else {
-	&log_message("Unable to generate zip containing gs3interface files " . $download_target_filepath . "$!");
-    }
-
-    # change back to original working directory (cgi-bin/linux probably)
-    chdir $curdir;
-
-    # ************** END RUDIMENTARY VERSION OF DOWNLOADING LANGUAGE FILES FOR GS3 ************* #
-
-
-    my $xml_response = &create_xml_response_for_chunks_requiring_work($translation_file_key, $download_target_filepath, scalar(keys(%source_files_key_to_text_mapping)),
-	\@target_files_keys_requiring_translation, \@target_files_keys_requiring_updating,
-	$num_chunks_to_return, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping,
-	\%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);
-	
-    return $xml_response;
+
+   return $filelisting;
 }
 
@@ -1995,5 +2018,5 @@
     my %target_files_key_to_last_update_date_mapping = ();
 	
-    &build_gs3_configuration($target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 
+    &build_gs3_configuration($translation_file_key, $target_language_code, \%source_files_key_to_text_mapping, \%target_files_key_to_text_mapping, 
 	\%source_files_key_to_last_update_date_mapping, \%target_files_key_to_last_update_date_mapping);
     
@@ -2022,11 +2045,17 @@
 sub build_gs3_configuration
 {
-    my ($target_language_code, $source_files_key_to_text_mapping, $target_files_key_to_text_mapping,
+    my ($translation_file_key, $target_language_code, $source_files_key_to_text_mapping, $target_files_key_to_text_mapping,
 	$source_files_key_to_gti_comment_or_last_updated_mapping, $target_files_key_to_gti_comment_or_last_updated_mapping, $get_gti_comments_not_last_updated) = @_;
     
     my $source_file_directory = "greenstone3";  # my $source_file_directory = &util::filename_cat("WEB-INF","classes"); 
+    my $files_array = \@gs3_interface_files;
+
+    if($translation_file_key eq "gs3colcfg") {
+	$source_file_directory = "gs3-collection-configs";
+	$files_array = \@gs3_col_cfg_files;
+    }
     my $translation_file_type = "resource_bundle";
 	
-    foreach my $interface_file_key (@gs3_interface_files) {
+    foreach my $interface_file_key (@$files_array) {
 		
 		&log_message("Greenstone 3 interface file: " . $interface_file_key);
@@ -2087,4 +2116,5 @@
 sub write_translated_gs3interface
 {
+    my $translation_file_key = shift(@_);
     my $source_file_key_to_text_mapping = shift(@_);
     my $target_file_key_to_text_mapping = shift(@_);
@@ -2105,5 +2135,6 @@
     
     my $source_file_directory = "greenstone3";    
-    
+    $source_file_directory = "gs3-collection-configs" if $translation_file_key eq "gs3colcfg";
+
     foreach my $interface_file_key (keys(%translated_interface_file_keys)) {
 		
