Project

General

Profile

« Previous | Next » 

Revision 2403

Added by sgarg over 19 years ago

Changed the code which handles Associated Party, Keywords and Taxonomic Information.

View differences:

register-dataset.cgi
1082 1082
                    if (hasContent(param("kwType" . $tmp1)) &&
1083 1083
                       (param("kwType" . $tmp1) !~ "none") ) {
1084 1084
                         $doc .= "keywordType=\"";
1085
                         $doc .= param("kwType" . $tmp1);
1085
                         $doc .= lc(param("kwType" . $tmp1));
1086 1086
                         $doc .= "\"";
1087 1087
                    }
1088 1088
                    $doc .= ">";
......
1736 1736
  #      errMoreThanN("Additional Originators");
1737 1737
 #   } 
1738 1738

  
1739
    $$templateVars{'aoCount'} = $aoCount-1;
1739
    $$templateVars{'aoCount'} = $aoCount;
1740 1740
    
1741 1741
    dontOccur($doc, "./pubDate", "pubDate");
1742 1742
    dontOccur($doc, "./language", "language");
......
1754 1754

  
1755 1755
    $results = $doc->findnodes('//dataset/keywordSet');
1756 1756

  
1757
    my $count = 0;
1757
    my $count = 1;
1758 1758
    foreach $node ($results->get_nodelist) {
1759 1759
	$tempResult = $node->findnodes('./keyword');
1760 1760
	if ($tempResult->size() > 1) {
1761 1761
	    errMoreThanOne("keyword");
1762 1762
	} else {
1763
	    $count++;
1764 1763
	    foreach $tempNode ($tempResult->get_nodelist) {
1765 1764
		$$templateVars{"keyword$count"} = $tempNode->textContent();
1766 1765
		if ($tempNode->hasAttributes()) {
1767 1766
		    my @attlist = $tempNode->attributes();
1768
		    $$templateVars{"kwType$count"} = $attlist[0]->value;
1767
                    my $tmp = $attlist[0]->value;  #convert the first letter to upper case
1768
		    $tmp =~ s/\b(\w)/\U$1/g;
1769
		    $$templateVars{"kwType$count"} = $tmp;
1769 1770
		}  
1770 1771
	    }
1771 1772
	}
1772 1773
	$$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
1774
        $count++;
1773 1775
    }
1774 1776
    $$templateVars{'keyCount'} = $count;
1775 1777
    if($count > 0 ){
......
1834 1836
        errMoreThanOne("distribution/online");
1835 1837
    } else {
1836 1838
        foreach my $tempNode ($results->get_nodelist) {
1837
            $$templateVars{'dataMedium'} = findValue($tempNode, "mediumName");
1839
            my $temp = findValue($tempNode, "mediumName");
1840
            if(substr($temp, 0, 5) eq "other"){
1841
                $$templateVars{'dataMedium'} = substr($temp, 0, 5);
1842
                $$templateVars{'dataMediumOther'} = substr($temp, 5);
1843
            } else {
1844
                $$templateVars{'dataMedium'} = $temp;
1845
            }
1838 1846
            dontOccur($tempNode, "./mediumDensity", "/distribution/offline/mediumDensity");
1839 1847
            dontOccur($tempNode, "./mediumDensityUnits", "/distribution/offline/mediumDensityUnits");
1840 1848
            dontOccur($tempNode, "./mediumVolume", "/distribution/offline/mediumVolume");
......
2358 2366
        $$templateVars{'origEmailContact'} = normalizeCD($FORM::origEmailContact);    
2359 2367
    }
2360 2368

  
2361
    $$templateVars{'aoCount'} = $FORM::aoCount;
2362
    foreach my $origName (param()) {
2363
	if ($origName =~ /origNamefirst/) {
2364
	    my $origNameIndex = $origName;
2365
	    $origNameIndex =~ s/origNamefirst//; # get the index of the parameter 0, ..., 10
2366
	    my $origNamelast = "origNamelast".$origNameIndex;
2367
	    my $origRole = "origRole".$origNameIndex;
2368
	    if ( $origNameIndex =~ /[0-9]/  && $origNameIndex > 0){
2369
		if (hasContent(param($origName)) && hasContent(param($origNamelast)) && hasContent(param($origRole))) {
2370
		    debug("Registry processing keyword: $origName = ".param($origName)." $origNamelast = ".param($origNamelast)." $origRole = ".param($origRole));
2371
		    $$templateVars{$origName} = normalizeCD(param($origName));
2372
		    $$templateVars{$origNamelast} = normalizeCD(param($origNamelast));
2373
		    $$templateVars{$origRole} = normalizeCD(param($origRole));
2374
		}
2375
	    }
2376
	}
2369
    my $aoFNArray = \@FORM::aoFirstName;
2370
    my $aoLNArray = \@FORM::aoLastName;
2371
    my $aoRoleArray = \@FORM::aoRole;
2372
    my $aoCount = 1;
2373

  
2374
    for(my $i = 0; $i <= $#$aoRoleArray; $i++){
2375
        if (hasContent($aoFNArray->[$i]) && hasContent($aoLNArray->[$i])) {
2376
            debug("Registry processing Associated Party: origName = ".$aoFNArray->[$i]
2377
                  ." origNamelast = ".$aoLNArray->[$i]." origRole = "
2378
                  .$aoRoleArray->[$i]);
2379
            $$templateVars{"origNamefirst".$aoCount} = normalizeCD($aoFNArray->[$i]);
2380
            $$templateVars{"origNamelast".$aoCount} = normalizeCD($aoLNArray->[$i]);
2381
            $$templateVars{"origRole".$aoCount} = normalizeCD($aoRoleArray->[$i]);
2382
            $aoCount++;
2383
	}    
2377 2384
    }
2378 2385

  
2386
    $$templateVars{'aoCount'} = $aoCount;
2379 2387
    $$templateVars{'abstract'} = normalizeCD($FORM::abstract);
2380
    $$templateVars{'keyCount'} = $FORM::keyCount;
2381
    foreach my $kyd (param()) {
2382
	if ($kyd =~ /keyword/) {
2383
	    my $keyIndex = $kyd;
2384
	    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
2385
	    my $keyType = "kwType".$keyIndex;
2386
	    my $keyTh = "kwTh".$keyIndex;
2387
	    if ( $keyIndex =~ /[0-9]/ ){
2388
		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
2389
		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
2390
		    $$templateVars{$kyd} = normalizeCD(param($kyd));
2391
		    $$templateVars{$keyType} = param($keyType);
2392
		    $$templateVars{$keyTh} = param($keyTh);
2393
		}
2394
	    }
2395
	}
2396
    }
2388
   
2389
   
2390
    my $keywordArray = \@FORM::keyword;
2391
    my $keywordTypeArray = \@FORM::keywordType;
2392
    my $keywordThArray = \@FORM::keywordTh;
2393
    my $keyCount = 1;
2394
   
2395
    for(my $i = 0; $i <= $#$keywordArray; $i++){
2396
        if (hasContent($keywordArray->[$i])) {
2397
            debug("Registry processing keyword: keyword = ".$keywordArray->[$i]."
2398
                  keywordType = ".$keywordTypeArray->[$i]."
2399
                  keywordTh = ".$keywordThArray->[$i]);
2400
            $$templateVars{"keyword".$keyCount} = normalizeCD($keywordArray->[$i]);
2401
            $$templateVars{"kwType".$keyCount} = normalizeCD($keywordTypeArray->[$i]);
2402
            $$templateVars{"kwTh".$keyCount} = normalizeCD($keywordThArray->[$i]);
2403
            $keyCount++;
2404
	}    
2405
    }    
2406
    $$templateVars{'keyCount'} = $keyCount;
2407
    
2397 2408
    $$templateVars{'addComments'} = normalizeCD($FORM::addComments);
2398 2409
    $$templateVars{'useConstraints'} = $FORM::useConstraints;
2399
    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
2410
    if($FORM::useConstraints eq "other"){
2411
        $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
2412
    }
2400 2413
    $$templateVars{'url'} = $FORM::url;
2401
    if($FORM::dataMedium eq "Select type of medium here."){
2402
        $$templateVars{'dataMedium'} = "";
2403
    }else{
2404
        $$templateVars{'dataMedium'} = $FORM::dataMedium;
2405
    }    
2406
    $$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
2414
    $$templateVars{'dataMedium'} = $FORM::dataMedium;
2415
    if($FORM::dataMedium eq "other"){
2416
        $$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
2417
    }
2407 2418
    $$templateVars{'beginningYear'} = $FORM::beginningYear;
2408 2419
    $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
2409 2420
    $$templateVars{'beginningDay'} = $FORM::beginningDay;
......
2429 2440
    $$templateVars{'longSec2'} = $FORM::longSec2;
2430 2441
    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
2431 2442

  
2432
    $$templateVars{'taxaCount'} = $FORM::taxaCount;
2433
    foreach my $trn (param()) {
2434
        if ($trn =~ /taxonRankName/) {
2435
            my $taxIndex = $trn;
2436
            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
2437
            my $trv = "taxonRankValue".$taxIndex;
2438
            if ( $taxIndex =~ /[0-9]/ ){
2439
                if (hasContent(param($trn)) && hasContent(param($trv))) {
2440
                    debug("Registry processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
2441
                    $$templateVars{$trn} = normalizeCD(param($trn));
2442
                    $$templateVars{$trv} = normalizeCD(param($trv));
2443
                }
2444
            }
2445
        }
2443
    my $taxonRankArray = \@FORM::taxonRank;
2444
    my $taxonNameArray = \@FORM::taxonName;
2445
    my $taxonCount = 1;
2446

  
2447
    for(my $i = 0; $i <= $#$taxonNameArray; $i++){
2448
        if (hasContent($taxonRankArray->[$i]) && hasContent($taxonNameArray->[$i])) {
2449
            debug("Registry processing keyword: trv = ".$taxonRankArray->[$i]
2450
                    ." trn = ".$taxonNameArray->[$i]);
2451
            $$templateVars{"taxonRankName".$taxonCount} = normalizeCD($taxonNameArray->[$i]);
2452
            $$templateVars{"taxonRankValue".$taxonCount} = normalizeCD($taxonRankArray->[$i]);
2453
            $taxonCount++;
2454
	}    
2446 2455
    }
2456

  
2457
    $$templateVars{'taxaCount'} = $taxonCount-1;
2447 2458
    $$templateVars{'taxaAuth'} = normalizeCD($FORM::taxaAuth);
2448 2459

  
2449 2460
    $$templateVars{'methodTitle'} = normalizeCD($FORM::methodTitle);
2450

  
2461
 
2451 2462
    my @tempMethodPara;
2452 2463
    for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
2453 2464
	$tempMethodPara[$i] = normalizeCD($FORM::methodPara[$i]);
......
2590 2601
	    if ( $keyIndex =~ /[0-9]/ ){
2591 2602
		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
2592 2603
		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
2593
		    $$templateVars{$kyd} = param($kyd);
2594
		    $$templateVars{$keyType} = param($keyType);
2604
		    $$templateVars{$kyd} = param($kyd); 
2605
                    my $tmp = param($keyType);  #convert the first letter to upper case
2606
		    $tmp =~ s/\b(\w)/\U$1/g;
2607
                    $$templateVars{$keyType} = $tmp;
2595 2608
		    $$templateVars{$keyTh} = param($keyTh);
2596 2609
		}
2597 2610
	    }

Also available in: Unified diff