Revision 9633
Added by ben leinfelder over 8 years ago
register-dataset.cgi | ||
---|---|---|
1841 | 1841 |
sub datasetStart() { |
1842 | 1842 |
my $dataset = "<dataset>\n"; |
1843 | 1843 |
|
1844 |
if ( hasContent($FORM::identifier) ) { |
|
1845 |
$dataset .= "<alternateIdentifier system=\"$FORM::site\">"; |
|
1846 |
$dataset .= normalize($FORM::identifier) . "</alternateIdentifier>\n"; |
|
1844 |
## handle multiple alternate identifiers |
|
1845 |
my $identifierArray = \@FORM::identifier; |
|
1846 |
debug( "datasetStart identifier array size = " . $#$identifierArray ); |
|
1847 |
for ( my $i = 0 ; $i <= $#$identifierArray ; $i++ ) { |
|
1848 |
if ( hasContent( $identifierArray->[$i] ) ) |
|
1849 |
{ |
|
1850 |
debug( "Processing identifier: id = " |
|
1851 |
. $identifierArray->[$i] ); |
|
1852 |
#$dataset .= "<alternateIdentifier system=\"$FORM::site\">"; |
|
1853 |
$dataset .= "<alternateIdentifier>"; |
|
1854 |
$dataset .= normalize($identifierArray->[$i]) . "</alternateIdentifier>\n"; |
|
1855 |
} |
|
1847 | 1856 |
} |
1857 |
|
|
1858 |
|
|
1848 | 1859 |
return $dataset; |
1849 | 1860 |
} |
1850 | 1861 |
|
... | ... | |
2715 | 2726 |
|
2716 | 2727 |
# find out the tag <alternateIdentifier>. |
2717 | 2728 |
$results = $doc->findnodes('//dataset/alternateIdentifier'); |
2718 |
if ( $results->size() > 1 ) {
|
|
2719 |
errMoreThanOne("alternateIdentifier");
|
|
2720 |
}
|
|
2721 |
else {
|
|
2729 |
if ( $results->size() > 0 ) {
|
|
2730 |
# handle multiple alternate identifiers
|
|
2731 |
$results = $doc->findnodes('//dataset/alternateIdentifier');
|
|
2732 |
my $identifierIndex = 0;
|
|
2722 | 2733 |
foreach $node ( $results->get_nodelist ) { |
2723 |
$$templateVars{'identifier'} = |
|
2724 |
findValue( $node, '../alternateIdentifier' ); |
|
2734 |
$identifierIndex++; |
|
2735 |
$$templateVars{ "identifierValue" . $identifierIndex } = |
|
2736 |
findValue( $node, '../alternateIdentifier[' . $identifierIndex . ']' ); |
|
2725 | 2737 |
} |
2738 |
$$templateVars{'identifierCount'} = $identifierIndex; |
|
2739 |
|
|
2726 | 2740 |
} |
2741 |
|
|
2727 | 2742 |
|
2728 | 2743 |
# find out the tag <title>. |
2729 | 2744 |
$results = $doc->findnodes('//dataset/title'); |
... | ... | |
4871 | 4886 |
} |
4872 | 4887 |
|
4873 | 4888 |
$$templateVars{'funding'} = normalizeCD($FORM::funding); |
4874 |
$$templateVars{'identifier'} = normalizeCD($FORM::identifier); |
|
4889 |
|
|
4890 |
# handle multiple identifiers |
|
4891 |
#$$templateVars{'identifier'} = normalizeCD($FORM::identifier); |
|
4892 |
my $identifierArray = \@FORM::identifier; |
|
4893 |
debug( "Processing identifier array size = " . $#$identifierArray ); |
|
4894 |
my $identifierCount = 1; |
|
4895 |
for ( my $i = 0 ; $i <= $#$identifierArray ; $i++ ) { |
|
4896 |
if ( hasContent( $identifierArray->[$i] ) ) |
|
4897 |
{ |
|
4898 |
debug( "Processing confirm identifier: id = " |
|
4899 |
. $identifierArray->[$i] ); |
|
4900 |
$$templateVars{ "identifierValue" . $identifierCount } = |
|
4901 |
normalizeCD( $identifierArray->[$i] ); |
|
4902 |
$identifierCount++; |
|
4903 |
} |
|
4904 |
} |
|
4905 |
$$templateVars{'identifierCount'} = $identifierCount - 1; |
|
4906 |
|
|
4875 | 4907 |
$$templateVars{'title'} = normalizeCD($FORM::title); |
4876 | 4908 |
$$templateVars{'origNamefirst0'} = normalizeCD($FORM::origNamefirst0); |
4877 | 4909 |
$$templateVars{'origNamelast0'} = normalizeCD($FORM::origNamelast0); |
... | ... | |
5178 | 5210 |
$$templateVars{'wg'} = \@FORM::wg; |
5179 | 5211 |
} |
5180 | 5212 |
$$templateVars{'funding'} = $FORM::funding; |
5181 |
$$templateVars{'identifier'} = $FORM::identifier; |
|
5213 |
|
|
5214 |
# handle multiple identifier values |
|
5215 |
#$$templateVars{'identifier'} = $FORM::identifier; |
|
5216 |
$$templateVars{'identifierCount'} = $FORM::identifierCount; |
|
5217 |
debug( "Identifier template count: " . $FORM::identifierCount ); |
|
5218 |
|
|
5219 |
foreach my $id ( param() ) { |
|
5220 |
if ( $id =~ /identifier/ ) { |
|
5221 |
debug( "Processing identifier param: $id = " . param($id) ); |
|
5222 |
|
|
5223 |
my $identifierIndex = $id; |
|
5224 |
$identifierIndex =~ s/identifierValue//; # get the index of the parameter 0, ..., 10 |
|
5225 |
my $idParamName = "identifierValue" . $identifierIndex; |
|
5226 |
debug( "identifierIndex:" . $identifierIndex ); |
|
5227 |
debug( "idParamName: " . $idParamName ); |
|
5228 |
debug( "id: " . $id ); |
|
5229 |
if ( $identifierIndex =~ /[0-9]+/ ) { |
|
5230 |
if ( hasContent( param($idParamName) ) ) { |
|
5231 |
debug( "Processing template identifier: $id = " |
|
5232 |
. param($idParamName) ); |
|
5233 |
$$templateVars{$idParamName} = param($idParamName); |
|
5234 |
} |
|
5235 |
} |
|
5236 |
} |
|
5237 |
} |
|
5238 |
|
|
5239 |
|
|
5182 | 5240 |
$$templateVars{'title'} = $FORM::title; |
5183 | 5241 |
$$templateVars{'origNamefirst0'} = $FORM::origNamefirst0; |
5184 | 5242 |
$$templateVars{'origNamelast0'} = $FORM::origNamelast0; |
Also available in: Unified diff
merge changes to accommodate multiple alternative identifiers into trunk from 2.6 branch.