Revision 4080
Added by daigle over 16 years ago
register-dataset.cgi | ||
---|---|---|
30 | 30 |
|
31 | 31 |
use Metacat; |
32 | 32 |
use AppConfig qw(:expand :argcount); |
33 |
use Config::Properties; |
|
33 | 34 |
use XML::LibXML; |
34 | 35 |
use XML::LibXSLT; |
35 | 36 |
use Template; |
... | ... | |
42 | 43 |
use strict; |
43 | 44 |
|
44 | 45 |
# Global configuration paramters |
45 |
#my $cfgdir = "/usr/local/devtools/tomcat/webapps/knb/style/skins"; |
|
46 |
my $cfgdir = "@install-dir@@style-skins-relpath@"; |
|
47 |
my $tmpdir = "@temp-dir@"; |
|
48 |
my $templatesdir = "@install-dir@@style-common-relpath@/templates"; |
|
46 |
my $cgiUrl = $ENV{'SCRIPT_FILENAME'}; |
|
47 |
my $workingDirectory = dirname($cgiUrl); |
|
48 |
my $metacatProps = "${workingDirectory}/../WEB-INF/metacat.properties"; |
|
49 |
my $properties = new Config::Properties(); |
|
50 |
unless (open (METACAT_PROPERTIES, $metacatProps)) { |
|
51 |
print "Content-type: text/html\n\n"; |
|
52 |
print "Unable to locate Metacat properties. Working directory is set as '$workingDirectory', is this correct?"; |
|
53 |
exit(0); |
|
54 |
} |
|
55 |
|
|
56 |
$properties->load(*METACAT_PROPERTIES); |
|
57 |
|
|
58 |
# local directory configuration |
|
59 |
my $configDir = $properties->getProperty('config-dir'); # skins directory |
|
60 |
my $tmpDir = $properties->getProperty('temp-dir'); |
|
61 |
my $xslConvDir = "$configDir/lib/style"; |
|
62 |
|
|
63 |
# url configuration |
|
64 |
my $metacatUrl = $properties->getProperty('metacatUrl'); |
|
65 |
|
|
49 | 66 |
my $now = time; |
50 | 67 |
my $xslConvDir = "$cfgdir/lib/style/"; |
51 | 68 |
|
... | ... | |
57 | 74 |
my $error = 0; |
58 | 75 |
my @errorMessages; |
59 | 76 |
|
60 |
# create a new AppConfig object and load our config parameters |
|
61 |
# note that this requires the form submission to have a "cfg" paramter |
|
62 |
# to determine which config file to load |
|
63 |
my $config = AppConfig->new({ |
|
64 |
GLOBAL => { ARGCOUNT => ARGCOUNT_ONE, } }); |
|
65 |
|
|
66 |
$config->define("metacatUrl"); |
|
67 |
$config->define("username"); |
|
68 |
$config->define("password"); |
|
69 |
$config->define("ldapUrl"); |
|
70 |
$config->define("defaultScope"); |
|
71 |
$config->define("organization"); |
|
72 |
$config->define("orgabbrev"); |
|
73 |
$config->define("orgurl"); |
|
74 |
$config->define("accesspubid"); |
|
75 |
$config->define("accesssysid"); |
|
76 |
$config->define("datasetpubid"); |
|
77 |
$config->define("datasetsysid"); |
|
78 |
$config->define("showSiteList", { DEFAULT => 'true'} ); |
|
79 |
$config->define("lsite", { DEFAULT => 'station'} ); |
|
80 |
$config->define("usite", { DEFAULT => 'Station'} ); |
|
81 |
$config->define("showWgList", { DEFAULT => 'true'} ); |
|
82 |
$config->define("showOrganization", { DEFAULT => 'true'} ); |
|
83 |
$config->define("hasKeyword", { DEFAULT => 'true'} ); |
|
84 |
$config->define("hasTemporal", { DEFAULT => 'true'} ); |
|
85 |
$config->define("hasSpatial", { DEFAULT => 'true'} ); |
|
86 |
$config->define("hasTaxonomic", { DEFAULT => 'true'} ); |
|
87 |
$config->define("hasMethod", { DEFAULT => 'true'} ); |
|
88 |
$config->define("hasUpload", { DEFAULT => 'false'} ); |
|
89 |
$config->define("temporalRequired", { DEFAULT => 'true'} ); |
|
90 |
$config->define("spatialRequired", { DEFAULT => 'true'} ); |
|
91 |
$config->define("contactEmailAddressRequired", { DEFAULT => 'false'} ); |
|
92 |
$config->define("publicReadable", { DEFAULT => 'true'} ); |
|
93 |
$config->define("adminIsDocOwner", { DEFAULT => 'false'} ); |
|
94 |
$config->define("moderators", { DEFAULT => ''} ); |
|
95 |
$config->define("mailhost"); |
|
96 |
$config->define("sender"); |
|
97 |
$config->define("recipient"); |
|
98 |
$config->define("adminname"); |
|
99 |
if ($FORM::cfg eq 'nceas') { |
|
100 |
$config->define("nceas_db"); |
|
101 |
$config->define("nceas_db_user"); |
|
102 |
$config->define("nceas_db_password"); |
|
103 |
} |
|
104 |
$config->define("responseTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
105 |
$config->define("entryFormTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
106 |
$config->define("guideTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
107 |
$config->define("loginFormTemplate", { DEFAULT => 'loginForm.tmpl'} ); |
|
108 |
$config->define("confirmDataTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
109 |
$config->define("deleteDataTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
110 |
$config->define("modEmailNotificationTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
111 |
$config->define("modResultTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
112 |
$config->define("getReviewsTemplate", { DEFAULT => 'crap.tmpl'} ); |
|
113 |
$config->define("debug", { DEFAULT => '0'} ); |
|
114 |
$config->define("lat", { ARGCOUNT => ARGCOUNT_HASH} ); |
|
115 |
$config->define("lon", { ARGCOUNT => ARGCOUNT_HASH} ); |
|
116 |
|
|
117 |
|
|
77 |
my $skinProperties = new Config::Properties(); |
|
118 | 78 |
if (! hasContent($FORM::cfg)) { |
119 | 79 |
$error = "Application misconfigured. Please contact the administrator."; |
120 | 80 |
push(@errorMessages, $error); |
121 | 81 |
} else { |
122 |
my $cfgfile = $cfgdir . "/" . $FORM::cfg . "/" . $FORM::cfg . ".cfg"; |
|
123 |
$config->file($cfgfile); |
|
82 |
my $skinProps = "$configDir/$FORM::cfg/$FORM::cfg.properties"; |
|
83 |
unless (open (SKIN_PROPERTIES, $skinProps)) { |
|
84 |
print "Content-type: text/html\n\n"; |
|
85 |
print "Unable to locate skin properties at $skinProps. Is this path correct?"; |
|
86 |
exit(0); |
|
87 |
} |
|
88 |
$skinProperties->load(*SKIN_PROPERTIES); |
|
124 | 89 |
} |
125 | 90 |
|
126 |
my $metacatUrl = $config->metacatUrl(); |
|
127 |
my $username = $config->username(); |
|
128 |
my $password = $config->password(); |
|
129 |
my $ldapUrl = $config->ldapUrl(); |
|
130 |
my $defaultScope = $config->defaultScope(); |
|
131 |
my $organization = $config->organization(); |
|
132 |
my $orgabbrev = $config->orgabbrev(); |
|
133 |
my $orgurl = $config->orgurl(); |
|
134 |
my $orgfilter = $organization; |
|
135 |
$orgfilter =~ s/ /%20/g; |
|
136 |
my $responseTemplate = $config->responseTemplate(); |
|
137 |
my $entryFormTemplate = $config->entryFormTemplate(); |
|
138 |
my $deleteDataTemplate = $config->deleteDataTemplate(); |
|
139 |
my $guideTemplate = $config->guideTemplate(); |
|
140 |
my $loginFormTemplate = $config->loginFormTemplate(); |
|
141 |
my $confirmDataTemplate = $config->confirmDataTemplate(); |
|
142 |
my $modEmailNotificationTemplate = $config->modEmailNotificationTemplate(); |
|
143 |
my $modResultTemplate = $config->modResultTemplate(); |
|
144 |
my $getReviewsTemplate = $config->getReviewsTemplate(); |
|
145 |
my $accesspubid = $config->accesspubid(); |
|
146 |
my $accesssysid = $config->accesssysid(); |
|
147 |
my $datasetpubid = $config->datasetpubid(); |
|
148 |
my $datasetsysid = $config->datasetsysid(); |
|
149 |
my $showSiteList = $config->showSiteList(); |
|
150 |
my $lsite = $config->lsite(); |
|
151 |
my $usite = $config->usite(); |
|
152 |
my $showWgList = $config->showWgList(); |
|
153 |
my $showOrganization = $config->showOrganization(); |
|
154 |
my $hasKeyword = $config->hasKeyword(); |
|
155 |
my $hasTemporal = $config->hasTemporal(); |
|
156 |
my $hasSpatial = $config->hasSpatial(); |
|
157 |
my $hasTaxonomic = $config->hasTaxonomic(); |
|
158 |
my $hasMethod = $config->hasMethod(); |
|
159 |
my $hasUpload = $config->hasUpload(); |
|
160 |
my $temporalRequired = $config->temporalRequired(); |
|
161 |
my $spatialRequired = $config->spatialRequired(); |
|
162 |
my $contactEmailAddressRequired = $config->contactEmailAddressRequired(); |
|
163 |
my $publicReadable = $config->publicReadable(); |
|
164 |
my $adminIsDocOwner = $config->adminIsDocOwner(); |
|
165 |
my $moderators = $config->moderators(); |
|
166 |
my $mailhost = $config->mailhost(); |
|
167 |
my $sender = $config->sender(); |
|
168 |
my $recipient = $config->recipient(); |
|
169 |
my $adminname = $config->adminname(); |
|
170 |
my $nceas_db; |
|
171 |
my $nceas_db_user; |
|
172 |
my $nceas_db_password; |
|
173 |
if ($FORM::cfg eq 'nceas') { |
|
174 |
$nceas_db = $config->nceas_db(); |
|
175 |
$nceas_db_user = $config->nceas_db_user(); |
|
176 |
$nceas_db_password = $config->nceas_db_password(); |
|
91 |
# replacements for appconfig values using properties |
|
92 |
my $metacatUrl = $properties->getProperty('metacatUrl'); |
|
93 |
my $moderators = $properties->getProperty('ldap.moderators'); |
|
94 |
my $config = $properties->splitToTree(qr/\./, 'registry.config'); |
|
95 |
my $templates = $properties->splitToTree(qr/\./, 'registry.templates'); |
|
96 |
my $modules = $properties->splitToTree(qr/\./, 'registry.modules'); |
|
97 |
my $required = $properties->splitToTree(qr/\./, 'registry.required'); |
|
98 |
my $spatial = $properties->splitToTree(qr/\./, 'registry.spatial'); |
|
99 |
|
|
100 |
my $metacatUrl = $properties->getProperty('metacatUrl'); |
|
101 |
my $username = $config->{'username'}; |
|
102 |
my $password = $config->{'password'}; |
|
103 |
|
|
104 |
# XXX replace these with the proper array versions once the templates work correctly |
|
105 |
my $showWgList = $required->{'wgList'}; |
|
106 |
my $showOrganization = $required->{'organization'}; |
|
107 |
my $hasKeyword = $required->{'keyword'}; |
|
108 |
my $hasTemporal = $required->{'temporal'}; |
|
109 |
my $hasSpatial = $required->{'spatial'}; |
|
110 |
my $hasTaxonomic = $required->{'taxonomic'}; |
|
111 |
my $hasMethod = $required->{'method'}; |
|
112 |
my $hasUpload = $required->{'upload'}; |
|
113 |
|
|
114 |
# contains sender, recipient, admin, mailhost |
|
115 |
my $email = $properties->splitToTree(qr/\./, 'email'); |
|
116 |
|
|
117 |
# set stderr printing if configured |
|
118 |
my $debug_enabled = $config->{'debug'}; |
|
119 |
if ($FORM::debug) { |
|
120 |
$debug_enabled = $FORM::debug; |
|
177 | 121 |
} |
178 |
my $debug = $config->debug(); |
|
122 |
my $lat = $config->get('lat'); |
|
123 |
my $lon = $config->get('lon'); |
|
124 |
|
|
125 |
my $metacatUrl = $properties->getProperty('metacatUrl'); |
|
126 |
my $username = $config->{'username'}; |
|
127 |
my $password = $config->{'password'}; |
|
128 |
|
|
129 |
# TODO SCW replace these with the proper array versions once the templates work correctly |
|
130 |
my $showWgList = $required->{'wgList'}; |
|
131 |
my $showOrganization = $required->{'organization'}; |
|
132 |
my $hasKeyword = $required->{'keyword'}; |
|
133 |
my $hasTemporal = $required->{'temporal'}; |
|
134 |
my $hasSpatial = $required->{'spatial'}; |
|
135 |
my $hasTaxonomic = $required->{'taxonomic'}; |
|
136 |
my $hasMethod = $required->{'method'}; |
|
137 |
my $hasUpload = $required->{'upload'}; |
|
138 |
|
|
139 |
# contains sender, recipient, admin, mailhost |
|
140 |
my $email = $properties->splitToTree(qr/\./, 'email'); |
|
141 |
|
|
142 |
# set stderr printing if configured |
|
143 |
my $debug_enabled = $config->{'debug'}; |
|
179 | 144 |
if ($FORM::debug) { |
180 |
$debug = $FORM::debug; |
|
145 |
$debug_enabled = $FORM::debug;
|
|
181 | 146 |
} |
182 | 147 |
|
183 |
# 1.8.1 temporary baseUrl fix |
|
184 |
my $baseUrl = $metacatUrl; |
|
185 |
$baseUrl =~ s/metacat$//; |
|
148 |
# populate db parameters for NCEAS AdminDB |
|
149 |
my $database = ''; |
|
150 |
if ($FORM::cfg eq 'nceas') { |
|
151 |
my $database = $properties->splitToTree(qr/\./, 'registry.db'); |
|
152 |
} |
|
186 | 153 |
|
187 |
my $lat = $config->get('lat'); |
|
188 |
my $lon = $config->get('lon'); |
|
189 |
|
|
190 |
# Convert the lat and lon configs into usable data structures |
|
154 |
#Convert the lat and lon configs into usable data structures |
|
191 | 155 |
my @sitelist; |
192 | 156 |
my %siteLatDMS; |
193 | 157 |
my %siteLongDMS; |
194 |
foreach my $newsite (keys %$lat) { |
|
195 |
my ($latd, $latm, $lats, $latdir) = split(':', $lat->{$newsite}); |
|
196 |
my ($lond, $lonm, $lons, $londir) = split(':', $lon->{$newsite}); |
|
197 |
push(@sitelist, $newsite); |
|
198 |
$siteLatDMS{$newsite} = [ $latd, $latm, $lats, $latdir ]; |
|
199 |
$siteLongDMS{$newsite} = [ $lond, $lonm, $lons, $londir ]; |
|
158 |
while ( my ($key, $value) = each (%$spatial)) { |
|
159 |
my ($name, $lon, $lat) = split(",", $value); |
|
160 |
my ($latd, $latm, $lats, $latdir) = split(':', $lat); |
|
161 |
my ($lond, $lonm, $lons, $londir) = split(':', $lon); |
|
162 |
push(@sitelist, $name); |
|
163 |
$siteLatDMS{$name} = [ $latd, $latm, $lats, $latdir ]; |
|
164 |
$siteLongDMS{$name} = [ $lond, $lonm, $lons, $londir ]; |
|
200 | 165 |
} |
201 | 166 |
|
202 | 167 |
# set some configuration options for the template object |
203 | 168 |
my $ttConfig = { |
204 |
INCLUDE_PATH => $templatesdir,
|
|
169 |
INCLUDE_PATH => $properties->getProperty('templates-dir'),
|
|
205 | 170 |
INTERPOLATE => 0, |
206 | 171 |
POST_CHOMP => 1, |
207 | 172 |
#DEBUG => 'all', |
... | ... | |
211 | 176 |
my $template = Template->new($ttConfig) || die $Template::ERROR, "\n"; |
212 | 177 |
|
213 | 178 |
# Set up the template information that is common to all forms |
179 |
$$templateVars{'styleSkinsPath'} = $properties->getProperty('style-skins-path'); |
|
180 |
$$templateVars{'styleCommonPath'} = $properties->getProperty('style-common-path'); |
|
181 |
$$templateVars{'servletPath'} = $properties->getProperty('servlet-path'); |
|
182 |
$$templateVars{'metacatUrl'} = $metacatUrl; |
|
183 |
$$templateVars{'cgiPrefix'} = $properties->getProperty('cgi-prefix'); |
|
214 | 184 |
$$templateVars{'cfg'} = $FORM::cfg; |
215 |
$$templateVars{'recipient'} = $recipient; |
|
216 |
$$templateVars{'adminname'} = $adminname; |
|
217 |
$$templateVars{'organization'} = $organization; |
|
218 |
$$templateVars{'orgabbrev'} = $orgabbrev; |
|
219 |
$$templateVars{'orgurl'} = $orgurl; |
|
220 |
$$templateVars{'orgfilter'} = $orgfilter; |
|
221 |
$$templateVars{'baseUrl'} = $baseUrl; |
|
185 |
$$templateVars{'email'} = $email; |
|
186 |
$$templateVars{'templates'} = $templates; |
|
187 |
$$templateVars{'required'} = $required; |
|
188 |
$$templateVars{'config'} = $config; |
|
222 | 189 |
|
223 | 190 |
debug("Registry: Initialized -- stage set: $FORM::stage"); |
224 | 191 |
|
... | ... | |
227 | 194 |
debug("Registry: No configuration set."); |
228 | 195 |
print "Content-type: text/html\n\n"; |
229 | 196 |
$$templateVars{'message'} = 'Error: The registry requires a skin name to continue.'; |
230 |
$template->process( $loginFormTemplate, $templateVars);
|
|
197 |
$template->process( $templates->{'login'}, $templateVars);
|
|
231 | 198 |
exit(0); |
232 | 199 |
} |
233 | 200 |
|
... | ... | |
240 | 207 |
exit(0); |
241 | 208 |
} |
242 | 209 |
|
243 |
# FIXME: temporary 1.8.1 fix to prevent missing upload directory from causing errors |
|
244 |
if (not -W $tmpdir) { |
|
245 |
debug("Registry Error: Can't write files to $tmpdir, disabling file uploads"); |
|
246 |
#push(@errorMessages, "Unable to write files to temporary folder. Email sysadmin."); |
|
247 |
$hasUpload = 'false'; |
|
248 |
} |
|
249 |
|
|
250 | 210 |
# Process the form based on stage parameter. |
251 | 211 |
if ($FORM::stage =~ "loginform") { |
252 | 212 |
print "Content-type: text/html\n\n"; |
... | ... | |
259 | 219 |
|
260 | 220 |
if ( $session->is_empty ) { |
261 | 221 |
# no session found ... redirect to login page template |
262 |
$template->process( $loginFormTemplate, $templateVars);
|
|
222 |
$template->process( $templates->{'login'}, $templateVars);
|
|
263 | 223 |
} else { |
264 | 224 |
# session found ... delete the session.... |
265 | 225 |
$session->delete(); |
266 |
$template->process( $loginFormTemplate, $templateVars);
|
|
226 |
$template->process( $templates->{'login'}, $templateVars);
|
|
267 | 227 |
} |
268 | 228 |
exit(0); |
269 | 229 |
} elsif ($FORM::stage =~ "logout") { |
... | ... | |
294 | 254 |
if ($FORM::stage =~ "guide") { |
295 | 255 |
# Send back the information on how to fill the form |
296 | 256 |
$$templateVars{'section'} = "Guide on How to Complete Registry Entries"; |
297 |
$template->process( $guideTemplate, $templateVars);
|
|
257 |
$template->process( $template->{'guide'}, $templateVars);
|
|
298 | 258 |
exit(0); |
299 | 259 |
|
300 | 260 |
} elsif ($FORM::stage =~ "insert") { |
... | ... | |
316 | 276 |
if ( $session->is_empty ) { |
317 | 277 |
# no session found ... redirect to login page template |
318 | 278 |
$$templateVars{'message'} = 'You must login to modify your dataset.'; |
319 |
$template->process( $loginFormTemplate, $templateVars);
|
|
279 |
$template->process( $templates->{'login'}, $templateVars);
|
|
320 | 280 |
} else { |
321 | 281 |
# Show the form will all the values filled in. |
322 | 282 |
my @sortedSites; |
... | ... | |
340 | 300 |
} else { |
341 | 301 |
$$templateVars{'status'} = "Cancel"; |
342 | 302 |
$$templateVars{'function'} = "cancel"; |
343 |
$template->process( $responseTemplate, $templateVars);
|
|
303 |
$template->process( $templates->{'response'}, $templateVars);
|
|
344 | 304 |
exit(0); |
345 | 305 |
} |
346 | 306 |
|
... | ... | |
348 | 308 |
# Deletion of a file has been requested. |
349 | 309 |
# Ask for username and password using deleteDataForm |
350 | 310 |
$$templateVars{'docid'} = $FORM::docid; |
351 |
$template->process( $deleteDataTemplate, $templateVars);
|
|
311 |
$template->process( $templates->{'deleteData'}, $templateVars);
|
|
352 | 312 |
exit(0); |
353 | 313 |
|
354 | 314 |
}elsif ($FORM::stage !~ "confirmed") { |
... | ... | |
360 | 320 |
# no session found ... redirect to login page template |
361 | 321 |
$$templateVars{'showInstructions'} = 'true'; |
362 | 322 |
$$templateVars{'message'} = 'You must login to register your dataset.'; |
363 |
$template->process( $loginFormTemplate, $templateVars);
|
|
323 |
$template->process( $templates->{'login'}, $templateVars);
|
|
364 | 324 |
} else { |
365 | 325 |
|
366 | 326 |
# Hence, send back entry form for entry of data. |
... | ... | |
369 | 329 |
foreach my $site (sort @sitelist) { |
370 | 330 |
push(@sortedSites, $site); |
371 | 331 |
} |
372 |
|
|
332 |
|
|
373 | 333 |
if ($FORM::cfg eq 'nceas') { |
374 |
my $projects = getProjectList(); |
|
334 |
my $projects = getProjectList($database);
|
|
375 | 335 |
$$templateVars{'projects'} = $projects; |
376 | 336 |
$$templateVars{'wg'} = \@FORM::wg; |
377 | 337 |
} |
378 | 338 |
|
379 |
$$templateVars{'showSiteList'} = $showSiteList; |
|
380 |
$$templateVars{'lsite'} = $lsite; |
|
381 |
$$templateVars{'usite'} = $usite; |
|
382 |
$$templateVars{'showWgList'} = $showWgList; |
|
383 |
$$templateVars{'showOrganization'} = $showOrganization; |
|
384 |
$$templateVars{'hasKeyword'} = $hasKeyword; |
|
385 |
$$templateVars{'hasTemporal'} = $hasTemporal; |
|
386 |
$$templateVars{'hasSpatial'} = $hasSpatial; |
|
387 |
$$templateVars{'hasTaxonomic'} = $hasTaxonomic; |
|
388 |
$$templateVars{'hasMethod'} = $hasMethod; |
|
389 |
$$templateVars{'hasUpload'} = $hasUpload; |
|
390 |
$$templateVars{'temporalRequired'} = $temporalRequired; |
|
391 |
$$templateVars{'spatialRequired'} = $spatialRequired; |
|
392 |
$$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired; |
|
339 |
#$$templateVars{'required'} = $required; |
|
340 |
$$templateVars{'templates'} = $templates; |
|
341 |
$$templateVars{'showSiteList'} = $required->{'siteList'}; |
|
342 |
$$templateVars{'site'} = $config->{'site'}; |
|
343 |
$$templateVars{'showWgList'} = $showWgList; |
|
344 |
$$templateVars{'showOrganization'} = $showOrganization; |
|
345 |
$$templateVars{'hasKeyword'} = $hasKeyword; |
|
346 |
$$templateVars{'hasTemporal'} = $hasTemporal; |
|
347 |
$$templateVars{'hasSpatial'} = $hasSpatial; |
|
348 |
$$templateVars{'hasTaxonomic'} = $hasTaxonomic; |
|
349 |
$$templateVars{'hasMethod'} = $hasMethod; |
|
350 |
$$templateVars{'hasUpload'} = $hasUpload; |
|
351 |
$$templateVars{'temporalRequired'} = $required->{'temporalRequired'}; |
|
352 |
$$templateVars{'spatialRequired'} = $required->{'spatialRequired'}; |
|
353 |
$$templateVars{'contactEmailAddressRequired'} = $required->{'contactEmail'}; |
|
393 | 354 |
|
394 |
$$templateVars{'siteList'} = \@sortedSites;
|
|
395 |
$$templateVars{'section'} = "Entry Form";
|
|
396 |
$$templateVars{'docid'} = "";
|
|
397 |
debug("Registry: Sending form: ready to process template");
|
|
398 |
$template->process( $entryFormTemplate, $templateVars);
|
|
399 |
debug("Registry: Sending form: template processed");
|
|
355 |
$$templateVars{'siteList'} = \@sortedSites;
|
|
356 |
$$templateVars{'section'} = "Entry Form";
|
|
357 |
$$templateVars{'docid'} = "";
|
|
358 |
debug("Registry: Sending form: ready to process template");
|
|
359 |
$template->process( $templates->{'entry'}, $templateVars);
|
|
360 |
debug("Registry: Sending form: template processed");
|
|
400 | 361 |
} |
401 | 362 |
exit(0); |
402 | 363 |
} |
... | ... | |
444 | 405 |
# Login to metacat |
445 | 406 |
my ($dname, $userPass) = getCredentials(); |
446 | 407 |
my $response = $metacat->login($dname, $userPass); |
408 |
my $errorMessage = ""; |
|
447 | 409 |
|
448 | 410 |
# Parameters have been validated and Create the XML document |
449 | 411 |
my $xmldoc = createXMLDocument(); |
450 | 412 |
|
451 | 413 |
# Write out the XML file for debugging purposes |
452 |
#my $testFile = $tmpdir . "/test-file.xml";
|
|
414 |
#my $testFile = $tmpDir . "/test-file.xml";
|
|
453 | 415 |
#open (TFILE,">$testFile") || die ("Cant open xml file...\n"); |
454 | 416 |
#print TFILE $xmldoc; |
455 | 417 |
#close(TFILE); |
... | ... | |
467 | 429 |
$$templateVars{'cfg'} = $FORM::cfg; |
468 | 430 |
$$templateVars{'function'} = "submitted"; |
469 | 431 |
$$templateVars{'section'} = "Submission Status"; |
470 |
$template->process( $responseTemplate, $templateVars);
|
|
432 |
$template->process( $templates->{'response'}, $templateVars);
|
|
471 | 433 |
exit(0); |
472 | 434 |
} else { |
473 | 435 |
|
474 |
if($adminIsDocOwner eq 'true'){
|
|
436 |
if($config->{'adminIsDocOwner'} eq 'true'){
|
|
475 | 437 |
$response = $metacat->login($username, $password); |
476 | 438 |
if (! $response) { |
477 | 439 |
push(@errorMessages, $metacat->getMessage()); |
... | ... | |
482 | 444 |
$$templateVars{'cfg'} = $FORM::cfg; |
483 | 445 |
$$templateVars{'function'} = "submitted"; |
484 | 446 |
$$templateVars{'section'} = "Submission Status"; |
485 |
$template->process( $responseTemplate, $templateVars);
|
|
447 |
$template->process( $templates->{'response'}, $templateVars);
|
|
486 | 448 |
exit(0); |
487 | 449 |
} |
488 | 450 |
} |
... | ... | |
493 | 455 |
# document is being inserted |
494 | 456 |
my $notunique = "NOT_UNIQUE"; |
495 | 457 |
while ($notunique eq "NOT_UNIQUE") { |
496 |
$docid = newAccessionNumber($defaultScope);
|
|
458 |
$docid = newAccessionNumber($config->{'scope'});
|
|
497 | 459 |
|
498 | 460 |
$xmldocWithDocID = $xmldoc; |
499 | 461 |
$xmldocWithDocID =~ s/docid/$docid/; |
... | ... | |
508 | 470 |
$notunique = insertMetadata($xmldocWithDocID, $docid); |
509 | 471 |
# if (!$notunique) { |
510 | 472 |
# Write out the XML file for debugging purposes |
511 |
#my $testFile = $tmpdir . "/test-new.xml";
|
|
473 |
#my $testFile = $tmpDir . "/test-new.xml";
|
|
512 | 474 |
#open (TFILE,">$testFile") || die ("Cant open xml file...\n"); |
513 | 475 |
#print TFILE $newdoc; |
514 | 476 |
#close(TFILE); |
... | ... | |
517 | 479 |
# The id wasn't unique, so update our lastid file |
518 | 480 |
if ($notunique eq "NOT_UNIQUE") { |
519 | 481 |
debug( "Registry: Updating lastid (B1.1)"); |
520 |
updateLastId($defaultScope);
|
|
482 |
updateLastId($config->{'scope'});
|
|
521 | 483 |
} |
522 | 484 |
} |
523 | 485 |
debug("Registry: B2"); |
... | ... | |
569 | 531 |
# Create our HTML response and send it back |
570 | 532 |
$$templateVars{'function'} = "modified"; |
571 | 533 |
$$templateVars{'section'} = "Modification Status"; |
572 |
$template->process( $responseTemplate, $templateVars);
|
|
534 |
$template->process( $templates->{'response'}, $templateVars);
|
|
573 | 535 |
|
574 | 536 |
exit(0); |
575 | 537 |
} |
... | ... | |
606 | 568 |
$$templateVars{'function'} = "submitted"; |
607 | 569 |
$$templateVars{'section'} = "Submission Status"; |
608 | 570 |
|
609 |
$template->process( $responseTemplate, $templateVars);
|
|
571 |
$template->process( $templates->{'response'}, $templateVars);
|
|
610 | 572 |
|
611 | 573 |
exit(0); |
612 | 574 |
|
... | ... | |
630 | 592 |
(my $foundScope, my $id, my $rev) = split(/\./, $docid); |
631 | 593 |
debug("Docid is: $docid\n"); |
632 | 594 |
debug("Lastid is: $id"); |
633 |
my $scopeFile = $cfgdir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
|
|
595 |
my $scopeFile = $configDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
|
|
634 | 596 |
# FIXME: skins dir isn't generally writeable by the HTTP server, use tmp instead |
635 | 597 |
open(LASTID, "+>$scopeFile") or |
636 | 598 |
die "Failed to open lastid file for writing!"; |
... | ... | |
691 | 653 |
my $docrev = 1; |
692 | 654 |
my $lastid = 1; |
693 | 655 |
|
694 |
my $scopeFile = $cfgdir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
|
|
656 |
my $scopeFile = $configDir . "/" . $FORM::cfg . "/" . $scope . ".lastid";
|
|
695 | 657 |
if (-e $scopeFile) { |
696 | 658 |
open(LASTID, "<$scopeFile") or die "Failed to generate accession number!"; |
697 | 659 |
$lastid = <LASTID>; |
... | ... | |
719 | 681 |
my @invalidParams; |
720 | 682 |
|
721 | 683 |
push(@invalidParams, "Name of the Project is not selected in the form.") |
722 |
if (scalar(@FORM::wg) == 0 && $showWgList eq 'true');
|
|
684 |
if (scalar(@FORM::wg) == 0 && $required->{'wgList'} eq 'true');
|
|
723 | 685 |
push(@invalidParams, "First name of person entering the form is missing.") |
724 | 686 |
unless hasContent($FORM::providerGivenName); |
725 | 687 |
push(@invalidParams, "Last name of person entering the form is missing.") |
726 | 688 |
unless hasContent($FORM::providerSurName); |
727 | 689 |
push(@invalidParams, "Dataset title is missing.") |
728 | 690 |
unless hasContent($FORM::title); |
729 |
push(@invalidParams, $usite." name is missing.")
|
|
691 |
push(@invalidParams, ucfirst($config->{'site'})." name is missing.")
|
|
730 | 692 |
unless ((hasContent($FORM::site) && !($FORM::site =~ /^Select/)) || |
731 | 693 |
$FORM::cfg eq "nceas"); |
732 | 694 |
push(@invalidParams, "First name of principal data set owner is missing.") |
... | ... | |
1051 | 1013 |
my $fileNum = shift; |
1052 | 1014 |
my $fileHash = param("upload_$fileNum"); |
1053 | 1015 |
my $fileName = param("uploadname_$fileNum"); |
1016 |
my $contentType = param("uploadtype_$fileNum"); |
|
1054 | 1017 |
my $filePerm = param("uploadperm_$fileNum"); |
1055 |
my $contentType = param("uploadtype_$fileNum"); |
|
1056 | 1018 |
my $cleanName = $fileName; |
1057 | 1019 |
|
1058 | 1020 |
# normalize input filenames; Windows filenames include full paths |
1059 | 1021 |
$cleanName =~ s/.*[\/\\](.*)/$1/; |
1060 | 1022 |
|
1061 |
my $outFile = $tmpdir . "/" . $cleanName;
|
|
1023 |
my $outFile = $tmpDir . "/" . $cleanName;
|
|
1062 | 1024 |
#debug("Reading file from disk: $outFile"); |
1063 | 1025 |
|
1064 | 1026 |
my $fileSize = stat($outFile)->size; |
... | ... | |
1075 | 1037 |
return 0; |
1076 | 1038 |
} |
1077 | 1039 |
|
1078 |
#my ($dname, $userPass) = getCredentials(); |
|
1079 |
#debug("Logging in with $dname, $userPass"); |
|
1080 |
#$metacat->login($username, $password); |
|
1081 |
|
|
1082 |
my $docid = newAccessionNumber($defaultScope); |
|
1040 |
my $docid = newAccessionNumber($config->{'scope'}); |
|
1083 | 1041 |
my $unique = uploadData($outFile, $docid); |
1084 | 1042 |
if (!$unique) { |
1085 | 1043 |
debug( "Registry: Updating lastid file"); |
1086 |
updateLastId($defaultScope);
|
|
1044 |
updateLastId($config->{'scope'});
|
|
1087 | 1045 |
} |
1088 | 1046 |
|
1089 | 1047 |
my $entityid = $fileHash."001"; |
... | ... | |
1129 | 1087 |
|
1130 | 1088 |
# file is in Metacat, generate the pertinent EML elements |
1131 | 1089 |
my $contentType = uploadInfo($fileName)->{'Content-Type'}; |
1132 |
|
|
1133 | 1090 |
# occasionally CGI.pm doesn't get the file info. In this case, |
1134 | 1091 |
# use a default MIME type of text/plain. Seems fixed in the newer CGI.pm: |
1135 | 1092 |
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313141 |
... | ... | |
1165 | 1122 |
$ctx->add($fileData); |
1166 | 1123 |
my $digest = $ctx->hexdigest; |
1167 | 1124 |
|
1168 |
my $outputName = $tmpdir . "/" . $cleanName;
|
|
1125 |
my $outputName = $tmpDir . "/" . $cleanName;
|
|
1169 | 1126 |
open(OUT,">$outputName") or die "Could not open: $!"; |
1170 | 1127 |
print OUT $fileData; |
1171 | 1128 |
close(OUT); |
... | ... | |
1176 | 1133 |
|
1177 | 1134 |
sub deleteFile { |
1178 | 1135 |
my $input = shift; |
1179 |
my $fileName = $tmpdir . "/" . $input;
|
|
1136 |
my $fileName = $tmpDir . "/" . $input;
|
|
1180 | 1137 |
|
1181 | 1138 |
if (-e $fileName) { |
1182 | 1139 |
unlink $fileName or |
... | ... | |
1310 | 1267 |
$roleName = $defaultRole; |
1311 | 1268 |
} |
1312 | 1269 |
|
1270 |
#debug("XXXXX role name: " . $roleName); |
|
1313 | 1271 |
push (@{$orig{$roleName}}, [$first, $last, $origRole]); |
1314 | 1272 |
} |
1315 | 1273 |
} |
... | ... | |
1439 | 1397 |
foreach my $x (@$a_ref) { |
1440 | 1398 |
my ($kw, $kwType) = @$x; |
1441 | 1399 |
$kwElem .= "<keyword "; |
1442 |
if (hasContent($kwType) && $kwType ne "None") {
|
|
1400 |
if (hasContent($kwType) && $kwType != "None") {
|
|
1443 | 1401 |
$kwElem.= "keywordType=\"".lc($kwType)."\""; |
1444 | 1402 |
} |
1445 | 1403 |
$kwElem .= ">$kw</keyword>\n"; |
... | ... | |
1882 | 1840 |
$access .= allowElement(getUsername(), 'read', 'write'); |
1883 | 1841 |
} |
1884 | 1842 |
|
1885 |
if($publicReadable eq "true"){
|
|
1843 |
if($config->{'publicReadable'} eq "true"){
|
|
1886 | 1844 |
$access .= allowElement('public', 'read'); |
1887 | 1845 |
} |
1888 | 1846 |
$access .= "</access>\n"; |
... | ... | |
1906 | 1864 |
my $username = ''; |
1907 | 1865 |
|
1908 | 1866 |
if ($FORM::username ne '') { |
1909 |
$username = "uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org"; |
|
1867 |
$username = "uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org";
|
|
1910 | 1868 |
} else { |
1911 | 1869 |
my $session = CGI::Session->load(); |
1912 | 1870 |
if ( !$session->is_empty ) { |
... | ... | |
1955 | 1913 |
push(@errorMessages, $error); |
1956 | 1914 |
} elsif ($doc=~ /<error/) { |
1957 | 1915 |
if ( $doc=~ /public/){ |
1958 |
$error ="Error in reading the eml document. Please check if you are logged in.";
|
|
1959 |
push(@errorMessages, $error);
|
|
1960 |
} else {
|
|
1961 |
$error ="Error in reading the eml document. Please check if you have access to read the document";
|
|
1962 |
push(@errorMessages, $error);
|
|
1963 |
}
|
|
1916 |
$error ="Error in reading the eml document. Please check if you are logged in.";
|
|
1917 |
push(@errorMessages, $error);
|
|
1918 |
} else {
|
|
1919 |
$error ="Error in reading the eml document. Please check if you have access to read the document";
|
|
1920 |
push(@errorMessages, $error);
|
|
1921 |
}
|
|
1964 | 1922 |
} else { |
1965 | 1923 |
$findType = $xmldoc->findnodes('//dataset/identifier'); |
1966 | 1924 |
if ($findType->size() > 0) { |
... | ... | |
1975 | 1933 |
# If the file is already in @fileArray then do not add it |
1976 | 1934 |
$alreadyInArray = 0; |
1977 | 1935 |
foreach $element (@fileArray) { |
1978 |
$tempfile = $tmpdir."/".$pushDoc;
|
|
1936 |
$tempfile = $tmpDir."/".$pushDoc;
|
|
1979 | 1937 |
if ($element eq $pushDoc) { |
1980 | 1938 |
$alreadyInArray = 1; |
1981 | 1939 |
} |
1982 | 1940 |
} |
1983 | 1941 |
|
1984 | 1942 |
if (!$alreadyInArray) { |
1985 |
$tempfile = $tmpdir."/".$pushDoc;
|
|
1943 |
$tempfile = $tmpDir."/".$pushDoc;
|
|
1986 | 1944 |
$response = ""; |
1987 | 1945 |
$response = $metacat->read($pushDoc); |
1988 | 1946 |
if (! $response) { |
... | ... | |
2005 | 1963 |
|
2006 | 1964 |
# Read the main document. |
2007 | 1965 |
|
2008 |
$tempfile = $tmpdir."/".$docid;
|
|
1966 |
$tempfile = $tmpDir."/".$docid;
|
|
2009 | 1967 |
open (TFILE,">$tempfile") || die ("Cant open xml file...\n"); |
2010 | 1968 |
print TFILE $doc; |
2011 | 1969 |
close(TFILE); |
... | ... | |
2018 | 1976 |
my $resultsheet; |
2019 | 1977 |
|
2020 | 1978 |
$xslt = XML::LibXSLT->new(); |
2021 |
$tempfile = $tmpdir."/"."triple_info.xsl";
|
|
1979 |
$tempfile = $tmpDir."/"."triple_info.xsl";
|
|
2022 | 1980 |
|
2023 | 1981 |
$triplesheet = $xslt->parse_stylesheet_file($tempfile); |
2024 | 1982 |
|
2025 |
$results = $triplesheet->transform($xmldoc, packageDir => "\'$tmpdir/\'", packageName => "\'$docid\'");
|
|
1983 |
$results = $triplesheet->transform($xmldoc, packageDir => "\'$tmpDir/\'", packageName => "\'$docid\'");
|
|
2026 | 1984 |
|
2027 |
$tempfile = $tmpdir."/"."emlb6toeml2.xsl";
|
|
1985 |
$tempfile = $tmpDir."/"."emlb6toeml2.xsl";
|
|
2028 | 1986 |
$stylesheet = $xslt->parse_stylesheet_file($tempfile); |
2029 | 1987 |
$resultsheet = $stylesheet->transform($results); |
2030 | 1988 |
|
... | ... | |
2051 | 2009 |
################################################################################ |
2052 | 2010 |
sub modifyData { |
2053 | 2011 |
|
2054 |
my $xmldoc = readDocumentFromMetacat();
|
|
2012 |
my $xmldoc = readDocumentFromMetacat();
|
|
2055 | 2013 |
if (!scalar(@errorMessages)) { |
2056 |
getFormValuesFromEml2($xmldoc);
|
|
2014 |
getFormValuesFromEml2($xmldoc);
|
|
2057 | 2015 |
} |
2058 | 2016 |
|
2059 | 2017 |
if (scalar(@errorMessages)) { |
... | ... | |
2063 | 2021 |
$error = 1; |
2064 | 2022 |
$$templateVars{'function'} = "modification"; |
2065 | 2023 |
$$templateVars{'section'} = "Modification Status"; |
2066 |
$template->process( $responseTemplate, $templateVars);
|
|
2024 |
$template->process( $templates->{'response'}, $templateVars);
|
|
2067 | 2025 |
} else { |
2068 | 2026 |
$$templateVars{'form'} = 're_entry'; |
2069 |
$template->process( $entryFormTemplate, $templateVars);
|
|
2027 |
$template->process( $templates->{'entry'}, $templateVars);
|
|
2070 | 2028 |
} |
2071 | 2029 |
} |
2072 | 2030 |
|
... | ... | |
2088 | 2046 |
my $foundDSO; |
2089 | 2047 |
|
2090 | 2048 |
# set variable values |
2091 |
$$templateVars{'showSiteList'} = $showSiteList;
|
|
2092 |
$$templateVars{'lsite'} = $lsite;
|
|
2093 |
$$templateVars{'usite'} = $usite;
|
|
2094 |
$$templateVars{'showWgList'} = $showWgList; |
|
2049 |
$$templateVars{'required'} = $required;
|
|
2050 |
$$templateVars{'showSiteList'} = $required->{'siteList'};
|
|
2051 |
$$templateVars{'site'} = $config->{'site'};
|
|
2052 |
#$$templateVars{'showWgList'} = $showWgList;
|
|
2095 | 2053 |
$$templateVars{'showOrganization'} = $showOrganization; |
2096 | 2054 |
$$templateVars{'hasKeyword'} = $hasKeyword; |
2097 | 2055 |
$$templateVars{'hasTemporal'} = $hasTemporal; |
2098 | 2056 |
$$templateVars{'hasSpatial'} = $hasSpatial; |
2099 | 2057 |
$$templateVars{'hasTaxonomic'} = $hasTaxonomic; |
2100 | 2058 |
$$templateVars{'hasMethod'} = $hasMethod; |
2101 |
$$templateVars{'spatialRequired'} = $spatialRequired;
|
|
2102 |
$$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired;
|
|
2103 |
$$templateVars{'temporalRequired'} = $temporalRequired;
|
|
2059 |
$$templateVars{'spatialRequired'} = $required->{'spatialRequired'};
|
|
2060 |
$$templateVars{'contactEmailAddressRequired'} = $required->{'contactEmail'};
|
|
2061 |
$$templateVars{'temporalRequired'} = $required->{'temporal'};
|
|
2104 | 2062 |
|
2105 | 2063 |
# find out the tag <alternateIdentifier>. |
2106 | 2064 |
$results = $doc->findnodes('//dataset/alternateIdentifier'); |
... | ... | |
2200 | 2158 |
$aoCount++; |
2201 | 2159 |
} |
2202 | 2160 |
} |
2203 |
$$templateVars{'origEmail'} = findValue($node, '../electronicMailAddress'); |
|
2204 |
$$templateVars{'origNameOrg'} = findValue($node, '../organizationName'); |
|
2205 | 2161 |
} |
2206 | 2162 |
|
2207 | 2163 |
$results = $doc->findnodes('//dataset/creator/organizationName'); |
... | ... | |
2214 | 2170 |
foreach $node ($results->get_nodelist) { |
2215 | 2171 |
my $tempValue = findValue($node,'../organizationName'); |
2216 | 2172 |
$tempResult = $node->findnodes('../individualName'); |
2217 |
if ($tempResult->size == 0 && $tempValue ne $organization) {
|
|
2173 |
if ($tempResult->size == 0 && $tempValue ne $config->{'organization'}) {
|
|
2218 | 2174 |
$$templateVars{'site'} = $tempValue; |
2219 | 2175 |
} |
2220 | 2176 |
} |
... | ... | |
2224 | 2180 |
my $tempValue = findValue($node,'../organizationName'); |
2225 | 2181 |
$wg[scalar(@wg)] = $tempValue; |
2226 | 2182 |
} |
2227 |
my $projects = getProjectList(); |
|
2183 |
my $projects = getProjectList($database);
|
|
2228 | 2184 |
$$templateVars{'projects'} = $projects; |
2229 | 2185 |
$$templateVars{'wg'} = \@wg; |
2230 | 2186 |
} |
... | ... | |
2266 | 2222 |
$$templateVars{"origNamefirst$aoCount"} = findValue($tempNode, './givenName'); |
2267 | 2223 |
$$templateVars{"origNamelast$aoCount"} = findValue($tempNode, './surName'); |
2268 | 2224 |
$$templateVars{"origRole$aoCount"} = findValue($tempNode, '../role'); |
2269 |
$aoCount++; |
|
2225 |
$aoCount++;
|
|
2270 | 2226 |
} |
2271 | 2227 |
} |
2272 | 2228 |
} |
... | ... | |
2317 | 2273 |
|
2318 | 2274 |
my $count = 1; |
2319 | 2275 |
foreach $node ($results->get_nodelist) { |
2320 |
$tempResult = $node->findnodes('./keyword'); |
|
2276 |
$tempResult = $node->findnodes('./keyword'); |
|
2277 |
if ($tempResult->size() > 1) { |
|
2278 |
errMoreThanOne("keyword"); |
|
2279 |
} else { |
|
2321 | 2280 |
foreach $tempNode ($tempResult->get_nodelist) { |
2322 | 2281 |
$$templateVars{"keyword$count"} = $tempNode->textContent(); |
2323 |
$$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus"); |
|
2324 |
|
|
2325 | 2282 |
if ($tempNode->hasAttributes()) { |
2326 | 2283 |
my @attlist = $tempNode->attributes(); |
2327 | 2284 |
my $tmp = $attlist[0]->value; #convert the first letter to upper case |
2328 | 2285 |
$tmp =~ s/\b(\w)/\U$1/g; |
2329 | 2286 |
$$templateVars{"kwType$count"} = $tmp; |
2330 | 2287 |
} |
2331 |
$count++; |
|
2332 | 2288 |
} |
2333 | 2289 |
} |
2290 |
$$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus"); |
|
2291 |
$count++; |
|
2292 |
} |
|
2334 | 2293 |
$$templateVars{'keyCount'} = $count; |
2335 | 2294 |
if($count > 0 ){ |
2336 | 2295 |
$$templateVars{'hasKeyword'} = "true"; |
... | ... | |
2550 | 2509 |
dontOccur($node, "../positionName|../onlineURL|../userId", |
2551 | 2510 |
"positionName, onlineURL, userId in contact tag"); |
2552 | 2511 |
dontOccur($node, "./saluation", "saluation in contact tag"); |
2553 |
|
|
2512 |
|
|
2554 | 2513 |
$tempResult = $node->findnodes('../address|../phone|../electronicmailAddress|../organizationName'); |
2555 | 2514 |
if ($tempResult->size > 0) { |
2556 | 2515 |
$$templateVars{'origNamefirstContact'} = findValue($node, 'givenName'); |
2557 | 2516 |
$$templateVars{'origNamelastContact'} = findValue($node, 'surName'); |
2558 |
|
|
2517 |
|
|
2559 | 2518 |
my $tempResult2 = $node->findnodes('../address'); |
2560 | 2519 |
if ($tempResult2->size > 1) { |
2561 | 2520 |
errMoreThanOne("address"); |
... | ... | |
2568 | 2527 |
$$templateVars{'origCountryContact'} = findValue($tempNode2, 'country'); |
2569 | 2528 |
} |
2570 | 2529 |
} |
2571 |
|
|
2530 |
|
|
2572 | 2531 |
my $tempResult3 = $node->findnodes('../phone'); |
2573 | 2532 |
if ($tempResult3->size > 2) { |
2574 | 2533 |
errMoreThanN("phone"); |
... | ... | |
2593 | 2552 |
$$templateVars{'origNamelastContact'} = findValue($node, 'surName'); |
2594 | 2553 |
$$templateVars{'origNameOrgContact'} = findValue($node, '../organizationName'); |
2595 | 2554 |
} |
2596 |
$$templateVars{'origEmail'} = findValue($node, '../electronicMailAddress'); |
|
2597 |
$$templateVars{'origNameOrg'} = findValue($node, '../organizationName'); |
|
2598 |
|
|
2599 | 2555 |
} |
2600 | 2556 |
} |
2601 | 2557 |
|
... | ... | |
2708 | 2664 |
|
2709 | 2665 |
######################################################## |
2710 | 2666 |
|
2667 |
|
|
2711 | 2668 |
dontOccur($doc, "./dataTable", "dataTable"); |
2712 | 2669 |
dontOccur($doc, "./spatialRaster", "spatialRaster"); |
2713 | 2670 |
dontOccur($doc, "./spatialVector", "spatialVector"); |
2714 | 2671 |
dontOccur($doc, "./storedProcedure", "storedProcedure"); |
2715 | 2672 |
dontOccur($doc, "./view", "view"); |
2716 |
|
|
2717 | 2673 |
dontOccur($doc, "./otherEntity", "otherEntity"); |
2718 | 2674 |
dontOccur($doc, "./references", "references"); |
2719 | 2675 |
|
... | ... | |
2840 | 2796 |
|
2841 | 2797 |
$$templateVars{'function'} = "deleted"; |
2842 | 2798 |
$$templateVars{'section'} = "Deletion Status"; |
2843 |
$template->process( $responseTemplate, $templateVars);
|
|
2799 |
$template->process( $templates->{'response'}, $templateVars);
|
|
2844 | 2800 |
} |
2845 | 2801 |
} |
2846 | 2802 |
|
... | ... | |
2862 | 2818 |
my $returnVal = $metacat->login($username,$password); |
2863 | 2819 |
debug("Registry: Login was $returnVal for login attempt to $metacatUrl, with $username"); |
2864 | 2820 |
if($returnVal > 0){ |
2865 |
# valid username and passwd
|
|
2866 |
# create a new session and store username and passswd
|
|
2867 |
$session = new CGI::Session();
|
|
2821 |
# valid username and passwd
|
|
2822 |
# create a new session and store username and passswd
|
|
2823 |
$session = new CGI::Session();
|
|
2868 | 2824 |
|
2869 |
$session->param('username', $username);
|
|
2870 |
$session->param('password', $password);
|
|
2871 |
|
|
2872 |
if($returnVal == 2 || $returnVal == 4){
|
|
2873 |
# is a moderator. store this information in the session
|
|
2874 |
$session->param('moderator', 'true');
|
|
2875 |
}
|
|
2825 |
$session->param('username', $username);
|
|
2826 |
$session->param('password', $password);
|
|
2827 |
|
|
2828 |
if($returnVal == 2 || $returnVal == 4){
|
|
2829 |
# is a moderator. store this information in the session
|
|
2830 |
$session->param('moderator', 'true');
|
|
2831 |
}
|
|
2876 | 2832 |
|
2877 |
# send redirect to metacat and action = login
|
|
2878 |
my $html = "<html><head>";
|
|
2879 |
$html .= "</head><body onload=\"document.loginForm.submit()\">";
|
|
2880 |
$html .= "<form name=\"loginForm\" method=\"post\" action=\"@systemidserver@@servlet-path@\">";
|
|
2881 |
$html .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
|
|
2882 |
$html .= "<input type=\"hidden\" name=\"username\" value=\"".$FORM::username."\" />";
|
|
2883 |
$html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />";
|
|
2884 |
$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
|
|
2885 |
$html .= "</form></body></html>";
|
|
2886 |
print $session->header();
|
|
2887 |
print $html;
|
|
2888 |
} else {
|
|
2889 |
# send back the error template with error message as wrong username password
|
|
2890 |
# push(@errorMessages, $metacat->getMessage());
|
|
2891 |
print "Content-type: text/html\n\n";
|
|
2892 |
push(@errorMessages, "Failed during login.\n");
|
|
2893 |
$$templateVars{'status'} = 'login_failure';
|
|
2894 |
$$templateVars{'errorMessages'} = \@errorMessages;
|
|
2895 |
$$templateVars{'cfg'} = $FORM::cfg;
|
|
2896 |
$$templateVars{'section'} = "Login Status";
|
|
2897 |
$template->process( $responseTemplate, $templateVars);
|
|
2898 |
}
|
|
2833 |
# send redirect to metacat and action = login
|
|
2834 |
my $html = "<html><head>";
|
|
2835 |
$html .= "</head><body onload=\"document.loginForm.submit()\">";
|
|
2836 |
$html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
|
|
2837 |
$html .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
|
|
2838 |
$html .= "<input type=\"hidden\" name=\"username\" value=\"".$FORM::username."\" />";
|
|
2839 |
$html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />";
|
|
2840 |
$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
|
|
2841 |
$html .= "</form></body></html>";
|
|
2842 |
print $session->header();
|
|
2843 |
print $html;
|
|
2844 |
} else {
|
|
2845 |
# send back the error template with error message as wrong username password
|
|
2846 |
# push(@errorMessages, $metacat->getMessage());
|
|
2847 |
print "Content-type: text/html\n\n";
|
|
2848 |
push(@errorMessages, "Failed during login.\n");
|
|
2849 |
$$templateVars{'status'} = 'login_failure';
|
|
2850 |
$$templateVars{'errorMessages'} = \@errorMessages;
|
|
2851 |
$$templateVars{'cfg'} = $FORM::cfg;
|
|
2852 |
$$templateVars{'section'} = "Login Status";
|
|
2853 |
$template->process( $templates->{'response'}, $templateVars);
|
|
2854 |
}
|
|
2899 | 2855 |
|
2900 |
exit(0);
|
|
2856 |
exit(0); |
|
2901 | 2857 |
} else { |
2902 | 2858 |
# session found ... redirect to index page |
2903 |
my $url = "@systemidserver@@style-skins-path@/".$FORM::cfg."/index.html";
|
|
2904 |
redirect($url);
|
|
2905 |
exit(0);
|
|
2859 |
my $url = "$configDir/$FORM::cfg/index.html";
|
|
2860 |
redirect($url);
|
|
2861 |
exit(0);
|
|
2906 | 2862 |
} |
2907 | 2863 |
} |
2908 | 2864 |
|
... | ... | |
2918 | 2874 |
my $session = CGI::Session->load(); |
2919 | 2875 |
if ( $session->is_empty || $session->is_expired) { |
2920 | 2876 |
# no session found ... send back to index.html page ... |
2921 |
debug("Session empty or not found");
|
|
2922 |
my $url = "@systemidserver@@style-skins-path@/".$FORM::cfg."/index.html";
|
|
2923 |
redirect($url);
|
|
2877 |
debug("Session empty or not found");
|
|
2878 |
my $url = "$configDir/$FORM::cfg/index.html";
|
|
2879 |
redirect($url);
|
|
2924 | 2880 |
# should logout request be sent to metacat??? |
2925 |
} else {
|
|
2926 |
# get the user name and delete the session
|
|
2927 |
debug("Session found");
|
|
2928 |
my $uname = $session->param("username");
|
|
2929 |
$session->delete();
|
|
2930 |
# send redirect to metacat and action = login
|
|
2931 |
my $html = "<html><head>";
|
|
2932 |
$html .= "</head><body onload=\"document.loginForm.submit()\">";
|
|
2933 |
$html .= "<form name=\"loginForm\" method=\"post\" action=\"@systemidserver@@servlet-path@\">";
|
|
2934 |
$html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
|
|
2935 |
$html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />";
|
|
2936 |
$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
|
|
2937 |
$html .= "</form></body></html>";
|
|
2938 |
print($html);
|
|
2939 |
}
|
|
2881 |
} else {
|
|
2882 |
# get the user name and delete the session
|
|
2883 |
debug("Session found");
|
|
2884 |
my $uname = $session->param("username");
|
|
2885 |
$session->delete();
|
|
2886 |
# send redirect to metacat and action = login
|
|
2887 |
my $html = "<html><head>";
|
|
2888 |
$html .= "</head><body onload=\"document.loginForm.submit()\">";
|
|
2889 |
$html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
|
|
2890 |
$html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
|
|
2891 |
$html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />";
|
|
2892 |
$html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$FORM::cfg."\" />";
|
|
2893 |
$html .= "</form></body></html>";
|
|
2894 |
print($html);
|
|
2895 |
}
|
|
2940 | 2896 |
} |
2941 | 2897 |
|
2942 | 2898 |
################################################################################ |
... | ... | |
2976 | 2932 |
my $session = CGI::Session->load(); |
2977 | 2933 |
if ( $session->is_empty || $session->is_expired) { |
2978 | 2934 |
# no session found ... send back to index.html page ... |
2979 |
processResultTemplate($stage, 'failure', "Moderator is not logged in.\n");
|
|
2980 |
$returnValue = -1;
|
|
2935 |
processResultTemplate($stage, 'failure', "Moderator is not logged in.\n");
|
|
2936 |
$returnValue = -1;
|
|
2981 | 2937 |
} |
2982 | 2938 |
|
2983 | 2939 |
# check if logged in user is moderator |
2984 | 2940 |
my $moderator = $session->param("moderator"); |
2985 | 2941 |
if ( $moderator ne 'true') { |
2986 | 2942 |
# no session found ... send back to index.html page ... |
2987 |
debug("Logged in user is not moderator");
|
|
2988 |
processResultTemplate($stage, 'failure', "Logged in user is not moderator.\n");
|
|
2989 |
$returnValue = -1;
|
|
2943 |
debug("Logged in user is not moderator");
|
|
2944 |
processResultTemplate($stage, 'failure', "Logged in user is not moderator.\n");
|
|
2945 |
$returnValue = -1;
|
|
2990 | 2946 |
} |
2991 | 2947 |
|
2992 | 2948 |
if($returnValue eq 1){ |
2993 |
$modUsername = $session->param("username");
|
|
2994 |
$modPassword = $session->param("password");
|
|
2949 |
$modUsername = $session->param("username");
|
|
2950 |
$modPassword = $session->param("password");
|
|
2995 | 2951 |
} |
2996 | 2952 |
|
2997 | 2953 |
return $returnValue; |
2998 | 2954 |
} |
2999 | 2955 |
|
3000 | 2956 |
sub handleRead { |
3001 |
my $docid = $FORM::docid; |
|
3002 |
my $errorMessage; |
|
3003 |
|
|
3004 |
print "Content-type: text/html\n\n"; |
|
3005 |
|
|
3006 |
# Check if the session exists |
|
3007 |
my $session = CGI::Session->load(); |
|
3008 |
if ( $session->is_empty || $session->is_expired) { |
|
3009 |
# no session found ... send back the regular read page ... |
|
3010 |
my $url = "@systemidserver@@style-skins-path@/".$FORM::cfg."/index.html"; |
|
3011 |
redirect($url); |
|
3012 |
} else { |
|
3013 |
my $htmldoc = ""; |
|
3014 |
$htmldoc .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">"; |
|
3015 |
$htmldoc .= "<html><head><title>Dataset Description: ".$docid."</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>"; |
|
3016 |
$htmldoc .= "<frameset rows=\"150,*\" cols=\"*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">"; |
|
3017 |
$htmldoc .= "<frame src=\"@systemidserver@@style-skins-path@/".$FORM::cfg."/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>"; |
|
3018 |
$htmldoc .= "<frameset cols=\"200,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">"; |
|
3019 |
$htmldoc .= "<body></body><frame src=\"@cgi-prefix@/register-dataset.cgi?cfg=".$FORM::cfg."&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>"; |
|
3020 |
$htmldoc .= "<frame src=\"@systemidserver@@servlet-path@?action=read&qformat=".$FORM::cfg."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">"; |
|
3021 |
$htmldoc .= "</frameset></frameset></html>"; |
|
2957 |
my $docid = $FORM::docid; |
|
2958 |
my $errorMessage; |
|
3022 | 2959 |
|
3023 |
print $htmldoc; |
|
2960 |
print "Content-type: text/html\n\n"; |
|
2961 |
|
|
2962 |
# Check if the session exists |
|
2963 |
my $session = CGI::Session->load(); |
|
2964 |
if ( $session->is_empty || $session->is_expired) { |
|
2965 |
# no session found ... send back the regular read page ... |
|
2966 |
my $url = "$configDir/$FORM::cfg/index.html"; |
|
2967 |
redirect($url); |
|
2968 |
} else { |
|
2969 |
my $htmldoc = ""; |
|
2970 |
$htmldoc .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">"; |
|
2971 |
$htmldoc .= "<html><head><title>Dataset Description: ".$docid."</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>"; |
|
2972 |
$htmldoc .= "<frameset rows=\"150,*\" cols=\"*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">"; |
|
2973 |
$htmldoc .= "<frame src=\"$configDir/$FORM::cfg/header.jsp\" marginwidth=\"40\" name=\"topFrame\" scrolling=\"NO\" noresize>"; |
|
2974 |
$htmldoc .= "<frameset cols=\"200,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">"; |
|
2975 |
$htmldoc .= "<body></body><frame src=\"$cgiUrl?cfg=$FORM::cfg&stage=review_frame&docid=".$docid."\" name=\"rightFrame\" scrolling=\"NO\" noresize></frame>"; |
|
2976 |
$htmldoc .= "<frame src=\"". $metacatUrl ."?action=read&qformat=".$FORM::cfg."&docid=".$docid."&insertTemplate=0\" name=\"mainFrame\">"; |
|
2977 |
$htmldoc .= "</frameset></frameset></html>"; |
|
2978 |
|
|
2979 |
print $htmldoc; |
|
3024 | 2980 |
} |
3025 | 2981 |
} |
3026 | 2982 |
|
... | ... | |
3038 | 2994 |
if ( $moderator eq 'true') { |
3039 | 2995 |
$$templateVars{'isModerator'} = "true"; |
3040 | 2996 |
} |
3041 |
$template->process( $getReviewsTemplate, $templateVars);
|
|
2997 |
$template->process( $templates->{'getReviews'}, $templateVars);
|
|
3042 | 2998 |
} |
3043 | 2999 |
|
3044 | 3000 |
sub getReviewHistoryHTML { |
... | ... | |
3596 | 3552 |
# |
3597 | 3553 |
################################################################################ |
3598 | 3554 |
sub mod_sendNotification { |
3599 |
my $title = shift;
|
|
3600 |
my $contactEmailAddress = shift;
|
|
3601 |
my $contactName = shift;
|
|
3602 |
my $subject = shift;
|
|
3555 |
my $title = shift;
|
|
3556 |
my $contactEmailAddress = shift;
|
|
3557 |
my $contactName = shift;
|
|
3558 |
my $subject = shift;
|
|
3603 | 3559 |
|
3604 |
debug($subject);
|
|
3560 |
debug($subject);
|
|
3605 | 3561 |
# send notification to the user and the moderator |
3606 |
my $templateVars = { 'stage' => $FORM::stage }; |
|
3607 |
$$templateVars{'recipient'} = $recipient; |
|
3608 |
$$templateVars{'sender'} = $sender; |
|
3609 |
# form doesn't handle edit without revision; append |
|
3610 |
#my ($x, $y, $z) = split(/\./, $FORM::docid); |
|
3611 |
#my $docidWithoutRev = $x.".".$y; |
|
3612 |
#$$templateVars{'docid'} = $docidWithoutRev; |
|
3613 |
$$templateVars{'docid'} = $FORM::docid; |
|
3614 |
$$templateVars{'comment'} = $FORM::review; |
|
3615 |
$$templateVars{'contactName'} = $contactName; |
|
3616 |
$$templateVars{'dpTitle'} = $title; |
|
3562 |
my $templateVars = { 'stage' => $FORM::stage }; |
|
3563 |
my ($x, $y, $z) = split(/\./, $FORM::docid); |
|
3564 |
my $docidWithoutRev = $x.".".$y; |
|
3565 |
$$templateVars{'docid'} = $docidWithoutRev; |
|
3566 |
$$templateVars{'comment'} = $FORM::review; |
|
3567 |
$$templateVars{'contactName'} = $contactName; |
|
3568 |
$$templateVars{'dpTitle'} = $title; |
|
3617 | 3569 |
|
3618 |
$$templateVars{'recipient_status'} = 'moderator'; |
|
3619 |
sendNotification($mailhost, $sender, $recipient, $subject, |
|
3620 |
$modEmailNotificationTemplate, $templateVars); |
|
3621 |
if($contactEmailAddress ne ''){ |
|
3622 |
# send notification to contact email address specified in cfg |
|
3623 |
$$templateVars{'recipient'} = $contactEmailAddress; |
|
3624 |
$$templateVars{'recipient_status'} = 'user'; |
|
3625 |
sendNotification($mailhost, $sender, $contactEmailAddress, |
|
3626 |
$subject, $modEmailNotificationTemplate, $templateVars); |
|
3627 |
} |
|
3570 |
$$templateVars{'recipient_status'} = 'moderator'; |
|
3571 |
sendNotification($email->{'sender'}, $email->{'recipient'}, $subject, |
|
3572 |
$templates->{'modEmailNotification'}, $templateVars); |
|
3573 |
if($contactEmailAddress ne ''){ |
|
3574 |
# send notification to contact email address specified in cfg |
|
3575 |
$$templateVars{'recipient_status'} = 'user'; |
|
3576 |
sendNotification($email->{'sender'}, $contactEmailAddress, |
|
3577 |
$subject, $templates->{'modEmailNotification'}, $templateVars); |
|
3578 |
} |
|
3628 | 3579 |
} |
3629 | 3580 |
|
3630 | 3581 |
################################################################################ |
... | ... | |
3633 | 3584 |
# |
3634 | 3585 |
################################################################################ |
3635 | 3586 |
sub sendNotification { |
3636 |
my $mailhost = shift; |
|
3637 | 3587 |
my $sender = shift; |
3638 | 3588 |
my $recipient = shift; |
3639 | 3589 |
my $subject = shift; |
3640 | 3590 |
my $templateForm = shift; |
3641 | 3591 |
my $templateVars = shift; |
3642 | 3592 |
|
3643 |
my $smtp = Net::SMTP->new($mailhost);
|
|
3593 |
my $smtp = Net::SMTP->new($email->{'mailhost'});
|
|
3644 | 3594 |
$smtp->mail($sender); |
3645 | 3595 |
$smtp->to($recipient); |
3646 | 3596 |
|
... | ... | |
3686 | 3636 |
} |
3687 | 3637 |
} |
3688 | 3638 |
$$templateVars{'message'} = $message; |
3689 |
$template->process($modResultTemplate, $templateVars);
|
|
3639 |
$template->process($templates->{'modResult'}, $templateVars);
|
|
3690 | 3640 |
} |
3691 | 3641 |
|
3692 | 3642 |
|
... | ... | |
3697 | 3647 |
################################################################################ |
3698 | 3648 |
sub toConfirmData{ |
3699 | 3649 |
# Check if any invalid parameters |
3700 |
|
|
3650 |
|
|
3701 | 3651 |
my $invalidParams; |
3702 | 3652 |
if (! $error) { |
3703 |
$invalidParams = validateParameters(0);
|
|
3704 |
if (scalar(@$invalidParams)) {
|
|
3705 |
$$templateVars{'status'} = 'failure';
|
|
3706 |
$$templateVars{'invalidParams'} = $invalidParams;
|
|
3707 |
$error = 1;
|
|
3708 |
}
|
|
3653 |
$invalidParams = validateParameters(0);
|
|
3654 |
if (scalar(@$invalidParams)) {
|
|
3655 |
$$templateVars{'status'} = 'failure';
|
|
3656 |
$$templateVars{'invalidParams'} = $invalidParams;
|
|
3657 |
$error = 1;
|
|
3658 |
}
|
|
3709 | 3659 |
} |
3710 | 3660 |
|
3711 | 3661 |
$$templateVars{'providerGivenName'} = normalizeCD($FORM::providerGivenName); |
... | ... | |
3809 | 3759 |
$$templateVars{"kwType".$keyCount} = normalizeCD($keywordTypeArray->[$i]); |
3810 | 3760 |
$$templateVars{"kwTh".$keyCount} = normalizeCD($keywordThArray->[$i]); |
3811 | 3761 |
$keyCount++; |
3812 |
}
|
|
3813 |
} |
|
3762 |
}
|
|
3763 |
}
|
|
3814 | 3764 |
$$templateVars{'keyCount'} = $keyCount; |
3815 |
|
|
3765 |
|
|
3816 | 3766 |
$$templateVars{'addComments'} = normalizeCD($FORM::addComments); |
3817 | 3767 |
$$templateVars{'useConstraints'} = $FORM::useConstraints; |
3818 | 3768 |
if($FORM::useConstraints eq "other"){ |
... | ... | |
3852 | 3802 |
my $taxonNameArray = \@FORM::taxonName; |
3853 | 3803 |
my $taxonCount = 1; |
3854 | 3804 |
|
3855 |
for (my $i = 0; $i <= $#$taxonNameArray; $i++) {
|
|
3805 |
for(my $i = 0; $i <= $#$taxonNameArray; $i++){
|
|
3856 | 3806 |
if (hasContent($taxonRankArray->[$i]) && hasContent($taxonNameArray->[$i])) { |
3857 | 3807 |
debug("Registry processing keyword: trv = ".$taxonRankArray->[$i] |
3858 | 3808 |
." trn = ".$taxonNameArray->[$i]); |
3859 | 3809 |
$$templateVars{"taxonRankName".$taxonCount} = normalizeCD($taxonRankArray->[$i]); |
3860 | 3810 |
$$templateVars{"taxonRankValue".$taxonCount} = normalizeCD($taxonNameArray->[$i]); |
3861 | 3811 |
$taxonCount++; |
3862 |
}
|
|
3812 |
}
|
|
3863 | 3813 |
} |
3864 | 3814 |
|
3865 | 3815 |
$$templateVars{'taxaCount'} = $taxonCount-1; |
... | ... | |
3877 | 3827 |
$$templateVars{"uploadname_$upNum"} = param("uploadname_$upNum"); |
3878 | 3828 |
$$templateVars{"uploadtype_$upNum"} = param("uploadtype_$upNum"); |
3879 | 3829 |
$$templateVars{"uploadperm_$upNum"} = param("uploadperm_$upNum"); |
3830 |
|
|
3880 | 3831 |
} |
3881 | 3832 |
} |
3882 | 3833 |
} |
... | ... | |
3895 | 3846 |
$$templateVars{"upload_$totalFileNum"} = $fileInfo->{'fileHash'}; |
3896 | 3847 |
$$templateVars{"uploadname_$totalFileNum"} = $fileInfo->{'fileName'}; |
3897 | 3848 |
$$templateVars{"uploadtype_$totalFileNum"} = $fileInfo->{'contentType'}; |
3898 |
$$templateVars{"uploadperm_$totalFileNum"} = param("uploadperm_$totalFileNum"); |
|
3899 | 3849 |
$uploadCount++; |
3900 | 3850 |
} |
3901 | 3851 |
} |
... | ... | |
3913 | 3863 |
$$templateVars{'origStateContact'} = $FORM::origState; |
3914 | 3864 |
|
3915 | 3865 |
$$templateVars{'showSiteList'} = $FORM::showSiteList; |
3916 |
$$templateVars{'lsite'} = $FORM::lsite; |
|
3917 |
$$templateVars{'usite'} = $FORM::usite; |
|
3866 |
$$templateVars{'site'} = $FORM::site; |
|
3918 | 3867 |
$$templateVars{'showWgList'} = $FORM::showWgList; |
3919 | 3868 |
$$templateVars{'showOrganization'} = $FORM::showOrganization; |
3920 | 3869 |
$$templateVars{'hasKeyword'} = $FORM::hasKeyword; |
... | ... | |
3938 | 3887 |
if (! $error) { |
3939 | 3888 |
# If no errors, then print out data in confirm Data template |
3940 | 3889 |
$$templateVars{'section'} = "Confirm Data"; |
3941 |
$template->process( $confirmDataTemplate, $templateVars);
|
|
3890 |
$template->process( $templates->{'confirmData'}, $templateVars);
|
|
3942 | 3891 |
|
3943 | 3892 |
} else{ |
3944 | 3893 |
# Errors from validation function. print the errors out using the response template |
... | ... | |
3950 | 3899 |
# Create our HTML response and send it back |
3951 | 3900 |
$$templateVars{'function'} = "submitted"; |
3952 | 3901 |
$$templateVars{'section'} = "Submission Status"; |
3953 |
$template->process( $responseTemplate, $templateVars);
|
|
3902 |
$template->process( $templates->{'response'}, $templateVars);
|
|
3954 | 3903 |
} |
3955 | 3904 |
} |
3956 | 3905 |
|
... | ... | |
3972 | 3921 |
$$templateVars{'docid'} = $FORM::docid; |
3973 | 3922 |
|
3974 | 3923 |
$$templateVars{'form'} = 're_entry'; |
3975 |
$template->process( $entryFormTemplate, $templateVars);
|
|
3924 |
$template->process( $templates->{'entry'}, $templateVars);
|
|
3976 | 3925 |
} |
3977 | 3926 |
|
3978 | 3927 |
|
... | ... | |
3986 | 3935 |
$$templateVars{'providerSurName'} = $FORM::providerSurName; |
3987 | 3936 |
$$templateVars{'site'} = $FORM::site; |
3988 | 3937 |
if ($FORM::cfg eq "nceas") { |
3989 |
my $projects = getProjectList(); |
|
3938 |
my $projects = getProjectList($database);
|
|
3990 | 3939 |
$$templateVars{'projects'} = $projects; |
3991 | 3940 |
$$templateVars{'wg'} = \@FORM::wg; |
3992 | 3941 |
} |
... | ... | |
4116 | 4065 |
$$templateVars{'samplingDescription'} = $FORM::samplingDescription; |
4117 | 4066 |
|
4118 | 4067 |
$$templateVars{'showSiteList'} = $FORM::showSiteList; |
4119 |
$$templateVars{'lsite'} = $FORM::lsite; |
|
4120 |
$$templateVars{'usite'} = $FORM::usite; |
|
4068 |
$$templateVars{'site'} = $FORM::site; |
|
4121 | 4069 |
$$templateVars{'showWgList'} = $FORM::showWgList; |
4122 | 4070 |
$$templateVars{'showOrganization'} = $FORM::showOrganization; |
4123 | 4071 |
$$templateVars{'hasKeyword'} = $FORM::hasKeyword; |
... | ... | |
4289 | 4237 |
sub debug { |
4290 | 4238 |
my $msg = shift; |
4291 | 4239 |
|
4292 |
if ($debug) { |
|
4240 |
if ($debug_enabled) {
|
|
4293 | 4241 |
print STDERR "$msg\n"; |
4294 | 4242 |
} |
4295 | 4243 |
else { |
... | ... | |
4306 | 4254 |
# |
4307 | 4255 |
################################################################################ |
4308 | 4256 |
sub getProjectList { |
4257 |
my $database = shift; |
|
4309 | 4258 |
my $projects; |
4310 | 4259 |
|
4311 | 4260 |
# Check for availability AdminDB.pm, for accessing NCEAS projects |
Also available in: Unified diff
Merge 1.9 changes into Head