Revision 3422
Added by walbridge over 17 years ago
lib/style/skins/nceas/nceas-login.xsl | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
* '$RCSfile$' |
|
4 |
* Authors: Jivka Bojilova |
|
5 |
* Copyright: 2000 Regents of the University of California and the |
|
6 |
* National Center for Ecological Analysis and Synthesis |
|
7 |
* For Details: http://www.nceas.ucsb.edu/ |
|
8 |
* |
|
9 |
* '$Author$' |
|
10 |
* '$Date$' |
|
11 |
* '$Revision$' |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or modify |
|
14 |
* it under the terms of the GNU General Public License as published by |
|
15 |
* the Free Software Foundation; either version 2 of the License, or |
|
16 |
* (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
26 |
* |
|
27 |
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to |
|
28 |
* convert an XML file with information about login action |
|
29 |
* into an HTML format suitable for rendering with modern web browsers. |
|
30 |
--> |
|
31 |
|
|
32 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|
33 |
|
|
34 |
<xsl:output method="html"/> |
|
35 |
<xsl:param name="qformat">default</xsl:param> |
|
36 |
<xsl:template match="/"> |
|
37 |
<html> |
|
38 |
<head> |
|
39 |
<link rel="stylesheet" type="text/css" |
|
40 |
href="@style-skins-path@/nceas/nceas.css" /> |
|
41 |
<script language="Javascript" type="text/JavaScript" |
|
42 |
src="@style-skins-path@/nceas/nceas.js" /> |
|
43 |
<script language="Javascript" type="text/JavaScript" |
|
44 |
src="@style-common-path@/branding.js" /> |
|
45 |
</head> |
|
46 |
|
|
47 |
<script language="JavaScript"> |
|
48 |
insertTemplateOpening(); |
|
49 |
insertSearchBox(); |
|
50 |
</script> |
|
51 |
<xsl:if test="count(login) > 0"> |
|
52 |
<xsl:choose> |
|
53 |
<xsl:when test="count(login/isModerator) > 0"> |
|
54 |
<script language="JavaScript"> |
|
55 |
<![CDATA[function search(){ |
|
56 |
var searchForm = document.getElementById("search-form"); |
|
57 |
var queryInput = document.createElement("input"); |
|
58 |
queryInput.setAttribute("type", "hidden"); |
|
59 |
queryInput.setAttribute("name", "query"); |
|
60 |
queryInput.setAttribute("value", "<pathquery version=\"1.2\"><querytitle>Moderator-Search</querytitle><returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype><returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype><returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype><returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype><returndoctype>-//NCEAS//resource//EN</returndoctype><returndoctype>-//NCEAS//eml-dataset//EN</returndoctype><returnfield>originator/individualName/surName</returnfield><returnfield>originator/individualName/givenName</returnfield><returnfield>creator/individualName/surName</returnfield><returnfield>creator/individualName/givenName</returnfield><returnfield>originator/organizationName</returnfield><returnfield>creator/organizationName</returnfield><returnfield>dataset/title</returnfield><returnfield>keyword</returnfield><querygroup operator=\"INTERSECT\"><queryterm searchmode=\"not-contains\" casesensitive=\"false\"><value>public</value><pathexpr>dataset/access/allow/principal</pathexpr></queryterm><queryterm searchmode=\"not-contains\" casesensitive=\"false\"><value>Revision Requested</value><pathexpr>additionalMetadata/moderatorComment</pathexpr></queryterm></querygroup></pathquery>"); |
|
61 |
searchForm.appendChild(queryInput); |
|
62 |
searchForm.submit(); |
|
63 |
}]]> |
|
64 |
</script> |
|
65 |
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="timerID=setTimeout('search()',20)"> |
|
66 |
<p class="text_plain">Welcome <xsl:value-of select="login/name"/>. You are now logged in as moderator.</p> |
|
67 |
<form id="search-form" action="@servlet-path@" method="post"> |
|
68 |
<input type="hidden" name="action" value="squery"/> |
|
69 |
<input type="hidden" name="qformat" value="nceas"/> |
|
70 |
<input type="hidden" name="enableediting" value="true"/> |
|
71 |
<input type="hidden" name="message" value="You are now logged in as moderator."/> |
|
72 |
</form> |
|
73 |
</body> |
|
74 |
</xsl:when> |
|
75 |
<xsl:otherwise> |
|
76 |
<script language="JavaScript"> |
|
77 |
<![CDATA[ |
|
78 |
function search(){ |
|
79 |
location.href = "@cgi-prefix@/register-dataset.cgi?cfg=nceas"; |
|
80 |
}]]> |
|
81 |
</script> |
|
82 |
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="timerID=setTimeout('search()',2000)"> |
|
83 |
<p class="text_plain">Welcome <xsl:value-of select="login/name"/>. You will be automatically redirected to the data repoistory form.</p> |
|
84 |
</body> |
|
85 |
|
|
86 |
</xsl:otherwise> |
|
87 |
</xsl:choose> |
|
88 |
</xsl:if> |
|
89 |
<xsl:if test="count(unauth_login) > 0"> |
|
90 |
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> |
|
91 |
<p class="text_plain"><xsl:value-of select="unauth_login/message" /></p> |
|
92 |
</body> |
|
93 |
</xsl:if> |
|
94 |
<p class="text_plain">Return to the <a href="@systemidserver@@style-skins-path@/nceas/" target="_top">Registry home</a>. |
|
95 |
</p> |
|
96 |
<script language="JavaScript"> |
|
97 |
insertTemplateClosing(); |
|
98 |
</script> |
|
99 |
</html> |
|
100 |
</xsl:template> |
|
101 |
|
|
102 |
</xsl:stylesheet> |
|
103 |
|
|
0 | 104 |
lib/style/skins/nceas/nceas.cfg | ||
---|---|---|
22 | 22 |
sender = NCEAS Data Repository <help@nceas.ucsb.edu> |
23 | 23 |
recipient = help@nceas.ucsb.edu |
24 | 24 |
adminname = the repository administrator |
25 |
debug = 1
|
|
25 |
debug = 0
|
|
26 | 26 |
lsite = 'project' |
27 | 27 |
usite = 'Project' |
28 | 28 |
showSiteList = 'false' |
... | ... | |
33 | 33 |
hasSpatial = 'true' |
34 | 34 |
hasKeyword = 'true' |
35 | 35 |
hasTemporal = 'true' |
36 |
hasUpload = 'true' |
|
36 | 37 |
nceas_db = //hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu |
37 | 38 |
nceas_db_user = admowner |
38 | 39 |
nceas_db_password = your-pw-goes-here |
lib/style/skins/nceas/nceas.xml | ||
---|---|---|
18 | 18 |
<target publicid="-//W3C//HTML//EN">@systemidserver@@style-common-path@/generic-morpho.xsl</target> |
19 | 19 |
</doctype> |
20 | 20 |
--> |
21 |
<doctype publicid="-//NCEAS//login//EN"> |
|
22 |
<target publicid="-//W3C//HTML//EN">@systemidserver@@style-skins-path@/nceas/nceas-login.xsl</target> |
|
23 |
</doctype> |
|
21 | 24 |
|
22 |
|
|
23 | 25 |
<!-- pre-beta6 modules --> |
24 | 26 |
<!-- NOTE these settings are unchanged from the previous version - only the xsl |
25 | 27 |
filename has changed from "eml-dataset-display.xsl" to "eml-dataset-2.0.0beta4.xsl" --> |
lib/style/common/templates/entryForm.tmpl | ||
---|---|---|
847 | 847 |
var methodBit = 1; |
848 | 848 |
var dscBit = 1; |
849 | 849 |
var distBit = 1; |
850 |
var uploadBit = 1; |
|
850 | 851 |
|
851 | 852 |
function swap(evt, _node, nodeBit){ |
852 | 853 |
evt = (evt) ? evt : ((window.event) ? window.event : null); |
... | ... | |
996 | 997 |
} |
997 | 998 |
} |
998 | 999 |
|
1000 |
// include source for Multiple file uploader: |
|
1001 |
// http://the-stickman.com/web-development/javascript/ |
|
1002 |
|
|
1003 |
function MultiSelector( list_target, max ){ |
|
1004 |
|
|
1005 |
this.list_target = list_target; |
|
1006 |
this.count = 0; |
|
1007 |
this.id = 0; |
|
1008 |
var fcount = document.getElementById("fileCount"); |
|
1009 |
if (fcount.value > 0) { |
|
1010 |
this.id = fcount.value; |
|
1011 |
} |
|
1012 |
|
|
1013 |
if( max ){ |
|
1014 |
this.max = max; |
|
1015 |
} else { |
|
1016 |
this.max = -1; |
|
1017 |
}; |
|
1018 |
|
|
1019 |
/** |
|
1020 |
* Add a new file input element |
|
1021 |
*/ |
|
1022 |
this.addElement = function( element ){ |
|
1023 |
|
|
1024 |
// Make sure it's a file input element |
|
1025 |
if( element.tagName == 'INPUT' && element.type == 'file' ){ |
|
1026 |
// Element name -- what number am I? |
|
1027 |
element.name = 'file_' + this.id++; |
|
1028 |
|
|
1029 |
// Add reference to this object |
|
1030 |
element.multi_selector = this; |
|
1031 |
|
|
1032 |
// What to do when a file is selected |
|
1033 |
element.onchange = function(){ |
|
1034 |
// Increment file counter |
|
1035 |
var fileCount = incrementCount("fileCount"); |
|
1036 |
|
|
1037 |
// Clean up file text |
|
1038 |
var comment_element = document.getElementById( 'file_comment' ); |
|
1039 |
if (comment_element){ |
|
1040 |
comment_element.parentNode.removeChild(comment_element); |
|
1041 |
} |
|
1042 |
|
|
1043 |
// New file input |
|
1044 |
var new_element = document.createElement( 'input' ); |
|
1045 |
new_element.type = 'file'; |
|
1046 |
|
|
1047 |
// Add new element |
|
1048 |
this.parentNode.insertBefore( new_element, this ); |
|
1049 |
|
|
1050 |
// Apply 'update' to element |
|
1051 |
this.multi_selector.addElement( new_element ); |
|
1052 |
|
|
1053 |
// Update list |
|
1054 |
this.multi_selector.addListRow( this ); |
|
1055 |
|
|
1056 |
// Hide this: we can't use display:none because Safari doesn't like it |
|
1057 |
this.style.position = 'absolute'; |
|
1058 |
this.style.left = '-1000px'; |
|
1059 |
|
|
1060 |
}; |
|
1061 |
|
|
1062 |
// If we've reached maximum number, disable input element |
|
1063 |
if( this.max != -1 && this.count >= this.max ){ |
|
1064 |
element.disabled = true; |
|
1065 |
}; |
|
1066 |
// File element counter |
|
1067 |
this.count++; |
|
1068 |
|
|
1069 |
// Most recent element |
|
1070 |
this.current_element = element; |
|
1071 |
|
|
1072 |
} else { |
|
1073 |
// This can only be applied to file input elements! |
|
1074 |
alert( 'Error: not a file input element' ); |
|
1075 |
}; |
|
1076 |
|
|
1077 |
}; |
|
1078 |
|
|
1079 |
/** |
|
1080 |
* Add a new row to the list of files |
|
1081 |
*/ |
|
1082 |
this.addListRow = function( element ){ |
|
1083 |
|
|
1084 |
// Row div |
|
1085 |
var new_row = document.createElement( 'div' ); |
|
1086 |
|
|
1087 |
// Delete button |
|
1088 |
var new_row_button = document.createElement( 'input' ); |
|
1089 |
new_row_button.type = 'button'; |
|
1090 |
new_row_button.value = 'Delete'; |
|
1091 |
|
|
1092 |
// References |
|
1093 |
new_row.element = element; |
|
1094 |
|
|
1095 |
// Delete function |
|
1096 |
new_row_button.onclick= function(){ |
|
1097 |
// Remove element from form |
|
1098 |
this.parentNode.element.parentNode.removeChild( this.parentNode.element ); |
|
1099 |
|
|
1100 |
// Remove this row from the list |
|
1101 |
this.parentNode.parentNode.removeChild( this.parentNode ); |
|
1102 |
// Decrement counter |
|
1103 |
this.parentNode.element.multi_selector.count--; |
|
1104 |
|
|
1105 |
// Re-enable input element (if it's disabled) |
|
1106 |
this.parentNode.element.multi_selector.current_element.disabled = false; |
|
1107 |
|
|
1108 |
// Appease Safari |
|
1109 |
// without it Safari wants to reload the browser window |
|
1110 |
// which nixes your already queued uploads |
|
1111 |
return false; |
|
1112 |
}; |
|
1113 |
|
|
1114 |
// Set row value |
|
1115 |
new_row.innerHTML = element.value + " "; |
|
1116 |
|
|
1117 |
// Add button |
|
1118 |
new_row.appendChild( new_row_button ); |
|
1119 |
|
|
1120 |
// Add it to the list |
|
1121 |
this.list_target.appendChild( new_row ); |
|
1122 |
|
|
1123 |
}; |
|
1124 |
|
|
1125 |
}; |
|
1126 |
|
|
1127 |
function deleteFile(evt, file) { |
|
1128 |
evt = (evt) ? evt : ((window.event) ? window.event : null); |
|
1129 |
if (evt) { |
|
1130 |
// equalize W3C/IE models to get event target reference |
|
1131 |
var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); |
|
1132 |
var element = document.getElementById("file_element"); |
|
1133 |
if (elem) { |
|
1134 |
try { |
|
1135 |
// Add a new hidden form element to delete exisiting files |
|
1136 |
// FIXME: this needs to find the matching file element, so if our node |
|
1137 |
// has 'test.txt' as the filename, find the input hidden value="test.txt" |
|
1138 |
//element.parentNode.removeChild( element ); |
|
1139 |
|
|
1140 |
var delete_input = document.createElement( 'input' ); |
|
1141 |
delete_input.type = 'hidden'; |
|
1142 |
delete_input.value = file; |
|
1143 |
elem.appendChild( delete_input ); |
|
1144 |
|
|
1145 |
// Remove this row from the list |
|
1146 |
elem.parentNode.parentNode.removeChild( elem.parentNode ); |
|
1147 |
|
|
1148 |
// Decrement counter |
|
1149 |
elem.parentNode.element.multi_selector.count--; |
|
1150 |
|
|
1151 |
// Re-enable input element (if it's disabled) |
|
1152 |
elem.parentNode.element.multi_selector.current_element.disabled = false; |
|
1153 |
} |
|
1154 |
catch(e) { |
|
1155 |
var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error"); |
|
1156 |
alert("Error:\n" + msg); |
|
1157 |
return; |
|
1158 |
} |
|
1159 |
} |
|
1160 |
} |
|
1161 |
} |
|
1162 |
|
|
999 | 1163 |
</script> |
1000 | 1164 |
|
1001 | 1165 |
[% IF form != 're_entry' %] |
... | ... | |
1065 | 1229 |
</table> |
1066 | 1230 |
|
1067 | 1231 |
|
1068 |
<form action="@cgi-prefix@/register-dataset.cgi" method="post"> |
|
1232 |
<form action="@cgi-prefix@/register-dataset.cgi" enctype="multipart/form-data" method="post">
|
|
1069 | 1233 |
<input type="hidden" name="cfg" value="[% cfg %]"> |
1070 | 1234 |
<input type="hidden" name="docid" value="[% docid %]"> |
1071 | 1235 |
<input type="hidden" name="stage" value="insert"> |
... | ... | |
1079 | 1243 |
<input type="hidden" name="hasSpatial" value="[% hasSpatial %]"> |
1080 | 1244 |
<input type="hidden" name="hasTaxonomic" value="[% hasTaxonomic %]"> |
1081 | 1245 |
<input type="hidden" name="hasMethod" value="[% hasMethod %]"> |
1246 |
<input type="hidden" name="hasUpload" value="[% hasUpload %]"> |
|
1082 | 1247 |
<input type="hidden" name="temporalRequired" value="[% temporalRequired %]"> |
1083 | 1248 |
<input type="hidden" name="spatialRequired" value="[% spatialRequired %]"> |
1084 | 1249 |
<input type="hidden" name="contactEmailAddressRequired" value="[% contactEmailAddressRequired %]"> |
... | ... | |
1285 | 1450 |
onClick="addAssociatedParty()"></td></tr> |
1286 | 1451 |
|
1287 | 1452 |
[% numAO = 0 %] |
1288 |
[% IF aoCount > 0 %]
|
|
1453 |
[% IF aoCount %] |
|
1289 | 1454 |
[% numAO = aoCount %] |
1290 | 1455 |
<tr class="sectbody" id="aoHRRow"> |
1291 | 1456 |
<td colSpan="6"> |
... | ... | |
1395 | 1560 |
|
1396 | 1561 |
|
1397 | 1562 |
[% numKey = 0 %] |
1398 |
[% IF keyCount > 0 %]
|
|
1563 |
[% IF keyCount %] |
|
1399 | 1564 |
[% numKey = keyCount %] |
1400 | 1565 |
[% numAO = aoCount %] |
1401 | 1566 |
<tr class="sectbody" id="keywordHRRow"> |
... | ... | |
1773 | 1938 |
</tr> |
1774 | 1939 |
|
1775 | 1940 |
[% numTaxa = 0 %] |
1776 |
[% IF taxaCount > 0 %]
|
|
1941 |
[% IF taxaCount %] |
|
1777 | 1942 |
[% numTaxa = taxaCount %] |
1778 | 1943 |
<tr class="sectbody" id="taxonHRRow"> |
1779 | 1944 |
<td colSpan="6"> |
... | ... | |
1842 | 2007 |
|
1843 | 2008 |
<tr class="sectbody"><td valign="top" class="rightCol"><span class="label">Method Description</span> |
1844 | 2009 |
<td colspan="5" align="left"> |
1845 |
[% IF methodPara.size < 1 %]
|
|
2010 |
[% IF !methodPara %]
|
|
1846 | 2011 |
<textarea rows="6" cols="60" name="methodPara"></textarea> |
1847 | 2012 |
[% END %] |
1848 | 2013 |
[% FOREACH para = methodPara %] |
... | ... | |
2090 | 2255 |
|
2091 | 2256 |
</table> |
2092 | 2257 |
|
2258 |
[% IF hasUpload == 'true' %] |
|
2259 |
|
|
2260 |
<!-- Associated Data --> |
|
2261 |
<table class="tables" cellpadding="5" cellspacing="0"> |
|
2262 |
<tr class="sectheader"><td colspan="5" align="left"> |
|
2263 |
<span class="label">UPLOAD DATA </span><a href="@cgi-prefix@/register-dataset.cgi?cfg=[%cfg%]&stage=guide#XXX" |
|
2264 |
target="guide"><span class="smalltext">(What's this?)</span></a></td> |
|
2265 |
<td class="rightCol"><span><a onClick="distBit=swap(event, 'uploadTable', uploadBit)" style="cursor:pointer">Hide</a></span></td> |
|
2266 |
</tr> |
|
2267 |
</table> |
|
2268 |
<table class="tables" cellpadding="5" cellspacing="0" id="uploadTable"> |
|
2269 |
<tr class="sectbody"> |
|
2270 |
<td class="rightCol"><span class="label">Upload Data File:</span></td> |
|
2271 |
<td colspan="5"> |
|
2272 |
<input type="file" id="file_element" name="file_1" class="longwidth"> |
|
2273 |
|
|
2274 |
[% IF form == 're_entry' && upCount %] |
|
2275 |
[% cnt = 0 %] |
|
2276 |
[% WHILE cnt < upCount %] |
|
2277 |
[% SET fileSum = "upload_${cnt}" %] |
|
2278 |
[% SET fileName = "uploadname_${cnt}" %] |
|
2279 |
[% SET fileType = "uploadtype_${cnt}" %] |
|
2280 |
[% IF fileSum %] |
|
2281 |
<input type="hidden" name="[%fileSum%]" value="[% $fileSum %]"> |
|
2282 |
<input type="hidden" name="[%fileName%]" value="[% $fileName %]"> |
|
2283 |
<input type="hidden" name="[%fileType%]" value="[% $fileType %]"> |
|
2284 |
[% END %] |
|
2285 |
[% cnt = cnt + 1 %] |
|
2286 |
[% END %] |
|
2287 |
<input type="hidden" name="upCount" value="[%upCount%]"> |
|
2288 |
[% END %] |
|
2289 |
|
|
2290 |
<input type="hidden" name="fileCount" value="[%fileCount%]" id="fileCount"></td> |
|
2291 |
</tr> |
|
2292 |
<tr class="sectbody"> |
|
2293 |
<td class="rightCol" valign="top"><span class="label">Attached Files:</span></td> |
|
2294 |
<td colspan="5"> |
|
2295 |
[% IF !upCount %] |
|
2296 |
<div id="file_comment"> |
|
2297 |
(<i>None currently attached</i>) |
|
2298 |
</div> |
|
2299 |
[% END %] |
|
2300 |
<div id="files_list">[% IF form == 're_entry' && upCount %] |
|
2301 |
[% cnt = 0 %] |
|
2302 |
[% WHILE cnt < upCount %] |
|
2303 |
[% SET fileName = "uploadname_${cnt}" %] |
|
2304 |
[% IF fileName %]<div>[% $fileName %] <input type="button" value="Delete" onclick="deleteFile(event, [%fileName%]);"</div>[% END %] |
|
2305 |
[% cnt = cnt + 1 %] |
|
2306 |
[% END %] |
|
2307 |
[% END %]</div></td> |
|
2308 |
</tr> |
|
2309 |
</table> |
|
2310 |
|
|
2311 |
<script language="JavaScript" type="text/JavaScript"> |
|
2312 |
var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 10); |
|
2313 |
multi_selector.addElement( document.getElementById( 'file_element' ) ); |
|
2314 |
</script> |
|
2315 |
[% END %] |
|
2093 | 2316 |
<table class="tables" cellpadding="5" cellspacing="0"> |
2094 | 2317 |
<tr class="sectheader"><td colspan="6" align="left"></td></tr> |
2095 | 2318 |
<tr class="sectheader"><td colspan="6" align="center" class="borderbottom"><input type="SUBMIT" onClick="sortInputTags()" value="Submit Data Set Description" name="SUBMIT"> |
lib/style/common/templates/confirmData.tmpl | ||
---|---|---|
267 | 267 |
</font></p> |
268 | 268 |
</td> |
269 | 269 |
</tr> |
270 |
[% IF latDeg2 %] |
|
270 | 271 |
<tr> |
271 | 272 |
<td valign="TOP" colspan="4"> |
272 | 273 |
<p><span class="label">The second lat/long pair:</span></p> |
... | ... | |
308 | 309 |
</font></p> |
309 | 310 |
</td> |
310 | 311 |
</tr> |
312 |
[% END %] |
|
311 | 313 |
</table> |
312 | 314 |
[% END %] |
313 | 315 |
|
... | ... | |
341 | 343 |
<p><span class="label">Sampling Description:</span> [%samplingDescription%]</p> |
342 | 344 |
[% END %] |
343 | 345 |
|
346 |
[% IF hasUpload == 'true' && upCount %] |
|
347 |
<hr> |
|
348 |
<a name="Upload Data"></a> |
|
349 |
<p><span class="sectionnames">UPLOAD DATA</span></p> |
|
350 |
|
|
351 |
[% cnt = 0 %] |
|
352 |
[% WHILE cnt < upCount %] |
|
353 |
[% SET fileName = "uploadname_${cnt}" %] |
|
354 |
[% cnt = cnt + 1 %] |
|
355 |
|
|
356 |
<p><span class="label">File #[% cnt %]:</span> [% $fileName %] </p> |
|
357 |
[% END %] |
|
358 |
[% END %] |
|
344 | 359 |
<hr> |
345 | 360 |
<a name="DataSetContactAddress"></a> |
346 | 361 |
<p><span class="sectionnames">DATA SET CONTACT</span> |
... | ... | |
419 | 434 |
<input type="hidden" name="hasTemporal" value="[% hasTemporal %]"> |
420 | 435 |
<input type="hidden" name="hasTaxonomic" value="[% hasTaxonomic %]"> |
421 | 436 |
<input type="hidden" name="hasMethod" value="[% hasMethod %]"> |
437 |
<input type="hidden" name="hasUpload" value="[% hasUpload %]"> |
|
422 | 438 |
<input type="hidden" name="temporalRequired" value="[% temporalRequired %]"> |
423 | 439 |
<input type="hidden" name="spatialRequired" value="[% spatialRequired %]"> |
424 | 440 |
<input type="hidden" name="contactEmailAddressRequired" value="[% contactEmailAddressRequired %]"> |
... | ... | |
529 | 545 |
[% END %] |
530 | 546 |
<input type="hidden" name="studyExtentDescription" value="[%studyExtentDescription%]"> |
531 | 547 |
<input type="hidden" name="samplingDescription" value="[%samplingDescription%]"> |
548 |
<input type="hidden" name="fileCount" value="[%fileCount%]"> |
|
549 |
<input type="hidden" name="upCount" value="[%upCount%]"> |
|
550 |
[% fCount = 0 %] |
|
551 |
[% IF upCount > 0 %] |
|
552 |
[% fCount = upCount %] |
|
553 |
[% END %] |
|
532 | 554 |
|
555 |
[% cnt = 0 %] |
|
556 |
[% WHILE cnt < fCount %] |
|
557 |
[% SET fileSum = "upload_${cnt}" %] |
|
558 |
[% SET fileName = "uploadname_${cnt}" %] |
|
559 |
[% SET fileType = "uploadtype_${cnt}" %] |
|
560 |
|
|
561 |
[% IF fileSum %] |
|
562 |
<input type="hidden" name="[% fileSum %]" value="[% $fileSum %]"> |
|
563 |
<input type="hidden" name="[% fileName %]" value="[% $fileName %]"> |
|
564 |
<input type="hidden" name="[% fileType %]" value="[% $fileType %]"> |
|
565 |
[% END %] |
|
566 |
[% cnt = cnt + 1 %] |
|
567 |
[% END %] |
|
533 | 568 |
</td><tr></table> |
534 | 569 |
|
535 | 570 |
[% IF userLoggedIn != 'true' %] |
lib/style/common/templates/genericResponse.tmpl | ||
---|---|---|
75 | 75 |
<input type="hidden" name="hasSpatial" value="[% hasSpatial %]"> |
76 | 76 |
<input type="hidden" name="hasTaxonomic" value="[% hasTaxonomic %]"> |
77 | 77 |
<input type="hidden" name="hasMethod" value="[% hasMethod %]"> |
78 |
<input type="hidden" name="hasUpload" value="[% hasUpload %]"> |
|
78 | 79 |
<input type="hidden" name="temporalRequired" value="[% temporalRequired %]"> |
79 | 80 |
<input type="hidden" name="spatialRequired" value="[% spatialRequired %]"> |
80 | 81 |
<input type="hidden" name="contactEmailAddressRequired" value="[% contactEmailAddressRequired %]"> |
... | ... | |
198 | 199 |
[% END %] |
199 | 200 |
<input type="hidden" name="studyExtentDescription" value="[%studyExtentDescription%]"> |
200 | 201 |
<input type="hidden" name="samplingDescription" value="[%samplingDescription%]"> |
201 |
|
|
202 |
<table class="intro" cellpadding="8" cellspacing="0"> |
|
203 |
<tr><td align="left"> |
|
204 |
<span class="regtext">Click the button below to return to the form and fill in the required fields.</span> |
|
205 |
<span class="redbold">Do NOT use the back button on your browser.</span> |
|
206 |
<span class="regtext">Submit the description again when you are finished.</span> |
|
207 |
</td></tr> |
|
202 |
<input type="hidden" name="fileCount" value="[%fileCount%]"> |
|
203 |
<input type="hidden" name="upCount" value="[%upCount%]"> |
|
204 |
[% fCount = 0 %] |
|
205 |
[% IF upCount > 0 %] |
|
206 |
[% fCount = upCount %] |
|
207 |
[% END %] |
|
208 |
|
|
209 |
[% cnt = 0 %] |
|
210 |
[% WHILE cnt < fCount %] |
|
211 |
[% SET fileSum = "upload_${cnt}" %] |
|
212 |
[% SET fileName = "uploadname_${cnt}" %] |
|
213 |
[% SET fileType = "uploadtype_${cnt}" %] |
|
214 |
|
|
215 |
[% IF fileSum %] |
|
216 |
|
|
217 |
<input type="hidden" name="[% fileSum %]" value="[% $fileSum %]"> |
|
218 |
<input type="hidden" name="[% fileName %]" value="[% $fileName %]"> |
|
219 |
<input type="hidden" name="[% fileType %]" value="[% $fileType %]"> |
|
220 |
[% END %] |
|
221 |
[% cnt = cnt + 1 %] |
|
222 |
[% END %] |
|
223 |
|
|
224 |
<table class="intro" cellpadding="8" cellspacing="0"> |
|
225 |
<tr><td align="left"> |
|
226 |
<span class="regtext">Click the button below to return to the form and fill in the required fields.</span> |
|
227 |
<span class="redbold">Do NOT use the back button on your browser.</span> |
|
228 |
<span class="regtext">Submit the description again when you are finished.</span> |
|
229 |
</td></tr> |
|
208 | 230 |
<tr> |
209 | 231 |
<td align="left"> |
210 | 232 |
<input type="submit" value="Return to Form"/> |
src/perl/register-dataset.cgi | ||
---|---|---|
36 | 36 |
use Net::SMTP; |
37 | 37 |
use CGI qw/:standard :html3/; |
38 | 38 |
use CGI::Session; |
39 |
use Digest::SHA1; |
|
40 |
use File::stat; |
|
41 |
use File::Basename; |
|
39 | 42 |
use strict; |
40 | 43 |
|
41 | 44 |
# Global configuration paramters |
... | ... | |
83 | 86 |
$config->define("hasSpatial", { DEFAULT => 'true'} ); |
84 | 87 |
$config->define("hasTaxonomic", { DEFAULT => 'true'} ); |
85 | 88 |
$config->define("hasMethod", { DEFAULT => 'true'} ); |
89 |
$config->define("hasUpload", { DEFAULT => 'false'} ); |
|
86 | 90 |
$config->define("temporalRequired", { DEFAULT => 'true'} ); |
87 | 91 |
$config->define("spatialRequired", { DEFAULT => 'true'} ); |
88 | 92 |
$config->define("contactEmailAddressRequired", { DEFAULT => 'false'} ); |
... | ... | |
101 | 105 |
$config->define("responseTemplate", { DEFAULT => 'crap.tmpl'} ); |
102 | 106 |
$config->define("entryFormTemplate", { DEFAULT => 'crap.tmpl'} ); |
103 | 107 |
$config->define("guideTemplate", { DEFAULT => 'crap.tmpl'} ); |
104 |
$config->define("loginFormTemplate", { DEFAULT => 'crap.tmpl'} );
|
|
108 |
$config->define("loginFormTemplate", { DEFAULT => 'loginForm.tmpl'} );
|
|
105 | 109 |
$config->define("confirmDataTemplate", { DEFAULT => 'crap.tmpl'} ); |
106 | 110 |
$config->define("deleteDataTemplate", { DEFAULT => 'crap.tmpl'} ); |
107 | 111 |
$config->define("modEmailNotificationTemplate", { DEFAULT => 'crap.tmpl'} ); |
... | ... | |
153 | 157 |
my $hasSpatial = $config->hasSpatial(); |
154 | 158 |
my $hasTaxonomic = $config->hasTaxonomic(); |
155 | 159 |
my $hasMethod = $config->hasMethod(); |
160 |
my $hasUpload = $config->hasUpload(); |
|
156 | 161 |
my $temporalRequired = $config->temporalRequired(); |
157 | 162 |
my $spatialRequired = $config->spatialRequired(); |
158 | 163 |
my $contactEmailAddressRequired = $config->contactEmailAddressRequired(); |
... | ... | |
174 | 179 |
my $debug = $config->debug(); |
175 | 180 |
my $lat = $config->get('lat'); |
176 | 181 |
my $lon = $config->get('lon'); |
177 |
$debug = 1; |
|
182 |
|
|
178 | 183 |
# Convert the lat and lon configs into usable data structures |
179 | 184 |
my @sitelist; |
180 | 185 |
my %siteLatDMS; |
... | ... | |
206 | 211 |
$$templateVars{'orgurl'} = $orgurl; |
207 | 212 |
$$templateVars{'orgfilter'} = $orgfilter; |
208 | 213 |
|
209 |
debug("Registry: Initialized"); |
|
214 |
debug("Registry: Initialized -- stage set: $FORM::stage"); |
|
215 |
|
|
216 |
# Must have a config to use Metacat |
|
217 |
if (!hasContent($FORM::cfg)) { |
|
218 |
debug("Registry: No configuration set."); |
|
219 |
print "Content-type: text/html\n\n"; |
|
220 |
$$templateVars{'message'} = 'Error: The registry requires a skin name to continue.'; |
|
221 |
$template->process( $loginFormTemplate, $templateVars); |
|
222 |
exit(0); |
|
223 |
} |
|
224 |
|
|
225 |
# Metacat isn't initialized, the registry will fail in strange ways. |
|
226 |
if (!hasContent($metacatUrl)) { |
|
227 |
debug("Registry: No Metacat."); |
|
228 |
print "Content-type: text/html\n\n"; |
|
229 |
$$templateVars{'message'} = 'Error: Metacat is not initialized! Make sure' . |
|
230 |
' MetacatUrl is set correctly in ' . $FORM::cfg . '.cfg'; |
|
231 |
$template->process( $loginFormTemplate, $templateVars); |
|
232 |
exit(0); |
|
233 |
} |
|
234 |
|
|
210 | 235 |
# Process the form based on stage parameter. |
211 | 236 |
if ($FORM::stage =~ "loginform") { |
212 | 237 |
print "Content-type: text/html\n\n"; |
... | ... | |
316 | 341 |
|
317 | 342 |
# check if the user is logged in... |
318 | 343 |
my $session = CGI::Session->load() or die CGI::Session->errstr(); |
319 |
if ( $session->is_empty && $FORM::cfg =~ 'esa' ) {
|
|
344 |
if ( $session->is_empty ) { |
|
320 | 345 |
# no session found ... redirect to login page template |
321 |
$$templateVars{'showInstructions'} = 'true';
|
|
322 |
$$templateVars{'message'} = 'You must login to register your dataset.';
|
|
346 |
$$templateVars{'showInstructions'} = 'true';
|
|
347 |
$$templateVars{'message'} = 'You must login to register your dataset.';
|
|
323 | 348 |
$template->process( $loginFormTemplate, $templateVars); |
324 | 349 |
} else { |
325 | 350 |
|
... | ... | |
346 | 371 |
$$templateVars{'hasSpatial'} = $hasSpatial; |
347 | 372 |
$$templateVars{'hasTaxonomic'} = $hasTaxonomic; |
348 | 373 |
$$templateVars{'hasMethod'} = $hasMethod; |
374 |
$$templateVars{'hasUpload'} = $hasUpload; |
|
349 | 375 |
$$templateVars{'temporalRequired'} = $temporalRequired; |
350 | 376 |
$$templateVars{'spatialRequired'} = $spatialRequired; |
351 | 377 |
$$templateVars{'contactEmailAddressRequired'} = $contactEmailAddressRequired; |
... | ... | |
395 | 421 |
} |
396 | 422 |
|
397 | 423 |
|
398 |
my $metacat; |
|
399 | 424 |
my $docid; |
425 |
# Create a metacat object |
|
426 |
my $metacat = Metacat->new($metacatUrl); |
|
427 |
|
|
400 | 428 |
if (! $error) { |
429 |
# Login to metacat |
|
430 |
my ($dname, $userPass) = getCredentials(); |
|
431 |
my $response = $metacat->login($dname, $userPass); |
|
432 |
|
|
401 | 433 |
# Parameters have been validated and Create the XML document |
402 |
|
|
403 | 434 |
my $xmldoc = createXMLDocument(); |
404 |
|
|
435 |
|
|
405 | 436 |
# Write out the XML file for debugging purposes |
406 |
#my $testFile = $tmpdir . "/test.xml"; |
|
437 |
#my $testFile = $tmpdir . "/test-file.xml"; |
|
438 |
#open (TFILE,">$testFile") || die ("Cant open xml file...\n"); |
|
439 |
#print TFILE $xmldoc; |
|
440 |
#close(TFILE); |
|
407 | 441 |
|
408 |
# Create a metacat object |
|
409 |
$metacat = Metacat->new(); |
|
410 |
if ($metacat) { |
|
411 |
$metacat->set_options( metacatUrl => $metacatUrl ); |
|
412 |
} else { |
|
413 |
#die "failed during metacat creation\n"; |
|
414 |
push(@errorMessages, "Failed during metacat creation."); |
|
415 |
} |
|
416 |
|
|
417 |
# Login to metacat |
|
418 |
my $userDN = $FORM::username; |
|
419 |
my $userOrg = $FORM::organization; |
|
420 |
my $userPass = $FORM::password; |
|
421 |
my $dname = "uid=$userDN,o=$userOrg,dc=ecoinformatics,dc=org"; |
|
422 |
|
|
423 |
if($FORM::userLoggedIn eq 'true'){ |
|
424 |
my $session = CGI::Session->load(); |
|
425 |
if (!( $session->is_empty || $session->is_expired)) { |
|
426 |
$dname = $session->param("username"); |
|
427 |
$userPass = $session->param("password"); |
|
428 |
} |
|
429 |
} |
|
430 |
|
|
431 | 442 |
my $xmldocWithDocID = $xmldoc; |
432 |
|
|
433 | 443 |
my $errorMessage = ""; |
434 |
my $response = $metacat->login($dname, $userPass); |
|
435 | 444 |
|
436 |
|
|
437 | 445 |
if (! $response) { |
446 |
debug("No response from Metacat"); |
|
438 | 447 |
push(@errorMessages, $metacat->getMessage()); |
439 | 448 |
push(@errorMessages, "Failed during login.\n"); |
440 | 449 |
$$templateVars{'status'} = 'login_failure'; |
... | ... | |
586 | 595 |
################################################################################ |
587 | 596 |
sub updateLastId { |
588 | 597 |
my $scope = shift; |
598 |
$metacat = Metacat->new($metacatUrl); |
|
599 |
my $errormsg = 0; |
|
589 | 600 |
|
590 |
my $errormsg = 0; |
|
591 | 601 |
my $docid = $metacat->getLastId($scope); |
592 | 602 |
|
593 | 603 |
if ($docid =~ /null/) { |
... | ... | |
598 | 608 |
debug("Docid is: $docid\n"); |
599 | 609 |
debug("Lastid is: $id"); |
600 | 610 |
my $scopeFile = $cfgdir . "/" . $FORM::cfg . "/" . $scope . ".lastid"; |
611 |
# FIXME: skins dir isn't generally writeable by the HTTP server, use tmp instead |
|
601 | 612 |
open(LASTID, "+>$scopeFile") or |
602 | 613 |
die "Failed to open lastid file for writing!"; |
603 | 614 |
print LASTID $id, "\n"; |
... | ... | |
620 | 631 |
debug("Trying to insert the following document"); |
621 | 632 |
my $notunique = "SUCCESS"; |
622 | 633 |
debug("Registry: Starting insert (D1)"); |
634 |
|
|
635 |
#$metacat = Metacat->new($metacatUrl); |
|
623 | 636 |
my $response = $metacat->insert($docid, $xmldoc); |
624 | 637 |
if (! $response) { |
625 | 638 |
debug("Registry: Response gotten (D2)"); |
... | ... | |
663 | 676 |
$lastid++; |
664 | 677 |
close(LASTID); |
665 | 678 |
} |
679 |
#debug("scopeFile: $scopeFile"); |
|
666 | 680 |
open(LASTID, ">$scopeFile") or die "Failed to open lastid file for writing!"; |
667 | 681 |
print LASTID $lastid, "\n"; |
668 | 682 |
close(LASTID); |
... | ... | |
862 | 876 |
unless (hasContent($FORM::origEmailContact)); |
863 | 877 |
} |
864 | 878 |
} |
865 |
push(@invalidParams, "Data medium is missing.") |
|
866 |
unless (hasContent($FORM::dataMedium) || $FORM::dataMedium =~ /elect/); |
|
867 |
push(@invalidParams, "Usage rights are missing.") |
|
868 |
unless (hasContent($FORM::useConstraints)); |
|
869 | 879 |
|
880 |
# scw: commented these out, don't seem to be matched to cfg setting |
|
881 |
#push(@invalidParams, "Data medium is missing.") |
|
882 |
#unless (hasContent($FORM::dataMedium) || $FORM::dataMedium =~ /elect/); |
|
883 |
#push(@invalidParams, "Usage rights are missing.") |
|
884 |
#unless (hasContent($FORM::useConstraints)); |
|
885 |
|
|
870 | 886 |
return \@invalidParams; |
871 | 887 |
} |
872 | 888 |
|
... | ... | |
985 | 1001 |
return $val; |
986 | 1002 |
} |
987 | 1003 |
|
1004 |
################################################################################ |
|
1005 |
# |
|
1006 |
# Upload new file objects into Metacat, if they're present and valid. |
|
1007 |
# |
|
1008 |
################################################################################ |
|
1009 |
sub allFileData { |
|
1010 |
my %uploadedFiles = (); |
|
1011 |
my $fileInfo; |
|
1012 |
my $docid; |
|
988 | 1013 |
|
1014 |
for (my $fileNum = 0; $fileNum <= $FORM::upCount; $fileNum++) { |
|
1015 |
my $fn = 'upload_' . $fileNum; |
|
1016 |
if (hasContent(param($fn))) { |
|
1017 |
debug("Registry: retrieving metadata for file: $fn"); |
|
1018 |
($docid, $fileInfo) = fileMetadata($fileNum); |
|
1019 |
$uploadedFiles{ $docid } = $fileInfo; |
|
1020 |
} |
|
1021 |
} |
|
1022 |
|
|
1023 |
return %uploadedFiles; |
|
1024 |
} |
|
1025 |
|
|
1026 |
sub fileMetadata { |
|
1027 |
my $fileNum = shift; |
|
1028 |
my $fileHash = param("upload_$fileNum"); |
|
1029 |
my $fileName = param("uploadname_$fileNum"); |
|
1030 |
my $contentType = param("uploadtype_$fileNum"); |
|
1031 |
my $cleanName = $fileName; |
|
1032 |
|
|
1033 |
# normalize input filenames; Windows filenames include full paths |
|
1034 |
$cleanName =~ s/.*[\/\\](.*)/$1/; |
|
1035 |
|
|
1036 |
my $outFile = $tmpdir . "/" . $cleanName; |
|
1037 |
#debug("Reading file from disk: $outFile"); |
|
1038 |
|
|
1039 |
my $fileSize = stat($outFile)->size; |
|
1040 |
if ($fileSize == 0) { |
|
1041 |
push(@errorMessages, "file $fileName is zero bytes!"); |
|
1042 |
debug( "Registry: file $fileName is zero bytes!"); |
|
1043 |
} |
|
1044 |
|
|
1045 |
# Now the file is on disk, send the object to Metacat |
|
1046 |
my $session = CGI::Session->load(); |
|
1047 |
if ( $session->is_empty ) { |
|
1048 |
push(@errorMessages, "Must be logged in to upload files."); |
|
1049 |
debug( "Not logged in, cannot upload files."); |
|
1050 |
return 0; |
|
1051 |
} |
|
1052 |
|
|
1053 |
#my ($dname, $userPass) = getCredentials(); |
|
1054 |
#debug("Logging in with $dname, $userPass"); |
|
1055 |
#$metacat->login($username, $password); |
|
1056 |
|
|
1057 |
my $docid = newAccessionNumber($defaultScope); |
|
1058 |
my $unique = uploadData($outFile, $docid); |
|
1059 |
if (!$unique) { |
|
1060 |
debug( "Registry: Updating lastid file"); |
|
1061 |
updateLastId($defaultScope); |
|
1062 |
} |
|
1063 |
|
|
1064 |
my $entityid = $fileHash."001"; |
|
1065 |
my $distribid = $fileHash."002"; |
|
1066 |
|
|
1067 |
my $uploadUrl = 'ecogrid://knb/' . $docid; |
|
1068 |
# TODO: should match the object promotion path, so that an |
|
1069 |
# Excel upload results in 'dataTable' in this field |
|
1070 |
my $entityType = 'Other'; |
|
1071 |
|
|
1072 |
my %dataInfo = ( 'docid' => $docid, |
|
1073 |
'entityid' => $entityid, |
|
1074 |
'distribid' => $distribid, |
|
1075 |
'fileName' => $cleanName, |
|
1076 |
'fileSize' => $fileSize, |
|
1077 |
'fileHash' => $fileHash, |
|
1078 |
'contentType' => $contentType, |
|
1079 |
'url' => $uploadUrl, |
|
1080 |
'entityType' => $entityType, |
|
1081 |
); |
|
1082 |
|
|
1083 |
return ($docid, \%dataInfo); |
|
1084 |
} |
|
1085 |
|
|
1086 |
|
|
1087 |
sub processFile { |
|
1088 |
my $fileName = shift; |
|
1089 |
|
|
1090 |
# test that we actually got a file |
|
1091 |
if(!$fileName || cgi_error()) { |
|
1092 |
debug("Error receiving file ". cgi_error()); |
|
1093 |
} |
|
1094 |
|
|
1095 |
# write file to disk, get SHA1 hash and size |
|
1096 |
my ($outFile, $fileHash) = writeFile($fileName); |
|
1097 |
|
|
1098 |
my $fileSize = stat($outFile)->size; |
|
1099 |
if ($fileSize == 0) { |
|
1100 |
push(@errorMessages, "file $fileName is zero bytes!"); |
|
1101 |
debug( "Registry: file $fileName is zero bytes!"); |
|
1102 |
} |
|
1103 |
|
|
1104 |
# file is in Metacat, generate the pertinent EML elements |
|
1105 |
my $contentType = uploadInfo($fileName)->{'Content-Type'}; |
|
1106 |
|
|
1107 |
my %dataInfo = ( 'fileName' => $fileName, |
|
1108 |
'fileHash' => $fileHash, |
|
1109 |
'contentType' => $contentType, |
|
1110 |
); |
|
1111 |
|
|
1112 |
return \%dataInfo; |
|
1113 |
} |
|
1114 |
|
|
1115 |
sub writeFile { |
|
1116 |
my $fileName = shift; |
|
1117 |
my $fileData; |
|
1118 |
my $length = 0; |
|
1119 |
my $buffer; |
|
1120 |
my $cleanName = $fileName; |
|
1121 |
|
|
1122 |
# normalize input filenames; Windows filenames include full paths |
|
1123 |
$cleanName =~ s/.*[\/\\](.*)/$1/; |
|
1124 |
|
|
1125 |
while (my $bytesRead = read($fileName, $buffer, 4096)) { |
|
1126 |
$fileData .= $buffer; |
|
1127 |
$length += $bytesRead; |
|
1128 |
} |
|
1129 |
|
|
1130 |
# create SHA1 sum to store file hash |
|
1131 |
my $ctx = Digest::SHA1->new; |
|
1132 |
$ctx->add($fileData); |
|
1133 |
my $digest = $ctx->hexdigest; |
|
1134 |
|
|
1135 |
my $outputName = $tmpdir . "/" . $cleanName; |
|
1136 |
open(OUT,">$outputName") or die "Could not open: $!"; |
|
1137 |
print OUT $fileData; |
|
1138 |
close(OUT); |
|
1139 |
debug("Registry: output is: $outputName, length is: $length"); |
|
1140 |
|
|
1141 |
return ($outputName, $digest); |
|
1142 |
} |
|
1143 |
|
|
1144 |
sub uploadData { |
|
1145 |
my $data = shift; |
|
1146 |
my $docid = shift; |
|
1147 |
|
|
1148 |
debug("Registry: Upload -- Starting upload of $docid"); |
|
1149 |
my $response = $metacat->upload($docid, $data); |
|
1150 |
if (!$response) { |
|
1151 |
my $uploadMsg = $metacat->getMessage(); |
|
1152 |
debug("Registry: Upload -- Error is: $uploadMsg"); |
|
1153 |
} else { |
|
1154 |
debug("Registry: Upload -- Success! New docid $docid"); |
|
1155 |
} |
|
1156 |
} |
|
1157 |
|
|
1158 |
|
|
989 | 1159 |
################################################################################ |
990 | 1160 |
# |
991 | 1161 |
# Create the XML document from the HTML form input |
... | ... | |
993 | 1163 |
# |
994 | 1164 |
################################################################################ |
995 | 1165 |
sub createXMLDocument { |
1166 |
#FIXME placeholder for $FORM element, should be determined by config |
|
996 | 1167 |
|
997 |
my $orig = ""; |
|
998 |
my $role = "associatedParty"; |
|
999 |
my $creat = ""; |
|
1000 |
my $metaP = ""; |
|
1001 |
my $apart = ""; |
|
1002 |
my $cont = ""; |
|
1003 |
my $publ = ""; |
|
1004 |
my $dso = ""; |
|
1005 |
my $gmt = gmtime($now); |
|
1168 |
if ($FORM::cfg eq "ebm") { |
|
1169 |
return createProjectDocument(); |
|
1170 |
} else { |
|
1171 |
return createDatasetDocument(); |
|
1172 |
} |
|
1173 |
} |
|
1006 | 1174 |
|
1175 |
sub createProjectDocument { |
|
1176 |
my $doc = EMLStart(); |
|
1007 | 1177 |
|
1178 |
$doc .= titleElement(); |
|
1179 |
$doc .= creatorNameElement(); |
|
1180 |
$doc .= creatorElement(); |
|
1181 |
|
|
1182 |
$doc .= pubElement(); |
|
1183 |
$doc .= setDisplayType('project'); |
|
1184 |
$doc .= keywordElement(); |
|
1185 |
$doc .= contactElement(); |
|
1186 |
|
|
1187 |
# putting everything else under project |
|
1188 |
$doc .= "<project>"; |
|
1189 |
$doc .= titleElement(); |
|
1190 |
my %originators = personnelCreate(); |
|
1191 |
$doc .= personnelList(\%originators, 'personnel'); |
|
1192 |
$doc .= abstractElement(); |
|
1193 |
$doc .= "<studyAreaDescription>\n"; |
|
1194 |
$doc .= coverageElement(); |
|
1195 |
$doc .= "</studyAreaDescription>\n"; |
|
1196 |
|
|
1197 |
$doc .= "</project>"; |
|
1198 |
$doc .= accessElement(); |
|
1199 |
$doc .= datasetEnd(); |
|
1200 |
$doc .= EMLEnd(); |
|
1201 |
return $doc; |
|
1202 |
} |
|
1203 |
|
|
1204 |
sub createDatasetDocument { |
|
1205 |
my $doc = EMLStart(); |
|
1206 |
$doc .= titleElement(); |
|
1207 |
$doc .= creatorElement(); |
|
1208 |
$doc .= contactElement('creator'); |
|
1209 |
my %originators = personnelCreate(); |
|
1210 |
$doc .= personnelList(\%originators, 'associatedParty'); |
|
1211 |
|
|
1212 |
$doc .= pubElement(); |
|
1213 |
$doc .= abstractElement(); |
|
1214 |
# $doc .= setDisplayType('dataset'); |
|
1215 |
$doc .= keywordElement(); |
|
1216 |
$doc .= distributionElement(); |
|
1217 |
$doc .= coverageElement(); |
|
1218 |
$doc .= contactElement(); |
|
1219 |
$doc .= methodsElement(); |
|
1220 |
$doc .= accessElement(); |
|
1221 |
my %fileData = allFileData(); |
|
1222 |
$doc .= entityElement(\%fileData); |
|
1223 |
$doc .= datasetEnd(); |
|
1224 |
$doc .= addMetaElement(\%fileData); |
|
1225 |
$doc .= EMLEnd(); |
|
1226 |
} |
|
1227 |
|
|
1228 |
# EML document creation functions |
|
1229 |
|
|
1230 |
sub personnelCreate { |
|
1231 |
# TODO: improve flow for personnel, associatedParty |
|
1232 |
# element name => objects of that type |
|
1233 |
my %orig = ( |
|
1234 |
'personnel' => [], |
|
1235 |
); |
|
1236 |
|
|
1237 |
push (@{$orig{personnel}}, [$FORM::providerGivenName, $FORM::providerSurName, 'Metadata Provider']); |
|
1238 |
|
|
1239 |
# Additional originators |
|
1240 |
foreach my $origName (param()) { |
|
1241 |
my $origNum = $origName; |
|
1242 |
$origNum =~ s/origNamelast//; # get the index of the parameter 0 to 10 |
|
1243 |
if ( $origNum =~ /^([0-9])$/) { |
|
1244 |
# do not generate EML for empty originator fields |
|
1245 |
if (hasContent(param("origNamefirst" . $origNum))) { |
|
1246 |
my $first = normalize(param("origNamefirst" . $origNum)); |
|
1247 |
my $last = normalize(param("origNamelast" . $origNum)); |
|
1248 |
my $origRole = param("origRole" . $origNum); |
|
1249 |
|
|
1250 |
push (@{$orig{personnel}}, [$first, $last, $origRole]); |
|
1251 |
} |
|
1252 |
} |
|
1253 |
} |
|
1254 |
return %orig |
|
1255 |
} |
|
1256 |
|
|
1257 |
sub personnelList { |
|
1258 |
my ($orig, $type) = @_; |
|
1259 |
my %orig = %$orig; |
|
1260 |
|
|
1261 |
my $elemList = ""; |
|
1262 |
|
|
1263 |
foreach my $v (@{$orig->{'personnel'}}) { |
|
1264 |
my ($first, $last, $role) = @$v; |
|
1265 |
my $elemRole = $type; |
|
1266 |
my $elem = "<individualName>\n"; |
|
1267 |
$elem .= "<givenName>".normalize($first)."</givenName>\n"; |
|
1268 |
$elem .= "<surName>".normalize($last)."</surName>\n"; |
|
1269 |
$elem .= "</individualName>\n"; |
|
1270 |
|
|
1271 |
if ($role eq "Originator") { |
|
1272 |
$elemRole = 'creator'; |
|
1273 |
} |
|
1274 |
elsif ($role eq "Metadata Provider") { |
|
1275 |
$elemRole = 'metadataProvider'; |
|
1276 |
} |
|
1277 |
elsif ($role eq "Publisher") { |
|
1278 |
$elemRole = 'publisher'; |
|
1279 |
} |
|
1280 |
else { |
|
1281 |
$elemRole = $type; |
|
1282 |
} |
|
1283 |
|
|
1284 |
if (($elemRole eq 'personnel') && ($FORM::origNameOrgContact) ) { |
|
1285 |
$elem .= "<organizationName>$FORM::origNameOrgContact</organizationName>\n"; |
|
1286 |
} |
|
1287 |
|
|
1288 |
if (($elemRole eq 'personnel') || ($elemRole eq 'associatedParty') ) { |
|
1289 |
$elem .= "<role>".normalize($role)."</role>\n"; |
|
1290 |
} |
|
1291 |
|
|
1292 |
$elemList .= "<$elemRole>\n$elem</$elemRole>\n"; |
|
1293 |
} |
|
1294 |
return $elemList; |
|
1295 |
} |
|
1296 |
|
|
1297 |
sub entityElement() { |
|
1298 |
my $entityObjects = shift; |
|
1299 |
my %entityObjects = %$entityObjects; |
|
1300 |
my $entityList = ""; |
|
1301 |
|
|
1302 |
while ( my ($docid, $data) = each(%entityObjects) ) { |
|
1303 |
my $entityStub = qq|<otherEntity id="$data->{'entityid'}" scope="document"> |
|
1304 |
<entityName>$data->{'fileName'}</entityName> |
|
1305 |
<physical scope="document"> |
|
1306 |
<objectName>$data->{'fileName'}</objectName> |
|
1307 |
<size>$data->{'fileSize'}</size> |
|
1308 |
<authentication method="SHA1">$data->{'fileHash'}</authentication> |
|
1309 |
<dataFormat> |
|
1310 |
<externallyDefinedFormat> |
|
1311 |
<formatName>$data->{'contentType'}</formatName> |
|
1312 |
</externallyDefinedFormat> |
|
1313 |
</dataFormat> |
|
1314 |
<distribution id="$data->{'distribid'}" scope="document"> |
|
1315 |
<online> |
|
1316 |
<url function="download">$data->{'url'}</url> |
|
1317 |
</online> |
|
1318 |
</distribution> |
|
1319 |
</physical> |
|
1320 |
<entityType>$data->{'entityType'}</entityType> |
|
1321 |
</otherEntity> |
|
1322 |
|; |
|
1323 |
$entityList .= $entityStub; |
|
1324 |
} |
|
1325 |
|
|
1326 |
return $entityList; |
|
1327 |
} |
|
1328 |
|
|
1329 |
sub addMetaElement() { |
|
1330 |
my $entityObjects = shift; |
|
1331 |
my %entityObjects = %$entityObjects; |
|
1332 |
my $accessList = ""; |
|
1333 |
|
|
1334 |
while ( my ($docid, $data) = each(%entityObjects) ) { |
|
1335 |
my $accessStub = qq|<additionalMetadata> |
|
1336 |
<describes>$data->{'distribid'}</describes> |
|
1337 |
<access authSystem="knb" order="allowFirst"> |
|
1338 |
<deny> |
|
1339 |
<principal>public</principal> |
|
1340 |
<permission>read</permission> |
|
1341 |
</deny> |
|
1342 |
</access> |
|
1343 |
</additionalMetadata> |
|
1344 |
|; |
|
1345 |
$accessList .= $accessStub; |
|
1346 |
} |
|
1347 |
|
|
1348 |
return $accessList; |
|
1349 |
} |
|
1350 |
|
|
1351 |
sub keywordElement() { |
|
1352 |
my %kwSet, my $kwList = (), ""; |
|
1353 |
|
|
1354 |
# process the standard keywords |
|
1355 |
foreach my $kwName (param()) { |
|
1356 |
my $kwNum = $kwName; |
|
1357 |
$kwNum =~ s/keyword//; # get the index of the parameter 0, ..., 10 |
|
1358 |
if ( $kwNum =~ /^([0-9])$/ ){ |
|
1359 |
# don't generate xml for empty keyword fields |
|
1360 |
# don't generate taxonomic keyword fields, those go in taxonomic coverage |
|
1361 |
if (hasContent(param($kwName))) { |
|
1362 |
my $kwType = param("kwType" . $kwNum); |
|
1363 |
my $kwTh = param("kwTh" . $kwNum); |
|
1364 |
my $kw = param("keyword" . $kwNum); |
|
1365 |
|
|
1366 |
push(@{$kwSet{$kwTh}}, [$kw, $kwType]); |
|
1367 |
} |
|
1368 |
} |
|
1369 |
} |
|
1370 |
|
|
1371 |
# output keyword lists |
|
1372 |
while ((my $thesaurus, my $a_ref) = each %kwSet) { |
|
1373 |
my $kwElem .= "<keywordSet>\n"; |
|
1374 |
|
|
1375 |
foreach my $x (@$a_ref) { |
|
1376 |
my ($kw, $kwType) = @$x; |
|
1377 |
$kwElem .= "<keyword "; |
|
1378 |
if (hasContent($kwType) && $kwType != "None") { |
|
1379 |
$kwElem.= "keywordType=\"".lc($kwType)."\""; |
|
1380 |
} |
|
1381 |
$kwElem .= ">$kw</keyword>\n"; |
|
1382 |
} |
|
1383 |
|
|
1384 |
$kwElem .= "<keywordThesaurus>".normalize($thesaurus)."</keywordThesaurus>\n"; |
|
1385 |
$kwElem .= "</keywordSet>\n"; |
|
1386 |
$kwList .= $kwElem; |
|
1387 |
} |
|
1388 |
return $kwList; |
|
1389 |
} |
|
1390 |
|
|
1391 |
sub EMLStart() { |
|
1392 |
my $gmt = gmtime($now); |
|
1008 | 1393 |
my $doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; |
1009 | 1394 |
|
1010 |
$doc .= "<eml:eml\n
|
|
1011 |
\t packageId=\"docid\" system=\"knb\"\n
|
|
1012 |
\t xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.1\"\n
|
|
1013 |
\t xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n
|
|
1014 |
\t xmlns:ds=\"eml://ecoinformatics.org/dataset-2.0.1\"\n
|
|
1015 |
\t xmlns:stmml=\"http://www.xml-cml.org/schema/stmml\"\n
|
|
1016 |
\t xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.1 eml.xsd\">\n";
|
|
1395 |
$doc .= "<eml:eml |
|
1396 |
packageId=\"docid\" system=\"knb\"
|
|
1397 |
xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.1\"
|
|
1398 |
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
|
|
1399 |
xmlns:ds=\"eml://ecoinformatics.org/dataset-2.0.1\"
|
|
1400 |
xmlns:stmml=\"http://www.xml-cml.org/schema/stmml\"
|
|
1401 |
xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.1 eml.xsd\">\n"; |
|
1017 | 1402 |
|
1018 | 1403 |
$doc .= "<!-- Person who filled in the catalog entry form: "; |
1019 | 1404 |
$doc .= normalize($FORM::providerGivenName)." ".normalize($FORM::providerSurName)." -->\n"; |
1020 | 1405 |
$doc .= "<!-- Form filled out at $gmt GMT -->\n"; |
1021 | 1406 |
$doc .= "<dataset>\n"; |
1022 |
|
|
1407 |
|
|
1023 | 1408 |
if (hasContent($FORM::identifier)) { |
1024 | 1409 |
$doc .= "<alternateIdentifier system=\"$FORM::site\">"; |
1025 | 1410 |
$doc .= normalize($FORM::identifier) . "</alternateIdentifier>\n"; |
1026 | 1411 |
} |
1027 |
|
|
1412 |
return $doc; |
|
1413 |
} |
|
1414 |
|
|
1415 |
sub EMLEnd() { |
|
1416 |
return "</eml:eml>\n"; |
|
1417 |
} |
|
1418 |
|
|
1419 |
sub datasetEnd() { |
|
1420 |
return "</dataset>\n"; |
|
1421 |
} |
|
1422 |
|
|
1423 |
sub setDisplayType { |
|
1424 |
my $kwDisp = shift; |
|
1425 |
if (!$kwDisp) { |
|
1426 |
$kwDisp = 'dataset'; |
|
1427 |
} |
|
1428 |
my $kw = "<keywordSet>\n"; |
|
1429 |
$kw .= " <keyword>$kwDisp</keyword>\n"; |
|
1430 |
$kw .= " <keywordThesaurus>EMLDisplayType</keywordThesaurus>\n"; |
|
1431 |
$kw .= "</keywordSet>\n"; |
|
1432 |
return $kw; |
|
1433 |
} |
|
1434 |
|
|
1435 |
sub pubElement() { |
|
1436 |
#add the publication Date to the eml document. |
|
1437 |
my ($Day, $Month, $Year) = (localtime)[3,4,5]; |
|
1438 |
|
|
1439 |
return "<pubDate>".sprintf("%03d-%02d-%02d", $Year + 1900, $Month + 1, $Day)."</pubDate>\n"; |
|
1440 |
} |
|
1441 |
|
|
1442 |
sub titleElement() { |
|
1028 | 1443 |
if (hasContent($FORM::title)) { |
1029 |
$doc .= "<title>".normalize($FORM::title)."</title>\n";
|
|
1444 |
return "<title>".normalize($FORM::title)."</title>\n";
|
|
1030 | 1445 |
} |
1446 |
} |
|
1031 | 1447 |
|
1032 |
if (hasContent($FORM::origNamelast0)) { |
|
1033 |
$role = "creator"; |
|
1034 |
$orig .= "<individualName>\n"; |
|
1035 |
$orig .= "<givenName>".normalize($FORM::origNamefirst0)."</givenName>\n"; |
|
1036 |
$orig .= "<surName>".normalize($FORM::origNamelast0)."</surName>\n"; |
|
1037 |
$orig .= "</individualName>\n"; |
|
1448 |
sub abstractElement() { |
|
1449 |
return "<abstract>\n<para>".normalize($FORM::abstract)."</para>\n</abstract>\n"; |
|
1450 |
} |
|
1451 |
|
|
1452 |
sub creatorElement() { |
|
1453 |
my $creators; |
|
1454 |
if ($FORM::cfg eq 'nceas') { |
|
1455 |
for (my $i = 0; $i < scalar(@FORM::wg); $i++) { |
|
1456 |
$creators .= creatorNode($FORM::wg[$i]); |
|
1457 |
} |
|
1458 |
} else { |
|
1459 |
$creators .= creatorNode($FORM::site); |
|
1038 | 1460 |
} |
1461 |
if ($FORM::cfg ne 'knb') { |
|
1462 |
$creators .= creatorNode(); |
|
1463 |
} |
|
1039 | 1464 |
|
1040 |
if (hasContent($FORM::origNameOrg)) { |
|
1041 |
$orig .= "<organizationName>".normalize($FORM::origNameOrg)."</organizationName>\n"; |
|
1465 |
return $creators; |
|
1466 |
} |
|
1467 |
|
|
1468 |
sub creatorNode { |
|
1469 |
my $org = shift; |
|
1470 |
my $content = ""; |
|
1471 |
|
|
1472 |
if (!hasContent($org)) { |
|
1473 |
$content = $organization; |
|
1474 |
} else { |
|
1475 |
$content = $org; |
|
1042 | 1476 |
} |
1043 | 1477 |
|
1044 |
if (hasContent($FORM::origDelivery) || hasContent($FORM::origCity) || |
|
1045 |
(hasContent($FORM::origState ) && |
|
1046 |
($FORM::origState !~ "Select state here.")) || |
|
1047 |
hasContent($FORM::origStateOther) || |
|
1048 |
hasContent($FORM::origZIP ) || hasContent($FORM::origCountry)) { |
|
1049 |
$orig .= "<address>\n"; |
|
1478 |
return |
|
1479 |
"<creator>\n<organizationName>".normalize($content)."</organizationName>\n</creator>\n"; |
|
1480 |
} |
|
1050 | 1481 |
|
1051 |
if (hasContent($FORM::origDelivery)) {
|
|
1052 |
$orig .= "<deliveryPoint>".normalize($FORM::origDelivery)."</deliveryPoint>\n";
|
|
1053 |
}
|
|
1054 |
if (hasContent($FORM::origCity)) {
|
|
1055 |
$orig .= "<city>".normalize($FORM::origCity)."</city>\n";
|
|
1056 |
}
|
|
1482 |
sub creatorNameElement {
|
|
1483 |
my $role = shift;
|
|
1484 |
my $creator;
|
|
1485 |
if (!hasContent($role)) {
|
|
1486 |
$role ="creator";
|
|
1487 |
} |
|
1057 | 1488 |
|
1058 |
if (hasContent($FORM::origState) && |
|
1059 |
($FORM::origState !~ "Select state here.")) { |
|
1060 |
$orig .= "<administrativeArea>".normalize($FORM::origState); |
|
1061 |
$orig .= "</administrativeArea>\n"; |
|
1062 |
} elsif (hasContent($FORM::origStateOther)) { |
|
1063 |
$orig .= "<administrativeArea>".normalize($FORM::origStateOther); |
|
1064 |
$orig .= "</administrativeArea>\n"; |
|
1489 |
$creator .= "<individualName>\n"; |
|
1490 |
$creator .= "<givenName>".normalize($FORM::origNamefirst0)."</givenName>\n"; |
|
1491 |
$creator .= "<surName>".normalize($FORM::origNamelast0)."</surName>\n"; |
|
1492 |
$creator .= "</individualName>\n"; |
|
1493 |
|
|
1494 |
return "<$role>\n$creator</$role>\n" |
|
1495 |
} |
|
1496 |
|
|
1497 |
sub methodsElement() { |
|
1498 |
my $methods = ""; |
|
1499 |
if ((hasContent($FORM::methodTitle)) || scalar(@FORM::methodsPara) > 0 || ($FORM::methodPara[0] ne "")) { |
|
1500 |
$methods = "<methods><methodStep><description><section>\n"; |
|
1501 |
if (hasContent($FORM::methodTitle)) { |
|
1502 |
$methods .= "<title>".normalize($FORM::methodTitle)."</title>\n"; |
|
1065 | 1503 |
} |
1066 |
if (hasContent($FORM::origZIP)) {
|
|
1067 |
$orig .= "<postalCode>".normalize($FORM::origZIP)."</postalCode>\n";
|
|
1504 |
for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
|
|
1505 |
$methods .= "<para>".normalize($FORM::methodPara[$i])."</para>\n";
|
|
1068 | 1506 |
} |
1069 |
if (hasContent($FORM::origCountry)) { |
|
1070 |
$orig .= "<country>".normalize($FORM::origCountry)."</country>\n"; |
|
1507 |
$methods .= "</section></description></methodStep>\n"; |
|
1508 |
if (hasContent($FORM::studyExtentDescription)) { |
|
1509 |
$methods .= "<sampling><studyExtent><description>\n"; |
|
1510 |
$methods .= "<para>".normalize($FORM::studyExtentDescription)."</para>\n"; |
|
1511 |
$methods .= "</description></studyExtent>\n"; |
|
1512 |
$methods .= "<samplingDescription>\n"; |
|
1513 |
$methods .= "<para>".normalize($FORM::samplingDescription)."</para>\n"; |
|
1514 |
$methods .= "</samplingDescription>\n"; |
|
1515 |
$methods .= "</sampling>\n"; |
|
1071 | 1516 |
} |
1072 |
$orig .= "</address>\n";
|
|
1517 |
$methods .= "</methods>\n";
|
|
1073 | 1518 |
} |
1519 |
return $methods |
|
1520 |
} |
|
1074 | 1521 |
|
1075 |
if (hasContent($FORM::origPhone)) { |
|
1076 |
$orig .= "<phone>".normalize($FORM::origPhone)."</phone>\n"; |
|
1077 |
} |
|
1078 |
if (hasContent($FORM::origFAX)) { |
|
1079 |
$orig .= "<phone phonetype=\"Fax\">".normalize($FORM::origFAX)."</phone>\n"; |
|
1080 |
} |
|
1081 |
if (hasContent($FORM::origEmail)) { |
|
1082 |
$orig .= "<electronicMailAddress>".normalize($FORM::origEmail); |
|
1083 |
$orig .= "</electronicMailAddress>\n"; |
|
1084 |
} |
|
1085 |
$dso = "<$role>\n$orig</$role>\n"; |
|
1086 |
|
|
1087 |
if ($FORM::cfg eq 'nceas') { |
|
1088 |
for (my $i = 0; $i < scalar(@FORM::wg); $i++) { |
|
1089 |
$creat .= "<creator>\n"; |
|
1090 |
$creat .= "<organizationName>".normalize($FORM::wg[$i])."</organizationName>\n"; |
|
1091 |
$creat .= "</creator>\n"; |
|
1092 |
} |
|
1093 |
} else { |
|
1094 |
$creat .= "<creator>\n"; |
|
1095 |
$creat .= "<organizationName>".normalize($FORM::site)."</organizationName>\n"; |
|
1096 |
$creat .= "</creator>\n"; |
|
1097 |
} |
|
1522 |
sub contactElement() { |
|
1523 |
my $role = shift; |
|
1524 |
my $cont = ""; |
|
1098 | 1525 |
|
1099 |
if ($FORM::cfg ne 'knb') { |
|
1100 |
$creat .= "<creator>\n"; |
|
1101 |
$creat .= "<organizationName>".normalize($organization)."</organizationName>\n"; |
|
1102 |
$creat .= "</creator>\n"; |
|
1526 |
if (!hasContent($role)) { |
|
1527 |
$role = 'contact'; |
|
1103 | 1528 |
} |
1104 | 1529 |
|
1105 |
$creat .= $dso; |
|
1530 |
$cont .= "<individualName>\n"; |
|
1531 |
$cont .= "<givenName>".normalize($FORM::origNamefirstContact)."</givenName>\n"; |
|
1532 |
$cont .= "<surName>".normalize($FORM::origNamelastContact)."</surName>\n"; |
|
1533 |
$cont .= "</individualName>\n"; |
|
1106 | 1534 |
|
1107 |
if ($FORM::useOrigAddress) { |
|
1108 |
# Add a contact originator like the original with a different role |
|
1109 |
$cont .= "<contact>\n"; |
|
1110 |
$cont .= $orig; |
|
1111 |
$cont .= "</contact>\n"; |
|
1112 |
} else { |
|
1113 |
$cont .= "<contact>\n"; |
|
1114 |
|
|
1115 |
$cont .= "<individualName>\n"; |
|
1116 |
$cont .= "<givenName>".normalize($FORM::origNamefirstContact)."</givenName>\n"; |
|
1117 |
$cont .= "<surName>".normalize($FORM::origNamelastContact)."</surName>\n"; |
|
1118 |
$cont .= "</individualName>\n"; |
|
1119 |
|
|
1120 | 1535 |
if (hasContent($FORM::origNameOrgContact)) { |
1121 | 1536 |
$cont .= "<organizationName>".normalize($FORM::origNameOrgContact)."</organizationName>\n"; |
1122 | 1537 |
} |
1123 | 1538 |
|
1124 |
if (hasContent($FORM::origDeliveryContact) || |
|
1125 |
hasContent($FORM::origCityContact) || |
|
1126 |
(hasContent($FORM::origStateContact) && |
|
1127 |
($FORM::origStateContact !~ "Select state here.")) || |
|
1128 |
hasContent($FORM::origStateOtherContact) || |
|
1129 |
hasContent($FORM::origZIPContact) || |
|
1130 |
hasContent($FORM::origCountryContact)) { |
|
1131 |
$cont .= "<address>\n"; |
|
1132 |
if (hasContent($FORM::origDeliveryContact)) { |
|
1133 |
$cont .= "<deliveryPoint>".normalize($FORM::origDeliveryContact); |
|
1134 |
$cont .= "</deliveryPoint>\n"; |
|
1135 |
} |
|
1136 |
if (hasContent($FORM::origCityContact)) { |
|
1137 |
$cont .= "<city>".normalize($FORM::origCityContact)."</city>\n"; |
|
1138 |
} |
|
1139 |
if (hasContent($FORM::origStateContact) && |
|
1140 |
($FORM::origStateContact !~ "Select state here.")) { |
|
1141 |
$cont .= "<administrativeArea>".normalize($FORM::origStateContact); |
|
1142 |
$cont .= "</administrativeArea>\n"; |
|
1143 |
} elsif (hasContent($FORM::origStateOtherContact)) { |
|
1144 |
$cont .= "<administrativeArea>".normalize($FORM::origStateOtherContact); |
|
1145 |
$cont .= "</administrativeArea>\n"; |
|
1146 |
} |
|
1147 |
if (hasContent($FORM::origZIPContact)) { |
|
1148 |
$cont .= "<postalCode>".normalize($FORM::origZIPContact)."</postalCode>\n"; |
|
1149 |
} |
|
1150 |
if (hasContent($FORM::origCountryContact)) { |
|
1151 |
$cont .= "<country>".normalize($FORM::origCountryContact)."</country>\n"; |
|
1152 |
} |
|
1153 |
$cont .= "</address>\n"; |
|
1539 |
if (hasContent($FORM::origDeliveryContact) || |
|
1540 |
hasContent($FORM::origCityContact) || |
|
1541 |
(hasContent($FORM::origStateContact) && |
|
1542 |
($FORM::origStateContact !~ "Select state here.")) || |
|
1543 |
hasContent($FORM::origStateOtherContact) || |
|
1544 |
hasContent($FORM::origZIPContact) || |
|
1545 |
hasContent($FORM::origCountryContact)) { |
|
1546 |
$cont .= "<address>\n"; |
|
1547 |
if (hasContent($FORM::origDeliveryContact)) { |
|
1548 |
$cont .= "<deliveryPoint>".normalize($FORM::origDeliveryContact); |
|
1549 |
$cont .= "</deliveryPoint>\n"; |
|
1154 | 1550 |
} |
1155 |
if (hasContent($FORM::origPhoneContact)) {
|
|
1156 |
$cont .= "<phone>".normalize($FORM::origPhoneContact)."</phone>\n";
|
|
1551 |
if (hasContent($FORM::origCityContact)) {
|
|
1552 |
$cont .= "<city>".normalize($FORM::origCityContact)."</city>\n";
|
|
1157 | 1553 |
} |
1554 |
if (hasContent($FORM::origStateContact) && |
|
1555 |
($FORM::origStateContact !~ "Select state here.")) { |
|
1556 |
$cont .= "<administrativeArea>".normalize($FORM::origStateContact); |
|
1557 |
$cont .= "</administrativeArea>\n"; |
|
1558 |
} elsif (hasContent($FORM::origStateOtherContact)) { |
|
1559 |
$cont .= "<administrativeArea>".normalize($FORM::origStateOtherContact); |
|
1560 |
$cont .= "</administrativeArea>\n"; |
|
1561 |
} |
|
1562 |
if (hasContent($FORM::origZIPContact)) { |
|
1563 |
$cont .= "<postalCode>".normalize($FORM::origZIPContact)."</postalCode>\n"; |
|
1564 |
} |
|
1565 |
if (hasContent($FORM::origCountryContact)) { |
|
1566 |
$cont .= "<country>".normalize($FORM::origCountryContact)."</country>\n"; |
|
1567 |
} |
|
1568 |
$cont .= "</address>\n"; |
|
1569 |
} |
|
1570 |
if (hasContent($FORM::origPhoneContact)) { |
|
1571 |
$cont .= "<phone>".normalize($FORM::origPhoneContact)."</phone>\n"; |
|
1572 |
} |
|
1158 | 1573 |
if (hasContent($FORM::origFAXContact)) { |
1159 | 1574 |
$cont .= "<phone phonetype=\"Fax\">".normalize($FORM::origFAXContact)."</phone>\n"; |
Also available in: Unified diff
Added submission of data files to the registry. New parameter 'hasUpload' can be set on a per-skin basis to enable the uploading of data objects to be associated with a metadata document. NCEAS skin is using this by default, to be changed in the future for other skins.
Refactored XML creation in register-dataset.cgi to use function stubs, to allow us flexibility in document creation.