r4519 - trunk/src/perl

walbridge at ecoinformatics.org walbridge at ecoinformatics.org
Thu Nov 6 11:28:56 PST 2008


Author: walbridge
Date: 2008-11-06 11:28:56 -0800 (Thu, 06 Nov 2008)
New Revision: 4519

Modified:
   trunk/src/perl/register-dataset.cgi
Log:
Dump copy of EML document being uploaded when debug mode is enabled.


Modified: trunk/src/perl/register-dataset.cgi
===================================================================
--- trunk/src/perl/register-dataset.cgi	2008-11-06 19:16:49 UTC (rev 4518)
+++ trunk/src/perl/register-dataset.cgi	2008-11-06 19:28:56 UTC (rev 4519)
@@ -380,12 +380,6 @@
     # Parameters have been validated and Create the XML document
     my $xmldoc = createXMLDocument();
     
-    # Write out the XML file for debugging purposes
-    my $testFile = $tempDir . "/registry-eml-upload.xml";
-    open (TFILE,">$testFile") || die ("Cant open xml file...\n");
-    print TFILE $xmldoc;
-    close(TFILE);
-
     my $xmldocWithDocID = $xmldoc;
     my $errorMessage = "";
 
@@ -429,6 +423,7 @@
                 $docid = newAccessionNumber($config->{'scope'});
 
                 $xmldocWithDocID =~ s/docid/$docid/;
+                debugDoc($xmldocWithDocID);
                 $docStatus = insertMetadata($xmldocWithDocID, $docid);
             }
             debug("Registry: B2");
@@ -442,17 +437,18 @@
         } else {
             # document is being modified
             $docid = $FORM::docid;
-    
+
             my $x;
             my $y;
             my $z;
-        
+
             ($x, $y, $z) = split(/\./, $docid); 
             $z++;
             $docid = "$x.$y.$z";
-    
+
             $xmldoc =~ s/docid/$docid/;
-        
+            debugDoc($xmldoc);$
+
             my $response = $metacat->update($docid, $xmldoc);
 
             if (! $response) {
@@ -473,10 +469,6 @@
                 $$templateVars{'cfg'} = $skinName;
             }
 
-            #if (! $error) {
-                #sendNotification($docid, $mailhost, $sender, $recipient);
-            #}
-
             # Create our HTML response and send it back
             $$templateVars{'function'} = "modified";
             $$templateVars{'section'} = "Modification Status";
@@ -509,10 +501,6 @@
     
 }
 
-#if (! $error) {
-#sendNotification($docid, $mailhost, $sender, $recipient);
-#}
-
 # Create our HTML response and send it back
 $$templateVars{'function'} = "submitted";
 $$templateVars{'section'} = "Submission Status";
@@ -4126,6 +4114,24 @@
 
 ################################################################################
 # 
+# dump the EML document to disk
+#
+################################################################################
+
+sub debugDoc {
+    my $doc = shift;
+
+    if ($debug_enabled) {
+        # Write out the XML file for debugging purposes
+        my $testFile = $tempDir . "/registry-eml-upload.xml";
+        open (TFILE,">$testFile") || die ("Cant open xml file...\n");
+        print TFILE $doc;
+        close(TFILE);
+     }
+}
+
+################################################################################
+# 
 # get the list of projects
 #
 ################################################################################



More information about the Metacat-cvs mailing list