Project

General

Profile

« Previous | Next » 

Revision 2136

Added by sgarg over 20 years ago

Removed repetition of code. Also fixed the link to the modified file submitted from responseTemplate

View differences:

src/perl/register-dataset.cgi
372 372
        if (scalar(@errorMessages)) {
373 373
            debug("Registry: ErrorMessages defined in modify.");
374 374

  
375
	    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
376
	    $$templateVars{'providerSurName'} = $FORM::providerSurName;
377
	    $$templateVars{'site'} = $FORM::site;
378
	    if ($FORM::cfg eq "nceas") {
379
		my $projects = getProjectList();
380
		$$templateVars{'projects'} = $projects;
381
		$$templateVars{'wg'} = \@FORM::wg;
382
	    }
383
	    $$templateVars{'identifier'} = $FORM::identifier;
384
	    $$templateVars{'title'} = $FORM::title;
385
	    $$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
386
	    $$templateVars{'origNamelast0'} = $FORM::origNamelast0;
387
	    $$templateVars{'origNameOrg'} = $FORM::origNameOrg;
388
	    #   $$templateVars{'origRole0'} = $FORM::origRole0;
389
	    $$templateVars{'origDelivery'} = $FORM::origDelivery;
390
	    $$templateVars{'origCity'} = $FORM::origCity;
391
	    $$templateVars{'origState'} = $FORM::origState;
392
	    $$templateVars{'origStateOther'} = $FORM::origStateOther;
393
	    $$templateVars{'origZIP'} = $FORM::origZIP;
394
	    $$templateVars{'origCountry'} = $FORM::origCountry;
395
	    $$templateVars{'origPhone'} = $FORM::origPhone;
396
	    $$templateVars{'origFAX'} = $FORM::origFAX;
397
	    $$templateVars{'origEmail'} = $FORM::origEmail;
398
	    if ($FORM::useSiteCoord ne "") {
399
		$$templateVars{'useOrigAddress'} = "CHECKED";
400
	    }else{
401
		$$templateVars{'useOrigAddress'} = $FORM::useOrigAddress;
402
	    }
403
	    $$templateVars{'origNamefirstContact'} = $FORM::origNamefirstContact;
404
	    $$templateVars{'origNamelastContact'} = $FORM::origNamelastContact;
405
	    $$templateVars{'origNameOrgContact'} = $FORM::origNameOrgContact;
406
	    $$templateVars{'origDeliveryContact'} = $FORM::origDeliveryContact; 
407
	    $$templateVars{'origCityContact'} = $FORM::origCityContact;
408
	    $$templateVars{'origStateContact'} = $FORM::origStateContact;
409
	    $$templateVars{'origStateOtherContact'} = $FORM::origStateOtherContact;
410
	    $$templateVars{'origZIPContact'} = $FORM::origZIPContact;
411
	    $$templateVars{'origCountryContact'} = $FORM::origCountryContact;
412
	    $$templateVars{'origPhoneContact'} = $FORM::origPhoneContact;
413
	    $$templateVars{'origFAXContact'} = $FORM::origFAXContact;
414
	    $$templateVars{'origEmailContact'} = $FORM::origEmailContact;    
415
	    $$templateVars{'origNamefirst1'} = $FORM::origNamefirst1;
416
	    $$templateVars{'origNamelast1'} = $FORM::origNamelast1;
417
	    $$templateVars{'origRole1'} = $FORM::origRole1;
418
	    $$templateVars{'origNamefirst2'} = $FORM::origNamefirst2;
419
	    $$templateVars{'origNamelast2'} = $FORM::origNamelast2;
420
	    $$templateVars{'origRole2'} = $FORM::origRole2;
421
	    $$templateVars{'origNamefirst3'} = $FORM::origNamefirst3;
422
	    $$templateVars{'origNamelast3'} = $FORM::origNamelast3;
423
	    $$templateVars{'origRole3'} = $FORM::origRole3;
424
	    $$templateVars{'origNamefirst4'} = $FORM::origNamefirst4;
425
	    $$templateVars{'origNamelast4'} = $FORM::origNamelast4;
426
	    $$templateVars{'origRole4'} = $FORM::origRole4;
427
	    $$templateVars{'origNamefirst5'} = $FORM::origNamefirst5;
428
	    $$templateVars{'origNamelast5'} = $FORM::origNamelast5;
429
	    $$templateVars{'origRole5'} = $FORM::origRole5;
430
	    $$templateVars{'origNamefirst6'} = $FORM::origNamefirst6;
431
	    $$templateVars{'origNamelast6'} = $FORM::origNamelast6;
432
	    $$templateVars{'origRole6'} = $FORM::origRole6;
433
	    $$templateVars{'origNamefirst7'} = $FORM::origNamefirst7;
434
	    $$templateVars{'origNamelast7'} = $FORM::origNamelast7;
435
	    $$templateVars{'origRole7'} = $FORM::origRole7;
436
	    $$templateVars{'origNamefirst8'} = $FORM::origNamefirst8;
437
	    $$templateVars{'origNamelast8'} = $FORM::origNamelast8;
438
	    $$templateVars{'origRole8'} = $FORM::origRole8;
439
	    $$templateVars{'origNamefirst9'} = $FORM::origNamefirst9;
440
	    $$templateVars{'origNamelast9'} = $FORM::origNamelast9;
441
	    $$templateVars{'origRole9'} = $FORM::origRole9;
442
	    $$templateVars{'origNamefirst10'} = $FORM::origNamefirst10;
443
	    $$templateVars{'origNamelast10'} = $FORM::origNamelast10;
444
	    $$templateVars{'origRole10'} = $FORM::origRole10;
445
	    $$templateVars{'abstract'} = $FORM::abstract;
446
	    $$templateVars{'keyCount'} = $FORM::keyCount;
447
	    foreach my $kyd (param()) {
448
		if ($kyd =~ /keyword/) {
449
		    my $keyIndex = $kyd;
450
		    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
451
		    my $keyType = "kwType".$keyIndex;
452
		    my $keyTh = "kwTh".$keyIndex;
453
		    if ( $keyIndex =~ /[0-9]/ ){
454
			if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
455
			    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
456
			    $$templateVars{$kyd} = param($kyd);
457
			    $$templateVars{$keyType} = param($keyType);
458
			    $$templateVars{$keyTh} = param($keyTh);
459
			}
460
		    }
461
		}
462
	    }
463
	    $$templateVars{'addComments'} = $FORM::addComments;
464
	    $$templateVars{'useConstraints'} = $FORM::useConstraints;
465
	    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
466
	    $$templateVars{'url'} = $FORM::url;
467
	    $$templateVars{'dataMedium'} = $FORM::dataMedium;
468
	    $$templateVars{'dataMediumOther'} = $FORM::dataMediumOther;
469
	    $$templateVars{'beginningYear'} = $FORM::beginningYear;
470
	    $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
471
	    $$templateVars{'beginningDay'} = $FORM::beginningDay;
472
	    $$templateVars{'endingYear'} = $FORM::endingYear;
473
	    $$templateVars{'endingMonth'} = $FORM::endingMonth;
474
	    $$templateVars{'endingDay'} = $FORM::endingDay;
475
	    $$templateVars{'geogdesc'} = $FORM::geogdesc;
476
	    if($FORM::useSiteCoord ne ""){
477
		$$templateVars{'useSiteCoord'} = "CHECKED";
478
	    }else{
479
		$$templateVars{'useSiteCoord'} = "";
480
	    }
481
	    $$templateVars{'latDeg1'} = $FORM::latDeg1;
482
	    $$templateVars{'latMin1'} = $FORM::latMin1;
483
	    $$templateVars{'latSec1'} = $FORM::latSec1;
484
	    $$templateVars{'hemisphLat1'} = $FORM::hemisphLat1;
485
	    $$templateVars{'longDeg1'} = $FORM::longDeg1;
486
	    $$templateVars{'longMin1'} = $FORM::longMin1;
487
	    $$templateVars{'longSec1'} = $FORM::longSec1;
488
	    $$templateVars{'hemisphLong1'} = $FORM::hemisphLong1;
489
	    $$templateVars{'latDeg2'} = $FORM::latDeg2;
490
	    $$templateVars{'latMin2'} = $FORM::latMin2;
491
	    $$templateVars{'latSec2'} = $FORM::latSec2;
492
	    $$templateVars{'hemisphLat2'} = $FORM::hemisphLat2;
493
	    $$templateVars{'longDeg2'} = $FORM::longDeg2;
494
	    $$templateVars{'longMin2'} = $FORM::longMin2;
495
	    $$templateVars{'longSec2'} = $FORM::longSec2;
496
	    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
497
	    $$templateVars{'taxaCount'} = $FORM::taxaCount;
498
	    foreach my $trn (param()) {
499
		if ($trn =~ /taxonRankName/) {
500
		    my $taxIndex = $trn;
501
		    $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
502
		    my $trv = "taxonRankValue".$taxIndex;
503
		    if ( $taxIndex =~ /[0-9]/ ){
504
			if (hasContent(param($trn)) && hasContent(param($trv))) {
505
			    debug("Registry processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
506
			    $$templateVars{$trn} = param($trn);
507
			    $$templateVars{$trv} = param($trv);
508
			}
509
		    }
510
		}
511
	    }
512
	    $$templateVars{'taxaAuth'} = $FORM::taxaAuth;
513
	    $$templateVars{'methodTitle'} = $FORM::methodTitle;
514
	    $$templateVars{'methodPara'} = \@FORM::methodPara;
515
	    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
516
	    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
517 375
	    $$templateVars{'docid'} = $FORM::docid;
518
	    
376
	    copyFormToTemplateVars();
519 377
            $$templateVars{'status'} = 'failure';
520 378
            $$templateVars{'errorMessages'} = \@errorMessages;
521 379
            $error = 1;
522
        }
380
        } else {
381
	    $$templateVars{'docid'} = $docid;
382
	    $$templateVars{'cfg'} = $FORM::cfg;
383
	}
523 384

  
524 385
        #if (! $error) {
525 386
            #sendNotification($docid, $mailhost, $sender, $recipient);
......
538 399

  
539 400
if (scalar(@errorMessages)) {
540 401
    debug("Registry: ErrorMessages defined.");
541
    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
542
    $$templateVars{'providerSurName'} = $FORM::providerSurName;
543
    $$templateVars{'site'} = $FORM::site;
544
    if ($FORM::cfg eq "nceas") {
545
        my $projects = getProjectList();
546
        $$templateVars{'projects'} = $projects;
547
        $$templateVars{'wg'} = \@FORM::wg;
548
    }
549
    $$templateVars{'identifier'} = $FORM::identifier;
550
    $$templateVars{'title'} = $FORM::title;
551
    $$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
552
    $$templateVars{'origNamelast0'} = $FORM::origNamelast0;
553
    $$templateVars{'origNameOrg'} = $FORM::origNameOrg;
554
 #   $$templateVars{'origRole0'} = $FORM::origRole0;
555
    $$templateVars{'origDelivery'} = $FORM::origDelivery;
556
    $$templateVars{'origCity'} = $FORM::origCity;
557
    $$templateVars{'origState'} = $FORM::origState;
558
    $$templateVars{'origStateOther'} = $FORM::origStateOther;
559
    $$templateVars{'origZIP'} = $FORM::origZIP;
560
    $$templateVars{'origCountry'} = $FORM::origCountry;
561
    $$templateVars{'origPhone'} = $FORM::origPhone;
562
    $$templateVars{'origFAX'} = $FORM::origFAX;
563
    $$templateVars{'origEmail'} = $FORM::origEmail;
564
    if ($FORM::useSiteCoord ne "") {
565
        $$templateVars{'useOrigAddress'} = "CHECKED";
566
    }else{
567
        $$templateVars{'useOrigAddress'} = $FORM::useOrigAddress;
568
    }
569
    $$templateVars{'origNamefirstContact'} = $FORM::origNamefirstContact;
570
    $$templateVars{'origNamelastContact'} = $FORM::origNamelastContact;
571
    $$templateVars{'origNameOrgContact'} = $FORM::origNameOrgContact;
572
    $$templateVars{'origDeliveryContact'} = $FORM::origDeliveryContact; 
573
    $$templateVars{'origCityContact'} = $FORM::origCityContact;
574
    $$templateVars{'origStateContact'} = $FORM::origStateContact;
575
    $$templateVars{'origStateOtherContact'} = $FORM::origStateOtherContact;
576
    $$templateVars{'origZIPContact'} = $FORM::origZIPContact;
577
    $$templateVars{'origCountryContact'} = $FORM::origCountryContact;
578
    $$templateVars{'origPhoneContact'} = $FORM::origPhoneContact;
579
    $$templateVars{'origFAXContact'} = $FORM::origFAXContact;
580
    $$templateVars{'origEmailContact'} = $FORM::origEmailContact;    
581
    $$templateVars{'origNamefirst1'} = $FORM::origNamefirst1;
582
    $$templateVars{'origNamelast1'} = $FORM::origNamelast1;
583
    $$templateVars{'origRole1'} = $FORM::origRole1;
584
    $$templateVars{'origNamefirst2'} = $FORM::origNamefirst2;
585
    $$templateVars{'origNamelast2'} = $FORM::origNamelast2;
586
    $$templateVars{'origRole2'} = $FORM::origRole2;
587
    $$templateVars{'origNamefirst3'} = $FORM::origNamefirst3;
588
    $$templateVars{'origNamelast3'} = $FORM::origNamelast3;
589
    $$templateVars{'origRole3'} = $FORM::origRole3;
590
    $$templateVars{'origNamefirst4'} = $FORM::origNamefirst4;
591
    $$templateVars{'origNamelast4'} = $FORM::origNamelast4;
592
    $$templateVars{'origRole4'} = $FORM::origRole4;
593
    $$templateVars{'origNamefirst5'} = $FORM::origNamefirst5;
594
    $$templateVars{'origNamelast5'} = $FORM::origNamelast5;
595
    $$templateVars{'origRole5'} = $FORM::origRole5;
596
    $$templateVars{'origNamefirst6'} = $FORM::origNamefirst6;
597
    $$templateVars{'origNamelast6'} = $FORM::origNamelast6;
598
    $$templateVars{'origRole6'} = $FORM::origRole6;
599
    $$templateVars{'origNamefirst7'} = $FORM::origNamefirst7;
600
    $$templateVars{'origNamelast7'} = $FORM::origNamelast7;
601
    $$templateVars{'origRole7'} = $FORM::origRole7;
602
    $$templateVars{'origNamefirst8'} = $FORM::origNamefirst8;
603
    $$templateVars{'origNamelast8'} = $FORM::origNamelast8;
604
    $$templateVars{'origRole8'} = $FORM::origRole8;
605
    $$templateVars{'origNamefirst9'} = $FORM::origNamefirst9;
606
    $$templateVars{'origNamelast9'} = $FORM::origNamelast9;
607
    $$templateVars{'origRole9'} = $FORM::origRole9;
608
    $$templateVars{'origNamefirst10'} = $FORM::origNamefirst10;
609
    $$templateVars{'origNamelast10'} = $FORM::origNamelast10;
610
    $$templateVars{'origRole10'} = $FORM::origRole10;
611
    $$templateVars{'abstract'} = $FORM::abstract;
612
    $$templateVars{'keyCount'} = $FORM::keyCount;
613
    foreach my $kyd (param()) {
614
	if ($kyd =~ /keyword/) {
615
	    my $keyIndex = $kyd;
616
	    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
617
	    my $keyType = "kwType".$keyIndex;
618
	    my $keyTh = "kwTh".$keyIndex;
619
	    if ( $keyIndex =~ /[0-9]/ ){
620
		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
621
		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
622
		    $$templateVars{$kyd} = param($kyd);
623
		    $$templateVars{$keyType} = param($keyType);
624
		    $$templateVars{$keyTh} = param($keyTh);
625
		}
626
	    }
627
	}
628
    }
629
    $$templateVars{'addComments'} = $FORM::addComments;
630
    $$templateVars{'useConstraints'} = $FORM::useConstraints;
631
    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
632
    $$templateVars{'url'} = $FORM::url;
633
    $$templateVars{'dataMedium'} = $FORM::dataMedium;
634
    $$templateVars{'dataMediumOther'} = $FORM::dataMediumOther;
635
    $$templateVars{'beginningYear'} = $FORM::beginningYear;
636
    $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
637
    $$templateVars{'beginningDay'} = $FORM::beginningDay;
638
    $$templateVars{'endingYear'} = $FORM::endingYear;
639
    $$templateVars{'endingMonth'} = $FORM::endingMonth;
640
    $$templateVars{'endingDay'} = $FORM::endingDay;
641
    $$templateVars{'geogdesc'} = $FORM::geogdesc;
642
    if($FORM::useSiteCoord ne ""){
643
    $$templateVars{'useSiteCoord'} = "CHECKED";
644
    }else{
645
    $$templateVars{'useSiteCoord'} = "";
646
    }
647
    $$templateVars{'latDeg1'} = $FORM::latDeg1;
648
    $$templateVars{'latMin1'} = $FORM::latMin1;
649
    $$templateVars{'latSec1'} = $FORM::latSec1;
650
    $$templateVars{'hemisphLat1'} = $FORM::hemisphLat1;
651
    $$templateVars{'longDeg1'} = $FORM::longDeg1;
652
    $$templateVars{'longMin1'} = $FORM::longMin1;
653
    $$templateVars{'longSec1'} = $FORM::longSec1;
654
    $$templateVars{'hemisphLong1'} = $FORM::hemisphLong1;
655
    $$templateVars{'latDeg2'} = $FORM::latDeg2;
656
    $$templateVars{'latMin2'} = $FORM::latMin2;
657
    $$templateVars{'latSec2'} = $FORM::latSec2;
658
    $$templateVars{'hemisphLat2'} = $FORM::hemisphLat2;
659
    $$templateVars{'longDeg2'} = $FORM::longDeg2;
660
    $$templateVars{'longMin2'} = $FORM::longMin2;
661
    $$templateVars{'longSec2'} = $FORM::longSec2;
662
    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
663
    $$templateVars{'taxaCount'} = $FORM::taxaCount;
664
    foreach my $trn (param()) {
665
        if ($trn =~ /taxonRankName/) {
666
            my $taxIndex = $trn;
667
            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
668
            my $trv = "taxonRankValue".$taxIndex;
669
            if ( $taxIndex =~ /[0-9]/ ){
670
                if (hasContent(param($trn)) && hasContent(param($trv))) {
671
                    debug("Registry processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
672
                    $$templateVars{$trn} = param($trn);
673
                    $$templateVars{$trv} = param($trv);
674
                }
675
            }
676
        }
677
    }
678
    $$templateVars{'taxaAuth'} = $FORM::taxaAuth;
679
    $$templateVars{'methodTitle'} = $FORM::methodTitle;
680
    $$templateVars{'methodPara'} = \@FORM::methodPara;
681
    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
682
    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
683 402
    $$templateVars{'docid'} = $FORM::docid;
684

  
403
    copyFormToTemplateVars();
685 404
    $$templateVars{'status'} = 'failure';
686 405
    $$templateVars{'errorMessages'} = \@errorMessages;
687 406
    $error = 1;
......
2703 2422

  
2704 2423
    $$templateVars{'siteList'} = \@sortedSites;
2705 2424
    $$templateVars{'section'} = "Re-Entry Form";
2425
    copyFormToTemplateVars();
2426
    $$templateVars{'docid'} = $FORM::docid;
2706 2427

  
2428
    $$templateVars{'form'} = 're_entry';
2429
    $template->process( $entryFormTemplate, $templateVars);
2430
}
2431

  
2432

  
2433
################################################################################
2434
# 
2435
# Copy form data to templateVars.....
2436
#
2437
################################################################################
2438
sub copyFormToTemplateVars{
2707 2439
    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
2708 2440
    $$templateVars{'providerSurName'} = $FORM::providerSurName;
2709 2441
    $$templateVars{'site'} = $FORM::site;
......
2792 2524
	    }
2793 2525
	}
2794 2526
    }
2795

  
2796 2527
    $$templateVars{'addComments'} = $FORM::addComments;
2797 2528
    $$templateVars{'useConstraints'} = $FORM::useConstraints;
2798 2529
    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
......
2847 2578
    $$templateVars{'methodPara'} = \@FORM::methodPara;
2848 2579
    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
2849 2580
    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
2850
    $$templateVars{'docid'} = $FORM::docid;
2851

  
2852
    $$templateVars{'form'} = 're_entry';
2853
    $template->process( $entryFormTemplate, $templateVars);
2854 2581
}
2855 2582

  
2856

  
2857 2583
################################################################################
2858 2584
# 
2859 2585
# check if there is multiple occurence of the given tag and find its value.

Also available in: Unified diff