Project

General

Profile

« Previous | Next » 

Revision 2859

Added by sgarg almost 19 years ago

Made changes so that the user is prompted to login before entering a dataset

View differences:

src/perl/register-dataset.cgi
211 211
    # Send back the login form.....
212 212
    my $session = CGI::Session->load() or die CGI::Session->errstr();
213 213

  
214
	
215
    $$templateVars{'submission'} = $FORM::submission;
214
    if($FORM::submission eq 'true'){
215
    	$$templateVars{'message'} = 'You must login to view your submissions.';
216
    }	
216 217

  
217 218
    if ( $session->is_empty ) {
218
		# no session found ... redirect to login page template
219
	# no session found ... redirect to login page template
219 220
        $template->process( $loginFormTemplate, $templateVars);
220 221
    } else {
221
		# session found ... delete the session....
222
	    $session->delete();
223
		$template->process( $loginFormTemplate, $templateVars);
222
	# session found ... delete the session....
223
	$session->delete();
224
	$template->process( $loginFormTemplate, $templateVars);
224 225
    }
225 226
	exit(0);
226 227
} elsif ($FORM::stage =~ "logout") {
......
268 269

  
269 270
}elsif ($FORM::stage =~ "modify") {
270 271
    # Modification of a file has been requested. 
271
    # Show the form will all the values filled in.
272
    my @sortedSites;
273
    foreach my $site (sort @sitelist) {
274
        push(@sortedSites, $site);
272
    # check if the user is logged in...
273
    my $session = CGI::Session->load() or die CGI::Session->errstr();
274
    if ( $session->is_empty ) {
275
        # no session found ... redirect to login page template
276
    	$$templateVars{'message'} = 'You must login to modify your dataset.';
277
        $template->process( $loginFormTemplate, $templateVars);
278
    } else {
279
    	# Show the form will all the values filled in.
280
    	my @sortedSites;
281
    	foreach my $site (sort @sitelist) {
282
        	push(@sortedSites, $site);
283
    	}
284
    	$$templateVars{'siteList'} = \@sortedSites;
285
    	$$templateVars{'section'} = "Modification Form";
286
    	$$templateVars{'docid'} = $FORM::docid;
287
    	modifyData();
275 288
    }
276
    $$templateVars{'siteList'} = \@sortedSites;
277
    $$templateVars{'section'} = "Modification Form";
278
    $$templateVars{'docid'} = $FORM::docid;
279
    modifyData();
280 289
    exit(0);
281 290

  
282 291
}elsif ($FORM::stage =~ "delete_confirm") {
......
302 311

  
303 312
}elsif ($FORM::stage !~ "confirmed") {
304 313
    # None of the stages have been reached and data is not being confirmed. 
305
    # Hence, send back entry form for entry of data.  
306
    debug("Registry: Sending form");
307
    my @sortedSites;
308
    foreach my $site (sort @sitelist) {
309
        push(@sortedSites, $site);
310
    }
311 314
    
312
    if ($FORM::cfg eq 'nceas') {
313
        my $projects = getProjectList();
314
        $$templateVars{'projects'} = $projects;
315
        $$templateVars{'wg'} = \@FORM::wg;
316
    }
315
    # check if the user is logged in...
316
    my $session = CGI::Session->load() or die CGI::Session->errstr();
317
    if ( $session->is_empty ) {
318
        # no session found ... redirect to login page template
319
    	$$templateVars{'message'} = 'You must login to register your dataset.';
320
        $template->process( $loginFormTemplate, $templateVars);
321
    } else {
317 322

  
318
    $$templateVars{'showSiteList'} = $showSiteList;
319
    $$templateVars{'lsite'} = $lsite;
320
    $$templateVars{'usite'} = $usite;
321
    $$templateVars{'showWgList'} = $showWgList;
322
    $$templateVars{'showOrganization'} = $showOrganization;
323
    $$templateVars{'hasKeyword'} = $hasKeyword;
324
    $$templateVars{'hasTemporal'} = $hasTemporal;
325
    $$templateVars{'hasSpatial'} = $hasSpatial;
326
    $$templateVars{'hasTaxonomic'} = $hasTaxonomic;
327
    $$templateVars{'hasMethod'} = $hasMethod;
328
    $$templateVars{'temporalRequired'} = $temporalRequired;
329
    $$templateVars{'spatialRequired'} = $spatialRequired;
330
    $$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired;
323
    	# Hence, send back entry form for entry of data.  
324
    	debug("Registry: Sending form");
325
    	my @sortedSites;
326
    	foreach my $site (sort @sitelist) {
327
        	push(@sortedSites, $site);
328
    	}
329
    
330
    	if ($FORM::cfg eq 'nceas') {
331
        	my $projects = getProjectList();
332
        	$$templateVars{'projects'} = $projects;
333
        	$$templateVars{'wg'} = \@FORM::wg;
334
    	}
331 335

  
332
    $$templateVars{'siteList'} = \@sortedSites;
333
    $$templateVars{'section'} = "Entry Form";
334
    $$templateVars{'docid'} = "";
335
    debug("Registry: Sending form: ready to process template");
336
    $template->process( $entryFormTemplate, $templateVars);
337
    debug("Registry: Sending form: template processed");
338
    exit(0);
336
    	$$templateVars{'showSiteList'} = $showSiteList;
337
    	$$templateVars{'lsite'} = $lsite;
338
    	$$templateVars{'usite'} = $usite;
339
    	$$templateVars{'showWgList'} = $showWgList;
340
    	$$templateVars{'showOrganization'} = $showOrganization;
341
    	$$templateVars{'hasKeyword'} = $hasKeyword;
342
    	$$templateVars{'hasTemporal'} = $hasTemporal;
343
    	$$templateVars{'hasSpatial'} = $hasSpatial;
344
    	$$templateVars{'hasTaxonomic'} = $hasTaxonomic;
345
    	$$templateVars{'hasMethod'} = $hasMethod;
346
    	$$templateVars{'temporalRequired'} = $temporalRequired;
347
    	$$templateVars{'spatialRequired'} = $spatialRequired;
348
    	$$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired;
349

  
350
    	$$templateVars{'siteList'} = \@sortedSites;
351
    	$$templateVars{'section'} = "Entry Form";
352
    	$$templateVars{'docid'} = "";
353
    	debug("Registry: Sending form: ready to process template");
354
    	$template->process( $entryFormTemplate, $templateVars);
355
    	debug("Registry: Sending form: template processed");
356
   }
357
   exit(0);
339 358
}
340 359

  
341 360
# Confirm stage has been reached. Enter the data into metacat. 

Also available in: Unified diff