Project

General

Profile

« Previous | Next » 

Revision 1984

Added by Matt Jones over 20 years ago

Added the ability to describe taxonomicCoverage to the registry. This
allows an arbitrary number of species or other taxa to be listed, and the
editing form can dynamically grow through a simple javascript approach
(also used in Methods). Need to test thoroughly, and need to test on
other browsers -- works on Mozilla and Firebird so far.

View differences:

register-dataset.cgi
1127 1127
    $doc .= "</boundingCoordinates>\n";
1128 1128
    $doc .= "</geographicCoverage>\n";
1129 1129

  
1130
    # Taxonomic coverage information
1131
    # my $foundFirstTaxKeyword = 0;
1132
    # foreach my $tmp (param()) {
1133
    #    if ($tmp =~ /keyword/) {
1134
    #        my $tmp1 = $tmp;
1135
    #        $tmp1 =~ s/keyword//; # get the index of the parameter 0, ..., 10
1136
    #        if ( $tmp1 =~ /[0-9]/ ){
1137
    #            # don't generate xml for empty keyword fields
1138
    #            if (hasContent(param($tmp))) {
1139
    #                if (hasContent(param("kwType" . $tmp1)) &&
1140
    #                   (param("kwType" . $tmp1) eq "taxonomic") ) {
1141
    #                    # Opening tags before first taxonomic. keyword.
1142
    #                    if ($foundFirstTaxKeyword == 0) {
1143
    #                        $foundFirstTaxKeyword = 1;
1144
    #                        $doc .= "<taxonomicCoverage>\n";
1145
    #                    }
1146
    #                    $doc .= "<keywtax>\n";
1147
    #                    $doc .= "<taxonkt>".param("kwTh".$tmp1)."</taxonkt>\n";
1148
    #                    $doc .= "<taxonkey>".param("keyword".$tmp1).
1149
    #                            "</taxonkey>\n";
1150
    #                    $doc .= "</keywtax>\n";
1151
    #                }
1152
    #            }
1153
    #        }
1154
    #    }
1155
    # }
1156
    # Closing tag for taxonomic coverage, if there was a tax. keyword
1157
    # if ($foundFirstTaxKeyword == 1) {
1158
    #    $doc .= "<taxoncl></taxoncl>\n";
1159
    #    $doc .= "</taxonomicCoverage>\n";
1160
    # }
1130
    # Write out the taxonomic coverage fields
1131
    my $foundFirstTaxon = 0;
1132
    foreach my $trn (param()) {
1133
        if ($trn =~ /taxonRankName/) {
1134
            my $taxIndex = $trn;
1135
            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
1136
            my $trv = "taxonRankValue".$taxIndex;
1137
            if ( $taxIndex =~ /[0-9]/ ){
1138
                if (hasContent(param($trn)) && hasContent(param($trv))) {
1139
                    if (! $foundFirstTaxon) {
1140
                        $doc .= "<taxonomicCoverage>\n";
1141
                        $foundFirstTaxon = 1;
1142
                    }
1143
                    $doc .= "<taxonomicClassification>\n";
1144
                    $doc .= "  <taxonRankName>".param($trn)."</taxonRankName>\n";
1145
                    $doc .= "  <taxonRankValue>".param($trv)."</taxonRankValue>\n";
1146
                    $doc .= "</taxonomicClassification>\n";
1147
                }
1148
            }
1149
        }
1150
    }
1151
    if ($foundFirstTaxon) {
1152
        $doc .= "</taxonomicCoverage>\n";
1153
    }
1161 1154

  
1162 1155
    $doc .= "</coverage>\n";
1163 1156

  
......
1714 1707
        errMoreThanOne("coverage");
1715 1708
    } else {
1716 1709
        foreach $node ($results->get_nodelist) {
1717
            dontOccur($node, "./temporalCoverage/rangeOfDates/beginDate/time|./temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale|./temporalCoverage/rangeOfDates/endDate/time|./temporalCoverage/rangeOfDates/endDate/alternativeTimeScale|./taxonomicCoverage|./geographicCoverage/datasetGPolygon|./geographicCoverage/boundingCoordinates/boundingAltitudes", "temporalCoverage/rangeOfDates/beginDate/time, /temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale, /temporalCoverage/rangeOfDates/endDate/time, /temporalCoverage/rangeOfDates/endDate/alternativeTimeScale, /taxonomicCoverage, /geographicCoverage/datasetGPolygon, /geographicCoverage/boundingCoordinates/boundingAltitudes");
1710
            dontOccur($node, "./temporalCoverage/rangeOfDates/beginDate/time|./temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale|./temporalCoverage/rangeOfDates/endDate/time|./temporalCoverage/rangeOfDates/endDate/alternativeTimeScale|./taxonomicCoverage/taxonomicSystem|./taxonomicCoverage/generalTaxonomicCoverage|./taxonomicCoverage/taxonomicClassification/commonName|./taxonomicCoverage/taxonomicClassification/taxonomicClassification|./geographicCoverage/datasetGPolygon|./geographicCoverage/boundingCoordinates/boundingAltitudes", "temporalCoverage/rangeOfDates/beginDate/time, /temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale, /temporalCoverage/rangeOfDates/endDate/time, /temporalCoverage/rangeOfDates/endDate/alternativeTimeScale, /taxonomicCoverage/taxonomicSystem, /taxonomicCoverage/generalTaxonomicCoverage, /taxonomicCoverage/taxonomicClassification/commonName, /taxonomicCoverage/taxonomicClassification/taxonomicClassification, /geographicCoverage/datasetGPolygon, /geographicCoverage/boundingCoordinates/boundingAltitudes");
1718 1711

  
1719 1712
            $tempResult = $node->findnodes('./temporalCoverage');
1720 1713
            if ($tempResult->size > 1) {
......
1816 1809
                    eval($$templateVars{'longSec2'} = int($coord));
1817 1810
                }
1818 1811
            }
1812

  
1813
            $tempResult = $node->findnodes('./taxonomicCoverage/taxonomicClassification');
1814
            my $taxonIndex = 0;
1815
            foreach $tempNode ($tempResult->get_nodelist) {
1816
                $taxonIndex++;
1817
                my $taxonRankName = findValue($tempNode, "taxonRankName");
1818
                my $taxonRankValue = findValue($tempNode, "taxonRankValue");
1819
                $$templateVars{"taxonRankName".$taxonIndex} = $taxonRankName;
1820
                $$templateVars{"taxonRankValue".$taxonIndex} = $taxonRankValue;
1821
            }
1822
            $$templateVars{'taxaCount'} = $taxonIndex;
1819 1823
        }
1820 1824
    }
1821 1825
    dontOccur($doc, "./purpose", "purpose");
......
2274 2278
    $$templateVars{'longMin2'} = $FORM::longMin2;
2275 2279
    $$templateVars{'longSec2'} = $FORM::longSec2;
2276 2280
    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
2281

  
2282
    $$templateVars{'taxaCount'} = $FORM::taxaCount;
2283
    foreach my $trn (param()) {
2284
        if ($trn =~ /taxonRankName/) {
2285
            my $taxIndex = $trn;
2286
            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
2287
            my $trv = "taxonRankValue".$taxIndex;
2288
            if ( $taxIndex =~ /[0-9]/ ){
2289
                if (hasContent(param($trn)) && hasContent(param($trv))) {
2290
                    debug("Registry processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
2291
                    $$templateVars{$trn} = param($trn);
2292
                    $$templateVars{$trv} = param($trv);
2293
                }
2294
            }
2295
        }
2296
    }
2297

  
2277 2298
    $$templateVars{'methodTitle'} = $FORM::methodTitle;
2278 2299
    $$templateVars{'methodPara'} = \@FORM::methodPara;
2279 2300
    $$templateVars{'docid'} = $FORM::docid;

Also available in: Unified diff