Index: trunk/gsdl/bin/script/export.pl
===================================================================
--- trunk/gsdl/bin/script/export.pl	(revision 12332)
+++ trunk/gsdl/bin/script/export.pl	(revision 12333)
@@ -38,4 +38,5 @@
     unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
     unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
+    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugouts");
     unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
 }
@@ -48,4 +49,5 @@
 use colcfg;
 use plugin;
+use plugout;
 use docprint;
 use util;
@@ -68,5 +70,10 @@
         'desc' => "{export.saveas.DSpace}" },
       { 'name' => "METS",
-        'desc' => "{export.saveas.METS}" } ];
+        'desc' => "{export.saveas.METS}"},
+      { 'name' => "GA",
+        'desc' => "{export.saveas.GA}"},
+      { 'name' => "MARCXML",
+        'desc' => "{export.saveas.MARCXML}"}
+     ];
 
 
@@ -96,5 +103,5 @@
 	'type' => "string",
 	'reqd' => "no",
-        'deft' => "greenstone" },
+       'deft' => "greenstone" },
       { 'name' => "exportdir",
 	'desc' => "{export.exportdir}",
@@ -161,4 +168,24 @@
 	'reqd' => "no",
         'hiddengli' => "yes" },
+      { 'name' => "xsltfile",
+	'desc' => "{BasPlugout.xslt_file}",
+	'type' => "string",
+	'reqd' => "no",
+        'hiddengli' => "yes" },
+      { 'name' => "xslt_txt",
+	'desc' => "{METSPlugout.xslt_txt}",
+	'type' => "string",
+	'reqd' => "no",
+        'hiddengli' => "no" },
+      { 'name' => "xslt_mets",
+	'desc' => "{METSPlugout.xslt_mets}",
+	'type' => "string",
+	'reqd' => "no",
+        'hiddengli' => "no" },
+      { 'name' => "group_marc",
+	'desc' => "{MARCXMLPlugout.group}",
+	'type' => "flag",
+	'reqd' => "no",
+        'hiddengli' => "no" },
       { 'name' => "verbosity",
 	'desc' => "{export.verbosity}",
@@ -200,5 +227,5 @@
     my ($language, $verbosity, $importdir, $exportdir, $keepold, $listall,
 	$removeold, $saveas, $saveas_version, $debug, 
-	$maxdocs, $statsfile, $out, $faillog, $collectdir, $gli);
+	$maxdocs, $statsfile, $xsltfile, $out, $faillog, $collectdir, $gli,$xslt_mets,$xslt_txt,$group_marc);
     my $xml = 0;
     
@@ -409,5 +436,5 @@
 		if ($saveas eq "DSpace"){
 		    $export_info_filename = &util::filename_cat ($exportdir, "contents");
-		} elsif ($saveas eq "METS") {
+		} elsif ($saveas eq "METS" || $saveas eq "GA" || $saveas eq "MARC" ) {
 		    $export_info_filename = &util::filename_cat ($exportdir, "export.inf");
 		}
@@ -415,6 +442,44 @@
 		$export_info = new arcinfo();
 		$export_info -> load_info ($export_info_filename);	
+               		
+                if ($saveas !~ /^(GA|METS|DSpace|MARCXML)$/) {
+		    if (defined $collectcfg->{'plugout'} && $collectcfg->{'plugout'}[0] =~ /^(GAPlugout|METSPlugout)$/) {
+			$saveas = $collectcfg->{'plugout'}[0];
+		    } else {
+			$saveas ="GAPlugout";
+		    }
+		}
+
+              		
+    		####Use Plugout####
+		my ($plugout_name);
+		if ($saveas !~ /^(GA|METS|DSpace|MARCXML)Plugout$/  ){      
+		    $plugout_name = $saveas."Plugout";
+		}
+		else{
+		    $plugout_name = $saveas;
+		} 
+             
+	      my $opts=[];
+
+              
+	      push @$opts,("-output_info",$export_info) if (defined $export_info); 
+
+        	push @$opts,("-verbosity",$verbosity) if (defined $verbosity);
 		
-		$processor = new docsave ($collection, $export_info, $verbosity, $gzip, $groupsize, $out, $service, $saveas);
+		push @$opts,("-gzip_output",$gzip) if (defined $gzip);
+		push @$opts,("-group_size",$groupsize) if (defined $groupsize);
+		push @$opts,("-output_handle",$out) if (defined $out);
+
+               	push @$opts,("-xslt_file",$xsltfile) if (defined $xsltfile);
+                push @$opts,("-group") if ($group_marc && $plugout_name =~ /^MARCXMLPlugout$/);
+		push @$opts,("-saveas_version",$saveas_version) if (defined $saveas_version && $plugout_name =~ /^METSPlugout$/);
+                push @$opts,("-xslt_mets",$xslt_mets) if (defined $xslt_mets && $plugout_name =~ /^METSPlugout$/);
+                push @$opts,("-xslt_txt",$xslt_txt) if (defined $xslt_txt && $plugout_name =~ /^METSPlugout$/);
+                        
+                                           	
+	        $processor = &plugout::load_plugout($plugout_name,$opts);    
+
+		#$processor = new docsave ($collection, $export_info, $verbosity, $gzip, $groupsize, $out, $service, $saveas, $xsltfile);
 		
 		$processor->setoutputdir ($exportdir);
@@ -422,6 +487,6 @@
 		$processor->set_sortmeta ($sortmeta) if defined $sortmeta;
 		$processor->set_OIDtype ($OIDtype);
-		$processor->set_saveas ($saveas);
-		$processor->set_saveas_version ($saveas_version);
+		#$processor->set_saveas ($saveas);
+		#$processor->set_saveas_version ($saveas_version);
 	    } else {
 		$processor = new docprint ();
@@ -440,4 +505,5 @@
 	    if (!$debug) {
 		$processor->close_file_output() if $groupsize > 1;
+                $processor->close_group_output() if $processor->is_group();
 		if ($saveas eq "METS") {
 		    $export_info->save_info($export_info_filename);
