Project

General

Profile

« Previous | Next » 

Revision 9557

Added by Chris Jones about 8 years ago

Add a fundingElement() method to insert the funding element into the generted EML. Ensure it is added to the template variables hash for maintaining state across stages.

refs https://github.nceas.ucsb.edu/KNB/arctic-data/issues/42

View differences:

register-dataset.cgi
1607 1607
	$doc .= coverageElement();
1608 1608
	$doc .= contactElement();
1609 1609
	$doc .= methodsElement();
1610
	$doc .= fundingElement();
1610 1611
	my %fileData = allFileData();
1611 1612
	$doc .= entityElement( \%fileData );
1612 1613
	$doc .= datasetEnd();
......
1970 1971
	return $methods;
1971 1972
}
1972 1973

  
1974
sub fundingElement() {
1975
    my $project = "";
1976

  
1977
    if ( hasContent($FORM::funding) ) {
1978

  
1979
        # Add a project title based on the dataset title
1980
        $project .= "<project>\n";
1981
        $project .= "<title>" .
1982
                    normalize($FORM::title) .
1983
                    "</title>\n";
1984

  
1985
        # Add a project personnel based on the dataset owner
1986
        $project .= "<personnel>\n" .
1987
                    "<individualName>\n" .
1988
                    "<givenName>" .
1989
                    normalize($FORM::origNamefirst0) .
1990
                    "</givenName>\n" .
1991
                    "<surName>" .
1992
                    normalize($FORM::origNamelast0) .
1993
                    "</surName>\n" .
1994
                    "</individualName>\n";
1995
        # Add a default role
1996
        $project .= "<role>originator</role>\n" .
1997
                    "</personnel>\n";
1998

  
1999
        # Add the funding info (grant number)
2000
        $project .= "<funding>" .
2001
                    normalize($FORM::funding) .
2002
                    "</funding>\n";
2003
        $project .= "</project>\n";
2004
    }
2005

  
2006
    return $project;
2007
}
2008

  
1973 2009
sub creatorContactElement() {
1974 2010
	my $cont = "";
1975 2011

  
......
4804 4840
	if ( $skinName eq "nceas" ) {
4805 4841
		$$templateVars{'wg'} = \@FORM::wg;
4806 4842
	}
4843

  
4844
	$$templateVars{'funding'}        = normalizeCD($FORM::funding);
4807 4845
	$$templateVars{'identifier'}     = normalizeCD($FORM::identifier);
4808 4846
	$$templateVars{'title'}          = normalizeCD($FORM::title);
4809 4847
	$$templateVars{'origNamefirst0'} = normalizeCD($FORM::origNamefirst0);
......
5111 5149
		$$templateVars{'projects'} = $projects;
5112 5150
		$$templateVars{'wg'}       = \@FORM::wg;
5113 5151
	}
5152
	$$templateVars{'funding'}        = $FORM::funding;
5114 5153
	$$templateVars{'identifier'}     = $FORM::identifier;
5115 5154
	$$templateVars{'title'}          = $FORM::title;
5116 5155
	$$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
......
5799 5838

  
5800 5839
    return $token_info->{'isValid'};
5801 5840
}
5802

  

Also available in: Unified diff