Project

General

Profile

« Previous | Next » 

Revision 4190

Added by walbridge over 16 years ago

Allow script to be run from command line, more token changes including all path changes for URLs and directories.

View differences:

src/perl/register-dataset.cgi
1
#!/usr/bin/perl
1
#!/usr/bin/env perl
2 2
#
3 3
#  '$RCSfile$'
4 4
#  Copyright: 2000 Regents of the University of California 
......
31 31
use Metacat;
32 32
use AppConfig qw(:expand :argcount);
33 33
use Config::Properties;
34
use Cwd 'abs_path';
34 35
use XML::LibXML;
35 36
use XML::LibXSLT;
36 37
use Template;
......
44 45

  
45 46
# Global configuration paramters
46 47
my $cgiUrl = $ENV{'SCRIPT_FILENAME'};
47
my $workingDirectory = dirname($cgiUrl);
48
my $workingDirectory = ".";
49
if ($cgiUrl ne "") {
50
    my $workingDirectory = dirname($cgiUrl);
51
}
48 52
my $metacatProps = "${workingDirectory}/../WEB-INF/metacat.properties";
49 53
my $properties = new Config::Properties();
50 54
unless (open (METACAT_PROPERTIES, $metacatProps)) {
......
57 61

  
58 62
# local directory configuration
59 63
my $skinsDir = "${workingDirectory}/../style/skins";
60
my $tmpDir = $properties->getProperty('temp-dir');
64
my $templatesDir = abs_path("${workingDirectory}/../style/common/templates");
65
my $tempDir = $properties->getProperty('application.tempDir');
61 66

  
62 67
# url configuration
63 68
my $server = $properties->splitToTree(qr/\./, 'server');
64
my $metacatUrl = 'http://' . $properties->getProperty('server.name') . ':' . 
69
my $contextUrl = 'http://' . $properties->getProperty('server.name') . ':' . 
65 70
                 $properties->getProperty('server.httpPort') . '/' . 
66
                 $properties->getProperty('application.context') . '/metacat';
71
                 $properties->getProperty('application.context');
67 72

  
73
my $metacatUrl = $contextUrl . "/metacat";
74
my $cgiPrefix = "/" . $properties->getProperty('application.context') . "/cgi-bin";
75
my $styleSkinsPath = $contextUrl . "/style/skins";
76
my $styleCommonPath = $contextUrl . "/style/common";
77

  
68 78
my $now = time;
69 79

  
70 80
# Import all of the HTML form fields as variables
71 81
import_names('FORM');
72 82

  
83
# Must have a config to use Metacat
84
my $skinName = "";
85
if (hasContent($FORM::cfg)) {
86
    $skinName = $FORM::cfg;
87
} elsif (hasContent($ARGV[0])) {
88
    $skinName = $ARGV[0];
89
} else {
90
    debug("Registry: No configuration set.");
91
    print "Content-type: text/html\n\n";
92
    'Registry Error: The registry requires a skin name to continue.';
93
    exit();
94
}
95

  
96
# Metacat isn't initialized, the registry will fail in strange ways.
97
if (!hasContent($metacatUrl)) {
98
    debug("Registry: No Metacat.");
99
    print "Content-type: text/html\n\n";
100
    'Registry Error: Metacat is not initialized! Make sure' .
101
        ' MetacatUrl is set correctly in ' .  $skinName . '.cfg';
102
    exit();
103
}
104

  
73 105
# Set up the hash for returning data to the HTML templates
74 106
my $templateVars = { 'status' => 'success' };
75 107
my $error = 0;
76 108
my @errorMessages;
77 109

  
78 110
my $skinProperties = new Config::Properties();
79
if (! hasContent($FORM::cfg)) {
111
if (! hasContent($skinName)) {
80 112
    $error = "Application misconfigured.  Please contact the administrator.";
81 113
    push(@errorMessages, $error);
82 114
} else {
83
    my $skinProps = "$skinsDir/$FORM::cfg/$FORM::cfg.properties";
115
    my $skinProps = "$skinsDir/$skinName/$skinName.properties";
84 116
    unless (open (SKIN_PROPERTIES, $skinProps)) {
85 117
        print "Content-type: text/html\n\n";
86 118
        print "Unable to locate skin properties at $skinProps.  Is this path correct?";
......
102 134
if ($FORM::debug) {
103 135
    $debug_enabled = $FORM::debug;
104 136
}
105
my $lat = $config->get('lat');
106
my $lon = $config->get('lon');
107 137

  
108
my $metacatUrl = $properties->getProperty('metacatUrl');
109 138
my $username = $config->{'username'};
110 139
my $password = $config->{'password'};
111 140

  
......
128 157
    $debug_enabled = $FORM::debug;
129 158
}
130 159

  
131
# populate db parameters for NCEAS AdminDB
132
my $database = '';
133
if ($FORM::cfg eq 'nceas') {
134
    my $database = $skinProperties->splitToTree(qr/\./, 'registry.db');
135
}
136

  
137 160
#Convert the lat and lon configs into usable data structures
138 161
my @sitelist;
139 162
my %siteLatDMS;
140 163
my %siteLongDMS;
141 164
while ( my ($key, $value) = each (%$spatial)) {
142 165
    my ($name, $lon, $lat) = split("|", $value);
143
    my ($latd, $latm, $lats, $latdir) = split(':', $lat);
144
    my ($lond, $lonm, $lons, $londir) = split(':', $lon);
166
    my ($latd, $latm, $lats, $latdir) = split('|', $lat);
167
    my ($lond, $lonm, $lons, $londir) = split('|', $lon);
145 168
    push(@sitelist, $name);
146 169
    $siteLatDMS{$name} = [ $latd, $latm, $lats, $latdir ];
147 170
    $siteLongDMS{$name} = [ $lond, $lonm, $lons, $londir ];
148 171
}
149

  
172
debug("template: $templatesDir\n");
150 173
# set some configuration options for the template object
151 174
my $ttConfig = {
152
             INCLUDE_PATH => $properties->getProperty('templates-dir'),
175
             INCLUDE_PATH => $templatesDir,
153 176
             INTERPOLATE  => 0,                    
154 177
             POST_CHOMP   => 1,
155 178
             #DEBUG        => 'all',
......
159 182
my $template = Template->new($ttConfig) || die $Template::ERROR, "\n";
160 183

  
161 184
# Set up the template information that is common to all forms
162
$$templateVars{'styleSkinsPath'} = $properties->getProperty('style-skins-path');
163
$$templateVars{'styleCommonPath'} = $properties->getProperty('style-common-path');
164
$$templateVars{'servletPath'} = $properties->getProperty('servlet-path');
185

  
186
# GENERATE ME:
187
$$templateVars{'styleSkinsPath'} = $styleSkinsPath;
188
$$templateVars{'styleCommonPath'} = $styleCommonPath;
189
$$templateVars{'cgiPrefix'} = $cgiPrefix;
165 190
$$templateVars{'metacatUrl'} = $metacatUrl;
166
$$templateVars{'cgiPrefix'} = $properties->getProperty('cgi-prefix');
167
$$templateVars{'cfg'} = $FORM::cfg;
191
$$templateVars{'cfg'} = $skinName;
168 192
$$templateVars{'email'} = $email;
169 193
$$templateVars{'templates'} = $templates;
170 194
$$templateVars{'required'} = $required;
......
172 196

  
173 197
debug("Registry: Initialized -- stage set: $FORM::stage");
174 198

  
175
# Must have a config to use Metacat
176
if (!hasContent($FORM::cfg)) {
177
    debug("Registry: No configuration set.");
178
    print "Content-type: text/html\n\n";
179
    $$templateVars{'message'} = 'Error: The registry requires a skin name to continue.';
180
    $template->process( $templates->{'login'}, $templateVars);
181
    exit(0);
182
}
183

  
184
# Metacat isn't initialized, the registry will fail in strange ways.
185
if (!hasContent($metacatUrl)) {
186
    debug("Registry: No Metacat.");
187
    print "Content-type: text/html\n\n";
188
    'Registry Error: Metacat is not initialized! Make sure' .
189
        ' MetacatUrl is set correctly in ' .  $FORM::cfg . '.cfg';
190
    exit(0);
191
}
192

  
193 199
# Process the form based on stage parameter. 
194 200
if ($FORM::stage =~ "loginform") {
195 201
    print "Content-type: text/html\n\n";
......
303 309
        # no session found ... redirect to login page template
304 310
        $$templateVars{'showInstructions'} = 'true';
305 311
        $$templateVars{'message'} = 'You must login to register your dataset.';
312
        debug($templates->{'login'});
306 313
        $template->process( $templates->{'login'}, $templateVars);
307 314
    } else {
308 315

  
......
313 320
        	push(@sortedSites, $site);
314 321
    	}
315 322

  
316
    	if ($FORM::cfg eq 'nceas') {
317
        	my $projects = getProjectList($database);
323
    	if ($skinName eq 'nceas') {
324
        	my $projects = getProjectList($properties);
318 325
        	$$templateVars{'projects'} = $projects;
319 326
        	$$templateVars{'wg'} = \@FORM::wg;
320 327
    	}
......
394 401
    my $xmldoc = createXMLDocument();
395 402
    
396 403
    # Write out the XML file for debugging purposes
397
    #my $testFile = $tmpDir . "/test-file.xml";
404
    #my $testFile = $tempDir . "/test-file.xml";
398 405
    #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
399 406
    #print TFILE $xmldoc;
400 407
    #close(TFILE);
......
409 416
        $$templateVars{'status'} = 'login_failure';
410 417
        $$templateVars{'errorMessages'} = \@errorMessages;
411 418
        $$templateVars{'docid'} = $docid;
412
        $$templateVars{'cfg'} = $FORM::cfg;
419
        $$templateVars{'cfg'} = $skinName;
413 420
        $$templateVars{'function'} = "submitted";
414 421
        $$templateVars{'section'} = "Submission Status";
415 422
        $template->process( $templates->{'response'}, $templateVars);
......
424 431
        		$$templateVars{'status'} = 'login_failure';
425 432
        		$$templateVars{'errorMessages'} = \@errorMessages;
426 433
        		$$templateVars{'docid'} = $docid;
427
        		$$templateVars{'cfg'} = $FORM::cfg;
434
        		$$templateVars{'cfg'} = $skinName;
428 435
        		$$templateVars{'function'} = "submitted";
429 436
        		$$templateVars{'section'} = "Submission Status";
430 437
        		$template->process( $templates->{'response'}, $templateVars);
......
453 460
                $notunique = insertMetadata($xmldocWithDocID, $docid);
454 461
                #  if (!$notunique) {
455 462
                # Write out the XML file for debugging purposes
456
                #my $testFile = $tmpDir . "/test-new.xml";
463
                #my $testFile = $tempDir . "/test-new.xml";
457 464
                #open (TFILE,">$testFile") || die ("Cant open xml file...\n");
458 465
                #print TFILE $newdoc;
459 466
                #close(TFILE);
......
496 503

  
497 504
            if (scalar(@errorMessages)) {
498 505
                debug("Registry: ErrorMessages defined in modify.");
499
    
506

  
500 507
                $$templateVars{'docid'} = $FORM::docid;
501
        	    copyFormToTemplateVars();
508
                copyFormToTemplateVars();
502 509
                $$templateVars{'status'} = 'failure';
503 510
                $$templateVars{'errorMessages'} = \@errorMessages;
504 511
                $error = 1;
505 512
            } else {
506 513
                $$templateVars{'docid'} = $docid;
507
        	$$templateVars{'cfg'} = $FORM::cfg;
514
                $$templateVars{'cfg'} = $skinName;
508 515
            }
509 516

  
510 517
            #if (! $error) {
511 518
                #sendNotification($docid, $mailhost, $sender, $recipient);
512 519
            #}
513
    
520

  
514 521
            # Create our HTML response and send it back
515 522
            $$templateVars{'function'} = "modified";
516 523
            $$templateVars{'section'} = "Modification Status";
517 524
            $template->process( $templates->{'response'}, $templateVars);
518
    
525

  
519 526
            exit(0);
520 527
        }
521 528
    }
......
532 539
    $error = 1;
533 540
} else {
534 541
    $$templateVars{'docid'} = $docid;
535
    $$templateVars{'cfg'} = $FORM::cfg;
542
    $$templateVars{'cfg'} = $skinName;
536 543
    # delete the remaining file objects from disk
537 544
    for (my $fileNum = 0; $fileNum <= $FORM::upCount; $fileNum++) {
538 545
        my $fn = 'uploadname_' . $fileNum;
......
575 582
      (my $foundScope, my $id, my $rev) = split(/\./, $docid);
576 583
      debug("Docid is: $docid\n");
577 584
      debug("Lastid is: $id");
578
      my $scopeFile = $skinsDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
585
      my $scopeFile = $skinsDir . "/" . $skinName . "/" . $scope . ".lastid";
579 586
      # FIXME: skins dir isn't generally writeable by the HTTP server, use tmp instead
580 587
      open(LASTID, "+>$scopeFile") or 
581 588
          die "Failed to open lastid file for writing!";
......
636 643
  my $docrev = 1;
637 644
  my $lastid = 1;
638 645

  
639
  my $scopeFile = $skinsDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
646
  my $scopeFile = $skinsDir . "/" . $skinName . "/" . $scope . ".lastid";
640 647
  if (-e $scopeFile) {
641 648
    open(LASTID, "<$scopeFile") or die "Failed to generate accession number!";
642 649
    $lastid = <LASTID>;
......
673 680
        unless hasContent($FORM::title);
674 681
    push(@invalidParams, ucfirst($config->{'site'})." name is missing.")
675 682
        unless ((hasContent($FORM::site) && !($FORM::site =~ /^Select/)) ||
676
                $FORM::cfg eq "nceas");
683
                $skinName eq "nceas");
677 684
    push(@invalidParams, "First name of principal data set owner is missing.")
678 685
        unless hasContent($FORM::origNamefirst0);
679 686
    push(@invalidParams, "Last name of principal data set owner is missing.")
......
1003 1010
    # normalize input filenames; Windows filenames include full paths
1004 1011
    $cleanName =~ s/.*[\/\\](.*)/$1/;
1005 1012

  
1006
    my $outFile = $tmpDir . "/" . $cleanName;
1013
    my $outFile = $tempDir . "/" . $cleanName;
1007 1014
    #debug("Reading file from disk: $outFile");
1008 1015

  
1009 1016
    my $fileSize = stat($outFile)->size;
......
1105 1112
    $ctx->add($fileData);
1106 1113
    my $digest = $ctx->hexdigest;
1107 1114

  
1108
    my $outputName = $tmpDir . "/" . $cleanName;
1115
    my $outputName = $tempDir . "/" . $cleanName;
1109 1116
    open(OUT,">$outputName") or die "Could not open: $!";
1110 1117
    print OUT $fileData;
1111 1118
    close(OUT);
......
1116 1123

  
1117 1124
sub deleteFile {
1118 1125
    my $input = shift;
1119
    my $fileName = $tmpDir . "/" . $input;
1126
    my $fileName = $tempDir . "/" . $input;
1120 1127

  
1121 1128
    if (-e $fileName) {
1122 1129
        unlink $fileName or
......
1154 1161
sub createXMLDocument {
1155 1162
    #FIXME placeholder for $FORM element, should be determined by config
1156 1163

  
1157
    if ($FORM::cfg eq "ebm") {
1164
    if ($skinName eq "ebm") {
1158 1165
        return createProjectDocument();
1159 1166
    } else {
1160 1167
        return createDatasetDocument();
......
1456 1463

  
1457 1464
sub creatorElement() {
1458 1465
    my $creators;
1459
    if ($FORM::cfg eq 'nceas') {
1466
    if ($skinName eq 'nceas') {
1460 1467
        for (my $i = 0; $i < scalar(@FORM::wg); $i++) {
1461 1468
            $creators .= creatorNode($FORM::wg[$i]);
1462 1469
        }
1463 1470
    } else {
1464 1471
        $creators .= creatorNode($FORM::site);
1465 1472
    }
1466
    if ($FORM::cfg ne 'knb') {
1473
    if ($skinName ne 'knb') {
1467 1474
        $creators .= creatorNode();
1468 1475
    }
1469 1476

  
......
1475 1482
    my $content = "";
1476 1483

  
1477 1484
    if (!hasContent($org)) {
1478
        $content = $organization;
1485
        $content = $config->{'organization'};
1479 1486
    } else {
1480 1487
        $content = $org;
1481 1488
    }
......
1913 1920
                    # If the file is already in @fileArray then do not add it 
1914 1921
                    $alreadyInArray = 0;
1915 1922
                    foreach $element (@fileArray) {
1916
                        $tempfile = $tmpDir."/".$pushDoc;
1923
                        $tempfile = $tempDir."/".$pushDoc;
1917 1924
                        if ($element eq $pushDoc) {
1918 1925
                            $alreadyInArray = 1;
1919 1926
                        }
1920 1927
                    }
1921 1928
            
1922 1929
                    if (!$alreadyInArray) {
1923
                        $tempfile = $tmpDir."/".$pushDoc;
1930
                        $tempfile = $tempDir."/".$pushDoc;
1924 1931
                        $response = "";
1925 1932
                        $response = $metacat->read($pushDoc);    
1926 1933
                        if (! $response) {
......
1942 1949

  
1943 1950
            # Read the main document. 
1944 1951

  
1945
            $tempfile = $tmpDir."/".$docid;
1952
            $tempfile = $tempDir."/".$docid;
1946 1953
            open (TFILE,">$tempfile") || die ("Cant open xml file...\n");
1947 1954
            print TFILE $doc;
1948 1955
            close(TFILE);
......
1955 1962
            my $resultsheet;
1956 1963
        
1957 1964
            $xslt = XML::LibXSLT->new();
1958
            $tempfile = $tmpDir."/"."triple_info.xsl";
1965
            $tempfile = $tempDir."/"."triple_info.xsl";
1959 1966
    
1960 1967
            $triplesheet = $xslt->parse_stylesheet_file($tempfile);
1961 1968

  
1962
            $results = $triplesheet->transform($xmldoc, packageDir => "\'$tmpDir/\'", packageName => "\'$docid\'");
1969
            $results = $triplesheet->transform($xmldoc, packageDir => "\'$tempDir/\'", packageName => "\'$docid\'");
1963 1970

  
1964
            $tempfile = $tmpDir."/"."emlb6toeml2.xsl";
1971
            $tempfile = $tempDir."/"."emlb6toeml2.xsl";
1965 1972
            $stylesheet = $xslt->parse_stylesheet_file($tempfile);
1966 1973
            $resultsheet = $stylesheet->transform($results);
1967 1974
        
......
2153 2160
                $$templateVars{'site'} = $tempValue;
2154 2161
            }
2155 2162
        }
2156
        if ($FORM::cfg eq 'nceas') {
2163
        if ($skinName eq 'nceas') {
2157 2164
            my @wg;
2158 2165
            foreach $node ($results->get_nodelist) {
2159 2166
                my $tempValue = findValue($node,'../organizationName');
2160 2167
                $wg[scalar(@wg)] = $tempValue;
2161 2168
            }
2162
            my $projects = getProjectList($database);
2169
            my $projects = getProjectList($properties);
2163 2170
            $$templateVars{'projects'} = $projects;
2164 2171
            $$templateVars{'wg'} = \@wg;
2165 2172
        }
......
2816 2823
            $html .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
2817 2824
            $html .= "<input type=\"hidden\" name=\"username\" value=\"".$FORM::username."\" />";
2818 2825
            $html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />";
2819
            $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
2826
            $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$skinName."\" />";
2820 2827
            $html .= "</form></body></html>";
2821 2828
            print $session->header();
2822 2829
            print $html;
......
2827 2834
            push(@errorMessages, "Failed during login.\n");
2828 2835
            $$templateVars{'status'} = 'login_failure';
2829 2836
            $$templateVars{'errorMessages'} = \@errorMessages;
2830
            $$templateVars{'cfg'} = $FORM::cfg;
2837
            $$templateVars{'cfg'} = $skinName;
2831 2838
            $$templateVars{'section'} = "Login Status";
2832 2839
            $template->process( $templates->{'response'}, $templateVars);
2833 2840
        }
......
2835 2842
    exit(0);
2836 2843
    } else {
2837 2844
        # session found ... redirect to index page
2838
        my $url = "$skinsDir/$FORM::cfg/index.html";
2845
        my $url = "$skinsDir/$skinName/index.html";
2839 2846
        redirect($url);
2840 2847
        exit(0);
2841 2848
   }
......
2854 2861
    if ( $session->is_empty || $session->is_expired) {
2855 2862
        # no session found ... send back to index.html page ... 
2856 2863
        debug("Session empty or not found");
2857
        my $url = "$skinsDir/$FORM::cfg/index.html";
2864
        my $url = "$skinsDir/$skinName/index.html";
2858 2865
        redirect($url);
2859 2866
        # should logout request be sent to metacat??? 
2860 2867
    } else {
......
2868 2875
        $html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
2869 2876
        $html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
2870 2877
        $html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />";
2871
        $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
2878
        $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$skinName."\" />";
2872 2879
        $html .= "</form></body></html>";
2873 2880
        print($html);
2874 2881
    }
......
2942 2949
    my $session = CGI::Session->load();
2943 2950
        if ( $session->is_empty || $session->is_expired) {
2944 2951
            # no session found ... send back the regular read page ...
2945
       	    my $url = "$skinsDir/$FORM::cfg/index.html";
2952
       	    my $url = "$skinsDir/$skinName/index.html";
2946 2953
       	    redirect($url);
2947 2954
        } else {
2948 2955
       	    my $htmldoc = "";
2949 2956
       	    $htmldoc .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
2950 2957
       	    $htmldoc .= "<html><head><title>Dataset Description: ".$docid."</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>";
2951 2958
       	    $htmldoc .= "<frameset rows=\"150,*\" cols=\"*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
2952
       	    $htmldoc .= "<frame src=\"$skinsDir/$FORM::cfg/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>";
2959
       	    $htmldoc .= "<frame src=\"$skinsDir/$skinName/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>";
2953 2960
       	    $htmldoc .= "<frameset cols=\"200,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">";
2954
       	    $htmldoc .= "<body></body><frame src=\"$cgiUrl?cfg=$FORM::cfg&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>";
2955
       	    $htmldoc .= "<frame src=\"". $metacatUrl ."?action=read&qformat=".$FORM::cfg."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">";
2961
       	    $htmldoc .= "<body></body><frame src=\"$cgiUrl?cfg=$skinName&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>";
2962
       	    $htmldoc .= "<frame src=\"". $metacatUrl ."?action=read&qformat=".$skinName."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">";
2956 2963
            $htmldoc .= "</frameset></frameset></html>";
2957 2964

  
2958 2965
       	    print $htmldoc;	
......
3498 3505
			
3499 3506
			my $reviewDoc = '';
3500 3507
			$reviewDoc .= "<?xml version=\"1.0\"?>";
3501
			$reviewDoc .= "<reviewHistory registryName=\"".$FORM::cfg."\">";
3508
			$reviewDoc .= "<reviewHistory registryName=\"".$skinName."\">";
3502 3509
			$reviewDoc .= $review;
3503 3510
			$reviewDoc .= "</reviewHistory>";
3504 3511
	                $response = $metacat->insert($id, $reviewDoc);
......
3644 3651
    }else{
3645 3652
        $$templateVars{'site'} = $FORM::site;
3646 3653
    }
3647
    if($FORM::cfg eq "nceas"){
3654
    if($skinName eq "nceas"){
3648 3655
        $$templateVars{'wg'} = \@FORM::wg;
3649 3656
    }
3650 3657
    $$templateVars{'identifier'} = normalizeCD($FORM::identifier);
......
3913 3920
    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
3914 3921
    $$templateVars{'providerSurName'} = $FORM::providerSurName;
3915 3922
    $$templateVars{'site'} = $FORM::site;
3916
    if ($FORM::cfg eq "nceas") {
3917
        my $projects = getProjectList($database);
3923
    if ($skinName eq "nceas") {
3924
        my $projects = getProjectList($properties);
3918 3925
        $$templateVars{'projects'} = $projects;
3919 3926
        $$templateVars{'wg'} = \@FORM::wg;
3920 3927
    }
......
4233 4240
#
4234 4241
################################################################################
4235 4242
sub getProjectList {
4236
    my $database = shift;
4243
    my $properties = shift;
4237 4244
    my $projects;
4238 4245

  
4239 4246
    # Check for availability AdminDB.pm, for accessing NCEAS projects
......
4242 4249
        $projects = getTestProjectList();
4243 4250
    } else {
4244 4251
        my $admindb = NCEAS::AdminDB->new();
4245
        $admindb->connect($nceas_db, $nceas_db_user, $nceas_db_password);
4252

  
4253
        # populate db parameters for NCEAS AdminDB
4254
        my $db = $properties->splitToTree(qr/\./, 'registry.db');
4255

  
4256
        $admindb->connect($db->{'connection'}, $db->{'user'}, $db->{'password'});
4246 4257
        if ($admindb->{'connected'}) {
4247 4258
            $projects = $admindb->getProjects();
4248 4259
        } else {

Also available in: Unified diff