Project

General

Profile

« Previous | Next » 

Revision 1989

Added studyExtent and samplingDescription fields to the registry to accomodate
Sandy's request for a temporalDescription field. This is a little more than
she wanted, but it was needed to satisfy EML minimum requirements.

View differences:

register-dataset.cgi
321 321
            
322 322
            $xmldoc =~ s/docid/$docid/;
323 323
    
324
            #my $testFile = "/tmp/test.xml";
325
            #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
326
            #print TFILE $xmldoc;
327
            #close(TFILE);
324
            my $testFile = "/tmp/test.xml";
325
            open (TFILE,">$testFile") || die ("Cant open xml file...\n");
326
            print TFILE $xmldoc;
327
            close(TFILE);
328 328
    
329 329
            $notunique = insertMetadata($xmldoc, $docid);
330 330
            #  if (!$notunique) {
......
337 337

  
338 338
            # The id wasn't unique, so update our lastid file
339 339
            if ($notunique eq "NOT_UNIQUE") {
340
                debug( "Registry: Updating lastid (B1.1)");
340 341
                updateLastId($defaultScope);
341 342
            }
342 343
        }
......
448 449
  my $docid = shift;
449 450

  
450 451
  my $notunique = "SUCCESS";
452
  debug("Registry: Starting insert (D1)");
451 453
  my $response = $metacat->insert($docid, $xmldoc);
452 454
  if (! $response) {
455
    debug("Registry: Response gotten (D2)");
453 456
    my $errormsg = $metacat->getMessage();
457
    debug("Registry: Error is (D3): ".$errormsg);
454 458
    if ($errormsg =~ /is already in use/) {
455 459
      $notunique = "NOT_UNIQUE";
456 460
      #print "Accession number already used: $docid\n";
......
464 468
      $notunique = $errormsg;
465 469
    }
466 470
  }
471
  debug("Registry: Ending insert (D4)");
467 472

  
468 473
  return $notunique;
469 474
}
......
644 649
        unless hasContent($longDeg1);
645 650
    }
646 651

  
652
    push(@invalidParams, 
653
        "You must provide a method description if you provide a method title.")
654
        if (hasContent($FORM::methodTitle) && !(scalar(@FORM::methodPara) > 0));
655
    push(@invalidParams, 
656
        "You must provide a method description if you provide a study extent description.")
657
        if (hasContent($FORM::studyExtentDescription) && !(scalar(@FORM::methodPara) > 0));
658
    push(@invalidParams, 
659
        "You must provide both a study extent description and a sampling description, or neither.")
660
        unless (hasContent($FORM::studyExtentDescription) && hasContent($FORM::samplingDescription));
661

  
647 662
    push(@invalidParams, "Contact first name is missing.")
648 663
    unless (hasContent($FORM::origNamefirstContact) || 
649 664
        $FORM::useOrigAddress);
......
1168 1183
        for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
1169 1184
            $methods .= "<para>$FORM::methodPara[$i]</para>\n";
1170 1185
        }
1171
        $methods .= "</section></description></methodStep></methods>\n";
1186
        $methods .= "</section></description></methodStep>\n";
1187
        if (hasContent($FORM::studyExtentDescription)) {
1188
            $methods .= "<sampling><studyExtent><description>\n";
1189
            $methods .= "<para>$FORM::studyExtentDescription</para>\n";
1190
            $methods .= "</description></studyExtent>\n";
1191
            $methods .= "<samplingDescription>\n";
1192
            $methods .= "<para>$FORM::samplingDescription</para>\n";
1193
            $methods .= "</samplingDescription>\n";
1194
            $methods .= "</sampling>\n";
1195
        }
1196
        $methods .= "</methods>\n";
1172 1197
        $doc .= $methods;
1173 1198
    }
1174 1199

  
......
1884 1909
        }
1885 1910
    }
1886 1911
    
1887
    $results = $doc->findnodes('//dataset/methods/methodStep/description/section');
1912
    $results = $doc->findnodes(
1913
            '//dataset/methods/methodStep/description/section');
1888 1914
    debug("Registry: Number methods: ".$results->size());
1889 1915
    if ($results->size() > 1) {
1890 1916
        errMoreThanN("methods/methodStep/description/section");    
1891 1917
    } else {
1892
        dontOccur($doc, "//methodStep/citation", "methodStep/citation");
1893
        dontOccur($doc, "//methodStep/protocol", "methodStep/protocol");
1894
        dontOccur($doc, "//methodStep/instrumentation", "methodStep/instrumentation");
1895
        dontOccur($doc, "//methodStep/software", "methodStep/software");
1896
        dontOccur($doc, "//methodStep/subStep", "methodStep/subStep");
1897
        dontOccur($doc, "//methodStep/dataSource", "methodStep/dataSource");
1898
        dontOccur($doc, "//methods/sampling", "methods/sampling");
1899
        dontOccur($doc, "//methods/qualityControl", "methods/qualityControl");
1900 1918

  
1901 1919
        my @methodPara;
1902 1920
        foreach $node ($results->get_nodelist) {
......
1920 1938
        }
1921 1939
    }
1922 1940

  
1941
    $results = $doc->findnodes(
1942
            '//dataset/methods/sampling/studyExtent/description/para');
1943
    if ($results->size() > 1) {
1944
        errMoreThanN("methods/sampling/studyExtent/description/para");    
1945
    } else {
1946
        foreach $node ($results->get_nodelist) {
1947
            my $studyExtentDescription = $node->textContent();
1948
            $$templateVars{'studyExtentDescription'} = $studyExtentDescription;
1949
        }
1950
    }
1951

  
1952
    $results = $doc->findnodes(
1953
            '//dataset/methods/sampling/samplingDescription/para');
1954
    if ($results->size() > 1) {
1955
        errMoreThanN("methods/sampling/samplingDescription/para");    
1956
    } else {
1957
        foreach $node ($results->get_nodelist) {
1958
            my $samplingDescription = $node->textContent();
1959
            $$templateVars{'samplingDescription'} = $samplingDescription;
1960
        }
1961
    }
1962

  
1963
    dontOccur($doc, "//methodStep/citation", "methodStep/citation");
1964
    dontOccur($doc, "//methodStep/protocol", "methodStep/protocol");
1965
    dontOccur($doc, "//methodStep/instrumentation", "methodStep/instrumentation");
1966
    dontOccur($doc, "//methodStep/software", "methodStep/software");
1967
    dontOccur($doc, "//methodStep/subStep", "methodStep/subStep");
1968
    dontOccur($doc, "//methodStep/dataSource", "methodStep/dataSource");
1969
    dontOccur($doc, "//methods/qualityControl", "methods/qualityControl");
1970

  
1971
    dontOccur($doc, "//methods/sampling/spatialSamplingUnits", "methods/sampling/spatialSamplingUnits");
1972
    dontOccur($doc, "//methods/sampling/citation", "methods/sampling/citation");
1923 1973
    dontOccur($doc, "./pubPlace", "pubPlace");
1924 1974
    dontOccur($doc, "./project", "project");
1925 1975
    
......
2303 2353

  
2304 2354
    $$templateVars{'methodTitle'} = $FORM::methodTitle;
2305 2355
    $$templateVars{'methodPara'} = \@FORM::methodPara;
2356
    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
2357
    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
2306 2358
    $$templateVars{'docid'} = $FORM::docid;
2307 2359

  
2308 2360
    $$templateVars{'section'} = "Confirm Data";
......
2490 2542
    $$templateVars{'taxaAuth'} = $FORM::taxaAuth;
2491 2543
    $$templateVars{'methodTitle'} = $FORM::methodTitle;
2492 2544
    $$templateVars{'methodPara'} = \@FORM::methodPara;
2545
    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
2546
    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
2493 2547
    $$templateVars{'docid'} = $FORM::docid;
2494 2548

  
2495 2549
    $$templateVars{'form'} = 're_entry';

Also available in: Unified diff