Project

General

Profile

« Previous | Next » 

Revision 1979

Further changes to the registry scripts to support the NCEAS registry
with access to the project list fromthe admindb. Also, fixed a bug with
the script where creators were getting duplicated in the editing process
accidentally.

View differences:

register-dataset.cgi
1345 1345
    }   
1346 1346
    
1347 1347
    if (scalar(@errorMessages)) {
1348
    # if any errors, print them in the response template 
1349
    $$templateVars{'status'} = 'failure';
1350
    $$templateVars{'errorMessages'} = \@errorMessages;
1351
    $error = 1;
1352
    $$templateVars{'function'} = "modification";
1353
    $$templateVars{'section'} = "Modification Status";
1354
    $template->process( $responseTemplate, $templateVars); 
1348
        # if any errors, print them in the response template 
1349
        $$templateVars{'status'} = 'failure';
1350
        $$templateVars{'errorMessages'} = \@errorMessages;
1351
        $error = 1;
1352
        $$templateVars{'function'} = "modification";
1353
        $$templateVars{'section'} = "Modification Status";
1354
        $template->process( $responseTemplate, $templateVars); 
1355 1355
    } else {
1356 1356
        $$templateVars{'form'} = 're_entry';
1357 1357
        $template->process( $entryFormTemplate, $templateVars);
1358 1358
    }
1359
    
1360
    # process the response template
1361 1359
}
1362 1360

  
1363

  
1364

  
1365 1361
################################################################################
1366 1362
# 
1367 1363
# Parse an EML 2.0.0 file and extract the metadata into perl variables for 
......
1405 1401

  
1406 1402
    # find out the tag <creator>. 
1407 1403
    $results = $doc->findnodes('//dataset/creator/individualName');
1404
    debug("Registry: Creators: ".$results->size());
1408 1405
    if ($results->size() > 11) {
1409 1406
        errMoreThanN("creator/individualName");
1410 1407
    } else {
......
1414 1411
        
1415 1412
            dontOccur($node, "./saluation", "saluation");                
1416 1413
        
1414
            debug("Registry: Checking a creator in loop 1...");
1417 1415
            $tempResult = $node->findnodes('../address|../phone|../electronicmailAddress|../organizationName');
1418 1416
            if($tempResult->size > 0) {
1419 1417
                if($foundDSO == 0) {
1420 1418
                    $foundDSO = 1;
1421 1419
     
1420
                    debug("Registry: Recording a creator in loop 1...");
1422 1421
                    $$templateVars{'origNamefirst0'} = findValue($node, 'givenName');
1423 1422
                    $$templateVars{'origNamelast0'} = findValue($node, 'surName');
1424 1423
            
......
1460 1459
            }
1461 1460
        }
1462 1461
        foreach $node ($results->get_nodelist) {
1463
            $tempResult = $node->findnodes('../address|../phone|../electronicmailAddress');
1462
            debug("Registry: Checking a creator in loop 2...");
1463
            $tempResult = $node->findnodes('../address|../phone|../electronicmailAddress|../organizationName');
1464 1464
            if ($tempResult->size == 0) {
1465 1465
                if ($foundDSO == 0) {
1466
                    debug("Registry: Recording a creator in loop 2 block A...");
1466 1467
                    $foundDSO = 1;
1467 1468
                    $$templateVars{'origNamefirst0'} = findValue($node, 'givenName');
1468 1469
                    $$templateVars{'origNamelast0'} = findValue($node, 'surName');
1469 1470
                    $$templateVars{'origNameOrg'} = findValue($node, '../organizationName');
1470 1471
                } else {
1472
                    debug("Registry: Recording a creator in loop 2 block B...");
1471 1473
                    $$templateVars{"origNamefirst$aoCount"} =  findValue($node, './givenName');
1472 1474
                    $$templateVars{"origNamelast$aoCount"} =  findValue($node, './surName');
1473 1475
                    $$templateVars{"origRole$aoCount"} = "Originator";
......
1478 1480
    }
1479 1481

  
1480 1482
    $results = $doc->findnodes('//dataset/creator/organizationName');
1481
    if ($results->size() > 3) {
1483
    my $wgroups = $doc->findnodes("//dataset/creator/organizationName[contains(text(),'(NCEAS ')]");
1484
    debug("Registry: Number Org: ".$results->size());
1485
    debug("Registry:  Number WG: ".$wgroups->size());
1486
    if ($results->size() - $wgroups->size() > 3) {
1482 1487
        errMoreThanN("creator/organizationName");    
1483 1488
    } else {
1484 1489
        foreach $node ($results->get_nodelist) {
1485

  
1486 1490
            my $tempValue = findValue($node,'../organizationName');
1487 1491
            $tempResult = $node->findnodes('../individualName');
1488 1492
            if ($tempResult->size == 0 && $tempValue ne $organization) {
1489 1493
                $$templateVars{'site'} = $tempValue;
1490 1494
            }
1491 1495
        }
1496
        if ($FORM::cfg == 'nceas') {
1497
            my @wg;
1498
            foreach $node ($results->get_nodelist) {
1499
                my $tempValue = findValue($node,'../organizationName');
1500
                $wg[scalar(@wg)] = $tempValue;
1501
            }
1502
            my $projects = getProjectList();
1503
            $$templateVars{'projects'} = $projects;
1504
            $$templateVars{'wg'} = \@wg;
1505
        }
1492 1506
    }
1493 1507

  
1494 1508
    $results = $doc->findnodes('//dataset/metadataProvider');

Also available in: Unified diff