Index: main/trunk/greenstone2/perllib/collConfigxml.pm
===================================================================
--- main/trunk/greenstone2/perllib/collConfigxml.pm	(revision 27803)
+++ main/trunk/greenstone2/perllib/collConfigxml.pm	(revision 28034)
@@ -34,4 +34,6 @@
 
 # A mapping hash to resolve name discrepancy between gs2 and gs3.
+# the first item is the gs3 element name from collectionConfig, the second one
+# is the internal name for the option
 my $nameMap = {"key" => "value",
 	       "creator" => "creator",
@@ -60,11 +62,9 @@
 	       "buildType" => "buildtype",
 	       "orthogonalBuildTypes" => "orthogonalbuildtypes",
-	       "buildOption" => "buildOption"
-	       #"buildOptions" => "buildOptions", "importOptions" => "importOptions", no actual equivalents for importOptions and buildOptions in GS2
 	       };
 # A hash structure which is returned by sub read_cfg_file.
 my $data = {};
 
-my $repeatedBlock = q/^(browse|pluginList)$/; #|buildOptionList)$/;
+my $repeatedBlock = q/^(browse|pluginList)$/; 
 
 # use those unique attribute values to locate the text within the elements
@@ -74,4 +74,7 @@
 my $displayItemNames = q/^(name|description)$/;
   
+# these options get set at top level
+my $topleveloptionexp = q/^(importOption|buildOption)$/;
+
 # For storing the attributes during the StartTag subroutine, so that 
 # we can use it later in Text (or EndTag) subroutines
@@ -87,6 +90,4 @@
 my $hashexp = q/^(subcollection)$/; # add other element names that should be represented by hash expressions here
 my $hashhashexp = q/^(displayItem)$/; # add other (collectionmeta) element names that should be represented by hashes of hashes here.
-
-my $generalOptions = q/^(importOptions|buildOptions)$/; # becomes GS2 toplevel map of (name, value) pairs
 
 my $defaults = q/^(defaultIndex|defaultLevel|defaultIndexLanguage|languageMetadata)$/;
@@ -200,5 +201,5 @@
     #@ Handle index|sort|facet|level|indexOption|indexSubcollection|indexLanguage 
     elsif ($element =~ /$arrayexp/) {
-      my $key = $nameMap->{$element};	
+      my $key = $nameMap->{$element};	# 
       if (!defined $data->{$key}) {
 	$data->{$key} = [];
@@ -209,10 +210,15 @@
       }
     }
-
-    #*****************************************
-    elsif ($element eq "buildOption") {
-        print STDERR "**** BUILD OPTION PAIR $name $value\n";
-        $data->{$name} = $value;
-    }    
+    # importOption and buildOption, just stored at top level, name=value, 
+    # as per gs2 version
+    elsif ($element =~ /$topleveloptionexp/) {
+	if (defined $name) {
+	    if (!defined $value) {
+		# flag option, set to true
+		$value = "true";
+	    }
+	    $data->{$name} = $value;
+	}
+    }
 
     #@ plugout options
@@ -287,39 +293,4 @@
     }
 
-    #@ Handling each importOptions/buildOptions element
-    elsif ($element =~ /$generalOptions/) {
-        $currentLevel = $element;
-        #my $key = $nameMap->{$element}; # importOptions and buildOptions map to themselves, no equivalents in GS2
-
-	# define a map of string pairs
-	if (!defined $data->{$element}) {
-	    $data->{$element} = {};
-	}
-    }
-    #@ Handling the option elements in an importOptions/buildOptions element, which are of the form:
-    # <importOptions><option name="n" value="v"/><option .../></importOptions>
-    # these get stored in-memory at the top level as (n, v) pairs, just as in GS2
-    elsif ($currentLevel =~ /$generalOptions/ and $element eq "option") {
-	if (defined $name and $name =~ /\w/) {
-
-	    # if a flag's value is on or 1, set it to true. If the value is off or 0, set it to false. (GS2 expects true/false)
-	    # But such on/off flags (like -gli) need not be given a value, in which case the value defaults to 'true' again.
-
-	    if(defined $value and $value =~ /\w/) {		
-
-		if ($value =~ m/^(on|1)$/) {
-		    $value = "true";
-		} elsif ($value =~ m/^(off|0)$/) {
-		    $value = "false";
-		} # else, use whatever value is provided
-
-	    } 
-	    else {
-		$value = "true";
-	    }
-	    $data->{$name} = $value; #$data->{$currentLevel}->{$name} = $value;
-	    #print "@@@@ Added $currentLevel option: $name=$value\n";
-	}
-    }
 
 }
@@ -327,5 +298,5 @@
 sub EndTag {
     my ($expat, $element) = @_;
-    my $endTags = q/^(browse|pluginList|displayItemList|indexOption|importOptions|buildOptions)$/; #|buildOptionList)$/;   
+    my $endTags = q/^(browse|pluginList|displayItemList|indexOption)$/; #|buildOptionList)$/;   
     if ($element =~ /$endTags/) {
 		$currentIndex = 0;
