Index: lib/style/skins/sanparks/sanparks.cfg
===================================================================
--- lib/style/skins/sanparks/sanparks.cfg	(revision 5310)
+++ lib/style/skins/sanparks/sanparks.cfg	(nonexistent)
@@ -1,38 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=knpadmin,o=SANParks,dc=ecoinformatics,dc=org
-password = testme
-ldapUrl = @ldapUrl@
-defaultScope = knp
-organization = Kruger National Park
-orgabbrev = KNP
-orgurl = http://www.sanparks.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-spatialRequired = false
-temporalRequired = false
-showSiteList = 'false'
-showWgList = 'false'
-hasUpload = 'true'
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = somewhere.sanparks.org
-sender = registry@sanparks.org
-recipient = judithk@sanparks.org
-adminname = Judith Kruger
-debug = 0
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-# example format ...
-# lat [UK] Harwood forest[Sitka Spruce] = 55:12:46:N
-# lon [UK] Harwood forest[Sitka Spruce] = 2:2:15:W

Property changes on: lib/style/skins/sanparks/sanparks.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/kepler/kepler.cfg
===================================================================
--- lib/style/skins/kepler/kepler.cfg	(revision 5310)
+++ lib/style/skins/kepler/kepler.cfg	(nonexistent)
@@ -1,28 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org
-password = kepler
-ldapUrl = @ldapUrl@
-defaultScope = kepler
-organization = Kepler
-orgabbrev = Kepler
-orgurl = http://www.kepler-project.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-spatialRequired = false
-temporalRequired = false
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = mail.nceas.ucsb.edu
-sender = kepler@kepler-project.org
-recipient = kepler-users@ecoinformatics.org
-adminname = Chad Berkley
-debug = 0
-

Property changes on: lib/style/skins/kepler/kepler.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/parc/parc.cfg
===================================================================
--- lib/style/skins/parc/parc.cfg	(revision 5310)
+++ lib/style/skins/parc/parc.cfg	(nonexistent)
@@ -1,39 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=parcadmin,o=PARC,dc=ecoinformatics,dc=org
-password = mgr4parc
-ldapUrl=@ldapUrl@
-defaultScope = parc
-organization = Palmyra Atoll Research Consortium
-orgabbrev = PARC
-orgurl = http://www.palmyraresearch.org
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@
-sender = PARC Data Repository <cjones@msi.ucsb.edu>
-recipient = cjones@msi.ucsb.edu
-adminname = the repository administrator
-debug = 1
-lsite = 'project'
-usite = 'Project'
-showSiteList = 'false'
-showWgList = 'true'
-showOrganization = 'false'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-hasUpload = 'true'
-nceas_db = //hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
-nceas_db_user = admowner
-nceas_db_password = your-pw-goes-here

Property changes on: lib/style/skins/parc/parc.cfg
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: lib/style/skins/ltss/ltss.cfg
===================================================================
--- lib/style/skins/ltss/ltss.cfg	(revision 5310)
+++ lib/style/skins/ltss/ltss.cfg	(nonexistent)
@@ -1,35 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=esaadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = ltss
-organization = Long-term Studies Section
-orgabbrev = LTSS
-orgurl = http://www.esa.org/longterm/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = hyperion.nceas.ucsb.edu
-sender = LTSS Data Registry <esaadmin@nceas.ucsb.edu>
-recipient = esaadmin@nceas.ucsb.edu
-adminname = the Registry Administrator
-debug = 0
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'false'
-showWgList = 'false'
-showOrganization = 'true'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'

Property changes on: lib/style/skins/ltss/ltss.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/first/first.cfg
===================================================================
--- lib/style/skins/first/first.cfg	(revision 5310)
+++ lib/style/skins/first/first.cfg	(nonexistent)
@@ -1,38 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@server@@servlet-path@
-username = uid=knbadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = knb
-organization = Knowledge Network for Biocomplexity
-orgabbrev = KNB
-orgurl = http://knb.ecoinformatics.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@ 
-sender = KNB Data Registry <help@nceas.ucsb.edu>
-recipient = help@nceas.ucsb.edu
-adminname = the repository administrator
-debug = 1
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'false'
-showWgList = 'false'
-showOrganization = 'true'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-nceas_db = somedb
-nceas_db_user = someuser
-nceas_db_password = your-pw-goes-here

Property changes on: lib/style/skins/first/first.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/nceas/nceas.cfg
===================================================================
--- lib/style/skins/nceas/nceas.cfg	(revision 5310)
+++ lib/style/skins/nceas/nceas.cfg	(nonexistent)
@@ -1,39 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=nceasadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = nceas
-organization = National Center for Ecological Analysis and Synthesis
-orgabbrev = NCEAS
-orgurl = http://www.nceas.ucsb.edu/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@
-sender = NCEAS Data Repository <help@nceas.ucsb.edu>
-recipient = help@nceas.ucsb.edu
-adminname = the repository administrator
-debug = 1
-lsite = 'project'
-usite = 'Project'
-showSiteList = 'false'
-showWgList = 'true'
-showOrganization = 'false'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-hasUpload = 'true'
-nceas_db = //hyperion.nceas.ucsb.edu:1521/nceasp.nceas.ucsb.edu
-nceas_db_user = admowner
-nceas_db_password = your-pw-goes-here

Property changes on: lib/style/skins/nceas/nceas.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/obfs/obfs.cfg
===================================================================
--- lib/style/skins/obfs/obfs.cfg	(revision 5310)
+++ lib/style/skins/obfs/obfs.cfg	(nonexistent)
@@ -1,561 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=obfsadmin,o=LTER,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = obfs
-organization = Organization of Biological Field Stations
-orgabbrev = OBFS
-orgurl = http://www.obfs.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@
-sender = OBFS Data Registry <obfsadmin@lternet.edu>
-recipient = stromberg@berkeley.edu
-adminname = Mark Stromberg
-debug = 0
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'true'
-showWgList = 'false'
-showOrganization = 'false'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-lat (AK) Toolik Field Station = 68:38:0:N
-lon (AK) Toolik Field Station = 149:43:0:W
-lat (AR) Ouachita Mountains Biological Station = 34:26:56.4:N
-lon (AR) Ouachita Mountains Biological Station = 94:0:32.4:W
-lat (AZ) Appleton-Whittell Research Ranch = 31:35:27.6:N
-lon (AZ) Appleton-Whittell Research Ranch = 110:30:21.6:W
-lat (AZ) Desert Station = 32:14:2.4:N
-lon (AZ) Desert Station = 111:9:3.6:W
-lat (AZ) Intercultural Center for Study of Deserts and Oceans = 31:12:0:N
-lon (AZ) Intercultural Center for Study of Deserts and Oceans = 113:19:48:W
-lat (AZ) Merriam-Powel Center for Environmental Research = 35:10:0:N
-lon (AZ) Merriam-Powel Center for Environmental Research = 111:45:0:W
-lat (AZ) Northern Arizona University Centennial Forest = 35:11:53:N
-lon (AZ) Northern Arizona University Centennial Forest = 111:39:2:W
-lat (AZ) Rincon Institute = 32:5:9.6:N
-lon (AZ) Rincon Institute = 110:42:39.6:W
-lat (AZ) Sierra Ancha Station = 33:40:58.8:N
-lon (AZ) Sierra Ancha Station = 110:58:1.2:W
-lat (AZ) Sonoran Arthropod Studies Institute = 32:7:45:N
-lon (AZ) Sonoran Arthropod Studies Institute = 111:14:31:W
-lat (AZ) Southwestern Research Station = 31:53:2.4:N
-lon (AZ) Southwestern Research Station = 109:12:28.8:W
-lat (AZ) Walnut Creek Center for Education and Research = 34:55:22:N
-lon (AZ) Walnut Creek Center for Education and Research = 112:50:38:W
-lat (CA) Ano Nuevo Island Reserve  = 37:6:30:N
-lon (CA) Ano Nuevo Island Reserve  = 122:20:10:W
-lat (CA) Bernard Biological Field Station (Claremont Colleges) = 34:06:36:N
-lon (CA) Bernard Biological Field Station (Claremont Colleges) = 117:42:32:W
-lat (CA) Blodgett Forest Research Station = 38:54:0:N
-lon (CA) Blodgett Forest Research Station = 120:36:0:W
-lat (CA) Bodega Bay Marine Laboratory and Reserve = 38:19:3:N
-lon (CA) Bodega Bay Marine Laboratory and Reserve = 123:4:12:W
-lat (CA) Boyd Deep Canyon Desert Research Center = 33:43:19.2:N
-lon (CA) Boyd Deep Canyon Desert Research Center = 116:23:2.4:W
-lat (CA) Coal Oil Point Reserve = 34:25:00:N
-lon (CA) Coal Oil Point Reserve = 119:52:30:W
-lat (CA) Dawson Los Monos Canyon Reserve = 33:8:31.2:N
-lon (CA) Dawson Los Monos Canyon Reserve = 117:15:21.6:W
-lat (CA) Desert Studies Center = 35:35:20.4:N
-lon (CA) Desert Studies Center = 116:21:18.:W
-lat (CA) Eagle Lake Biological Field Station = 40:37:1.2:N
-lon (CA) Eagle Lake Biological Field Station = 120:43:37.2:W
-lat (CA) Field Research Station, Gazos Creek = 37:11.1:N
-lon (CA) Field Research Station, Gazos Creek = 122:17:25:W
-lat (CA) Fortuna Mountain Research Reserve = 32:50:38.4:N
-lon (CA) Fortuna Mountain Research Reserve = 117:3:21.6:W
-lat (CA) Hastings Natural History Reservation = 36:23:14.9:N
-lon (CA) Hastings Natural History Reservation = 121:33:05:W
-lat (CA) Hopkins Marine Station = 36:37:15.6:N
-lon (CA) Hopkins Marine Station = 121:54:10.8:W
-lat (CA) James San Jacinto Mountains Reserve = 33:48:28.8:N
-lon (CA) James San Jacinto Mountains Reserve = 116:46:40.8:W
-lat (CA) Jasper Ridge Biological Preserve = 37:24:0.:N
-lon (CA) Jasper Ridge Biological Preserve = 122:13:30.:W
-lat (CA) Kendall Frost Marsh Reserve = 32:47:34.8:N
-lon (CA) Kendall Frost Marsh Reserve = 117:13:1.2:W
-lat (CA) Landels-Hill Big Creek Reserve = 36:4:12.:N
-lon (CA) Landels-Hill Big Creek Reserve = 121:35:56.4:W
-lat (CA) Long Marine Laboratory = 36:56:52.8:N
-lon (CA) Long Marine Laboratory = 122:3:50.4:W
-lat (CA) McLaughlin Reserve = 38:52:26:N  
-lon (CA) McLaughlin Reserve = 122:25:54:W
-lat (CA) Moss Landing Marine Laboratory = 36:48:0.:N
-lon (CA) Moss Landing Marine Laboratory = 121:47:16.8:W
-lat (CA) Palomarin Field Station = 37:56:0:N 
-lon (CA) Palomarin Field Station = 122:44:0:W
-lat (CA) Pepperwood Ranch Natural Preserve = 38:34:4.8:N
-lon (CA) Pepperwood Ranch Natural Preserve = 122:42:3.6:W
-lat (CA) Quail Ridge Reserve = 38:49:4:N  
-lon (CA) Quail Ridge Reserve = 122:14:28:W
-lat (CA) Sagehen Creek Field Station = 39:25:54:N
-lon (CA) Sagehen Creek Field Station = 120:14:27:W
-lat (CA) Santa Cruz Island Reserve = 34:4:4.8:N
-lon (CA) Santa Cruz Island Reserve = 119:43:4.8:W
-lat (CA) Scripps Coastal Reserve = 32:52:30.:N
-lon (CA) Scripps Coastal Reserve = 117:15:14.4:W
-lat (CA) Santa Margarita Biological Field Station = 33:27:28.8:N
-lon (CA) Santa Margarita Biological Field Station = 117:10:1.2:W
-lat (CA) Sedgwick Reserve = 34:40:4.8:N
-lon (CA) Sedgwick Reserve = 120:6:50.4:W
-lat (CA) Sierra Nevada Aquatic Research Lab = 37:36:51:N
-lon (CA) Sierra Nevada Aquatic Research Lab = 118:49:47:W
-lat (CA) Sierra Nevada Field Campus = 39:35:16.8:N
-lon (CA) Sierra Nevada Field Campus = 120:25:44.4:W
-lat (CA) Sky Oaks Field Station = 33:22:37.2:N
-lon (CA) Sky Oaks Field Station = 116:37:22.8:W
-lat (CA) Starr Ranch Sanctuary = 33:37:44.4:N
-lon (CA) Starr Ranch Sanctuary = 117:33:10.8:W
-lat (CA) Stebbins Cold Canyon Reserve = 38:30:32:N 
-lon (CA) Stebbins Cold Canyon Reserve = 122:5:50:W
-lat (CA) Stunt Ranch Santa Monica Mountains Reserve = 34:6:0:N
-lon (CA) Stunt Ranch Santa Monica Mountains Reserve = 118:39:0:W
-lat (CA) Sweeney Granite Mountains Desert Research Center = 34:48:21.6:N
-lon (CA) Sweeney Granite Mountains Desert Research Center = 115:39:50.4:W
-lat (CA) Teakettle Experimental Forest = 36:58:0:N
-lon (CA) Teakettle Experimental Forest = 119:2:0:W
-lat (CA) Valentine Eastern Sierra Reserve = 37:37:30:N
-lon (CA) Valentine Eastern Sierra Reserve = 118:59:30:W
-lat (CA) White Mountain Research Station = 37:21:40:N
-lon (CA) White Mountain Research Station = 118:19:35:W
-lat (CA) Wrigley Marine Science Center = 33:25:58.8:N
-lon (CA) Wrigley Marine Science Center = 118:30:0:W
-lat (CO) Catamount Environmental Institute = 38:55:0:N
-lon (CO) Catamount Environmental Institute = 105:6:0:W
-lat (CO) Mountain Research Station = 40:6:0:N
-lon (CO) Mountain Research Station = 105:29:24.:W
-lat (CO) Mountain Studies Institute = 37:48:39:N
-lon (CO) Mountain Studies Institute = 107:39:50:W
-lat (CO) Rocky Mountain Biological Laboratory = 38:57:32.4:N
-lon (CO) Rocky Mountain Biological Laboratory = 106:59:20.4:W
-lat (CO) Shortgrass Steppe LTER Site = 40:42:36.:N
-lon (CO) Shortgrass Steppe LTER Site = 104:46:48.:W
-lat (CT) Trinity College Field Station = 41:49:58.8:N
-lon (CT) Trinity College Field Station = 72:10:8.4:W
-lat (FL) Archbold Biological Station = 27:11:16.8:N
-lon (FL) Archbold Biological Station = 81:20:16.8:W
-lat (FL) Brooker Creek Preserve = 28:8:13.2:N
-lon (FL) Brooker Creek Preserve = 82:40:26.4:W
-lat (FL) Disney Wilderness Preserve = 28:7:55.2:N
-lon (FL) Disney Wilderness Preserve = 81:24:18:W
-lat (FL) Katharine Ordway Preserve - Swisher Memorial Sanctuary = 29:41:45.6:N
-lon (FL) Katharine Ordway Preserve - Swisher Memorial Sanctuary = 81:58:55.2:W
-lat (FL) MacArthur Agro-Ecology Research Station = 27:8:24.:N
-lon (FL) MacArthur Agro-Ecology Research Station = 81:9:0:W
-lat (FL) Pinellas County Biological Field Research Station at Brooker Creek Preserve = 28:8:13:N
-lon (FL) Pinellas County Biological Field Research Station at Brooker Creek Preserve = 82:40:28:W
-lat (FL) Riverwoods Field Laboratory = 27:22:40.8:N
-lon (FL) Riverwoods Field Laboratory = 81:5:49.2:W
-lat (FL) Sanibel-Captiva Conservation Foundation, Marine Laboratory = 26:26:31.12:N
-lon (FL) Sanibel-Captiva Conservation Foundation, Marine Laboratory = 82:1:59:W
-lat (FL) Seahorse Key Marine Laboratory = 29:5:9.6:N
-lon (FL) Seahorse Key Marine Laboratory = 83:1:8.4:W
-lat (FL) Tall Timbers Research Station = 30:30:0.:N
-lon (FL) Tall Timbers Research Station = 84:0:0.:W
-lat (GA) Lake Louise Field Station = 38:0:0:N
-lon (GA) Lake Louise Field Station = 84:0:0:W
-lat (GA) St. Catherines Island Research Station = 31:40:N
-lon (GA) St. Catherines Island Research Station = 81:09:W
-lat (IA) Conard (Henry S.) Environmental Research Area = 41:42:46.8:N
-lon (IA) Conard (Henry S.) Environmental Research Area = 92:52:44.4:W
-lat (IA) Iowa Lakeside Laboratory = 43:29:24.:N
-lon (IA) Iowa Lakeside Laboratory = 95:11:24.:W
-lat (ID) Clark Fork Field Station = 48:9:0.:N
-lon (ID) Clark Fork Field Station = 116:9:7.2:W
-lat (ID) McCall Field Campus = 44:54:39.6:N
-lon (ID) McCall Field Campus = 116:6:3.6:W
-lat (ID) Northwest Watershed Research Center = 43:36:0:N
-lon (ID) Northwest Watershed Research Center = 116:13:0:W
-lat (ID) Taylor Ranch Wilderness Field Station = 45:6:14.4:N
-lon (ID) Taylor Ranch Wilderness Field Station = 114:51:14.4:W
-lat (IL) ACM Wilderness Field Station = 47:59:42.:N
-lon (IL) ACM Wilderness Field Station = 91:49:51.6:W
-lat (IL) Alice L. Kibbe Life Science Field Station = 40:15:0:N
-lon (IL) Alice L. Kibbe Life Science Field Station = 91:22:48:W
-lat (IL) Ecological Field Station-Monmoth College = 41:4:4.8:N
-lon (IL) Ecological Field Station-Monmoth College = 90:45:3.6:W
-lat (IL) Forbes Biological Station = 40:21:10:N
-lon (IL) Forbes Biological Station = 90:3:0.:W
-lat (IL) Grasslands Wildlife Research Lab = 38:55:1.2:N
-lon (IL) Grasslands Wildlife Research Lab = 88:12:0.:W
-lat (IL) Great Rivers Field Station - LTRM 26 = 38:55:58.8:N
-lon (IL) Great Rivers Field Station - LTRM 26 = 90:1:20:W
-lat (IL) Green Wing Environmental  Laboratory = 41:42:50.4:N
-lon (IL) Green Wing Environmental  Laboratory = 89:19:44.4:W
-lat (IL) Illinois River Biological Station = 40:21:10:N
-lon (IL) Illinois River Biological Station = 90:1:20:W
-lat (IL) Kaskaskia Biological Station = 39:30:0.:N
-lon (IL) Kaskaskia Biological Station = 88:45:0.:W
-lat (IL) Kibbe Life Sciences Field Station = 40:21:32.4:N
-lon (IL) Kibbe Life Sciences Field Station = 91:26:2.4:W
-lat (IL) Lake Michigan Biological Station = 42:28:1.2:N
-lon (IL) Lake Michigan Biological Station = 87:49:1.2:W
-lat (IL) Lost Mound Field Station = 42:11:0:N
-lon (IL) Lost Mound Field Station = 92:15:0:W
-lat (IL) Wheaton College Science Station = 103:13:12:W
-lon (IL) Wheaton College Science Station = 44:5:24:N
-lat (IL) Ball State Field Station and Environmental Education Center = 40:18:57.6:N
-lon (IL) Ball State Field Station and Environmental Education Center= 85:40:58.8:W
-lat (IN) Ecology Research Center = 39:52:58.8:N
-lon (IN) Ecology Research Center = 85:12:0:W
-lat (IN) Indiana University Research & Teaching Preserve = 39:10:48:N
-lon (IN) Indiana University Research & Teaching Preserve = 86:30:0:W
-lat (IN) Merry Lea Environmental Learning Center = 41:18:49.44:N
-lon (IN) Merry Lea Environmental Learning Center = 85:31:3.13:W
-lat (IN) Notre Dame Environmental Research Center = 46:13:37:N
-lon (IN) Notre Dame Environmental Research Center = 89:31:24:W
-lat (IN) Purdue Univ. N. Central Biology Field Station = 41:42:0.:N
-lon (IN) Purdue Univ. N. Central Biology Field Station = 86:56:45.6:W
-lat (KS) Emporia State University Natural Areas = 38:29:42:N  
-lon (KS) Emporia State University Natural Areas = 96:20:6:W
-lat (KS) Kansas Ecological Reserves = 39:1:58.8:N
-lon (KS) Kansas Ecological Reserves = 95:12:0.:W
-lat (KS) Konza Prairie Biological Station = 39:5:0:N
-lon (KS) Konza Prairie Biological Station = 96:35:0:W
-lat (KY) Hancock Biological Station = 36:44:31.2:N
-lon (KY) Hancock Biological Station = 88:7:30.:W
-lat (KY) Lilley Cornett Woods = 37:5:24.:N
-lon (KY) Lilley Cornett Woods = 83:1:12.:W
-lat (KY) Robinson Forest = 37:33:10.8:N
-lon (KY) Robinson Forest = 83:23:2.4:W
-lat (KY) Thomas More College = 39:1:12:N
-lon (KY) Thomas More College = 84:19:48:W
-lat (LA) LUMCON Marine Center-Cocodrie, LA = 29:14:49.2:N
-lon (LA) LUMCON Marine Center-Cocodrie, LA = 90:39:39.6:W
-lat (LA) Turtle Cove Environmental Research Station = 30:17:38.4:N
-lon (LA) Turtle Cove Environmental Research Station = 90:18:14.4:W
-lat (LA) Univ. of LA Lafayette Cntr. for Ecology and Envir. Technology = 30:18:19:N
-lon (LA) Univ. of LA Lafayette Cntr. for Ecology and Envir. Technology = 92:0:36:W
-lat (MA) Hopkins Memorial Forest = 42:43:58.8:N
-lon (MA) Hopkins Memorial Forest = 73:15:0:W
-lat (MA) Manomet Center for Conservation Sciences = 42:4:1.2:N
-lon (MA) Manomet Center for Conservation Sciences = 71:4:1.2:W
-lat (MA) Nantucket Field Station = 41:17:26:N
-lon (MA) Nantucket Field Station = 70:1:58:W
-lat (ME) Bowdoin Scientific Station = 44:30:3.6:N
-lon (ME) Bowdoin Scientific Station = 66:50:2.4:W
-lat (ME) Humboldt Field Research Institute = 44:28:48.:N
-lon (ME) Humboldt Field Research Institute = 68:1:48.:W
-lat (ME) Mount Desert Island Biological Laboratory = 44:25:48.:N
-lon (ME) Mount Desert Island Biological Laboratory = 68:17:24.:W
-lat (ME) Shoals Marine Laboratory = 42:59:20.4:N
-lon (ME) Shoals Marine Laboratory = 70:36:54.:W
-lat (MI) Au Sable Institute of Environmental Studies = 44:46:12:N
-lon (MI) Au Sable Institute of Environmental Studies = 84:54:0:W
-lat (MI) CMU Biological Station = 45:41:38.4:N
-lon (MI) CMU Biological Station = 85:32:24:W
-lat (MI) E S George Reserve = 42:27:46.8:N
-lon (MI) E S George Reserve = 83:57:50.4:W
-lat (MI) Ford Forestry Center = 46:38:35:N 
-lon (MI) Ford Forestry Center = 88:28:44:W
-lat (MI) Huron Mt. Ives Lake Field Station = 46:51:0:N
-lon (MI) Huron Mt. Ives Lake Field Station = 87:40:12:W
-lat (MI) Pierce Cedar Creek Institute = 42:32:0:N
-lon (MI) Pierce Cedar Creek Institute = 85:17:0:W
-lat (MI) Univ Michigan Biological Station at Douglas Lake = 45:34:51.6:N
-lon (MI) Univ Michigan Biological Station at Douglas Lake = 84:41:49.2:W
-lat (MI) W.K. Kellogg Biological Station = 42:24:0:N
-lon (MI) W.K. Kellogg Biological Station = 85:24:39.6:W
-lat (MN) Cedar Creek Natural History Area = 45:24:14.4:N
-lon (MN) Cedar Creek Natural History Area = 93:16:4.8:W
-lat (MN) Cloquet Forestry Center = 46:42:18.:N
-lon (MN) Cloquet Forestry Center = 92:31:19.2:W
-lat (MN) Katharine Ordway Natural History Study Area = 44:8:0:N
-lon (MN) Katharine Ordway Natural History Study Area = 93:0:0:W
-lat (MN) Lake Itasca Forestry and Biological Station = 47:13:39:N
-lon (MN) Lake Itasca Forestry and Biological Station = 95:11:30:W
-lat (MN) MSUM Regional Sceince Center = 46:52:12:N
-lon (MN) MSUM Regional Sceince Center = 96:29:24:W
-lat (MN) St Croix Watershed Research Station = 45:10:16:N
-lon (MN) St Croix Watershed Research Station = 92:45:39:W
-lat (MN) Vermilion Community College = 47:54:3.6:N
-lon (MN) Vermilion Community College = 91:52:4.8:W
-lat (MO) Bull Shoals Field Station = 36:33:57.6:N
-lon (MO) Bull Shoals Field Station = 93:4:33.6:W
-lat (MO) Lay Field Station = 39:24:14.4:N
-lon (MO) Lay Field Station = 91:9:3.6:W
-lat (MO) Reis Biological Station = 37:58:48:N
-lon (MO) Reis Biological Station = 91:13:48:W
-lat (MO) Tyson Research Center = 38:32:13.2:N
-lon (MO) Tyson Research Center = 90:33:32.4:W
-lat (MO) University Forest (University of Missouri) = 36:52:48:N
-lon (MO) University Forest (University of Missouri) = 90:18:0:W
-lat (MS) Univ of Mississippi Field Station = 34:25:30:N
-lon (MS) Univ of Mississippi Field Station = 89:23:31.2:W
-lat (MT) Flathead Lake Biological Station = 47:52:35:N
-lon (MT) Flathead Lake Biological Station = 114:01:54:W
-lat (MT) Yellowstone Ecosystem Studies Field Station = 45:0:0:N
-lon (MT) Yellowstone Ecosystem Studies Field Station = 109:50:0:W
-lat (NC) Coweeta Hydrologic Laboratory = 35:4:48:N
-lon (NC) Coweeta Hydrologic Laboratory = 83:25:48:W
-lat (NC) Highlands Biological Station = 35:3:14.4:N
-lon (NC) Highlands Biological Station = 83:11:16.8:W
-lat (NE) Cedar Point Biological Station = 41:12:32.4:N
-lon (NE) Cedar Point Biological Station = 101:38:45.6:W
-lat (NH) Hubbard Brook Research Foundation = 43:55:58.8:N
-lon (NH) Hubbard Brook Research Foundation = 71:45:0:W
-lat (NJ) Pinelands Field Research Station = 39:55:48.:N
-lon (NJ) Pinelands Field Research Station = 74:36:0:W
-lat (NM) Sevilleta Field Station = 34:21:0:N
-lon (NM) Sevilleta Field Station = 106:53:2.4:W
-lat (NV) Desert Research Institute = 39:31:48:N
-lon (NV) Desert Research Institute = 119:48:46.8:W
-lat (NV) Nevada Desert Ecological Research Facility = 36:46:0:N 
-lon (NV) Nevada Desert Ecological Research Facility = 115:58:0:W
-lat (NV) Whittell Forest & Wildlife Area = 39:16:30:N
-lon (NV) Whittell Forest & Wildlife Area = 119:52:40.8:W
-lat (NY) Adirondack Ecological Center = 43:59:6:N
-lon (NY) Adirondack Ecological Center = 74:14:6:W
-lat (NY) Arnot Teaching and Research Forest = 42:17:6:N
-lon (NY) Arnot Teaching and Research Forest = 76:38:9.6:W
-lat (NY) Bard College Field Station = 42:1:48:N
-lon (NY) Bard College Field Station = 73:54:0:W
-lat (NY) Black Rock Forest = 41:24:21.6:N
-lon (NY) Black Rock Forest = 74:01:44.4:W
-lat (NY) Columbia-Greene Community College Field Station = 38:45:0:N
-lon (NY) Columbia-Greene Community College Field Station = 79:30:0:W
-lat (NY) Cornell Biological Field Station = 43:10:12:N
-lon (NY) Cornell Biological Field Station = 75:58:4.8:W
-lat (NY) Cranberry Lake Biological Station = 44:13:19.2:N
-lon (NY) Cranberry Lake Biological Station = 74:50:13.2:W
-lat (NY) Darrin Fresh Water Institute = 43:33:25.2:N
-lon (NY) Darrin Fresh Water Institute = 73:39:18:W
-lat (NY) E.N. Huyck Preserve and Biological Research = 42:30:57.6:N
-lon (NY) E.N. Huyck Preserve and Biological Research = 74:8:16.8:W
-lat (NY) Institute of  Ecosystem Studies = 41:47:6:N
-lon (NY) Institute of  Ecosystem Studies = 73:41:38.4:W
-lat (NY) Louis Calder Center - Biological Station = 41:7:40.8:N
-lon (NY) Louis Calder Center - Biological Station = 73:43:55.2:W
-lat (NY) Marine Science Center = 40:52:48:N
-lon (NY) Marine Science Center = 72:26:27.6:W
-lat (NY) Mohonk Preserve Inc = 41:45:0:N
-lon (NY) Mohonk Preserve Inc = 74:6:0:W
-lat (NY) PSU-Ecosystem Studies Field Lab = 44:50:25:N
-lon (NY) PSU-Ecosystem Studies Field Lab = 73:34:8:W
-lat (NY) PSU-Twin Valleys Outdoor Education Center = 44:16:0:N
-lon (NY) PSU-Twin Valleys Outdoor Education Center = 73:29:0:W
-lat (NY) PSU-Valcour Kayaking & Docking Station = 44:36:36:N
-lon (NY) PSU-Valcour Kayaking & Docking Station = 73:26:31:W
-lat (NY) Rice Creek Field Station = 43:27:18:N
-lon (NY) Rice Creek Field Station = 76:30:39.6:W
-lat (NY) Robert R. Smith (Oneonta) Environmental Field Station = 42:42:36:N
-lon (NY) Robert R. Smith (Oneonta) Environmental Field Station = 74:54:36:W
-lat (NY) Seatuck MWR = 40:48:50.4:N
-lon (NY) Seatuck MWR = 72:43:37.2:W
-lat (NY) SUNY Oneonta Biological Field Station = 42:45:0:N  
-lon (NY) SUNY Oneonta Biological Field Station = 74:49:48:W
-lat (NY) Thousand Islands Biological Station = 44:14:50:N
-lon (NY) Thousand Islands Biological Station = 76:05:54:W
-lat (NY) Tifft Nature Preserve = 39:1:12:N
-lon (NY) Tifft Nature Preserve = 84:19:48:W
-lat (OH) Bath Field Station = 41:6:32.4:N
-lon (OH) Bath Field Station = 81:23:16.8:W
-lat (OH) F.T. Stone Laboratory = 41:39:14.4:N
-lon (OH) F.T. Stone Laboratory = 82:49:22.8:W
-lat (OH) Glen Helen Ecology Institute = 39:39:36:N
-lon (OH) Glen Helen Ecology Institute = 84:0:0:W
-lat (OH) JH Barrow Field Station = 41:18:46.8:N
-lon (OH) JH Barrow Field Station = 81:8:38.4:W
-lat (OH) Lake Erie Center = 41:41:20.4:N
-lon (OH) Lake Erie Center = 83:23:56.4:W
-lat (OH) Ecology Research Center (Miami University) = 39:31:57:N
-lon (OH) Ecology Research Center (Miami University) = 84:43:0:W
-lat (OH) Woodlake Environmental Field Station = 41:13:48:N
-lon (OH) Woodlake Environmental Field Station = 81:31:12:W
-lat (OK) Kessler Farm Field Laboratory = 34:58:41:N
-lon (OK) Kessler Farm Field Laboratory = 97:30:58:W
-lat (OK) Selman Living Laboratory = 48:12:0:N
-lon (OK) Selman Living Laboratory = 99:16:1.2:W
-lat (OK) Univ of Oklahoma Biological Station = 33:52:57:N
-lon (OK) Univ of Oklahoma Biological Station = 96:48:2:W
-lat (OR) Cascade Head Experimental Forest and Scenic Research Area = 45:02:30:N
-lon (OR) Cascade Head Experimental Forest and Scenic Research Area = 123:55:30:W
-lat (OR) Hatfield Marine Science Center = 44:38:13.2:N
-lon (OR) Hatfield Marine Science Center = 124:3:7.2:W
-lat (OR) HJ Andrews Experimental Forest = 44:13:N
-lon (OR) HJ Andrews Experimental Forest = 122:15:W
-lat (OR) Malheur Field Station = 43:15:57.6:N
-lon (OR) Malheur Field Station = 118:50:34.8:W
-lat (OR) Oregon Institute of Marine Biology = 43:20:24:N
-lon (OR) Oregon Institute of Marine Biology = 124:19:44.4:W
-lat (PA) Hawk Mountain Sanctuary = 40:38:45.6:N
-lon (PA) Hawk Mountain Sanctuary = 75:58:48:W
-lat (PA) Lacawac Sanctuary = 41:22:15.6:N
-lon (PA) Lacawac Sanctuary = 75:19:44.4:W
-lat (PA) Powdermill Biological Station = 40:11:49.2:N
-lon (PA) Powdermill Biological Station = 79:14:20.4:W
-lat (PA) Pymatuning Laboratory of Ecology = 41:39:21.6:N
-lon (PA) Pymatuning Laboratory of Ecology = 80:25:26.4:W
-lat (PA) Raystown Field Station = 40:21:28.8:N
-lon (PA) Raystown Field Station = 78:9:0:W
-lat (PA) Stroud Water Research Center = 39:15:50:N
-lon (PA) Stroud Water Research Center = 75:47:16:W
-lat (PR) El Verde Field Station = 18:19:21:N
-lon (PR) El Verde Field Station = 65:49:13:W
-lat (PR) Mata de Platano Field Station and Nature Reserve = 18:25:0:N
-lon (PR) Mata de Platano Field Station and Nature Reserve = 66:43:0:W
-lat (PR) Institute of Neurobiology, University of Puerto Rico = 18:28:06:N
-lon (PR) Institute of Neurobiology, University of Puerto Rico = 66:06:22:W
-lat (SC) Baruch Institute for Marine Biology = 33:21:3:N
-lon (SC) Baruch Institute for Marine Biology = 79:11:5:W
-lat (SC) Savannah River Environmental Field Station = 33:21:50:N
-lon (SC) Savannah River Environmental Field Station = 81:40:45:W
-lat (SD) Oak Lake Field Station = 44:30:32.4:N
-lon (SD) Oak Lake Field Station = 96:31:55.2:W
-lat (TN) EJ Meeman Biological Station = 35:21:3.6:N
-lon (TN) EJ Meeman Biological Station = 89:59:13.2:W
-lat (TN) Reelfoot Lake Research and Teaching Center = 36:23:1:N
-lon (TN) Reelfoot Lake Research and Teaching Center = 89:21:0:W
-lat (TX) Chapala Ecology Station, Baylor (Waco) = 21:0:0:N
-lon (TX) Chapala Ecology Station, Baylor (Waco) = 102:0:0:W
-lat (TX) Brackenridge Field Laboratory = 30:16:26.4:N
-lon (TX) Brackenridge Field Laboratory = 97:43:55.2:W
-lat (TX) Indio Mountains Research Station = 30:46:41:N
-lon (TX) Indio Mountains Research Station = 105:0:52:W
-lat (TX) Marine Science Institute = 27:50:2.4:N
-lon (TX) Marine Science Institute = 97:3:39.6:W
-lat (TX) SHSU Center for Biological Field Studies = 30:44:33:N
-lon (TX) SHSU Center for Biological Field Studies = 95:28:38:W 
-lat (TX) Stengl "Lost Pines" Biological Station = 30:04:51:N
-lon (TX) Stengl "Lost Pines" Biological Station = 97:10:23:W
-lat (TX) The University of Texas-Pan American Coastal Studies Laboratory = 26:04:30:N
-lon (TX) The University of Texas-Pan American Coastal Studies Laboratory = 97:09:30:W
-lat (TX) Upper Rio Grande Biological Station = 26:30:52:N
-lon (TX) Upper Rio Grande Biological Station = 99:06:54:W
-lat (UT) Cedar Mountain Science Center = 37:36:0:N
-lon (UT) Cedar Mountain Science Center = 113:0:0:W
-lat (UT) Red Butte Garden and Arboretum = 40:47:52.8:N
-lon (UT) Red Butte Garden and Arboretum = 111:46:58.8:W
-lat (VA) Anheuser Busch Coastal Research Center = 37:18:0:N
-lon (VA) Anheuser Busch Coastal Research Center = 75:56:0:W
-lat (VA) Blackwater Ecological Preserve = 36:45:0:N
-lon (VA) Blackwater Ecological Preserve = 76:30:0:W
-lat (VA) Blandy Experimental Farm = 39:3:50.4:N
-lon (VA) Blandy Experimental Farm = 78:3:54:W
-lat (VA) Inger and Walter Rice Center for Environmental Life Sciences = 37:19:0:N
-lon (VA) Inger and Walter Rice Center for Environmental Life Sciences = 77:12:0:W
-lat (VA) Mountain Lake Biological Station = 37:22:30:N
-lon (VA) Mountain Lake Biological Station = 80:31:19.2:W
-lat (VA) Univ. of Virginia Coastal Research Center = 37:17:9.6:N
-lon (VA) Univ. of Virginia Coastal Research Center = 75:55:22.8:W
-lat (WA) Au-Sable Pacific Rim Facility = 48:12:0:N
-lon (WA) Au-Sable Pacific Rim Facility = 122:0:0:W
-lat (WA) Blakely Island Field Station = 48:33:16:N
-lon (WA) Blakely Island Field Station = 122:48:18:W
-lat (WA) Shannon Point Marine Center = 48:30:46.8:N
-lon (WA) Shannon Point Marine Center = 122:36:39.6:W
-lat (WA) Wind River Canopy Crane Research Facility = 45:49:14:N
-lon (WA) Wind River Canopy Crane Research Facility = 121:57:7:W
-lat (WI) Howard T. Greene Field Station = 42:58:1.2:N
-lon (WI) Howard T. Greene Field Station = 88:22:1.2:W
-lat (WI) Kemp Natural Resources Station = 45:49:58.8:N
-lon (WI) Kemp Natural Resources Station = 89:40:1.2:W
-lat (WI) Pigeon Lake Field Station = 46:22:12:N
-lon (WI) Pigeon Lake Field Station = 91:24:36:W
-lat (WI) Treehaven Field Station = 45:33:0:N
-lon (WI) Treehaven Field Station = 89:33:36:W
-lat (WI) Trout Lake Station = 46:1:4.8:N
-lon (WI) Trout Lake Station = 89:40:4.8:W
-lat (WI) University of Notre Dame Environmental Research Center = 46:13:37:N
-lon (WI) University of Notre Dame Environmental Research Center = 89:31:24:W
-lat (WI) Univ of Wisconsin Milwaukee Field Station = 43:22:55.2:N
-lon (WI) Univ of Wisconsin Milwaukee Field Station = 88:01:15:W
-lat (WV) Fernow Experimental Forest = 39:02:30:N
-lon (WV) Fernow Experimental Forest = 79:41:0:W
-lat (WV) Spruce Knob Mountain Center = 38:40:15.6:N
-lon (WV) Spruce Knob Mountain Center = 79:29:27.6:W
-lat (WY) Wyoming National Park Service = 43:51:25.2:N
-lon (WY) Wyoming National Park Service = 110:35:20.4:W
-lat (AZ) Aravaipa Canyon Preserve, Ind. Mem. = 32:53:52.8:N
-lon (AZ) Aravaipa Canyon Preserve, Ind. Mem. = 110:26:20.4:W
-lat [Australia] Kioloa Costal Campus - Edith and Joy London Foundation = 35:33:0:S
-lon [Australia] Kioloa Costal Campus - Edith and Joy London Foundation = 150:23:0:E
-lat [Bahamas] Gerace Research Center, San Salvador Island = 24:07:0:N
-lon [Bahamas] Gerace Research Center, San Salvador Island = 74:28:0:W
-lat [Bahamas] Bahamas Environmental Research Center, Andros Island = 25:0:0:N
-lon [Bahamas] Bahamas Environmental Research Center, Andros Island = 78:0:0:W
-lat [Bahamas] Forfar Field Station = 25:0:0:N
-lon [Bahamas] Forfar Field Station = 77:30:0:W
-lat [Belize] Jaguar Creek = 17:09:39:N
-lon [Belize] Jaguar Creek = 88:40:48:W
-lat [Belize] Las Cuevas Forest Research Station = 16:44:0:N
-lon [Belize] Las Cuevas Forest Research Station = 88:59:0:W
-lat [Bermuda] Bermuda Biological Station = 32:22:2 N
-lon [Bermuda] Bermuda Biological Station = 64:42:0 W
-lat [Brazil] Iracambi Atlantic Rainforest Research & Conservation Center = 21:0:0:N
-lon [Brazil] Iracambi Atlantic Rainforest Research & Conservation Center = 42:30:0:W
-lat [British West Indies] School for Field Studies-Center for Marine Studies = 21:29:0:N
-lon [British West Indies] School for Field Studies-Center for Marine Studies = 71:32:0:W
-lat [Canada] Bamfield Marine Station = 48:50:1:N
-lon [Canada] Bamfield Marine Station = 125:8:0:W
-lat [Canada] Churchill Northern Studies Centre = 58:44:10:N
-lon [Canada] Churchill Northern Studies Centre = 93:49:5:W
-lat [Canada] Delta Marsh Field Station = 50:10:57:N
-lon [Canada] Delta Marsh Field Station = 98:22:56:W
-lat [Canada] Gault Nature Reserve  = 45:31:0:N 
-lon [Canada] Gault Nature Reserve  = 73:08:0:W
-lat [Canada] Huntsman Marine Science Centre = 45:5:0:N
-lon [Canada] Huntsman Marine Science Centre = 67:5:0:W
-lat [Canada] Meanook Biological Research Station = 54:37:0:N
-lon [Canada] Meanook Biological Research Station = 113:21:0:W
-lat [Canada] Kananaskis Field Stations = 51:02:0:N
-lon [Canada] Kananaskis Field Stations = 115:03:0:W
-lat [Canada] Koffler Scientific Reserve at Jokers Hill = 44:03:0:N
-lon [Canada] Koffler Scientific Reserve at Jokers Hill = 79:29:0:W
-lat [Canada] Quesnel River Research Centre = 52:34:48:N
-lon [Canada] Quesnel River Research Centre = 121:33:0:W
-lat [Canada] Taiga Biological Station = 51:1:48:N
-lon [Canada] Taiga Biological Station = 95:19:48:W
-lat [Costa Rica] Cano Palma Field Station = 10:30:0:N
-lon [Costa Rica] Cano Palma Field Station = 83:30:0:W
-lat [Costa Rica] La Suerte Biological Field Station = 10:26:30:N
-lon [Costa Rica] La Suerte Biological Field Station = 83:46:15:W
-lat [Costa Rica] La Selva Biological Station = 10:25:50:N
-lon [Costa Rica] La Selva Biological Station = 84:00:25:W
-lat [Costa Rica] Quetzal Education Research Complex = 9:33:12:N
-lon [Costa Rica] Quetzal Education Research Complex = 83:48:41:W
-lat [Dominica] Archbold Tropical Research Center, Springfield Station = 15:30:0:N
-lon [Dominica] Archbold Tropical Research Center, Springfield Station = 61:15:0:W
-lat [Dominica, West Indies] The Institute for Tropical marine Ecology = 15:19:0:N
-lon [Dominica, West Indies] The Institute for Tropical marine Ecology = 61:24:0:W
-lat [Ecuador] Galapagos Academic Institute for Arts Sciences = 0:55:0:N
-lon [Ecuador] Galapagos Academic Institute for Arts Sciences = 90:45:0:W
-lat [Mexico] Chapala Ecology Station, Baylor University = 21:0:0:N
-lon [Mexico] Chapala Ecology Station, Baylor University = 102:0:0:W
-lat [Mexico] Estacion del Mar Cortes = 28:57:0:N
-lon [Mexico] Estacion del Mar Cortes = 113:33:0:W
-lat [Mexico] Kino Bay Center for Cultural & Ecological Studies = 25:1:30:N
-lon [Mexico] Kino Bay Center for Cultural & Ecological Studies = 112:1:30:W
-lat [Mexico] Tijuana River National Estuarine Research R = 32:33:14.4:N
-lon [Mexico] Tijuana River National Estuarine Research R = 117:6:50.4:W
-lat [Namibia] Gobabeb Training and Research Centre = 23:4:48:S
-lon [Namibia] Gobabeb Training and Research Centre = 14:30:0:E
-lat [Panama] Institute for Tropical Ecology and Conservation = 9:25:0:N 
-lon [Panama] Institute for Tropical Ecology and Conservation = 82:15:0:W
-lat [Panama] Smithsonian Tropical Research Institute = 9:25:35:N
-lon [Panama] Smithsonian Tropical Research Institute = 82:19:24:W
-lat [South Pacific] Richard B Gump South Pacific Biological Research Station = 17:30:0:S
-lon [South Pacific] Richard B Gump South Pacific Biological Research Station = 148:50:0:W
-lat [Trinidad and Tobago] William Beebe Tropical Research Station = 10:41:1:S
-lon [Trinidad and Tobago] William Beebe Tropical Research Station = 61:17:0:W 
-

Property changes on: lib/style/skins/obfs/obfs.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/knb2/knb2.cfg
===================================================================
--- lib/style/skins/knb2/knb2.cfg	(revision 5310)
+++ lib/style/skins/knb2/knb2.cfg	(nonexistent)
@@ -1,38 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=knbadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = knb
-organization = Knowledge Network for Biocomplexity
-orgabbrev = KNB
-orgurl = http://localhost:8080/knbweb
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = hyperion.nceas.ucsb.edu
-sender = KNB Data Registry <help@nceas.ucsb.edu>
-recipient = help@nceas.ucsb.edu
-adminname = the repository administrator
-debug = 1
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'false'
-showWgList = 'false'
-showOrganization = 'true'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-nceas_db = somedb
-nceas_db_user = someuser
-nceas_db_password = your-pw-goes-here

Property changes on: lib/style/skins/knb2/knb2.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/sbclter/sbclter.cfg
===================================================================
--- lib/style/skins/sbclter/sbclter.cfg	(revision 5310)
+++ lib/style/skins/sbclter/sbclter.cfg	(nonexistent)
@@ -1,496 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@server@@servlet-path@
-username = uid=obfsadmin,o=LTER,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = obfs
-organization = Organization of Biological Field Stations
-orgabbrev = OBFS
-orgurl = http://www.obfs.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = hyperion.nceas.ucsb.edu
-sender = OBFS Data Registry <obfsadmin@lternet.edu>
-recipient = tmaddux@lternet.edu
-adminname = Troy Maddux
-debug = 0
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-lat (AK) Toolik Field Station =
-lon (AK) Toolik Field Station =
-lat (AR) Ouachita Mountains Biological Station = 34:26:56.4:N
-lon (AR) Ouachita Mountains Biological Station = 94:0:32.4:W
-lat (AZ) Appleton-Whittell Research Ranch = 31:35:27.6:N
-lon (AZ) Appleton-Whittell Research Ranch = 110:30:21.6:W
-lat (AZ) Desert Station = 32:14:2.4:N
-lon (AZ) Desert Station = 111:9:3.6:W
-lat (AZ) Rincon Institute = 32:5:9.6:N
-lon (AZ) Rincon Institute = 110:42:39.6:W
-lat (AZ) Sierra Ancha Station = 33:40:58.8:N
-lon (AZ) Sierra Ancha Station = 110:58:1.2:W
-lat (AZ) Sonoran Arthropod Studies Institute = 32:07:451:N
-lon (AZ) Sonoran Arthropod Studies Institute = 111:14:311:W
-lat (AZ) Southwestern Research Station = 31:53:2.4:N
-lon (AZ) Southwestern Research Station = 109:12:28.8:W
-lat (CA) Año Nuevo Island Reserve  = 
-lon (CA) Año Nuevo Island Reserve  = 
-lat (CA) Bernard Biological Field Station (Claremont Colleges) =
-lon (CA) Bernard Biological Field Station (Claremont Colleges) =
-lat (CA) Bodega Bay Marine Laboratory and Reserve = 38:19:3:N
-lon (CA) Bodega Bay Marine Laboratory and Reserve = 123:4:12:W
-lat (CA) Boyd Deep Canyon Desert Research Center = 33:43:19.2:N
-lon (CA) Boyd Deep Canyon Desert Research Center = 116:23:2.4:W
-lat (CA) Coal Oil Point Reserve = 34:25:00:N
-lon (CA) Coal Oil Point Reserve = 119:52:30:W
-lat (CA) Dawson Los Monos Canyon Reserve = 33:8:31.2:N
-lon (CA) Dawson Los Monos Canyon Reserve = 117:15:21.6:W
-lat (CA) Desert Studies Center = 35:35:20.4:N
-lon (CA) Desert Studies Center = 116:21:18.:W
-lat (CA) Eagle Lake Biological Field Station = 40:37:1.2:N
-lon (CA) Eagle Lake Biological Field Station = 120:43:37.2:W
-lat (CA) Field Research Station, Gazos Creek = 37:11.1:N
-lon (CA) Field Research Station, Gazos Creek = 122:17:25:W
-lat (CA) Fortuna Mountain Research Reserve = 32:50:38.4:N
-lon (CA) Fortuna Mountain Research Reserve = 117:3:21.6:W
-lat (CA) Hastings Natural History Reservation = 36:23:14.9:N
-lon (CA) Hastings Natural History Reservation = 121:33:05:W
-lat (CA) Hopkins Marine Station = 36:37:15.6:N
-lon (CA) Hopkins Marine Station = 121:54:10.8:W
-lat (CA) James San Jacinto Mountains Reserve = 33:48:28.8:N
-lon (CA) James San Jacinto Mountains Reserve = 116:46:40.8:W
-lat (CA) Jasper Ridge Biological Preserve = 37:24:0.:N
-lon (CA) Jasper Ridge Biological Preserve = 122:13:30.:W
-lat (CA) Kendall Frost Marsh Reserve = 32:47:34.8:N
-lon (CA) Kendall Frost Marsh Reserve = 117:13:1.2:W
-lat (CA) Landels-Hill Big Creek Reserve = 36:4:12.:N
-lon (CA) Landels-Hill Big Creek Reserve = 121:35:56.4:W
-lat (CA) Long Marine Laboratory = 36:56:52.8:N
-lon (CA) Long Marine Laboratory = 122:3:50.4:W
-lat (CA) McLaughlin Reserve = 
-lon (CA) McLaughlin Reserve = 
-lat (CA) Moss Landing Marine Laboratory = 36:48:0.:N
-lon (CA) Moss Landing Marine Laboratory = 121:47:16.8:W
-lat (CA) Pepperwood Ranch Natural Preserve = 38:34:4.8:N
-lon (CA) Pepperwood Ranch Natural Preserve = 122:42:3.6:W
-lat (CA) Quail Ridge Reserve = 
-lon (CA) Quail Ridge Reserve = 
-lat (CA) Santa Cruz Island Reserve = 34:4:4.8:N
-lon (CA) Santa Cruz Island Reserve = 119:43:4.8:W
-lat (CA) Scripps Coastal Reserve = 32:52:30.:N
-lon (CA) Scripps Coastal Reserve = 117:15:14.4:W
-lat (CA) Santa Margarita Biological Field Station = 33:27:28.8:N
-lon (CA) Santa Margarita Biological Field Station = 117:10:1.2:W
-lat (CA) Sedgwick Reserve = 34:40:4.8:N
-lon (CA) Sedgwick Reserve = 120:6:50.4:W
-lat (CA) Sierra Nevada Aquatic Research Lab = 37:36:51:N
-lon (CA) Sierra Nevada Aquatic Research Lab = 118:49:47:W
-lat (CA) Sierra Nevada Field Campus = 39:35:16.8:N
-lon (CA) Sierra Nevada Field Campus = 120:25:44.4:W
-lat (CA) Sky Oaks Field Station = 33:22:37.2:N
-lon (CA) Sky Oaks Field Station = 116:37:22.8:W
-lat (CA) Starr Ranch Sanctuary = 33:37:44.4:N
-lon (CA) Starr Ranch Sanctuary = 117:33:10.8:W
-lat (CA) Stebbins Cold Canyon Reserve = 
-lon (CA) Stebbins Cold Canyon Reserve =
-lat (CA) Stunt Ranch Santa Monica Mountains Reserve = 34:6:N
-lon (CA) Stunt Ranch Santa Monica Mountains Reserve = 118:39:W
-lat (CA) Sweeney Granite Mountains Desert Research Center = 34:48:21.6:N
-lon (CA) Sweeney Granite Mountains Desert Research Center = 115:39:50.4:W
-lat (CA) Teakettle Experimental Forest = 36:58:0:N
-lon (CA) Teakettle Experimental Forest = 119:2:0:W
-lat (CA) Valentine Eastern Sierra Reserve = 37:37:30:N
-lon (CA) Valentine Eastern Sierra Reserve = 118:59:30:W
-lat (CA) Volcano Bay Field Station =
-lon (CA) Volcano Bay Field Station =
-lat (CA) White Mountain Research Station = 37:21:40:N
-lon (CA) White Mountain Research Station = 118:19:35:W
-lat (CO) Catamount Environmental Institute =
-lon (CO) Catamount Environmental Institute =
-lat (CO) Mountain Research Station = 40:6:0.:N
-lon (CO) Mountain Research Station = 105:29:24.:W
-lat (CO) Rocky Mountain Biological Laboratory = 38:57:32.4:N
-lon (CO) Rocky Mountain Biological Laboratory = 106:59:20.4:W
-lat (CO) Shortgrass Steppe LTER Site = 40:42:36.:N
-lon (CO) Shortgrass Steppe LTER Site = 104:46:48.:W
-lat (CT) Trinity College Field Station = 41:49:58.8:N
-lon (CT) Trinity College Field Station = 72:10:8.4:W
-lat (FL) Archbold Biological Station = 27:11:16.8:N
-lon (FL) Archbold Biological Station = 81:20:16.8:W
-lat (FL) Brooker Creek Preserve = 28:8:13.2:N
-lon (FL) Brooker Creek Preserve = 82:40:26.4:W
-lat (FL) Disney Wilderness Preserve = 28:7:55.2:N
-lon (FL) Disney Wilderness Preserve = 81:24:18:W
-lat (FL) Katharine Ordway Natural History Study Area = 44:7:58.8:N
-lon (FL) Katharine Ordway Natural History Study Area = 93:0:0.:W
-lat (FL) Katharine Ordway Preserve - Swisher Memorial Sanctuary = 29:41:45.6:N
-lon (FL) Katharine Ordway Preserve - Swisher Memorial Sanctuary = 81:58:55.2:W
-lat (FL) MacArthur Agro-Ecology Research Station = 27:8:24.:N
-lon (FL) MacArthur Agro-Ecology Research Station = 81:9:0.:W
-lat (FL) Pinellas County Biological Field Research Station at Brooker Creek Preserve =
-lon (FL) Pinellas County Biological Field Research Station at Brooker Creek Preserve =
-lat (FL) Riverwoods Field Laboratory = 27:22:40.8:N
-lon (FL) Riverwoods Field Laboratory = 81:5:49.2:W
-lat (FL) Seahorse Key Marine Laboratory = 29:5:9.6:N
-lon (FL) Seahorse Key Marine Laboratory = 83:1:8.4:W
-lat (FL) Tall Timbers Research Station = 30:30:0.:N
-lon (FL) Tall Timbers Research Station = 84:0:0.:W
-lat (GA) Savannah River Environmental Field Station = 33:21:43.2:N
-lon (GA) Savannah River Environmental Field Station = 81:41:45.6:W
-lat (GA) St. Catherines Island Research Station = 31:40:N
-lon (GA) St. Catherines Island Research Station = 81:09:W
-lat (IA) Conard (Henry S.) Environmental Research Area = 41:42:46.8:N
-lon (IA) Conard (Henry S.) Environmental Research Area = 92:52:44.4:W
-lat (IA) Iowa Lakeside Laboratory = 43:29:24.:N
-lon (IA) Iowa Lakeside Laboratory = 95:11:24.:W
-lat (ID) Clark Fork Field Station = 48:9:0.:N
-lon (ID) Clark Fork Field Station = 116:9:7.2:W
-lat (ID) McCall Field Campus = 44:54:39.6:N
-lon (ID) McCall Field Campus = 116:6:3.6:W
-lat (ID) Northwest Watershed Research Center =
-lon (ID) Northwest Watershed Research Center =
-lat (ID) Taylor Ranch Wilderness Field Station = 45:6:14.4:N
-lon (ID) Taylor Ranch Wilderness Field Station = 114:51:14.4:W
-lat (IL) ACM Wilderness Field Station = 47:59:42.:N
-lon (IL) ACM Wilderness Field Station = 91:49:51.6:W
-lat (IL) Ecological Field Station-Monmoth College = 41:4:4.8:N
-lon (IL) Ecological Field Station-Monmoth College = 90:45:3.6:W
-lat (IL) Forbes Biological Station = 40:21:10:N
-lon (IL) Forbes Biological Station = 90:3:0.:W
-lat (IL) Grasslands Wildlife Research Lab = 38:55:1.2:N
-lon (IL) Grasslands Wildlife Research Lab = 88:12:0.:W
-lat (IL) Great Rivers Field Station - LTRM 26 = 38:55:58.8:N
-lon (IL) Great Rivers Field Station - LTRM 26 = 90:1:20:W
-lat (IL) Green Wing Environmental  Laboratory = 41:42:50.4:N
-lon (IL) Green Wing Environmental  Laboratory = 89:19:44.4:W
-lat (IL) Illinois River Biological Station = 40:21:10:N
-lon (IL) Illinois River Biological Station = 90:1:20:W
-lat (IL) Kaskaskia Biological Station = 39:30:0.:N
-lon (IL) Kaskaskia Biological Station = 88:45:0.:W
-lat (IL) Kibbe Life Sciences Field Station = 40:21:32.4:N
-lon (IL) Kibbe Life Sciences Field Station = 91:26:2.4:W
-lat (IL) Lake Michigan Biological Station = 42:28:1.2:N
-lon (IL) Lake Michigan Biological Station = 87:49:1.2:W
-lat (IL) Wheaton College Science Station = 103:13:12.:W
-lon (IL) Wheaton College Science Station = 44:5:24.:N
-lat (IN) Ecology Research Center = 39:52:58.8:N
-lon (IN) Ecology Research Center = 85:12:0.:W
-lat (IN) Notre Dame Environmental Research Center = 46:13:37:N
-lon (IN) Notre Dame Environmental Research Center = 89:31:24:W
-lat (IN) Purdue Univ. N. Central Biology Field Station = 41:42:0.:N
-lon (IN) Purdue Univ. N. Central Biology Field Station = 86:56:45.6:W
-lat (KS) Kansas Ecological Reserves = 39:1:58.8:N
-lon (KS) Kansas Ecological Reserves = 95:12:0.:W
-lat (KS) Konza Prairie Biological Station = 39:3:0:N
-lon (KS) Konza Prairie Biological Station = 96:21:0:W
-lat (KY) Hancock Biological Station = 36:44:31.2:N
-lon (KY) Hancock Biological Station = 88:7:30.:W
-lat (KY) Lilley Cornett Woods = 37:5:24.:N
-lon (KY) Lilley Cornett Woods = 83:1:12.:W
-lat (KY) Robinson Forest = 37:33:10.8:N
-lon (KY) Robinson Forest = 83:23:2.4:W
-lat (KY) Thomas More College = 39:1:12.:N
-lon (KY) Thomas More College = 84:19:48.:W
-lat (LA) LUMCON Marine Center-Cocodrie, LA = 29:14:49.2:N
-lon (LA) LUMCON Marine Center-Cocodrie, LA = 90:39:39.6:W
-lat (LA) Turtle Cove Environmental Research Station = 30:17:38.4:N
-lon (LA) Turtle Cove Environmental Research Station = 90:18:14.4:W
-lat (MA) Hopkins Memorial Forest = 42:43:58.8:N
-lon (MA) Hopkins Memorial Forest = 73:15:0.:W
-lat (MA) Manomet Center for Conservation Sciences = 42:4:1.2:N
-lon (MA) Manomet Center for Conservation Sciences = 71:4:1.2:W
-lat (MA) Nantucket Field Station = 41:23:20.4:N
-lon (MA) Nantucket Field Station = 70:2:45.6:W
-lat (ME) Bowdoin Scientific Station = 44:30:3.6:N
-lon (ME) Bowdoin Scientific Station = 66:50:2.4:W
-lat (ME) Humboldt Field Research Institute = 44:28:48.:N
-lon (ME) Humboldt Field Research Institute = 68:1:48.:W
-lat (ME) Mount Desert Island Biological Laboratory = 44:25:48.:N
-lon (ME) Mount Desert Island Biological Laboratory = 68:17:24.:W
-lat (ME) Shoals Marine Laboratory = 42:59:20.4:N
-lon (ME) Shoals Marine Laboratory = 70:36:54.:W
-lat (MI) CMU Biological Station = 45:41:38.4:N
-lon (MI) CMU Biological Station = 85:32:24.:W
-lat (MI) E S George Reserve = 42:27:46.8:N
-lon (MI) E S George Reserve = 83:57:50.4:W
-lat (MI) Univ of Michigan Biological Station = 45:33:36.:N
-lon (MI) Univ of Michigan Biological Station = 84:40:40.8:W
-lat (MI) Univ of Michigan Biological StationDouglas L = 45:34:51.6:N
-lon (MI) Univ of Michigan Biological StationDouglas L = 84:41:49.2:W
-lat (MI) W.K. Kellogg Biological Station = 42:24:0.:N
-lon (MI) W.K. Kellogg Biological Station = 85:24:39.6:W
-lat (MN) Cedar Creek Natural History Area = 45:24:14.4:N
-lon (MN) Cedar Creek Natural History Area = 93:16:4.8:W
-lat (MN) Cloquet Forestry Center = 46:42:18.:N
-lon (MN) Cloquet Forestry Center = 92:31:19.2:W
-lat (MN) Katharine Ordway Natural History Study Area =
-lon (MN) Katharine Ordway Natural History Study Area =
-lat (MN) Lake Itasca Forestry and Biological Station = 47:13:39:N
-lon (MN) Lake Itasca Forestry and Biological Station = 95:11:30:W
-lat (MN) MSUM Regional Sceince Center = 46:52:12:N
-lon (MN) MSUM Regional Sceince Center = 96:29:24:W
-lat (MN) St Croix Watershed Research Station = 45:10:16:N
-lon (MN) St Croix Watershed Research Station = 92:45:39:W
-lat (MN) Vermilion Community College = 47:54:3.6:N
-lon (MN) Vermilion Community College = 91:52:4.8:W
-lat (MO) Bull Shoals Field Station = 36:33:57.6:N
-lon (MO) Bull Shoals Field Station = 93:4:33.6:W
-lat (MO) Lay Field Station = 39:24:14.4:N
-lon (MO) Lay Field Station = 91:9:3.6:W
-lat (MO) Reis Biological Station = 37:58:48.:N
-lon (MO) Reis Biological Station = 91:13:48.:W
-lat (MO) Tyson Research Center = 38:32:13.2:N
-lon (MO) Tyson Research Center = 90:33:32.4:W
-lat (MS) Univ of Mississippi Field Station = 34:25:30.:N
-lon (MS) Univ of Mississippi Field Station = 89:23:31.2:W
-lat (MT) Flathead Lake Biological Station = 47:52:35:N
-lon (MT) Flathead Lake Biological Station = 114:01:54:W
-lat (MT) Yellowstone Ecosystem Studies Field Station =
-lon (MT) Yellowstone Ecosystem Studies Field Station =
-lat (NC) Coweeta Hydrologic Laboratory = 35:4:48:N
-lon (NC) Coweeta Hydrologic Laboratory = 83:25:48:W
-lat (NC) Highlands Biological Station = 35:3:14.4:N
-lon (NC) Highlands Biological Station = 83:11:16.8:W
-lat (NE) Cedar Point Biological Station = 41:12:32.4:N
-lon (NE) Cedar Point Biological Station = 101:38:45.6:W
-lat (NH) Hubbard Brook Research Foundation = 43:55:58.8:N
-lon (NH) Hubbard Brook Research Foundation = 71:45:0.:W
-lat (NJ) Pinelands Field Research Station = 39:55:48.:N
-lon (NJ) Pinelands Field Research Station = 74:36:0.:W
-lat (NM) Sevilleta Field Station = 34:21:0.:N
-lon (NM) Sevilleta Field Station = 106:53:2.4:W
-lat (NV) Nevada Desert Ecological Research Facility = 
-lon (NV) Nevada Desert Ecological Research Facility = 
-lat (NV) Desert Research Institute = 39:31:48.:N
-lon (NV) Desert Research Institute = 119:48:46.8:W
-lat (NV) Whittell Forest & Wildlife Area = 39:16:30.:N
-lon (NV) Whittell Forest & Wildlife Area = 119:52:40.8:W
-lat (NY) Adirondack Ecological Center = 43:59:6.:N
-lon (NY) Adirondack Ecological Center = 74:14:6.:W
-lat (NY) Arnot Teaching and Research Forest = 42:17:6.:N
-lon (NY) Arnot Teaching and Research Forest = 76:38:9.6:W
-lat (NY) Bard College Field Station = 42:1:48.:N
-lon (NY) Bard College Field Station = 73:54:0.:W
-lat (NY) Black Rock Forest = 41:24:21.6:N
-lon (NY) Black Rock Forest = 74:01:44.4:W
-lat (NY) Cornell Biological Field Station = 43:10:12.:N
-lon (NY) Cornell Biological Field Station = 75:58:4.8:W
-lat (NY) Cranberry Lake Biological Station = 44:13:19.2:N
-lon (NY) Cranberry Lake Biological Station = 74:50:13.2:W
-lat (NY) Darrin Fresh Water Institute = 43:33:25.2:N
-lon (NY) Darrin Fresh Water Institute = 73:39:18.:W
-lat (NY) E.N. Huyck Preserve and Biological Research = 42:30:57.6:N
-lon (NY) E.N. Huyck Preserve and Biological Research = 74:8:16.8:W
-lat (NY) Hartwick College Field Station-Pine Lake Environmental Center = 
-lon (NY) Hartwick College Field Station-Pine Lake Environmental Center = 
-lat (NY) Institute of  Ecosystem Studies = 41:47:6.:N
-lon (NY) Institute of  Ecosystem Studies = 73:41:38.4:W
-lat (NY) Louis Calder Center - Biological Station = 41:7:40.8:N
-lon (NY) Louis Calder Center - Biological Station = 73:43:55.2:W
-lat (NY) Marine Science Center = 40:52:48.:N
-lon (NY) Marine Science Center = 72:26:27.6:W
-lat (NY) Mohonk Preserve Inc = 41:45:0.:N
-lon (NY) Mohonk Preserve Inc = 74:6:0.:W
-lat (NY) PSU-Ecosystem Studies Field Lab = 44:50:247:N
-lon (NY) PSU-Ecosystem Studies Field Lab = 73:34:818:W
-lat (NY) PSU-Twin Valleys Outdoor Education Center = 44:16:0:N
-lon (NY) PSU-Twin Valleys Outdoor Education Center = 73:29:0:W
-lat (NY) PSU-Valcour Kayaking & Docking Station = 44:36:359:N
-lon (NY) PSU-Valcour Kayaking & Docking Station = 73:26:306:W
-lat (NY) Rice Creek Field Station = 43:27:18.:N
-lon (NY) Rice Creek Field Station = 76:30:39.6:W
-lat (NY) Robert R. Smith (Oneonta) Environmental Fiel = 42:42:36.:N
-lon (NY) Robert R. Smith (Oneonta) Environmental Fiel = 74:54:36.:W
-lat (NY) Seatuck MWR = 40:48:50.4:N
-lon (NY) Seatuck MWR = 72:43:37.2:W
-lat (OH) Bath Field Station = 41:6:32.4:N
-lon (OH) Bath Field Station = 81:23:16.8:W
-lat (OH) F.T. Stone Laboratory = 41:39:14.4:N
-lon (OH) F.T. Stone Laboratory = 82:49:22.8:W
-lat (OH) JH Barrow Field Station = 41:18:46.8:N
-lon (OH) JH Barrow Field Station = 81:8:38.4:W
-lat (OH) Lake Erie Center = 41:41:20.4:N
-lon (OH) Lake Erie Center = 83:23:56.4:W
-lat (OH) Miami University Ecology Research Center = 30:31:57:N
-lon (OH) Miami University Ecology Research Center = 80:43:22:W
-lat (OH) Woodlake Environmental Field Station = 41:13:48.:N
-lon (OH) Woodlake Environmental Field Station = 81:31:12.:W
-lat (OK) Selman Living Laboratory = 48:12:0.:N
-lon (OK) Selman Living Laboratory = 99:16:1.2:W
-lat (OK) Univ of Oklahoma Biological Station = 33:52:57:N
-lon (OK) Univ of Oklahoma Biological Station = 96:48:2:W
-lat (OR) Cascade Head Experimental Forest and Scenic Research Area = 45:02:30:N
-lon (OR) Cascade Head Experimental Forest and Scenic Research Area = 123:55:30:W
-lat (OR) Hatfield Marine Science Center = 44:38:13.2:N
-lon (OR) Hatfield Marine Science Center = 124:3:7.2:W
-lat (OR) HJ Andrews Experimental Forest = 44:13:N
-lon (OR) HJ Andrews Experimental Forest = 122:15:W
-lat (OR) Oregon Institute of Marine Biology = 43:20:24:N
-lon (OR) Oregon Institute of Marine Biology = 124:19:44.4:W
-lat (OR) Malheur Field Station = 43:15:57.6:N
-lon (OR) Malheur Field Station = 118:50:34.8:W
-lat (PA) Hawk Mountain Sanctuary = 40:38:45.6:N
-lon (PA) Hawk Mountain Sanctuary = 75:58:48.:W
-lat (PA) Lacawac Sanctuary = 41:22:15.6:N
-lon (PA) Lacawac Sanctuary = 75:19:44.4:W
-lat (PA) Powdermill Biological Station = 40:11:49.2:N
-lon (PA) Powdermill Biological Station = 79:14:20.4:W
-lat (PA) Pymatuning Laboratory of Ecology = 41:39:21.6:N
-lon (PA) Pymatuning Laboratory of Ecology = 80:25:26.4:W
-lat (PA) Raystown Field Station = 40:21:28.8:N
-lon (PA) Raystown Field Station = 78:9:0.:W
-lat (PA) Stroud Water Research Center =
-lon (PA) Stroud Water Research Center =
-lat (PR) El Verde Field Station = 18:19:21:N
-lon (PR) El Verde Field Station = 65:49:13:W
-lat (PR) Mata de Platano Field Station and Nature Reserve = 18:25:N
-lon (PR) Mata de Platano Field Station and Nature Reserve = 66:43:W
-lat (PR) Institute of Neurobiology, University of Puerto Rico =
-lon (PR) Institute of Neurobiology, University of Puerto Rico =
-lat (SC) Belle Baruch Institute for Marine Biology = 33:21:3:N
-lon (SC) Belle Baruch Institute for Marine Biology = 79:11:5:W
-lat (SC) Savannah River Enviormental Field Station =
-lon (SC) Savannah River Enviormental Field Station =
-lat (SD) Oak Lake Field Station = 44:30:32.4:N
-lon (SD) Oak Lake Field Station = 96:31:55.2:W
-lat (TN) EJ Meeman Biological Station = 35:21:3.6:N
-lon (TN) EJ Meeman Biological Station = 89:59:13.2:W
-lat (TN) Reelfoot Lake Research and Teaching Center = 36:23:1:N
-lon (TN) Reelfoot Lake Research and Teaching Center = 89:21:0:W
-lat (TX) Chapala Ecology Station, Baylor (Waco) =
-lon (TX) Chapala Ecology Station, Baylor (Waco) =
-lat (TX) Brackenridge Field Laboratory = 30:16:26.4:N
-lon (TX) Brackenridge Field Laboratory = 97:43:55.2:W
-lat (TX) Indio Mountains Research Station = 30:46:41:N
-lon (TX) Indio Mountains Research Station = 105:0:52:W
-lat (TX) Marine Science Institute = 27:50:2.4:N
-lon (TX) Marine Science Institute = 97:3:39.6:W
-lat (TX) The University of Texas-Pan American Coastal Studies Laboratory =
-lon (TX) The University of Texas-Pan American Coastal Studies Laboratory =
-lat (TX) Upper Rio Grande Biological Station =
-lon (TX) Upper Rio Grande Biological Station =
-lat (UT) Cedar Mountain Science Center =
-lon (UT) Cedar Mountain Science Center =
-lat (UT) Red Butte Garden and Arboretum = 40:47:52.8:N
-lon (UT) Red Butte Garden and Arboretum = 111:46:58.8:W
-lat (VA) Anheuser Busch Coastal Research Center =
-lon (VA) Anheuser Busch Coastal Research Center =
-lat (VA) Blackwater Ecological Preserve = 36:45:0.:N
-lon (VA) Blackwater Ecological Preserve = 76:30:0.:W
-lat (VA) Blandy Experimental Farm = 39:3:50.4:N
-lon (VA) Blandy Experimental Farm = 78:3:54.:W
-lat (VA) Mountain Lake Biological Station = 37:22:30:N
-lon (VA) Mountain Lake Biological Station = 80:31:19.2:W
-lat (VA) Univ. of Virginia Coastal Research Center = 37:17:9.6:N
-lon (VA) Univ. of Virginia Coastal Research Center = 75:55:22.8:W
-lat (WA) Au-Sable Pacific Rim Facility = 48:12:0.:N
-lon (WA) Au-Sable Pacific Rim Facility = 122:0:0.:W
-lat (WA) Au Sable Institute of Environmental Studies = 44:46:12.:N
-lon (WA) Au Sable Institute of Environmental Studies = 84:54:0.:W
-lat (WA) Blakely Island Field Station = 48:33:160:N
-lon (WA) Blakely Island Field Station = 122:48:184:W
-lat (WA) Shannon Point Marine Center = 48:30:46.8:N
-lon (WA) Shannon Point Marine Center = 122:36:39.6:W
-lat (WA) Wind River Canopy Crane Research Facility = 45:49:13.76:N
-lon (WA) Wind River Canopy Crane Research Facility = 121:57:06.88:W
-lat (WI) Howard T. Greene Field Station = 42:58:1.2:N
-lon (WI) Howard T. Greene Field Station = 88:22:1.2:W
-lat (WI) Kemp Natural Resources Station = 45:49:58.8:N
-lon (WI) Kemp Natural Resources Station = 89:40:1.2:W
-lat (WI) Pigeon Lake Field Station = 46:22:12.:N
-lon (WI) Pigeon Lake Field Station = 91:24:36.:W
-lat (WI) Treehaven Field Station = 45:33:0.:N
-lon (WI) Treehaven Field Station = 89:33:36.:W
-lat (WI) Trout Lake Station = 46:1:4.8:N
-lon (WI) Trout Lake Station = 89:40:4.8:W
-lat (WI) University of Notre Dame Environmental Research Center =
-lon (WI) University of Notre Dame Environmental Research Center =
-lat (WI) Univ of Wisconsin Milwaukee Field Station = 43:22:55.2:N
-lon (WI) Univ of Wisconsin Milwaukee Field Station = 88:01:15:W
-lat (WV) Spruce Knob Mountain Center = 38:40:15.6:N
-lon (WV) Spruce Knob Mountain Center = 79:29:27.6:W
-lat (WY) Wyoming National Park Service = 43:51:25.2:N
-lon (WY) Wyoming National Park Service = 110:35:20.4:W
-lat (AZ) Aravaipa Canyon Preserve, Ind. Mem. = 32:53:52.8:N
-lon (AZ) Aravaipa Canyon Preserve, Ind. Mem. = 110:26:20.4:W
-lat [Australia] School for Field Studies- Centre for Rainforest Studies =
-lon [Australia] School for Field Studies- Centre for Rainforest Studies =
-lat [Bahamas] Bahamian Field Station, San Salvador Island =
-lon [Bahamas] Bahamian Field Station, San Salvador Island =
-lat [Bahamas] Bahamas Environmental Research Center, Andros Island =
-lon [Bahamas] Bahamas Environmental Research Center, Andros Island =
-lat [Bahamas] Forfar Field Station = 
-lon [Bahamas] Forfar Field Station = 
-lat [Belize] Jaguar Creek = 17:09:38.6:N
-lon [Belize] Jaguar Creek = 88:40:48.0:W
-lat [Belize] Las Cuevas Forest Research Station =
-lon [Belize] Las Cuevas Forest Research Station =
-lat [Bermuda] Bermuda Biological Station = 32:22.2 N
-lon [Bermuda] Bermuda Biological Station = 64:41.7 W
-lat [Brazil] Iracambi Atlantic Rainforest Research & Conservation Center =
-lon [Brazil] Iracambi Atlantic Rainforest Research & Conservation Center =
-lat [British West Indies] School for Field Studies-Center for Marine Studies =
-lon [British West Indies] School for Field Studies-Center for Marine Studies =
-lat [Canada] Bamfield Marine Station =
-lon [Canada] Bamfield Marine Station =
-lat [Canada] Churchill Northern Studies Centre =
-lon [Canada] Churchill Northern Studies Centre = 
-lat [Canada] Cochrane Ecological Institute =
-lon [Canada] Cochrane Ecological Institute =
-lat [Canada] Churchill Northern Studies Centre =
-lon [Canada] Churchill Northern Studies Centre =
-lat [Canada] Delta Marsh Field Station =
-lon [Canada] Delta Marsh Field Station =
-lat [Canada] Gault Nature Reserve  = 45:31:N 
-lon [Canada] Gault Nature Reserve  = 73:08:W
-lat [Canada] Huntsman Marine Science Centre =
-lon [Canada] Huntsman Marine Science Centre =
-lat [Canada] Meanook Biological Research Station = 
-lon [Canada] Meanook Biological Research Station =  
-lat [Canada] Kananaskis Field Stations = 51:02:N
-lon [Canada] Kananaskis Field Stations = 115:03:W
-lat [Canada] Taiga Biological Station =
-lon [Canada] Taiga Biological Station =
-lat [Costa Rica] La Laguna del Lagarto Lodge =
-lon [Costa Rica] La Laguna del Lagarto Lodge =
-lat [Costa Rica] La Suerte Biological Field Station =
-lon [Costa Rica] La Suerte Biological Field Station = 
-lat [Costa Rica] La Selva Biological Station = 10:25:50 N
-lon [Costa Rica] La Selva Biological Station = 84:00:25 W
-lat [Costa Rica] Mata de Platano Field Station and Nature Reserve =
-lon [Costa Rica] Mata de Platano Field Station and Nature Reserve =
-lat [Costa Rica] Organization of Tropical Studies (OTS) =
-lon [Costa Rica] Organization of Tropical Studies (OTS) =
-lat [Costa Rica] Quetzal Education Research Complex =
-lon [Costa Rica] Quetzal Education Research Complex =
-lat [Dominica] Archbold Tropical Research Center , Springfield Station =
-lon [Dominica] Archbold Tropical Research Center , Springfield Station =
-lat [Dominica, West Indies] The Institute for Tropical marine Ecology =
-lon [Dominica, West Indies] The Institute for Tropical marine Ecology =
-lat [Mexico] Chapala Ecology Station, Baylor University =
-lon [Mexico] Chapala Ecology Station, Baylor University =
-lat [Mexico] Kino Bay Center for Cultural & Ecological Studies =
-lon [Mexico] Kino Bay Center for Cultural & Ecological Studies =
-lat [Mexico] Tijuana River National Estuarine Research R = 32:33:14.4:N
-lon [Mexico] Tijuana River National Estuarine Research R = 117:6:50.4:W
-lat [Namibia] Gobabeb Training and Research Centre = 23:33:704:S
-lon [Namibia] Gobabeb Training and Research Centre = 15:02:466:E
-lat [Nicaragua] Isla Ometepe Biological Field Station (Ometepe Island within Lake Nicaragua) =
-lon [Nicaragua] Isla Ometepe Biological Field Station (Ometepe Island within Lake Nicaragua) =
-lat [Panama] Institute for Tropical Ecology and Conservation = 
-lon [Panama] Institute for Tropical Ecology and Conservation = 
-lat [Panama] Smithsonian Tropical Research Institute =
-lon [Panama] Smithsonian Tropical Research Institute =
-lat [South Pacific] Richard B Gump South Pacific Biological Research Station =
-lon [South Pacific] Richard B Gump South Pacific Biological Research Station =
Index: lib/style/skins/specnet/specnet.cfg
===================================================================
--- lib/style/skins/specnet/specnet.cfg	(revision 5310)
+++ lib/style/skins/specnet/specnet.cfg	(nonexistent)
@@ -1,60 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=specnetadmin,o=LTER,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = specnet
-organization = SpecNet
-orgabbrev = SpecNet
-orgurl = http://vcsars.calstatela.edu/SpecNet/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = hyperion.nceas.ucsb.edu
-sender = SpecNet Data Registry <specnetadmin@lternet.edu>
-recipient = dfuente@calstatela.edu
-adminname = David Fuentes
-debug = 0
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'true'
-showWgList = 'false'
-showOrganization = 'false'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-lat (AK) Atqasuk = 70:28:10.6:N
-lon (AK) Atqasuk = 157:24:32.2:W
-lat (AK) Barrow = 71:19:21.09:N
-lon (AK) Barrow = 156:37:33.17:W
-lat (CA) Santa Margarita = 33:28:27.84:N
-lon (CA) Santa Margarita = 117:8:16.44:W
-lat (CA) Sky Oaks = 33:22:26:N
-lon (CA) Sky Oaks = 116:37:22.4:W
-lat (IN) Morgan Monroe State Forest = 39:19:16.83:N
-lon (IN) Morgan Monroe State Forest = 86:24:48.07:W
-lat (NC) Duke Forest = 35:58:24.9:N
-lon (NC) Duke Forest = 79:6:1.55:W
-lat (NV) Nevada Desert Research Center = 39:45:36:N 
-lon (NV) Nevada Desert Research Center = 115:59:24:W
-lat [Australia] Tumbarumba = 35:39:20.6:S 
-lon [Australia] Tumbarumba = 148:9:7.5:E
-lat [Mexico] La Paz = 24:7:45.3:N
-lon [Mexico] La Paz = 110:26:16.87:W
-lat [Sweden] Stordalen Mire = 68:22:0:N
-lon [Sweden] Stordalen Mire = 19:3:0:E

Property changes on: lib/style/skins/specnet/specnet.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/tpc-result/tpc-result.xml
===================================================================
--- lib/style/skins/tpc-result/tpc-result.xml	(revision 5310)
+++ lib/style/skins/tpc-result/tpc-result.xml	(revision 5311)

Property changes on: lib/style/skins/tpc-result/tpc-result.xml
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: lib/style/skins/sms/sms.cfg
===================================================================
--- lib/style/skins/sms/sms.cfg	(revision 5310)
+++ lib/style/skins/sms/sms.cfg	(nonexistent)
@@ -1,38 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://linus.nceas.ucsb.edu:80/sms/metacat
-username = uid=knbadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=ldap://ldap.ecoinformatics.org/dc=ecoinformatics,dc=org
-defaultScope = sms
-organization = SEEK
-orgabbrev = SEEK
-orgurl = http://seek.ecoinformatics.org/
-responseTemplate = genericResponse.tmpl
-entryFormTemplate = entryForm.tmpl
-guideTemplate = genericGuide.tmpl
-confirmDataTemplate = confirmData.tmpl
-deleteDataTemplate = deleteData.tmpl
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = localhost 
-sender = KNB Data Registry <help@nceas.ucsb.edu>
-recipient = help@nceas.ucsb.edu
-adminname = the repository administrator
-debug = 1
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'false'
-showWgList = 'false'
-showOrganization = 'true'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-nceas_db = somedb
-nceas_db_user = someuser
-nceas_db_password = your-pw-goes-here

Property changes on: lib/style/skins/sms/sms.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/nrs/nrs.cfg
===================================================================
--- lib/style/skins/nrs/nrs.cfg	(revision 5310)
+++ lib/style/skins/nrs/nrs.cfg	(nonexistent)
@@ -1,115 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=nrsadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = nrs
-organization = University of California Natural Reserve System
-orgabbrev = UCNRS
-orgurl = http://www.ucnrs.org
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@
-sender = NRS Data Registry <kbrowne@ucnrs.org>
-recipient = kevin@jamesreserve.edu
-adminname = Kevin Browne
-debug = 0
-lsite = 'reserve'
-usite = 'Reserve'
-showSiteList = 'true'
-showWgList = 'false'
-showOrganization = 'false'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-lat Angelo Coast Range Reserve = 39:43:45:N
-lat Ano Nuevo Island Reserve = 37:6:30:N
-lat Bodega Marine Reserve = 38:18:25:N
-lat Box Springs Reserve = 33:59:31:N
-lat Boyd Deep Canyon Desert Research Center = 38:45:00:N
-lat Burns Pinon Ridge Reserve = 34:08:20:N
-lat Carpinteria Salt Marsh Reserve = 34:24:00:N
-lat Chickering American River Reserve =39:14:48:N
-lat Coal Oil Point Natural Reserve = 34:25:00:N
-lat Dawson Los Monos Canyon Reserve = 33:08:30:N
-lat Eagle Lake Field Station = 40:37:02:N
-lat Elliott Chaparral Reserve = 32:52:06:N
-lat Emerson Oaks Reserve = 33:28:00:N
-lat Fort Ord Natural Reserve = 36:40:00:N
-lat Hastings Natural History Reservation = 36:12:30:N
-lat James San Jacinto Mountains Reserve = 33:48:30:N
-lat Jenny Pygmy Forest Reserve = 39:17:00:N
-lat Jepson Prairie Reserve = 38:16:0:N
-lat Kendall-Frost Mission Bay Marsh Reserve = 32:47:35:N
-lat Kenneth Norris Rancho Marino Reserve = 35:31:40:N
-lat Landels-Hill Big Creek Reserve = 36:04:00:N
-lat McLaughlin Natural Reserve = 38:52:26:N
-lat Motte Rimrock Reserve = 33:48:45:N
-lat Oasis de los Osos Reserve = 33:53:30:N
-lat Quail Ridge Reserve = 38:49:04:N
-lat Sacramento Mountains Reserve = 34:47:51:N
-lat Sagehen Creek Field Station = 39:29:54:N
-lat San Joaquin Freshwater Marsh Reserve = 33:39:30:N
-lat Santa Cruz Island Reserve = 34:00:00:N
-lat Scripps Coastal Reserve = 32:52:30:N
-lat Sedgwick Reserve =  34:40:21:N
-lat Sierra Nevada Aquatic Research Laboratory = 37:36:51:N
-lat Stebbins Cold Canyon Reserve = 38:30:22:N
-lat Stunt Ranch Santa Monica Mountains Reserve = 34:6:0:N
-lat Sweeney Granite Mountains Desert Research Center = 34:48:20:N
-lat Valentine Camp = 37:37:30:N
-lat Younger Lagoon Reserve =36:57:03:N
-lon Angelo Coast Range Reserve = 123:38:40:W
-lon Ano Nuevo Island Reserve = 122:20:10:W
-lon Bodega Marine Reserve = 123:03:54:W
-lon Box Springs Reserve = 117:17:43:W
-lon Boyd Deep Canyon Desert Research Center = 79:30:00:W
-lon Burns Pinon Ridge Reserve = 116:27:10:W
-lon Carpinteria Salt Marsh Reserve = 119:31:30:W
-lon Chickering American River Reserve = 120:19:31:W
-lon Coal Oil Point Natural Reserve = 119:52:30:W
-lon Dawson Los Monos Canyon Reserve = 117:15:20:W
-lon Eagle Lake Field Station = 120:43:37:W
-lon Elliott Chaparral Reserve = 117:08:33:W
-lon Emerson Oaks Reserve = 117:02:22:W
-lon Fort Ord Natural Reserve = 121:46:00:W
-lon Hastings Natural History Reservation = 121:33:30:W
-lon James San Jacinto Mountains Reserve = 116:46:40:W
-lon Jenny Pygmy Forest Reserve = 123:45:25:W
-lon Jepson Prairie Reserve = 121:49:25:W
-lon Kendall-Frost Mission Bay Marsh Reserve = 117:13:00:W
-lon Kenneth Norris Rancho Marino Reserve = 121:04:35:W
-lon Landels-Hill Big Creek Reserve = 121:35:00:W
-lon McLaughlin Natural Reserve = 122:25:54:W
-lon Motte Rimrock Reserve = 117:15:30:W
-lon Oasis de los Osos Reserve = 116:41:18:W
-lon Quail Ridge Reserve = 122:14:28:W
-lon Sacramento Mountains Reserve = 114:43:51:W
-lon Sagehen Creek Field Station = 120:14:25:W
-lon San Joaquin Freshwater Marsh Reserve = 117:51:30:W
-lon Santa Cruz Island Reserve = 119:44:00:W
-lon Scripps Coastal Reserve = 117:15:15:W
-lon Sedgwick Reserve = 120:00:33:W
-lon Sierra Nevada Aquatic Research Laboratory = 118:49:47:W
-lon Stebbins Cold Canyon Reserve = 122:5:50:W
-lon Stunt Ranch Santa Monica Mountains Reserve = 118:39:0:W
-lon Sweeney Granite Mountains Desert Research Center = 115:39:50:W
-lon Valentine Camp = 118:59:30:W
-lon Younger Lagoon Reserve = 122:03:57:W
-

Property changes on: lib/style/skins/nrs/nrs.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/saeon/saeon.cfg
===================================================================
--- lib/style/skins/saeon/saeon.cfg	(revision 5310)
+++ lib/style/skins/saeon/saeon.cfg	(nonexistent)
@@ -1,38 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=saeonadmin,o=SAEON,dc=ecoinformatics,dc=org
-password = testme
-ldapUrl = @ldapUrl@
-defaultScope = saeon
-organization = South African Environmental Observation Network Repository
-orgabbrev = SAEON
-orgurl = http://www.saeon.ac.za/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-spatialRequired = false
-temporalRequired = false
-showSiteList = 'false'
-showWgList = 'false'
-hasUpload = 'true'
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = somewhere.sanparks.org
-sender = registry@sanparks.org
-recipient = judithk@sanparks.org
-adminname = Judith Kruger
-debug = 0
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-# example format ...
-# lat [UK] Harwood forest[Sitka Spruce] = 55:12:46:N
-# lon [UK] Harwood forest[Sitka Spruce] = 2:2:15:W

Property changes on: lib/style/skins/saeon/saeon.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/esa/esa.cfg
===================================================================
--- lib/style/skins/esa/esa.cfg	(revision 5310)
+++ lib/style/skins/esa/esa.cfg	(nonexistent)
@@ -1,46 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=esaadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = esa
-organization = Ecological Society of America
-orgabbrev = ESA
-orgurl = http://www.esa.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-loginFormTemplate = @loginForm@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-modEmailNotificationTemplate = esaModNotification.tmpl
-modResultTemplate = esaModResultTemplate.tmpl
-getReviewsTemplate = getReviews.tmpl
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@
-sender = ESA Data Registry <esaadmin@nceas.ucsb.edu>
-recipient = esaadmin@nceas.ucsb.edu
-adminname = ESA Registry Administrator
-debug = 0
-lsite = 'organization'
-usite = 'Organization'
-showSiteList = 'false'
-showWgList = 'false'
-showOrganization = 'true'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-contactEmailAddressRequired = 'true'
-publicReadable = 'false'
-adminIsDocOwner = 'true'
-#
-# Access will be given to the list of users mentioned below.
-#
-moderators = @moderators@

Property changes on: lib/style/skins/esa/esa.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/knb/knb.cfg
===================================================================
--- lib/style/skins/knb/knb.cfg	(revision 5310)
+++ lib/style/skins/knb/knb.cfg	(nonexistent)
@@ -1,38 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=knbadmin,o=NCEAS,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = knb
-organization = Knowledge Network for Biocomplexity
-orgabbrev = KNB
-orgurl = http://knb.ecoinformatics.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = @mailhost@ 
-sender = KNB Data Registry <help@nceas.ucsb.edu>
-recipient = help@nceas.ucsb.edu
-adminname = the repository administrator
-debug = 1
-lsite = 'station'
-usite = 'Station'
-showSiteList = 'false'
-showWgList = 'false'
-showOrganization = 'true'
-hasTaxonomic = 'true'
-hasMethod = 'true'
-hasSpatial = 'true'
-hasKeyword = 'true'
-hasTemporal = 'true'
-nceas_db = somedb
-nceas_db_user = someuser
-nceas_db_password = your-pw-goes-here

Property changes on: lib/style/skins/knb/knb.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/pisco/pisco.cfg
===================================================================
--- lib/style/skins/pisco/pisco.cfg	(revision 5310)
+++ lib/style/skins/pisco/pisco.cfg	(nonexistent)
@@ -1,496 +0,0 @@
-#
-# General configuration parameters
-#
-metacatUrl = http://@httpserver@@servlet-path@
-username = uid=obfsadmin,o=LTER,dc=ecoinformatics,dc=org
-password = your-pw-goes-here
-ldapUrl=@ldapUrl@
-defaultScope = obfs
-organization = Organization of Biological Field Stations
-orgabbrev = OBFS
-orgurl = http://www.obfs.org/
-responseTemplate = @responseForm@
-entryFormTemplate = @entryForm@
-guideTemplate = @guide@
-confirmDataTemplate = @confirmData@
-deleteDataTemplate = @deleteData@
-accesspubid = -//ecoinformatics.org//eml-access-2.0.0beta6//EN
-accesssysid = eml-access.dtd
-datasetpubid = eml://ecoinformatics.org/eml-dataset-2.0.0
-datasetsysid = eml-dataset.dtd
-mailhost = hyperion.nceas.ucsb.edu
-sender = OBFS Data Registry <obfsadmin@lternet.edu>
-recipient = tmaddux@lternet.edu
-adminname = Troy Maddux
-debug = 0
-#
-# These are the sites and their coordinates. Coordinates are in
-# degrees:minutes:seconds:direction format
-# Make sure there is a lat/lon pair for every site
-#
-lat (AK) Toolik Field Station =
-lon (AK) Toolik Field Station =
-lat (AR) Ouachita Mountains Biological Station = 34:26:56.4:N
-lon (AR) Ouachita Mountains Biological Station = 94:0:32.4:W
-lat (AZ) Appleton-Whittell Research Ranch = 31:35:27.6:N
-lon (AZ) Appleton-Whittell Research Ranch = 110:30:21.6:W
-lat (AZ) Desert Station = 32:14:2.4:N
-lon (AZ) Desert Station = 111:9:3.6:W
-lat (AZ) Rincon Institute = 32:5:9.6:N
-lon (AZ) Rincon Institute = 110:42:39.6:W
-lat (AZ) Sierra Ancha Station = 33:40:58.8:N
-lon (AZ) Sierra Ancha Station = 110:58:1.2:W
-lat (AZ) Sonoran Arthropod Studies Institute = 32:07:451:N
-lon (AZ) Sonoran Arthropod Studies Institute = 111:14:311:W
-lat (AZ) Southwestern Research Station = 31:53:2.4:N
-lon (AZ) Southwestern Research Station = 109:12:28.8:W
-lat (CA) Año Nuevo Island Reserve  = 
-lon (CA) Año Nuevo Island Reserve  = 
-lat (CA) Bernard Biological Field Station (Claremont Colleges) =
-lon (CA) Bernard Biological Field Station (Claremont Colleges) =
-lat (CA) Bodega Bay Marine Laboratory and Reserve = 38:19:3:N
-lon (CA) Bodega Bay Marine Laboratory and Reserve = 123:4:12:W
-lat (CA) Boyd Deep Canyon Desert Research Center = 33:43:19.2:N
-lon (CA) Boyd Deep Canyon Desert Research Center = 116:23:2.4:W
-lat (CA) Coal Oil Point Reserve = 34:25:00:N
-lon (CA) Coal Oil Point Reserve = 119:52:30:W
-lat (CA) Dawson Los Monos Canyon Reserve = 33:8:31.2:N
-lon (CA) Dawson Los Monos Canyon Reserve = 117:15:21.6:W
-lat (CA) Desert Studies Center = 35:35:20.4:N
-lon (CA) Desert Studies Center = 116:21:18.:W
-lat (CA) Eagle Lake Biological Field Station = 40:37:1.2:N
-lon (CA) Eagle Lake Biological Field Station = 120:43:37.2:W
-lat (CA) Field Research Station, Gazos Creek = 37:11.1:N
-lon (CA) Field Research Station, Gazos Creek = 122:17:25:W
-lat (CA) Fortuna Mountain Research Reserve = 32:50:38.4:N
-lon (CA) Fortuna Mountain Research Reserve = 117:3:21.6:W
-lat (CA) Hastings Natural History Reservation = 36:23:14.9:N
-lon (CA) Hastings Natural History Reservation = 121:33:05:W
-lat (CA) Hopkins Marine Station = 36:37:15.6:N
-lon (CA) Hopkins Marine Station = 121:54:10.8:W
-lat (CA) James San Jacinto Mountains Reserve = 33:48:28.8:N
-lon (CA) James San Jacinto Mountains Reserve = 116:46:40.8:W
-lat (CA) Jasper Ridge Biological Preserve = 37:24:0.:N
-lon (CA) Jasper Ridge Biological Preserve = 122:13:30.:W
-lat (CA) Kendall Frost Marsh Reserve = 32:47:34.8:N
-lon (CA) Kendall Frost Marsh Reserve = 117:13:1.2:W
-lat (CA) Landels-Hill Big Creek Reserve = 36:4:12.:N
-lon (CA) Landels-Hill Big Creek Reserve = 121:35:56.4:W
-lat (CA) Long Marine Laboratory = 36:56:52.8:N
-lon (CA) Long Marine Laboratory = 122:3:50.4:W
-lat (CA) McLaughlin Reserve = 
-lon (CA) McLaughlin Reserve = 
-lat (CA) Moss Landing Marine Laboratory = 36:48:0.:N
-lon (CA) Moss Landing Marine Laboratory = 121:47:16.8:W
-lat (CA) Pepperwood Ranch Natural Preserve = 38:34:4.8:N
-lon (CA) Pepperwood Ranch Natural Preserve = 122:42:3.6:W
-lat (CA) Quail Ridge Reserve = 
-lon (CA) Quail Ridge Reserve = 
-lat (CA) Santa Cruz Island Reserve = 34:4:4.8:N
-lon (CA) Santa Cruz Island Reserve = 119:43:4.8:W
-lat (CA) Scripps Coastal Reserve = 32:52:30.:N
-lon (CA) Scripps Coastal Reserve = 117:15:14.4:W
-lat (CA) Santa Margarita Biological Field Station = 33:27:28.8:N
-lon (CA) Santa Margarita Biological Field Station = 117:10:1.2:W
-lat (CA) Sedgwick Reserve = 34:40:4.8:N
-lon (CA) Sedgwick Reserve = 120:6:50.4:W
-lat (CA) Sierra Nevada Aquatic Research Lab = 37:36:51:N
-lon (CA) Sierra Nevada Aquatic Research Lab = 118:49:47:W
-lat (CA) Sierra Nevada Field Campus = 39:35:16.8:N
-lon (CA) Sierra Nevada Field Campus = 120:25:44.4:W
-lat (CA) Sky Oaks Field Station = 33:22:37.2:N
-lon (CA) Sky Oaks Field Station = 116:37:22.8:W
-lat (CA) Starr Ranch Sanctuary = 33:37:44.4:N
-lon (CA) Starr Ranch Sanctuary = 117:33:10.8:W
-lat (CA) Stebbins Cold Canyon Reserve = 
-lon (CA) Stebbins Cold Canyon Reserve =
-lat (CA) Stunt Ranch Santa Monica Mountains Reserve = 34:6:N
-lon (CA) Stunt Ranch Santa Monica Mountains Reserve = 118:39:W
-lat (CA) Sweeney Granite Mountains Desert Research Center = 34:48:21.6:N
-lon (CA) Sweeney Granite Mountains Desert Research Center = 115:39:50.4:W
-lat (CA) Teakettle Experimental Forest = 36:58:0:N
-lon (CA) Teakettle Experimental Forest = 119:2:0:W
-lat (CA) Valentine Eastern Sierra Reserve = 37:37:30:N
-lon (CA) Valentine Eastern Sierra Reserve = 118:59:30:W
-lat (CA) Volcano Bay Field Station =
-lon (CA) Volcano Bay Field Station =
-lat (CA) White Mountain Research Station = 37:21:40:N
-lon (CA) White Mountain Research Station = 118:19:35:W
-lat (CO) Catamount Environmental Institute =
-lon (CO) Catamount Environmental Institute =
-lat (CO) Mountain Research Station = 40:6:0.:N
-lon (CO) Mountain Research Station = 105:29:24.:W
-lat (CO) Rocky Mountain Biological Laboratory = 38:57:32.4:N
-lon (CO) Rocky Mountain Biological Laboratory = 106:59:20.4:W
-lat (CO) Shortgrass Steppe LTER Site = 40:42:36.:N
-lon (CO) Shortgrass Steppe LTER Site = 104:46:48.:W
-lat (CT) Trinity College Field Station = 41:49:58.8:N
-lon (CT) Trinity College Field Station = 72:10:8.4:W
-lat (FL) Archbold Biological Station = 27:11:16.8:N
-lon (FL) Archbold Biological Station = 81:20:16.8:W
-lat (FL) Brooker Creek Preserve = 28:8:13.2:N
-lon (FL) Brooker Creek Preserve = 82:40:26.4:W
-lat (FL) Disney Wilderness Preserve = 28:7:55.2:N
-lon (FL) Disney Wilderness Preserve = 81:24:18:W
-lat (FL) Katharine Ordway Natural History Study Area = 44:7:58.8:N
-lon (FL) Katharine Ordway Natural History Study Area = 93:0:0.:W
-lat (FL) Katharine Ordway Preserve - Swisher Memorial Sanctuary = 29:41:45.6:N
-lon (FL) Katharine Ordway Preserve - Swisher Memorial Sanctuary = 81:58:55.2:W
-lat (FL) MacArthur Agro-Ecology Research Station = 27:8:24.:N
-lon (FL) MacArthur Agro-Ecology Research Station = 81:9:0.:W
-lat (FL) Pinellas County Biological Field Research Station at Brooker Creek Preserve =
-lon (FL) Pinellas County Biological Field Research Station at Brooker Creek Preserve =
-lat (FL) Riverwoods Field Laboratory = 27:22:40.8:N
-lon (FL) Riverwoods Field Laboratory = 81:5:49.2:W
-lat (FL) Seahorse Key Marine Laboratory = 29:5:9.6:N
-lon (FL) Seahorse Key Marine Laboratory = 83:1:8.4:W
-lat (FL) Tall Timbers Research Station = 30:30:0.:N
-lon (FL) Tall Timbers Research Station = 84:0:0.:W
-lat (GA) Savannah River Environmental Field Station = 33:21:43.2:N
-lon (GA) Savannah River Environmental Field Station = 81:41:45.6:W
-lat (GA) St. Catherines Island Research Station = 31:40:N
-lon (GA) St. Catherines Island Research Station = 81:09:W
-lat (IA) Conard (Henry S.) Environmental Research Area = 41:42:46.8:N
-lon (IA) Conard (Henry S.) Environmental Research Area = 92:52:44.4:W
-lat (IA) Iowa Lakeside Laboratory = 43:29:24.:N
-lon (IA) Iowa Lakeside Laboratory = 95:11:24.:W
-lat (ID) Clark Fork Field Station = 48:9:0.:N
-lon (ID) Clark Fork Field Station = 116:9:7.2:W
-lat (ID) McCall Field Campus = 44:54:39.6:N
-lon (ID) McCall Field Campus = 116:6:3.6:W
-lat (ID) Northwest Watershed Research Center =
-lon (ID) Northwest Watershed Research Center =
-lat (ID) Taylor Ranch Wilderness Field Station = 45:6:14.4:N
-lon (ID) Taylor Ranch Wilderness Field Station = 114:51:14.4:W
-lat (IL) ACM Wilderness Field Station = 47:59:42.:N
-lon (IL) ACM Wilderness Field Station = 91:49:51.6:W
-lat (IL) Ecological Field Station-Monmoth College = 41:4:4.8:N
-lon (IL) Ecological Field Station-Monmoth College = 90:45:3.6:W
-lat (IL) Forbes Biological Station = 40:21:10:N
-lon (IL) Forbes Biological Station = 90:3:0.:W
-lat (IL) Grasslands Wildlife Research Lab = 38:55:1.2:N
-lon (IL) Grasslands Wildlife Research Lab = 88:12:0.:W
-lat (IL) Great Rivers Field Station - LTRM 26 = 38:55:58.8:N
-lon (IL) Great Rivers Field Station - LTRM 26 = 90:1:20:W
-lat (IL) Green Wing Environmental  Laboratory = 41:42:50.4:N
-lon (IL) Green Wing Environmental  Laboratory = 89:19:44.4:W
-lat (IL) Illinois River Biological Station = 40:21:10:N
-lon (IL) Illinois River Biological Station = 90:1:20:W
-lat (IL) Kaskaskia Biological Station = 39:30:0.:N
-lon (IL) Kaskaskia Biological Station = 88:45:0.:W
-lat (IL) Kibbe Life Sciences Field Station = 40:21:32.4:N
-lon (IL) Kibbe Life Sciences Field Station = 91:26:2.4:W
-lat (IL) Lake Michigan Biological Station = 42:28:1.2:N
-lon (IL) Lake Michigan Biological Station = 87:49:1.2:W
-lat (IL) Wheaton College Science Station = 103:13:12.:W
-lon (IL) Wheaton College Science Station = 44:5:24.:N
-lat (IN) Ecology Research Center = 39:52:58.8:N
-lon (IN) Ecology Research Center = 85:12:0.:W
-lat (IN) Notre Dame Environmental Research Center = 46:13:37:N
-lon (IN) Notre Dame Environmental Research Center = 89:31:24:W
-lat (IN) Purdue Univ. N. Central Biology Field Station = 41:42:0.:N
-lon (IN) Purdue Univ. N. Central Biology Field Station = 86:56:45.6:W
-lat (KS) Kansas Ecological Reserves = 39:1:58.8:N
-lon (KS) Kansas Ecological Reserves = 95:12:0.:W
-lat (KS) Konza Prairie Biological Station = 39:3:0:N
-lon (KS) Konza Prairie Biological Station = 96:21:0:W
-lat (KY) Hancock Biological Station = 36:44:31.2:N
-lon (KY) Hancock Biological Station = 88:7:30.:W
-lat (KY) Lilley Cornett Woods = 37:5:24.:N
-lon (KY) Lilley Cornett Woods = 83:1:12.:W
-lat (KY) Robinson Forest = 37:33:10.8:N
-lon (KY) Robinson Forest = 83:23:2.4:W
-lat (KY) Thomas More College = 39:1:12.:N
-lon (KY) Thomas More College = 84:19:48.:W
-lat (LA) LUMCON Marine Center-Cocodrie, LA = 29:14:49.2:N
-lon (LA) LUMCON Marine Center-Cocodrie, LA = 90:39:39.6:W
-lat (LA) Turtle Cove Environmental Research Station = 30:17:38.4:N
-lon (LA) Turtle Cove Environmental Research Station = 90:18:14.4:W
-lat (MA) Hopkins Memorial Forest = 42:43:58.8:N
-lon (MA) Hopkins Memorial Forest = 73:15:0.:W
-lat (MA) Manomet Center for Conservation Sciences = 42:4:1.2:N
-lon (MA) Manomet Center for Conservation Sciences = 71:4:1.2:W
-lat (MA) Nantucket Field Station = 41:23:20.4:N
-lon (MA) Nantucket Field Station = 70:2:45.6:W
-lat (ME) Bowdoin Scientific Station = 44:30:3.6:N
-lon (ME) Bowdoin Scientific Station = 66:50:2.4:W
-lat (ME) Humboldt Field Research Institute = 44:28:48.:N
-lon (ME) Humboldt Field Research Institute = 68:1:48.:W
-lat (ME) Mount Desert Island Biological Laboratory = 44:25:48.:N
-lon (ME) Mount Desert Island Biological Laboratory = 68:17:24.:W
-lat (ME) Shoals Marine Laboratory = 42:59:20.4:N
-lon (ME) Shoals Marine Laboratory = 70:36:54.:W
-lat (MI) CMU Biological Station = 45:41:38.4:N
-lon (MI) CMU Biological Station = 85:32:24.:W
-lat (MI) E S George Reserve = 42:27:46.8:N
-lon (MI) E S George Reserve = 83:57:50.4:W
-lat (MI) Univ of Michigan Biological Station = 45:33:36.:N
-lon (MI) Univ of Michigan Biological Station = 84:40:40.8:W
-lat (MI) Univ of Michigan Biological StationDouglas L = 45:34:51.6:N
-lon (MI) Univ of Michigan Biological StationDouglas L = 84:41:49.2:W
-lat (MI) W.K. Kellogg Biological Station = 42:24:0.:N
-lon (MI) W.K. Kellogg Biological Station = 85:24:39.6:W
-lat (MN) Cedar Creek Natural History Area = 45:24:14.4:N
-lon (MN) Cedar Creek Natural History Area = 93:16:4.8:W
-lat (MN) Cloquet Forestry Center = 46:42:18.:N
-lon (MN) Cloquet Forestry Center = 92:31:19.2:W
-lat (MN) Katharine Ordway Natural History Study Area =
-lon (MN) Katharine Ordway Natural History Study Area =
-lat (MN) Lake Itasca Forestry and Biological Station = 47:13:39:N
-lon (MN) Lake Itasca Forestry and Biological Station = 95:11:30:W
-lat (MN) MSUM Regional Sceince Center = 46:52:12:N
-lon (MN) MSUM Regional Sceince Center = 96:29:24:W
-lat (MN) St Croix Watershed Research Station = 45:10:16:N
-lon (MN) St Croix Watershed Research Station = 92:45:39:W
-lat (MN) Vermilion Community College = 47:54:3.6:N
-lon (MN) Vermilion Community College = 91:52:4.8:W
-lat (MO) Bull Shoals Field Station = 36:33:57.6:N
-lon (MO) Bull Shoals Field Station = 93:4:33.6:W
-lat (MO) Lay Field Station = 39:24:14.4:N
-lon (MO) Lay Field Station = 91:9:3.6:W
-lat (MO) Reis Biological Station = 37:58:48.:N
-lon (MO) Reis Biological Station = 91:13:48.:W
-lat (MO) Tyson Research Center = 38:32:13.2:N
-lon (MO) Tyson Research Center = 90:33:32.4:W
-lat (MS) Univ of Mississippi Field Station = 34:25:30.:N
-lon (MS) Univ of Mississippi Field Station = 89:23:31.2:W
-lat (MT) Flathead Lake Biological Station = 47:52:35:N
-lon (MT) Flathead Lake Biological Station = 114:01:54:W
-lat (MT) Yellowstone Ecosystem Studies Field Station =
-lon (MT) Yellowstone Ecosystem Studies Field Station =
-lat (NC) Coweeta Hydrologic Laboratory = 35:4:48:N
-lon (NC) Coweeta Hydrologic Laboratory = 83:25:48:W
-lat (NC) Highlands Biological Station = 35:3:14.4:N
-lon (NC) Highlands Biological Station = 83:11:16.8:W
-lat (NE) Cedar Point Biological Station = 41:12:32.4:N
-lon (NE) Cedar Point Biological Station = 101:38:45.6:W
-lat (NH) Hubbard Brook Research Foundation = 43:55:58.8:N
-lon (NH) Hubbard Brook Research Foundation = 71:45:0.:W
-lat (NJ) Pinelands Field Research Station = 39:55:48.:N
-lon (NJ) Pinelands Field Research Station = 74:36:0.:W
-lat (NM) Sevilleta Field Station = 34:21:0.:N
-lon (NM) Sevilleta Field Station = 106:53:2.4:W
-lat (NV) Nevada Desert Ecological Research Facility = 
-lon (NV) Nevada Desert Ecological Research Facility = 
-lat (NV) Desert Research Institute = 39:31:48.:N
-lon (NV) Desert Research Institute = 119:48:46.8:W
-lat (NV) Whittell Forest & Wildlife Area = 39:16:30.:N
-lon (NV) Whittell Forest & Wildlife Area = 119:52:40.8:W
-lat (NY) Adirondack Ecological Center = 43:59:6.:N
-lon (NY) Adirondack Ecological Center = 74:14:6.:W
-lat (NY) Arnot Teaching and Research Forest = 42:17:6.:N
-lon (NY) Arnot Teaching and Research Forest = 76:38:9.6:W
-lat (NY) Bard College Field Station = 42:1:48.:N
-lon (NY) Bard College Field Station = 73:54:0.:W
-lat (NY) Black Rock Forest = 41:24:21.6:N
-lon (NY) Black Rock Forest = 74:01:44.4:W
-lat (NY) Cornell Biological Field Station = 43:10:12.:N
-lon (NY) Cornell Biological Field Station = 75:58:4.8:W
-lat (NY) Cranberry Lake Biological Station = 44:13:19.2:N
-lon (NY) Cranberry Lake Biological Station = 74:50:13.2:W
-lat (NY) Darrin Fresh Water Institute = 43:33:25.2:N
-lon (NY) Darrin Fresh Water Institute = 73:39:18.:W
-lat (NY) E.N. Huyck Preserve and Biological Research = 42:30:57.6:N
-lon (NY) E.N. Huyck Preserve and Biological Research = 74:8:16.8:W
-lat (NY) Hartwick College Field Station-Pine Lake Environmental Center = 
-lon (NY) Hartwick College Field Station-Pine Lake Environmental Center = 
-lat (NY) Institute of  Ecosystem Studies = 41:47:6.:N
-lon (NY) Institute of  Ecosystem Studies = 73:41:38.4:W
-lat (NY) Louis Calder Center - Biological Station = 41:7:40.8:N
-lon (NY) Louis Calder Center - Biological Station = 73:43:55.2:W
-lat (NY) Marine Science Center = 40:52:48.:N
-lon (NY) Marine Science Center = 72:26:27.6:W
-lat (NY) Mohonk Preserve Inc = 41:45:0.:N
-lon (NY) Mohonk Preserve Inc = 74:6:0.:W
-lat (NY) PSU-Ecosystem Studies Field Lab = 44:50:247:N
-lon (NY) PSU-Ecosystem Studies Field Lab = 73:34:818:W
-lat (NY) PSU-Twin Valleys Outdoor Education Center = 44:16:0:N
-lon (NY) PSU-Twin Valleys Outdoor Education Center = 73:29:0:W
-lat (NY) PSU-Valcour Kayaking & Docking Station = 44:36:359:N
-lon (NY) PSU-Valcour Kayaking & Docking Station = 73:26:306:W
-lat (NY) Rice Creek Field Station = 43:27:18.:N
-lon (NY) Rice Creek Field Station = 76:30:39.6:W
-lat (NY) Robert R. Smith (Oneonta) Environmental Fiel = 42:42:36.:N
-lon (NY) Robert R. Smith (Oneonta) Environmental Fiel = 74:54:36.:W
-lat (NY) Seatuck MWR = 40:48:50.4:N
-lon (NY) Seatuck MWR = 72:43:37.2:W
-lat (OH) Bath Field Station = 41:6:32.4:N
-lon (OH) Bath Field Station = 81:23:16.8:W
-lat (OH) F.T. Stone Laboratory = 41:39:14.4:N
-lon (OH) F.T. Stone Laboratory = 82:49:22.8:W
-lat (OH) JH Barrow Field Station = 41:18:46.8:N
-lon (OH) JH Barrow Field Station = 81:8:38.4:W
-lat (OH) Lake Erie Center = 41:41:20.4:N
-lon (OH) Lake Erie Center = 83:23:56.4:W
-lat (OH) Miami University Ecology Research Center = 30:31:57:N
-lon (OH) Miami University Ecology Research Center = 80:43:22:W
-lat (OH) Woodlake Environmental Field Station = 41:13:48.:N
-lon (OH) Woodlake Environmental Field Station = 81:31:12.:W
-lat (OK) Selman Living Laboratory = 48:12:0.:N
-lon (OK) Selman Living Laboratory = 99:16:1.2:W
-lat (OK) Univ of Oklahoma Biological Station = 33:52:57:N
-lon (OK) Univ of Oklahoma Biological Station = 96:48:2:W
-lat (OR) Cascade Head Experimental Forest and Scenic Research Area = 45:02:30:N
-lon (OR) Cascade Head Experimental Forest and Scenic Research Area = 123:55:30:W
-lat (OR) Hatfield Marine Science Center = 44:38:13.2:N
-lon (OR) Hatfield Marine Science Center = 124:3:7.2:W
-lat (OR) HJ Andrews Experimental Forest = 44:13:N
-lon (OR) HJ Andrews Experimental Forest = 122:15:W
-lat (OR) Oregon Institute of Marine Biology = 43:20:24:N
-lon (OR) Oregon Institute of Marine Biology = 124:19:44.4:W
-lat (OR) Malheur Field Station = 43:15:57.6:N
-lon (OR) Malheur Field Station = 118:50:34.8:W
-lat (PA) Hawk Mountain Sanctuary = 40:38:45.6:N
-lon (PA) Hawk Mountain Sanctuary = 75:58:48.:W
-lat (PA) Lacawac Sanctuary = 41:22:15.6:N
-lon (PA) Lacawac Sanctuary = 75:19:44.4:W
-lat (PA) Powdermill Biological Station = 40:11:49.2:N
-lon (PA) Powdermill Biological Station = 79:14:20.4:W
-lat (PA) Pymatuning Laboratory of Ecology = 41:39:21.6:N
-lon (PA) Pymatuning Laboratory of Ecology = 80:25:26.4:W
-lat (PA) Raystown Field Station = 40:21:28.8:N
-lon (PA) Raystown Field Station = 78:9:0.:W
-lat (PA) Stroud Water Research Center =
-lon (PA) Stroud Water Research Center =
-lat (PR) El Verde Field Station = 18:19:21:N
-lon (PR) El Verde Field Station = 65:49:13:W
-lat (PR) Mata de Platano Field Station and Nature Reserve = 18:25:N
-lon (PR) Mata de Platano Field Station and Nature Reserve = 66:43:W
-lat (PR) Institute of Neurobiology, University of Puerto Rico =
-lon (PR) Institute of Neurobiology, University of Puerto Rico =
-lat (SC) Belle Baruch Institute for Marine Biology = 33:21:3:N
-lon (SC) Belle Baruch Institute for Marine Biology = 79:11:5:W
-lat (SC) Savannah River Enviormental Field Station =
-lon (SC) Savannah River Enviormental Field Station =
-lat (SD) Oak Lake Field Station = 44:30:32.4:N
-lon (SD) Oak Lake Field Station = 96:31:55.2:W
-lat (TN) EJ Meeman Biological Station = 35:21:3.6:N
-lon (TN) EJ Meeman Biological Station = 89:59:13.2:W
-lat (TN) Reelfoot Lake Research and Teaching Center = 36:23:1:N
-lon (TN) Reelfoot Lake Research and Teaching Center = 89:21:0:W
-lat (TX) Chapala Ecology Station, Baylor (Waco) =
-lon (TX) Chapala Ecology Station, Baylor (Waco) =
-lat (TX) Brackenridge Field Laboratory = 30:16:26.4:N
-lon (TX) Brackenridge Field Laboratory = 97:43:55.2:W
-lat (TX) Indio Mountains Research Station = 30:46:41:N
-lon (TX) Indio Mountains Research Station = 105:0:52:W
-lat (TX) Marine Science Institute = 27:50:2.4:N
-lon (TX) Marine Science Institute = 97:3:39.6:W
-lat (TX) The University of Texas-Pan American Coastal Studies Laboratory =
-lon (TX) The University of Texas-Pan American Coastal Studies Laboratory =
-lat (TX) Upper Rio Grande Biological Station =
-lon (TX) Upper Rio Grande Biological Station =
-lat (UT) Cedar Mountain Science Center =
-lon (UT) Cedar Mountain Science Center =
-lat (UT) Red Butte Garden and Arboretum = 40:47:52.8:N
-lon (UT) Red Butte Garden and Arboretum = 111:46:58.8:W
-lat (VA) Anheuser Busch Coastal Research Center =
-lon (VA) Anheuser Busch Coastal Research Center =
-lat (VA) Blackwater Ecological Preserve = 36:45:0.:N
-lon (VA) Blackwater Ecological Preserve = 76:30:0.:W
-lat (VA) Blandy Experimental Farm = 39:3:50.4:N
-lon (VA) Blandy Experimental Farm = 78:3:54.:W
-lat (VA) Mountain Lake Biological Station = 37:22:30:N
-lon (VA) Mountain Lake Biological Station = 80:31:19.2:W
-lat (VA) Univ. of Virginia Coastal Research Center = 37:17:9.6:N
-lon (VA) Univ. of Virginia Coastal Research Center = 75:55:22.8:W
-lat (WA) Au-Sable Pacific Rim Facility = 48:12:0.:N
-lon (WA) Au-Sable Pacific Rim Facility = 122:0:0.:W
-lat (WA) Au Sable Institute of Environmental Studies = 44:46:12.:N
-lon (WA) Au Sable Institute of Environmental Studies = 84:54:0.:W
-lat (WA) Blakely Island Field Station = 48:33:160:N
-lon (WA) Blakely Island Field Station = 122:48:184:W
-lat (WA) Shannon Point Marine Center = 48:30:46.8:N
-lon (WA) Shannon Point Marine Center = 122:36:39.6:W
-lat (WA) Wind River Canopy Crane Research Facility = 45:49:13.76:N
-lon (WA) Wind River Canopy Crane Research Facility = 121:57:06.88:W
-lat (WI) Howard T. Greene Field Station = 42:58:1.2:N
-lon (WI) Howard T. Greene Field Station = 88:22:1.2:W
-lat (WI) Kemp Natural Resources Station = 45:49:58.8:N
-lon (WI) Kemp Natural Resources Station = 89:40:1.2:W
-lat (WI) Pigeon Lake Field Station = 46:22:12.:N
-lon (WI) Pigeon Lake Field Station = 91:24:36.:W
-lat (WI) Treehaven Field Station = 45:33:0.:N
-lon (WI) Treehaven Field Station = 89:33:36.:W
-lat (WI) Trout Lake Station = 46:1:4.8:N
-lon (WI) Trout Lake Station = 89:40:4.8:W
-lat (WI) University of Notre Dame Environmental Research Center =
-lon (WI) University of Notre Dame Environmental Research Center =
-lat (WI) Univ of Wisconsin Milwaukee Field Station = 43:22:55.2:N
-lon (WI) Univ of Wisconsin Milwaukee Field Station = 88:01:15:W
-lat (WV) Spruce Knob Mountain Center = 38:40:15.6:N
-lon (WV) Spruce Knob Mountain Center = 79:29:27.6:W
-lat (WY) Wyoming National Park Service = 43:51:25.2:N
-lon (WY) Wyoming National Park Service = 110:35:20.4:W
-lat (AZ) Aravaipa Canyon Preserve, Ind. Mem. = 32:53:52.8:N
-lon (AZ) Aravaipa Canyon Preserve, Ind. Mem. = 110:26:20.4:W
-lat [Australia] School for Field Studies- Centre for Rainforest Studies =
-lon [Australia] School for Field Studies- Centre for Rainforest Studies =
-lat [Bahamas] Bahamian Field Station, San Salvador Island =
-lon [Bahamas] Bahamian Field Station, San Salvador Island =
-lat [Bahamas] Bahamas Environmental Research Center, Andros Island =
-lon [Bahamas] Bahamas Environmental Research Center, Andros Island =
-lat [Bahamas] Forfar Field Station = 
-lon [Bahamas] Forfar Field Station = 
-lat [Belize] Jaguar Creek = 17:09:38.6:N
-lon [Belize] Jaguar Creek = 88:40:48.0:W
-lat [Belize] Las Cuevas Forest Research Station =
-lon [Belize] Las Cuevas Forest Research Station =
-lat [Bermuda] Bermuda Biological Station = 32:22.2 N
-lon [Bermuda] Bermuda Biological Station = 64:41.7 W
-lat [Brazil] Iracambi Atlantic Rainforest Research & Conservation Center =
-lon [Brazil] Iracambi Atlantic Rainforest Research & Conservation Center =
-lat [British West Indies] School for Field Studies-Center for Marine Studies =
-lon [British West Indies] School for Field Studies-Center for Marine Studies =
-lat [Canada] Bamfield Marine Station =
-lon [Canada] Bamfield Marine Station =
-lat [Canada] Churchill Northern Studies Centre =
-lon [Canada] Churchill Northern Studies Centre = 
-lat [Canada] Cochrane Ecological Institute =
-lon [Canada] Cochrane Ecological Institute =
-lat [Canada] Churchill Northern Studies Centre =
-lon [Canada] Churchill Northern Studies Centre =
-lat [Canada] Delta Marsh Field Station =
-lon [Canada] Delta Marsh Field Station =
-lat [Canada] Gault Nature Reserve  = 45:31:N 
-lon [Canada] Gault Nature Reserve  = 73:08:W
-lat [Canada] Huntsman Marine Science Centre =
-lon [Canada] Huntsman Marine Science Centre =
-lat [Canada] Meanook Biological Research Station = 
-lon [Canada] Meanook Biological Research Station =  
-lat [Canada] Kananaskis Field Stations = 51:02:N
-lon [Canada] Kananaskis Field Stations = 115:03:W
-lat [Canada] Taiga Biological Station =
-lon [Canada] Taiga Biological Station =
-lat [Costa Rica] La Laguna del Lagarto Lodge =
-lon [Costa Rica] La Laguna del Lagarto Lodge =
-lat [Costa Rica] La Suerte Biological Field Station =
-lon [Costa Rica] La Suerte Biological Field Station = 
-lat [Costa Rica] La Selva Biological Station = 10:25:50 N
-lon [Costa Rica] La Selva Biological Station = 84:00:25 W
-lat [Costa Rica] Mata de Platano Field Station and Nature Reserve =
-lon [Costa Rica] Mata de Platano Field Station and Nature Reserve =
-lat [Costa Rica] Organization of Tropical Studies (OTS) =
-lon [Costa Rica] Organization of Tropical Studies (OTS) =
-lat [Costa Rica] Quetzal Education Research Complex =
-lon [Costa Rica] Quetzal Education Research Complex =
-lat [Dominica] Archbold Tropical Research Center , Springfield Station =
-lon [Dominica] Archbold Tropical Research Center , Springfield Station =
-lat [Dominica, West Indies] The Institute for Tropical marine Ecology =
-lon [Dominica, West Indies] The Institute for Tropical marine Ecology =
-lat [Mexico] Chapala Ecology Station, Baylor University =
-lon [Mexico] Chapala Ecology Station, Baylor University =
-lat [Mexico] Kino Bay Center for Cultural & Ecological Studies =
-lon [Mexico] Kino Bay Center for Cultural & Ecological Studies =
-lat [Mexico] Tijuana River National Estuarine Research R = 32:33:14.4:N
-lon [Mexico] Tijuana River National Estuarine Research R = 117:6:50.4:W
-lat [Namibia] Gobabeb Training and Research Centre = 23:33:704:S
-lon [Namibia] Gobabeb Training and Research Centre = 15:02:466:E
-lat [Nicaragua] Isla Ometepe Biological Field Station (Ometepe Island within Lake Nicaragua) =
-lon [Nicaragua] Isla Ometepe Biological Field Station (Ometepe Island within Lake Nicaragua) =
-lat [Panama] Institute for Tropical Ecology and Conservation = 
-lon [Panama] Institute for Tropical Ecology and Conservation = 
-lat [Panama] Smithsonian Tropical Research Institute =
-lon [Panama] Smithsonian Tropical Research Institute =
-lat [South Pacific] Richard B Gump South Pacific Biological Research Station =
-lon [South Pacific] Richard B Gump South Pacific Biological Research Station =

Property changes on: lib/style/skins/pisco/pisco.cfg
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: src/scripts/debian
===================================================================
--- src/scripts/debian	(revision 5310)
+++ src/scripts/debian	(revision 5311)

Property changes on: src/scripts/debian
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/scripts/bash/buildIndex.sh
===================================================================
--- src/scripts/bash/buildIndex.sh	(revision 5310)
+++ src/scripts/bash/buildIndex.sh	(revision 5311)

Property changes on: src/scripts/bash/buildIndex.sh
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/scripts/bash/measure-metacat-query-performance.sh
===================================================================
--- src/scripts/bash/measure-metacat-query-performance.sh	(revision 5310)
+++ src/scripts/bash/measure-metacat-query-performance.sh	(revision 5311)

Property changes on: src/scripts/bash/measure-metacat-query-performance.sh
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/scripts/bash/backup-metacat.sh
===================================================================
--- src/scripts/bash/backup-metacat.sh	(revision 5310)
+++ src/scripts/bash/backup-metacat.sh	(revision 5311)

Property changes on: src/scripts/bash/backup-metacat.sh
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/scripts/bash/measure-metacat-query-performance2.sh
===================================================================
--- src/scripts/bash/measure-metacat-query-performance2.sh	(revision 5310)
+++ src/scripts/bash/measure-metacat-query-performance2.sh	(revision 5311)

Property changes on: src/scripts/bash/measure-metacat-query-performance2.sh
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/scripts/bash/check_shape_file_existence.sh
===================================================================
--- src/scripts/bash/check_shape_file_existence.sh	(revision 5310)
+++ src/scripts/bash/check_shape_file_existence.sh	(revision 5311)

Property changes on: src/scripts/bash/check_shape_file_existence.sh
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/edu/ucsb/nceas/workflowscheduler/WorkflowJob.java
===================================================================
--- src/edu/ucsb/nceas/workflowscheduler/WorkflowJob.java	(revision 5310)
+++ src/edu/ucsb/nceas/workflowscheduler/WorkflowJob.java	(nonexistent)
@@ -1,123 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: a single workflow job that is schedulable 
- *  Copyright: 2009 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- *
- *   '$Author: daigle $'
- *     '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
- * '$Revision: 4080 $'
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-package edu.ucsb.nceas.workflowscheduler;
-
-import java.rmi.RemoteException;
-import javax.xml.rpc.ServiceException;
-
-import org.apache.log4j.Logger;
-
-import org.quartz.InterruptableJob;
-import org.quartz.JobDetail;
-import org.quartz.JobDataMap;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
-import org.kepler.executionWS.KeplerWebServiceLocator;
-import org.kepler.executionWS.KeplerWebServicePortType;
-
-import edu.ucsb.nceas.metacat.scheduler.ScheduledJobAccess;
-import edu.ucsb.nceas.metacat.scheduler.ScheduledJobDAO;
-import edu.ucsb.nceas.metacat.scheduler.ScheduledJobParamDAO;
-
-public class WorkflowJob implements InterruptableJob {
-	
-	private static Logger logMetacat = Logger.getLogger(WorkflowJob.class);
-    	
-	/**
-	 * Required method that is called when the job is run by the scheduler.
-	 * 
-	 * @param executionContext
-	 *            the context information for this job
-	 */
-	public void execute(JobExecutionContext executionContext) throws JobExecutionException {
-		try {
-			// have to be able to get the job detail
-			JobDetail jobDetail = executionContext.getJobDetail();
-			if (jobDetail == null) {
-				throw new JobExecutionException("WorkflowJob.execute - Could not get job detail from execution context"); 
-			}
-			
-			// have to be able to get the job data map from the job detail
-			JobDataMap jobDataMap = jobDetail.getJobDataMap();
-			if (jobDataMap == null) {
-				throw new JobExecutionException("WorkflowJob.execute - Could not get job data map from job detail"); 
-			}
-			
-			String jobName = jobDetail.getName();
-			
-			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
-			ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
-			
-			if(jobDAO == null) {
-				String errorMessage = "WorkflowJob.execute - Could not retrieve job info from " 
-					+ "database for job: " + jobName;
-				logMetacat.error(errorMessage);
-				throw new JobExecutionException(errorMessage);
-			}
-			
-			// the kar lsid must be part of the job data map
-			ScheduledJobParamDAO jobParamDAO = jobDAO.getAllJobParams().get("karid");
-			if (jobParamDAO == null) {
-				throw new JobExecutionException("WorkflowJob.execute - Could not get job param named karid from " 
-						+ "job data map for job: " + jobName);
-			}
-			String karLSID = jobParamDAO.getValue();
-			if (karLSID == null) {
-				throw new JobExecutionException("WorkflowJob.execute - Could not get kar LSID for job: " + jobName);
-			}
-			
-			// Locate service
-			logMetacat.debug("WorkflowJob.execute - Getting kepler webservice Locator");
-			KeplerWebServiceLocator serviceLocator = new KeplerWebServiceLocator();
-			
-			// get endpoint service
-			logMetacat.debug("WorkflowJob.execute - Getting kepler webservice");
-			KeplerWebServicePortType serviceEndpoint = serviceLocator.getKeplerWebServiceHttpSoap11Endpoint();
-			
-			// call execute against remote endpoint
-			logMetacat.debug("WorkflowJob.execute - Executing with kar lsid:" + karLSID);
-			String status = serviceEndpoint.execute(karLSID);		
-			logMetacat.debug("WorkflowJob.execute - Status: " + status);
-			
-		} catch (RemoteException re) {
-			String errorStr = "WorkflowJob.execute - Remote problem when trying to execute task: " + re.getMessage();
-			logMetacat.error(errorStr);
-			throw new JobExecutionException(errorStr); 
-		} catch (ServiceException se) {
-			String errorStr = "WorkflowJob.execute - Service problem when trying to execute task: " + se.getMessage();
-			logMetacat.error(errorStr);
-			throw new JobExecutionException(errorStr); 
-		} catch (Exception e) {
-			String errorStr = "WorkflowJob.execute - General problem when trying to execute task: " + e.getMessage();
-			logMetacat.error(errorStr);
-			throw new JobExecutionException(errorStr); 
-		}
-	}
-	
-	public void interrupt() {
-	}
-}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/workflowscheduler/WorkflowJob.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/workflowscheduler/WorkflowScheduler.java
===================================================================
--- src/edu/ucsb/nceas/workflowscheduler/WorkflowScheduler.java	(revision 5310)
+++ src/edu/ucsb/nceas/workflowscheduler/WorkflowScheduler.java	(nonexistent)
@@ -1,500 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that handles scheduling workflow jobs 
- *  Copyright: 2009 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- * 
- *   '$Author: daigle $'
- *     '$Date: 2009-03-25 13:41:15 -0800 (Wed, 25 Mar 2009) $'
- * '$Revision: 4861 $'
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-package edu.ucsb.nceas.workflowscheduler;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.util.Calendar;
-import java.util.Hashtable;
-import java.util.HashMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.log4j.Logger;
-
-import org.xml.sax.InputSource;
-
-import org.ecoinformatics.ecogrid.client.AuthenticationServiceClient;
-import org.ecoinformatics.ecogrid.client.AuthorizationServiceClient;
-
-import edu.ucsb.nceas.metacat.scheduler.BaseScheduler;
-import edu.ucsb.nceas.metacat.scheduler.ScheduledJobAccess;
-import edu.ucsb.nceas.metacat.scheduler.ScheduledJobDAO;
-import edu.ucsb.nceas.metacat.scheduler.SchedulerService;
-import edu.ucsb.nceas.metacat.scheduler.MetacatSchedulerException;
-import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
-import edu.ucsb.nceas.metacat.properties.PropertyService;
-import edu.ucsb.nceas.metacat.shared.AccessException;
-import edu.ucsb.nceas.metacat.shared.ServiceException;
-import edu.ucsb.nceas.metacat.util.ErrorSendingErrorException;
-import edu.ucsb.nceas.metacat.util.ResponseUtil;
-import edu.ucsb.nceas.utilities.DateUtil;
-import edu.ucsb.nceas.utilities.PropertyNotFoundException;
-import edu.ucsb.nceas.utilities.UtilException;
-
-/**
- * @author daigle
- *
- */
-public class WorkflowScheduler extends BaseScheduler {
-	
-	private static WorkflowScheduler workflowScheduler = null;
-	
-	private static Logger logMetacat = Logger.getLogger(WorkflowScheduler.class);
-	
-	private static String WORKFLOW_JOB_GROUP = "workflow";
-	private static String WORKFLOW_JOB_CLASS = "edu.ucsb.nceas.workflowscheduler.WorkflowJob";
-
-	/**
-	 * private constructor since this is a singleton
-	 */
-	private WorkflowScheduler()  {}
-	
-	/**
-	 * Get the single instance of SchedulerService.
-	 * 
-	 * @return the single instance of SchedulerService
-	 */
-	public static WorkflowScheduler getInstance() {
-		if (workflowScheduler == null) {
-			workflowScheduler = new WorkflowScheduler();
-		}
-		return workflowScheduler;
-	}
-	
-	/**
-	 * Scheduling a workflow
-	 * 
-	 * @param request
-	 *            the servlet request object
-	 * @param response
-	 *            the servlet response object
-	 * @param params
-	 *            the request parameters
-	 * @param username
-	 *            the user
-	 * @param groups
-	 *            the user's group
-	 */
-	public void scheduleJob(HttpServletRequest request, HttpServletResponse response, 
-			Hashtable<String, String[]> params) throws MetacatSchedulerException {
-		 
-		String sessionIds[] = params.get("sessionid");
-		String delays[] = params.get("delay");
-		String startTimes[] = params.get("starttime");
-		String endTimes[] = params.get("endtime");
-		HashMap<String, String> jobParams = new HashMap<String, String>();
-		Calendar startCal = null;
-		Calendar endCal = null;
-		
-		if (sessionIds == null) {
-			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - sessionid field must be populated "
-							+ "in scheduler parameters when scheduling job.");
-		}
-		
-		String sessionStatus = validateRemoteSession(sessionIds[0]);
-		logMetacat.debug("WorkflowScheduler.scheduleJob - session status: " + sessionStatus);
-		
-		if (!sessionStatus.equals("valid")) {
-			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - session " 
-					+ request.getSession().getId() + " is not valid.");
-		}
-		
-		try {
-			SchedulerService schedulerService = SchedulerService.getInstance();
-
-			// get start time or delay.  Start time takes precedence if both exist.
-			if (startTimes != null && startTimes.length > 0) {
-				startCal = DateUtil.humanReadableToCalendar(startTimes[0], "MM/dd/yyyy HH:mm:ss");
-			} else if (delays != null && delays.length > 0) {
-				startCal = schedulerService.getStartDateFromDelay(delays[0]);
-			} else {
-				// if delay and starttime were not provided, set date to now.
-				startCal = Calendar.getInstance();
-			}
-			
-			// get end time.  null is fine.
-			if (endTimes != null && endTimes.length > 0) {
-				endCal = DateUtil.humanReadableToCalendar(endTimes[0], "MM/dd/yyyy HH:mm:ss");
-			} 
-
-			// interval value must exist
-			String intervalValues[] = params.get("intervalvalue");
-			if (intervalValues == null || intervalValues.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - intervalvalue field must be populated "
-								+ "in scheduler parameters when scheduling job.");
-			}
-			String intervalStrValue = intervalValues[0];
-			int intervalValue = Integer.parseInt(intervalStrValue);
-			
-			// interval unit must exist
-			String intervalUnits[] = params.get("intervalunit");
-			if (intervalUnits == null || intervalUnits.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - intervalunit field must be populated "
-								+ "in scheduler parameters when scheduling job.");
-			}
-			String intervalUnit = intervalUnits[0];
-
-			// workflow id must exist.  Add to job params
-			String workflowids[] = params.get("workflowid");
-			if (workflowids == null || workflowids.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - workflowid field must be populated "
-								+ "in scheduler parameters when scheduling job.");
-			}
-			jobParams.put("workflowid", workflowids[0]);
-			
-			String workflowAuthorizeStatus = authorizeRemoteSession(sessionIds[0], workflowids[0], AccessControlInterface.WRITESTRING);
-			if (!workflowAuthorizeStatus.equals("true")) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - session " 
-						+ request.getSession().getId() + " is not authorized to write workflow " + workflowids[0]  + ".");
-			}
-			
-			// kar id must exist.  Add to job params
-			String karids[] = params.get("karid");
-			if (karids == null || karids.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - karid field must be populated "
-								+ "in scheduler parameters when scheduling job.");
-			}
-			jobParams.put("karid", karids[0]);
-			
-			String karAuthorizeStatus = authorizeRemoteSession(sessionIds[0], karids[0], AccessControlInterface.READSTRING);
-			if (!karAuthorizeStatus.equals("true")) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - session " 
-						+ request.getSession().getId() + " is not authorized to read kar " + karids[0]  + ".");
-			}
-			
-			// workflow name unit must exist.  Add to job params
-			String workflownames[] = params.get("workflowname");
-			if (workflownames == null || workflownames.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - workflowname field must be populated "
-								+ "in scheduler parameters when scheduling job.");
-			}
-			jobParams.put("workflowname", workflownames[0]);
-
-			String jobName = WORKFLOW_JOB_GROUP
-					+ Calendar.getInstance().getTimeInMillis();
-
-			// Schedule the job
-			String xmlResult = schedulerService.scheduleJob(jobName, startCal, endCal, intervalValue, intervalUnit,
-					WORKFLOW_JOB_CLASS, WORKFLOW_JOB_GROUP, jobParams);
-			
-			ResponseUtil.sendSuccessXML(response, xmlResult);
-			
-		} catch (UtilException ue) {
-			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - " 
-					+ "Utility issue when scheduling job: " + ue.getMessage());
-		} catch (ServiceException se) {
-			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - " 
-					+ "Service issue when scheduling job", se);
-		} catch (ErrorSendingErrorException esee) {
-			throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - " 
-					+ "Issue sending error when scheduling job: " + esee.getMessage());			
-		}
-	}
-	
-	/**
-	 * Unschedule a job
-	 * 
-	 * @param request
-	 *            the servlet request object
-	 * @param response
-	 *            the servlet response object
-	 * @param params
-	 *            the request parameters
-	 * @param username
-	 *            the user
-	 * @param groups
-	 *            the user's group
-	 */
-	public void unscheduleJob(HttpServletRequest request, HttpServletResponse response,
-			Hashtable<String, String[]> params, String username, String[] groups)
-			throws MetacatSchedulerException {
-		try {
-			String sessionIds[] = params.get("sessionid");
-			
-			// interval value must exist
-			if (sessionIds == null || sessionIds.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.unscheduleJob - sessionid field must be populated "
-								+ "in scheduler parameters when unscheduling job.");
-			}
-			
-			String sessionStatus = validateRemoteSession(sessionIds[0]);
-			logMetacat.debug("WorkflowScheduler.unscheduleJob - session status: " + sessionStatus);
-			
-			if (!sessionStatus.equals("valid")) {
-				throw new MetacatSchedulerException("WorkflowScheduler.unscheduleJob - session " 
-						+ sessionIds[0] + " is not valid.");
-			}
-			
-			// workflow job id must exist
-			String jobNames[] = params.get("workflowjobname");
-			if (jobNames == null || jobNames.length == 0) {
-				throw new MetacatSchedulerException("SchedulerService.unScheduleJob - workflowjobname " 
-						+ "field must be populated in scheduler parameters when unscheduling job.");
-			}
-			String jobName = jobNames[0];
-
-			// unschedule the job
-			SchedulerService schedulerService = SchedulerService.getInstance();
-			String xmlResult = schedulerService.unscheduleJob(jobName, username, groups);
-			
-			ResponseUtil.sendSuccessXML(response, xmlResult);
-
-		} catch (ServiceException se) {
-			throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - " 
-					+ "Service issue unscheduling job", se);
-		} catch (Exception e) {
-			throw new MetacatSchedulerException("WorkflowScheduler.unScheduleJob - " 
-					+ "Generic issue unscheduling job: " + e.getMessage());
-		}
-	}
-	
-	/**
-	 * reschedule job
-	 * 
-	 * @param request
-	 *            the servlet request object
-	 * @param response
-	 *            the servlet response object
-	 * @param params
-	 *            the request parameters
-	 * @param username
-	 *            the user
-	 * @param groups
-	 *            the user's group
-	 */
-	public void rescheduleJob(HttpServletRequest request, HttpServletResponse response, 
-			Hashtable<String, String[]> params, String username,
-			String[] groups) throws MetacatSchedulerException {
-		 		
-		try {
-			String sessionIds[] = params.get("sessionid");
-			
-			// interval value must exist
-			if (sessionIds == null || sessionIds.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.rescheduleJob - sessionid field must be populated "
-								+ "in scheduler parameters when rescheduling job.");
-			}
-			
-			String sessionStatus = validateRemoteSession(sessionIds[0]);
-			
-			logMetacat.debug("WorkflowScheduler.rescheduleJob - session status: " + sessionStatus);
-			
-			if (!sessionStatus.equals("valid")) {
-				throw new MetacatSchedulerException("WorkflowScheduler.scheduleJob - session " 
-						+ sessionIds[0] + " is not valid.");
-			}
-			
-			// workflow job id must exist
-			String jobNames[] = params.get("workflowjobname");	
-			if (jobNames == null || jobNames.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.rescheduleJob - workflowjobname field must be populated "
-						+ "in scheduler parameters when rescheduling job.");
-			}			
-			String jobName = jobNames[0];
-	
-			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
-			ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
-			
-			// reschedule the job
-			SchedulerService schedulerService = SchedulerService.getInstance();
-			String result = schedulerService.rescheduleJob(jobDAO, username, groups);
-
-			ResponseUtil.sendSuccessXML(response, result);
-			
-		} catch (AccessException ae) {
-			throw new MetacatSchedulerException("WorkflowScheduler.rescheduleJob - " 
-					+ "DB access issue when rescheduling job  : ", ae);
-		} catch (ServiceException se) {
-			throw new MetacatSchedulerException("WorkflowScheduler.rescheduleJob - " 
-					+ "Service issue rescheduling job", se);
-		} catch (ErrorSendingErrorException esee) {
-			throw new MetacatSchedulerException("WorkflowScheduler.rescheduleJob - " 
-					+ "Issue sending erro when rescheduling job: " + esee.getMessage());			
-		}
-	}
-	
-	/**
-	 * delete job - to be implemented
-	 */
-	public void deleteJob(HttpServletRequest request, HttpServletResponse response, 
-			Hashtable<String, String[]> params, String username, String[] groups) throws MetacatSchedulerException {
-		 try {
-			String sessionIds[] = params.get("sessionid");
-				
-			// interval value must exist
-			if (sessionIds == null || sessionIds.length == 0) {
-				throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - sessionid field must be populated "
-								+ "in scheduler parameters when deleting job.");
-			}
-				
-			String sessionStatus = validateRemoteSession(sessionIds[0]);
-			logMetacat.debug("WorkflowScheduler.rescheduleJob - session status: " + sessionStatus);
-				
-			if (!sessionStatus.equals("valid")) {
-				throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - session " 
-						+ sessionIds[0] + " is not valid.");
-			}
-				
-			// workflow job id must exist
-			String jobNames[] = params.get("workflowjobname");
-			if (jobNames == null || jobNames.length == 0) {
-				throw new MetacatSchedulerException(
-						"WorkflowScheduler.deleteJob - workflowname field must be populated "
-								+ "in scheduler parameters when deleting job.");
-			}
-			String jobName = jobNames[0];
-
-			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
-			ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
-
-			// delete the job
-			SchedulerService schedulerService = SchedulerService.getInstance();
-			String result = schedulerService.deleteJob(jobDAO);
-
-			ResponseUtil.sendSuccessXML(response, result);
-
-		} catch (AccessException ae) {
-			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - "
-					+ "DB access issue when deleting job  : ", ae);
-		} catch (ServiceException se) {
-			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - "
-					+ "Service issue deleting job", se);
-		} catch (ErrorSendingErrorException esee) {
-			throw new MetacatSchedulerException("WorkflowScheduler.deleteJob - "
-					+ "Issue sending erro when deleting job: " + esee.getMessage());
-		}
-	}
-	
-	/**
-	 * get job information for a given workflow in xml format
-	 * 
-	 * @param request
-	 *            the servlet request object
-	 * @param response
-	 *            the servlet response object
-	 * @param params
-	 *            the request parameters
-	 * @param username
-	 *            the user
-	 * @param groups
-	 *            the user's group
-	 */
-	public void getJobs(HttpServletRequest request, HttpServletResponse response, 
-			Hashtable<String, String[]> params, String username, String[] groups) throws MetacatSchedulerException {
-		
-		String workflowId = null;
-		
-		String workflowIds[] = params.get("workflowid");
-		if (workflowIds != null && workflowIds.length != 0) {
-			workflowId = workflowIds[0];
-		}
-		
-		logMetacat.debug("WorkflowScheduler.getJobs - getting jobs for workflow:" + workflowId);
-		
-        PrintWriter out = null;
-		try {
-			// get the job info in xml format
-			out = response.getWriter();
-			SchedulerService.getInstance().getJobsInfoXML(WORKFLOW_JOB_GROUP,
-					"workflowid", workflowId, out);
-		} catch (ServiceException se) {
-			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - " 
-					+ "Service error when transforming XML for workflow id: " 
-					+ workflowId + " : " + se.getMessage());
-		} catch (IOException ioe) {
-			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - " 
-					+ "I/O error when transforming XML for workflow id: " 
-					+ workflowId + " : " + ioe.getMessage());
-		} finally {
-			if (out != null) {
-				out.close();
-			}
-		}
-	}
-	
-	private String validateRemoteSession(String sessionId) throws MetacatSchedulerException {
-		String sessionStatus = "unknown";
-	    XPath xpath = XPathFactory.newInstance().newXPath();
-		
-		try {
-			String ecogridUrl = PropertyService.getProperty("workflowScheduler.authServiceUrl");
-		
-			AuthenticationServiceClient authServiceClient = 
-					new AuthenticationServiceClient(ecogridUrl);
-			
-			String sessionStatusXML = authServiceClient.validate_session_action(sessionId);
-			
-			sessionStatus = 
-				xpath.evaluate("/validateSession/status",  new InputSource(new StringReader(sessionStatusXML)));
-			
-			
-		} catch (PropertyNotFoundException pnfe) {
-			throw new MetacatSchedulerException("WorkflowScheduler.validateSession - Could not " 
-					+ "find property: " + pnfe.getMessage());
-		} catch (Exception e) {
-			throw new MetacatSchedulerException("WorkflowScheduler.validateSession - " 
-					+ "general error when validating Session: " + e.getMessage());
-		}
-		
-		
-		return sessionStatus;
-	}
-	
-	private String authorizeRemoteSession(String sessionId, String resourceLsid, String permission) 
-		throws MetacatSchedulerException {
-		
-		String authStatus = "unknown";
-	    XPath xpath = XPathFactory.newInstance().newXPath();
-		
-		try {
-			String ecogridUrl = PropertyService.getProperty("workflowScheduler.authorizationServiceUrl");
-		
-			AuthorizationServiceClient authorizationServiceClient = 
-					new AuthorizationServiceClient(ecogridUrl);
-			
-			String authStatusXML = authorizationServiceClient.is_authorized_action(sessionId, resourceLsid, permission);
-			
-			authStatus = 
-				xpath.evaluate("/resourceAuthorization/isAuthorized",  new InputSource(new StringReader(authStatusXML)));		
-			
-		} catch (PropertyNotFoundException pnfe) {
-			throw new MetacatSchedulerException("WorkflowScheduler.authorizeRemoteSession - Could not " 
-					+ "find property: " + pnfe.getMessage());
-		} catch (Exception e) {
-			throw new MetacatSchedulerException("WorkflowScheduler.authorizeRemoteSession - " 
-					+ "general error when authorizing Session: " + e.getMessage());
-		}
-		
-		
-		return authStatus;
-	}
-}

Property changes on: src/edu/ucsb/nceas/workflowscheduler/WorkflowScheduler.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/workflowscheduler/WorkflowSchedulerServlet.java
===================================================================
--- src/edu/ucsb/nceas/workflowscheduler/WorkflowSchedulerServlet.java	(revision 5310)
+++ src/edu/ucsb/nceas/workflowscheduler/WorkflowSchedulerServlet.java	(nonexistent)
@@ -1,532 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that implements a metadata catalog as a java Servlet
- *  Copyright: 2006 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Matt Jones, Dan Higgins, Jivka Bojilova, Chad Berkley, Matthew Perry
- *
- *   '$Author: daigle $'
- *     '$Date: 2009-08-07 10:35:18 -0700 (Fri, 07 Aug 2009) $'
- * '$Revision: 5018 $'
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-package edu.ucsb.nceas.workflowscheduler;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.sql.SQLException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
-
-import edu.ucsb.nceas.metacat.database.DBConnectionPool;
-import edu.ucsb.nceas.metacat.properties.PropertyService;
-import edu.ucsb.nceas.metacat.scheduler.SchedulerService;
-import edu.ucsb.nceas.metacat.service.SessionService;
-import edu.ucsb.nceas.metacat.shared.BaseException;
-import edu.ucsb.nceas.metacat.shared.ServiceException;
-import edu.ucsb.nceas.metacat.util.ErrorSendingErrorException;
-import edu.ucsb.nceas.metacat.util.RequestUtil;
-import edu.ucsb.nceas.metacat.util.ResponseUtil;
-import edu.ucsb.nceas.metacat.util.SessionData;
-import edu.ucsb.nceas.utilities.FileUtil;
-
-/**
- * A workflow scheduling server implemented as a Java Servlet
- *
- * Valid actions are:
- * 
- * action=scheduleWorkflow -- Schedule a workflow to be run.  Scheduling a workflow 
- *                            registers it with the scheduling engine and creates a row
- *                            in the scheduled_job table.  Note that this may be 
- *                            extracted into a separate servlet.
- *     delay -- The amount of time from now before the workflow should be run.  The 
- *              delay can be expressed in number of seconds, minutes, hours and days, 
- *              for instance 30s, 2h, etc.
- *     starttime -- The time that the workflow should first run.  If both are provided
- *                  this takes precedence over delay.  The time should be expressed as: 
- *                  MM/dd/yyyy HH:mm:ss with the timezone assumed to be that of the OS.
- *     endtime -- The time when the workflow should end. The time should be expressed as: 
- *                  MM/dd/yyyy HH:mm:ss with the timezone assumed to be that of the OS.
- *     intervalvalue -- The numeric value of the interval between runs
- *     intervalunit -- The unit of the interval between runs.  Can be s, m, h, d for 
- *                     seconds, minutes, hours and days respectively
- *     workflowid -- The lsid of the workflow that we want to schedule.  This workflow
- *                   must already exist in the database.
- *     karid -- The karid for the workflow that we want to schedule.
- *     workflowname -- The name of the workflow.
- *     forwardto -- If provided, forward to this page when processing is done.
- *     qformat -- If provided, render results using the stylesheets associated with
- *                this skin.  Default is xml.
- * action=unscheduleWorkflow -- Unschedule a workflow.  Unscheduling a workflow 
- *                            removes it from the scheduling engine and changes the 
- *                            status in the scheduled_job table to " unscheduled.  Note 
- *                            that this may be extracted into a separate servlet.
- *     workflowjobname -- The job ID for the workflow run that we want to unschedule.  This
- *                      is held in the database as scheduled_job.name
- *     forwardto -- If provided, forward to this page when processing is done.
- *     qformat -- If provided, render results using the stylesheets associated with
- *                this skin.  Default is xml.
- * action=rescheduleWorkflow -- Unschedule a workflow.  Rescheduling a workflow 
- *                            registers it with the scheduling engine and changes the 
- *                            status in the scheduled_job table to " scheduled.  Note 
- *                            that this may be extracted into a separate servlet.
- *     workflowjobname -- The job ID for the workflow run that we want to reschedule.  This
- *                      is held in the database as scheduled_job.name
- *     forwardto -- If provided, forward to this page when processing is done.
- *     qformat -- If provided, render results using the stylesheets associated with
- *                this skin.  Default is xml.
- * action=deleteScheduledWorkflow -- Delete a workflow.  Deleting a workflow 
- *                            removes it from the scheduling engine and changes the 
- *                            status in the scheduled_job table to " deleted.  Note 
- *                            that this may be extracted into a separate servlet.
- *     workflowjobname -- The job ID for the workflow run that we want to delete.  This
- *                      is held in the database as scheduled_job.name
- *     forwardto -- If provided, forward to this page when processing is done.
- *     qformat -- If provided, render results using the stylesheets associated with
- *                this skin.  Default is xml.
- *     
- */
-public class WorkflowSchedulerServlet extends HttpServlet {
-
-	private static final long serialVersionUID = 1L;
-    
-    // Constants -- these should be final in a servlet
-    private static String LOG_CONFIG_NAME = null;
-    
-    public static final String APPLICATION_NAME = "workflowscheduler";
-    
-    /**
-     * Initialize the servlet by creating appropriate database connections
-     */
-    public void init(ServletConfig config) throws ServletException {
-    	Logger logMetacat = Logger.getLogger(WorkflowSchedulerServlet.class);
-    	try {
-    		
-            super.init(config);
-            
-            ServletContext context = config.getServletContext();
-            context.setAttribute("APPLICATION_NAME", APPLICATION_NAME);
-            
-            // Initialize the properties file
-            String dirPath = context.getRealPath("WEB-INF");
-            
-            LOG_CONFIG_NAME = dirPath + FileUtil.getFS() + "log4j.properties";
-        	PropertyConfigurator.configureAndWatch(LOG_CONFIG_NAME);
-            
-            PropertyService.getInstance(context);
-            SessionService.getInstance();
-            SchedulerService.getInstance();
-            
-			// initialize DBConnection pool
-			DBConnectionPool connPool = DBConnectionPool.getInstance();
-			logMetacat.debug("WorkflowSchedulerServlet.init - DBConnection pool initialized: " + connPool.toString());
-            
-    	} catch (ServiceException se) {
-        	String errorMessage = 
-        		"WorkflowSchedulerServlet.init - Service problem while intializing WorkflowScheduler Servlet: " + se.getMessage();
-            logMetacat.error(errorMessage);
-            throw new ServletException(errorMessage);
-        } catch (SQLException e) {
-			String errorMessage = "WorkflowSchedulerServlet.init - SQL problem while intializing WorkflowScheduler Servlet: "
-					+ e.getMessage();
-			logMetacat.error(errorMessage);
-			throw new ServletException(errorMessage);
-        } 
-    }
-    
-    /**
-	 * Close all db connections from the pool
-	 */
-    public void destroy() {
-    	Logger logMetacat = Logger.getLogger(WorkflowSchedulerServlet.class);
-    	
-    	try {
-    		SchedulerService.getInstance().stop();
-    	} catch (ServiceException se) {
-    		logMetacat.warn("WorkflowSchedulerServlet.destroy - Could not stop scheduler service: " + se.getMessage());
-    	}
-    	
-        // Close all db connection
-        logMetacat.warn("WorkflowSchedulerServlet.destroy - Destroying WorkflowSchedulerServlet");
-//        IndexingQueue.getInstance().setMetacatRunning(false);
-        DBConnectionPool.release();
-    }
-    
-    /** Handle "GET" method requests from HTTP clients */
-    public void doGet(HttpServletRequest request, HttpServletResponse response)
-    throws ServletException, IOException {
-        
-        // Process the data and send back the response
-        handleGetOrPost(request, response);
-    }
-    
-    /** Handle "POST" method requests from HTTP clients */
-    public void doPost(HttpServletRequest request, HttpServletResponse response)
-    throws ServletException, IOException {
-        
-        // Process the data and send back the response
-        handleGetOrPost(request, response);
-    }
-    
-    /**
-	 * Control servlet response depending on the action parameter specified
-	 */
-	private void handleGetOrPost(HttpServletRequest request, HttpServletResponse response)
-			throws ServletException, IOException {
-		Logger logMetacat = Logger.getLogger(WorkflowSchedulerServlet.class);
-
-		// Update the last update time for this user if they are not new
-		HttpSession httpSession = request.getSession(false);
-		if (httpSession != null) {
-			SessionService.touchSession(httpSession.getId());
-		}
-
-		/*
-		 * logMetacat.debug("Connection pool size: "
-		 * +connPool.getSizeOfDBConnectionPool(),10); logMetacat.debug("Free
-		 * DBConnection number: "
-		 */
-		// If all DBConnection in the pool are free and DBConnection pool
-		// size is greater than initial value, shrink the connection pool
-		// size to initial value
-		DBConnectionPool.shrinkDBConnectionPoolSize();
-
-		// Debug message to print out the method which have a busy DBConnection
-		try {
-			DBConnectionPool pool = DBConnectionPool.getInstance();
-//			pool.printMethodNameHavingBusyDBConnection();
-		} catch (SQLException sqle) {
-			logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - error getting DBConnectionPool: "
-					+ sqle.getMessage());
-			sqle.printStackTrace();
-		}
-
-		try {
-
-			String name = null;
-			String[] value = null;
-			Hashtable<String, String[]> params = new Hashtable<String, String[]>();
-
-			Enumeration<String> paramlist = 
-				(Enumeration<String>) request.getParameterNames();
-			while (paramlist.hasMoreElements()) {
-
-				name = paramlist.nextElement();
-				value = request.getParameterValues(name);
-
-				params.put(name, value);
-			}
-
-			// handle param is emptpy
-			if (params.isEmpty() || params == null) {
-				return;
-			}
-
-			// if the user clicked on the input images, decode which image
-			// was clicked then set the action.
-			if (params.get("action") == null) {
-				PrintWriter out = response.getWriter();
-				response.setContentType("text/xml");
-				out.println("<?xml version=\"1.0\"?>");
-				out.println("<error>");
-				out.println("Action not specified");
-				out.println("</error>");
-				out.close();
-				return;
-			}
-
-			String action = (params.get("action"))[0];
-			logMetacat.info("WorkflowSchedulerServlet.handleGetOrPost - Action is: " + action);
-
-			// This block handles session management for the servlet
-			// by looking up the current session information for all actions
-			// other than "login" and "logout"
-			String userName = null;
-			String[] groupNames = null;
-			name = null;
-
-			// handle login action
-			if (action.equals("login")) {
-				// PrintWriter out = response.getWriter();
-				// handleLoginAction(out, params, request, response);
-				// out.close();
-
-				// handle logout action
-			} else if (action.equals("logout")) {
-				// PrintWriter out = response.getWriter();
-				// handleLogoutAction(out, params, request, response);
-				// out.close();
-
-				// handle shrink DBConnection request
-			} else if (action.equals("shrink")) {
-				PrintWriter out = response.getWriter();
-				boolean success = false;
-				// If all DBConnection in the pool are free and DBConnection
-				// pool
-				// size is greater than initial value, shrink the connection
-				// pool
-				// size to initial value
-				success = DBConnectionPool.shrinkConnectionPoolSize();
-				if (success) {
-					// if successfully shrink the pool size to initial value
-					out.println("DBConnection Pool shrunk successfully.");
-				}// if
-				else {
-					out.println("DBConnection pool not shrunk successfully.");
-				}
-				// close out put
-				out.close();
-
-				// aware of session expiration on every request
-			} else {
-				SessionData sessionData = RequestUtil.getSessionData(request);
-
-				userName = sessionData.getUserName();
-				// password = sessionData.getPassword();
-				groupNames = sessionData.getGroupNames();
-				// sessionId = sessionData.getId();
-
-				logMetacat.info("WorkflowSchedulerServlet.handleGetOrPost - The user is : " + userName);
-			}
-
-			if (action.equals("scheduleWorkflow")) {
-				try {
-					WorkflowScheduler.getInstance().scheduleJob(request, response,
-							params);
-					return;
-				} catch (BaseException be) {
-					logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - error when scheduling" 
-							+ "workflow", be);
-					ResponseUtil.sendErrorXML(response,
-							ResponseUtil.SCHEDULE_WORKFLOW_ERROR, be);
-					return;
-				}
-			} else if (action.equals("unscheduleWorkflow")) {
-				try {
-					WorkflowScheduler.getInstance().unscheduleJob(request, response,
-							params, userName, groupNames);
-					return;
-				} catch (BaseException be) {
-					logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - error when unscheduling" 
-							+ "workflow", be);
-					ResponseUtil.sendErrorXML(response,
-							ResponseUtil.UNSCHEDULE_WORKFLOW_ERROR, be);
-					return;
-				}
-			} else if (action.equals("rescheduleWorkflow")) {
-				try {
-					WorkflowScheduler.getInstance().rescheduleJob(request, response,
-							params, userName, groupNames);
-					return;
-				} catch (BaseException be) {
-					logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - error when rescheduling" 
-							+ "workflow", be);
-					ResponseUtil.sendErrorXML(response,
-							ResponseUtil.RESCHEDULE_WORKFLOW_ERROR, be);
-					return;
-				}
-			} else if (action.equals("getScheduledWorkflow")) {
-				try {
-					WorkflowScheduler.getInstance().getJobs(request, response, params,
-							userName, groupNames);
-					return;
-				} catch (BaseException be) {
-					logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - error when getting" 
-							+ "scheduled workflows", be);
-					ResponseUtil.sendErrorXML(response,
-							ResponseUtil.GET_SCHEDULED_WORKFLOW_ERROR, be);
-					return;
-				}
-			} else if (action.equals("deleteScheduledWorkflow")) {
-				try {
-					WorkflowScheduler.getInstance().deleteJob(request, response, params,
-							userName, groupNames);
-					return;
-				} catch (BaseException be) {
-					logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - error when deleting" 
-							+ "workflow", be);
-					ResponseUtil.sendErrorXML(response,
-							ResponseUtil.DELETE_SCHEDULED_WORKFLOW_ERROR, be);
-					return;
-				}
-			} else {
-				logMetacat.error("WorkflowSchedulerServlet.handleGetOrPost - unregistered action: " 
-						+ action);
-				PrintWriter out = response.getWriter();
-				out.println("<?xml version=\"1.0\"?>");
-				out.println("<error>");
-				out.println("Error: action not registered.  Please report this error.");
-				out.println("</error>");
-				out.close();
-			}
-		} catch (ErrorSendingErrorException esee) {
-			String errorString = "WorkflowSchedulerServlet.handleGetOrPost - Error sending error message: " + esee.getMessage();
-			logMetacat.error(errorString);
-			throw new ServletException(errorString);
-		}
-	}
-    
-// // LOGIN & LOGOUT SECTION
-// /**
-// * Handle the login request. Create a new session object. Do user
-//	 * authentication through the session.
-//	 */
-//    private void handleLoginAction(PrintWriter out, Hashtable<String, String[]> params,
-//            HttpServletRequest request, HttpServletResponse response) {
-//        Logger logMetacat = Logger.getLogger(WorkflowSchedulerServlet.class);
-//        AuthSession sess = null;
-//        
-//        if(params.get("username") == null){
-//            response.setContentType("text/xml");
-//            out.println("<?xml version=\"1.0\"?>");
-//            out.println("<error>");
-//            out.println("Username not specified");
-//            out.println("</error>");
-//            return;
-//        }
-//        
-//        // }
-//        
-//        if(params.get("password") == null){
-//            response.setContentType("text/xml");
-//            out.println("<?xml version=\"1.0\"?>");
-//            out.println("<error>");
-//            out.println("Password not specified");
-//            out.println("</error>");
-//            return;
-//        }
-//        
-//        String un = (params.get("username"))[0];
-//        logMetacat.info("user " + un + " is trying to login");
-//        String pw = (params.get("password"))[0];
-//        
-//        String qformat = "xml";
-//        if(params.get("qformat") != null){
-//            qformat = (params.get("qformat"))[0];
-//        }
-//        
-//        try {
-//            sess = new AuthSession();
-//        } catch (Exception e) {
-//        	String errorMsg = "Problem in WorkflowSchedulerServlet.handleLoginAction() authenicating session: "
-//                + e.getMessage();
-//            logMetacat.error(errorMsg);
-//            out.println(errorMsg);
-//            return;
-//        }
-//        boolean isValid = sess.authenticate(request, un, pw);
-//        
-//        //if it is authernticate is true, store the session
-//        if (isValid) {
-//            HttpSession session = sess.getSessions();
-//            String id = session.getId();
-//            logMetacat.debug("Store session id " + id
-//                    + " which has username" + session.getAttribute("username")
-//                    + " into hash in login method");
-//            try {
-//				SessionService.registerSession(id, (String) session
-//						.getAttribute("username"), (String[]) session
-//						.getAttribute("groupnames"), (String) session
-//						.getAttribute("password"));
-//			} catch (ServiceException se) {
-//				String errorMsg = "Problem in WorkflowSchedulerServlet.handleLoginAction() registering session: "
-//						+ se.getMessage();
-//				logMetacat.error(errorMsg);
-//				out.println(errorMsg);
-//				return;
-//			}
-//        }
-//        
-//        // format and transform the output
-//        if (qformat.equals("xml")) {
-//            response.setContentType("text/xml");
-//            out.println(sess.getMessage());
-//        } else {
-//            try {
-//                DBTransform trans = new DBTransform();
-//                response.setContentType("text/html");
-//                trans.transformXMLDocument(sess.getMessage(),
-//                        "-//NCEAS//login//EN", "-//W3C//HTML//EN", qformat,
-//                        out, null, null);
-//            } catch (Exception e) {               
-//                logMetacat.error("Error in WorkflowSchedulerServlet.handleLoginAction: "
-//                        + e.getMessage());
-//            }
-//        }
-//    }
-//    
-//    /**
-//     * Handle the logout request. Close the connection.
-//     */
-//    private void handleLogoutAction(PrintWriter out, Hashtable<String, String[]> params,
-//            HttpServletRequest request, HttpServletResponse response) {
-//        Logger logMetacat = Logger.getLogger(WorkflowSchedulerServlet.class);
-//        String qformat = "xml";
-//        if(params.get("qformat") != null){
-//            qformat = params.get("qformat")[0];
-//        }
-//        
-//        // close the connection
-//        HttpSession sess = request.getSession(false);
-//        logMetacat.info("After get session in logout request");
-//        if (sess != null) {
-//            logMetacat.info("The session id " + sess.getId()
-//            + " will be invalidate in logout action");
-//            logMetacat.info("The session contains user "
-//                    + sess.getAttribute("username")
-//                    + " will be invalidate in logout action");
-//            sess.invalidate();
-//            SessionService.unRegisterSession(sess.getId());
-//        }
-//        
-//        // produce output
-//        StringBuffer output = new StringBuffer();
-//        output.append("<?xml version=\"1.0\"?>");
-//        output.append("<logout>");
-//        output.append("User logged out");
-//        output.append("</logout>");
-//        
-//        //format and transform the output
-//        if (qformat.equals("xml")) {
-//            response.setContentType("text/xml");
-//            out.println(output.toString());
-//        } else {
-//            try {
-//                DBTransform trans = new DBTransform();
-//                response.setContentType("text/html");
-//                trans.transformXMLDocument(output.toString(),
-//                        "-//NCEAS//login//EN", "-//W3C//HTML//EN", qformat,
-//                        out, null, null);
-//            } catch (Exception e) {
-//                logMetacat.error(
-//                        "Error in WorkflowSchedulerServlet.handleLogoutAction"
-//                        + e.getMessage());
-//            }
-//        }
-//    }
-}

Property changes on: src/edu/ucsb/nceas/workflowscheduler/WorkflowSchedulerServlet.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5311)
@@ -61,7 +61,6 @@
 import edu.ucsb.nceas.metacat.shared.HandlerException;
 import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
 import edu.ucsb.nceas.metacat.shared.ServiceException;
-import edu.ucsb.nceas.metacat.spatial.SpatialFeatureSchema;
 import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 import edu.ucsb.nceas.metacat.util.AuthUtil;
 import edu.ucsb.nceas.metacat.util.ConfigurationUtil;
@@ -336,7 +335,6 @@
 			logMetacat.debug("MetaCatServlet.initSecondHalf - DBConnection pool initialized: " + connPool.toString());
 			
 			ServiceService.registerService("XMLSchemaService", XMLSchemaService.getInstance());
-//			ServiceService.registerService("SchedulerService", SchedulerService.getInstance());
 
 			// check if eml201 document were corrected or not. if not, correct eml201 documents.
 			// Before Metacat 1.8.1, metacat uses tag RELEASE_EML_2_0_1_UPDATE_6 as eml
@@ -374,25 +372,23 @@
 			 * If spatial option is turned on and set to regenerate the spatial
 			 * cache on restart, trigger the harvester regeneratation method
 			 */
-			if (PropertyService.getProperty("spatial.runSpatialOption").equals("true")) {
-			//      && PropertyService.getProperty("spatial.regenerateCacheOnRestart").equals("true")) {
-			        
+			if (PropertyService.getProperty("spatial.runSpatialOption").equals("true") && 
+					PropertyService.getProperty("spatial.regenerateCacheOnRestart").equals("true")) {
+
 				// Begin timer
 				long before = System.currentTimeMillis();
 
-                // if either the point or polygon shape files do not exist, then regenerate the entire spatial cache
-                // this may be expensive with many documents
-                if (FileUtil.getFileStatus(SpatialFeatureSchema.pointShpUri) == FileUtil.DOES_NOT_EXIST) {      
-                    SpatialHarvester sh = new SpatialHarvester();
-                    sh.regenerate();
-                    sh.destroy();
-                }
+				// if either the point or polygon shape files do not exist, then regenerate the entire spatial cache
+				// this may be expensive with many documents		
+				SpatialHarvester sh = new SpatialHarvester();
+				sh.regenerate();
+				sh.destroy();
 
 				// After running the first time, we want to to set
 				// regenerateCacheOnRestart to false
 				// so that it does not regenerate the cache every time tomcat is
 				// restarted
-//				PropertyService.setProperty("spatial.regenerateCacheOnRestart", "false");
+				PropertyService.setProperty("spatial.regenerateCacheOnRestart", "false");
 
 				// End timer
 				long after = System.currentTimeMillis();
@@ -420,10 +416,12 @@
 			System.setProperty("replication.logfile.name", replicationLogPath);			
 			PropertyConfigurator.configureAndWatch(LOG_CONFIG_NAME);
 			
+			SessionService.unRegisterAllSessions();
+			
 	         //Initialize Metacat Handler
             handler = new MetacatHandler(getServletContext(), timer);
 
-			MetacatHandler.set_sitemapScheduled(false);
+			handler.set_sitemapScheduled(false);
 
 			_fullyInitialized = true;
 			
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5311)
@@ -1662,21 +1662,11 @@
                 }
                 // Lastly, update the xml_path_index table
                 if(!pathsFound.isEmpty()){
-                    try {
-                        logMetacat.debug("DocumentImpl.buildIndex - updating path index");
+                	logMetacat.debug("DocumentImpl.buildIndex - updating path index");
                     	
-                    	updatePathIndex(dbConn, pathsFound);
-                    } catch (SQLException sqle) {
-                    	
-                    	logMetacat.warn("DocumentImpl.buildIndex - SQL error when updating node " + 
-                    			"index.  Sleeping for 3 seconds and trying again : " + sqle.getMessage());
-                    	try {
-                    		Thread.currentThread().sleep(3000);
-                    	} catch (InterruptedException ie) {}
-                    	
-                    	updatePathIndex(dbConn, pathsFound);
-                    }
-                  pathsFound.clear();
+                	updatePathIndex(dbConn, pathsFound);
+
+                	pathsFound.clear();
                 }
             }
             
@@ -1943,6 +1933,16 @@
         Iterator<PathIndexEntry> it = pathsFound.values().iterator();
          while (it.hasNext()) {
              PathIndexEntry entry = (PathIndexEntry)it.next();
+             if (entry.path.length() > 2784) {
+            	 logMetacat.warn("DocumentImpl.updatePathIndex - the path for doc id " + entry.docid + 
+            			 " is too long and will db break indexing.  This path was not indexed: " + entry.path);
+            	 continue;
+             }
+             if (entry.nodeData.length() > 2784) {
+            	 logMetacat.warn("DocumentImpl.updatePathIndex - the node data for doc id " + entry.docid + 
+            			 " is too long and will break db indexing.  This path was not indexed: " + entry.path);
+            	 continue;
+             }
              pstmt.setString(1,entry.docid);
              pstmt.setString(2, entry.path);
              pstmt.setString(3, entry.nodeData);
@@ -2464,15 +2464,6 @@
             
             pstmt.close();
             if(action.equals("UPDATE")){
-                /*// Delete the old nodes in xml_nodes table...
-                pstmt = connection.prepareStatement("DELETE FROM xml_nodes "
-                                                + "WHERE rootnodeid = ?");
-                // Increase dbconnection usage count
-                connection.increaseUsageCount(1);
-                // Bind the values to the query and execute it
-                pstmt.setLong(1, thisdoc.getRootNodeID());
-                pstmt.execute();
-                pstmt.close();*/
             	logMetacat.debug("DocumentImpl.writeDocumentToDB - Deleting xml nodes for docid: " + 
             			thisdoc.getDocID() + " using root node ID: " + thisdoc.getRootNodeID());
             	deleteXMLNodes(connection, thisdoc.getRootNodeID());
Index: src/edu/ucsb/nceas/metacat/MetacatHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetacatHandler.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/MetacatHandler.java	(revision 5311)
@@ -342,6 +342,7 @@
                 + e.getMessage();
             logMetacat.error(errorMsg);
             out.println(errorMsg);
+            e.printStackTrace(System.out);
             return;
         }
         boolean isValid = sess.authenticate(request, un, pw);
@@ -365,6 +366,7 @@
                         + se.getMessage();
                 logMetacat.error("MetaCatServlet.handleLoginAction - " + errorMsg);
                 out.println(errorMsg);
+                se.printStackTrace(System.out);
                 return;
             }           
         }
@@ -383,6 +385,7 @@
             } catch (Exception e) {               
                 logMetacat.error("MetaCatServlet.handleLoginAction - General error"
                         + e.getMessage());
+                e.printStackTrace(System.out);
             }
         }
     }
@@ -433,6 +436,7 @@
                 logMetacat.error(
                         "MetaCatServlet.handleLogoutAction - General error: "
                         + e.getMessage());
+                e.printStackTrace(System.out);
             }
         }
     }
@@ -584,6 +588,7 @@
             } catch (IOException ioe) {
                 logMetacat.error("MetaCatServlet.handleExportAction - Problem with the servlet output: "
                         + ioe.getMessage());
+                e.printStackTrace(System.out);
             }
             
             logMetacat.error("MetaCatServlet.handleExportAction - General error: "
@@ -691,9 +696,11 @@
             } catch (IOException ioe) {
                 logMetacat.error("MetaCatServlet.handleReadInlineDataAction - Problem with the servlet output: "
                         + ioe.getMessage());
+                e.printStackTrace(System.out);
             }
             logMetacat.error("MetaCatServlet.handleReadInlineDataAction - General error: "
                     + e.getMessage());
+            e.printStackTrace(System.out);
         }
     }
     
@@ -783,7 +790,10 @@
                     if (zip) {
                         addDocToZip(request, docid, providedFileName, zout, user, groups);
                     } else {
-                        readFromMetacat(request.getRemoteAddr(), response, response.getOutputStream(), docid, qformat,
+                    	if (out == null) {
+                    		out = response.getOutputStream();
+                    	}
+                        readFromMetacat(request.getRemoteAddr(), response, out, docid, qformat,
                                 user, groups, withInlineData, params);
                     }
                 }
@@ -817,6 +827,7 @@
             } catch (Exception exc) {
                 logMetacat.error("MetaCatServlet.handleReadAction - General error: "
                         + exc.getMessage());
+                exc.printStackTrace(System.out);
                 try {
                     if (out != null) {
                         response.setContentType("text/xml");
@@ -849,6 +860,7 @@
                 } catch (IOException ie) {
                     logMetacat.error("MetaCatServlet.handleReadAction - Problem with the servlet output: "
                             + ie.getMessage());
+                    ie.printStackTrace(System.out);
                 }
             }
         } catch (Exception e) {
@@ -890,7 +902,7 @@
             
             logMetacat.error("MetaCatServlet.handleReadAction - General error: "
                     + e.getMessage());
-            //e.printStackTrace(System.out);
+            e.printStackTrace(System.out);
         }
     }
     
@@ -994,6 +1006,7 @@
                         // old way of creating the xml directly.
                         logMetacat.error("MetaCatServlet.readFromMetacat - could not read from document file " + docid 
                                 + ": " + e.getMessage());
+                        e.printStackTrace(System.out);
                         PrintWriter pw = new PrintWriter(out);
                         doc.toXmlFromDb(pw, user, groups, withInlineData);
                     }
@@ -1306,6 +1319,7 @@
         } catch (MetacatUtilException ue) {
             logMetacat.error("MetaCatServlet.handleInsertOrUpdateAction - Could not determine if user could insert or update: "
                     + ue.getMessage());
+            ue.printStackTrace(System.out);
         }
         
         try {
@@ -1461,6 +1475,7 @@
                 
                 logMetacat.error("MetaCatServlet.handleInsertOrUpdateAction - General error: "
                         + e.getMessage());
+                e.printStackTrace(System.out);
             }
         }
     }
@@ -1580,6 +1595,7 @@
                     out.println("</error>");
                     logMetacat.error("MetaCatServlet.handleDeleteAction - Document could not be deleted: "
                             + ane.getMessage());
+                    ane.printStackTrace(System.out);
                 }
             } catch (Exception e) {
                 response.setContentType("text/xml");
@@ -1589,6 +1605,7 @@
                 out.println("</error>");
                 logMetacat.error("MetaCatServlet.handleDeleteAction - Document could not be deleted: "
                         + e.getMessage());
+                e.printStackTrace(System.out);
             }
         }
     }
@@ -1710,7 +1727,8 @@
                 docid = actualDocId;
             } catch (ParseLSIDException ple) {
                 logMetacat.error("MetaCatServlet.handleGetAccessControlAction - MetaCatServlet.handleGetAccessControlAction - " +
-                        "could not parse lsid: " + docid + " : " + ple.getMessage());               
+                        "could not parse lsid: " + docid + " : " + ple.getMessage());  
+                ple.printStackTrace(System.out);
             }
         }
         
@@ -1953,6 +1971,7 @@
                 }
             } catch (ParseException e) {
                 logMetacat.error("MetaCatServlet.handleGetLogAction - Failed to created Timestamp from input.");
+                e.printStackTrace(System.out);
             }
             
             // Request the report by passing the filter parameters
@@ -1962,9 +1981,11 @@
         } catch (IOException e) {
             logMetacat.error("MetaCatServlet.handleGetLogAction - Could not open http response for writing: "
                     + e.getMessage());
+            e.printStackTrace(System.out);
         } catch (MetacatUtilException ue) {
             logMetacat.error("MetaCatServlet.handleGetLogAction - Could not determine if user is administrator: "
                     + ue.getMessage());
+            ue.printStackTrace(System.out);
         }
     }
     
@@ -2031,9 +2052,11 @@
         } catch (IOException e) {
             logMetacat.error("MetaCatServlet.handleBuildIndexAction - Could not open http response for writing: "
                     + e.getMessage());
+            e.printStackTrace(System.out);
         } catch (MetacatUtilException ue) {
             logMetacat.error("MetaCatServlet.handleBuildIndexAction - Could not determine if user is administrator: "
                     + ue.getMessage());
+            ue.printStackTrace(System.out);
         }
     }
     
@@ -2080,6 +2103,7 @@
         } catch (PropertyNotFoundException pnfe) {
             logMetacat.error("MetaCatServlet.handleMultipartForm - Could not determine data file size limit.  Using 1000. " 
                     + pnfe.getMessage());
+            pnfe.printStackTrace(System.out);
         }
         logMetacat.debug("MetaCatServlet.handleMultipartForm - The size limit of uploaded data files is: " + sizeLimit);
         
@@ -2161,6 +2185,7 @@
         } catch (IOException ioe2) {
             logMetacat.error("MetaCatServlet.handleMultipartForm - Fatal Error: couldn't get response "
                     + "output stream.");
+            ioe2.printStackTrace(System.out);
         }
         
         if (action.equals("upload")) {
@@ -2283,6 +2308,7 @@
                     {
                         logMetacat.error("MetaCatServlet.handleInsertMultipartAction - IO Exception copying file: " +
                                 ioe.getMessage());
+                        ioe.printStackTrace(System.out);
                     }
                     size = newFile.length();
                     if (size == 0) 
@@ -2331,7 +2357,7 @@
           catch(Exception e)
           {
               logMetacat.error("MetaCatServlet.handleInsertMultipartAction - error uploading text file via multipart: " + e.getMessage());
-              e.printStackTrace();
+              e.printStackTrace(System.out);;
           }
         }
       }
@@ -2404,6 +2430,7 @@
                                 } catch (IOException ioe) {
                                     logMetacat.error("IO Exception copying file: " +
                                             ioe.getMessage());
+                                    ioe.printStackTrace(System.out);
                                 }
                                 size = newFile.length();
                                 if (size == 0) {
@@ -2490,6 +2517,7 @@
                 
                 logMetacat.error("MetaCatServlet.handleUploadAction - General error: "
                         + e.getMessage());
+                e.printStackTrace(System.out);
             }
         }
     }
@@ -2583,7 +2611,8 @@
                     docid = actualDocId;
                 } catch (ParseLSIDException ple) {
                     logMetacat.error("MetaCatServlet.handleSetAccessAction - " +
-                            "could not parse lsid: " + docid + " : " + ple.getMessage());               
+                            "could not parse lsid: " + docid + " : " + ple.getMessage()); 
+                    ple.printStackTrace(System.out);
                 }
             }
             
@@ -2597,6 +2626,7 @@
             } catch (Exception e) {
                 logMetacat.error("MetaCatServlet.handleSetAccessAction - Error in handleSetAccessAction: "
                         + e.getMessage());
+                e.printStackTrace(System.out);
                 error = "Error in set access control for document - " + accessionNumber + e.getMessage();
                 errorList.addElement(error);
                 continue;
@@ -2637,6 +2667,7 @@
                 } catch (Exception ee) {
                     logMetacat.error("MetaCatServlet.handleSetAccessAction - Error inserting permission: "
                             + ee.getMessage());
+                    ee.printStackTrace(System.out);
                     error = "Failed to set access control for document "
                             + accessionNumber + " because " + ee.getMessage();
                     errorList.addElement(error);
@@ -2662,6 +2693,7 @@
             } catch (MetacatUtilException mue) {
                 logMetacat.error("metaCatServlet.handleSetAccessAction - could not forward " +
                         "request. Sending output to response writer");
+                mue.printStackTrace(System.out);
                 outputResponse(successList, errorList, out);
             }               
         } else {
@@ -2872,7 +2904,7 @@
     /**
      * @param sitemapScheduled toggle the _sitemapScheduled flag
      */
-    public static void set_sitemapScheduled(boolean sitemapScheduled) {
+    public void set_sitemapScheduled(boolean sitemapScheduled) {
         _sitemapScheduled = sitemapScheduled;
     }
 
Index: src/edu/ucsb/nceas/metacat/service/XMLSchemaService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/XMLSchemaService.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/service/XMLSchemaService.java	(revision 5311)
@@ -86,7 +86,7 @@
 			createRegisteredNameSpaceAndLocationString();
 			
 		} catch (PropertyNotFoundException pnfe) {
-			logMetacat.error("Could not find property: xml.useFullSchemaValidation. " + 
+			logMetacat.error("XMLService.XMLSchemaService() - Could not find property: xml.useFullSchemaValidation. " + 
 					"Setting to false.");
 		}
 	}
@@ -117,7 +117,7 @@
 			createRegisteredNameSpaceList();
 			createRegisteredNameSpaceAndLocationString();
 		} catch (PropertyNotFoundException pnfe) {
-			logMetacat.error("Could not find property: xml.useFullSchemaValidation. " + 
+			logMetacat.error("XMLService.doRefresh - Could not find property: xml.useFullSchemaValidation. " + 
 					"Setting to false.");
 		}
 	}
@@ -202,7 +202,7 @@
 					.getDBConnection("XMLService.populateRegisteredSchemaList");
 			serialNumber = conn.getCheckOutSerialNumber();
 			pstmt = conn.prepareStatement(sql);
-			logMetacat.debug("Selecting schemas: " + pstmt.toString());
+			logMetacat.debug("XMLService.populateRegisteredSchemaList - Selecting schemas: " + pstmt.toString());
 			pstmt.execute();
 			resultSet = pstmt.getResultSet();
 
@@ -211,7 +211,7 @@
 			while (resultSet.next()) {
 				String fileNamespace = resultSet.getString(1);
 				String fileLocation = resultSet.getString(2);
-				logMetacat.debug("Registering schema: " + fileNamespace + " " + fileLocation);
+				logMetacat.debug("XMLService.populateRegisteredSchemaList - Registering schema: " + fileNamespace + " " + fileLocation);
 				XMLSchema xmlSchema = new XMLSchema(fileNamespace);
 				xmlSchema.setFileName(fileLocation);
 
@@ -218,12 +218,12 @@
 				if (FileUtil.getFileStatus(xmlSchema.getLocalFileDir()) >= FileUtil.EXISTS_READABLE) {
 					registeredSchemaList.add(xmlSchema);
 				} else {
-					logMetacat.warn("Schema file: " + xmlSchema.getLocalFileDir() + " is registered "
+					logMetacat.warn("XMLService.populateRegisteredSchemaList - Schema file: " + xmlSchema.getLocalFileDir() + " is registered "
 							+ " in the database but does not exist on the file system.");
 				}
 			}
 		} catch (SQLException e) {
-			logMetacat.error("XMLService.populateRegisteredSchemaList(): "
+			logMetacat.error("XMLService.populateRegisteredSchemaList - SQL Error: "
 					+ e.getMessage());
 		} finally {
 			try {
@@ -230,7 +230,7 @@
 				pstmt.close();
 			}// try
 			catch (SQLException sqlE) {
-				logMetacat.error("Error in XMLService.populateRegisteredSchemaList(): "
+				logMetacat.error("XMLSchemaService.populateRegisteredSchemaList - Error in XMLService.populateRegisteredSchemaList(): "
 						+ sqlE.getMessage());
 			}
 			DBConnectionPool.returnDBConnection(conn, serialNumber);
@@ -317,7 +317,7 @@
 
 		// no xml. return empty vector
 		if (xml == null) {
-			logMetacat.debug("Returning empty schemaList.");
+			logMetacat.debug("XMLSchemaService.findSchemasInXML - Returning empty schemaList.");
 			return schemaList;
 		}
 
@@ -359,7 +359,7 @@
 			}
 		}
 
-		logMetacat.debug("Schemas for eml are " + schemaList.toString());
+		logMetacat.debug("XMLSchemaService.findSchemasInXML - Schemas for eml are " + schemaList.toString());
 
 		return schemaList;
 	}    
@@ -380,7 +380,7 @@
 		String eml2_1_0NameSpace = DocumentImpl.EML2_1_0NAMESPACE;
 
 		if (xml == null) {
-			logMetacat.debug("XML doc is null.  There is no namespace.");
+			logMetacat.debug("XMLSchemaService.findDocumentNamespace - XML doc is null.  There is no namespace.");
 			return namespace;
 		}
 
@@ -486,7 +486,7 @@
             tmp = xml.read();
         }
         secondLine = buffer.toString();
-        logMetacat.debug("the second line string is: " + secondLine);
+        logMetacat.debug("XMLSchemaService.getSchemaLine - the second line string is: " + secondLine);
         
         xml.reset();
         return secondLine;
Index: src/edu/ucsb/nceas/metacat/util/DocumentUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/DocumentUtil.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/util/DocumentUtil.java	(revision 5311)
@@ -157,7 +157,7 @@
         int end   = identifier.length();
         accessionNumber = identifier.substring(start, end);
       }
-      logMetacat.warn("DocumentUtil.getAccessionNumberFromEcogridIdentifier - The accession number from url is " +
+      logMetacat.info("DocumentUtil.getAccessionNumberFromEcogridIdentifier - The accession number from url is " +
                                  accessionNumber);
       return accessionNumber;
     }
Index: src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 5311)
@@ -59,7 +59,7 @@
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 
 /**
- * A database aware Class implementing callback bethods for the SAX parser to
+ * A database aware Class implementing callback methods for the SAX parser to
  * call when processing the XML stream and generating events
  * Here is the rules for user which has write permission in top level access
  * rules(he can update metadata but can't update access module) try to update
@@ -66,7 +66,7 @@
  * a document:
  * 1. Checking access part (both in top level and additional level, node by node)
  *    If something was modified, reject the document. Note: for additional part
- *    The access subtree startnode starts at "<describ>" rather than <access>.
+ *    The access subtree startnode starts at "<describe>" rather than <access>.
  *    This is because make sure ids wouldn't be mess up by user.
  * 2. Checking ids in additional access part, if they points a distribution
  *    module with online or inline. If some ids don't, reject the documents.
@@ -74,7 +74,7 @@
  *    If user can't read the inline data, the empty string in inline element
  *    will be send to user if he read this eml document(user has read access
  *    at top level - metadata, but user couldn't read inline data).
- *    Here is some intrested senario: If user does have read and write
+ *    Here is some interested scenario: If user does have read and write
  *    permission in top level access rules(for metadata)
  *    but 1) user doesn't have read and write permission in inline data block,
  *    so if user update the document with some inline data rather than
@@ -81,7 +81,7 @@
  *    empty string in same inline data block(same distribution inline id),
  *    this means user updated the inline data. So the document should be
  *    rejected.
- *    2) user doesn't have read permssion, but has write premission in
+ *    2) user doesn't have read permission, but has write permission in
  *    inline data block. If user send back inline data block with empty
  *    string, we will think user doesn't update inline data and we will
  *    copy old inline data back to the new one. If user send something
@@ -116,16 +116,27 @@
 public class Eml200SAXHandler extends DBSAXHandler implements
         AccessControlInterface
 {
-    private boolean processTopLeverAccess = false;
+	// Boolean that tells whether we are processing top level (document level) access.
+	// this is true when we hit an 'access' element, and the grandparent element is 
+	// 'eml' and we are not inside an 'additionalMetadata' section.  Set back to false
+	// in endElement
+    private boolean processTopLevelAccess = false;
 
     // now additionalAccess will be explained as distribution access control
     // - data file
     private boolean processAdditionalAccess = false;
 
+	// Boolean that tells whether we are processing other access. This is true when 
+    // we find an 'access' element inside an 'additionalMetadata' element.  Set back
+    // to false in endElement
     private boolean processOtherAccess = false;
 
+    // if we are inside an 'access' element, we use this object to hold the 
+    // current access info
     private AccessSection accessObject = null;
 
+    // for each 'access/allow' and 'access/deny' we create a new access Rule to hold
+    // the info
     private AccessRule accessRule = null;
 
     private Vector describesId = new Vector(); // store the ids in
@@ -157,7 +168,7 @@
     // temporarily store distribution id
     private String distributionId = null;
 
-    // flag to indicate to handle distrubiton
+    // flag to indicate to handle distribution
     private boolean proccessDistribution = false;
 
     // a hash table to stored the distribution which is a reference and this
@@ -171,14 +182,18 @@
     // id (300) will be stored in above distribution lists.
     private Hashtable distributionReferenceList = new Hashtable();
 
-    private boolean needCheckingAccessModule = false;
+    // if the action is update and the user does not have ALL permission 
+    // and the user is not an administrator, then we will need to compare 
+    // access modules to make sure the user has update permissions
+    private boolean needToCheckAccessModule = false;
 
-    private AccessSection unChangebleTopAccessSubTree = null;
+    private AccessSection topAccessSubTreeFromDB = null;
 
-    private Vector unChangebleAdditionalAccessSubTreeVector = new Vector();
+    private Vector additionalAccessSubTreeListFromDB = new Vector();
 
-    private Hashtable unChangebleReferencedAccessSubTreeHash = new Hashtable();
+    private Hashtable referencedAccessSubTreeListFromDB = new Hashtable();
 
+    // this holds the top level (document level) access section.
     private AccessSection topAccessSection;
 
     private Vector additionalAccessVector = new Vector();
@@ -206,7 +221,7 @@
 
     private Vector inlineFileIDList = new Vector();
 
-    private boolean inadditionalMetaData = false;
+    private boolean inAdditionalMetaData = false;
 
     //user has unwritable inline data object when it updates a document
     private boolean unWritableInlineDataObject = false;
@@ -322,7 +337,7 @@
             //unChangableSubTreeHash = getUnchangableSubTree(control, user,
             // groups);
 
-            //If the action is update and user doesn't have "ALL" permission
+            // If the action is update and user doesn't have "ALL" permission
             // we need to check if user update access subtree
             if (action != null && action.equals("UPDATE")
                     && !control.hasPermission(user, groups,
@@ -329,11 +344,11 @@
                             AccessControlInterface.ALLSTRING) 
                             && !AuthUtil.isAdministrator(user, groups))
             {
-                needCheckingAccessModule = true;
-                unChangebleTopAccessSubTree = getTopAccessSubTreeFromDB();
-                unChangebleAdditionalAccessSubTreeVector =
+                needToCheckAccessModule = true;
+                topAccessSubTreeFromDB = getTopAccessSubTreeFromDB();
+                additionalAccessSubTreeListFromDB =
                                          getAdditionalAccessSubTreeListFromDB();
-                unChangebleReferencedAccessSubTreeHash =
+                referencedAccessSubTreeListFromDB =
                                          getReferencedAccessSubTreeListFromDB();
             }
 
@@ -596,7 +611,7 @@
 
             //start handle inline data
             //=====================================================
-            if (qName.equals(INLINE) && !inadditionalMetaData)
+            if (qName.equals(INLINE) && !inAdditionalMetaData)
             {
                 handleInlineData = true;
                 inLineDataIndex++;
@@ -654,8 +669,8 @@
             {
 
 
-                if (needCheckingAccessModule
-                        && (processAdditionalAccess || processOtherAccess || processTopLeverAccess)) {
+                if (needToCheckAccessModule
+                        && (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
                     // stored the pull out nodes into storedNode stack
                     NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT",
                             null, null, MetacatUtil.normalize(textBuffer
@@ -807,7 +822,7 @@
               }
               else if (attributeName != null && attributeName.equals(ID) &&
                        currentNode.getTagName().equals(DISTRIBUTION) &&
-                       !inadditionalMetaData)
+                       !inAdditionalMetaData)
               {
                  // this is a distribution element and the id is distributionID
                  distributionId = attributeValue;
@@ -834,12 +849,12 @@
                 // put parent node back
                 nodeStack.push(tmpNode);
                 String grandParentTag = grandParentNode.getTagName();
-                if (grandParentTag.equals(EML) && !inadditionalMetaData)
+                if (grandParentTag.equals(EML) && !inAdditionalMetaData)
                 {
-                  processTopLeverAccess = true;
+                  processTopLevelAccess = true;
 
                 }
-                else if ( !inadditionalMetaData )
+                else if ( !inAdditionalMetaData )
                 {
                   // process other access embedded into resource level
                   // module
@@ -847,11 +862,10 @@
                 }
                 else
                 {
-                  // this for access in additional data which don't have
-                  // described element. If it has a descirbed element,
-                  // this code would hurt any thing
+                  // this for access in additional data which doesn't have a
+                  // described element. If it has a described element,
+                  // this code won't hurt any thing
                   processAdditionalAccess = true;
-                  logMetacat.info("accessing process additional access true when meet access");
                 }
 
 
@@ -871,7 +885,7 @@
                   accessObject.setStartedDescribesNodeId(firstDescribesNodeId);
                   accessObject.setControlLevel(DATAACCESSLEVEL);
                 }
-                else if (processTopLeverAccess)
+                else if (processTopLevelAccess)
                 {
                   accessObject.setControlLevel(TOPLEVEL);
                 }
@@ -918,8 +932,8 @@
             nodeIndex.addElement(currentNode);
 
             // store access module element and attributes into stored stack
-            if (needCheckingAccessModule
-                    && (processAdditionalAccess || processOtherAccess || processTopLeverAccess))
+            if (needToCheckAccessModule
+                    && (processAdditionalAccess || processOtherAccess || processTopLevelAccess))
             {
                 // stored the pull out nodes into storedNode stack
                 NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "ELEMENT",
@@ -938,7 +952,7 @@
 
             if (currentNode.getTagName().equals(ADDITIONALMETADATA))
             {
-              inadditionalMetaData = true;
+              inAdditionalMetaData = true;
             }
             else if (currentNode.getTagName().equals(DESCRIBES) &&
                      parentNode.getTagName().equals(ADDITIONALMETADATA) &&
@@ -954,7 +968,7 @@
               processAdditionalAccess = true;
               logMetacat.info("set processAdditonalAccess true when meet describe");
             }
-            else if (inadditionalMetaData && processAdditionalAccess &&
+            else if (inAdditionalMetaData && processAdditionalAccess &&
                      parentNode.getTagName().equals(ADDITIONALMETADATA) &&
                      !currentNode.getTagName().equals(DESCRIBES) &&
                      !currentNode.getTagName().equals(ACCESS))
@@ -971,7 +985,7 @@
                logMetacat.warn("set processAddtionAccess false if the there is no access in additional");
             }
             else if (currentNode.getTagName().equals(DISTRIBUTION) &&
-                     !inadditionalMetaData)
+                     !inAdditionalMetaData)
             {
               proccessDistribution = true;
             }
@@ -1053,8 +1067,8 @@
                 DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
                 endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer,
                         currentNode);
-                if (needCheckingAccessModule
-                     && (processAdditionalAccess || processOtherAccess || processTopLeverAccess))
+                if (needToCheckAccessModule
+                     && (processAdditionalAccess || processOtherAccess || processTopLevelAccess))
                 {
                      // stored the pull out nodes into storedNode stack
                      NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT",
@@ -1237,7 +1251,7 @@
                     //firstDescribesNodeId = 0;
                 }
                 else if (currentTag.equals(REFERENCES)
-                        && (processTopLeverAccess || processAdditionalAccess || processOtherAccess))
+                        && (processTopLevelAccess || processAdditionalAccess || processOtherAccess))
                 {
                     // get reference
                     data = (textBuffer.toString()).trim();
@@ -1257,7 +1271,7 @@
                   }
 
                 }
-                else if (currentTag.equals(URL) && !inadditionalMetaData)
+                else if (currentTag.equals(URL) && !inAdditionalMetaData)
                 {
                     //handle online data, make sure its'parent is online
                     DBSAXNode parentNode = (DBSAXNode) nodeStack.peek();
@@ -1284,8 +1298,8 @@
                  endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer,
                             currentNode);
 
-                if (needCheckingAccessModule
-                        && (processAdditionalAccess || processOtherAccess || processTopLeverAccess)) {
+                if (needToCheckAccessModule
+                        && (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
                     // stored the pull out nodes into storedNode stack
                     NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT",
                             null, null, MetacatUtil.normalize(textBuffer
@@ -1325,7 +1339,7 @@
                 if (newAccessObject != null)
                 {
 
-                    if (processTopLeverAccess)
+                    if (processTopLevelAccess)
                     {
                        topAccessSection = newAccessObject;
 
@@ -1362,7 +1376,7 @@
 
                 // reset flag
                 processAdditionalAccess = false;
-                processTopLeverAccess = false;
+                processTopLevelAccess = false;
                 processOtherAccess = false;
 
             }//access element
@@ -1371,7 +1385,7 @@
                 //reset describesId
                 describesId = null;
                 describesId = new Vector();
-                inadditionalMetaData = false;
+                inAdditionalMetaData = false;
                 firstDescribesNodeId = -1;
                 // reset tmp stored node stack
                 storedAccessNodeStack = null;
@@ -1379,13 +1393,13 @@
 
 
             }
-            else if (currentTag.equals(DISTRIBUTION) && !inadditionalMetaData)
+            else if (currentTag.equals(DISTRIBUTION) && !inAdditionalMetaData)
             {
                //reset distribution id
                distributionId = null;
                proccessDistribution = false;
             }
-            else if (currentTag.equals(OFFLINE) && !inadditionalMetaData)
+            else if (currentTag.equals(OFFLINE) && !inAdditionalMetaData)
             {
                if (distributionId != null)
                {
@@ -1393,7 +1407,7 @@
                }
             }
             else if ((currentTag.equals(CONNECTION) || currentTag.equals(CONNECTIONDEFINITION))
-                     && !inadditionalMetaData)
+                     && !inAdditionalMetaData)
             {
               //handle online data, make sure its'parent is online
                  DBSAXNode parentNode = (DBSAXNode) nodeStack.peek();
@@ -1537,14 +1551,14 @@
                             str, PERMISSIONERROR);
                 }//if*/
                 //compare top level access module
-                if (processTopLeverAccess && needCheckingAccessModule) {
+                if (processTopLevelAccess && needToCheckAccessModule) {
                     /*compareCommentNode(currentUnchangableAccessModuleNodeStack,
                             str, UPDATEACCESSERROR);*/
                 }
                 endNodeId = currentNode.writeChildNodeToDB("COMMENT", null,
                         str, docid);
-                if (needCheckingAccessModule
-                        && (processAdditionalAccess || processOtherAccess || processTopLeverAccess)) {
+                if (needToCheckAccessModule
+                        && (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
                     // stored the pull out nodes into storedNode stack
                     NodeRecord nodeElement = new NodeRecord(-2, -2, -2,
                             "COMMENT", null, null, MetacatUtil.normalize(str));
@@ -1621,13 +1635,13 @@
             String data = new String(cbuf, start, len);
 
                 //compare whitespace in access top module
-                if (processTopLeverAccess && needCheckingAccessModule) {
+                if (processTopLevelAccess && needToCheckAccessModule) {
                     /*compareWhiteSpace(currentUnchangableAccessModuleNodeStack,
                             data, UPDATEACCESSERROR);*/
                 }
                 // Write the content of the node to the database
-                if (needCheckingAccessModule
-                        && (processAdditionalAccess || processOtherAccess || processTopLeverAccess)) {
+                if (needToCheckAccessModule
+                        && (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
                     // stored the pull out nodes into storedNode stack
                     NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT",
                             null, null, MetacatUtil.normalize(data));
@@ -1650,7 +1664,7 @@
     public void endDocument() throws SAXException
     {
         logMetacat.info("end Document");
-        if (needCheckingAccessModule)
+        if (needToCheckAccessModule)
         {
           compareAllAccessModules();
         }
@@ -1691,10 +1705,10 @@
     private void compareAllAccessModules() throws SAXException
     {
       //compare top level
-      compareAccessSubtree(unChangebleTopAccessSubTree, topAccessSection);
+      compareAccessSubtree(topAccessSubTreeFromDB, topAccessSection);
 
       //compare additional level
-      int oldSize = unChangebleAdditionalAccessSubTreeVector.size();
+      int oldSize = additionalAccessSubTreeListFromDB.size();
       int newSize = additionalAccessVector.size();
       // if size is different, use deleted or added rules, so throw a exception
       if (oldSize != newSize)
@@ -1706,7 +1720,7 @@
       for ( int i = 0; i < newSize; i++)
       {
         AccessSection fromDB = (AccessSection)
-                          unChangebleAdditionalAccessSubTreeVector.elementAt(i);
+                          additionalAccessSubTreeListFromDB.elementAt(i);
         AccessSection fromParser = (AccessSection)
                                 additionalAccessVector.elementAt(i);
         compareAccessSubtree(fromDB, fromParser);
@@ -1713,12 +1727,12 @@
       }
 
       //compare referenced level
-      Enumeration em = unChangebleReferencedAccessSubTreeHash.keys();
+      Enumeration em = referencedAccessSubTreeListFromDB.keys();
       while (em.hasMoreElements())
       {
         String id = (String)em.nextElement();
         AccessSection fromDB = (AccessSection)
-                               unChangebleReferencedAccessSubTreeHash.get(id);
+                               referencedAccessSubTreeListFromDB.get(id);
         AccessSection fromParser = (AccessSection)
                                possibleReferencedAccessHash.get(id);
         compareAccessSubtree(fromDB, fromParser);
@@ -1926,7 +1940,7 @@
      //System.out.println("in write additional");
      // we should delete all inline access rules in xml_access if
      // user has all permission
-     if (!needCheckingAccessModule)
+     if (!needToCheckAccessModule)
      {
        deleteAllInlineDataAccessRules();
      }
Index: docs/dev/metacat-eclipse-project.html
===================================================================
--- docs/dev/metacat-eclipse-project.html	(revision 5310)
+++ docs/dev/metacat-eclipse-project.html	(revision 5311)
@@ -31,48 +31,184 @@
     </tr>
   </table>
     
-  Run metacat on eclipse
+    <p> The following are the steps to download Eclipse, load the Metacat project and
+    it's dependent projects, set up the environment, and run Metacat via Tomcat from
+    within Eclipse.</p>
+    
+    <p> One note, these instructions are based on my development system, which is a Linux
+    system.  I rarely use
+    apt-get install (debian) or yum install (fedora) to install supporting applications
+    like Java, Tomcat and Apache.  This is because I want a certain level of control
+    over where these apps are installed, and I like to be able to install several 
+    versions side by side so I can switch back and forth in my development environment.</p>
+    
+    <p> My typical approach is to install the application in the /usr directory.  Then I 
+    create a symlink from /usr/local to this install.  Any environment variables reference
+    this symlink, so I can easily modify the symlink to change the version of the 
+    application.</p>
+    
+	<p><div class="header3">Install Java (assuming it's not already installed):</div>
+	<ul>
+		<li>go to <a target="_blank" href="http://java.sun.com/javase/downloads/index.jsp">Java Download Site</a>.</li>
+		<li>download the Java SE Development Kit for your platform (I use the regular .bin file, not the
+		   rpm.bin).</li>
+		<li>make the java usr directory:  <code>sudo mkdir /usr/java</code></li>
+		<li>move the jdk .bin file you downloaded into the java user dir: 
+			<code>sudo mv jdk-6u19-linux-i586.bin /usr/java</code></li>
+		<li>make bin file executable: <code>sudo chmod +x jdk-6u19-linux-i586.bin</code></li>
+		<li>run the bin file: <code>sudo ./jdk-6u19-linux-i586.bin</code></li>
+		<li>create java symlink in /usr/local: <code>ln -s /usr/java/jdk1.6.19/ /usr/local/java</code>
+		<li>add the following lines to /etc/profile (again, this is my preference):<br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;JAVA_HOME=/usr/local/java</code><br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;PATH=$JAVA_HOME/bin:$PATH</code><br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;export PATH JAVA_HOME</code>
+		</li>
+	</ul>
+	
+	<p><div class="header3">Install Tomcat (assuming it's not already installed):</div>
+	<ul>
+		<li>go to <a target="_blank" href="http://tomcat.apache.org/download-60.cgi">Tomcat Download Site</a>.</li>
+		<li>download the binary core tar.gz file.</li>
+		<li>make the tomcat usr directory:  <code>sudo mkdir /usr/tomcat</code></li>
+		<li>move the tar.gz file you downloaded into the tomcat user dir: 
+			<code>sudo mv apache-tomcat-6.0.26.tar.gz /usr/tomcat</code></li>
+		<li>expand tar.gz: <code>sudo tar -xvzf apache-tomcat-6.0.26.tar.gz</code></li>
+		<li>create tomcat symlink in /usr/local: <code>ln -s /usr/tomcat/apache-tomcat-6.0.26/ /usr/local/tomcat</code>
+		<li>add the following lines to /etc/profile (again, this is my preference):<br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;TOMCAT_HOME=/usr/local/tomcat</code><br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;PATH=$TOMCAT_HOME/bin:$PATH</code><br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;export PATH TOMCAT_HOME</code>
+		</li>
+	</ul>
+	</p>
+	
+	<p><div class="header3">Download and Install Eclipse:</div>
+	<ul>
+		<li>go to <a target="_blank" href="http://www.eclipse.org/downloads/">Eclipse Download Site</a>.</li>
+		<li>choose Eclipse IDE for Java Developers</li>
+		<li>make the eclipse usr directory:  <code>sudo mkdir /usr/eclipse</code></li>
+		<li>move the tar.gz file you downloaded into the eclipse user dir: 
+			<code>sudo mv eclipse-java-galileo-SR2-linux-gtk.tar.gz /usr/eclipse</code></li>
+		<li>extract tar.gz: 
+		   <code>sudo tar -xvzf eclipse-java-galileo-SR2-linux-gtk.tar.gz</code></li>
+		<li>note that Eclipse extracts into a folder named eclipse.  I like to rename this
+		folder using the SR number or current date, in case I want to put another version of 
+		eclipse next to it. So: <br>&nbsp;&nbsp;&nbsp;&nbsp;<code>mv /usr/eclipse/eclipse /usr/eclipse/eclipse-galileo-SR2</code></li>
+		<li>create eclipse symlink in /usr/local: <code>ln -s /usr/eclipse/eclipse-galileo-SR2 /usr/local/eclipse</code>
+		<li>add the following lines to /etc/profile (again, this is my preference):<br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;ECLIPSE_HOME=/usr/local/eclipse</code><br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;PATH=$ECLIPSE_HOME:$PATH</code><br>
+		    <code>&nbsp;&nbsp;&nbsp;&nbsp;export PATH ECLIPSE_HOME</code>
+		</li>
+		<li>I create a desktop launcher for Eclipse.  The command should just be <code>eclipse</code>.
+		If that doesn't work, you may need to log out and log in to pick up changes in 
+		<code>/etc/profile</code>.  You can associate the launcher with the eclipse icon
+		at <code>/usr/local/eclipse/icon.xpm</code></li>
+	</ul>
+	</p>
 
-
-Download eclipse ganymede:
-	go to http://www.eclipse.org/downloads/packages/release/ganymede/sr2
-	choose Eclipse IDE for Java Developers
-	extract tar.gz to /Applications/eclipse
-
-Get svn plugin:
-	in eclipse, go to Help/Software Updates
-	add the following update site: http://subclipse.tigris.org/update_1.6.x
+	<p><div class="header3">Get Subversion plugin:</div>
+	<p>The subversion plugin allows you to checkout and manage your code against
+	an SVN repository</p>
+	<ul>
+		<li>in eclipse, go to Help/Install New Software</li>
+		<li>add the following update site: <code>http://subclipse.tigris.org/update_1.6.x</code>
 		Note this may change for newer versions.
-		Check at http://subclipse.tigris.org/ for newer versions
-	Choose to install all the packages under that site
+		Check <a target="_blank" href="http://subclipse.tigris.org/">Subclipse Site</a> for newer versions</li>
+		<li>Choose to install all the packages under that site</li>
+		<li>After restarting Eclipse, you should see an SVN Repository Exploring
+		perspective available.</li>
+	</ul>
+	</p>
 
-Check out metacat code:
-	in eclipse go to the svn repository view
-	click in window under svn repositories and chosse "add svn repository"
-	add https://code.ecoinformatics.org/code/metacat
-	add https://code.ecoinformatics.org/code/utilities 
-	add https://code.ecoinformatics.org/code/seek
-	for each, open tree and right click on trunk
-	choose "checkout from svn"
-	check out as a project using the wizard
-	choose java project
-	create a new project in workspace.
-	Note, if you want to check out a certain branch or tag, browse to that tag in the tree and follow the same steps as above.
+	<p><div class="header3">Check out metacat code:</div>
+	<ul>
+		<li>In eclipse go to the SVN Repository Exploring perspecitve</li>
+		<li>Click in window under svn repositories and chosse "New > Repostory Location ..."</li>
+		<li>Add <code>https://code.ecoinformatics.org/code/metacat</code></li>
+		<li>Add <code>https://code.ecoinformatics.org/code/utilities </code></li>
+		<li>If you are actively working on ecogrid, add <code>https://code.ecoinformatics.org/code/seek</code></li>
+		<li>For each repository, open its tree and right click on trunk </li>
+		<li>Choose "checkout..."</li>
+		<li>Check out as a project using the wizard</li>
+		<li>Choose java project</li>
+		<li>Name the project in workspace. One thing to keep in mind is that the build
+		process relies on the Metacat code being in a directory named "metacat".  If you will
+		absolutely only have one metacat project, you can name it "metacat".  Otherwise, I usually
+		name the project something meaningfull, like "METACAT_TRUNK" or "METACAT_1_9_1_RC2".  Then
+		I create a "metacat" simlink at the same level that points to the checkout that I 
+		actually want to build.</li>
+		<li>Note, if you want to check out a certain branch or tag, browse to that tag in the tree and follow the same steps as above.</li>
+	</ul>
+	</p>
 
-Set met
+	<p><div class="header3">Set up Metacat Dependencies</div>
+	<p>These dependencies are primarily so you can eliminate reference errors in
+	the code and so you can debug when running in tomcat.</p>
+	<ul>
+		<li>In the Java perspective, hilight the utilities project you checked out.</li>
+		<ul>
+			<li>In the menu, go to Project > Properties > Java Build Path</li>
+			<li>Choose the libraries tab and Add Jars...</li>
+			<li>Select all the jar files in the utilities/lib directory</li>
+			<li>Switch to the Source tab and remove utilities/src</li>
+			<li>Add folder utilties/src/java</li>
+		</ul>
+		<li>In the Java perspective, hilight the metacat project you checked out.</li>
+		<ul>
+			<li>In the menu, go to Project > Properties > Java Build Path</li>
+			<li>Choose the libraries tab and Add Jars...</li>
+			<li>Select all the jar files in the metacat/lib directory EXCEPT the 
+			    utilities.jar if it exists.</li>
+			<li>Select all the jar files in the metacat/lib/lsid_lib directory</li>
+			<li>Select all the jar files in the metacat/lib/spatial/geoserver/WEB-INF/lib directory</li>
+			<li>Choose to Add External Jars and select all the jar files in /usr/local/tomcat/lib</li>
+			<li>Switch to the Projects tab and add the utilities project.</li>
+		</ul>
+		<li>These settings should remove all but the most persistant error markers in
+		the code.</li>
+	</ul>
+	</p>
+	
+	<p><div class="header3">Build Metacat</div>
+	<p>A full description of how to build Metacat is beyond the scope of this document, however
+	you should be able to do all Ant tasks from within eclipse.</p>
+	<ul>
+		<li>In Eclipse choose Window > Show View > Ant</li>
+		<li>You should see an Ant window pop up on the right.</li>
+		<li>In the Metacat project, select the build.xml file and drag it to 
+			the Ant window.</li>
+		<li>All Ant tasks should now be runnable from this window</li>
+	</ul>
+	</p>
 
-Set up Tomcat:
-	go to http://tomcat.apache.org and get tomcat 6.0 binary tar.gz and extract
-	(or on ubuntu, do apt-get install tomcat)
-	get tomcat eclipse plugin at: http://www.eclipsetotale.com/tomcatPlugin.html
-		extract zip and move resulting dir into <eclipse_home>/plugins directory
-		restart eclipse
-	In eclipse preferences, go to tomcat 
-		Set version to correct value (6 recommended)
-		Set tomcat home to directory where you just installed tomcat
+	<p><div class="header3">Set up Tomcat in Eclipse:</div>
+	<ul>
+		<li>Get tomcat eclipse plugin at: 
+		    <a target="_blank" href="http://www.eclipsetotale.com/tomcatPlugin.html">Tomcat Plugin Site</a></li>
+		<li>Extract zip: <code>sudo unzip tomcatPluginV321.zip</code></li>
+		<li>move resulting dir into Eclipse plugins directory: <br>
+			<code>&nbsp;&nbsp;&nbsp;&nbsp;sudo mv com.sysdeo.eclipse.tomcat_3.2.1 /usr/locale/eclipse/plugins</code></li>
+		<li>Restart Eclipse. You should see some Tomcat icons in the toolbar.</li>
+		<li>In Eclipse go to Window > Preferences > Tomcat </li>
+		<li>Set Tomcat version to correct value (6 recommended)</li>
+		<li>Set tomcat home to directory where you just installed tomcat 
+		   (<code>/usr/local/tomcat</code> if you used my instructions).</li>  
+		<li>Under "Advanced", add Metacat and Utilities projects to Tomcat classpath</li>
+		<li>You can now start and stop Tomcat using the Tomcat menu or toolbar items.
+			The application output will show up in the console tab in Eclipse.  Note
+			that there is also now a Debug perspective.  You can perform the standard
+			debugger actions on your running Metcat instance via this perspective.</li>
+	</ul>
+	</p>   
     
+    <p><div class="header3">Advanced Operations:</div><p>
+    <p>There are many more advanced operations that can be performed from within
+    Eclipse, including running individual classes, regular expression searching, 
+    jumping to implementation source and more.  Please refer to 
+    <a target="_blank" href="http://www.eclipse.org/documentation/">Eclipse Documentation</a>
+    for more information.</p> 
     
-    
   <br>
   <a href="./metacat-dev-hardware.html">Back</a> | <a href="./index.html">Home</a> | 
   <a href="./testing-metacat.html">Next</a>
Index: docs/dev/service-base.html
===================================================================
--- docs/dev/service-base.html	(revision 5310)
+++ docs/dev/service-base.html	(revision 5311)
@@ -57,10 +57,20 @@
   </div>  
   
   <a name="Overview"></a><div class="header1">Overview</div>   
-  <p>Metacat is migrating toward a service based architecture.  Basically, 
-  what this means is that any internal service that Metacat provides should be 
-  represented in a singleton class that extends the BaseService class.</p>
+  <p>There is a goal to migrate Metacat to a service based architecture.  This
+  provides several advantages: </p>
+  <ul>
+    <li>Cached values can be refreshed via the configuration utility without
+    requiring a restart of Metacat.</li>
+    <li>Services can be gracefully shut down when Metacat is stopped.  For
+    instance, the database service can make sure all db requests have completed
+    before continuing with shutdown.</li>
+    <li>Services can have a common interface to expose MBeans for JMX monitoring
+    (see the <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">Java Management Extensions</a> page).</li>
+  </ul>
   
+  <p>From a 
+  
   <p>There are a few basic questions that can be asked when you are creating a 
   class to decide if it should be a service.</p>
   <ul>
@@ -99,7 +109,8 @@
     performs any appropriate state-specific service updates.</li>
     <li> refresh() - a package level method that calls refreshable() and doRefresh().  It has
     package level access because we only want the ServiceService to be able to refresh the 
-    service</li>
+    service.</li>
+    <li>stop() - Gracefully shut down the service, releasing any resources.</li>
   </ul>
     
   <a name="ServiceService"></a><div class="header1">Controling Services With ServiceService Class</div>   
Index: src/edu/ucsb/nceas/metacat/NodeRecord.java
===================================================================
--- src/edu/ucsb/nceas/metacat/NodeRecord.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/NodeRecord.java	(revision 5311)
@@ -32,14 +32,14 @@
  * A utility class that encapsulates a node and its data
  */
 public class NodeRecord {
-  private long nodeid = -1;
-  private long parentnodeid = -1;
-  private long nodeindex = -1;
-  private String nodename = null;
-  private String nodeprefix = null;
-  private String nodetype = null;
-  private String nodedata = null;
-  private float nodedatanumerical = -1;
+  private long _nodeid = -1;
+  private long _parentnodeid = -1;
+  private long _nodeindex = -1;
+  private String _nodename = null;
+  private String _nodeprefix = null;
+  private String _nodetype = null;
+  private String _nodedata = null;
+  private float _nodedatanumerical = -1;
   private Logger logMetacat = Logger.getLogger(NodeRecord.class);
 
   /**
@@ -48,68 +48,66 @@
   public NodeRecord(long nodeid, long parentnodeid, long nodeindex,
                     String nodetype, String nodename, String nodeprefix, 
                     String nodedata) {
-    this.nodeid = nodeid;
-    this.parentnodeid = parentnodeid;
-    this.nodeindex = nodeindex;
-    this.nodename = nodename;
-    this.nodeprefix = nodeprefix;
-    this.nodetype = nodetype;
-    this.nodedata = nodedata;
+	    setNodeId(nodeid);
+	    setParentNodeId(parentnodeid);
+	    setNodeIndex(nodeindex);
+	    setNodeName(nodename);
+	    setNodePrefix(nodeprefix);
+	    setNodeType(nodetype);
+	    setNodeData(nodedata);
   }
   
+  public NodeRecord(long nodeid, long parentnodeid, long nodeindex, String nodetype,
+			String nodename, String nodeprefix, String nodedata, float nodedatanumerical) {
+		setNodeId(nodeid);
+		setParentNodeId(parentnodeid);
+		setNodeIndex(nodeindex);
+		setNodeName(nodename);
+		setNodePrefix(nodeprefix);
+		setNodeType(nodetype);
+		setNodeData(nodedata);
+		setNodeDataNumerical(nodedatanumerical);
+	}
   
-  public NodeRecord(long nodeid, long parentnodeid, long nodeindex,
-                    String nodetype, String nodename, String nodeprefix, 
-                    String nodedata, float nodedatanumerical) {
-    this.nodeid = nodeid;
-    this.parentnodeid = parentnodeid;
-    this.nodeindex = nodeindex;
-    this.nodename = nodename;
-    this.nodeprefix = nodeprefix;
-    this.nodetype = nodetype;
-    this.nodedata = nodedata;
-    this.nodedatanumerical = nodedatanumerical;
-  }
-  
-  /** Get functions*/
+  /** Get functions */
   public long getNodeId()
   {
-    return nodeid;
+    return _nodeid;
   }
   
   public long getParentNodeId()
   {
-    return parentnodeid;
+    return _parentnodeid;
   }
   
   public long getNodeIndex()
   {
-    return nodeindex;
+    return _nodeindex;
   }
   
   public String getNodeName()
   {
-    return nodename;
+    return _nodename;
   }
   
   public String getNodeType()
   {
-    return nodetype;
+    return _nodetype;
   }
   
   public String getNodePrefix()
   {
-    return nodeprefix;
+    return _nodeprefix;
   }
   
   public String getNodeData()
   {
-    return nodedata;
+    return _nodedata;
   }
 
   public float getNodeDataNumerical()
   {
-    return nodedatanumerical;
+    return _nodedatanumerical;
   }
   
   /** Setter methods **/
@@ -119,8 +117,8 @@
    *
    * @param id  the new value of the id
    */
-  public void setNodeId (long id){
-    this.nodeid = id;
+  public void setNodeId (long id) {
+	  _nodeid = id;
   }
   
   /**
@@ -128,8 +126,8 @@
    *
    * @param parentid  the new value of the parent id
    */
-  public void setParentNodeId (long parentid){
-    this.parentnodeid = parentid;
+  public void setParentNodeId (long parentid) {
+	  _parentnodeid = parentid;
   }
   
   /**
@@ -137,8 +135,12 @@
    *
    * @param name  the new value of the node name
    */
-  public void setNodeName (String name){
-    this.nodename = name;
+  public void setNodeName (String name) {
+	  if (name != null) {
+		  _nodename = name.trim();
+	  } else {
+		  _nodename = null;
+	  }
   }
   
   /**
@@ -146,8 +148,12 @@
    *
    * @param prefix  the new value of the node prefix
    */
-  public void setNodePrefix (String prefix){
-    this.nodeprefix = prefix;
+  public void setNodePrefix (String prefix) {
+	  if (prefix != null) {
+		  _nodeprefix = prefix.trim(); 
+	  } else {
+		  _nodeprefix = null;
+	  }
   }
   
   /**
@@ -155,8 +161,8 @@
    *
    * @param index  the new value of the node index
    */
-  public void setNodeIndex (long index){
-    this.nodeindex = index;
+  public void setNodeIndex (long index) {
+	  _nodeindex = index;
   }
   
   /**
@@ -164,8 +170,12 @@
    *
    * @param type  the new value of the node type
    */ 
-  public void setNodeType (String type){
-    this.nodetype = type;
+  public void setNodeType (String type) {
+	  if (type != null) {
+		  _nodetype = type.trim();
+	  } else {
+		  _nodetype = null;
+	  }
   }
   
   /**
@@ -173,8 +183,12 @@
    *
    * @param data  the new value of the node data
    */
-  public void setNodeData (String data){
-    this.nodedata = data;
+  public void setNodeData (String data) {
+	  if (data != null) {
+		  _nodedata = data.trim();
+	  } else {
+		  _nodedata = null;
+	  }
   }
   
   /**
@@ -183,7 +197,7 @@
    * @param datanumerical  the new value of the numerical node data
    */     
   public void setNodeDataNumerical (float datanumerical){
-    this.nodedatanumerical = datanumerical;
+    _nodedatanumerical = datanumerical;
   }
   
   /** Method compare two records */
@@ -190,42 +204,42 @@
   public boolean contentEquals(NodeRecord record)
   {
     boolean flag = true;
-    logMetacat.info("First nodetype: "+this.nodetype);
-    logMetacat.info("Second nodetype: "+record.getNodeType());
-    logMetacat.info("First nodename: "+this.nodename);
-    logMetacat.info("Second nodename: "+record.getNodeName());
-    logMetacat.info("First nodeprefix: "+this.nodeprefix);
-    logMetacat.info("Second nodeprefix: "+record.getNodePrefix());
-    logMetacat.info("First nodedata: "+this.nodedata);
-    logMetacat.info("Second nodedata: "+record.getNodeData());
-    if ((this.nodename == null && record.getNodeName() != null) ||
-        (this.nodename != null && record.getNodeName() == null) ||
-        (this.nodename != null && record.getNodeName() != null &&
-        !(this.nodename).equals(record.getNodeName())))
+    logMetacat.info("First nodetype: " + _nodetype);
+    logMetacat.info("Second nodetype: " + record.getNodeType());
+    logMetacat.info("First nodename: " + _nodename);
+    logMetacat.info("Second nodename: " + record.getNodeName());
+    logMetacat.info("First nodeprefix: " + _nodeprefix);
+    logMetacat.info("Second nodeprefix: " + record.getNodePrefix());
+    logMetacat.info("First nodedata: " + _nodedata);
+    logMetacat.info("Second nodedata: " + record.getNodeData());
+    if ((_nodename == null && record.getNodeName() != null) ||
+        (_nodename != null && record.getNodeName() == null) ||
+        (_nodename != null && record.getNodeName() != null &&
+        !(_nodename).equals(record.getNodeName())))
     {
       //compare nodename
       flag = false;
     }
-    else if ((this.nodetype == null && record.getNodeType() != null) ||
-             (this.nodetype != null && record.getNodeType() == null) ||
-             (this.nodetype != null && record.getNodeType() != null &&
-             !(this.nodetype).equals(record.getNodeType())))
+    else if ((_nodetype == null && record.getNodeType() != null) ||
+             (_nodetype != null && record.getNodeType() == null) ||
+             (_nodetype != null && record.getNodeType() != null &&
+             !(_nodetype).equals(record.getNodeType())))
     {
       // compare node type
       flag = false;
     }
-    else if ((this.nodeprefix == null && record.getNodePrefix() != null) ||
-             (this.nodeprefix != null && record.getNodePrefix() == null) ||
-             (this.nodeprefix != null && record.getNodePrefix() != null &&
-             !(this.nodeprefix).equals(record.getNodePrefix())))
+    else if ((_nodeprefix == null && record.getNodePrefix() != null) ||
+             (_nodeprefix != null && record.getNodePrefix() == null) ||
+             (_nodeprefix != null && record.getNodePrefix() != null &&
+             !(_nodeprefix).equals(record.getNodePrefix())))
     {
       // compare node prefix
       flag = false;
     }
-    else if ((this.nodedata == null && record.getNodeData() != null) ||
-             (this.nodedata != null && record.getNodeData() == null) ||
-             (this.nodedata != null && record.getNodeData() != null &&
-             !(this.nodedata).equals(record.getNodeData())))
+    else if ((_nodedata == null && record.getNodeData() != null) ||
+             (_nodedata != null && record.getNodeData() == null) ||
+             (_nodedata != null && record.getNodeData() != null &&
+             !(_nodedata).equals(record.getNodeData())))
     {
       // compare node data
       flag = false;
Index: docs/dev/workflowscheduler/installWorkflowScheduler.txt
===================================================================
--- docs/dev/workflowscheduler/installWorkflowScheduler.txt	(revision 5310)
+++ docs/dev/workflowscheduler/installWorkflowScheduler.txt	(revision 5311)
@@ -54,6 +54,8 @@
 	-- cd build-area
 	-- ant change-to -Dsuite=wrp
 	-- ant run 
+	-- close kepler 
+	-- ant startup-script       
 
 Install workflow run engine:
 	-- follow the steps listed in:
Index: build.xml
===================================================================
--- build.xml	(revision 5310)
+++ build.xml	(revision 5311)
@@ -59,15 +59,10 @@
         </and>
 	</condition>
 
-	<target name="config">
-        <!-- Find the servlet-api.jar, depending on the tomcat version. -->
-		<property name="t5.jar" 
-                 value="${build.tomcat.dir}/common/lib/servlet-api.jar"/>
-		<property name="t6.jar" 
-                 value="${build.tomcat.dir}/lib/servlet-api.jar"/>
-		<available file="${t5.jar}" property="jsdk" value="${t5.jar}"/>
-		<available file="${t6.jar}" property="jsdk" value="${t6.jar}"/>
+	<available file="${build.tomcat.dir}/common/lib/servlet-api.jar" 
+			property="tomcat.common.exists" />
 
+	<target name="config" depends="setTomcatCommon, setTomcatNoCommon">
 		<!-- usr for client testing, generally you don't need change-->
 		<property name="mcuser"
 			value="uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org" />
@@ -90,7 +85,17 @@
 
 		<echo>*********** set jsdk to ${jsdk}</echo>
 	</target>
-
+	
+	<target name="setTomcatCommon" if="tomcat.common.exists" >
+		<property name="jsdk"
+			value="${build.tomcat.dir}/common/lib/servlet-api.jar" />
+	</target>
+	
+	<target name="setTomcatNoCommon" unless="tomcat.common.exists" >
+		<property name="jsdk"
+			value="${build.tomcat.dir}/lib/servlet-api.jar" />
+	</target>
+	
 	<target name="init" depends="config">
 		<path id="compile.classpath">
 			<pathelement location="${jsdk}" />
@@ -118,7 +123,35 @@
 			</fileset>
 
 		</path>
+		
+		<path id="test.classpath">
+			<pathelement location="${jsdk}" />
+			<pathelement location="lib" />
+			<fileset dir="lib">
+				<include name="*.jar" />
+				<exclude name="maven-ant-tasks-2.1.0.jar" />
+			</fileset>
+			<fileset dir="lib">
+				<include name="xalan.jar" />
+			</fileset>
+			<fileset dir="lib/lsid_lib">
+				<include name="*.jar" />
+			</fileset>
 
+			<!-- Include geoserver, geotools, et. al. -->
+			<fileset dir="lib/spatial/geoserver/WEB-INF/lib">
+				<include name="*.jar" />
+			</fileset>
+			<pathelement
+				location="lib/spatial/geoserver/WEB-INF/classes" />
+
+			<!-- Include OAI-PMH -->
+			<fileset dir="lib/oaipmh">
+				<include name="*.jar" />
+			</fileset>
+
+		</path>
+
 		<!-- It is less likely you'll need to make any changes from here down,
 			but customization is possible -->
 		<property name="name" value="metacat" />
@@ -1040,7 +1073,7 @@
 			haltonerror="no">
 			<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient" />
 			<classpath>
-				<path refid="compile.classpath" />
+				<path refid="test.classpath" />
 				<fileset dir="${build.dir}">
 					<include name="${name}.jar" />
 					<include name="${name}-client.jar" />
@@ -1071,7 +1104,7 @@
 			haltonerror="no" showoutput="yes">
 			<!--<jvmarg value="-Djava.protocol.handler.pkgs=HTTPClient"/>-->
 			<classpath>
-				<path refid="compile.classpath" />
+				<path refid="test.classpath" />
 				<fileset dir="${build.dir}">
 					<include name="${name}.jar" />
 					<include name="${name}-client.jar" />
Index: test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java
===================================================================
--- test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java	(revision 5310)
+++ test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java	(revision 5311)
@@ -58,7 +58,6 @@
 	}
 
 	private String serialNumber;
-	private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
 
 	/**
 	 * Constructor to build the test
@@ -109,7 +108,7 @@
 		//create random number for docid, so it can void repeat
 		number = Math.random() * 100000;
 		serial = Integer.toString(((new Double(number)).intValue()));
-		logMetacat.debug("serial: " + serial);
+		debug("serial: " + serial);
 		suite.addTest(new MetaCatServletNetTest("testInsertXMLDocument", serial));
 		suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentXMLFormat", serial));
 		suite.addTest(new MetaCatServletNetTest("testUpdateXMLDocument", serial));
@@ -145,7 +144,7 @@
 	}
 
 	/**
-	 * Test the login to neceas succesfully
+	 * Test the login to nceas succesfully
 	 */
 	public void testNCEASLogin() {
 		debug("\nRunning: testNCEASLogin test");
@@ -156,7 +155,7 @@
 	}
 
 	/**
-	 * Test the login to neceas failed
+	 * Test the login to nceas failed
 	 */
 	public void testNCEASLoginFail() {
 		debug("\nRunning: testNCEASLoginFail test");
@@ -184,7 +183,7 @@
 		debug("\nRunning: testInsertXMLDocument test");
 		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
 				+ PropertyService.getProperty("document.accNumSeparator") + "1";
-		logMetacat.debug("insert docid: " + name);
+		debug("insert docid: " + name);
 		String content = "<?xml version=\"1.0\"?>"
 				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
 				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
@@ -195,7 +194,7 @@
 				+ "<permission>all</permission>" + "</allow>" + "<allow>"
 				+ "<principal>public</principal>" + "<permission>read</permission>"
 				+ "</allow>" + "</acl>";
-		logMetacat.debug("xml document: " + content);
+		debug("xml document: " + content);
 		assertTrue(handleXMLDocument(content, name, "insert"));
 
 	}
@@ -208,7 +207,7 @@
 		debug("\nRunning: testInsertInvalidateXMLDocument test");
 		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
 				+ PropertyService.getProperty("document.accNumSeparator") + "1";
-		logMetacat.debug("insert docid: " + name);
+		debug("insert docid: " + name);
 		String content = "<?xml version=\"1.0\"?>"
 				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
 				+ "</identifier>" + "<allow>"
@@ -216,7 +215,7 @@
 				+ "<permission>all</permission>" + "</allow>" + "<allow>"
 				+ "<principal>public</principal>" + "<permission>read</permission>"
 				+ "</allow>" + "</acl>";
-		logMetacat.debug("xml document: " + content);
+		debug("xml document: " + content);
 		assertTrue(handleXMLDocument(content, name, "insert"));
 	}
 
@@ -228,7 +227,7 @@
 		debug("\nRunning: testInsertNonWellFormedXMLDocument test");
 		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
 				+ PropertyService.getProperty("document.accNumSeparator") + "1";
-		logMetacat.debug("insert non well-formed docid: " + name);
+		debug("insert non well-formed docid: " + name);
 		String content = "<?xml version=\"1.0\"?>"
 				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
 				+ "</identifier>" + "<allow>"
@@ -237,7 +236,7 @@
 				+ "<principal>public</principal>" + "<permission>read</permission>"
 				+ "</allow>";
 
-		logMetacat.debug("xml document: " + content);
+		debug("xml document: " + content);
 		assertTrue(!handleXMLDocument(content, name, "insert"));
 	}
 
@@ -281,7 +280,7 @@
 		debug("\nRunning: testUpdateXMLDocument test");
 		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
 				+ PropertyService.getProperty("document.accNumSeparator") + "2";
-		logMetacat.debug("update docid: " + name);
+		debug("update docid: " + name);
 		String content = "<?xml version=\"1.0\"?>"
 				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
 				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
@@ -292,7 +291,7 @@
 				+ "<permission>all</permission>" + "</allow>" + "<allow>"
 				+ "<principal>public</principal>" + "<permission>read</permission>"
 				+ "</allow>" + "</acl>";
-		logMetacat.debug("xml document: " + content);
+		debug("xml document: " + content);
 		assertTrue(handleXMLDocument(content, name, "update"));
 
 	}
@@ -304,8 +303,8 @@
 		debug("\nRunning: testInertDataFile test");
 		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
 				+ PropertyService.getProperty("document.accNumSeparator") + "1";
-		logMetacat.debug("insert data file docid: " + name);
-		logMetacat.debug("insert data file ");
+		debug("insert data file docid: " + name);
+		debug("insert data file ");
 		File hello = new File("test/jones.204.22.xml");
 
 		assertTrue(insertDataFile(name, hello));
@@ -318,9 +317,8 @@
 		debug("\nRunning: testDeleteXMLDocument test");
 		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
 				+ PropertyService.getProperty("document.accNumSeparator") + "2";
-		logMetacat.debug("delete docid: " + name);
+		debug("delete docid: " + name);
 		assertTrue(handleDeleteFile(name));
-
 	}
 
 	/**
@@ -348,7 +346,7 @@
 
 		// Now contact metacat
 		String response = getMetacatString(prop);
-		logMetacat.debug("Login Message: " + response);
+		debug("Login Message: " + response);
 		boolean connected = false;
 		if (response.indexOf("<login>") != -1) {
 			connected = true;
@@ -374,7 +372,7 @@
 		prop.put("qformat", "xml");
 
 		String response = getMetacatString(prop);
-		logMetacat.debug("Logout Message: " + response);
+		debug("Logout Message: " + response);
 		edu.ucsb.nceas.morpho.framework.HttpMessage.setCookie(null);
 
 		if (response.indexOf("<logout>") != -1) {
@@ -432,7 +430,7 @@
 		prop.put("docid", docid);
 
 		String message = getMetacatString(prop);
-		logMetacat.debug("Insert or Update Message: " + message);
+		debug("Insert or Update Message: " + message);
 		if (message.indexOf("<error>") != -1) {//there was an error
 
 			return false;
@@ -453,7 +451,7 @@
 		prop.put("docid", name);
 
 		String message = getMetacatString(prop);
-		logMetacat.debug("Delete Message: " + message);
+		debug("Delete Message: " + message);
 		if (message.indexOf("<error>") != -1) {//there was an error
 
 			return false;
Index: lib/utilities.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/utilities.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/httpclient.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/httpclient.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/web.xml.tomcat5
===================================================================
--- lib/web.xml.tomcat5	(revision 5310)
+++ lib/web.xml.tomcat5	(revision 5311)
@@ -507,14 +507,6 @@
 
 <security-constraint>
 	<web-resource-collection>
-		<web-resource-name>CFG</web-resource-name>
-			<url-pattern>*.cfg</url-pattern>
-	</web-resource-collection>
-	<auth-constraint/>
-</security-constraint>
-
-<security-constraint>
-	<web-resource-collection>
 		<web-resource-name>PROPERTIES</web-resource-name>
 		<url-pattern>*.properties</url-pattern>
 	</web-resource-collection>
Index: lib/style/skins/sanparks/searchWorkflowRun.jsp
===================================================================
--- lib/style/skins/sanparks/searchWorkflowRun.jsp	(revision 5310)
+++ lib/style/skins/sanparks/searchWorkflowRun.jsp	(revision 5311)
@@ -83,9 +83,9 @@
 												<!-- input name="keyword" id="sf-metadata-type1000" value="urn:lsid:localhost:onto:3:1#tpc-workflow-run" type="hidden">
 							           			<input name="metadata-type-searchmode" id="sm-metadata-type1000" value="equals" type="hidden" -->
 <%
-												if (request.getParameter("workflowid") != null) {	
+												if (request.getParameter("workflowlsid") != null) {	
 %>
-								         			<input name="workflow-lsid" id="sf-workflow-id1000" value="<%= request.getParameter("workflowid") %>" type="hidden">
+								         			<input name="workflow-lsid" id="sf-workflow-id1000" value="<%= request.getParameter("workflowlsid") %>" type="hidden">
 							           				<input name="metadata-type-searchmode" id="sm-workflow-id1000" value="starts-with" type="hidden">	
 <%
 												}
@@ -98,8 +98,8 @@
 														<option value="creator">Creator</option>
 														<option value="description">Description</option>
 														<option value="date-executed">Date Executed</option>
-														<option value="workflow-run-id">Workflow Run ID</option>
-														<option value="workflow-lsid">Workflow ID</option>
+														<option value="workflow-run-lsid">Workflow Run LSID</option>
+														<option value="workflow-lsid">Workflow LSID</option>
 														<option value="status">Status</option>
 													</select>    
 							        		
Index: lib/style/skins/sanparks/searchWorkflow.jsp
===================================================================
--- lib/style/skins/sanparks/searchWorkflow.jsp	(revision 5310)
+++ lib/style/skins/sanparks/searchWorkflow.jsp	(revision 5311)
@@ -88,7 +88,7 @@
 														<option value="creator">Creator</option>
 														<option value="description">Description</option>
 														<option value="date-created">Date Created</option>
-														<option value="workflow-id">Workflow ID</option>
+														<option value="workflow-lsid">Workflow LSID</option>
 													</select>         		
 			        								<input class="submit-button" value="Search" type="button" onclick="setWorkflowQueryFormField('tpcSearch');submitFormIntoDiv('<%=SERVLET_URL%>','tpcSearch','workflow-search-results')">
 			        							</div> 
Index: lib/style/skins/sanparks/sanparks-scheduled-jobs.css
===================================================================
--- lib/style/skins/sanparks/sanparks-scheduled-jobs.css	(revision 5310)
+++ lib/style/skins/sanparks/sanparks-scheduled-jobs.css	(revision 5311)
@@ -32,6 +32,8 @@
  **********************************************************************/
 
 .content-section {
+	vertical-align: top;
+	padding-top: 60px;
 }
 
 .content-section-header {
@@ -47,6 +49,12 @@
 	margin:0px 60px 20px 178px;
 }
 
+.content-subsection {
+	vertical-align: top;
+	margin: 0px 0px 0px 20px;
+	width: 825px;
+}
+
 .content-subsection-header {
 	margin: 10px 0px 5px 0px;
 	padding: 0px 0px 0px 0px;
@@ -55,6 +63,19 @@
 	font-weight: bold;
 }
 
+.page-section {
+	margin: 0px 20px 0px 20px;
+	border-spacing: 0px;
+	border-width: 0px;
+	width: 95%;
+	min-width: 900px;
+}
+
+.schedule-section {
+	vertical-align: top;
+	width: 100%;
+}
+
 .from-date-section {
 	display:inline;
 	float: left;
@@ -189,6 +210,7 @@
 
 .col4 {
 	width: 160px;
+	border-right:1px solid #D5D5D5;
 }
 
 .col5 {
Index: lib/style/skins/sanparks/index.jsp
===================================================================
--- lib/style/skins/sanparks/index.jsp	(revision 5310)
+++ lib/style/skins/sanparks/index.jsp	(revision 5311)
@@ -31,6 +31,7 @@
         <title>SANParks - South African National Park Data Repository</title>
         <link rel="stylesheet" href="<%=STYLE_SKINS_URL%>/default/default.css" type="text/css"/>
         <link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/sanparks/sanparks.css"/>
+        <script language="JavaScript" type="text/JavaScript" src="<%=STYLE_SKINS_URL%>/sanparks/searchPathQuery.js"></script>
         <script language="JavaScript" type="text/JavaScript" src="<%=STYLE_SKINS_URL%>/sanparks/sanparks.js"></script>
         <script language="JavaScript" type="text/JavaScript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
     </head>
Index: lib/style/skins/sanparks/scheduleWorkflowRun.jsp
===================================================================
--- lib/style/skins/sanparks/scheduleWorkflowRun.jsp	(revision 5310)
+++ lib/style/skins/sanparks/scheduleWorkflowRun.jsp	(revision 5311)
@@ -41,6 +41,7 @@
     <head>
         <title>Sanparks TPC Report Search</title>
         <link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/sanparks/sanparks.css"/>
+        <link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/sanparks/sanparks-tpc.css"/>
         <link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/sanparks/sanparks-scheduled-jobs.css"/>
         <link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/sanparks/header2.css"/>
         <link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/sanparks/left-nav2.css"/>
@@ -53,112 +54,129 @@
         <script language="JavaScript" type="text/JavaScript" src="<%=STYLE_COMMON_URL%>/ajax-utils.js"></script>
         <script language="JavaScript" type="text/JavaScript" src="<%=STYLE_COMMON_URL%>/scheduleWorkflow.js"></script>
     </head>
-    <body class="main-section" onload="getWorkflowRunSection('<%=SERVLET_URL%>','<%=request.getParameter("workflowid")%>','<%=request.getParameter("workflowname")%>','workflow-run-content')">
-        <jsp:include page="header2.jsp"/>
-        
-        <!-- Main content -->
-        <jsp:include page="left-nav2.jsp"/>
+    <body onload="getWorkflowRunSection('<%=SERVLET_URL%>','<%=request.getParameter("workflowid")%>','<%=request.getParameter("workflowname")%>','workflow-run-content')">
+		<table class="page-section" cellpadding="0" cellspacing="0" border="0">
+        	<tr>
+        		<td>
+        			<jsp:include page="header2.jsp"/>
+        		</td>
+        	</tr>
+			<tr>
+				<td>
+        			<table class="center-content-section" cellpadding="0" cellspacing="0" border="0">
+        				<tr>
+        					<td class="left-nav-section">
+        						<!-- Main content -->
+								<jsp:include page="left-nav2.jsp"/>
+ 							</td>
            
-    	<div class=content-section>  
-    	    <div class="content-subsection" id="workflow-summary-section"> 
+    						<td class="schedule-section">  
+    	    					<div class="content-subsection" id="workflow-summary-section"> 
 <%
-    	    if (! hasSchedulePermissions) {
+    	    						if (! hasSchedulePermissions) {
 %>
-				<div class="warning-header">You have view permissions only for this workflow</div>
+									<div class="warning-header">You have view permissions only for this workflow</div>
 <%
-    	    } 
+    	    						} 
 %>		
-				<div class="content-subsection-header">Workflow Summary</div> 
-    			<div class="form-input-row" id="form-base-row">
-    				<div class="summary-field" id='workflow-name-label' >Name: </div>  
+									<div class="content-subsection-header">Workflow Summary</div> 
+    								<div class="form-input-row" id="form-base-row">
+    									<div class="summary-field" id='workflow-name-label' >Name: </div>  
 <%
-					if (request.getParameter("workflowname") != null) {
+										if (request.getParameter("workflowname") != null) {
 %>
-						<div class="summary-value" id='workflow-name-value' ><%=request.getParameter("workflowname")%></div>
+										<div class="summary-value" id='workflow-name-value' ><%=request.getParameter("workflowname")%></div>
 <%
-					}
+										}
 %>	  
-					<br>
-					<div class="summary-field" id='workflow-lsid-label' >LSID: </div>  
+										<br>
+										<div class="summary-field" id='workflow-lsid-label' >LSID: </div>  
 <%
-					if (request.getParameter("workflowid") != null) {
+										if (request.getParameter("workflowid") != null) {
 %>
-						<div class="summary-value" id='workflow-lsid-value' ><%=request.getParameter("workflowid")%></div>
+										<div class="summary-value" id='workflow-lsid-value' ><%=request.getParameter("workflowid")%></div>
 <%
-    	    			if (hasSchedulePermissions) {
+    	    								if (hasSchedulePermissions) {
 %>
-						(<jsp:text><![CDATA[<a href=./workflowAccess.jsp?workflowid=]]></jsp:text><jsp:expression>request.getParameter("workflowid")</jsp:expression><jsp:text><![CDATA[&workflowname=]]></jsp:text><jsp:expression>request.getParameter("workflowname")</jsp:expression><jsp:text><![CDATA[>Change Access Permissions</a>]]></jsp:text>)
-						
+											(<jsp:text><![CDATA[<a href=./workflowAccess.jsp?workflowid=]]></jsp:text><jsp:expression>request.getParameter("workflowid")</jsp:expression><jsp:text><![CDATA[&workflowname=]]></jsp:text><jsp:expression>request.getParameter("workflowname")</jsp:expression><jsp:text><![CDATA[>Change Access Permissions</a>]]></jsp:text>)						
 <%
-    	    			}
-					}
+    	    								}
+										}
 %>	  
-				</div>
-			</div>
-			<div class="content-subsection" id="schedule-section">   
-    			<div class="content-subsection-header">Schedule Workflow </div> 
-        		<form action="<%=SERVLET_URL%>" name="workflowScheduler" id="workflowScheduler">
-					<input name="qformat" value="sanparks" type="hidden" />
-					<input name="action" value="scheduleWorkflow" type="hidden" />  
-					<input name="forwardto" value="scheduleWorkflowRun.jsp" type="hidden" /> 
+									</div>
+								</div>
+								<div class="content-subsection" id="schedule-section">   
+    								<div class="content-subsection-header">Schedule Workflow </div> 
+        							<form action="<%=SERVLET_URL%>" name="workflowScheduler" id="workflowScheduler">
+										<input name="qformat" value="sanparks" type="hidden" />
+										<input name="action" value="scheduleWorkflow" type="hidden" />  
+										<input name="forwardto" value="scheduleWorkflowRun.jsp" type="hidden" /> 
 <%
-					if (request.getParameter("workflowid") != null) {
+										if (request.getParameter("workflowid") != null) {
 %>
-						<input name='workflowid' value='<%=request.getParameter("workflowid")%>' type='hidden' />
+										<input name='workflowid' value='<%=request.getParameter("workflowid")%>' type='hidden' />
 <%
-					}
-					if (request.getParameter("karid") != null) {
+										}
+										if (request.getParameter("karid") != null) {
 %>
-						<input name='karid' value='<%=request.getParameter("karid")%>' type='hidden' />
+										<input name='karid' value='<%=request.getParameter("karid")%>' type='hidden' />
 <%
-					}
-					if (request.getParameter("workflowname") != null) {
+										}
+										if (request.getParameter("workflowname") != null) {
 %>
-						<input name='workflowname' value='<%=request.getParameter("workflowname")%>' type='hidden' />
+										<input name='workflowname' value='<%=request.getParameter("workflowname")%>' type='hidden' />
 <%
-					}
+										}
 %>	  		 
-					<div class="form-input-row">
-						<div class="field-label" id='start-time-label' >Start Time: </div>  
-						<input class="date-input" name='starttime' id='starttime' /> 
-						<div class="field-suffix"><%= TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT) %> &nbsp;&nbsp;(mm/dd/yyyy hh:mm:ss)</div>
-					</div>
-					<div class="form-input-row">
-						<div class="field-label" id='start-time-label' >End Time: </div>  
-						<input class="date-input" name='endtime' id='endtime' /> 
-						<div class="field-suffix"><%= TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT) %> &nbsp;&nbsp;(mm/dd/yyyy hh:mm:ss)</div>
-					</div>
-					<div class="form-input-row">
-						<div class="field-label" id='interval-label' >Interval: </div>  
-						<input class="int-input" name='intervalvalue' id='intervalvalue' /> 
-						<select class="dropdown-input" name='intervalunit'>
-							<!-- option name="seconds" value="sec">seconds</option -->
-							<!-- option name="minutes" value="min">minutes</option -->
-							<option name="hours" value="hour">hours</option>
-							<option name="days" value="day">days</option>
-							<option name="weeks" value="week">weeks</option>
-							<option name="months" value="mon">months</option>
-						</select>
-					</div>
-					<br> <br>     		
-        			<input class="submit-button" value="Schedule" type="submit"
+										<div class="form-input-row">
+											<div class="field-label" id='start-time-label' >Start Time: </div>  
+											<input class="date-input" name='starttime' id='starttime' /> 
+											<div class="field-suffix"><%= TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT) %> &nbsp;&nbsp;(mm/dd/yyyy hh:mm:ss)</div>
+										</div>
+										<div class="form-input-row">
+											<div class="field-label" id='start-time-label' >End Time: </div>  
+											<input class="date-input" name='endtime' id='endtime' /> 
+											<div class="field-suffix"><%= TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT) %> &nbsp;&nbsp;(mm/dd/yyyy hh:mm:ss)</div>
+										</div>
+										<div class="form-input-row">
+											<div class="field-label" id='interval-label' >Interval: </div>  
+											<input class="int-input" name='intervalvalue' id='intervalvalue' /> 
+											<select class="dropdown-input" name='intervalunit'>
+												<!-- option name="seconds" value="sec">seconds</option -->
+												<!-- option name="minutes" value="min">minutes</option -->
+												<option name="hours" value="hour">hours</option>
+												<option name="days" value="day">days</option>
+												<option name="weeks" value="week">weeks</option>
+												<option name="months" value="mon">months</option>
+											</select>
+										</div>
+										<br> <br>     		
+					        			<input class="submit-button" value="Schedule" type="submit"
 <%
-    	    	if (! hasSchedulePermissions) {
+					    	    		if (! hasSchedulePermissions) {
 %>
-					disabled="disabled"
+											disabled="disabled"
 <%
-    	    	}
+					    	    		}
 %>      			
-        			> 
-        		</form>
-			</div>		
-			<div class="content-subsection" id="workflow-run-section"> 
-				<div class="content-subsection-header">Workflow Run Schedule</div> 
-    			<div class="workflow-run-content" id="workflow-run-content"></div>
-			</div>
-        </div>
-        
-        <!-- Footer Content -->
-        <jsp:include page="footer2.jsp" />
+					        			> 
+        							</form>
+								</div>		
+								<div class="content-subsection" id="workflow-run-section"> 
+									<div class="content-subsection-header">Workflow Run Schedule</div> 
+					    			<div class="workflow-run-content" id="workflow-run-content"></div>
+								</div>
+        					</td>
+        				</tr>
+        				<tr class="footer-content-section">
+			    			<td colspan="3">     
+			        			<!-- Footer Content -->
+			       				<jsp:include page="footer2.jsp" />
+			     			</td>
+			    		</tr>
+        			</table>
+        		</td>
+        	</tr>
+        </table>
     </body>
 </html>
Index: lib/style/skins/kepler/keplerAuthNameSpace.jsp
===================================================================
--- lib/style/skins/kepler/keplerAuthNameSpace.jsp	(nonexistent)
+++ lib/style/skins/kepler/keplerAuthNameSpace.jsp	(revision 5311)
@@ -0,0 +1,111 @@
+<%@ page contentType="text/plain;charset=ISO-8859-1" import="java.io.*" %>
+<% 
+/************************************************
+ * This is an example implementation of a Kepler AuthNamespace web service.
+ * 
+ * The output parameters are
+ *   error, namespace
+ * The optional input parameters are
+ *   username, password, namespace
+ *
+ ************************************
+ * Kepler AuthNamespace Web Service *
+ ************************************
+ *
+ * The namespace that is returned shall always be unique for the given URL regardless of URI input parameters
+ * The file type returned by the webservice shall be text/plain and shall contain the two output parameters
+ *      formatted in accordance with the java.util.Properties specification.
+ *
+ * Optionally a username and password parameter may be supplied to the webservice for authenticating users
+ *      or simply for disallowing robots from accessing the service.
+ * Implementations of the AuthNamespace service may also optionally accept a namespace as an input,
+ *      check to see if that namespace is available, and return it if it is available or return an error if it is not.
+ *
+ ************************************************/
+try {
+	/*
+	 * The authority string should exactly match the URL this service is accessed by.
+	 * This prevents having multiple URLs accessing this same JSP page which would be bad
+	 *   since the namespaces generated by an authority must be unique to that authority.
+	 */
+	String authority = "http://library.kepler-project.org/kepler/style/skins/kepler/keplerAuthNameSpace.jsp";
+	String accessedAuthority = request.getRequestURL().toString();
+	
+	/*
+	 * Get username and password inputs.
+	 */
+	String user = request.getParameter( "username" );
+	String pass = request.getParameter( "password" );
+	
+	/*
+	 * Make sure the URL used to access this service is the correct authority URL.
+	 */
+	if ( accessedAuthority != null && accessedAuthority.equals( authority )) {
+	
+		/* 
+		 * Check to make sure the "kepler" username/password was given
+		 * This will prevent stray robots or users from incrementing namespaces arbitrarily.
+		 */
+		if ( user != null && user.equals("kepler") ) {
+			if ( pass != null && pass.equals("kepler") ) {
+				
+				if ( request.getParameter( "namespace" ) != null ) {
+					// TODO query a database for the requested namespace
+					// print namespace if it is not already taken and insert it into the database
+					// return an error if the namespace has already been reserved
+				} else {
+				
+					/* Store an incrementing integer in a file.
+					 * This approach may fail due to collisions under high load conditions.
+					 * But works fine for this example implementation.
+					 */
+					ServletContext context = session.getServletContext();
+					String fname = "/var/kepler/last_issued_namespace.txt";
+
+					Integer inc = new Integer(0);
+
+					File f = new File( fname );
+					if (f.exists()) {
+					
+						// Read in the previous Integer
+						InputStream is = new FileInputStream(fname);
+						ObjectInput oi = new ObjectInputStream(is);
+						inc = (Integer) oi.readObject();
+						oi.close();
+
+						int i = inc.intValue() + 1;
+						inc = new Integer( i );
+
+					}
+					
+					// Write out the incremented integer (or 0 if the file does not exist)
+					OutputStream os = new FileOutputStream(fname);
+					ObjectOutputStream oos = new ObjectOutputStream(os);
+					oos.writeObject( inc );
+					oos.flush();
+
+					/*
+					 * Print out the incremented Integer as the namespace output
+					 * in java.util.Properties format.
+					 */
+					out.println( "namespace=" + inc + "\n" );
+				}
+				
+			} else {
+				throw new Exception("The specified password is incorrect");
+			}
+		} else {
+			throw new Exception("The specified username is incorrect.");
+		}
+	} else {
+		throw new Exception("The specified authority URL is incorrect.");
+	}
+
+} catch (Exception e) { 
+	
+	/*
+	 * Print out the error in java.util.Properties format.
+	 */
+	out.println( "error=" + e.getMessage() + "\n" );
+} 
+%>
\ No newline at end of file
Index: lib/style/skins/esa/header.jsp
===================================================================
--- lib/style/skins/esa/header.jsp	(revision 5310)
+++ lib/style/skins/esa/header.jsp	(revision 5311)
@@ -26,7 +26,7 @@
 %>
 
 <%
-	String esaHome = SkinPropertyService.getProperty("esa","registryurl");
+	String esaHome = SkinPropertyService.getProperty("esa", "registryurl");
 %>
 
 <%@ include file="../../common/common-settings.jsp"%>
@@ -89,33 +89,33 @@
         	httpRequest.setRequestHeader("Content-Type", "text/xml");
         	var stringToSend = "action=getloggedinuserinfo";
         	httpRequest.onreadystatechange=function() {
-                	if (httpRequest.readyState==4) {
-                        	var response = httpRequest.responseText;
-                        	var login_block = document.getElementById('login_block');
-                        	var submission_block = document.getElementById('submission_block');
-                        	var userSearch = document.getElementById('userSearch');
-                        	var modSearch = document.getElementById('modSearch');
-				login_block.innerHTML="";
-				submission_block.innerHTML="";
-                        	if(response.indexOf("public") > 0){
-					login_block.innerHTML = "<a href='<%=CGI_URL%>/register-dataset.cgi?cfg=esa&stage=loginform' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"Login\",\"\",\"ESAHeaderSlices/RollOvers/LoginR.gif\",1);'><img name='Login' src='ESAHeaderSlices/Login.gif' width='62' height='18' border='0' title='Login' alt='Login'></a>";
-					submission_block.innerHTML = "<a href='<%=CGI_URL%>/register-dataset.cgi?cfg=esa&stage=loginform&submission=true' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"MySubmissions\",\"\",\"ESAHeaderSlices/RollOvers/MySubmissionsR.gif\",1);'><img name='MySubmissions' src='ESAHeaderSlices/MySubmissions.gif' width='114' height='18' border='0' title='My Submissions - Before you can view your submissions you must login.' alt='My Submissions'></a>";
-                        	} else {
-					login_block.innerHTML = "<a href='<%=CGI_URL%>/register-dataset.cgi?cfg=esa&stage=logout' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"Logout\",\"\",\"ESAHeaderSlices/RollOvers/LogoutR.gif\",1);'><img name='Logout' src='ESAHeaderSlices/Logout.gif' width='62' height='18' border='0' title ='Logout' alt='Logout'></a>";
+                if (httpRequest.readyState==4) {
+					var response = httpRequest.responseText;
+					var login_block = document.getElementById('login_block');
+					var submission_block = document.getElementById('submission_block');
+					var userSearch = document.getElementById('userSearch');
+					var modSearch = document.getElementById('modSearch');
+					login_block.innerHTML="";
+					submission_block.innerHTML="";
+					if(response.indexOf("public") > 0) {
+						login_block.innerHTML = "<a href='<%=CGI_URL%>/register-dataset.cgi?cfg=esa&stage=loginform' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"Login\",\"\",\"ESAHeaderSlices/RollOvers/LoginR.gif\",1);'><img name='Login' src='ESAHeaderSlices/Login.gif' width='62' height='18' border='0' title='Login' alt='Login'></a>";
+						submission_block.innerHTML = "<a href='<%=CGI_URL%>/register-dataset.cgi?cfg=esa&stage=loginform&submission=true' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"MySubmissions\",\"\",\"ESAHeaderSlices/RollOvers/MySubmissionsR.gif\",1);'><img name='MySubmissions' src='ESAHeaderSlices/MySubmissions.gif' width='114' height='18' border='0' title='My Submissions - Before you can view your submissions you must login.' alt='My Submissions'></a>";
+					} else {
+						login_block.innerHTML = "<a href='<%=CGI_URL%>/register-dataset.cgi?cfg=esa&stage=logout' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"Logout\",\"\",\"ESAHeaderSlices/RollOvers/LogoutR.gif\",1);'><img name='Logout' src='ESAHeaderSlices/Logout.gif' width='62' height='18' border='0' title ='Logout' alt='Logout'></a>";
 					
-					if(response.indexOf("isModerator") > 0){
-						submission_block.innerHTML = "<a onClick='modSearch.submit()' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"ViewSubmissions\",\"\",\"ESAHeaderSlices/RollOvers/ViewSubmissionsR.gif\",1);'><img name='ViewSubmissions' src='ESAHeaderSlices/ViewSubmissions.gif' width='114' height='18' border='0' title='View Submissions' alt='View Submissions'></a>";
-                                        } else {
-						submission_block.innerHTML = "<a onClick='userSearch.submit()' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"MySubmissions\",\"\",\"ESAHeaderSlices/RollOvers/MySubmissionsR.gif\",1);'><img name='MySubmissions' src='ESAHeaderSlices/MySubmissions.gif' width='114' height='18' border='0' title='My Submissions - Before you can view your submissions you must login.' alt='My Submissions'></a>";
-                                        }
-	                	}
-                	}
-		}
-        	httpRequest.send(stringToSend);
-     	 } catch (e) {
+						if(response.indexOf("isModerator") > 0) {
+							submission_block.innerHTML = "<a onClick='modSearch.submit()' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"ViewSubmissions\",\"\",\"ESAHeaderSlices/RollOvers/ViewSubmissionsR.gif\",1);'><img name='ViewSubmissions' src='ESAHeaderSlices/ViewSubmissions.gif' width='114' height='18' border='0' title='View Submissions' alt='View Submissions'></a>";
+						} else {
+							submission_block.innerHTML = "<a onClick='userSearch.submit()' target='_top' onMouseOut='MM_swapImgRestore();' onMouseOver='MM_swapImage(\"MySubmissions\",\"\",\"ESAHeaderSlices/RollOvers/MySubmissionsR.gif\",1);'><img name='MySubmissions' src='ESAHeaderSlices/MySubmissions.gif' width='114' height='18' border='0' title='My Submissions - Before you can view your submissions you must login.' alt='My Submissions'></a>";
+						}
+					}
+				}
+			}
+			httpRequest.send(stringToSend);
+		} catch (e) {
         	alert("caught an exception: " + e
                  + " \nresponse was: \n" + httpRequest.responseText);
-	 }     
+	}     
 }
 
 //-->
Index: lib/style/common/searchWorkflow.js
===================================================================
--- lib/style/common/searchWorkflow.js	(revision 5310)
+++ lib/style/common/searchWorkflow.js	(revision 5311)
@@ -35,7 +35,7 @@
 function setWorkflowQueryFormField(formId) {
 	var queryString = ""; 
 	queryString += "<pathquery version='1.2'>";
-	queryString += "<returndoctype>entity</returndoctype>";
+	/*queryString += "<returndoctype>entity</returndoctype>";
 	queryString += "<returndoctype>-//UC Berkeley//DTD MoML 1//EN</returndoctype>";
 	queryString += "<returnfield>/entity/@name</returnfield>";
 	queryString += "<returnfield>/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'author\']/configure</returnfield>";
@@ -43,8 +43,16 @@
 	queryString += "<returnfield>/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'createDate\']/configure</returnfield>";
 	queryString += "<returnfield>/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'workflowId\']/configure</returnfield>";
 	queryString += "<returnfield>/entity/property[@name=\'karLSID\']/@value</returnfield>";				
-	queryString += "<returnfield>/entity/property[@name=\'entityId\']/@value</returnfield>";
-	
+	queryString += "<returnfield>/entity/property[@name=\'entityId\']/@value</returnfield>";*/
+	queryString += "<returndoctype>kar</returndoctype>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/entity/@name</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'author\']/configure</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'description\']/configure</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'createDate\']/configure</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/entity/property[@name=\'KeplerDocumentation\']/property[@name=\'workflowId\']/configure</returnfield>";
+  queryString += "<returnfield>/kar/mainAttributes/lsid</returnfield>";       
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/entity/property[@name=\'entityId\']/@value</returnfield>";
+	queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/@class</returnfield>";
 	queryString += "<querygroup operator='INTERSECT'>";	
 	
 	var elementList = document.getElementById(formId).elements;
@@ -86,53 +94,54 @@
 	if (sfElement.name == 'name') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>entity/@name</pathexpr>";
+		/*pathExpr += "<pathexpr>entity/@name</pathexpr>";*/
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/@name</pathexpr>";
 		pathExpr += "</queryterm>"; 		
 	} else if (sfElement.name == 'keyword') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/@value</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/@value</pathexpr>";
 		pathExpr += "</queryterm>"; 		
 	} else if (sfElement.name == 'creator') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
 		pathExpr += "</queryterm>"; 		
 	} else if (sfElement.name == 'description') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
 		pathExpr += "</queryterm>"; 		
 	} else if (sfElement.name == 'date-created') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
 		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'date-executed') {
+	} /*else if (sfElement.name == 'date-executed') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
 		pathExpr += "</queryterm>";		
-	} else if (sfElement.name == 'workflow-id') {
+	} */ else if (sfElement.name == 'workflow-lsid') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>entityId</value>";
-		pathExpr += "<pathexpr>/entity/property/@name</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/@name</pathexpr>";
 		pathExpr += "</queryterm>"; 
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>/entity/property/@value</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/@value</pathexpr>";
 		pathExpr += "</queryterm>";		
-	} else if (sfElement.name == 'workflow-run-id') {
+	}/* else if (sfElement.name == 'workflow-run-id') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
 		pathExpr += "</queryterm>"; 		
 	} else if (sfElement.name == 'status') {
 		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
 		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
+		pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
 		pathExpr += "</queryterm>"; 		
-	} 
+	}*/
 	
 	//alert("returning path expression: " + pathExpr);
 	return pathExpr;
Index: lib/style/common/searchWorkflowResultset.xsl
===================================================================
--- lib/style/common/searchWorkflowResultset.xsl	(revision 5310)
+++ lib/style/common/searchWorkflowResultset.xsl	(revision 5311)
@@ -29,13 +29,15 @@
 	* into an HTML format suitable for rendering with modern web browsers.
 -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
+	
+	<xsl:import href="util.xsl"/>
 	<xsl:output method="html" />
 	<xsl:param name="sessid" />
 	<xsl:param name="qformat">default</xsl:param>
 	<xsl:param name="enableediting">false</xsl:param>
 	<xsl:param name="contextURL"/>
-	
+	<xsl:variable name ="emptyString"/>
+
 	<xsl:template match="/">  
 	
 		<div class="result-header-section">      
@@ -52,8 +54,13 @@
 		<xsl:if test="count(resultset/document) &gt; 0">
 			<xsl:for-each select="resultset/document">
 				<xsl:sort select='./updatedate' order='descending' />
-				<xsl:sort select='./param[@name="/entity/@name"]' />
-				<xsl:if test="./docname = 'entity'">
+				<!--<xsl:sort select='./param[@name="/entity/@name"]' />
+				<xsl:if test="./docname = 'entity'">-->
+				<xsl:sort select='./param[@name="/kar/karEntry/karEntryXML/entity/@name"]' />
+				<xsl:variable name="workflowRunClassName">
+                    <xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/property[@name=&apos;WorkflowRun&apos;]/@class"]'/>
+                </xsl:variable>
+                <xsl:if test="$workflowRunClassName = $emptyString">
 					<div>
 						<xsl:attribute name="class">
 							<xsl:choose>
@@ -61,12 +68,33 @@
 								<xsl:when test="position() mod 2 = 0">row row-even</xsl:when>
 							</xsl:choose>
 						</xsl:attribute>
+						<xsl:variable name="karLSID">
+							<xsl:value-of select='./param[@name="/kar/mainAttributes/lsid"]' />
+						</xsl:variable>
+						<xsl:variable name="karDocid">
+							<xsl:call-template name="extractDocidFromLsid">
+								<xsl:with-param name="lsidString" select="$karLSID" />
+							</xsl:call-template>
+						</xsl:variable>
+						<xsl:variable name="workflowLSID">
+							<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/entity/property[@name=&apos;entityId&apos;]/@value"]'/>
+						</xsl:variable>
+						<xsl:variable name="karXmlDocid">
+                            <xsl:value-of select='./docid'/>
+                        </xsl:variable>
+                        <xsl:variable name="karXmlLSID">
+                            <xsl:call-template name="lsid">
+                                <xsl:with-param name="docid" select="$karXmlDocid" />
+                            </xsl:call-template>
+                        </xsl:variable>
 
 						<div class="col col1">	
-							<xsl:value-of select='./param[@name="/entity/@name"]' />		
+							<!--<xsl:value-of select='./param[@name="/entity/@name"]' />-->
+							<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/entity/@name"]' />		
 						</div>
 						<div class="col col2">	
-							<xsl:value-of select='./param[@name="property[@name=&apos;KeplerDocumentation&apos;]/property[@name=&apos;author&apos;]/configure"]' />		
+							<!--<xsl:value-of select='./param[@name="property[@name=&apos;KeplerDocumentation&apos;]/property[@name=&apos;author&apos;]/configure"]' />-->
+							<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/entity/property[@name=&apos;KeplerDocumentation&apos;]/property[@name=&apos;author&apos;]/configure"]' />		
 						</div>
 						<div class="col col3">	
 							<xsl:value-of select='./updatedate' />			
@@ -74,13 +102,15 @@
 						<div class="col col4">	
 							<a>
 								<xsl:attribute name="class">underlined</xsl:attribute>
-								<xsl:attribute name="href">./searchWorkflowRun.jsp?workflowid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;entityId&apos;]/@value"]' /></xsl:attribute>
+								<!--<xsl:attribute name="href">./searchWorkflowRun.jsp?workflowid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;entityId&apos;]/@value"]' /></xsl:attribute>-->
+								<xsl:attribute name="href">./searchWorkflowRun.jsp?workflowlsid=<xsl:value-of select="$workflowLSID" /></xsl:attribute>
 									 View Runs
 							</a>
 							<span> | </span>
 							<a>
 								<xsl:attribute name="class">underlined</xsl:attribute>
-								<xsl:attribute name="href">./scheduleWorkflowRun.jsp?workflowid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;entityId&apos;]/@value"]' />&amp;karid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;karLSID&apos;]/@value"]' />&amp;workflowname=<xsl:value-of select='./param[@name="/entity/@name"]' /></xsl:attribute>	 
+								<!--<xsl:attribute name="href">./scheduleWorkflowRun.jsp?workflowid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;entityId&apos;]/@value"]' />&amp;karid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;karLSID&apos;]/@value"]' />&amp;workflowname=<xsl:value-of select='./param[@name="/entity/@name"]' /></xsl:attribute>-->
+								<xsl:attribute name="href">./scheduleWorkflowRun.jsp?workflowid=<xsl:value-of select="$karXmlLSID" />&amp;karid=<xsl:value-of select="normalize-space($karLSID)" />&amp;workflowname=<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/entity/@name"]' /></xsl:attribute>	 
 									 Schedule
 							</a> 
 							<span> | </span>
@@ -87,7 +117,8 @@
 							<a>
 								<xsl:attribute name="class">underlined</xsl:attribute>
 								<xsl:attribute name="href">
-									<xsl:value-of select='$contextURL' />/metacat?action=read&amp;docid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;karLSID&apos;]/@value"]' />
+									<!--<xsl:value-of select='$contextURL' />/metacat?action=read&amp;docid=<xsl:value-of select='./param[@name="/entity/property[@name=&apos;karLSID&apos;]/@value"]' />-->
+									<xsl:value-of select='$contextURL' />/metacat?action=read&amp;docid=<xsl:value-of select="$karDocid" />
 								</xsl:attribute>	 
 									 Download
 							</a> 
@@ -97,5 +128,14 @@
 			</xsl:for-each>
 		</xsl:if>
 	</xsl:template>
-
+	
+	<!--************** creates a fake lsid for kar xml file document**************-->
+   <xsl:template name="lsid">
+       <xsl:param name="docid"/>
+       <xsl:variable name="colonString">
+           <xsl:value-of select="translate($docid, '.', ':')" />
+        </xsl:variable>
+       <xsl:variable name="lsidString" select="concat('urn:lsid:','gamma.msi.ucsb.edu/OpenAuth',':',string($colonString))"/>      
+        <xsl:value-of select="$lsidString"/>
+   </xsl:template>
 </xsl:stylesheet>
\ No newline at end of file
Index: lib/style/common/eml_xsl.css
===================================================================
--- lib/style/common/eml_xsl.css	(revision 5310)
+++ lib/style/common/eml_xsl.css	(revision 5311)
@@ -9,7 +9,7 @@
   *     Authors: Matt Jones
   *
   *    '$Author: jones $'
-  *      '$Date: 2009/03/05 18:56:15 $'
+  *      '$Date: 2009-03-05 18:56:15 $'
   *  '$Revision: 1.32 $'
   *
   * This program is free software; you can redistribute it and/or modify
Index: lib/style/common/templates/esaModNotification.tmpl
===================================================================
--- lib/style/common/templates/esaModNotification.tmpl	(revision 5310)
+++ lib/style/common/templates/esaModNotification.tmpl	(revision 5311)
@@ -1,56 +1,130 @@
 [% IF recipient_status == 'moderator' %]
 Ecological Society of America moderator notice:
+
 [% IF stage == 'mod_accept' %]
 
-You have accepted the metadata entry for [% contactName %]'s article, '[% dpTitle %]'.  This part of the article's submission process is now complete.  You can see the metadata entry as it currently stands at [% registryUrl %]?action=read&qformat=esa&docid=[% docid %].  Once published, the entry will be available to the public at the same location.
+You have accepted the metadata entry for: 
+	
+	
+Title: [% dpTitle %]
+	
+Document ID: [% docid %]
+	
+Creator: [% contactName %]  
+	
+	
+This part of the article's submission process is now complete.  
+	
+	
+To view this document, login at [% contextUrl %] and click the View Submissions link.
 
 [% ELSIF stage == 'mod_decline' %]		
 
-You have rejected the metadata entry for [% contactName %]'s article, '[% dpTitle %]'. This entry is no longer being considered for publication. Your comments (if any) on the reason for the rejection are listed below. 
-
+You have rejected the metadata entry for: 
+	
+	
+Title: [% dpTitle %]
+	
+Document ID: [% docid %]
+	
+Creator: [% contactName %]
+	
+	
+This entry is no longer being considered for publication. Your comments 
+(if any) on the reason for the rejection are listed below. 
+	
+	
 Your Comments:
 [% comment %]
 
 [% ELSIF stage == 'mod_revise' %]
 
-You have sent back for review the metadata entry for [% contactName %]'s article, [% dpTitle %].  Your comments on the areas that could be improved are noted below. You can edit the metadata entry as it currently stands at [% registryUrl %]?stage=modify&cfg=esa&docid=[% docid %].
-
+You have sent back for review the metadata entry for: 
+	
+	
+Title: [% dpTitle %]
+	
+Document ID: [% docid %]
+	
+Creator: [% contactName %]
+	
+	
+Your comments on the areas that could be improved are noted below. 
+	
+	
+To view this document, login at [% contextUrl %] and click the View Submissions link.
+	
+	
 Your Comments:
 [% comment %]
 
+[% ELSIF stage == 'confirmed' %]
+[% IF function == 'modified' %]
+The following document has been modified and is awaiting review:
+[% ELSE %]
+The following document has been submitted and is awaiting review:
 [% END %]
+	
+Title: [% dpTitle %]
+	
+[% IF function == 'modified' %]
+Document ID: [% fullDocid %]
+[% ELSE %]
+Document ID: [% docid %]
+[% END %]
+	
+Creator: [% contactName %]
+	
+	
+To review this document, login at [% contextUrl %] and click the View Submissions link.
+
+[% END %]
 [% ELSIF recipient_status == 'user' %]
 [% IF stage == 'mod_accept' %]
 
 Dear [% contactName %],
-
+	
+	
 We are happy to inform you that the metadata entry for your article submission,
 [% dpTitle %], has been accepted.  This part of the submission process is now
-complete.  Your metadata entry can be cited in the future as a LSID (Life Science ID), and will be
-viewable online at [% registryUrl %]?action=read&qformat=esa&docid=[% docid %] after publication.  Thank you for your cooperation.
-
+complete.  
+	
+	
+Your metadata entry can be cited in the future as a LSID (Life Science ID), and will be
+viewable online at [% metacatUrl %]?action=read&qformat=esa&docid=[% docid %] after publication.  
+	
+	
+Thank you for your cooperation.
+	
+	
 The Ecological Society of America
  		
 [% ELSIF stage == 'mod_decline' %]
 
 Dear [% contactName %],
-
+	
+	
 We are sorry to inform you that the metadata entry for your article submission,
 [% dpTitle %], has been rejected.  The comments of your reviewer (if any) may be
 seen at the bottom of this message.  We hope that you will submit more research for
 review in the future.
-
+	
+	
 Sincerely,
-
+	
+	
 The Ecological Society of America
-
+	
+	
 If this metadata entry was not made as part of an article submission to ESA:
-
+	
+	
 This metadata registry is only for entries associated with articles for ESA
 publications.  For those wishing to make public metadata entries not associated with
 ESA, there is a metadata registry available to the greater scientific community at
 http://knb.ecoinformatics.org
-
+	
+	
 Reviewer's Comments:
 [% comment %]
 
@@ -57,18 +131,45 @@
 [% ELSIF stage == 'mod_revise' %]
 
 Dear [% contactName %],
-
+	
+	
 Upon review, we feel that the metadata entry for your article submission,
 [% dpTitle %], is still missing some relevant information.  Please read the
 reviewer's comments below for any suggested additions and changes.  You are strongly
-encouraged to go back and address these issues with your entry.  You can login,
-edit, and resubmit your entry at [% registryUrl %]?stage=modify&cfg=esa&docid=[% docid %]. 
-
+encouraged to go back and address these issues with your entry.  
+	
+	
+To view this document, login at [% contextUrl %] and click the My Submissions link.
+	
+	
 The Ecological Society of America
-
+	
+	
 Reviewer's Notes:
 [% comment %]
+	
+[% ELSIF stage == 'confirmed' %]
+Dear [% contactName %],
 
+The following document has been submitted and is awaiting review:
+		
+Title: [% dpTitle %]
+	
+Document ID: [% docid %]
+	
+Creator: [% contactName %]
+	
+	
+To view and/or edit this document, login at [% contextUrl %] and click the My Submissions link.
+	
+	
+You will be notified by email once this document has been reviewed.
+	
+	
+Sincerely,
+	
+	
+The Ecological Society of America
+	
 [% END %]
 [% END %]
-
Index: lib/style/common/templates/confirmData.tmpl
===================================================================
--- lib/style/common/templates/confirmData.tmpl	(revision 5310)
+++ lib/style/common/templates/confirmData.tmpl	(revision 5311)
@@ -186,7 +186,7 @@
 </table>
 [% END %]
   
-[% IF module.temporal == 'true' %]
+[% IF modules.temporal == 'true' %]
 <hr class="rule">
 <a name="TemporalCoverageOfData"></a>
 <p><span class="sectionnames">TEMPORAL COVERAGE OF DATA</span> 
@@ -198,7 +198,7 @@
 </p>
 [% END %]
 
-[% IF module.spatial == 'true' %]
+[% IF modules.spatial == 'true' %]
 <hr class="rule">
 <a name="SpatialCoverageOfData"></a>
 <p><span class="sectionnames">SPATIAL COVERAGE OF DATA</span> 
Index: lib/style/common/searchWorkflowRun.js
===================================================================
--- lib/style/common/searchWorkflowRun.js	(revision 5310)
+++ lib/style/common/searchWorkflowRun.js	(revision 5311)
@@ -12,7 +12,7 @@
 function setWorkflowQueryFormField(formId) {
 	var queryString = ""; 
 	queryString += "<pathquery version='1.2'>";
-	queryString += "<returndoctype>property</returndoctype>";
+	/*queryString += "<returndoctype>property</returndoctype>";
 	queryString += "<returndoctype>-//UC Berkeley//DTD MoML 1//EN</returndoctype>";
 	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'user\']/@value</returnfield>";
 	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'description\']/@value</returnfield>";
@@ -23,8 +23,19 @@
 	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'pdfReport\']/@value</returnfield>";
 	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'htmlReport\']/@value</returnfield>";
 	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'karLSID\']/@value</returnfield>";
-	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'ReportInstance_pdf\']/@value</returnfield>";
+	queryString += "<returnfield>/property[@class=\'org.kepler.util.WorkflowRun\']/property[@name=\'ReportInstance_pdf\']/@value</returnfield>";*/
 	
+	queryString += "<returndoctype>kar</returndoctype>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/property[@name=\'user\']/@value</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/property[@name=\'description\']/@value</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/property[@name=\'startTime\']/@value</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/property[@name=\'workflowLSID\']/@value</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryAttributes/tpcStatus</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/property[@name=\'workflowName\']/@value</returnfield>";
+  queryString += "<returnfield>/kar/mainAttributes/lsid</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryXML/property[@name=\'WorkflowRun\']/@class</returnfield>";
+  queryString += "<returnfield>/kar/karEntry/karEntryAttributes/Name</returnfield>";
+	
 	queryString += "<querygroup operator='INTERSECT'>";	
 	
 	var elementList = document.getElementById(formId).elements;
@@ -64,63 +75,56 @@
 	
 	var pathExpr = '';
 	if (sfElement.name == 'name') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>entity/@name</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'keyword') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/@value</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'creator') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'description') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'date-created') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'date-executed') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'workflow-id') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'workflow-lsid') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>workflowLSID</value>";
-		pathExpr += "<pathexpr>property/property/@name</pathexpr>";
-		pathExpr += "</queryterm>"; 
-		pathExpr += "<queryterm casesensitive='false' searchmode='starts-with'>";
-		var workflowId = sfElement.value;
-		var lastColonPos = workflowId.lastIndexOf(':');
-		var truncWorkflowId = workflowId.substring(0, lastColonPos);
-		pathExpr += "<value>" + truncWorkflowId + "</value>";
-		pathExpr += "<pathexpr>property/property/@value</pathexpr>";
-		pathExpr += "</queryterm>";		
-	} else if (sfElement.name == 'workflow-run-id') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} else if (sfElement.name == 'status') {
-		pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
-		pathExpr += "<value>" + sfElement.value + "</value>";
-		pathExpr += "<pathexpr>property/property/configure</pathexpr>";
-		pathExpr += "</queryterm>"; 		
-	} 
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    /*pathExpr += "<pathexpr>entity/@name</pathexpr>";*/
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/@name</pathexpr>";
+    pathExpr += "</queryterm>";     
+  } else if (sfElement.name == 'keyword') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/@value</pathexpr>";
+    pathExpr += "</queryterm>";     
+  } else if (sfElement.name == 'creator') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
+    pathExpr += "</queryterm>";     
+  } else if (sfElement.name == 'description') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
+    pathExpr += "</queryterm>";     
+  } else if (sfElement.name == 'date-created') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/property/configure</pathexpr>";
+    pathExpr += "</queryterm>";     
+  } else if (sfElement.name == 'date-executed') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/property/property/@value</pathexpr>";
+    pathExpr += "</queryterm>";   
+  } else if (sfElement.name == 'workflow-lsid') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>entityId</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/@name</pathexpr>";
+    pathExpr += "</queryterm>"; 
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/entity/property/@value</pathexpr>";
+    pathExpr += "</queryterm>";   
+  }else if (sfElement.name == 'workflow-run-lsid') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/property/property/@value</pathexpr>";
+    pathExpr += "</queryterm>";     
+  }else if (sfElement.name == 'status') {
+    pathExpr += "<queryterm casesensitive='false' searchmode='" + searchMode + "'>";
+    pathExpr += "<value>" + sfElement.value + "</value>";
+    pathExpr += "<pathexpr>/kar/karEntry/karEntryXML/property/property/@value</pathexpr>";
+    pathExpr += "</queryterm>";     
+  }
 	
 	//alert("returning path expression: " + pathExpr);
 	return pathExpr;
Index: lib/style/common/searchWorkflowRunResultset.xsl
===================================================================
--- lib/style/common/searchWorkflowRunResultset.xsl	(revision 5310)
+++ lib/style/common/searchWorkflowRunResultset.xsl	(revision 5311)
@@ -29,12 +29,14 @@
 	* into an HTML format suitable for rendering with modern web browsers.
 -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
+	<xsl:import href="util.xsl"/>
 	<xsl:output method="html" />
 	<xsl:param name="sessid" />
 	<xsl:param name="qformat">default</xsl:param>
 	<xsl:param name="enableediting">false</xsl:param>
 	<xsl:param name="contextURL"/>
+	<xsl:variable name ="pdfExtension" select="'.pdf'"/>
+	<xsl:variable name ="emptyString"/>
 	
 	<xsl:template match="/">  
 		<div class="result-header-section">      
@@ -50,40 +52,60 @@
 			if there are not then don't show the query results -->
 		<xsl:if test="count(resultset/document) &gt; 0">
 			<xsl:for-each select="resultset/document">
-				<xsl:sort select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;startTime&apos;]/@value"]' order='descending' />
-				<xsl:sort select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;workflowName&apos;]/@value"]' />
-				<div>
-					<xsl:attribute name="class">
-						<xsl:choose>
+				<xsl:sort select='./param[@name="/kar/karEntry/karEntryXML/property[@name=&apos;WorkflowRun&apos;]/property[@name=&apos;startTime&apos;]/@value"]' order='descending' />
+                <xsl:sort select='./param[@name="/kar/karEntry/karEntryXML/property[@name=&apos;WorkflowRun&apos;]/property[@name=&apos;workflowName&apos;]/@value"]' />
+				<!-- test if the document has the "workflowRun" property. If has, kept this document-->
+				<xsl:variable name="workflowRunClassName">
+					<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/property[@name=&apos;WorkflowRun&apos;]/@class"]'/>
+				</xsl:variable>
+				
+				<xsl:if test="$workflowRunClassName != $emptyString">				
+					<xsl:variable name="karDocid">
+                            <xsl:call-template name="extractDocidFromLsid">
+                                <xsl:with-param name="lsidString" select='./param[@name="/kar/mainAttributes/lsid"]' />
+                            </xsl:call-template>
+					</xsl:variable>
+					<xsl:variable name="pdfFile">
+						<xsl:for-each select='./param[@name="/kar/karEntry/karEntryAttributes/Name"]'>
+							<xsl:variable name="fileName" select='.' />				
+							<xsl:if test="contains($fileName, $pdfExtension)">
+                             <xsl:value-of select="normalize-space($fileName)"/>
+							 </xsl:if>                      
+						</xsl:for-each>
+					</xsl:variable>
+				
+					<div>
+						<xsl:attribute name="class">
+							<xsl:choose>
 							<xsl:when test="position() mod 2 = 1">row row-odd</xsl:when>
 							<xsl:when test="position() mod 2 = 0">row row-even</xsl:when>
-						</xsl:choose>
-					</xsl:attribute>
+							</xsl:choose>
+						</xsl:attribute>
 
-					<div class="col col1">	
-						<xsl:value-of select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;workflowName&apos;]/@value"]' />		
-					</div>
-					<div class="col col2">	
-						<xsl:choose>
-						<xsl:when  test="not(./param[@name=&quot;/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;tpcStatus&apos;]/@value&quot;])" >
+						<div class="col col1">	
+							<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/property[@name=&apos;WorkflowRun&apos;]/property[@name=&apos;workflowName&apos;]/@value"]' />		
+						</div>
+						<div class="col col2">	
+							<xsl:choose>
+							<xsl:when  test="not(./param[@name=&quot;/kar/karEntry/karEntryAttributes/tpcStatus&quot;])" >
 							unknown
-						</xsl:when>
-						<xsl:otherwise>
-							<xsl:value-of select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;tpcStatus&apos;]/@value"]' />	
-						</xsl:otherwise>
-						</xsl:choose>
-					</div>
-					<div class="col col3">	
-						<xsl:value-of select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;startTime&apos;]/@value"]' />		
-					</div>
-					<div class="col col4">	
-						<a>
-							<xsl:attribute name="class">underlined</xsl:attribute>
-							<xsl:attribute name="href">
-								<xsl:value-of select='$contextURL' />/metacat?action=read&amp;docid=<xsl:value-of select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;karLSID&apos;]/@value"]' />&amp;archiveEntryName=<xsl:value-of select='./param[@name="/property[@class=&apos;org.kepler.util.WorkflowRun&apos;]/property[@name=&apos;ReportInstance_pdf&apos;]/@value"]' />
-							</xsl:attribute>
-							PDF
-						</a> 
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:value-of select='./param[@name="/kar/karEntry/karEntryAttributes/tpcStatus"]' />	
+							</xsl:otherwise>
+							</xsl:choose>
+						</div>
+						<div class="col col3">	
+							<xsl:value-of select='./param[@name="/kar/karEntry/karEntryXML/property[@name=&apos;WorkflowRun&apos;]/property[@name=&apos;startTime&apos;]/@value"]' />		
+						</div>
+						<div class="col col4">	
+							<a>
+								<xsl:attribute name="class">underlined</xsl:attribute>
+								<xsl:attribute name="href">
+									<xsl:value-of select='$contextURL' />/metacat?action=read&amp;docid=<xsl:value-of select="$karDocid" />&amp;archiveEntryName=<xsl:value-of select="$pdfFile" />
+								</xsl:attribute>
+								PDF
+							</a> 
 						<!--  | 
 						<a>
 							<xsl:attribute name="class">underlined</xsl:attribute>
@@ -92,10 +114,10 @@
 							</xsl:attribute>
 							HTML
 						</a --> 							 
-					</div>		
-				</div>
+						</div>		
+					</div>
+				</xsl:if>
 			</xsl:for-each>
 		</xsl:if>
 	</xsl:template>
-
 </xsl:stylesheet>
\ No newline at end of file
Index: lib/style/common/widgets/form-fields-widget.js
===================================================================
--- lib/style/common/widgets/form-fields-widget.js	(revision 5310)
+++ lib/style/common/widgets/form-fields-widget.js	(revision 5311)
@@ -101,17 +101,17 @@
 		addSearchSelectionBefore('tpcSearch','Description','description','co|eq|sw|ew','form-base-row');
 	} else if (selectObj.value == "date-executed") {
 		addSearchSelectionBefore('tpcSearch','Date Executed','date-executed','be|af','form-base-row');
-	} else if (selectObj.value == "workflow-run-id") {
-		addSearchSelectionBefore('tpcSearch','Workflow-id','workflow-id','co|eq|sw|ew','form-base-row');
+	} else if (selectObj.value == "workflow-run-lsid") {
+		addSearchSelectionBefore('tpcSearch','Workflow-run-lsid','workflow-run-lsid','co|eq|sw|ew','form-base-row');
 	} else if (selectObj.value == "workflow-lsid") {
-		addSearchSelectionBefore('tpcSearch','Workflow-id','workflow-id','co|eq|sw|ew','form-base-row');
+		addSearchSelectionBefore('tpcSearch','Workflow-lsid','workflow-lsid','co|eq|sw|ew','form-base-row');
 	} else if (selectObj.value == "status") {
 		addSearchSelectionBefore('tpcSearch','Status','Status','is|in','form-base-row');
 	} else if (selectObj.value == "date-created") {
 		addSearchSelectionBefore('tpcSearch','Date Created','date-created','be|af','form-base-row');
-	} else if (selectObj.value == "workflow-id") {
+	} /*else if (selectObj.value == "workflow-id") {
 		addSearchSelectionBefore('tpcSearch','Workflow-id','workflow-id','co|eq|sw|ew','form-base-row');
-	}		
+	}*/	
 }
 
 function addSearchSelectionBefore(formId, inputLabel, inputName,  searchModes, beforeElementId) {
Index: lib/metacat.properties
===================================================================
--- lib/metacat.properties	(revision 5310)
+++ lib/metacat.properties	(revision 5311)
@@ -318,7 +318,7 @@
 #Before Metacat 1.8.1, metacat uses tag RELEASE_EML_2_0_1_UPDATE_6 as eml
 #schema, which accidentily points to wrong version of eml-resource.xsd.
 #If this value is false, metacat will run a class to correct eml201 doucment.
-document.eml201DocumentCorrected=false
+document.eml201DocumentCorrected=true
 document.sitecode=nceas
 document.accNumSeparator=.
 document.accNumPrefix=autogen
Index: src/upgrade-db-to-1.9.2-oracle.sql
===================================================================
--- src/upgrade-db-to-1.9.2-oracle.sql	(revision 5310)
+++ src/upgrade-db-to-1.9.2-oracle.sql	(revision 5311)
@@ -60,5 +60,3 @@
 
 INSERT INTO db_version (version, status, date_created) 
   VALUES ('1.9.2', 1, CURRENT_DATE);
-
-UPDATE db_version SET status=0; 
Index: src/perl/register-dataset.cgi
===================================================================
--- src/perl/register-dataset.cgi	(revision 5310)
+++ src/perl/register-dataset.cgi	(revision 5311)
@@ -1,12 +1,12 @@
 #!/usr/bin/env perl
 #
 #  '$RCSfile$'
-#  Copyright: 2000 Regents of the University of California 
+#  Copyright: 2000 Regents of the University of California
 #
 #   '$Author$'
 #     '$Date$'
-# '$Revision$' 
-# 
+# '$Revision$'
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -43,39 +43,45 @@
 use File::Basename;
 use strict;
 
+#debug("running register-dataset.cgi");
+
 # Global configuration paramters
-my $cgiDir = $ENV{'SCRIPT_FILENAME'};
+my $cgiDir           = $ENV{'SCRIPT_FILENAME'};
 my $workingDirectory = ".";
-if ($cgiDir ne "") {
-    my $workingDirectory = dirname($cgiDir);
+if ( $cgiDir ne "" ) {
+	my $workingDirectory = dirname($cgiDir);
 }
 my $metacatProps = "${workingDirectory}/../WEB-INF/metacat.properties";
-my $properties = new Config::Properties();
-unless (open (METACAT_PROPERTIES, $metacatProps)) {
-    print "Content-type: text/html\n\n";
-    print "Unable to locate Metacat properties. Working directory is set as '$workingDirectory', is this correct?";
-    exit();
+my $properties   = new Config::Properties();
+unless ( open( METACAT_PROPERTIES, $metacatProps ) ) {
+	print "Content-type: text/html\n\n";
+	print
+"Unable to locate Metacat properties. Working directory is set as '$workingDirectory', is this correct?";
+	exit();
 }
 
 $properties->load(*METACAT_PROPERTIES);
 
 # local directory configuration
-my $skinsDir = "${workingDirectory}/../style/skins";
+my $skinsDir     = "${workingDirectory}/../style/skins";
 my $templatesDir = abs_path("${workingDirectory}/../style/common/templates");
-my $tempDir = $properties->getProperty('application.tempDir');
-my $dataDir = $properties->getProperty('application.datafilepath');
+my $tempDir      = $properties->getProperty('application.tempDir');
+my $dataDir      = $properties->getProperty('application.datafilepath');
 
 # url configuration
-my $server = $properties->splitToTree(qr/\./, 'server');
+my $server = $properties->splitToTree( qr/\./, 'server' );
 my $contextUrl = 'http://' . $properties->getProperty('server.name');
-if ($properties->getProperty('server.httpPort') ne '80') {
-    $contextUrl = $contextUrl . ':' . $properties->getProperty('server.httpPort');
+if ( $properties->getProperty('server.httpPort') ne '80' ) {
+	$contextUrl =
+	  $contextUrl . ':' . $properties->getProperty('server.httpPort');
 }
-$contextUrl = $contextUrl . '/' .  $properties->getProperty('application.context');
+$contextUrl =
+  $contextUrl . '/' . $properties->getProperty('application.context');
 
 my $metacatUrl = $contextUrl . "/metacat";
-my $cgiPrefix = "/" . $properties->getProperty('application.context') . "/cgi-bin";
-my $styleSkinsPath = $contextUrl . "/style/skins";
+my $cgiPrefix =
+  "/" . $properties->getProperty('application.context') . "/cgi-bin";
+my $styleSkinsPath  = $contextUrl . "/style/skins";
 my $styleCommonPath = $contextUrl . "/style/common";
 
 my $now = time;
@@ -85,24 +91,28 @@
 
 # Must have a config to use Metacat
 my $skinName = "";
-if (hasContent($FORM::cfg)) {
-    $skinName = $FORM::cfg;
-} elsif (hasContent($ARGV[0])) {
-    $skinName = $ARGV[0];
-} else {
-    debug("No configuration set.");
-    print "Content-type: text/html\n\n";
-    'Registry Error: The registry requires a skin name to continue.';
-    exit();
+if ( hasContent($FORM::cfg) ) {
+	$skinName = $FORM::cfg;
 }
+elsif ( hasContent( $ARGV[0] ) ) {
+	$skinName = $ARGV[0];
+}
+else {
+	debug("No configuration set.");
+	print "Content-type: text/html\n\n";
+	'Registry Error: The registry requires a skin name to continue.';
+	exit();
+}
 
 # Metacat isn't initialized, the registry will fail in strange ways.
-if (!hasContent($metacatUrl)) {
-    debug("No Metacat.");
-    print "Content-type: text/html\n\n";
-    'Registry Error: Metacat is not initialized! Make sure' .
-        ' MetacatUrl is set correctly in ' .  $skinName . '.properties';
-    exit();
+if ( !hasContent($metacatUrl) ) {
+	debug("No Metacat.");
+	print "Content-type: text/html\n\n";
+	'Registry Error: Metacat is not initialized! Make sure'
+	  . ' MetacatUrl is set correctly in '
+	  . $skinName
+	  . '.properties';
+	exit();
 }
 
 # Set up the hash for returning data to the HTML templates
@@ -111,32 +121,33 @@
 my @errorMessages;
 
 my $skinProperties = new Config::Properties();
-if (! hasContent($skinName)) {
-    $error = "Application misconfigured.  Please contact the administrator.";
-    push(@errorMessages, $error);
-} else {
-    my $skinProps = "$skinsDir/$skinName/$skinName.properties";
-    unless (open (SKIN_PROPERTIES, $skinProps)) {
-        print "Content-type: text/html\n\n";
-        print "Unable to locate skin properties at $skinProps.  Is this path correct?";
-        exit();
-    }
-    $skinProperties->load(*SKIN_PROPERTIES);
+if ( !hasContent($skinName) ) {
+	$error = "Application misconfigured.  Please contact the administrator.";
+	push( @errorMessages, $error );
 }
+else {
+	my $skinProps = "$skinsDir/$skinName/$skinName.properties";
+	unless ( open( SKIN_PROPERTIES, $skinProps ) ) {
+		print "Content-type: text/html\n\n";
+		print "Unable to locate skin properties at $skinProps.  Is this path correct?";
+		exit();
+	}
+	$skinProperties->load(*SKIN_PROPERTIES);
+}
 
 # replacements for appconfig values using properties
 my $moderators = $properties->getProperty('auth.moderators');
-my $config = $skinProperties->splitToTree(qr/\./, 'registry.config');
-my $templates = $skinProperties->splitToTree(qr/\./, 'registry.templates');
-my $modules = $skinProperties->splitToTree(qr/\./, 'registry.modules');
-my $required = $skinProperties->splitToTree(qr/\./, 'registry.required');
-my $spatial = $skinProperties->splitToTree(qr/\./, 'registry.spatial');
-my $show = $skinProperties->splitToTree(qr/\./, 'registry.show');
+my $config     = $skinProperties->splitToTree( qr/\./, 'registry.config' );
+my $templates  = $skinProperties->splitToTree( qr/\./, 'registry.templates' );
+my $modules    = $skinProperties->splitToTree( qr/\./, 'registry.modules' );
+my $required   = $skinProperties->splitToTree( qr/\./, 'registry.required' );
+my $spatial    = $skinProperties->splitToTree( qr/\./, 'registry.spatial' );
+my $show       = $skinProperties->splitToTree( qr/\./, 'registry.show' );
 
 # set stderr printing if configured
 my $debug_enabled = $config->{'debug'};
 if ($FORM::debug) {
-    $debug_enabled = $FORM::debug;
+	$debug_enabled = $FORM::debug;
 }
 
 # skin owner credentials
@@ -144,15 +155,15 @@
 my $adminPassword = $config->{'password'};
 
 # contains sender, recipient, admin, mailhost
-my $skinEmail = $skinProperties->splitToTree(qr/\./, 'email');
-my $email = $properties->splitToTree(qr/\./, 'email');
+my $skinEmail = $skinProperties->splitToTree( qr/\./, 'email' );
+my $email = $properties->splitToTree( qr/\./, 'email' );
 
 # override email properties with skin-based ones
 my @emailData = keys(%$email);
 foreach my $d (@emailData) {
-    if (%$skinEmail->{$d}) {
-        $email->{$d} = %$skinEmail->{$d};
-    }
+	if ( %$skinEmail->{$d} ) {
+		$email->{$d} = %$skinEmail->{$d};
+	}
 }
 
 # convert the lat and lon configs into usable data structures
@@ -160,25 +171,26 @@
 my %siteLatDMS;
 my %siteLongDMS;
 
-while (my ($key, $value) = each (%$spatial)) {
-    my ($name, $lon, $lat) = split(/\|/, $value);
-    my ($latd, $latm, $lats, $latdir) = split(/\|/, $lat);
-    my ($lond, $lonm, $lons, $londir) = split(/\|/, $lon);
-    push(@sitelist, $name);
-    $siteLatDMS{$name} = [ $latd, $latm, $lats, $latdir ];
-    $siteLongDMS{$name} = [ $lond, $lonm, $lons, $londir ];
+while ( my ( $key, $value ) = each(%$spatial) ) {
+	my ( $name, $lon, $lat ) = split( /\|/, $value );
+	my ( $latd, $latm, $lats, $latdir ) = split( /\|/, $lat );
+	my ( $lond, $lonm, $lons, $londir ) = split( /\|/, $lon );
+	push( @sitelist, $name );
+	$siteLatDMS{$name}  = [ $latd, $latm, $lats, $latdir ];
+	$siteLongDMS{$name} = [ $lond, $lonm, $lons, $londir ];
 }
 
 # set some configuration options for the template object
 my $ttConfig = {
-             INCLUDE_PATH => $templatesDir,
-             INTERPOLATE  => 0,                    
-             POST_CHOMP   => 1,
-             DEBUG        => 1,
-             };
+	INCLUDE_PATH => $templatesDir,
+	INTERPOLATE  => 0,
+	POST_CHOMP   => 1,
+	DEBUG        => 1,
+};
 
 # create an instance of the template processor
 my $template = Template->new($ttConfig) || die $Template::ERROR, "\n";
+
 #print "Content-type: text/html\n\n";
 #print "Is debug enabled? `$debug_enabled`";
 #use Data::Dumper;
@@ -186,341 +198,468 @@
 #exit;
 # Set up the template information that is common to all forms
 
-$$templateVars{'contextUrl'} = $contextUrl;
-$$templateVars{'styleSkinsPath'} = $styleSkinsPath;
+$$templateVars{'contextUrl'}      = $contextUrl;
+$$templateVars{'styleSkinsPath'}  = $styleSkinsPath;
 $$templateVars{'styleCommonPath'} = $styleCommonPath;
-$$templateVars{'cgiPrefix'} = $cgiPrefix;
-$$templateVars{'metacatUrl'} = $metacatUrl;
-$$templateVars{'cfg'} = $skinName;
-$$templateVars{'email'} = $email;
-$$templateVars{'templates'} = $templates;
-$$templateVars{'required'} = $required;
-$$templateVars{'config'} = $config;
+$$templateVars{'cgiPrefix'}       = $cgiPrefix;
+$$templateVars{'metacatUrl'}      = $metacatUrl;
+$$templateVars{'cfg'}             = $skinName;
+$$templateVars{'email'}           = $email;
+$$templateVars{'templates'}       = $templates;
+$$templateVars{'required'}        = $required;
+$$templateVars{'config'}          = $config;
 
 debug("Initialized -- stage set: $FORM::stage");
 
-# Process the form based on stage parameter. 
-if ($FORM::stage =~ "loginform") {
-    print "Content-type: text/html\n\n";
-    # Send back the login form.....
-    my $session = CGI::Session->load() or die CGI::Session->errstr();
+# Process the form based on stage parameter.
+if ( $FORM::stage =~ "loginform" ) {
+	print "Content-type: text/html\n\n";
 
-    if ($FORM::submission eq 'true') {
-        $$templateVars{'message'} = 'You must login to view your submissions.';
-    }
+	# Send back the login form.....
+	my $session = CGI::Session->load() or die CGI::Session->errstr();
 
-    if (!$session->is_empty) {
-        # session found ... delete the session....
-        $session->delete();
-    }
+	if ( $FORM::submission eq 'true' ) {
+		$$templateVars{'message'} = 'You must login to view your submissions.';
+	}
 
-    $template->process($templates->{'login'}, $templateVars);
-    exit();
-} elsif ($FORM::stage =~ "logout") {
-    handleLogoutRequest();
-    exit();
-} elsif ($FORM::stage =~ "login") {
-    handleLoginRequest();
-    exit();
-} elsif ($FORM::stage =~ "mod_accept") {
-    handleModAccept();
-    exit();
-} elsif ($FORM::stage =~ "mod_decline") {
-    handleModDecline();
-    exit();
-} elsif ($FORM::stage =~ "mod_revise") {
-    handleModRevise();
-    exit();
-} elsif ($FORM::stage =~ "read") {
-    handleRead();
-    exit();
-} elsif ($FORM::stage =~ "review_frame") {
-    handleReviewFrame();
-    exit();
+	if ( !$session->is_empty ) {
+
+		# session found ... delete the session....
+		$session->delete();
+	}
+
+	$template->process( $templates->{'login'}, $templateVars );
+	exit();
 }
+elsif ( $FORM::stage =~ "logout" ) {
+	handleLogoutRequest();
+	exit();
+}
+elsif ( $FORM::stage =~ "login" ) {
+	handleLoginRequest();
+	exit();
+}
+elsif ( $FORM::stage =~ "mod_accept" ) {
+	handleModAccept();
+	exit();
+}
+elsif ( $FORM::stage =~ "mod_decline" ) {
+	handleModDecline();
+	exit();
+}
+elsif ( $FORM::stage =~ "mod_revise" ) {
+	handleModRevise();
+	exit();
+}
+elsif ( $FORM::stage =~ "read" ) {
+	handleRead();
+	exit();
+}
+elsif ( $FORM::stage =~ "review_frame" ) {
+	handleReviewFrame();
+	exit();
+}
 
 print "Content-type: text/html\n\n";
 
-if ($FORM::stage =~ "guide") {
-    # Send back the information on how to fill the form
-    $$templateVars{'section'} = "Guide on How to Complete Registry Entries";
-    $template->process($templates->{'guide'}, $templateVars);
-    exit();
+if ( $FORM::stage =~ "guide" ) {
 
-} elsif ($FORM::stage =~ "insert") {
-    # The user has entered the data. Do data validation and send back data 
-    # to confirm the data that has been entered. 
-    toConfirmData();
-    exit();
+	# Send back the information on how to fill the form
+	$$templateVars{'section'} = "Guide on How to Complete Registry Entries";
+	$template->process( $templates->{'guide'}, $templateVars );
+	exit();
 
-} elsif ($FORM::dataWrong =~ "No, go back to editing" && $FORM::stage =~ "confirmed") {
-    # The user wants to correct the data that he has entered. 
-    # Hence show the data again in entryData form. 
-    confirmDataToReEntryData();
-    exit();
+}
+elsif ( $FORM::stage =~ "insert" ) {
 
-} elsif ($FORM::stage =~ "modify") {
-    # Modification of a file has been requested. 
-    # check if the user is logged in...
-    my $session = CGI::Session->load() or die CGI::Session->errstr();
-    if ($session->is_empty) {
-        # no session found ... redirect to login page template
-        $$templateVars{'message'} = 'You must login to modify your dataset.';
-        $template->process($templates->{'login'}, $templateVars);
-    } else {
-        # Show the form will all the values filled in.
-        my @sortedSites;
-        foreach my $site (sort @sitelist) {
-            push(@sortedSites, $site);
-        }
-        $$templateVars{'siteList'} = \@sortedSites;
-        $$templateVars{'section'} = "Modification Form";
-        my ($foundScope, $id, $rev) = split(/\./, $FORM::docid);
-        if (! $rev) {
-        	my $metacat = Metacat->new($metacatUrl);
-        	my $lastRev = $metacat->getLastRevision($FORM::docid);
-        	$$templateVars{'docid'} = $FORM::docid . "." . $lastRev
-        } else {
-        	$$templateVars{'docid'} = $FORM::docid;
-        }
-        modifyData();
-    }
-    exit();
+	# The user has entered the data. Do data validation and send back data
+	# to confirm the data that has been entered.
+	toConfirmData();
+	exit();
 
-} elsif ($FORM::stage =~ "delete_confirm") {
+}
+elsif ($FORM::dataWrong =~ "No, go back to editing"
+	&& $FORM::stage =~ "confirmed" )
+{
 
-    # Result from deleteData form. 
-    if ($FORM::deleteData =~ "Delete document") {
-        # delete Data
-        deleteData(1);
-        exit();
-    } else {
-        $$templateVars{'status'} = "Cancel";
-        $$templateVars{'function'} = "cancel";
-        $template->process($templates->{'response'}, $templateVars);
-        exit();
-    }
+	# The user wants to correct the data that he has entered.
+	# Hence show the data again in entryData form.
+	confirmDataToReEntryData();
+	exit();
 
-} elsif ($FORM::stage =~ "delete") {
-    # Deletion of a file has been requested. 
-    # Ask for username and password using deleteDataForm
-    $$templateVars{'docid'} = $FORM::docid;
-    $template->process($templates->{'deleteData'}, $templateVars);
-    exit();
+}
+elsif ( $FORM::stage =~ "modify" ) {
+	#debug("in modify stage");
+	# Modification of a file has been requested.
+	# check if the user is logged in...
+	my $session = CGI::Session->load() or die CGI::Session->errstr();
+	if ( $session->is_empty ) {
 
-} elsif ($FORM::stage !~ "confirmed") {
-    # None of the stages have been reached and data is not being confirmed. 
+		# no session found ... redirect to login page template
+		$$templateVars{'message'} = 'You must login to modify your dataset.';
+		$template->process( $templates->{'login'}, $templateVars );
+	}
+	else {
 
-    # check if the user is logged in...
-    my $session = CGI::Session->load() or die CGI::Session->errstr();
-    if ($session->is_empty) {
-        # no session found ... redirect to login page template
-        $$templateVars{'showInstructions'} = 'true';
-        $$templateVars{'message'} = 'You must login to register your dataset.';
-        $template->process($templates->{'login'}, $templateVars);
-    } else {
+		# Show the form will all the values filled in.
+		my @sortedSites;
+		foreach my $site ( sort @sitelist ) {
+			push( @sortedSites, $site );
+		}
+		$$templateVars{'siteList'} = \@sortedSites;
+		$$templateVars{'section'}  = "Modification Form";
+		my ( $foundScope, $id, $rev ) = split( /\./, $FORM::docid );
+		if ( !$rev ) {
+			my $metacat = Metacat->new($metacatUrl);
+			my $lastRev = $metacat->getLastRevision($FORM::docid);
+			$$templateVars{'docid'} = $FORM::docid . "." . $lastRev;
+		}
+		else {
+			$$templateVars{'docid'} = $FORM::docid;
+		}
+		modifyData();
+	}
+	exit();
 
-        # Hence, send back entry form for entry of data.  
-        debug("Sending form");
-        my @sortedSites;
-        foreach my $site (sort @sitelist) {
-            push(@sortedSites, $site);
-        }
+}
+elsif ( $FORM::stage =~ "delete_confirm" ) {
 
-        if ($skinName eq 'nceas') {
-            my $projects = getProjectList($properties);
-            $$templateVars{'projects'} = $projects;
-            $$templateVars{'wg'} = \@FORM::wg;
-        }
+	# Result from deleteData form.
+	if ( $FORM::deleteData =~ "Delete document" ) {
 
-        $$templateVars{'modules'} = $modules;
-        $$templateVars{'required'} = $required;
-        $$templateVars{'templates'} = $templates;
-        $$templateVars{'show'} = $show;
-        $$templateVars{'site'} = $config->{'site'};
+		# delete Data
+		deleteData(1);
+		exit();
+	}
+	else {
+		$$templateVars{'status'}   = "Cancel";
+		$$templateVars{'function'} = "cancel";
+		$template->process( $templates->{'response'}, $templateVars );
+		exit();
+	}
 
-        $$templateVars{'siteList'} = \@sortedSites;
-        $$templateVars{'section'} = "Entry Form";
-        $$templateVars{'docid'} = "";
-        debug("Sending form: ready to process template");
-        $template->process($templates->{'entry'}, $templateVars);
-        debug("Sending form: template processed");
-   }
-   exit();
 }
+elsif ( $FORM::stage =~ "delete" ) {
 
-# Confirm stage has been reached. Enter the data into metacat. 
+	# Deletion of a file has been requested.
+	# Ask for username and password using deleteDataForm
+	$$templateVars{'docid'} = $FORM::docid;
+	$template->process( $templates->{'deleteData'}, $templateVars );
+	exit();
 
+}
+elsif ( $FORM::stage !~ "confirmed" ) {
+
+	# None of the stages have been reached and data is not being confirmed.
+
+	# check if the user is logged in...
+	my $session = CGI::Session->load() or die CGI::Session->errstr();
+	if ( $session->is_empty ) {
+
+		# no session found ... redirect to login page template
+		$$templateVars{'showInstructions'} = 'true';
+		$$templateVars{'message'} = 'You must login to register your dataset.';
+		$template->process( $templates->{'login'}, $templateVars );
+	}
+	else {
+
+		# Hence, send back entry form for entry of data.
+		debug("Sending form");
+		my @sortedSites;
+		foreach my $site ( sort @sitelist ) {
+			push( @sortedSites, $site );
+		}
+
+		if ( $skinName eq 'nceas' ) {
+			my $projects = getProjectList($properties);
+			$$templateVars{'projects'} = $projects;
+			$$templateVars{'wg'}       = \@FORM::wg;
+		}
+
+		$$templateVars{'modules'}   = $modules;
+		$$templateVars{'required'}  = $required;
+		$$templateVars{'templates'} = $templates;
+		$$templateVars{'show'}      = $show;
+		$$templateVars{'site'}      = $config->{'site'};
+
+		$$templateVars{'siteList'} = \@sortedSites;
+		$$templateVars{'section'}  = "Entry Form";
+		$$templateVars{'docid'}    = "";
+		debug("Sending form: ready to process template");
+		$template->process( $templates->{'entry'}, $templateVars );
+		debug("Sending form: template processed");
+	}
+	exit();
+}
+
+# Confirm stage has been reached. Enter the data into metacat.
+
 # Initialize some global vars
-my $latDeg1 = "";
-my $latMin1 = "";
-my $latSec1 = "";
-my $hemisphLat1 = "";
-my $longDeg1 = "";
-my $longMin1 = "";
-my $longSec1 = "";
+my $latDeg1      = "";
+my $latMin1      = "";
+my $latSec1      = "";
+my $hemisphLat1  = "";
+my $longDeg1     = "";
+my $longMin1     = "";
+my $longSec1     = "";
 my $hemisphLong1 = "";
-my $latDeg2 = "";
-my $latMin2 = "";
-my $latSec2 = "";
-my $hemisphLat2 = "";
-my $longDeg2 = "";
-my $longMin2 = "";
-my $longSec2 = "";
+my $latDeg2      = "";
+my $latMin2      = "";
+my $latSec2      = "";
+my $hemisphLat2  = "";
+my $longDeg2     = "";
+my $longMin2     = "";
+my $longSec2     = "";
 my $hemisphLong2 = "";
-my $modUsername = "";
-my $modPassword = "";
+my $modUsername  = "";
+my $modPassword  = "";
 
 # validate the input form parameters
 my $invalidParams;
 
-if (! $error) {
-    $invalidParams = validateParameters(1);
-    if (scalar(@$invalidParams)) {
-        $$templateVars{'status'} = 'failure';
-        $$templateVars{'invalidParams'} = $invalidParams;
-        $error = 1;
-    }
+if ( !$error ) {
+	$invalidParams = validateParameters(1);
+	if ( scalar(@$invalidParams) ) {
+		$$templateVars{'status'}        = 'failure';
+		$$templateVars{'invalidParams'} = $invalidParams;
+		$error                          = 1;
+	}
 }
 
+my $docid;
 
-my $docid;
 # Create a metacat object
 my $metacat = Metacat->new($metacatUrl);
 
-if (! $error) {
-    # Login to metacat
-    my ($username, $password) = getCredentials();
-    my $response = $metacat->login($username, $password);
-    my $errorMessage = "";
+if ( !$error ) {
 
-    # Parameters have been validated and Create the XML document
-    my $xmldoc = createXMLDocument();
-    
-    my $xmldocWithDocID = $xmldoc;
-    my $errorMessage = "";
+	# Login to metacat
+	my ( $username, $password ) = getCredentials();
+	my $response = $metacat->login( $username, $password );
+	my $errorMessage = "";
 
-    if (! $response) {
-        debug("No response from Metacat");
-        push(@errorMessages, $metacat->getMessage());
-        push(@errorMessages, "Failed during login.\n");
-        $$templateVars{'status'} = 'login_failure';
-        $$templateVars{'errorMessages'} = \@errorMessages;
-        $$templateVars{'docid'} = $docid;
-        $$templateVars{'cfg'} = $skinName;
-        $$templateVars{'function'} = "submitted";
-        $$templateVars{'section'} = "Submission Status";
-        $template->process($templates->{'response'}, $templateVars);
-        exit();
-    } else {
+	# Parameters have been validated and Create the XML document
+	my $xmldoc = createXMLDocument();
 
-    if ($config->{'adminIsDocOwner'} eq 'true') {
-        debug("adminIsDocOwner is set.");
-        $response = $metacat->login($adminUsername, $adminPassword);
-        if (! $response) {
-            push(@errorMessages, $metacat->getMessage());
-            push(@errorMessages, "Failed during login for admin.\n");
-            $$templateVars{'status'} = 'login_failure';
-            $$templateVars{'errorMessages'} = \@errorMessages;
-            $$templateVars{'docid'} = $docid;
-            $$templateVars{'cfg'} = $skinName;
-            $$templateVars{'function'} = "submitted";
-            $$templateVars{'section'} = "Submission Status";
-            $template->process($templates->{'response'}, $templateVars);
-            exit();
-        }
-    }
+	my $xmldocWithDocID = $xmldoc;
+	my $errorMessage    = "";
 
-        debug("A");
-        if ($FORM::docid eq "") {
-            debug("B1");
-            # document is being inserted 
-            my $docStatus = "INCOMPLETE";
-            while ($docStatus eq "INCOMPLETE") {
-                $docid = newAccessionNumber($config->{'scope'}, $metacat);
+	if ( !$response ) {
+		debug("No response from Metacat");
+		push( @errorMessages, $metacat->getMessage() );
+		push( @errorMessages, "Failed during login.\n" );
+		$$templateVars{'status'}        = 'login_failure';
+		$$templateVars{'errorMessages'} = \@errorMessages;
+		$$templateVars{'docid'}         = $docid;
+		$$templateVars{'cfg'}           = $skinName;
+		$$templateVars{'function'}      = "submitted";
+		$$templateVars{'section'}       = "Submission Status";
+		$template->process( $templates->{'response'}, $templateVars );
+		exit();
+	}
+	else {
 
-                $xmldocWithDocID =~ s/docid/$docid/;
-                debugDoc($xmldocWithDocID);
-                $docStatus = insertMetadata($xmldocWithDocID, $docid);
-            }
-            debug("B2");
-            if ($docStatus ne "SUCCESS") {
-                debug("NO SUCCESS");
-                debug("Message is: $docStatus");
-                push(@errorMessages, $docStatus);
-            } else {
-                deleteRemovedData();
-            }
+		if ( $config->{'adminIsDocOwner'} eq 'true' ) {
+			debug("adminIsDocOwner is set.");
+			$response = $metacat->login( $adminUsername, $adminPassword );
+			if ( !$response ) {
+				push( @errorMessages, $metacat->getMessage() );
+				push( @errorMessages, "Failed during login for admin.\n" );
+				$$templateVars{'status'}        = 'login_failure';
+				$$templateVars{'errorMessages'} = \@errorMessages;
+				$$templateVars{'docid'}         = $docid;
+				$$templateVars{'cfg'}           = $skinName;
+				$$templateVars{'function'}      = "submitted";
+				$$templateVars{'section'}       = "Submission Status";
+				$template->process( $templates->{'response'}, $templateVars );
+				exit();
+			}
+		}
 
-            debug("B3");
-        } else {
-            debug("M1");
+		debug("A");
+		if ( $FORM::docid eq "" ) {
+			debug("B1");
 
-            # document is being modified
-            $docid = incrementRevision($FORM::docid);
+			# document is being inserted
+			my $docStatus = "INCOMPLETE";
+			while ( $docStatus eq "INCOMPLETE" ) {
+				$docid = newAccessionNumber( $config->{'scope'}, $metacat );
 
-            $xmldoc =~ s/docid/$docid/;
-            debugDoc($xmldoc);
+				$xmldocWithDocID =~ s/docid/$docid/;
+				debugDoc($xmldocWithDocID);
+				$docStatus = insertMetadata( $xmldocWithDocID, $docid );
+			}
+			debug("B2");
+			if ( $docStatus ne "SUCCESS" ) {
+				debug("NO SUCCESS");
+				debug("Message is: $docStatus");
+				push( @errorMessages, $docStatus );
+			}
+			else {
+				deleteRemovedData();
+			}
 
-            my $response = $metacat->update($docid, $xmldoc);
+			debug("B3");
+		}
+		else {
+			debug("M1");
 
-            if (! $response) {
-                push(@errorMessages, $metacat->getMessage());
-                push(@errorMessages, "Failed while updating.\n");  
-            } 
-                     
-            debug("M2, $docid");
-            if (scalar(@errorMessages)) {
-                debug("Errors defined in modify.");
+			# document is being modified
+			$docid = incrementRevision($FORM::docid);
 
-                $$templateVars{'docid'} = $FORM::docid;
-                copyFormToTemplateVars();
-                $$templateVars{'status'} = 'failure';
-                $$templateVars{'errorMessages'} = \@errorMessages;
-                $error = 1;
-            } else {
-                deleteRemovedData();
-                $$templateVars{'docid'} = $docid;
-                $$templateVars{'cfg'} = $skinName;
-            }
+			$xmldoc =~ s/docid/$docid/;
+			debugDoc($xmldoc);
 
-            # Create our HTML response and send it back
-            $$templateVars{'function'} = "modified";
-            $$templateVars{'section'} = "Modification Status";
-            $template->process($templates->{'response'}, $templateVars);
+			my $response = $metacat->update( $docid, $xmldoc );
 
-            exit();
-        }
-    }
+			if ( !$response ) {
+				push( @errorMessages, $metacat->getMessage() );
+				push( @errorMessages, "Failed while updating.\n" );
+			}
+
+			debug("M2, $docid");
+			if ( scalar(@errorMessages) ) {
+				debug("Errors defined in modify.");
+
+				$$templateVars{'docid'} = $FORM::docid;
+				copyFormToTemplateVars();
+				$$templateVars{'status'}        = 'failure';
+				$$templateVars{'errorMessages'} = \@errorMessages;
+				$error                          = 1;
+			}
+			else {
+				deleteRemovedData();
+				$$templateVars{'docid'} = $docid;
+				$$templateVars{'cfg'}   = $skinName;
+			}
+
+			# Create our HTML response and send it back
+			$$templateVars{'function'} = "modified";
+			$$templateVars{'section'}  = "Modification Status";
+			$template->process( $templates->{'response'}, $templateVars );
+
+			# send a notification email to the moderator
+			if ( hasContent($FORM::cfg) && $FORM::cfg eq 'esa' ) {
+				my $title               = "";
+				my $contactEmailAddress = "";
+				my $contactName         = "";
+				my $parser              = XML::LibXML->new();
+				my $parsedDoc           = $parser->parse_string($xmldoc);
+				$FORM::function = 'modified';
+
+				my $findNodes = $parsedDoc->findnodes('//dataset/title');
+				if ( $findNodes->size() > 0 ) {
+
+					# found title
+					my $node = '';
+					foreach $node ( $findNodes->get_nodelist ) {
+						$title = findValue( $node, '../title' );
+					}
+				}
+
+				$findNodes = $parsedDoc->findnodes('//dataset/contact');
+				if ( $findNodes->size() > 0 ) {
+
+					# found contact email address
+					my $node = '';
+					foreach $node ( $findNodes->get_nodelist ) {
+						my $surName =
+						  findValue( $node, 'individualName/surName' );
+						my $givenName =
+						  findValue( $node, 'individualName/givenName' );
+						my $organizationName =
+						  findValue( $node, 'organizationName' );
+
+						if ( $surName ne '' ) {
+							$contactName = $givenName . ' ' . $surName;
+						}
+						else {
+							$contactName = $organizationName;
+						}
+					}
+				}
+
+				$FORM::docid = $docid;
+
+				modSendNotification( $title, $contactEmailAddress, $contactName,
+					"Document $docid modification review pending" );
+			}
+			exit();
+		}
+	}
+
+	if ( hasContent($FORM::cfg) && $FORM::cfg eq 'esa' ) {
+		my $title               = "";
+		my $contactEmailAddress = "";
+		my $contactName         = "";
+		my $parser              = XML::LibXML->new();
+		my $parsedDoc           = $parser->parse_string($xmldoc);
+
+		my $findNodes = $parsedDoc->findnodes('//dataset/title');
+		if ( $findNodes->size() > 0 ) {
+
+			# found title
+			my $node = '';
+			foreach $node ( $findNodes->get_nodelist ) {
+				$title = findValue( $node, '../title' );
+			}
+		}
+
+		$findNodes = $parsedDoc->findnodes('//dataset/contact');
+		if ( $findNodes->size() > 0 ) {
+
+			# found contact email address
+			my $node = '';
+			foreach $node ( $findNodes->get_nodelist ) {
+				$contactEmailAddress = findValue( $node, 'electronicMailAddress' );
+				my $surName   = findValue( $node, 'individualName/surName' );
+				my $givenName = findValue( $node, 'individualName/givenName' );
+				my $organizationName = findValue( $node, 'organizationName' );
+
+				if ( $surName ne '' ) {
+					$contactName = $givenName . ' ' . $surName;
+				}
+				else {
+					$contactName = $organizationName;
+				}
+			}
+		}
+		$FORM::docid = $docid;
+
+		modSendNotification( $title, $contactEmailAddress, $contactName,
+			"Document $docid review pending" );
+	}
 }
 
 debug("C");
 
-if (scalar(@errorMessages)) {
-    debug("ErrorMessages defined.");
-    $$templateVars{'docid'} = $FORM::docid;
-    copyFormToTemplateVars();
-    $$templateVars{'status'} = 'failure';
-    $$templateVars{'errorMessages'} = \@errorMessages;
-    $error = 1;
-} else {
-    $$templateVars{'docid'} = $docid;
-    $$templateVars{'cfg'} = $skinName;
-    # delete the remaining file objects from disk
-    for (my $fileNum = 0; $fileNum <= $FORM::upCount; $fileNum++) {
-        my $fn = 'uploadname_' . $fileNum;
-        if (hasContent(param($fn))) {
-            deleteFile(param($fn));
-        }
-    }
-    
+if ( scalar(@errorMessages) ) {
+	debug("ErrorMessages defined.");
+	$$templateVars{'docid'} = $FORM::docid;
+	copyFormToTemplateVars();
+	$$templateVars{'status'}        = 'failure';
+	$$templateVars{'errorMessages'} = \@errorMessages;
+	$error                          = 1;
 }
+else {
+	$$templateVars{'docid'} = $docid;
+	$$templateVars{'cfg'}   = $skinName;
 
+	# delete the remaining file objects from disk
+	for ( my $fileNum = 0 ; $fileNum <= $FORM::upCount ; $fileNum++ ) {
+		my $fn = 'uploadname_' . $fileNum;
+		if ( hasContent( param($fn) ) ) {
+			deleteFile( param($fn) );
+		}
+	}
+
+}
+
 # Create our HTML response and send it back
 $$templateVars{'function'} = "submitted";
-$$templateVars{'section'} = "Submission Status";
+$$templateVars{'section'}  = "Submission Status";
 
-$template->process($templates->{'response'}, $templateVars);
+$template->process( $templates->{'response'}, $templateVars );
 
 exit();
 
@@ -530,29 +669,31 @@
 #
 ################################################################################
 sub insertMetadata {
-  my $xmldoc = shift;
-  my $docid = shift;
+	my $xmldoc = shift;
+	my $docid  = shift;
 
-  debug("Trying to insert the following document");
-  my $docStatus = "SUCCESS";
-  debug("Starting insert (D1)");
+	debug("Trying to insert the following document");
+	my $docStatus = "SUCCESS";
+	debug("Starting insert (D1)");
 
-  my $response = $metacat->insert($docid, $xmldoc);
-  if (! $response) {
-    debug("Response gotten (D2)");
-    my $errormsg = $metacat->getMessage();i
-    debug("Error is (D3): " . $errormsg);
-    if ($errormsg =~ /is already in use/) {
-        $docStatus = "INCOMPLETE";
-    } elsif ($errormsg =~ /<login>/) {
-        $docStatus = "SUCCESS";
-    } else { 
-        $docStatus = $errormsg;
-    }
-  }
-  debug("Ending insert (D4)");
+	my $response = $metacat->insert( $docid, $xmldoc );
+	if ( !$response ) {
+		debug("Response gotten (D2)");
+		my $errormsg = $metacat->getMessage();
+		i debug( "Error is (D3): " . $errormsg );
+		if ( $errormsg =~ /is already in use/ ) {
+			$docStatus = "INCOMPLETE";
+		}
+		elsif ( $errormsg =~ /<login>/ ) {
+			$docStatus = "SUCCESS";
+		}
+		else {
+			$docStatus = $errormsg;
+		}
+	}
+	debug("Ending insert (D4)");
 
-  return $docStatus;
+	return $docStatus;
 }
 
 ################################################################################
@@ -562,345 +703,410 @@
 #  Also: need to check metacat for max id # used in this scope already
 ################################################################################
 sub newAccessionNumber {
-    my $scope = shift;
-    my $metacat = shift;
-    my $errormsg = 0;
+	my $scope    = shift;
+	my $metacat  = shift;
+	my $errormsg = 0;
 
-    my $docid = $metacat->getLastId($scope);
-    if (!$docid) {
-        $docid = "$scope.1.1";
-        debug("Error in newAccessionNumber: " . $metacat->getMessage());
-    } else {
-        my ($foundScope, $id, $rev) = split(/\./, $docid);
-        $id++;
-        $docid = "$scope.$id.1";
-    }
-    debug("Metcat handed us a new docid: $docid");
-    return $docid;
+	my $docid = $metacat->getLastId($scope);
+	if ( !$docid ) {
+		$docid = "$scope.1.1";
+		debug( "Error in newAccessionNumber: " . $metacat->getMessage() );
+	}
+	else {
+		my ( $foundScope, $id, $rev ) = split( /\./, $docid );
+		$id++;
+		$docid = "$scope.$id.1";
+	}
+	debug("Metcat handed us a new docid: $docid");
+	return $docid;
 }
 
 sub incrementRevision {
-    my $initDocid = shift;
-    my $docid = '';
-    if (!$initDocid) {
-        debug("No docid entered.");
-    } else {
-        my ($scope, $id, $rev) = split(/\./, $initDocid);
-        $rev++;
-        $docid = "$scope.$id.$rev";
-    }
-    return $docid;
+	my $initDocid = shift;
+	my $docid     = '';
+	if ( !$initDocid ) {
+		debug("No docid entered.");
+	}
+	else {
+		my ( $scope, $id, $rev ) = split( /\./, $initDocid );
+		$rev++;
+		$docid = "$scope.$id.$rev";
+	}
+	return $docid;
 }
 
 ################################################################################
-# 
+#
 # Validate the parameters to make sure that required params are provided
 #
 ################################################################################
 sub validateParameters {
-    my $chkUser = shift;
-    my @invalidParams;
+	my $chkUser = shift;
+	my @invalidParams;
 
-    push(@invalidParams, "Name of the Project is not selected in the form.")
-        if (scalar(@FORM::wg) == 0 && $required->{'wgList'} eq 'true');
-    push(@invalidParams, "First name of person entering the form is missing.")
-        unless hasContent($FORM::providerGivenName);
-    push(@invalidParams, "Last name of person entering the form is missing.")
-        unless hasContent($FORM::providerSurName);
-    push(@invalidParams, "Dataset title is missing.")
-        unless hasContent($FORM::title);
-    push(@invalidParams, ucfirst($config->{'site'})." name is missing.")
-        unless ((hasContent($FORM::site) && !($FORM::site =~ /^Select/)) ||
-                $skinName eq "nceas");
-    push(@invalidParams, "First name of principal data set owner is missing.")
-        unless hasContent($FORM::origNamefirst0);
-    push(@invalidParams, "Last name of principal data set owner is missing.")
-        unless hasContent($FORM::origNamelast0);
-    push(@invalidParams, "Dataset abstract is missing.")
-        unless hasContent($FORM::abstract);
-    if ($modules->{'temporal'} eq 'true') {
-        push(@invalidParams, "Year of start date is missing.")
-            unless (hasContent($FORM::beginningYear) || $required->{'temporal'} ne 'true');
-        push(@invalidParams, "Year of stop date has been specified but year of start date is missing.")
-            if ((!hasContent($FORM::beginningYear)) && hasContent($FORM::endingYear));
-    }
-    push(@invalidParams, "Geographic description is missing.")
-        unless (hasContent($FORM::geogdesc) || $required->{'spatial'} ne 'true');
+	push( @invalidParams, "Name of the Project is not selected in the form." )
+	  if ( scalar(@FORM::wg) == 0 && $required->{'wgList'} eq 'true' );
+	push( @invalidParams, "First name of person entering the form is missing." )
+	  unless hasContent($FORM::providerGivenName);
+	push( @invalidParams, "Last name of person entering the form is missing." )
+	  unless hasContent($FORM::providerSurName);
+	push( @invalidParams, "Dataset title is missing." )
+	  unless hasContent($FORM::title);
+	push( @invalidParams, ucfirst( $config->{'site'} ) . " name is missing." )
+	  unless ( ( hasContent($FORM::site) && !( $FORM::site =~ /^Select/ ) )
+		|| $skinName eq "nceas" );
+	push( @invalidParams, "First name of principal data set owner is missing." )
+	  unless hasContent($FORM::origNamefirst0);
+	push( @invalidParams, "Last name of principal data set owner is missing." )
+	  unless hasContent($FORM::origNamelast0);
+	push( @invalidParams, "Dataset abstract is missing." )
+	  unless hasContent($FORM::abstract);
 
-    if ($FORM::beginningMonth eq "MM") {
-        $FORM::beginningMonth = "";
-    }
-    if ($FORM::beginningDay eq "DD") {
-        $FORM::beginningDay = "";
-    }
-    if ($FORM::endingMonth eq "MM") {
-        $FORM::endingMonth = "";
-    }
-    if ($FORM::endingDay eq "DD") {
-        $FORM::endingDay = "";
-    }
+	if ( $modules->{'temporal'} eq 'true' ) {
+		push( @invalidParams, "Year of start date is missing." )
+		  unless ( hasContent($FORM::beginningYear)
+			|| $required->{'temporal'} ne 'true' );
+		push( @invalidParams,
+"Year of stop date has been specified but year of start date is missing."
+		  )
+		  if ( ( !hasContent($FORM::beginningYear) )
+			&& hasContent($FORM::endingYear) );
+	}
+	push( @invalidParams, "Geographic description is missing." )
+	  unless ( hasContent($FORM::geogdesc)
+		|| $required->{'spatial'} ne 'true' );
 
-    if (hasContent($FORM::beginningYear) && !($FORM::beginningYear =~ /[0-9]{4}/)) {
-        push(@invalidParams, "Invalid year of start date specified.")
-    }
+	if ( $FORM::beginningMonth eq "MM" ) {
+		$FORM::beginningMonth = "";
+	}
+	if ( $FORM::beginningDay eq "DD" ) {
+		$FORM::beginningDay = "";
+	}
+	if ( $FORM::endingMonth eq "MM" ) {
+		$FORM::endingMonth = "";
+	}
+	if ( $FORM::endingDay eq "DD" ) {
+		$FORM::endingDay = "";
+	}
 
-    if (hasContent($FORM::endingYear) && !($FORM::endingYear =~ /[0-9]{4}/)) {
-        push(@invalidParams, "Invalid year of stop date specified.")
-    }
+	if ( hasContent($FORM::beginningYear)
+		&& !( $FORM::beginningYear =~ /[0-9]{4}/ ) )
+	{
+		push( @invalidParams, "Invalid year of start date specified." );
+	}
 
-    # If the "use site" coord. box is checked and if the site is in 
-    # the longitude hash ...  && ($siteLatDMS{$FORM::site})
+	if ( hasContent($FORM::endingYear) && !( $FORM::endingYear =~ /[0-9]{4}/ ) )
+	{
+		push( @invalidParams, "Invalid year of stop date specified." );
+	}
 
-    if ($modules->{'spatial'} eq 'true') {
-        if (($FORM::useSiteCoord) && ($siteLatDMS{$FORM::site})) {
-            $latDeg1 = $siteLatDMS{$FORM::site}[0];
-            $latMin1 = $siteLatDMS{$FORM::site}[1];
-            $latSec1 = $siteLatDMS{$FORM::site}[2];
-            $hemisphLat1 = $siteLatDMS{$FORM::site}[3];
-            $longDeg1 = $siteLongDMS{$FORM::site}[0];
-            $longMin1 = $siteLongDMS{$FORM::site}[1];
-            $longSec1 = $siteLongDMS{$FORM::site}[2];
-            $hemisphLong1 = $siteLongDMS{$FORM::site}[3];
-        }  else {
-            $latDeg1 = $FORM::latDeg1;
-            $latMin1 = $FORM::latMin1;
-            $latSec1 = $FORM::latSec1;
-            $hemisphLat1 = $FORM::hemisphLat1;
-            $longDeg1 = $FORM::longDeg1;
-            $longMin1 = $FORM::longMin1;
-            $longSec1 = $FORM::longSec1;
-            $hemisphLong1 = $FORM::hemisphLong1;
-        }
+	# If the "use site" coord. box is checked and if the site is in
+	# the longitude hash ...  && ($siteLatDMS{$FORM::site})
 
-        if ($latDeg1 > 90 || $latDeg1 < 0) {
-            push(@invalidParams, "Invalid first latitude degrees specified.");
-        }
-        if ($latMin1 > 59 || $latMin1 < 0) {
-            push(@invalidParams, "Invalid first latitude minutes specified.");
-        }
-        if ($latSec1 > 59 || $latSec1 < 0) {
-            push(@invalidParams, "Invalid first latitude seconds specified.");
-        }
-        if ($longDeg1 > 180 || $longDeg1 < 0) {
-            push(@invalidParams, "Invalid first longitude degrees specified.");
-        }
-        if ($longMin1 > 59 || $longMin1 < 0) {
-            push(@invalidParams, "Invalid first longitude minutes specified.");
-        }
-        if ($longSec1 > 59 || $longSec1 < 0) {
-            push(@invalidParams, "Invalid first longitude seconds specified.");
-        }
+	if ( $modules->{'spatial'} eq 'true' ) {
+		if ( ($FORM::useSiteCoord) && ( $siteLatDMS{$FORM::site} ) ) {
+			$latDeg1      = $siteLatDMS{$FORM::site}[0];
+			$latMin1      = $siteLatDMS{$FORM::site}[1];
+			$latSec1      = $siteLatDMS{$FORM::site}[2];
+			$hemisphLat1  = $siteLatDMS{$FORM::site}[3];
+			$longDeg1     = $siteLongDMS{$FORM::site}[0];
+			$longMin1     = $siteLongDMS{$FORM::site}[1];
+			$longSec1     = $siteLongDMS{$FORM::site}[2];
+			$hemisphLong1 = $siteLongDMS{$FORM::site}[3];
+		}
+		else {
+			$latDeg1      = $FORM::latDeg1;
+			$latMin1      = $FORM::latMin1;
+			$latSec1      = $FORM::latSec1;
+			$hemisphLat1  = $FORM::hemisphLat1;
+			$longDeg1     = $FORM::longDeg1;
+			$longMin1     = $FORM::longMin1;
+			$longSec1     = $FORM::longSec1;
+			$hemisphLong1 = $FORM::hemisphLong1;
+		}
 
-        if (hasContent($FORM::latDeg2) && ($FORM::latDeg2 > 90 || $FORM::latDeg2 < 0)) {
-            push(@invalidParams, "Invalid second latitude degrees specified.");
-        }
-        if (hasContent($FORM::latMin2) && ($FORM::latMin2 > 59 || $FORM::latMin2 < 0)) {
-            push(@invalidParams, "Invalid second latitude minutes specified.");
-        }
-        if (hasContent($FORM::latSec2) && ($FORM::latSec2 > 59 || $FORM::latSec2 < 0)) {
-            push(@invalidParams, "Invalid second latitude seconds specified.");
-        }
-        if (hasContent($FORM::latDeg2) && ($FORM::longDeg2 > 180 || $FORM::longDeg2 < 0)) {
-            push(@invalidParams, "Invalid second longitude degrees specified.");
-        }
-        if (hasContent($FORM::latMin2) && ($FORM::longMin2 > 59 || $FORM::longMin2 < 0)) {
-            push(@invalidParams, "Invalid second longitude minutes specified.");
-        }
-        if (hasContent($FORM::latSec2) && ($FORM::longSec2 > 59 || $FORM::longSec2 < 0)) {
-            push(@invalidParams, "Invalid second longitude seconds specified.");
-        }
-    }
+		if ( $latDeg1 > 90 || $latDeg1 < 0 ) {
+			push( @invalidParams, "Invalid first latitude degrees specified." );
+		}
+		if ( $latMin1 > 59 || $latMin1 < 0 ) {
+			push( @invalidParams, "Invalid first latitude minutes specified." );
+		}
+		if ( $latSec1 > 59 || $latSec1 < 0 ) {
+			push( @invalidParams, "Invalid first latitude seconds specified." );
+		}
+		if ( $longDeg1 > 180 || $longDeg1 < 0 ) {
+			push( @invalidParams,
+				"Invalid first longitude degrees specified." );
+		}
+		if ( $longMin1 > 59 || $longMin1 < 0 ) {
+			push( @invalidParams,
+				"Invalid first longitude minutes specified." );
+		}
+		if ( $longSec1 > 59 || $longSec1 < 0 ) {
+			push( @invalidParams,
+				"Invalid first longitude seconds specified." );
+		}
 
-    # Check if latDeg1 and longDeg1 has values if useSiteCoord is used. 
-    # This check is required because some of the sites dont have lat 
-    # and long mentioned in the config file. 
+		if ( hasContent($FORM::latDeg2)
+			&& ( $FORM::latDeg2 > 90 || $FORM::latDeg2 < 0 ) )
+		{
+			push( @invalidParams,
+				"Invalid second latitude degrees specified." );
+		}
+		if ( hasContent($FORM::latMin2)
+			&& ( $FORM::latMin2 > 59 || $FORM::latMin2 < 0 ) )
+		{
+			push( @invalidParams,
+				"Invalid second latitude minutes specified." );
+		}
+		if ( hasContent($FORM::latSec2)
+			&& ( $FORM::latSec2 > 59 || $FORM::latSec2 < 0 ) )
+		{
+			push( @invalidParams,
+				"Invalid second latitude seconds specified." );
+		}
+		if ( hasContent($FORM::latDeg2)
+			&& ( $FORM::longDeg2 > 180 || $FORM::longDeg2 < 0 ) )
+		{
+			push( @invalidParams,
+				"Invalid second longitude degrees specified." );
+		}
+		if ( hasContent($FORM::latMin2)
+			&& ( $FORM::longMin2 > 59 || $FORM::longMin2 < 0 ) )
+		{
+			push( @invalidParams,
+				"Invalid second longitude minutes specified." );
+		}
+		if ( hasContent($FORM::latSec2)
+			&& ( $FORM::longSec2 > 59 || $FORM::longSec2 < 0 ) )
+		{
+			push( @invalidParams,
+				"Invalid second longitude seconds specified." );
+		}
+	}
 
+	# Check if latDeg1 and longDeg1 has values if useSiteCoord is used.
+	# This check is required because some of the sites dont have lat
+	# and long mentioned in the config file.
 
-    if ($modules->{'spatial'} eq 'true' && $required->{'spatial'} eq 'true') {
-        if ($FORM::useSiteCoord) {
-            push(@invalidParams, "The Data Registry doesn't have latitude and longitude information for the site that you chose. Please go back and enter the spatial information.")
-                unless(hasContent($latDeg1) && hasContent($longDeg1));
-        } else {
-            push(@invalidParams, "Latitude degrees are missing.")
-                unless (hasContent($latDeg1) || $required->{'spatial'} ne 'true');
-            push(@invalidParams, "Longitude degrees are missing.")
-                unless (hasContent($longDeg1) || $required->{'spatial'} ne 'true');
-        }
-        push(@invalidParams, 
-            "You must provide a geographic description if you provide latitude and longitude information.")
-            if ((hasContent($latDeg1) || (hasContent($longDeg1))) && (!hasContent($FORM::geogdesc)));
-    }
+	if ( $modules->{'spatial'} eq 'true' && $required->{'spatial'} eq 'true' ) {
+		if ($FORM::useSiteCoord) {
+			push( @invalidParams,
+"The Data Registry doesn't have latitude and longitude information for the site that you chose. Please go back and enter the spatial information."
+			) unless ( hasContent($latDeg1) && hasContent($longDeg1) );
+		}
+		else {
+			push( @invalidParams, "Latitude degrees are missing." )
+			  unless ( hasContent($latDeg1)
+				|| $required->{'spatial'} ne 'true' );
+			push( @invalidParams, "Longitude degrees are missing." )
+			  unless ( hasContent($longDeg1)
+				|| $required->{'spatial'} ne 'true' );
+		}
+		push( @invalidParams,
+"You must provide a geographic description if you provide latitude and longitude information."
+		  )
+		  if ( ( hasContent($latDeg1) || ( hasContent($longDeg1) ) )
+			&& ( !hasContent($FORM::geogdesc) ) );
+	}
 
-    if ($modules->{'method'} eq 'true') {
-    push (@invalidParams, 
-        "You must provide a method description if you provide a method title.")
-        if (hasContent($FORM::methodTitle) && (!(scalar(@FORM::methodPara) > 0) 
-            || (! hasContent($FORM::methodPara[0]))));
-    push(@invalidParams, 
-        "You must provide a method description if you provide an extent of study description.")
-        if (hasContent($FORM::studyExtentDescription) && (!(scalar(@FORM::methodPara) > 0) 
-            || (! hasContent($FORM::methodPara[0]))));
-    push(@invalidParams, 
-        "You must provide both an extent of study description and a sampling description, or neither.")
-        if ((hasContent($FORM::studyExtentDescription) && !hasContent($FORM::samplingDescription)) ||
-            (!hasContent($FORM::studyExtentDescription) && hasContent($FORM::samplingDescription)));
-    }
-    
-    if ($modules->{'upload'} eq 'true') {
-        for (my $upNum = 0; $upNum <= $FORM::upCount; $upNum++) {
-            my $upn = "upload_$upNum";
-            if (hasContent(param($upn)) && !grep {$_ eq ("uploadname_$upNum")} @FORM::deletefile) {
-                push(@invalidParams, "Must select a permission for file " . param("uploadname_$upNum"))
-                if (!hasContent(param("uploadperm_$upNum")));
-            }
-        }
-    }
- 
-    push(@invalidParams, "First name of data set contact is missing.")
-    unless (hasContent($FORM::origNamefirstContact) || 
-        $FORM::useOrigAddress);
-    push(@invalidParams, "Last name of data set contact is missing.")
-    unless (hasContent($FORM::origNamelastContact) || 
-        $FORM::useOrigAddress);
-    if ($required->{'contactEmailAddress'} eq 'true') {
-        if ($FORM::useOrigAddress) {
-        push(@invalidParams, "Email address of data set owner is missing. This is required as it will be used as contact email address as specified by you.")
-            unless (hasContent($FORM::origEmail));
-        } else {
-            push(@invalidParams, "Email address of data set contact is missing.")
-                unless (hasContent($FORM::origEmailContact));
-        }
-    }
+	if ( $modules->{'method'} eq 'true' ) {
+		push( @invalidParams,
+"You must provide a method description if you provide a method title."
+		  )
+		  if (
+			hasContent($FORM::methodTitle)
+			&& (  !( scalar(@FORM::methodPara) > 0 )
+				|| ( !hasContent( $FORM::methodPara[0] ) ) )
+		  );
+		push( @invalidParams,
+"You must provide a method description if you provide an extent of study description."
+		  )
+		  if (
+			hasContent($FORM::studyExtentDescription)
+			&& (  !( scalar(@FORM::methodPara) > 0 )
+				|| ( !hasContent( $FORM::methodPara[0] ) ) )
+		  );
+		push( @invalidParams,
+"You must provide both an extent of study description and a sampling description, or neither."
+		  )
+		  if (
+			(
+				hasContent($FORM::studyExtentDescription)
+				&& !hasContent($FORM::samplingDescription)
+			)
+			|| (  !hasContent($FORM::studyExtentDescription)
+				&& hasContent($FORM::samplingDescription) )
+		  );
+	}
 
-    # check required distribution elements
-    push(@invalidParams, "Data medium is required.")
-    unless (hasContent($FORM::dataMedium));
-    if ($FORM::dataMedium eq 'other') {
-        push(@invalidParams, "Must enter custom data medium when 'other' is selected.")
-        unless (hasContent($FORM::dataMediumOther));
-    }
-    push(@invalidParams, "Usage rights are required.")
-    unless (hasContent($FORM::useConstraints));
-    if ($FORM::useConstraints eq 'other') {
-        push(@invalidParams, "Must enter custom usage rights when 'other' is selected.")
-        unless (hasContent($FORM::useConstraintsOther));
-    }
+	if ( $modules->{'upload'} eq 'true' ) {
+		for ( my $upNum = 0 ; $upNum <= $FORM::upCount ; $upNum++ ) {
+			my $upn = "upload_$upNum";
+			if ( hasContent( param($upn) )
+				&& !grep { $_ eq ("uploadname_$upNum") } @FORM::deletefile )
+			{
+				push( @invalidParams,
+					"Must select a permission for file "
+					  . param("uploadname_$upNum") )
+				  if ( !hasContent( param("uploadperm_$upNum") ) );
+			}
+		}
+	}
 
-    return \@invalidParams;
+	push( @invalidParams, "First name of data set contact is missing." )
+	  unless ( hasContent($FORM::origNamefirstContact)
+		|| $FORM::useOrigAddress );
+	push( @invalidParams, "Last name of data set contact is missing." )
+	  unless ( hasContent($FORM::origNamelastContact)
+		|| $FORM::useOrigAddress );
+	if ( $required->{'contactEmailAddress'} eq 'true' ) {
+		if ($FORM::useOrigAddress) {
+			push( @invalidParams,
+"Email address of data set owner is missing. This is required as it will be used as contact email address as specified by you."
+			) unless ( hasContent($FORM::origEmail) );
+		}
+		else {
+			push( @invalidParams,
+				"Email address of data set contact is missing." )
+			  unless ( hasContent($FORM::origEmailContact) );
+		}
+	}
+
+	# check required distribution elements
+	push( @invalidParams, "Data medium is required." )
+	  unless ( hasContent($FORM::dataMedium) );
+	if ( $FORM::dataMedium eq 'other' ) {
+		push( @invalidParams,
+			"Must enter custom data medium when 'other' is selected." )
+		  unless ( hasContent($FORM::dataMediumOther) );
+	}
+	push( @invalidParams, "Usage rights are required." )
+	  unless ( hasContent($FORM::useConstraints) );
+	if ( $FORM::useConstraints eq 'other' ) {
+		push( @invalidParams,
+			"Must enter custom usage rights when 'other' is selected." )
+		  unless ( hasContent($FORM::useConstraintsOther) );
+	}
+
+	return \@invalidParams;
 }
 
 ################################################################################
-# 
+#
 # utility function to determine if a paramter is defined and not an empty string
 #
 ################################################################################
 sub hasContent {
-    my $param = shift;
+	my $param = shift;
 
-    my $paramHasContent;
-    if (!defined($param) || $param eq '') { 
-        $paramHasContent = 0;
-    } else {
-        $paramHasContent = 1;
-    }
-    return $paramHasContent;
+	my $paramHasContent;
+	if ( !defined($param) || $param eq '' ) {
+		$paramHasContent = 0;
+	}
+	else {
+		$paramHasContent = 1;
+	}
+	return $paramHasContent;
 }
 
 ################################################################################
 #
-# Subroutine for replacing characters not recognizable by XML and otherwise. 
+# Subroutine for replacing characters not recognizable by XML and otherwise.
 #
 ################################################################################
-sub normalize{
-    my $val = shift;
+sub normalize {
+	my $val = shift;
 
-    $val =~ s/&/&amp;/g;
+	$val =~ s/&/&amp;/g;
 
-    $val =~ s/</&lt;/g;
-    $val =~ s/>/&gt;/g;
-    $val =~ s/\"/&quot;/g;
-    $val =~ s/%/&#37;/g;   
- 
-    my $returnVal = "";
-    
-    foreach (split(//,$val)) {
-        my $var = unpack "C*", $_; 
+	$val =~ s/</&lt;/g;
+	$val =~ s/>/&gt;/g;
+	$val =~ s/\"/&quot;/g;
+	$val =~ s/%/&#37;/g;
 
-        if ($var < 128 && $var > 31) {
-            $returnVal = $returnVal.$_;
-        } elsif ($var < 32) {
-            if ($var == 10) {
-                $returnVal = $returnVal.$_;
-            }
-            if ($var == 13) {
-                $returnVal = $returnVal.$_;
-            }
-            if ($var == 9) {
-                $returnVal = $returnVal.$_;
-            }
-        } else { 
-            $returnVal=$returnVal.$_;
-        }
-    }
+	my $returnVal = "";
 
-    return $returnVal;
+	foreach ( split( //, $val ) ) {
+		my $var = unpack "C*", $_;
+
+		if ( $var < 128 && $var > 31 ) {
+			$returnVal = $returnVal . $_;
+		}
+		elsif ( $var < 32 ) {
+			if ( $var == 10 ) {
+				$returnVal = $returnVal . $_;
+			}
+			if ( $var == 13 ) {
+				$returnVal = $returnVal . $_;
+			}
+			if ( $var == 9 ) {
+				$returnVal = $returnVal . $_;
+			}
+		}
+		else {
+			$returnVal = $returnVal . $_;
+		}
+	}
+
+	return $returnVal;
 }
 
-
 ################################################################################
 #
-# Subroutine for replacing characters not recognizable by XML and otherwise 
+# Subroutine for replacing characters not recognizable by XML and otherwise
 # except for ", > amd <.
 #
 ################################################################################
-sub delNormalize{
-    my $val = shift;
+sub delNormalize {
+	my $val = shift;
 
-    $val =~ s/&/&amp;/g;
+	$val =~ s/&/&amp;/g;
 
-    $val =~ s/%/&#37;/g;
+	$val =~ s/%/&#37;/g;
 
-    my $returnVal = "";
+	my $returnVal = "";
 
-    foreach (split(//,$val)) {
-        my $var = unpack "C*", $_;
+	foreach ( split( //, $val ) ) {
+		my $var = unpack "C*", $_;
 
-        if($var < 128 && $var > 31) {
-            $returnVal=$returnVal.$_;
-        } elsif ($var < 32) {
-            if($var == 10) {
-                $returnVal=$returnVal.$_;
-            }
-            if ($var == 13) {
-                $returnVal=$returnVal.$_;
-            }
-            if ($var == 9) {
-                $returnVal=$returnVal.$_;
-            }
-        } else {
-            $returnVal=$returnVal."&#".$var.";";
-        }
-    }
+		if ( $var < 128 && $var > 31 ) {
+			$returnVal = $returnVal . $_;
+		}
+		elsif ( $var < 32 ) {
+			if ( $var == 10 ) {
+				$returnVal = $returnVal . $_;
+			}
+			if ( $var == 13 ) {
+				$returnVal = $returnVal . $_;
+			}
+			if ( $var == 9 ) {
+				$returnVal = $returnVal . $_;
+			}
+		}
+		else {
+			$returnVal = $returnVal . "&#" . $var . ";";
+		}
+	}
 
-    $returnVal =~ s/&/%26/g;
-    return $returnVal;
+	$returnVal =~ s/&/%26/g;
+	return $returnVal;
 }
 
-
 ################################################################################
 #
-# Subroutine for replacing characters that might create problem in HTML. 
-# Specifically written for " being used in any text field. This creates a 
-# problem in confirmData template, when you specify input name value pair 
-# with value having a " in it.  
+# Subroutine for replacing characters that might create problem in HTML.
+# Specifically written for " being used in any text field. This creates a
+# problem in confirmData template, when you specify input name value pair
+# with value having a " in it.
 #
 ################################################################################
-sub normalizeCD{
-    my $val = shift;
+sub normalizeCD {
+	my $val = shift;
 
-    $val =~ s/\"/&quot;/g;
-    
-    return $val;
+	$val =~ s/\"/&quot;/g;
+
+	return $val;
 }
 
 ################################################################################
@@ -909,390 +1115,428 @@
 #
 ################################################################################
 sub allFileData {
-    my %uploadedFiles = ();
-    my $fileInfo;
-    my $docid;
+	my %uploadedFiles = ();
+	my $fileInfo;
+	my $docid;
 
-    for (my $fileNum = 0; $fileNum <= $FORM::upCount; $fileNum++) {
-        my $fn = 'upload_' . $fileNum;
-        if (hasContent(param($fn))) {
-            # ignore data which is scheduled for deletion
-            if (grep {$_ eq ("uploadname_$fileNum")} @FORM::deletefile) {
-                debug("Not generating metadata for file scheduled for deletion: $fn");
-            } else {
-                debug("Retrieving metadata for file: $fn");
-                ($docid, $fileInfo) = fileMetadata($fileNum);
-                $uploadedFiles{ $docid } = $fileInfo;
-            }
-        }
-    }
+	for ( my $fileNum = 0 ; $fileNum <= $FORM::upCount ; $fileNum++ ) {
+		my $fn = 'upload_' . $fileNum;
+		if ( hasContent( param($fn) ) ) {
 
-    return %uploadedFiles;
+			# ignore data which is scheduled for deletion
+			if ( grep { $_ eq ("uploadname_$fileNum") } @FORM::deletefile ) {
+				debug(
+"Not generating metadata for file scheduled for deletion: $fn"
+				);
+			}
+			else {
+				debug("Retrieving metadata for file: $fn");
+				( $docid, $fileInfo ) = fileMetadata($fileNum);
+				$uploadedFiles{$docid} = $fileInfo;
+			}
+		}
+	}
+
+	return %uploadedFiles;
 }
 
 sub fileMetadata {
-    my $fileNum = shift;
-    my $fileHash = param("upload_$fileNum");
-    my $fileName = param("uploadname_$fileNum");
-    my $contentType = param("uploadtype_$fileNum");
-    my $filePerm = param("uploadperm_$fileNum");
-    my $docid;
-    my $outFile;
-    my $cleanName = $fileName;
+	my $fileNum     = shift;
+	my $fileHash    = param("upload_$fileNum");
+	my $fileName    = param("uploadname_$fileNum");
+	my $contentType = param("uploadtype_$fileNum");
+	my $filePerm    = param("uploadperm_$fileNum");
+	my $docid;
+	my $outFile;
+	my $cleanName = $fileName;
 
-    # process an _existing_ data file, which is already within Metacat.
-    if ($fileHash =~ /ondisk/) {
-        ($docid, $fileHash) = datafileInfo($fileHash);
-        $outFile = $dataDir . "/" . $docid;
-    } else {
-        # normalize input filenames; Windows filenames include full paths
-        $cleanName =~ s/.*[\/\\](.*)/$1/;
-        $outFile = $tempDir . "/" . $cleanName;
-    } 
-    debug("Reading file from disk: $outFile");
+	# process an _existing_ data file, which is already within Metacat.
+	if ( $fileHash =~ /ondisk/ ) {
+		( $docid, $fileHash ) = datafileInfo($fileHash);
+		$outFile = $dataDir . "/" . $docid;
+	}
+	else {
 
-    my $fileSize = stat($outFile)->size;
-    if ($fileSize == 0) {
-        push(@errorMessages, "file $fileName is zero bytes!");
-        debug("File $fileName is zero bytes!");
-    }
+		# normalize input filenames; Windows filenames include full paths
+		$cleanName =~ s/.*[\/\\](.*)/$1/;
+		$outFile = $tempDir . "/" . $cleanName;
+	}
+	debug("Reading file from disk: $outFile");
 
-    # Now the file is on disk, send the object to Metacat
-    my $session = CGI::Session->load();
-    if ($session->is_empty) {
-        push(@errorMessages, "Must be logged in to upload files.");
-        debug("Not logged in, cannot upload files.");
-        return 0;
-    }
+	my $fileSize = stat($outFile)->size;
+	if ( $fileSize == 0 ) {
+		push( @errorMessages, "file $fileName is zero bytes!" );
+		debug("File $fileName is zero bytes!");
+	}
 
-    if (!$docid) {
-        $docid = newAccessionNumber($config->{'scope'}, $metacat);
-        my $uploadReturn = uploadData($outFile, $docid);
-        if (!$uploadReturn) {
-            debug("Uploading the data failed.");
-        }
-    }
-    my $entityid = $fileHash."001";
-    my $distribid = $fileHash."002";
+	# Now the file is on disk, send the object to Metacat
+	my $session = CGI::Session->load();
+	if ( $session->is_empty ) {
+		push( @errorMessages, "Must be logged in to upload files." );
+		debug("Not logged in, cannot upload files.");
+		return 0;
+	}
 
-    my $uploadUrl = 'ecogrid://knb/' . $docid;
-    # TODO:  should match the object promotion path, so that an
-    #        Excel upload results in 'dataTable' in this field
-    my $entityType = 'Other';
+	if ( !$docid ) {
+		$docid = newAccessionNumber( $config->{'scope'}, $metacat );
+		my $uploadReturn = uploadData( $outFile, $docid );
+		if ( !$uploadReturn ) {
+			debug("Uploading the data failed.");
+		}
+	}
+	my $entityid  = $fileHash . "001";
+	my $distribid = $fileHash . "002";
 
-    my %dataInfo = (  'docid'       => $docid,
-                      'entityid'    => $entityid,
-                      'distribid'   => $distribid,
-                      'fileName'    => $cleanName,
-                      'fileSize'    => $fileSize,
-                      'fileHash'    => $fileHash,
-                      'filePerm'    => $filePerm,
-                      'contentType' => $contentType,
-                      'url'         => $uploadUrl,
-                      'entityType'  => $entityType,
-                   );
+	my $uploadUrl = 'ecogrid://knb/' . $docid;
 
-    return ($docid, \%dataInfo);
+	# TODO:  should match the object promotion path, so that an
+	#        Excel upload results in 'dataTable' in this field
+	my $entityType = 'Other';
+
+	my %dataInfo = (
+		'docid'       => $docid,
+		'entityid'    => $entityid,
+		'distribid'   => $distribid,
+		'fileName'    => $cleanName,
+		'fileSize'    => $fileSize,
+		'fileHash'    => $fileHash,
+		'filePerm'    => $filePerm,
+		'contentType' => $contentType,
+		'url'         => $uploadUrl,
+		'entityType'  => $entityType,
+	);
+
+	return ( $docid, \%dataInfo );
 }
 
 sub datafileInfo {
-    my $finfo = shift;
-    $finfo =~ s/ondisk://g;
-    return my ($docid, $fileHash) = split (":", $finfo);
+	my $finfo = shift;
+	$finfo =~ s/ondisk://g;
+	return my ( $docid, $fileHash ) = split( ":", $finfo );
 }
 
 sub processFile {
-    my $fileName = shift;
+	my $fileName = shift;
 
-    # test that we actually got a file
-    if(!$fileName || cgi_error()) {
-        debug("Error receiving file ". cgi_error());
-    }
-   
-    # write file to disk, get SHA1 hash and size
-    my ($outFile, $fileHash) = writeFile($fileName);
+	# test that we actually got a file
+	if ( !$fileName || cgi_error() ) {
+		debug( "Error receiving file " . cgi_error() );
+	}
 
-    my $fileSize = stat($outFile)->size;
-    if ($fileSize == 0) {
-        push(@errorMessages, "file $fileName is zero bytes!");
-        debug("File $fileName is zero bytes!");
-    }
+	# write file to disk, get SHA1 hash and size
+	my ( $outFile, $fileHash ) = writeFile($fileName);
 
-    # file is in Metacat, generate the pertinent EML elements
-    my $contentType = uploadInfo($fileName)->{'Content-Type'};
-    # occasionally CGI.pm doesn't get the file info.  In this case,
-    # use a default MIME type of text/plain.  Seems fixed in the newer CGI.pm:
-    # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313141
-    if (!$contentType) {
-        $contentType = 'text/plain';
-    }
+	my $fileSize = stat($outFile)->size;
+	if ( $fileSize == 0 ) {
+		push( @errorMessages, "file $fileName is zero bytes!" );
+		debug("File $fileName is zero bytes!");
+	}
 
-    my %dataInfo = ( 'fileName'    => $fileName,
-                     'fileHash'    => $fileHash,
-                     'contentType' => $contentType,
-                   );
+	# file is in Metacat, generate the pertinent EML elements
+	my $contentType = uploadInfo($fileName)->{'Content-Type'};
 
-    return \%dataInfo;
+	# occasionally CGI.pm doesn't get the file info.  In this case,
+	# use a default MIME type of text/plain.  Seems fixed in the newer CGI.pm:
+	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313141
+	if ( !$contentType ) {
+		$contentType = 'text/plain';
+	}
+
+	my %dataInfo = (
+		'fileName'    => $fileName,
+		'fileHash'    => $fileHash,
+		'contentType' => $contentType,
+	);
+
+	return \%dataInfo;
 }
 
 sub writeFile {
-    my $fileName = shift;
-    my $fileData;
-    my $length = 0;
-    my $buffer;
+	my $fileName = shift;
+	my $fileData;
+	my $length = 0;
+	my $buffer;
 
-    my $cleanName = $fileName;
+	my $cleanName = $fileName;
 
-    # normalize input filenames; Windows filenames include full paths
-    $cleanName =~ s/.*[\/\\](.*)/$1/;
+	# normalize input filenames; Windows filenames include full paths
+	$cleanName =~ s/.*[\/\\](.*)/$1/;
 
-    while (my $bytesRead = read($fileName, $buffer, 4096)) {
-        $fileData .= $buffer;
-        $length += $bytesRead;
-    }
+	while ( my $bytesRead = read( $fileName, $buffer, 4096 ) ) {
+		$fileData .= $buffer;
+		$length += $bytesRead;
+	}
 
-    # create SHA1 sum to store file hash
-    my $ctx = Digest::SHA1->new;
-    $ctx->add($fileData);
-    my $digest = $ctx->hexdigest;
+	# create SHA1 sum to store file hash
+	my $ctx = Digest::SHA1->new;
+	$ctx->add($fileData);
+	my $digest = $ctx->hexdigest;
 
-    my $outputName = $tempDir . "/" . $cleanName;
-    open(OUT,">$outputName") or die "Could not open: $!";
-    print OUT $fileData;
-    close(OUT);
-    debug("Writing output, result is: $outputName");
+	my $outputName = $tempDir . "/" . $cleanName;
+	open( OUT, ">$outputName" ) or die "Could not open: $!";
+	print OUT $fileData;
+	close(OUT);
+	debug("Writing output, result is: $outputName");
 
-    return ($outputName, $digest);
+	return ( $outputName, $digest );
 }
 
 sub deleteRemovedData {
-    # if we have any associated datafiles which are scheduled for deletion, remove them now
-    for (my $delNum = 0; $delNum <= $FORM::delCount; $delNum++) {
-        # need to look up the actual upload number, which is contained in the name
-        my $upNum = param("deletefile_$delNum");
-        $upNum =~ s/uploadname_//;
-        my $upn = param("upload_$upNum");
-        if (hasContent($upn)) {
-            debug("Deleting upload_$upNum, $upn");
-            if (grep {$_ eq ("uploadname_$upNum")} @FORM::deletefile) {
-                if (param("upload_$upNum") =~ /ondisk/) {
-                    debug("got a file which is ondisk, proceeding with deletion");
-                    deleteFileData(param("upload_$upNum"));
-                } else {
-                    debug("got an old reference, not yet in EML, remove from tempdir");
-                    deleteFile(param("uploadname_$upNum"));
-                }
-            } else {
-                debug("Name didn't match in deletefile list");
-            }
-        }
-    }
+
+# if we have any associated datafiles which are scheduled for deletion, remove them now
+	for ( my $delNum = 0 ; $delNum <= $FORM::delCount ; $delNum++ ) {
+
+	  # need to look up the actual upload number, which is contained in the name
+		my $upNum = param("deletefile_$delNum");
+		$upNum =~ s/uploadname_//;
+		my $upn = param("upload_$upNum");
+		if ( hasContent($upn) ) {
+			debug("Deleting upload_$upNum, $upn");
+			if ( grep { $_ eq ("uploadname_$upNum") } @FORM::deletefile ) {
+				if ( param("upload_$upNum") =~ /ondisk/ ) {
+					debug(
+						"got a file which is ondisk, proceeding with deletion");
+					deleteFileData( param("upload_$upNum") );
+				}
+				else {
+					debug(
+"got an old reference, not yet in EML, remove from tempdir"
+					);
+					deleteFile( param("uploadname_$upNum") );
+				}
+			}
+			else {
+				debug("Name didn't match in deletefile list");
+			}
+		}
+	}
 }
 
 sub deleteFile {
-    my $input = shift;
-    my $fileName = $tempDir . "/" . $input;
+	my $input    = shift;
+	my $fileName = $tempDir . "/" . $input;
 
-    if (-e $fileName) {
-        unlink $fileName or
-            debug("Failed to delete file $fileName.");
-    } else {
-        debug("Unable to find file $fileName");
-    }
-    if (!-e $fileName) {
-        debug("Successfully deleted $fileName");
-    }
+	if ( -e $fileName ) {
+		unlink $fileName
+		  or debug("Failed to delete file $fileName.");
+	}
+	else {
+		debug("Unable to find file $fileName");
+	}
+	if ( !-e $fileName ) {
+		debug("Successfully deleted $fileName");
+	}
 }
 
 sub deleteFileData {
-    my $input = shift;
-    my ($docid, $fileHash) = datafileInfo($input);
-    my $metacat = Metacat->new($metacatUrl);
+	my $input = shift;
+	my ( $docid, $fileHash ) = datafileInfo($input);
+	my $metacat = Metacat->new($metacatUrl);
 
-    my ($username, $password) = getCredentials();
-    my $response = $metacat->login($username, $password);
-    if (!$response) {
-        my $msg = $metacat->getMessage();
-        push(@errorMessages, "Failed to login with credentials for `$username`. Error was $msg");
-        debug("Failed to login with given credentials for username $username, Error is: $msg");
-    } else {
-        $response = $metacat->delete($docid);
-        if (!$response) {
-            my $msg = $metacat->getMessage();
-            push(@errorMessages, "Failed to delete existing file. Error was: $msg");
-            debug("Delete -- Error is: $msg");
-        } else {
-            debug("Delete -- Success! Removed docid $docid");
-        }
-    }
+	my ( $username, $password ) = getCredentials();
+	my $response = $metacat->login( $username, $password );
+	if ( !$response ) {
+		my $msg = $metacat->getMessage();
+		push( @errorMessages,
+			"Failed to login with credentials for `$username`. Error was $msg"
+		);
+		debug(
+"Failed to login with given credentials for username $username, Error is: $msg"
+		);
+	}
+	else {
+		$response = $metacat->delete($docid);
+		if ( !$response ) {
+			my $msg = $metacat->getMessage();
+			push( @errorMessages,
+				"Failed to delete existing file. Error was: $msg" );
+			debug("Delete -- Error is: $msg");
+		}
+		else {
+			debug("Delete -- Success! Removed docid $docid");
+		}
+	}
 }
 
 sub uploadData {
-    my $data = shift;
-    my $docid = shift;
+	my $data  = shift;
+	my $docid = shift;
 
-    debug("Upload -- Starting upload of $docid");
-    my $response = $metacat->upload($docid, $data);
-    if (!$response) {
-        my $uploadMsg = $metacat->getMessage();
-        push(@errorMessages, "Failed to upload file. Error was: $uploadMsg\n");
-        debug("Upload -- Error is: $uploadMsg");
-    } else {
-        debug("Upload -- Success! New docid $docid");
-    }
+	debug("Upload -- Starting upload of $docid");
+	my $response = $metacat->upload( $docid, $data );
+	if ( !$response ) {
+		my $uploadMsg = $metacat->getMessage();
+		push( @errorMessages,
+			"Failed to upload file. Error was: $uploadMsg\n" );
+		debug("Upload -- Error is: $uploadMsg");
+	}
+	else {
+		debug("Upload -- Success! New docid $docid");
+	}
 }
 
-
 ################################################################################
-# 
+#
 # Create the XML document from the HTML form input
 # returns the XML document as a string
 #
 ################################################################################
 sub createXMLDocument {
-    #FIXME placeholder for $FORM element, should be determined by config
 
-    if ($skinName eq "ebm") {
-        return createProjectDocument();
-    } else {
-        return createDatasetDocument();
-    }
+	#FIXME placeholder for $FORM element, should be determined by config
+
+	if ( $skinName eq "ebm" ) {
+		return createProjectDocument();
+	}
+	else {
+		return createDatasetDocument();
+	}
 }
 
 sub createProjectDocument {
-    my $doc = EMLStart();
-    $doc .= accessElement();
-    $doc .= datasetStart();
-    $doc .= titleElement();
-    $doc .= creatorNameElement();
-    $doc .= creatorElement();
+	my $doc = EMLStart();
+	$doc .= accessElement();
+	$doc .= datasetStart();
+	$doc .= titleElement();
+	$doc .= creatorNameElement();
+	$doc .= creatorElement();
 
-    $doc .= pubElement();
-    $doc .= setDisplayType('project');
-    $doc .= keywordElement();
-    $doc .= contactElement();
+	$doc .= pubElement();
+	$doc .= setDisplayType('project');
+	$doc .= keywordElement();
+	$doc .= contactElement();
 
-    # putting everything else under project
-    $doc .= "<project>";
-    $doc .= titleElement();
-    my %originators = personnelCreate('personnel');
-    $doc .= personnelList(\%originators);
-    $doc .= abstractElement();
-    $doc .= "<studyAreaDescription>\n";
-    $doc .= coverageElement();
-    $doc .= "</studyAreaDescription>\n";
+	# putting everything else under project
+	$doc .= "<project>";
+	$doc .= titleElement();
+	my %originators = personnelCreate('personnel');
+	$doc .= personnelList( \%originators );
+	$doc .= abstractElement();
+	$doc .= "<studyAreaDescription>\n";
+	$doc .= coverageElement();
+	$doc .= "</studyAreaDescription>\n";
 
-    $doc .= "</project>";
-    $doc .= datasetEnd();
-    $doc .= EMLEnd();
-    return $doc;
+	$doc .= "</project>";
+	$doc .= datasetEnd();
+	$doc .= EMLEnd();
+	return $doc;
 }
 
 sub createDatasetDocument {
-    my $doc = EMLStart();
-    $doc .= accessElement();
-    $doc .= datasetStart();
-    $doc .= titleElement();
-    $doc .= creatorElement();
-    $doc .= contactElement('creator');
-    my %originators = personnelCreate('associatedParty');
-    $doc .= personnelList(\%originators);
+	my $doc = EMLStart();
+	$doc .= accessElement();
+	$doc .= datasetStart();
+	$doc .= titleElement();
+	$doc .= creatorElement();
+	$doc .= creatorContactElement();
+	my %originators = personnelCreate('associatedParty');
+	$doc .= personnelList( \%originators );
 
-    $doc .= pubElement();
-    $doc .= abstractElement();
-#    $doc .= setDisplayType('dataset');
-    $doc .= keywordElement();
-    $doc .= distributionElement();
-    $doc .= coverageElement();
-    $doc .= contactElement();
-    $doc .= methodsElement();
-    my %fileData = allFileData();
-    $doc .= entityElement(\%fileData);
-    $doc .= datasetEnd();
-    $doc .= EMLEnd();
+	$doc .= pubElement();
+	$doc .= abstractElement();
+
+	#    $doc .= setDisplayType('dataset');
+	$doc .= keywordElement();
+	$doc .= distributionElement();
+	$doc .= coverageElement();
+	$doc .= contactElement();
+	$doc .= methodsElement();
+	my %fileData = allFileData();
+	$doc .= entityElement( \%fileData );
+	$doc .= datasetEnd();
+	$doc .= EMLEnd();
 }
 
 # EML document creation functions
 
 sub personnelCreate {
-    # passed parameter defines default role for individuals
-    my $defaultRole = shift;
-    # element name => objects of that type
-    my %orig = (
-                'creator'          => [],
-                'metadataProvider' => [],
-                'publisher'        => [],
-                $defaultRole       => [],
-            );
-    # form name => EML element name
-    my %roles = (
-                 'Originator'        => 'creator',
-                 'Metadata Provider' => 'metadataProvider',
-                 'Publisher'         => 'publisher',
-              );
 
-    push (@{$orig{'metadataProvider'}}, [$FORM::providerGivenName, $FORM::providerSurName]);
+	# passed parameter defines default role for individuals
+	my $defaultRole = shift;
 
-    # Additional originators
-    foreach my $origName (param()) {
-        my $origNum = $origName;
-        $origNum =~ s/origNamelast//; # get the index of the parameter 0 to 10
-        if ($origNum =~ /^([0-9]+)$/) {
-            # do not generate EML for empty originator fields
-            if (hasContent(param("origNamefirst" . $origNum))) {
-                my $first = normalize(param("origNamefirst" . $origNum));
-                my $last  = normalize(param("origNamelast" . $origNum));
-                my $origRole = param("origRole" . $origNum);
-                my $roleName = $roles{$origRole};
-                if (!hasContent($roleName)) {
-                  $roleName = $defaultRole;
-                }
+	# element name => objects of that type
+	my %orig = (
+		'creator'          => [],
+		'metadataProvider' => [],
+		'publisher'        => [],
+		$defaultRole       => [],
+	);
 
-                push (@{$orig{$roleName}}, [$first, $last, $origRole]);
-            }
-        }
-    }
-    return %orig;
+	# form name => EML element name
+	my %roles = (
+		'Originator'        => 'creator',
+		'Metadata Provider' => 'metadataProvider',
+		'Publisher'         => 'publisher',
+	);
+
+	push(
+		@{ $orig{'metadataProvider'} },
+		[ $FORM::providerGivenName, $FORM::providerSurName ]
+	);
+
+	# Additional originators
+	foreach my $origName ( param() ) {
+		my $origNum = $origName;
+		$origNum =~ s/origNamelast//;   # get the index of the parameter 0 to 10
+		if ( $origNum =~ /^([0-9]+)$/ ) {
+
+			# do not generate EML for empty originator fields
+			if ( hasContent( param( "origNamefirst" . $origNum ) ) ) {
+				my $first    = normalize( param( "origNamefirst" . $origNum ) );
+				my $last     = normalize( param( "origNamelast" . $origNum ) );
+				my $origRole = param( "origRole" . $origNum );
+				my $roleName = $roles{$origRole};
+				if ( !hasContent($roleName) ) {
+					$roleName = $defaultRole;
+				}
+
+				push( @{ $orig{$roleName} }, [ $first, $last, $origRole ] );
+			}
+		}
+	}
+	return %orig;
 }
 
 sub personnelList {
-    my ($orig, $type) = @_;
-    my %orig = %$orig;
-    
-    my $elemList = "";
-    foreach my $role (keys %orig) {
-        foreach my $v (@{$orig->{$role}}) {
-            my ($first, $last, $origRole) = @$v;
-            my $elem = "<individualName>\n";
-            $elem .= "<givenName>".normalize($first)."</givenName>\n";
-            $elem .= "<surName>".normalize($last)."</surName>\n";
-            $elem .= "</individualName>\n";
+	my ( $orig, $type ) = @_;
+	my %orig = %$orig;
 
-            if (($role eq 'personnel') && ($FORM::origNameOrgContact)) {
-                $elem .= "<organizationName>$FORM::origNameOrgContact</organizationName>\n";
-            }
+	my $elemList = "";
+	foreach my $role ( keys %orig ) {
+		foreach my $v ( @{ $orig->{$role} } ) {
+			my ( $first, $last, $origRole ) = @$v;
+			my $elem = "<individualName>\n";
+			$elem .= "<givenName>" . normalize($first) . "</givenName>\n";
+			$elem .= "<surName>" . normalize($last) . "</surName>\n";
+			$elem .= "</individualName>\n";
 
-            if (($role eq 'personnel') || ($role eq 'associatedParty')) {
-                my $roleElem = $role;
-                if (hasContent($origRole)) {
-                    $roleElem = $origRole;
-                }
-                $elem .= "<role>".normalize($roleElem)."</role>\n";
-            }
-            $elemList .= "<$role>$elem</$role>\n";
-        }
-    }
-    return $elemList;
+			if ( ( $role eq 'personnel' ) && ($FORM::origNameOrgContact) ) {
+				$elem .=
+"<organizationName>$FORM::origNameOrgContact</organizationName>\n";
+			}
+
+			if ( ( $role eq 'personnel' ) || ( $role eq 'associatedParty' ) ) {
+				my $roleElem = $role;
+				if ( hasContent($origRole) ) {
+					$roleElem = $origRole;
+				}
+				$elem .= "<role>" . normalize($roleElem) . "</role>\n";
+			}
+			$elemList .= "<$role>$elem</$role>\n";
+		}
+	}
+	return $elemList;
 }
 
 sub entityElement() {
-    my $entityObjects = shift;
-    my %entityObjects = %$entityObjects;
-    my $entityList = "";
+	my $entityObjects = shift;
+	my %entityObjects = %$entityObjects;
+	my $entityList    = "";
 
-    my $access = fileAccessElement(\%entityObjects);
-    while (my ($docid, $data) = each(%entityObjects)) {
-        my $entityStub = qq|<otherEntity id="$data->{'entityid'}" scope="document">
+	my $access = fileAccessElement( \%entityObjects );
+	while ( my ( $docid, $data ) = each(%entityObjects) ) {
+		my $entityStub =
+		  qq|<otherEntity id="$data->{'entityid'}" scope="document">
             <entityName>$data->{'fileName'}</entityName>
             <physical scope="document">
                 <objectName>$data->{'fileName'}</objectName>
@@ -1313,28 +1557,28 @@
             <entityType>$data->{'entityType'}</entityType>
     </otherEntity>
 |;
-    $entityList .= $entityStub;
-    }
+		$entityList .= $entityStub;
+	}
 
-    return $entityList;
+	return $entityList;
 }
 
 sub fileAccessElement() {
-    my $entityObjects = shift;
-    my %entityObjects = %$entityObjects;
-    my $userAccess = allowElement(getUsername(), 'all');
-    my $skinAccess = allowElement($adminUsername, 'all');
-    my $accessList = "";
+	my $entityObjects = shift;
+	my %entityObjects = %$entityObjects;
+	my $userAccess    = allowElement( getUsername(), 'all' );
+	my $skinAccess    = allowElement( $adminUsername, 'all' );
+	my $accessList    = "";
 
-    # form name => EML permission; roles akin to Apache model
-    my %accessRoles = (
-        'public'  => 'allow',
-        'private' => 'deny',
-    );
+	# form name => EML permission; roles akin to Apache model
+	my %accessRoles = (
+		'public'  => 'allow',
+		'private' => 'deny',
+	);
 
-    while (my ($docid, $data) = each(%entityObjects)) {
-        my $defaultAccess = $accessRoles{$data->{'filePerm'}};
-        $accessList = qq|
+	while ( my ( $docid, $data ) = each(%entityObjects) ) {
+		my $defaultAccess = $accessRoles{ $data->{'filePerm'} };
+		$accessList = qq|
                 <access authSystem="knb" order="denyFirst">
                     $skinAccess
                     $userAccess 
@@ -1344,56 +1588,60 @@
                     </$defaultAccess>
                 </access>
     |;
-    }
+	}
 
-  return $accessList;
+	return $accessList;
 }
 
 sub keywordElement() {
-    my %kwSet, my $kwList = (), "";
+	my %kwSet, my $kwList = (), "";
 
-    # process the standard keywords
-    foreach my $kwName (param()) {
-        my $kwNum = $kwName;
-        $kwNum =~ s/keyword//; # get the index of the parameter 0, ..., 10
-        if ($kwNum =~ /^([0-9]+)$/) {
-            # don't generate xml for empty keyword fields
-            # don't generate taxonomic keyword fields, those go in taxonomic coverage
-            if (hasContent(param($kwName))) {
-                my $kwType = param("kwType" . $kwNum);
-                my $kwTh   = param("kwTh" . $kwNum);
-                my $kw     = param("keyword" . $kwNum);
+	# process the standard keywords
+	foreach my $kwName ( param() ) {
+		my $kwNum = $kwName;
+		$kwNum =~ s/keyword//;    # get the index of the parameter 0, ..., 10
+		if ( $kwNum =~ /^([0-9]+)$/ ) {
 
-                push(@{$kwSet{$kwTh}}, [$kw, $kwType]);
-            }
-        }
-    }
+	   # don't generate xml for empty keyword fields
+	   # don't generate taxonomic keyword fields, those go in taxonomic coverage
+			if ( hasContent( param($kwName) ) ) {
+				my $kwType = param( "kwType" . $kwNum );
+				my $kwTh   = param( "kwTh" . $kwNum );
+				my $kw     = param( "keyword" . $kwNum );
 
-    # output keyword lists
-    while ((my $thesaurus, my $a_ref) = each %kwSet) {
-        my $kwElem .= "<keywordSet>\n";
+				push( @{ $kwSet{$kwTh} }, [ $kw, $kwType ] );
+			}
+		}
+	}
 
-        foreach my $x (@$a_ref) {
-            my ($kw, $kwType) = @$x;
-            $kwElem .= "<keyword ";
-            if (hasContent($kwType) && $kwType != "None") {
-                 $kwElem.= "keywordType=\"".lc($kwType)."\"";
-            }
-            $kwElem .= ">$kw</keyword>\n";
-        }
+	# output keyword lists
+	while ( ( my $thesaurus, my $a_ref ) = each %kwSet ) {
+		my $kwElem .= "<keywordSet>\n";
 
-        $kwElem .= "<keywordThesaurus>".normalize($thesaurus)."</keywordThesaurus>\n";
-        $kwElem .= "</keywordSet>\n";
-        $kwList .= $kwElem;
-    }
-    return $kwList;
+		foreach my $x (@$a_ref) {
+			my ( $kw, $kwType ) = @$x;
+			$kwElem .= "<keyword ";
+			if ( hasContent($kwType) && $kwType != "None" ) {
+				$kwElem .= "keywordType=\"" . lc($kwType) . "\"";
+			}
+			$kwElem .= ">$kw</keyword>\n";
+		}
+
+		$kwElem .=
+		    "<keywordThesaurus>"
+		  . normalize($thesaurus)
+		  . "</keywordThesaurus>\n";
+		$kwElem .= "</keywordSet>\n";
+		$kwList .= $kwElem;
+	}
+	return $kwList;
 }
 
 sub EMLStart() {
-    my $gmt = gmtime($now);
-    my $doc =  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
+	my $gmt = gmtime($now);
+	my $doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
 
-    $doc .= qq|<eml:eml
+	$doc .= qq|<eml:eml
       packageId="docid" system="knb"
       xmlns:eml="eml://ecoinformatics.org/eml-2.1.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -1402,1502 +1650,1944 @@
       xsi:schemaLocation="eml://ecoinformatics.org/eml-2.1.0 eml.xsd">
 |;
 
-    $doc .= "<!-- Person who filled in the catalog entry form: ";
-    $doc .= normalize($FORM::providerGivenName)." ".normalize($FORM::providerSurName)." -->\n";
-    $doc .= "<!-- Form filled out at $gmt GMT -->\n";
-    return $doc;
+	$doc .= "<!-- Person who filled in the catalog entry form: ";
+	$doc .=
+	    normalize($FORM::providerGivenName) . " "
+	  . normalize($FORM::providerSurName)
+	  . " -->\n";
+	$doc .= "<!-- Form filled out at $gmt GMT -->\n";
+	return $doc;
 }
 
 sub EMLEnd() {
-    return  "</eml:eml>\n";
+	return "</eml:eml>\n";
 }
 
 sub datasetStart() {
-    my $dataset = "<dataset>\n";
-        
-    if (hasContent($FORM::identifier)) {
-        $dataset .= "<alternateIdentifier system=\"$FORM::site\">";
-        $dataset .= normalize($FORM::identifier) . "</alternateIdentifier>\n";
-    }
-    return $dataset;
+	my $dataset = "<dataset>\n";
+
+	if ( hasContent($FORM::identifier) ) {
+		$dataset .= "<alternateIdentifier system=\"$FORM::site\">";
+		$dataset .= normalize($FORM::identifier) . "</alternateIdentifier>\n";
+	}
+	return $dataset;
 }
-                                   
+
 sub datasetEnd() {
-    return "</dataset>\n";
+	return "</dataset>\n";
 }
 
 sub setDisplayType {
-   my $kwDisp = shift;
-   if (!$kwDisp) {
-       $kwDisp = 'dataset';
-   }
-   my $kw = "<keywordSet>\n";
-   $kw .= "  <keyword>$kwDisp</keyword>\n";
-   $kw .= "  <keywordThesaurus>EMLDisplayType</keywordThesaurus>\n";
-   $kw .= "</keywordSet>\n";
-   return $kw;
+	my $kwDisp = shift;
+	if ( !$kwDisp ) {
+		$kwDisp = 'dataset';
+	}
+	my $kw = "<keywordSet>\n";
+	$kw .= "  <keyword>$kwDisp</keyword>\n";
+	$kw .= "  <keywordThesaurus>EMLDisplayType</keywordThesaurus>\n";
+	$kw .= "</keywordSet>\n";
+	return $kw;
 }
 
 sub pubElement() {
-    #add the publication Date to the eml document.
-    my ($Day, $Month, $Year) = (localtime)[3,4,5];
 
-    return "<pubDate>".sprintf("%03d-%02d-%02d", $Year + 1900, $Month + 1, $Day)."</pubDate>\n";
+	#add the publication Date to the eml document.
+	my ( $Day, $Month, $Year ) = (localtime)[ 3, 4, 5 ];
+
+	return
+	    "<pubDate>"
+	  . sprintf( "%03d-%02d-%02d", $Year + 1900, $Month + 1, $Day )
+	  . "</pubDate>\n";
 }
 
 sub titleElement() {
-    if (hasContent($FORM::title)) {
-        return "<title>".normalize($FORM::title)."</title>\n";
-    }
+	if ( hasContent($FORM::title) ) {
+		return "<title>" . normalize($FORM::title) . "</title>\n";
+	}
 }
 
 sub abstractElement() {
-    return "<abstract>\n<para>".normalize($FORM::abstract)."</para>\n</abstract>\n";
+	return
+	    "<abstract>\n<para>"
+	  . normalize($FORM::abstract)
+	  . "</para>\n</abstract>\n";
 }
 
 sub creatorElement() {
-    my $creators;
-    if ($skinName eq 'nceas') {
-        for (my $i = 0; $i < scalar(@FORM::wg); $i++) {
-            $creators .= creatorNode($FORM::wg[$i]);
-        }
-    } else {
-        $creators .= creatorNode($FORM::site);
-    }
-    if ($skinName ne 'knb') {
-        $creators .= creatorNode();
-    }
+	my $creators;
+	if ( $skinName eq 'nceas' ) {
+		for ( my $i = 0 ; $i < scalar(@FORM::wg) ; $i++ ) {
+			$creators .= creatorNode( $FORM::wg[$i] );
+		}
+	}
+	else {
+		$creators .= creatorNode($FORM::site);
+	}
+	if ( $skinName ne 'knb' ) {
+		$creators .= creatorNode();
+	}
 
-    return $creators;
+	return $creators;
 }
 
 sub creatorNode {
-    my $org = shift;
-    my $content = "";
+	my $org     = shift;
+	my $content = "";
 
-    if (!hasContent($org)) {
-        $content = $config->{'organization'};
-    } else {
-        $content = $org;
-    }
+	if ( !hasContent($org) ) {
+		$content = $config->{'organization'};
+	}
+	else {
+		$content = $org;
+	}
 
-    return
-    "<creator>\n<organizationName>".normalize($content)."</organizationName>\n</creator>\n";
+	return
+	    "<creator>\n<organizationName>"
+	  . normalize($content)
+	  . "</organizationName>\n</creator>\n";
 }
 
 sub creatorNameElement {
-    my $role = shift;
-    my $creator;
-    if (!hasContent($role)) {
-        $role ="creator";
-    }
+	my $role = shift;
+	my $creator;
+	if ( !hasContent($role) ) {
+		$role = "creator";
+	}
 
-    $creator .= "<individualName>\n";
-    $creator .= "<givenName>".normalize($FORM::origNamefirst0)."</givenName>\n";
-    $creator .= "<surName>".normalize($FORM::origNamelast0)."</surName>\n";
-    $creator .= "</individualName>\n";
+	$creator .= "<individualName>\n";
+	$creator .=
+	  "<givenName>" . normalize($FORM::origNamefirst0) . "</givenName>\n";
+	$creator .= "<surName>" . normalize($FORM::origNamelast0) . "</surName>\n";
+	$creator .= "</individualName>\n";
 
-    return "<$role>\n$creator</$role>\n"
+	return "<$role>\n$creator</$role>\n";
 }
 
 sub methodsElement() {
-    my $methods = "";
-    if ((hasContent($FORM::methodTitle)) || scalar(@FORM::methodsPara) > 0 || ($FORM::methodPara[0] ne "")) {
-        $methods = "<methods><methodStep><description><section>\n";
-        if (hasContent($FORM::methodTitle)) {
-            $methods .= "<title>".normalize($FORM::methodTitle)."</title>\n";
-        }
-        for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
-            $methods .= "<para>".normalize($FORM::methodPara[$i])."</para>\n";
-        }
-        $methods .= "</section></description></methodStep>\n";
-        if (hasContent($FORM::studyExtentDescription)) {
-            $methods .= "<sampling><studyExtent><description>\n";
-            $methods .= "<para>".normalize($FORM::studyExtentDescription)."</para>\n";
-            $methods .= "</description></studyExtent>\n";
-            $methods .= "<samplingDescription>\n";
-            $methods .= "<para>".normalize($FORM::samplingDescription)."</para>\n";
-            $methods .= "</samplingDescription>\n";
-            $methods .= "</sampling>\n";
-        }
-        $methods .= "</methods>\n";
-    }
-    return $methods
+	my $methods = "";
+	if (   ( hasContent($FORM::methodTitle) )
+		|| scalar(@FORM::methodsPara) > 0
+		|| ( $FORM::methodPara[0] ne "" ) )
+	{
+		$methods = "<methods><methodStep><description><section>\n";
+		if ( hasContent($FORM::methodTitle) ) {
+			$methods .=
+			  "<title>" . normalize($FORM::methodTitle) . "</title>\n";
+		}
+		for ( my $i = 0 ; $i < scalar(@FORM::methodPara) ; $i++ ) {
+			$methods .=
+			  "<para>" . normalize( $FORM::methodPara[$i] ) . "</para>\n";
+		}
+		$methods .= "</section></description></methodStep>\n";
+		if ( hasContent($FORM::studyExtentDescription) ) {
+			$methods .= "<sampling><studyExtent><description>\n";
+			$methods .=
+			  "<para>" . normalize($FORM::studyExtentDescription) . "</para>\n";
+			$methods .= "</description></studyExtent>\n";
+			$methods .= "<samplingDescription>\n";
+			$methods .=
+			  "<para>" . normalize($FORM::samplingDescription) . "</para>\n";
+			$methods .= "</samplingDescription>\n";
+			$methods .= "</sampling>\n";
+		}
+		$methods .= "</methods>\n";
+	}
+	return $methods;
 }
 
+sub creatorContactElement() {
+	my $cont = "";
+
+	$cont .= "<individualName>\n";
+	$cont .=
+	  "<givenName>" . normalize($FORM::origNamefirst0) . "</givenName>\n";
+	$cont .=
+	  "<surName>" . normalize($FORM::origNamelast0) . "</surName>\n";
+	$cont .= "</individualName>\n";
+
+	if ( hasContent($FORM::origNameOrg) ) {
+		$cont .=
+		    "<organizationName>"
+		  . normalize($FORM::origNameOrg)
+		  . "</organizationName>\n";
+	}
+
+	if (   hasContent($FORM::origDelivery)
+		|| hasContent($FORM::origCity)
+		|| hasContent($FORM::origState)
+		|| hasContent($FORM::origStateOther)
+		|| hasContent($FORM::origZIP)
+		|| hasContent($FORM::origCountry) )
+	{
+		$cont .= "<address>\n";
+		if ( hasContent($FORM::origDelivery) ) {
+			$cont .= "<deliveryPoint>" . normalize($FORM::origDelivery);
+			$cont .= "</deliveryPoint>\n";
+		}
+		if ( hasContent($FORM::origCity) ) {
+			$cont .= "<city>" . normalize($FORM::origCity) . "</city>\n";
+		}
+		if ( hasContent($FORM::origState)
+			&& ( $FORM::origState !~ /select state/i ) )
+		{
+			$cont .=
+			  "<administrativeArea>" . normalize($FORM::origState);
+			$cont .= "</administrativeArea>\n";
+		}
+		elsif ( hasContent($FORM::origStateOther) ) {
+			$cont .=
+			  "<administrativeArea>" . normalize($FORM::origStateOther);
+			$cont .= "</administrativeArea>\n";
+		}
+		if ( hasContent($FORM::origZIP) ) {
+			$cont .=
+			    "<postalCode>"
+			  . normalize($FORM::origZIP)
+			  . "</postalCode>\n";
+		}
+		if ( hasContent($FORM::origCountry) ) {
+			$cont .=
+			    "<country>"
+			  . normalize($FORM::origCountry)
+			  . "</country>\n";
+		}
+		$cont .= "</address>\n";
+	}
+	if ( hasContent($FORM::origPhone) ) {
+		$cont .= "<phone>" . normalize($FORM::origPhone) . "</phone>\n";
+	}
+	if ( hasContent($FORM::origFAXContact) ) {
+		$cont .=
+		    "<phone phonetype=\"Fax\">"
+		  . normalize($FORM::origFAXContact)
+		  . "</phone>\n";
+	}
+	if ( hasContent($FORM::origEmail) ) {
+		$cont .= "<electronicMailAddress>" . normalize($FORM::origEmail);
+		$cont .= "</electronicMailAddress>\n";
+	}
+
+	return "<creator>\n$cont</creator>\n";
+}
+
 sub contactElement() {
-    my $role = shift;
-    my $cont = "";
+	my $role = shift;
+	my $cont = "";
 
-    if (!hasContent($role)) {
-        $role = 'contact';
-    }
+	if ( !hasContent($role) ) {
+		$role = 'contact';
+	}
 
-    $cont .= "<individualName>\n";
-    $cont .= "<givenName>".normalize($FORM::origNamefirstContact)."</givenName>\n";
-    $cont .= "<surName>".normalize($FORM::origNamelastContact)."</surName>\n";
-    $cont .= "</individualName>\n";
+	$cont .= "<individualName>\n";
+	$cont .=
+	  "<givenName>" . normalize($FORM::origNamefirstContact) . "</givenName>\n";
+	$cont .=
+	  "<surName>" . normalize($FORM::origNamelastContact) . "</surName>\n";
+	$cont .= "</individualName>\n";
 
-    if (hasContent($FORM::origNameOrgContact)) {
-        $cont .= "<organizationName>".normalize($FORM::origNameOrgContact)."</organizationName>\n";
-    }
+	if ( hasContent($FORM::origNameOrgContact) ) {
+		$cont .=
+		    "<organizationName>"
+		  . normalize($FORM::origNameOrgContact)
+		  . "</organizationName>\n";
+	}
 
-    if (hasContent($FORM::origDeliveryContact) ||
-        hasContent($FORM::origCityContact) ||
-        hasContent($FORM::origStateContact)  ||
-        hasContent($FORM::origStateOtherContact) ||
-        hasContent($FORM::origZIPContact) ||
-        hasContent($FORM::origCountryContact)) {
-        $cont .= "<address>\n";
-        if (hasContent($FORM::origDeliveryContact)) {
-            $cont .= "<deliveryPoint>".normalize($FORM::origDeliveryContact);
-            $cont .= "</deliveryPoint>\n";
-        }
-        if (hasContent($FORM::origCityContact)) {
-            $cont .= "<city>".normalize($FORM::origCityContact)."</city>\n";
-        }
-        if (hasContent($FORM::origStateContact) &&
-            ($FORM::origStateContact !~ /select state/i)) {
-            $cont .= "<administrativeArea>".normalize($FORM::origStateContact);
-            $cont .= "</administrativeArea>\n";
-        } elsif (hasContent($FORM::origStateOtherContact)) {
-            $cont .= "<administrativeArea>".normalize($FORM::origStateOtherContact);
-            $cont .= "</administrativeArea>\n";
-        }
-        if (hasContent($FORM::origZIPContact)) {
-            $cont .= "<postalCode>".normalize($FORM::origZIPContact)."</postalCode>\n";
-        }
-        if (hasContent($FORM::origCountryContact)) {
-            $cont .= "<country>".normalize($FORM::origCountryContact)."</country>\n";
-        }
-        $cont .= "</address>\n";
-    }
-    if (hasContent($FORM::origPhoneContact)) {
-        $cont .= "<phone>".normalize($FORM::origPhoneContact)."</phone>\n";
-    }
-    if (hasContent($FORM::origFAXContact)) {
-        $cont .= "<phone phonetype=\"Fax\">".normalize($FORM::origFAXContact)."</phone>\n";
-    }
-    if (hasContent($FORM::origEmailContact)) {
-        $cont .= "<electronicMailAddress>".normalize($FORM::origEmailContact);
-        $cont .= "</electronicMailAddress>\n";
-    }
-    
-    return "<$role>\n$cont</$role>\n";
+	if (   hasContent($FORM::origDeliveryContact)
+		|| hasContent($FORM::origCityContact)
+		|| hasContent($FORM::origStateContact)
+		|| hasContent($FORM::origStateOtherContact)
+		|| hasContent($FORM::origZIPContact)
+		|| hasContent($FORM::origCountryContact) )
+	{
+		$cont .= "<address>\n";
+		if ( hasContent($FORM::origDeliveryContact) ) {
+			$cont .= "<deliveryPoint>" . normalize($FORM::origDeliveryContact);
+			$cont .= "</deliveryPoint>\n";
+		}
+		if ( hasContent($FORM::origCityContact) ) {
+			$cont .= "<city>" . normalize($FORM::origCityContact) . "</city>\n";
+		}
+		if ( hasContent($FORM::origStateContact)
+			&& ( $FORM::origStateContact !~ /select state/i ) )
+		{
+			$cont .=
+			  "<administrativeArea>" . normalize($FORM::origStateContact);
+			$cont .= "</administrativeArea>\n";
+		}
+		elsif ( hasContent($FORM::origStateOtherContact) ) {
+			$cont .=
+			  "<administrativeArea>" . normalize($FORM::origStateOtherContact);
+			$cont .= "</administrativeArea>\n";
+		}
+		if ( hasContent($FORM::origZIPContact) ) {
+			$cont .=
+			    "<postalCode>"
+			  . normalize($FORM::origZIPContact)
+			  . "</postalCode>\n";
+		}
+		if ( hasContent($FORM::origCountryContact) ) {
+			$cont .=
+			    "<country>"
+			  . normalize($FORM::origCountryContact)
+			  . "</country>\n";
+		}
+		$cont .= "</address>\n";
+	}
+	if ( hasContent($FORM::origPhoneContact) ) {
+		$cont .= "<phone>" . normalize($FORM::origPhoneContact) . "</phone>\n";
+	}
+	if ( hasContent($FORM::origFAXContact) ) {
+		$cont .=
+		    "<phone phonetype=\"Fax\">"
+		  . normalize($FORM::origFAXContact)
+		  . "</phone>\n";
+	}
+	if ( hasContent($FORM::origEmailContact) ) {
+		$cont .= "<electronicMailAddress>" . normalize($FORM::origEmailContact);
+		$cont .= "</electronicMailAddress>\n";
+	}
+
+	return "<$role>\n$cont</$role>\n";
 }
 
-sub coverageElement(){
-    my $cov = "";
-    
-    # temporal coverage
-    if (hasContent($FORM::endingYear)) {
-        $cov .= "<temporalCoverage>\n";
-        $cov .= "<rangeOfDates>\n";
-        if (hasContent($FORM::beginningMonth)) {
-            my $month = ("JAN","FEB","MAR","APR","MAY","JUN",
-                         "JUL","AUG","SEP","OCT","NOV","DEC")
-            [$FORM::beginningMonth - 1];
-            if (hasContent($FORM::beginningDay)) {
-                $cov .= "<beginDate>\n";
-                $cov .= "<calendarDate>";
-                $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-".normalize($FORM::beginningDay);
-                $cov .= "</calendarDate>\n";
-                $cov .= "</beginDate>\n";
-            } else {
-                $cov .= "<beginDate>\n";
-                $cov .= "<calendarDate>";
-                $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-01";
-                $cov .= "</calendarDate>\n";
-                $cov .= "</beginDate>\n";
-            }
-        } else {
-            $cov .= "<beginDate>\n";
-            $cov .= "<calendarDate>";
-            $cov .= normalize($FORM::beginningYear);
-            $cov .= "</calendarDate>\n";
-            $cov .= "</beginDate>\n";
-        }
+sub coverageElement() {
+	my $cov = "";
 
-        if (hasContent($FORM::endingMonth)) {
-            my $month = ("JAN","FEB","MAR","APR","MAY","JUN",
-                 "JUL","AUG","SEP","OCT","NOV","DEC")
-            [$FORM::endingMonth - 1];
+	# temporal coverage
+	if ( hasContent($FORM::endingYear) ) {
+		$cov .= "<temporalCoverage>\n";
+		$cov .= "<rangeOfDates>\n";
+		if ( hasContent($FORM::beginningMonth) ) {
+			my $month = (
+				"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
+				"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
+			)[ $FORM::beginningMonth - 1 ];
+			if ( hasContent($FORM::beginningDay) ) {
+				$cov .= "<beginDate>\n";
+				$cov .= "<calendarDate>";
+				$cov .=
+				    normalize($FORM::beginningYear) . "-"
+				  . normalize($FORM::beginningMonth) . "-"
+				  . normalize($FORM::beginningDay);
+				$cov .= "</calendarDate>\n";
+				$cov .= "</beginDate>\n";
+			}
+			else {
+				$cov .= "<beginDate>\n";
+				$cov .= "<calendarDate>";
+				$cov .=
+				    normalize($FORM::beginningYear) . "-"
+				  . normalize($FORM::beginningMonth) . "-01";
+				$cov .= "</calendarDate>\n";
+				$cov .= "</beginDate>\n";
+			}
+		}
+		else {
+			$cov .= "<beginDate>\n";
+			$cov .= "<calendarDate>";
+			$cov .= normalize($FORM::beginningYear);
+			$cov .= "</calendarDate>\n";
+			$cov .= "</beginDate>\n";
+		}
 
-            if (hasContent($FORM::endingDay)) {
-                $cov .= "<endDate>\n";
-                $cov .= "<calendarDate>";
-                $cov .= normalize($FORM::endingYear)."-".normalize($FORM::endingMonth)."-".normalize($FORM::endingDay);
-                $cov .= "</calendarDate>\n";
-                $cov .= "</endDate>\n";
-            } else {
-                $cov .= "<endDate>\n";
-                $cov .= "<calendarDate>";
-                $cov .= normalize($FORM::endingYear)."-".normalize($FORM::endingMonth)."-01";
-                $cov .= "</calendarDate>\n";
-                $cov .= "</endDate>\n";
-            }
-        } else {
-            $cov .= "<endDate>\n";
-            $cov .= "<calendarDate>";
-            $cov .= normalize($FORM::endingYear);
-            $cov .= "</calendarDate>\n";
-            $cov .= "</endDate>\n";
-        }
-        $cov .= "</rangeOfDates>\n";
-        $cov .= "</temporalCoverage>\n";
-    } else {
-        if(hasContent($FORM::beginningYear)) {
-            $cov .= "<temporalCoverage>\n";
-            $cov .= "<singleDateTime>\n";
-            if (hasContent($FORM::beginningMonth)) {
-                my $month = ("JAN","FEB","MAR","APR","MAY","JUN",
-                             "JUL","AUG","SEP","OCT","NOV","DEC")
-                [$FORM::beginningMonth - 1];
+		if ( hasContent($FORM::endingMonth) ) {
+			my $month = (
+				"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
+				"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
+			)[ $FORM::endingMonth - 1 ];
 
-                if (hasContent($FORM::beginningDay)) {
-                    $cov .= "<calendarDate>";
-                    $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-".normalize($FORM::beginningDay);
-                    $cov .= "</calendarDate>\n";
-                } else {
-                    $cov .= "<calendarDate>";
-                    $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-01";
-                    $cov .= "</calendarDate>\n";
-                }
-            } else {
-                $cov .= "<calendarDate>";
-                $cov .= normalize($FORM::beginningYear);
-                $cov .= "</calendarDate>\n";
-            }
-            $cov .= "</singleDateTime>\n";
-            $cov .= "</temporalCoverage>\n";
-        }
-    }
+			if ( hasContent($FORM::endingDay) ) {
+				$cov .= "<endDate>\n";
+				$cov .= "<calendarDate>";
+				$cov .=
+				    normalize($FORM::endingYear) . "-"
+				  . normalize($FORM::endingMonth) . "-"
+				  . normalize($FORM::endingDay);
+				$cov .= "</calendarDate>\n";
+				$cov .= "</endDate>\n";
+			}
+			else {
+				$cov .= "<endDate>\n";
+				$cov .= "<calendarDate>";
+				$cov .=
+				    normalize($FORM::endingYear) . "-"
+				  . normalize($FORM::endingMonth) . "-01";
+				$cov .= "</calendarDate>\n";
+				$cov .= "</endDate>\n";
+			}
+		}
+		else {
+			$cov .= "<endDate>\n";
+			$cov .= "<calendarDate>";
+			$cov .= normalize($FORM::endingYear);
+			$cov .= "</calendarDate>\n";
+			$cov .= "</endDate>\n";
+		}
+		$cov .= "</rangeOfDates>\n";
+		$cov .= "</temporalCoverage>\n";
+	}
+	else {
+		if ( hasContent($FORM::beginningYear) ) {
+			$cov .= "<temporalCoverage>\n";
+			$cov .= "<singleDateTime>\n";
+			if ( hasContent($FORM::beginningMonth) ) {
+				my $month = (
+					"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
+					"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
+				)[ $FORM::beginningMonth - 1 ];
 
-    # geographic coverage
-    if(hasContent($FORM::geogdesc) || (hasContent($FORM::latDeg1) && $FORM::latDeg1 < 91 && $FORM::latDeg1 > -1  && hasContent($FORM::longDeg1) && $FORM::longDeg1 < 181 && $FORM::longDeg1 > -1)) {
-        $cov .= "<geographicCoverage>\n";
+				if ( hasContent($FORM::beginningDay) ) {
+					$cov .= "<calendarDate>";
+					$cov .=
+					    normalize($FORM::beginningYear) . "-"
+					  . normalize($FORM::beginningMonth) . "-"
+					  . normalize($FORM::beginningDay);
+					$cov .= "</calendarDate>\n";
+				}
+				else {
+					$cov .= "<calendarDate>";
+					$cov .=
+					    normalize($FORM::beginningYear) . "-"
+					  . normalize($FORM::beginningMonth) . "-01";
+					$cov .= "</calendarDate>\n";
+				}
+			}
+			else {
+				$cov .= "<calendarDate>";
+				$cov .= normalize($FORM::beginningYear);
+				$cov .= "</calendarDate>\n";
+			}
+			$cov .= "</singleDateTime>\n";
+			$cov .= "</temporalCoverage>\n";
+		}
+	}
 
-        if(hasContent($FORM::geogdesc)) {
-            $cov .= "<geographicDescription>".normalize($FORM::geogdesc)."</geographicDescription>\n";
-        }
+	# geographic coverage
+	if (
+		hasContent($FORM::geogdesc)
+		|| (   hasContent($FORM::latDeg1)
+			&& $FORM::latDeg1 < 91
+			&& $FORM::latDeg1 > -1
+			&& hasContent($FORM::longDeg1)
+			&& $FORM::longDeg1 < 181
+			&& $FORM::longDeg1 > -1 )
+	  )
+	{
+		$cov .= "<geographicCoverage>\n";
 
-        if($latDeg1 < 91 && $latDeg1 > -1 && $longDeg1 < 181 && $longDeg1 > -1) {
-            $cov .= "<boundingCoordinates>\n";
-            # if the second latitude is missing, then set the second lat/long pair
-            # equal to the first this makes a point appear like a rectangle
-            if ($FORM::useSiteCoord || ($FORM::latDeg2 eq "" && $FORM::latMin2 eq "" && $FORM::latSec2 eq "")) {
+		if ( hasContent($FORM::geogdesc) ) {
+			$cov .=
+			    "<geographicDescription>"
+			  . normalize($FORM::geogdesc)
+			  . "</geographicDescription>\n";
+		}
 
-                $latDeg2 = $latDeg1;
-                $latMin2 = $latMin1;
-                $latSec2 = $latSec1;
-                $hemisphLat2 = $hemisphLat1;
-                $longDeg2 = $longDeg1;
-                $longMin2 = $longMin1;
-                $longSec2 = $longSec1;
-                $hemisphLong2 = $hemisphLong1;
-            }
-            else
-            {
-                $latDeg2 = $FORM::latDeg2;
-                $latMin2 = $FORM::latMin2;
-                $latSec2 = $FORM::latSec2;
-                $hemisphLat2 = $FORM::hemisphLat2;
-                $longDeg2 = $FORM::longDeg2;
-                $longMin2 = $FORM::longMin2;
-                $longSec2 = $FORM::longSec2;
-                $hemisphLong2 = $FORM::hemisphLong2;
-            }
+		if (   $latDeg1 < 91
+			&& $latDeg1 > -1
+			&& $longDeg1 < 181
+			&& $longDeg1 > -1 )
+		{
+			$cov .= "<boundingCoordinates>\n";
 
-            my $hemisph;
-            $hemisph = ($hemisphLong1 eq "W") ? -1 : 1;
-            $cov .= "<westBoundingCoordinate>";
-            my $var = $hemisph * ($longDeg1 + (60*$longMin1+$longSec1)/3600);
-            $cov .= sprintf("%.4f", $var);
-            $cov .= "</westBoundingCoordinate>\n";
+		  # if the second latitude is missing, then set the second lat/long pair
+		  # equal to the first this makes a point appear like a rectangle
+			if (
+				$FORM::useSiteCoord
+				|| (   $FORM::latDeg2 eq ""
+					&& $FORM::latMin2 eq ""
+					&& $FORM::latSec2 eq "" )
+			  )
+			{
 
-            $hemisph = ($hemisphLong2 eq "W") ? -1 : 1;
-            $cov .= "<eastBoundingCoordinate>";
-            $var = $hemisph * ($longDeg2 + (60*$longMin2+$longSec2)/3600);
-            $cov .= sprintf("%.4f", $var);
-            $cov .= "</eastBoundingCoordinate>\n";
+				$latDeg2      = $latDeg1;
+				$latMin2      = $latMin1;
+				$latSec2      = $latSec1;
+				$hemisphLat2  = $hemisphLat1;
+				$longDeg2     = $longDeg1;
+				$longMin2     = $longMin1;
+				$longSec2     = $longSec1;
+				$hemisphLong2 = $hemisphLong1;
+			}
+			else {
+				$latDeg2      = $FORM::latDeg2;
+				$latMin2      = $FORM::latMin2;
+				$latSec2      = $FORM::latSec2;
+				$hemisphLat2  = $FORM::hemisphLat2;
+				$longDeg2     = $FORM::longDeg2;
+				$longMin2     = $FORM::longMin2;
+				$longSec2     = $FORM::longSec2;
+				$hemisphLong2 = $FORM::hemisphLong2;
+			}
 
-            $hemisph = ($hemisphLat1 eq "S") ? -1 : 1;
-            $cov .= "<northBoundingCoordinate>";
-            $var = $hemisph * ($latDeg1 + (60*$latMin1+$latSec1)/3600);
-            $cov .= sprintf("%.4f", $var);
-            $cov .= "</northBoundingCoordinate>\n";
+			my $hemisph;
+			$hemisph = ( $hemisphLong1 eq "W" ) ? -1 : 1;
+			$cov .= "<westBoundingCoordinate>";
+			my $var =
+			  $hemisph * ( $longDeg1 + ( 60 * $longMin1 + $longSec1 ) / 3600 );
+			$cov .= sprintf( "%.4f", $var );
+			$cov .= "</westBoundingCoordinate>\n";
 
-            $hemisph = ($hemisphLat2 eq "S") ? -1 : 1;
-            $cov .= "<southBoundingCoordinate>";
-            $var = $hemisph * ($latDeg2 + (60*$latMin2+$latSec2)/3600);
-            $cov .= sprintf("%.4f", $var);
-            $cov .= "</southBoundingCoordinate>\n";
+			$hemisph = ( $hemisphLong2 eq "W" ) ? -1 : 1;
+			$cov .= "<eastBoundingCoordinate>";
+			$var =
+			  $hemisph * ( $longDeg2 + ( 60 * $longMin2 + $longSec2 ) / 3600 );
+			$cov .= sprintf( "%.4f", $var );
+			$cov .= "</eastBoundingCoordinate>\n";
 
-            $cov .= "</boundingCoordinates>\n";
-        }
-        $cov .= "</geographicCoverage>\n";
-    }
+			$hemisph = ( $hemisphLat1 eq "S" ) ? -1 : 1;
+			$cov .= "<northBoundingCoordinate>";
+			$var =
+			  $hemisph * ( $latDeg1 + ( 60 * $latMin1 + $latSec1 ) / 3600 );
+			$cov .= sprintf( "%.4f", $var );
+			$cov .= "</northBoundingCoordinate>\n";
 
-    # taxonomic coverage
-    my $foundFirstTaxon = 0;
-    foreach my $trn (param()) {
-        if ($trn =~ /taxonRankName/) {
-            my $taxIndex = $trn;
-            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
-            my $trv = "taxonRankValue".$taxIndex;
-            if ($taxIndex =~ /[0-9]+/) {
-                if (hasContent(param($trn)) && hasContent(param($trv))) {
-                    if (!$foundFirstTaxon) {
-                        $cov .= "<taxonomicCoverage>\n";
-                        $foundFirstTaxon = 1;
-                        if (hasContent($FORM::taxaAuth)) {
-                            $cov .= "<generalTaxonomicCoverage>".normalize($FORM::taxaAuth)."</generalTaxonomicCoverage>\n";
-                        }
-                    }
-                    $cov .= "<taxonomicClassification>\n";
-                    $cov .= "  <taxonRankName>".normalize(param($trn))."</taxonRankName>\n";
-                    $cov .= "  <taxonRankValue>".normalize(param($trv))."</taxonRankValue>\n";
-                    $cov .= "</taxonomicClassification>\n";
-                }
-            }
-        }
-    }
+			$hemisph = ( $hemisphLat2 eq "S" ) ? -1 : 1;
+			$cov .= "<southBoundingCoordinate>";
+			$var =
+			  $hemisph * ( $latDeg2 + ( 60 * $latMin2 + $latSec2 ) / 3600 );
+			$cov .= sprintf( "%.4f", $var );
+			$cov .= "</southBoundingCoordinate>\n";
 
-    if ($foundFirstTaxon) {
-        $cov .= "</taxonomicCoverage>\n";
-    }
+			$cov .= "</boundingCoordinates>\n";
+		}
+		$cov .= "</geographicCoverage>\n";
+	}
 
-    return "<coverage>\n$cov</coverage>\n"; 
+	# taxonomic coverage
+	my $foundFirstTaxon = 0;
+	foreach my $trn ( param() ) {
+		if ( $trn =~ /taxonRankName/ ) {
+			my $taxIndex = $trn;
+			$taxIndex =~
+			  s/taxonRankName//;    # get the index of the parameter 0, ..., 10
+			my $trv = "taxonRankValue" . $taxIndex;
+			if ( $taxIndex =~ /[0-9]+/ ) {
+				if ( hasContent( param($trn) ) && hasContent( param($trv) ) ) {
+					if ( !$foundFirstTaxon ) {
+						$cov .= "<taxonomicCoverage>\n";
+						$foundFirstTaxon = 1;
+						if ( hasContent($FORM::taxaAuth) ) {
+							$cov .=
+							    "<generalTaxonomicCoverage>"
+							  . normalize($FORM::taxaAuth)
+							  . "</generalTaxonomicCoverage>\n";
+						}
+					}
+					$cov .= "<taxonomicClassification>\n";
+					$cov .=
+					    "  <taxonRankName>"
+					  . normalize( param($trn) )
+					  . "</taxonRankName>\n";
+					$cov .=
+					    "  <taxonRankValue>"
+					  . normalize( param($trv) )
+					  . "</taxonRankValue>\n";
+					$cov .= "</taxonomicClassification>\n";
+				}
+			}
+		}
+	}
+
+	if ($foundFirstTaxon) {
+		$cov .= "</taxonomicCoverage>\n";
+	}
+
+	return "<coverage>\n$cov</coverage>\n";
 }
 
 sub distributionElement() {
-    my $dist = "";
-    if (hasContent($FORM::addComments)) {
-        $dist .= "<additionalInfo>\n";
-        $dist .= "<para>".normalize($FORM::addComments)."</para>\n";
-        $dist .= "</additionalInfo>\n";
-    }
+	my $dist = "";
+	if ( hasContent($FORM::addComments) ) {
+		$dist .= "<additionalInfo>\n";
+		$dist .= "<para>" . normalize($FORM::addComments) . "</para>\n";
+		$dist .= "</additionalInfo>\n";
+	}
 
-    if (hasContent($FORM::useConstraints) ||
-        hasContent($FORM::useConstraintsOther)) {
-        $dist .= "<intellectualRights>\n";
-        if (hasContent($FORM::useConstraints)) {
-            $dist .= "<para>".normalize($FORM::useConstraints)."</para>\n";
-        }
-        if (hasContent($FORM::useConstraintsOther)) {
-            $dist .= "<para>".normalize($FORM::useConstraintsOther)."</para>\n";
-        }
-        $dist .= "</intellectualRights>\n";
-    }
+	if (   hasContent($FORM::useConstraints)
+		|| hasContent($FORM::useConstraintsOther) )
+	{
+		$dist .= "<intellectualRights>\n";
+		if ( hasContent($FORM::useConstraints) ) {
+			$dist .= "<para>" . normalize($FORM::useConstraints) . "</para>\n";
+		}
+		if ( hasContent($FORM::useConstraintsOther) ) {
+			$dist .=
+			  "<para>" . normalize($FORM::useConstraintsOther) . "</para>\n";
+		}
+		$dist .= "</intellectualRights>\n";
+	}
 
+	if ( hasContent($FORM::url) ) {
+		$dist .= "<distribution>\n";
+		$dist .= "<online>\n";
+		$dist .= "<url>" . normalize($FORM::url) . "</url>\n";
+		$dist .= "</online>\n";
+		$dist .= "</distribution>\n";
+	}
 
-    if (hasContent($FORM::url)) {
-        $dist .= "<distribution>\n";
-        $dist .= "<online>\n";
-        $dist .= "<url>".normalize($FORM::url)."</url>\n";
-        $dist .= "</online>\n";
-        $dist .= "</distribution>\n";
-    }
-
-    $dist .= "<distribution>\n";
-    $dist .= "<offline>\n";
-    $dist .= "<mediumName>" . normalize($FORM::dataMedium)." ".normalize($FORM::dataMediumOther);
-    $dist .= "</mediumName>\n";
-    $dist .= "</offline>\n";
-    $dist .= "</distribution>\n";
-    return $dist;
+	$dist .= "<distribution>\n";
+	$dist .= "<offline>\n";
+	$dist .=
+	    "<mediumName>"
+	  . normalize($FORM::dataMedium) . " "
+	  . normalize($FORM::dataMediumOther);
+	$dist .= "</mediumName>\n";
+	$dist .= "</offline>\n";
+	$dist .= "</distribution>\n";
+	return $dist;
 }
 
 sub accessElement {
-    my $public = shift;
-    if (!$public) {
-        $public = $config->{'publicReadable'};
-    }
-               
-    my $access = "";
+	my $public = shift;
+	if ( !$public ) {
+		$public = $config->{'publicReadable'};
+	}
 
-    $access .= "<access authSystem=\"knb\" order=\"denyFirst\">\n";
-    $access .= allowElement($adminUsername, 'all');
+	my $access = "";
 
-    if($moderators eq '') {
-        $access .= allowElement(getUsername(), 'all');
-    } else {
-        foreach(split(":", $moderators)) {
-            $access .= allowElement($_, 'all');
-        }
+	$access .= "<access authSystem=\"knb\" order=\"denyFirst\">\n";
+	$access .= allowElement( $adminUsername, 'all' );
 
-        $access .= allowElement(getUsername(), 'read', 'write'); 
-    }
+	if ( $moderators eq '' ) {
+		$access .= allowElement( getUsername(), 'all' );
+	}
+	else {
+		foreach ( split( ":", $moderators ) ) {
+			$access .= allowElement( $_, 'all' );
+		}
 
-    if ($public eq "true") {
-        $access .= allowElement('public', 'read');
-    }
-    $access .= "</access>\n";
-    return $access;
+		$access .= allowElement( getUsername(), 'read', 'write' );
+	}
+
+	if ( $public eq "true" ) {
+		$access .= allowElement( 'public', 'read' );
+	}
+	$access .= "</access>\n";
+	return $access;
 }
 
 sub allowElement {
-    my $principal = shift;
-    my @permissions = @_;
+	my $principal   = shift;
+	my @permissions = @_;
 
-    my $allowElem = "<allow>\n" .
-                 "  <principal>$principal</principal>";
-    foreach my $perm (@permissions) {
-        $allowElem .= "<permission>$perm</permission>\n";
-    }
-    $allowElem .= "</allow>\n";
-    return $allowElem;
+	my $allowElem = "<allow>\n" . "  <principal>$principal</principal>";
+	foreach my $perm (@permissions) {
+		$allowElem .= "<permission>$perm</permission>\n";
+	}
+	$allowElem .= "</allow>\n";
+	return $allowElem;
 }
 
 sub getUsername() {
-    my $username = '';
-     
-    if ($FORM::username ne '') {
-        $username = "uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org";    
-    } else {
-        my $session = CGI::Session->load();
-        if (!$session->is_empty) {
-            $username = $session->param("username");
-        }
-    }
-  
-    return $username;
+	my $username = '';
+
+	if ( $FORM::username ne '' ) {
+		$username =
+		  "uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org";
+	}
+	else {
+		my $session = CGI::Session->load();
+		if ( !$session->is_empty ) {
+			$username = $session->param("username");
+		}
+	}
+
+	return $username;
 }
 
-sub readDocumentFromMetacat(){
+sub readDocumentFromMetacat() {
 
-    my $docid = $FORM::docid;
-    # create metacat instance
-    my $metacat = Metacat->new($metacatUrl);
-    my $httpMessage;
-    my $doc;
-    my $xmldoc;
-    my $findType;
-    my $parser = XML::LibXML->new();
-    my @fileArray;
-    my $pushDoc;
-    my $alreadyInArray;
-    my $node;
-    my $response; 
-    my $element;
-    my $tempfile;
+	#debug("read the document from metacat");
+	my $docid = $FORM::docid;
 
-    my ($username, $password) = getCredentials();
-    $metacat->login($username, $password);
- 
-    $httpMessage = $metacat->read($docid);
-    $doc = $httpMessage->content();
-    $xmldoc = $parser->parse_string($doc);
+	# create metacat instance
+	my $metacat = Metacat->new($metacatUrl);
+	my $httpMessage;
+	my $doc;
+	my $xmldoc;
+	my $findType;
+	my $parser = XML::LibXML->new();
+	my @fileArray;
+	my $pushDoc;
+	my $alreadyInArray;
+	my $node;
+	my $response;
+	my $element;
+	my $tempfile;
 
-    if ($xmldoc eq "") {
-        $error ="Error in parsing the eml document";
-        push(@errorMessages, $error);
-    } elsif ($doc=~ /<error/) {
-        if ($doc=~ /public/) {
-            $error ="Error in reading the eml document. Please check if you are logged in.";
-            push(@errorMessages, $error);
-        } else {
-          $error ="Error in reading the eml document. Please check if you have access to read the document";
-          push(@errorMessages, $error); 
-        }
-    } else {
-        $findType = $xmldoc->findnodes('//dataset/identifier');
-        if ($findType->size() > 0) {
-            # This is a eml beta6 document
-            # Read the documents mentioned in triples also
-            push(@errorMessages, "EML2 beta6 support deprecated."); 
-        }
-    }
-    return $xmldoc;
-}   
+	my ( $username, $password ) = getCredentials();
+	$metacat->login( $username, $password );
 
+	$httpMessage = $metacat->read($docid);
+	$doc         = $httpMessage->content();
+	$xmldoc      = $parser->parse_string($doc);
 
+	if ( $xmldoc eq "" ) {
+		$error = "Error in parsing the eml document";
+		push( @errorMessages, $error );
+	}
+	elsif ( $doc =~ /<error/ ) {
+		if ( $doc =~ /public/ ) {
+			$error = "Error in reading the eml document. Please check if you are logged in.";
+			push( @errorMessages, $error );
+		}
+		else {
+			$error = "Error in reading the eml document. Please check if you have access to read the document";
+			push( @errorMessages, $error );
+		}
+	}
+	else {
+		$findType = $xmldoc->findnodes('//dataset/identifier');
+		if ( $findType->size() > 0 ) {
+
+			# This is a eml beta6 document
+			# Read the documents mentioned in triples also
+			push( @errorMessages, "EML2 beta6 support deprecated." );
+		}
+	}
+	return $xmldoc;
+}
+
 ################################################################################
-# 
-# read the eml document and send back a form with values filled in. 
 #
+# read the eml document and send back a form with values filled in.
+#
 ################################################################################
 sub modifyData {
+	#debug("in modifyData");
 
-    my $xmldoc = readDocumentFromMetacat();     
-    if (!scalar(@errorMessages)) {
-      getFormValuesFromEml2($xmldoc);
-    }
+	my $xmldoc = readDocumentFromMetacat();
+	if ( !scalar(@errorMessages) ) {
+		getFormValuesFromEml2($xmldoc);
+	}
 
-    if (scalar(@errorMessages)) {
-        # if any errors, print them in the response template 
-        $$templateVars{'status'} = 'failure_no_resubmit';
-        $$templateVars{'errorMessages'} = \@errorMessages;
-        $error = 1;
-        $$templateVars{'function'} = "modification";
-        $$templateVars{'section'} = "Modification Status";
-        $template->process($templates->{'response'}, $templateVars); 
-    } else {
-        $$templateVars{'form'} = 're_entry';
-        $template->process($templates->{'entry'}, $templateVars);
-    }
+	if ( scalar(@errorMessages) ) {
+
+		# if any errors, print them in the response template
+		$$templateVars{'status'}        = 'failure_no_resubmit';
+		$$templateVars{'errorMessages'} = \@errorMessages;
+		$error                          = 1;
+		$$templateVars{'function'}      = "modification";
+		$$templateVars{'section'}       = "Modification Status";
+		$template->process( $templates->{'response'}, $templateVars );
+	}
+	else {
+		$$templateVars{'form'} = 're_entry';
+		$template->process( $templates->{'entry'}, $templateVars );
+	}
 }
 
 ################################################################################
-# 
+#
 # Convert EML 2.0.x documents into 2.1.0 using an XSLT transform
 #
 ################################################################################
 sub transformEmlTo210 {
-    my $xmldoc = shift;
-    my $xslt = XML::LibXSLT->new();
-    my $results;
-    my $stylesheet;
-    my $resultsheet;
+	my $xmldoc = shift;
+	my $xslt   = XML::LibXSLT->new();
+	my $results;
+	my $stylesheet;
+	my $resultsheet;
 
-    my $transform = "$styleCommonPath/conversions/eml201to210.xsl";
-    $stylesheet = $xslt->parse_stylesheet_file($transform);
-    $results = $stylesheet->transform($xmldoc);
-    # if debugging is enabled, dump the transformed document to disk
-    debugDoc($stylesheet->output_string($results));
+	my $transform = "$styleCommonPath/conversions/eml201to210.xsl";
+	$stylesheet = $xslt->parse_stylesheet_file($transform);
+	$results    = $stylesheet->transform($xmldoc);
 
-    return $results;
+	# if debugging is enabled, dump the transformed document to disk
+	debugDoc( $stylesheet->output_string($results) );
+
+	return $results;
 }
 
 ################################################################################
-# 
+#
 # transform the EML document if necessary, otherwise leave unadultered
 #
 ################################################################################
 sub transformEml {
-    my $doc = shift;
+	my $doc = shift;
 
-    # get the document namespace
-    my $root = $doc->getDocumentElement();
-    my $emlns = $root->lookupNamespaceURI("eml");
+	# get the document namespace
+	my $root  = $doc->getDocumentElement();
+	my $emlns = $root->lookupNamespaceURI("eml");
 
-    if ($emlns =~ 'eml-2.0') {
-        debug("Translation: Upgrading a 2.0.x doc to 2.1.0");
-        $doc = transformEmlTo210($doc);
-    }
-    elsif ($emlns =~ 'eml-2.1') {
-        debug("Translation: Found a 2.1.x doc.");
-    }
-    else {
-        $error = "Unrecognized document type!";
-        debug("Translation: $error"); 
-        push(@errorMessages, $error."\n");
-    }
-    return $doc;
+	if ( $emlns =~ 'eml-2.0' ) {
+		debug("Translation: Upgrading a 2.0.x doc to 2.1.0");
+		$doc = transformEmlTo210($doc);
+	}
+	elsif ( $emlns =~ 'eml-2.1' ) {
+		debug("Translation: Found a 2.1.x doc.");
+	}
+	else {
+		$error = "Unrecognized document type!";
+		debug("Translation: $error");
+		push( @errorMessages, $error . "\n" );
+	}
+	return $doc;
 }
 
 ################################################################################
-# 
-# Parse an EML 2.x file and extract the metadata into perl variables for 
+#
+# Parse an EML 2.x file and extract the metadata into perl variables for
 # processing and returning to the template processor
 #
 ################################################################################
 sub getFormValuesFromEml2 {
-    
-    my $doc = shift;
-    my $results;
-    my $error;
-    my $node;
-    my $tempResult;
-    my $tempNode;
-    my $aoCount = 0;
-    my $foundDSO;
+	#debug("getting form values from eml 2");
 
-    # set variable values
-    $$templateVars{'modules'} = $modules;
-    $$templateVars{'required'} = $required;
-    $$templateVars{'show'} = $show;
-    $$templateVars{'site'} = $config->{'site'};
+	my $doc = shift;
+	my $results;
+	my $error;
+	my $node;
+	my $tempResult;
+	my $tempNode;
+	my $aoCount = 0;
+	my $foundDSO;
 
-    # perform any required transformation
-    $doc = transformEml($doc);
+	# set variable values
+	$$templateVars{'modules'}  = $modules;
+	$$templateVars{'required'} = $required;
+	$$templateVars{'show'}     = $show;
+	$$templateVars{'site'}     = $config->{'site'};
 
-    # find out the tag <alternateIdentifier>. 
-    $results = $doc->findnodes('//dataset/alternateIdentifier');
-    if ($results->size() > 1) {
-        errMoreThanOne("alternateIdentifier");
-    } else {
-        foreach $node ($results->get_nodelist) {
-            $$templateVars{'identifier'} = findValue($node, '../alternateIdentifier');
-        }
-    }
+	# perform any required transformation
+	$doc = transformEml($doc);
 
-    # find out the tag <title>. 
-    $results = $doc->findnodes('//dataset/title');
-    if ($results->size() > 1) {
-        errMoreThanOne("title");
-    } elsif ($results->size() < 1) {
-        $error ="Following tag not found: title. Please use Morpho to edit this document";
-        push(@errorMessages, $error."\n");
-    } else {
-        foreach $node ($results->get_nodelist) {
-            $$templateVars{'title'} = findValue($node, '../title');
-        }
-    }
+	# find out the tag <alternateIdentifier>.
+	$results = $doc->findnodes('//dataset/alternateIdentifier');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("alternateIdentifier");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			$$templateVars{'identifier'} =
+			  findValue( $node, '../alternateIdentifier' );
+		}
+	}
 
-    # find out the tag <creator>. 
-    $results = $doc->findnodes('//dataset/creator/individualName');
-    debug("Creators: ".$results->size());
-     foreach $node ($results->get_nodelist) {
-            dontOccur($node, "../positionName|../onlineURL|../userId", 
-              "positionName, onlineURL, userId");
-        
-            dontOccur($node, "./salutation", "salutation");                
-        
-            debug("Checking a creator in loop 1...");
-            $tempResult = $node->findnodes('../address|../phone|../electronicMailAddress|../organizationName');
-            if($tempResult->size > 0) {
-                if($foundDSO == 0) {
-                    $foundDSO = 1;
-     
-                    debug("Recording a creator in loop 1...");
-                    $$templateVars{'origNamefirst0'} = findValue($node, 'givenName');
-                    $$templateVars{'origNamelast0'} = findValue($node, 'surName');
-            
-                    my $tempResult2 = $node->findnodes('../address');
-                    if ($tempResult2->size > 1) {
-                        errMoreThanOne("address");
-                    } else {
-                        foreach my $tempNode2 ($tempResult2->get_nodelist) {
-                            $$templateVars{'origDelivery'} = findValue($tempNode2, 'deliveryPoint');
-                            $$templateVars{'origCity'} = findValue($tempNode2, 'city');
-                            $$templateVars{'origState'} = findValue($tempNode2, 'administrativeArea');
-                            $$templateVars{'origZIP'} = findValue($tempNode2, 'postalCode');
-                            $$templateVars{'origCountry'} = findValue($tempNode2, 'country');
-                        }
-                    }
-            
-                    my $tempResult3 = $node->findnodes('../phone');
-                    if ($tempResult3->size > 2) {
-                        errMoreThanN("phone");
-                    } else {
-                        foreach my $tempNode2 ($tempResult3->get_nodelist) {
-                            if ($tempNode2->hasAttributes()) {
-                                my @attlist = $tempNode2->attributes();
-                                if ($attlist[0]->value eq "Fax") {
-                                    $$templateVars{'origFAX'} = $tempNode2->textContent();
-                                } else {
-                                    $$templateVars{'origPhone'} = $tempNode2->textContent();
-                                }
-                            } else {
-                                $$templateVars{'origPhone'} = $tempNode2->textContent();
-                            }
-                        }
-                    }
-                    $$templateVars{'origEmail'} = findValue($node, '../electronicMailAddress');
-                    $$templateVars{'origNameOrg'} = findValue($node, '../organizationName');
-                } else {
-                    errMoreThanN("address, phone and electronicMailAddress");
-                }
-            }
-        }
-        foreach $node ($results->get_nodelist) {
-            debug("Checking a creator in loop 2...");
-            $tempResult = $node->findnodes('../address|../phone|../electronicMailAddress|../organizationName');
-            if ($tempResult->size == 0) {
-                if ($foundDSO == 0) {
-                    debug("Recording a creator in loop 2 block A...");
-                    $foundDSO = 1;
-                    $$templateVars{'origNamefirst0'} = findValue($node, 'givenName');
-                    $$templateVars{'origNamelast0'} = findValue($node, 'surName');
-                    $$templateVars{'origNameOrg'} = findValue($node, '../organizationName');
-                } else {
-                    debug("Recording a creator in loop 2 block B...");
-                    $$templateVars{"origNamefirst$aoCount"} =  findValue($node, './givenName');
-                    $$templateVars{"origNamelast$aoCount"} =  findValue($node, './surName');
-                    $$templateVars{"origRole$aoCount"} = "Originator";
-                    $aoCount++;
-                }
-            }
-        }
+	# find out the tag <title>.
+	$results = $doc->findnodes('//dataset/title');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("title");
+	}
+	elsif ( $results->size() < 1 ) {
+		$error = "Following tag not found: title. Please use Morpho to edit this document";
+		push( @errorMessages, $error . "\n" );
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			$$templateVars{'title'} = findValue( $node, '../title' );
+		}
+	}
 
-    $results = $doc->findnodes('//dataset/creator/organizationName');
-    my $wgroups = $doc->findnodes("//dataset/creator/organizationName[contains(text(),'(NCEAS ')]");
-    debug("Number Org: ".$results->size());
-    debug(" Number WG: ".$wgroups->size());
-    if ($results->size() - $wgroups->size() > 3) {
-        errMoreThanN("creator/organizationName");    
-    } else {
-        foreach $node ($results->get_nodelist) {
-            my $tempValue = findValue($node,'../organizationName');
-            $tempResult = $node->findnodes('../individualName');
-            if ($tempResult->size == 0 && $tempValue ne $config->{'organization'}) {
-                $$templateVars{'site'} = $tempValue;
-            }
-        }
-        if ($skinName eq 'nceas') {
-            my @wg;
-            foreach $node ($results->get_nodelist) {
-                my $tempValue = findValue($node,'../organizationName');
-                $wg[scalar(@wg)] = $tempValue;
-            }
-            my $projects = getProjectList($properties);
-            $$templateVars{'projects'} = $projects;
-            $$templateVars{'wg'} = \@wg;
-        }
-    }
+	# find out the tag <creator>.
+	$results = $doc->findnodes('//dataset/creator/individualName');
+	debug( "Creators: " . $results->size() );
+	foreach $node ( $results->get_nodelist ) {
+		dontOccur(
+			$node,
+			"../positionName|../onlineURL|../userId",
+			"positionName, onlineURL, userId"
+		);
 
-    $results = $doc->findnodes('//dataset/metadataProvider');
-    foreach $node ($results->get_nodelist) {
-        dontOccur($node, "./organizationName|./positionName|./onlineURL|./userId|./electronicMailAddress|./phone|./address", 
-                "organizationName, positionName, onlineURL, userId, electronicMailAddress, phone, address in metadataProvider");
-        
-        $tempResult = $node->findnodes('./individualName');
-            if ($tempResult->size > 1) {
-                errMoreThanOne("metadataProvider/indvidualName");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    if ($$templateVars{'providerGivenName'} ne "") {
-                        $$templateVars{"origNamefirst$aoCount"} =  findValue($tempNode, './givenName');
-                        $$templateVars{"origNamelast$aoCount"} =  findValue($tempNode, './surName');
-                        $$templateVars{"origRole$aoCount"} = "Metadata Provider";
-                        $aoCount++;
-                    } else {
-                        $$templateVars{'providerGivenName'} =  findValue($tempNode, './givenName');
-                        $$templateVars{'providerSurName'} =  findValue($tempNode, './surName');
-                    }
-                }
-            }
-        }
+		dontOccur( $node, "./salutation", "salutation" );
 
-    $results = $doc->findnodes('//dataset/associatedParty');
-    foreach $node ($results->get_nodelist) {
-            dontOccur($node, "./organizationName|./positionName|./onlineURL|./userId|./electronicMailAddress|./phone|./address", 
-                "organizationName, positionName, onlineURL, userId, electronicMailAddress, phone, address in associatedParty");
-       
-            $tempResult = $node->findnodes('./individualName');
-            if ($tempResult->size > 1) {
-                errMoreThanOne("associatedParty/indvidualName");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    $$templateVars{"origNamefirst$aoCount"} =  findValue($tempNode, './givenName');
-                    $$templateVars{"origNamelast$aoCount"} =  findValue($tempNode, './surName');
-                    $$templateVars{"origRole$aoCount"} = findValue($tempNode, '../role');
-                    $aoCount++;           
-                }
-            }
-     }
+		debug("Checking a creator in loop 1...");
+		$tempResult = $node->findnodes(
+			'../address|../phone|../electronicmailAddress|../organizationName');
+		if ( $tempResult->size > 0 ) {
+			if ( $foundDSO == 0 ) {
+				$foundDSO = 1;
 
-    $results = $doc->findnodes('//dataset/publisher');
-#    if ($results->size() > 10) {
- #       errMoreThanN("publisher");
- #   } else {
-        foreach $node ($results->get_nodelist) {
-            dontOccur($node, "./organizationName|./positionName|./onlineURL|./userId|./electronicMailAddress|./phone|./address", 
-                "organizationName, positionName, onlineURL, userId, electronicMailAddress, phone, address in associatedParty");
-       
-            $tempResult = $node->findnodes('./individualName');
-            if ($tempResult->size > 1) {
-                errMoreThanOne("publisher/indvidualName");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    $$templateVars{"origNamefirst$aoCount"} =  findValue($tempNode, './givenName');
-                    $$templateVars{"origNamelast$aoCount"} =  findValue($tempNode, './surName');
-                    $$templateVars{"origRole$aoCount"} = "Publisher";
-                    $aoCount++;           
-                }
-            }
-        }
-  #  }
+				debug("Recording a creator in loop 1...");
+				$$templateVars{'origNamefirst0'} =
+				  findValue( $node, 'givenName' );
+				$$templateVars{'origNamelast0'} = findValue( $node, 'surName' );
 
-  #  if ($aoCount > 11) {
-  #      errMoreThanN("Additional Originators");
- #   } 
+				my $tempResult2 = $node->findnodes('../address');
+				if ( $tempResult2->size > 1 ) {
+					errMoreThanOne("address");
+				}
+				else {
+					foreach my $tempNode2 ( $tempResult2->get_nodelist ) {
+						$$templateVars{'origDelivery'} =
+						  findValue( $tempNode2, 'deliveryPoint' );
+						$$templateVars{'origCity'} =
+						  findValue( $tempNode2, 'city' );
+						$$templateVars{'origState'} =
+						  findValue( $tempNode2, 'administrativeArea' );
+						$$templateVars{'origZIP'} =
+						  findValue( $tempNode2, 'postalCode' );
+						$$templateVars{'origCountry'} =
+						  findValue( $tempNode2, 'country' );
+					}
+				}
 
-    $$templateVars{'aoCount'} = $aoCount;
-    
-    dontOccur($doc, "./pubDate", "pubDate");
-    dontOccur($doc, "./language", "language");
-    dontOccur($doc, "./series", "series");
+				my $tempResult3 = $node->findnodes('../phone');
+				if ( $tempResult3->size > 2 ) {
+					errMoreThanN("phone");
+				}
+				else {
+					foreach my $tempNode2 ( $tempResult3->get_nodelist ) {
+						if ( $tempNode2->hasAttributes() ) {
+							my @attlist = $tempNode2->attributes();
+							if ( $attlist[0]->value eq "Fax" ) {
+								$$templateVars{'origFAX'} =
+								  $tempNode2->textContent();
+							}
+							else {
+								$$templateVars{'origPhone'} =
+								  $tempNode2->textContent();
+							}
+						}
+						else {
+							$$templateVars{'origPhone'} =
+							  $tempNode2->textContent();
+						}
+					}
+				}
+				$$templateVars{'origEmail'} =
+				  findValue( $node, '../electronicMailAddress' );
+				$$templateVars{'origNameOrg'} =
+				  findValue( $node, '../organizationName' );
+			}
+			else {
+				errMoreThanN("address, phone and electronicMailAddress");
+			}
+		}
+	}
+	foreach $node ( $results->get_nodelist ) {
+		debug("Checking a creator in loop 2...");
+		$tempResult = $node->findnodes(
+			'../address|../phone|../electronicmailAddress|../organizationName');
+		if ( $tempResult->size == 0 ) {
+			if ( $foundDSO == 0 ) {
+				debug("Recording a creator in loop 2 block A...");
+				$foundDSO = 1;
+				$$templateVars{'origNamefirst0'} =
+				  findValue( $node, 'givenName' );
+				$$templateVars{'origNamelast0'} = findValue( $node, 'surName' );
+				$$templateVars{'origNameOrg'} =
+				  findValue( $node, '../organizationName' );
+			}
+			else {
+				debug("Recording a creator in loop 2 block B...");
+				$$templateVars{"origNamefirst$aoCount"} =
+				  findValue( $node, './givenName' );
+				$$templateVars{"origNamelast$aoCount"} =
+				  findValue( $node, './surName' );
+				$$templateVars{"origRole$aoCount"} = "Originator";
+				$aoCount++;
+			}
+		}
+	}
 
-    $results = $doc->findnodes('//dataset/abstract');
-    if ($results->size() > 1) {
-        errMoreThanOne("abstract");
-    } else {
-        foreach my $node ($results->get_nodelist) {
-            dontOccur($node, "./section", "section");
-            $$templateVars{'abstract'} = findValueNoChild($node, "para");
-        }
-    }
+	$results = $doc->findnodes('//dataset/creator/organizationName');
+	my $wgroups = $doc->findnodes(
+		"//dataset/creator/organizationName[contains(text(),'(NCEAS ')]");
+	debug( "Number Org: " . $results->size() );
+	debug( " Number WG: " . $wgroups->size() );
+	if ( $results->size() - $wgroups->size() > 3 ) {
+		errMoreThanN("creator/organizationName");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			my $tempValue = findValue( $node, '../organizationName' );
+			$tempResult = $node->findnodes('../individualName');
+			if (   $tempResult->size == 0
+				&& $tempValue ne $config->{'organization'} )
+			{
+				$$templateVars{'site'} = $tempValue;
+			}
+		}
+		if ( $skinName eq 'nceas' ) {
+			my @wg;
+			foreach $node ( $results->get_nodelist ) {
+				my $tempValue = findValue( $node, '../organizationName' );
+				$wg[ scalar(@wg) ] = $tempValue;
+			}
+			my $projects = getProjectList($properties);
+			$$templateVars{'projects'} = $projects;
+			$$templateVars{'wg'}       = \@wg;
+		}
+	}
 
-    $results = $doc->findnodes('//dataset/keywordSet');
+	$results = $doc->findnodes('//dataset/metadataProvider');
+	foreach $node ( $results->get_nodelist ) {
+		dontOccur(
+			$node,
+"./organizationName|./positionName|./onlineURL|./userId|./electronicMailAddress|./phone|./address",
+"organizationName, positionName, onlineURL, userId, electronicMailAddress, phone, address in metadataProvider"
+		);
 
-    my $count = 1;
-    foreach $node ($results->get_nodelist) {
-        my $thesaurus = findValue($node, "keywordThesaurus");
-        $tempResult = $node->findnodes('./keyword');
-        foreach $tempNode ($tempResult->get_nodelist) {
-            $$templateVars{"keyword$count"} = $tempNode->textContent();
-            if ($tempNode->hasAttributes()) {
-                my @attlist = $tempNode->attributes();
-                my $tmp = $attlist[0]->value;
-                $tmp =~ s/\b(\w)/\U$1/g; # convert the first letter to upper case
-                $$templateVars{"kwType$count"} = $tmp;
-            }
-            $$templateVars{"kwTh$count"} = $thesaurus;
-            #debug("Keyword Found: $count `" . $tempNode->textContent() . "`, $thesaurus");
-            $count++;
-        }
-    }
+		$tempResult = $node->findnodes('./individualName');
+		if ( $tempResult->size > 1 ) {
+			errMoreThanOne("metadataProvider/indvidualName");
+		}
+		else {
+			foreach $tempNode ( $tempResult->get_nodelist ) {
+				if ( $$templateVars{'providerGivenName'} ne "" ) {
+					$$templateVars{"origNamefirst$aoCount"} =
+					  findValue( $tempNode, './givenName' );
+					$$templateVars{"origNamelast$aoCount"} =
+					  findValue( $tempNode, './surName' );
+					$$templateVars{"origRole$aoCount"} = "Metadata Provider";
+					$aoCount++;
+				}
+				else {
+					$$templateVars{'providerGivenName'} =
+					  findValue( $tempNode, './givenName' );
+					$$templateVars{'providerSurName'} =
+					  findValue( $tempNode, './surName' );
+				}
+			}
+		}
+	}
 
-    $$templateVars{'keyCount'} = $count;
-    if ($count > 1) {
-       $$templateVars{'hasKeyword'} = "true";
-    }
+	$results = $doc->findnodes('//dataset/associatedParty');
+	foreach $node ( $results->get_nodelist ) {
+		dontOccur(
+			$node,
+"./organizationName|./positionName|./onlineURL|./userId|./electronicMailAddress|./phone|./address",
+"organizationName, positionName, onlineURL, userId, electronicMailAddress, phone, address in associatedParty"
+		);
 
-    $results = $doc->findnodes('//dataset/additionalInfo');
-    if ($results->size() > 1) {
-        errMoreThanOne("additionalInfo");
-    } else {
-        foreach $node ($results->get_nodelist) {
-            dontOccur($node, "./section", "section");
-            $$templateVars{'addComments'} = findValueNoChild($node, "para");
-        }
-    }
+		$tempResult = $node->findnodes('./individualName');
+		if ( $tempResult->size > 1 ) {
+			errMoreThanOne("associatedParty/indvidualName");
+		}
+		else {
+			foreach $tempNode ( $tempResult->get_nodelist ) {
+				$$templateVars{"origNamefirst$aoCount"} =
+				  findValue( $tempNode, './givenName' );
+				$$templateVars{"origNamelast$aoCount"} =
+				  findValue( $tempNode, './surName' );
+				$$templateVars{"origRole$aoCount"} =
+				  findValue( $tempNode, '../role' );
+				$aoCount++;
+			}
+		}
+	}
 
-    $$templateVars{'useConstraints'} = "";
-    $results = $doc->findnodes('//dataset/intellectualRights');
-    if ($results->size() > 1) {
-        errMoreThanOne("intellectualRights");
-    } else {
-        foreach $node ($results->get_nodelist) {
-            dontOccur($node, "./section", "section in intellectualRights");
+	$results = $doc->findnodes('//dataset/publisher');
 
-            $tempResult = $node->findnodes("para");
-            if ($tempResult->size > 2) {
-                   errMoreThanN("para");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    my $childNodes = $tempNode->childNodes;
-                    if ($childNodes->size() > 1) {
-                        $error ="The tag para in intellectualRights has children which cannot be shown using the form. Please use Morpho to edit this document";    
-                        push(@errorMessages, $error);
-                    } else {
-                        #print $tempNode->nodeName().":".$tempNode->textContent();
-                        #print "\n";
-                        if ($$templateVars{'useConstraints'} eq "") {
-                            $$templateVars{'useConstraints'} = $tempNode->textContent();
-                        } else {
-                            $$templateVars{'useConstraintsOther'} = $tempNode->textContent();
-                        }
-                    }
-                }
-            }
-        }
-    }
+	#    if ($results->size() > 10) {
+	#       errMoreThanN("publisher");
+	#   } else {
+	foreach $node ( $results->get_nodelist ) {
+		dontOccur(
+			$node,
+			"./organizationName|./positionName|./onlineURL|./userId|./electronicMailAddress|./phone|./address",
+			"organizationName, positionName, onlineURL, userId, electronicMailAddress, phone, address in associatedParty"
+		);
 
-    $results = $doc->findnodes('//dataset/distribution/online');
-    if ($results->size() > 1) {
-        errMoreThanOne("distribution/online");
-    } else {
-        foreach my $tempNode ($results->get_nodelist) {
-            $$templateVars{'url'} = findValue($tempNode, "url");
-            dontOccur($tempNode, "./connection", "/distribution/online/connection");
-            dontOccur($tempNode, "./connectionDefinition", "/distribution/online/connectionDefinition");
-        }
-    }
+		$tempResult = $node->findnodes('./individualName');
+		if ( $tempResult->size > 1 ) {
+			errMoreThanOne("publisher/indvidualName");
+		}
+		else {
+			foreach $tempNode ( $tempResult->get_nodelist ) {
+				$$templateVars{"origNamefirst$aoCount"} =
+				  findValue( $tempNode, './givenName' );
+				$$templateVars{"origNamelast$aoCount"} =
+				  findValue( $tempNode, './surName' );
+				$$templateVars{"origRole$aoCount"} = "Publisher";
+				$aoCount++;
+			}
+		}
+	}
 
-    $results = $doc->findnodes('//dataset/distribution/offline');
-    if ($results->size() > 1) {
-        errMoreThanOne("distribution/online");
-    } else {
-        foreach my $tempNode ($results->get_nodelist) {
-            my $temp = findValue($tempNode, "mediumName");
-            if (substr($temp, 0, 5) eq "other") {
-                $$templateVars{'dataMedium'} = substr($temp, 0, 5);
-                $$templateVars{'dataMediumOther'} = substr($temp, 6);
-            } else {
-                $$templateVars{'dataMedium'} = $temp;
-            }
-            dontOccur($tempNode, "./mediumDensity", "/distribution/offline/mediumDensity");
-            dontOccur($tempNode, "./mediumDensityUnits", "/distribution/offline/mediumDensityUnits");
-            dontOccur($tempNode, "./mediumVolume", "/distribution/offline/mediumVolume");
-            dontOccur($tempNode, "./mediumFormat", "/distribution/offline/mediumFormat");
-            dontOccur($tempNode, "./mediumNote", "/distribution/offline/mediumNote");
-        }
-    }
+	#  }
 
-    dontOccur($doc, "./inline", "//dataset/distribution/inline");
+	#  if ($aoCount > 11) {
+	#      errMoreThanN("Additional Originators");
+	#   }
 
-    $results = $doc->findnodes('//dataset/coverage');
-    if ($results->size() > 1) {
-        errMoreThanOne("coverage");
-    } else {
-        foreach $node ($results->get_nodelist) {
-            dontOccur($node, "./temporalCoverage/rangeOfDates/beginDate/time|./temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale|./temporalCoverage/rangeOfDates/endDate/time|./temporalCoverage/rangeOfDates/endDate/alternativeTimeScale|./taxonomicCoverage/taxonomicSystem|./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/taxonomicClassification/commonName, /taxonomicCoverage/taxonomicClassification/taxonomicClassification, /geographicCoverage/datasetGPolygon, /geographicCoverage/boundingCoordinates/boundingAltitudes");
+	$$templateVars{'aoCount'} = $aoCount;
 
-            $tempResult = $node->findnodes('./temporalCoverage');
-            if ($tempResult->size > 1) {
-                   errMoreThanOne("temporalCoverage");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    my $x;
-                    my $y;
-                    my $z;
-                    my $tempdate = findValue($tempNode, "rangeOfDates/beginDate/calendarDate");
-                    ($x, $y, $z) = split("-", $tempdate); 
-                    $$templateVars{'beginningYear'} = $x;
-                    $$templateVars{'beginningMonth'} = $y;
-                    $$templateVars{'beginningDay'} = $z;
+	dontOccur( $doc, "./pubDate",  "pubDate" );
+	dontOccur( $doc, "./language", "language" );
+	dontOccur( $doc, "./series",   "series" );
 
-                    $tempdate = findValue($tempNode, "rangeOfDates/endDate/calendarDate");
-                    ($x, $y, $z) = split("-", $tempdate);
-                    $$templateVars{'endingYear'} = $x;
-                    $$templateVars{'endingMonth'} = $y;
-                    $$templateVars{'endingDay'} = $z;
+	$results = $doc->findnodes('//dataset/abstract');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("abstract");
+	}
+	else {
+		foreach my $node ( $results->get_nodelist ) {
+			dontOccur( $node, "./section", "section" );
+			$$templateVars{'abstract'} = findValueNoChild( $node, "para" );
+		}
+	}
 
-                    $tempdate = "";
-                    $tempdate = findValue($tempNode, "singleDateTime/calendarDate");
-                    if ($tempdate ne "") {
-                        ($x, $y, $z) = split("-", $tempdate);
-                        $$templateVars{'beginningYear'} = $x;
-                        $$templateVars{'beginningMonth'} = $y;
-                        $$templateVars{'beginningDay'} = $z;
-                    }
+	$results = $doc->findnodes('//dataset/keywordSet');
 
-                    $$templateVars{'hasTemporal'} = "true";
-                }
-            }
+	my $count = 1;
+	foreach $node ( $results->get_nodelist ) {
+		my $thesaurus = findValue( $node, "keywordThesaurus" );
+		$tempResult = $node->findnodes('./keyword');
+		foreach $tempNode ( $tempResult->get_nodelist ) {
+			$$templateVars{"keyword$count"} = $tempNode->textContent();
+			if ( $tempNode->hasAttributes() ) {
+				my @attlist = $tempNode->attributes();
+				my $tmp     = $attlist[0]->value;
+				$tmp =~
+				  s/\b(\w)/\U$1/g;    # convert the first letter to upper case
+				$$templateVars{"kwType$count"} = $tmp;
+			}
+			$$templateVars{"kwTh$count"} = $thesaurus;
 
-            $tempResult = $node->findnodes('./geographicCoverage');
-            if ($tempResult->size > 1) {
-                errMoreThanOne("geographicCoverage");
-            } else {
-                foreach $tempNode ($tempResult->get_nodelist) {
-                    my $geogdesc = findValue($tempNode, "geographicDescription");
-                    debug("Geogdesc from xml is: $geogdesc");
-                    $$templateVars{'geogdesc'} = $geogdesc;
-                    my $coord = findValue($tempNode, "boundingCoordinates/westBoundingCoordinate");
-                    if ($coord > 0) {
-                        #print "+";
-                        $$templateVars{'hemisphLong1'} = "E";
-                    } else {
-                        #print "-";
-                        eval($coord = $coord * -1);
-                        $$templateVars{'hemisphLong1'} = "W";
-                    }
-                    eval($$templateVars{'longDeg1'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'longMin1'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'longSec1'} = int($coord));
-                    
-                    $coord = findValue($tempNode, "boundingCoordinates/southBoundingCoordinate");
-                    if ($coord > 0) {
-                        #print "+";
-                        $$templateVars{'hemisphLat2'} = "N";
-                    } else {
-                        #print "-";
-                        eval($coord = $coord * -1);
-                        $$templateVars{'hemisphLat2'} = "S";
-                    }
-                    eval($$templateVars{'latDeg2'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'latMin2'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'latSec2'} = int($coord));
-        
-                    $coord = findValue($tempNode, "boundingCoordinates/northBoundingCoordinate");
-                    if ($coord > 0) {
-                        #print "+";
-                        $$templateVars{'hemisphLat1'} = "N";
-                    } else {
-                        #print "-";
-                        eval($coord = $coord * -1);
-                        $$templateVars{'hemisphLat1'} = "S";
-                    }
-                    eval($$templateVars{'latDeg1'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'latMin1'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'latSec1'} = int($coord));
+ 			#debug("Keyword Found: $count `" . $tempNode->textContent() . "`, $thesaurus");
+			$count++;
+		}
+	}
 
-                    $coord = findValue($tempNode, "boundingCoordinates/eastBoundingCoordinate");
-                    if ($coord > 0) {
-                        #print "+";
-                        $$templateVars{'hemisphLong2'} = "E";
-                    } else {
-                        #print "-";
-                        eval($coord = $coord * -1);
-                        $$templateVars{'hemisphLong2'} = "W";
-                    }
-                    eval($$templateVars{'longDeg2'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'longMin2'} = int($coord));
-                    eval($coord = ($coord - int($coord))*60);
-                    eval($$templateVars{'longSec2'} = int($coord));
+	$$templateVars{'keyCount'} = $count;
+	if ( $count > 1 ) {
+		$$templateVars{'hasKeyword'} = "true";
+	}
 
-                    $$templateVars{'hasSpatial'} = "true";
-                }
-            }
+	$results = $doc->findnodes('//dataset/additionalInfo');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("additionalInfo");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			dontOccur( $node, "./section", "section" );
+			$$templateVars{'addComments'} = findValueNoChild( $node, "para" );
+		}
+	}
 
-            $tempResult = $node->findnodes('./taxonomicCoverage/taxonomicClassification');
-            my $taxonIndex = 0;
-            foreach $tempNode ($tempResult->get_nodelist) {
-                $taxonIndex++;
-                my $taxonRankName = findValue($tempNode, "taxonRankName");
-                my $taxonRankValue = findValue($tempNode, "taxonRankValue");
-                $$templateVars{"taxonRankName".$taxonIndex} = $taxonRankName;
-                $$templateVars{"taxonRankValue".$taxonIndex} = $taxonRankValue;
-                $$templateVars{'hasTaxonomic'} = "true";
-            }
-            $$templateVars{'taxaCount'} = $taxonIndex;
-            my $taxaAuth = findValue($node, "./taxonomicCoverage/generalTaxonomicCoverage");
-            $$templateVars{'taxaAuth'} = $taxaAuth;
-        }
-    }
-    dontOccur($doc, "./purpose", "purpose");
-    dontOccur($doc, "./maintenance", "maintnance");
+	$$templateVars{'useConstraints'} = "";
+	$results = $doc->findnodes('//dataset/intellectualRights');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("intellectualRights");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			dontOccur( $node, "./section", "section in intellectualRights" );
 
-    $results = $doc->findnodes('//dataset/contact/individualName');
-    if ($results->size() > 1) {
-        errMoreThanOne("contact/individualName");
-    } else {
-        foreach $node ($results->get_nodelist) {
-            dontOccur($node, "../positionName|../onlineURL|../userId", 
-              "positionName, onlineURL, userId in contact tag");
-            dontOccur($node, "./saluation", "saluation in contact tag");                
-        
-            $tempResult = $node->findnodes('../address|../phone|../electronicmailAddress|../organizationName');
-            if ($tempResult->size > 0) {
-                $$templateVars{'origNamefirstContact'} = findValue($node, 'givenName');
-                $$templateVars{'origNamelastContact'} = findValue($node, 'surName');
-    
-                my $tempResult2 = $node->findnodes('../address');
-                if ($tempResult2->size > 1) {
-                    errMoreThanOne("address");
-                } else {
-                    foreach my $tempNode2 ($tempResult2->get_nodelist) {
-                        $$templateVars{'origDeliveryContact'} = findValue($tempNode2, 'deliveryPoint');
-                        $$templateVars{'origCityContact'} = findValue($tempNode2, 'city');
-                        $$templateVars{'origStateContact'} = findValue($tempNode2, 'administrativeArea');
-                        $$templateVars{'origZIPContact'} = findValue($tempNode2, 'postalCode');
-                        $$templateVars{'origCountryContact'} = findValue($tempNode2, 'country');
-                    }
-                }
-            
-                my $tempResult3 = $node->findnodes('../phone');
-                if ($tempResult3->size > 2) {
-                    errMoreThanN("phone");
-                } else {
-                    foreach my $tempNode2 ($tempResult3->get_nodelist) {
-                        if ($tempNode2->hasAttributes()) {
-                            my @attlist = $tempNode2->attributes();
-                            if ($attlist[0]->value eq "Fax") {
-                                $$templateVars{'origFAXContact'} = $tempNode2->textContent();
-                            } else {
-                                $$templateVars{'origPhoneContact'} = $tempNode2->textContent();
-                            }
-                        } else {
-                            $$templateVars{'origPhoneContact'} = $tempNode2->textContent();
-                        }
-                    }
-                }
-                $$templateVars{'origEmailContact'} = findValue($node, '../electronicMailAddress');
-                $$templateVars{'origNameOrgContact'} = findValue($node, '../organizationName');
-            } else {
-                $$templateVars{'origNamefirstContact'} = findValue($node, 'givenName');
-                $$templateVars{'origNamelastContact'} = findValue($node, 'surName');
-                $$templateVars{'origNameOrgContact'} = findValue($node, '../organizationName');
-            }
-        }
-    }
-    
-    $results = $doc->findnodes(
-            '//dataset/methods/methodStep/description/section');
-    debug("Number methods: ".$results->size());
-    if ($results->size() > 1) {
-        errMoreThanN("methods/methodStep/description/section");    
-    } else {
-        my @methodPara;
-        foreach $node ($results->get_nodelist) {
-            my @children = $node->childNodes;
-            for (my $i = 0; $i < scalar(@children); $i++) {
-                debug("Method child loop ($i)");
-                my $child = $children[$i];
-                if ($child->nodeName eq 'title') {
-                    my $title = $child->textContent();
-                    debug("Method title ($title)");
-                    $$templateVars{'methodTitle'} = $title;
-                } elsif ($child->nodeName eq 'para') {
-                    my $para = $child->textContent();
-                    debug("Method para ($para)");
-                    $methodPara[scalar(@methodPara)] = $para;
-                }
-            }
-            $$templateVars{'hasMethod'} = "true";
-        }
-        if (scalar(@methodPara) > 0) {
-            $$templateVars{'methodPara'} = \@methodPara;
-        }
-    }
+			$tempResult = $node->findnodes("para");
+			if ( $tempResult->size > 2 ) {
+				errMoreThanN("para");
+			}
+			else {
+				foreach $tempNode ( $tempResult->get_nodelist ) {
+					my $childNodes = $tempNode->childNodes;
+					if ( $childNodes->size() > 1 ) {
+						$error = "The tag para in intellectualRights has children which cannot be shown using the form. Please use Morpho to edit this document";
+						push( @errorMessages, $error );
+					}
+					else {
 
-    $results = $doc->findnodes(
-            '//dataset/methods/sampling/studyExtent/description/para');
-    if ($results->size() > 1) {
-        errMoreThanN("methods/sampling/studyExtent/description/para");    
-    } else {
-        foreach $node ($results->get_nodelist) {
-            my $studyExtentDescription = $node->textContent();
-            $$templateVars{'studyExtentDescription'} = $studyExtentDescription;
-            $$templateVars{'hasMethod'} = "true";
-        }
-    }
+					  #print $tempNode->nodeName().":".$tempNode->textContent();
+					  #print "\n";
+						if ( $$templateVars{'useConstraints'} eq "" ) {
+							$$templateVars{'useConstraints'} =
+							  $tempNode->textContent();
+						}
+						else {
+							$$templateVars{'useConstraintsOther'} =
+							  $tempNode->textContent();
+						}
+					}
+				}
+			}
+		}
+	}
 
-    $results = $doc->findnodes(
-            '//dataset/methods/sampling/samplingDescription/para');
-    if ($results->size() > 1) {
-        errMoreThanN("methods/sampling/samplingDescription/para");    
-    } else {
-        foreach $node ($results->get_nodelist) {
-            my $samplingDescription = $node->textContent();
-            $$templateVars{'samplingDescription'} = $samplingDescription;
-            $$templateVars{'hasMethod'} = "true";
-        }
-    }
+	$results = $doc->findnodes('//dataset/distribution/online');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("distribution/online");
+	}
+	else {
+		foreach my $tempNode ( $results->get_nodelist ) {
+			$$templateVars{'url'} = findValue( $tempNode, "url" );
+			dontOccur( $tempNode, "./connection",
+				"/distribution/online/connection" );
+			dontOccur( $tempNode, "./connectionDefinition",
+				"/distribution/online/connectionDefinition" );
+		}
+	}
 
-    dontOccur($doc, "//methodStep/citation", "methodStep/citation");
-    dontOccur($doc, "//methodStep/protocol", "methodStep/protocol");
-    dontOccur($doc, "//methodStep/instrumentation", "methodStep/instrumentation");
-    dontOccur($doc, "//methodStep/software", "methodStep/software");
-    dontOccur($doc, "//methodStep/subStep", "methodStep/subStep");
-    dontOccur($doc, "//methodStep/dataSource", "methodStep/dataSource");
-    dontOccur($doc, "//methods/qualityControl", "methods/qualityControl");
+	$results = $doc->findnodes('//dataset/distribution/offline');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("distribution/online");
+	}
+	else {
+		foreach my $tempNode ( $results->get_nodelist ) {
+			my $temp = findValue( $tempNode, "mediumName" );
+			if ( substr( $temp, 0, 5 ) eq "other" ) {
+				$$templateVars{'dataMedium'} = substr( $temp, 0, 5 );
+				$$templateVars{'dataMediumOther'} = substr( $temp, 6 );
+			}
+			else {
+				$$templateVars{'dataMedium'} = $temp;
+			}
+			dontOccur( $tempNode, "./mediumDensity",
+				"/distribution/offline/mediumDensity" );
+			dontOccur( $tempNode, "./mediumDensityUnits",
+				"/distribution/offline/mediumDensityUnits" );
+			dontOccur( $tempNode, "./mediumVolume",
+				"/distribution/offline/mediumVolume" );
+			dontOccur( $tempNode, "./mediumFormat",
+				"/distribution/offline/mediumFormat" );
+			dontOccur( $tempNode, "./mediumNote",
+				"/distribution/offline/mediumNote" );
+		}
+	}
 
-    dontOccur($doc, "//methods/sampling/spatialSamplingUnits", "methods/sampling/spatialSamplingUnits");
-    dontOccur($doc, "//methods/sampling/citation", "methods/sampling/citation");
-    dontOccur($doc, "./pubPlace", "pubPlace");
-    dontOccur($doc, "./project", "project");
-    
-    # Code for checking ACL: with EML 2.1, we should only look within the top-level elements
+	dontOccur( $doc, "./inline", "//dataset/distribution/inline" );
 
-    dontOccur($doc, "/eml:eml/access/deny", "access/deny");
+	$results = $doc->findnodes('//dataset/coverage');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("coverage");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			dontOccur(
+				$node,
+				"./temporalCoverage/rangeOfDates/beginDate/time|./temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale|./temporalCoverage/rangeOfDates/endDate/time|./temporalCoverage/rangeOfDates/endDate/alternativeTimeScale|./taxonomicCoverage/taxonomicSystem|./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/taxonomicClassification/commonName, /taxonomicCoverage/taxonomicClassification/taxonomicClassification, /geographicCoverage/datasetGPolygon, /geographicCoverage/boundingCoordinates/boundingAltitudes"
+			);
 
-    $results = $doc->findnodes('/eml:eml/access/allow');
-    my $accessError = 0;
-    my $docOwner;
+			$tempResult = $node->findnodes('./temporalCoverage');
+			if ( $tempResult->size > 1 ) {
+				errMoreThanOne("temporalCoverage");
+			}
+			else {
+				foreach $tempNode ( $tempResult->get_nodelist ) {
+					my $x;
+					my $y;
+					my $z;
+					my $tempdate = findValue( $tempNode,
+						"rangeOfDates/beginDate/calendarDate" );
+					( $x, $y, $z ) = split( "-", $tempdate );
+					$$templateVars{'beginningYear'}  = $x;
+					$$templateVars{'beginningMonth'} = $y;
+					$$templateVars{'beginningDay'}   = $z;
 
-    foreach $node ($results->get_nodelist) {
-        my @children = $node->childNodes;
-        my $permission = "";
-        my $principal = "";
-        for (my $i = 0; $i < scalar(@children); $i++) {
-            my $child = $children[$i];
-            if ($child->nodeName eq 'principal') {
-                $principal = $child->textContent();
-            } elsif ($child->nodeName eq 'permission') {
-                $permission = $child->textContent();
-            }
-        }
-        # if the principal is any one of the moderators, the script will handle it
-        my @admins;
-        foreach (split(":", $moderators)) {
-            push(@admins, $_);
-        }
-        push(@admins, $adminUsername);
+					$tempdate = findValue( $tempNode,
+						"rangeOfDates/endDate/calendarDate" );
+					( $x, $y, $z ) = split( "-", $tempdate );
+					$$templateVars{'endingYear'}  = $x;
+					$$templateVars{'endingMonth'} = $y;
+					$$templateVars{'endingDay'}   = $z;
 
-        if ($principal eq 'public' && $permission ne 'read') { $accessError = 1; }
-        if ($principal eq $adminUsername && $permission ne 'all') { $accessError = 2; }
-        if ($principal ne 'public' && !grep {$_ eq $principal} @admins && $permission ne 'all') { 
-            $accessError = 3;
-            $docOwner = $principal;
-        }
-        # TODO: FIXME for 1.9.1
-        # The ESA skin has a separate concept of 'moderator', which is defined by a property
-        # within the configuration. This should be updated to check the user against the groups.
-        # my $isSkinModerator = 0;
-        # my $userGroups = metacat->getGroups($username');
-        #foreach my $mod (split(":", $moderators) {
-        #    foreach $my $ug (split(":", $userGroups)) {
-        #       if ($ug == $mod) {
-        #           $isSkinModerator = 1;
-        #       }
-        #    }
-        #}
-        # if (!$isSkinModerator) {
-        #   $accessError = 3;
-        # }
-        if ($accessError == 3) {
-            my ($username, $password) = getCredentials();
-            if ($principal eq $username) {
-                $accessError = 0;
-            }
-        }
-    }
+					$tempdate = "";
+					$tempdate =
+					  findValue( $tempNode, "singleDateTime/calendarDate" );
+					if ( $tempdate ne "" ) {
+						( $x, $y, $z ) = split( "-", $tempdate );
+						$$templateVars{'beginningYear'}  = $x;
+						$$templateVars{'beginningMonth'} = $y;
+						$$templateVars{'beginningDay'}   = $z;
+					}
 
-    if ($accessError != 0) {
-        my $error;
-        if ($accessError == 3) {
-            $error = "You don't have permission to edit this document, which is owned by $docOwner. (Access Error #3)\n";
-        } else {
-            my $error = "The ACL for this document has been changed outside the registry. Please use Morpho to edit this document (Access Error #$accessError).\n";
-        }
-        push(@errorMessages, $error);
-    }
+					$$templateVars{'hasTemporal'} = "true";
+				}
+			}
 
-    # handle otherEntity objects, by populating the relevant file form elements
-    $results = $doc->findnodes('//otherEntity/physical');
-    my $upCount = 0;
-    foreach $node ($results->get_nodelist) {
-        my $distUrl = findValue($node, 'distribution/online/url');
-        debug("Found distUrl of value $distUrl.");
-        if ($distUrl !~ /^ecogrid/) {
-            my $error = "The file URL referenced is not a local resource and has been changed outside the registry. Please use Morpho to edit this document.";
-            push(@errorMessages, $error."\n");
-        } else {
-            # have a file with a ecogrid distUrl, use this to set up the file parameters
-            $distUrl =~ s/ecogrid:\/\/knb\///g;           
-            my $accessResults = $doc->findnodes('distribution/access/allow');
-            my $accessRule = 'private';
+			$tempResult = $node->findnodes('./geographicCoverage');
+			if ( $tempResult->size > 1 ) {
+				errMoreThanOne("geographicCoverage");
+			}
+			else {
+				foreach $tempNode ( $tempResult->get_nodelist ) {
+					my $geogdesc =
+					  findValue( $tempNode, "geographicDescription" );
+					debug("Geogdesc from xml is: $geogdesc");
+					$$templateVars{'geogdesc'} = $geogdesc;
+					my $coord = findValue( $tempNode,
+						"boundingCoordinates/westBoundingCoordinate" );
+					if ( $coord > 0 ) {
 
-            foreach $node ($accessResults->get_nodelist) {
-                my @children = $node->childNodes;
-                my $permission = "";
-                my $principal = "";
-                for (my $i = 0; $i < scalar(@children); $i++) {
-                    my $child = $children[$i];
-                    if ($child->nodeName eq 'principal') {
-                        $principal = $child->textContent();
-                    } elsif ($child->nodeName eq 'permission') {
-                        $permission = $child->textContent();
-                    }
-                }
+						#print "+";
+						$$templateVars{'hemisphLong1'} = "E";
+					}
+					else {
 
-                if ($principal eq 'public' && $permission eq 'read') {
-                    $accessRule = 'public';
-                } 
-            }
-            # overload the name with the ondisk status, the docid and the SHA1 sum
-            $$templateVars{"upload_$upCount"} = "ondisk:$distUrl:" . findValue($node, 'authentication');
-            $$templateVars{"uploadname_$upCount"} = findValue($node, 'objectName');
-            $$templateVars{"uploadtype_$upCount"} = findValue($node, 'dataFormat/externallyDefinedFormat/formatName');
-            $$templateVars{"uploadperm_$upCount"} = $accessRule;
-            debug("Setting upload data: " . $$templateVars{"upload_$upCount"} . ", " . $$templateVars{"uploadname_$upCount"} . ", " . $$templateVars{"uploadtype_$upCount"} . ", " . $$templateVars{"uploadperm_$upCount"});
-            $upCount++;
-        }
-    }
-    if ($upCount > 0) {
-        $$templateVars{"upCount"} = $upCount;
-    }
+						#print "-";
+						eval( $coord = $coord * -1 );
+						$$templateVars{'hemisphLong1'} = "W";
+					}
+					eval( $$templateVars{'longDeg1'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'longMin1'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'longSec1'} = int($coord) );
 
-    dontOccur($doc, "./dataTable", "dataTable");
-    dontOccur($doc, "./spatialRaster", "spatialRaster");
-    dontOccur($doc, "./spatialVector", "spatialVector");
-    dontOccur($doc, "./storedProcedure", "storedProcedure");
-    dontOccur($doc, "./view", "view");
-    dontOccur($doc, "./references", "references");
-    
-    dontOccur($doc, "//citation", "citation");
-    dontOccur($doc, "//software", "software");
-    dontOccur($doc, "//protocol", "protocol");
-    $results = $doc->findnodes(
-            '//additionalMetadata/metadata/moderatorComment');
-    if ($results->size == 0) {
-        dontOccur($doc, "//additionalMetadata", "additionalMetadata");
-    }
+					$coord = findValue( $tempNode,
+						"boundingCoordinates/southBoundingCoordinate" );
+					if ( $coord > 0 ) {
+
+						#print "+";
+						$$templateVars{'hemisphLat2'} = "N";
+					}
+					else {
+
+						#print "-";
+						eval( $coord = $coord * -1 );
+						$$templateVars{'hemisphLat2'} = "S";
+					}
+					eval( $$templateVars{'latDeg2'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'latMin2'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'latSec2'} = int($coord) );
+
+					$coord = findValue( $tempNode,
+						"boundingCoordinates/northBoundingCoordinate" );
+					if ( $coord > 0 ) {
+
+						#print "+";
+						$$templateVars{'hemisphLat1'} = "N";
+					}
+					else {
+
+						#print "-";
+						eval( $coord = $coord * -1 );
+						$$templateVars{'hemisphLat1'} = "S";
+					}
+					eval( $$templateVars{'latDeg1'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'latMin1'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'latSec1'} = int($coord) );
+
+					$coord = findValue( $tempNode,
+						"boundingCoordinates/eastBoundingCoordinate" );
+					if ( $coord > 0 ) {
+
+						#print "+";
+						$$templateVars{'hemisphLong2'} = "E";
+					}
+					else {
+
+						#print "-";
+						eval( $coord = $coord * -1 );
+						$$templateVars{'hemisphLong2'} = "W";
+					}
+					eval( $$templateVars{'longDeg2'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'longMin2'} = int($coord) );
+					eval( $coord = ( $coord - int($coord) ) * 60 );
+					eval( $$templateVars{'longSec2'} = int($coord) );
+
+					$$templateVars{'hasSpatial'} = "true";
+				}
+			}
+
+			$tempResult =
+			  $node->findnodes('./taxonomicCoverage/taxonomicClassification');
+			my $taxonIndex = 0;
+			foreach $tempNode ( $tempResult->get_nodelist ) {
+				$taxonIndex++;
+				my $taxonRankName  = findValue( $tempNode, "taxonRankName" );
+				my $taxonRankValue = findValue( $tempNode, "taxonRankValue" );
+				$$templateVars{ "taxonRankName" . $taxonIndex } =
+				  $taxonRankName;
+				$$templateVars{ "taxonRankValue" . $taxonIndex } =
+				  $taxonRankValue;
+				$$templateVars{'hasTaxonomic'} = "true";
+			}
+			$$templateVars{'taxaCount'} = $taxonIndex;
+			my $taxaAuth = findValue( $node,
+				"./taxonomicCoverage/generalTaxonomicCoverage" );
+			$$templateVars{'taxaAuth'} = $taxaAuth;
+		}
+	}
+	dontOccur( $doc, "./purpose",     "purpose" );
+	dontOccur( $doc, "./maintenance", "maintnance" );
+
+	$results = $doc->findnodes('//dataset/contact/individualName');
+	if ( $results->size() > 1 ) {
+		errMoreThanOne("contact/individualName");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			dontOccur(
+				$node,
+				"../positionName|../onlineURL|../userId",
+				"positionName, onlineURL, userId in contact tag"
+			);
+			dontOccur( $node, "./saluation", "saluation in contact tag" );
+
+			$tempResult = $node->findnodes(
+'../address|../phone|../electronicmailAddress|../organizationName'
+			);
+			if ( $tempResult->size > 0 ) {
+				$$templateVars{'origNamefirstContact'} =
+				  findValue( $node, 'givenName' );
+				$$templateVars{'origNamelastContact'} =
+				  findValue( $node, 'surName' );
+
+				my $tempResult2 = $node->findnodes('../address');
+				if ( $tempResult2->size > 1 ) {
+					errMoreThanOne("address");
+				}
+				else {
+					foreach my $tempNode2 ( $tempResult2->get_nodelist ) {
+						$$templateVars{'origDeliveryContact'} =
+						  findValue( $tempNode2, 'deliveryPoint' );
+						$$templateVars{'origCityContact'} =
+						  findValue( $tempNode2, 'city' );
+						$$templateVars{'origStateContact'} =
+						  findValue( $tempNode2, 'administrativeArea' );
+						$$templateVars{'origZIPContact'} =
+						  findValue( $tempNode2, 'postalCode' );
+						$$templateVars{'origCountryContact'} =
+						  findValue( $tempNode2, 'country' );
+					}
+				}
+
+				my $tempResult3 = $node->findnodes('../phone');
+				if ( $tempResult3->size > 2 ) {
+					errMoreThanN("phone");
+				}
+				else {
+					foreach my $tempNode2 ( $tempResult3->get_nodelist ) {
+						if ( $tempNode2->hasAttributes() ) {
+							my @attlist = $tempNode2->attributes();
+							if ( $attlist[0]->value eq "Fax" ) {
+								$$templateVars{'origFAXContact'} =
+								  $tempNode2->textContent();
+							}
+							else {
+								$$templateVars{'origPhoneContact'} =
+								  $tempNode2->textContent();
+							}
+						}
+						else {
+							$$templateVars{'origPhoneContact'} =
+							  $tempNode2->textContent();
+						}
+					}
+				}
+				$$templateVars{'origEmailContact'} =
+				  findValue( $node, '../electronicMailAddress' );
+				$$templateVars{'origNameOrgContact'} =
+				  findValue( $node, '../organizationName' );
+			}
+			else {
+				$$templateVars{'origNamefirstContact'} =
+				  findValue( $node, 'givenName' );
+				$$templateVars{'origNamelastContact'} =
+				  findValue( $node, 'surName' );
+				$$templateVars{'origNameOrgContact'} =
+				  findValue( $node, '../organizationName' );
+			}
+		}
+	}
+
+	$results =
+	  $doc->findnodes('//dataset/methods/methodStep/description/section');
+	debug( "Number methods: " . $results->size() );
+	if ( $results->size() > 1 ) {
+		errMoreThanN("methods/methodStep/description/section");
+	}
+	else {
+		my @methodPara;
+		foreach $node ( $results->get_nodelist ) {
+			my @children = $node->childNodes;
+			for ( my $i = 0 ; $i < scalar(@children) ; $i++ ) {
+				debug("Method child loop ($i)");
+				my $child = $children[$i];
+				if ( $child->nodeName eq 'title' ) {
+					my $title = $child->textContent();
+					debug("Method title ($title)");
+					$$templateVars{'methodTitle'} = $title;
+				}
+				elsif ( $child->nodeName eq 'para' ) {
+					my $para = $child->textContent();
+					debug("Method para ($para)");
+					$methodPara[ scalar(@methodPara) ] = $para;
+				}
+			}
+			$$templateVars{'hasMethod'} = "true";
+		}
+		if ( scalar(@methodPara) > 0 ) {
+			$$templateVars{'methodPara'} = \@methodPara;
+		}
+	}
+
+	$results = $doc->findnodes(
+		'//dataset/methods/sampling/studyExtent/description/para');
+	if ( $results->size() > 1 ) {
+		errMoreThanN("methods/sampling/studyExtent/description/para");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			my $studyExtentDescription = $node->textContent();
+			$$templateVars{'studyExtentDescription'} = $studyExtentDescription;
+			$$templateVars{'hasMethod'}              = "true";
+		}
+	}
+
+	$results =
+	  $doc->findnodes('//dataset/methods/sampling/samplingDescription/para');
+	if ( $results->size() > 1 ) {
+		errMoreThanN("methods/sampling/samplingDescription/para");
+	}
+	else {
+		foreach $node ( $results->get_nodelist ) {
+			my $samplingDescription = $node->textContent();
+			$$templateVars{'samplingDescription'} = $samplingDescription;
+			$$templateVars{'hasMethod'}           = "true";
+		}
+	}
+
+	dontOccur( $doc, "//methodStep/citation", "methodStep/citation" );
+	dontOccur( $doc, "//methodStep/protocol", "methodStep/protocol" );
+	dontOccur( $doc, "//methodStep/instrumentation",
+		"methodStep/instrumentation" );
+	dontOccur( $doc, "//methodStep/software",    "methodStep/software" );
+	dontOccur( $doc, "//methodStep/subStep",     "methodStep/subStep" );
+	dontOccur( $doc, "//methodStep/dataSource",  "methodStep/dataSource" );
+	dontOccur( $doc, "//methods/qualityControl", "methods/qualityControl" );
+
+	dontOccur(
+		$doc,
+		"//methods/sampling/spatialSamplingUnits",
+		"methods/sampling/spatialSamplingUnits"
+	);
+	dontOccur( $doc, "//methods/sampling/citation",
+		"methods/sampling/citation" );
+	dontOccur( $doc, "./pubPlace", "pubPlace" );
+	dontOccur( $doc, "./project",  "project" );
+
+	# Code for checking ACL: with EML 2.1, we should only look within the top-level elements
+	#debug("checking user access");
+	dontOccur( $doc, "/eml:eml/access/deny", "access/deny" );
+
+	$results = $doc->findnodes('/eml:eml/access/allow');
+	my $accessError = 0;
+	my $accessGranted = 0;
+	my $docOwner;
+	my $errorMessage;
+
+	my @admins;
+	foreach ( split( ":", $moderators ) ) {
+		push( @admins, $_ );
+		#debug("getting moderator: $_");
+	}
+	push( @admins, $adminUsername );
+
+	#debug("getting user groups for current user");
+	
+	my @userGroups = getUserGroups();
+
+	foreach $node ( $results->get_nodelist ) {
+		my @children   = $node->childNodes;
+		my $permission = "";
+		my $principal  = "";
+		for ( my $i = 0 ; $i < scalar(@children) ; $i++ ) {
+			my $child = $children[$i];
+			if ( $child->nodeName eq 'principal' ) {
+				$principal = $child->textContent();
+			}
+			elsif ( $child->nodeName eq 'permission' ) {
+				$permission = $child->textContent();
+			}
+		}
+		
+		if (($principal eq 'public') && ($permission ne 'read')) {
+			# If the principal is 'public' and the permission is not 'read' then this document
+	    	# could not have been created in the registry. 
+			$errorMessage = "The ACL for this document has been changed outside the registry. Please use Morpho to edit this document (Access Error: public principal cannot have $permission permission).\n";
+			$accessError = 1;
+			debug($errorMessage);
+		} 
+		if (($principal eq $adminUsername) && ($permission ne 'all')) {
+			# If the principal is the admin and permission is not 'all' then this document
+	    	# could not have been created in the registry. 
+			$errorMessage = "The ACL for this document has been changed outside the registry. Please use Morpho to edit this document (Access Error: admin principal cannot have $permission permission).\n";
+			$accessError = 1;
+			debug($errorMessage);
+		} 
+
+		# no access error in doc, if principal is not equal to public and permission is 
+		# 'all' (requirements in registry) then try and determine if user has access
+		if (!$accessError && ($principal ne 'public') && ($permission eq 'all' || $permission eq 'write')) {
+			my ($username, $password) = getCredentials();
+						
+			# 1) check if user matches principal
+			#debug("does user $username match principal $principal?");
+			if ($principal eq $username) {
+				$accessGranted = 1;	
+				#debug("Access granted: user $username matches principal");
+			}
+						
+			# 2) if access not granted, check if user group matches principal			
+			if (!$accessGranted) {
+				#debug("is one of the user groups @userGroups the principal $principal?");
+				for my $userGroup (@userGroups) {
+      				if ($userGroup == $principal) {
+           				$accessGranted = 1;
+           				#debug("Access granted: user group $userGroup matches principal");
+           				last;
+       				}
+				}
+			}	
+		}		
+				
+		# if there was an access error, we know this is not a valid registry doc.  No need to
+		# continue looking at access sections in doc.  Same it true if we were granted access
+		# already.
+		if ( $accessError || $accessGranted ) {
+			last;
+		}
+	}
+	
+	if (!$accessError) {	
+		my ($username, $password) = getCredentials();
+		
+		# 3) if access not granted, check if the user is a moderator or admin
+		if (!$accessGranted) {
+			#debug("is user $username in admins @admins?");
+			if (grep { $_ eq $username } @admins) {
+				$accessGranted = 1;
+				#debug("Access granted: user $username is an admin or moderator");
+			}
+		}
+		
+		# 4) if access not granted, check if user group in moderator/admin list
+		if (!$accessGranted) {
+			#debug("is one of the user groups @userGroups in admins @admins?");
+			foreach my $userGroup (split(":", @userGroups)) {
+				if (grep {$_ eq $userGroup} @admins) {
+					$accessGranted = 1;
+					#debug("Access granted: user group $userGroup is an admin or moderator");
+					last;
+				}
+			}
+		}	
+	
+		# 5) if access not granted, and there was no other error, the user is not authorized. 
+		# Set accessError to true and set the error string
+		if (!$accessError && !$accessGranted) {
+			$errorMessage = "User $username is not authorized to access document\n";
+			$accessError = 1;
+		}
+	}
+
+	# push the error message, if any
+	if ( $accessError ) {
+		#debug($errorMessage);
+		push( @errorMessages, $errorMessage );
+	}
+
+	# handle otherEntity objects, by populating the relevant file form elements
+	$results = $doc->findnodes('//otherEntity/physical');
+	my $upCount = 0;
+	foreach $node ( $results->get_nodelist ) {
+		my $distUrl = findValue( $node, 'distribution/online/url' );
+		debug("Found distUrl of value $distUrl.");
+		if ( $distUrl !~ /^ecogrid/ ) {
+			my $error = "The file URL referenced is not a local resource and has been changed outside the registry. Please use Morpho to edit this document.";
+			push( @errorMessages, $error . "\n" );
+		}
+		else {
+
+			# have a file with a ecogrid distUrl, use this to set up the file parameters
+			$distUrl =~ s/ecogrid:\/\/knb\///g;
+			my $accessResults = $doc->findnodes('distribution/access/allow');
+			my $accessRule    = 'private';
+
+			foreach $node ( $accessResults->get_nodelist ) {
+				my @children   = $node->childNodes;
+				my $permission = "";
+				my $principal  = "";
+				for ( my $i = 0 ; $i < scalar(@children) ; $i++ ) {
+					my $child = $children[$i];
+					if ( $child->nodeName eq 'principal' ) {
+						$principal = $child->textContent();
+					}
+					elsif ( $child->nodeName eq 'permission' ) {
+						$permission = $child->textContent();
+					}
+				}
+
+				if ( $principal eq 'public' && $permission eq 'read' ) {
+					$accessRule = 'public';
+				}
+			}
+
+		  # overload the name with the ondisk status, the docid and the SHA1 sum
+			$$templateVars{"upload_$upCount"} =
+			  "ondisk:$distUrl:" . findValue( $node, 'authentication' );
+			$$templateVars{"uploadname_$upCount"} =
+			  findValue( $node, 'objectName' );
+			$$templateVars{"uploadtype_$upCount"} = findValue( $node,
+				'dataFormat/externallyDefinedFormat/formatName' );
+			$$templateVars{"uploadperm_$upCount"} = $accessRule;
+			debug(  "Setting upload data: "
+				  . $$templateVars{"upload_$upCount"} . ", "
+				  . $$templateVars{"uploadname_$upCount"} . ", "
+				  . $$templateVars{"uploadtype_$upCount"} . ", "
+				  . $$templateVars{"uploadperm_$upCount"} );
+			$upCount++;
+		}
+	}
+	if ( $upCount > 0 ) {
+		$$templateVars{"upCount"} = $upCount;
+	}
+
+	dontOccur( $doc, "./dataTable",       "dataTable" );
+	dontOccur( $doc, "./spatialRaster",   "spatialRaster" );
+	dontOccur( $doc, "./spatialVector",   "spatialVector" );
+	dontOccur( $doc, "./storedProcedure", "storedProcedure" );
+	dontOccur( $doc, "./view",            "view" );
+	dontOccur( $doc, "./references",      "references" );
+
+	dontOccur( $doc, "//citation", "citation" );
+	dontOccur( $doc, "//software", "software" );
+	dontOccur( $doc, "//protocol", "protocol" );
+	$results =
+	  $doc->findnodes('//additionalMetadata/metadata/moderatorComment');
+	if ( $results->size == 0 ) {
+		dontOccur( $doc, "//additionalMetadata", "additionalMetadata" );
+	}
 }
 
 ################################################################################
-# 
-# Delete the eml file that has been requested for deletion. 
 #
+# Delete the eml file that has been requested for deletion.
+#
 ################################################################################
 sub deleteData {
-    my $deleteAll = shift;
-    
-    # create metacat instance
-    my $metacat = Metacat->new($metacatUrl);
-    my $docid = $FORM::docid;
-    
-    # Login to metacat
-    my $errorMessage = "";
-    my ($username, $password) = getCredentials();
-    my $response = $metacat->login($username, $password);
+	my $deleteAll = shift;
 
-    if (! $response) {
-    # Could not login
-        push(@errorMessages, $metacat->getMessage());
-        push(@errorMessages, "Failed during login.\n");
+	# create metacat instance
+	my $metacat = Metacat->new($metacatUrl);
+	my $docid   = $FORM::docid;
 
-    } else {
-    #Able to login - try to delete the file    
+	# Login to metacat
+	my $errorMessage = "";
+	my ( $username, $password ) = getCredentials();
+	my $response = $metacat->login( $username, $password );
 
-    my $parser;
-    my @fileArray;
-    my $httpMessage;
-    my $xmldoc;
-    my $doc;
-    my $pushDoc;
-    my $alreadyInArray;
-    my $findType;
-    my $node;
-    my $element;
+	if ( !$response ) {
 
-    push (@fileArray, $docid);
-    $parser = XML::LibXML->new();
+		# Could not login
+		push( @errorMessages, $metacat->getMessage() );
+		push( @errorMessages, "Failed during login.\n" );
 
-    $httpMessage = $metacat->read($docid);
-    $doc = $httpMessage->content();    
-    $doc = delNormalize($doc);
-    $xmldoc = $parser->parse_string($doc);
+	}
+	else {
 
-    if ($xmldoc eq "") {
-        $error ="Error in parsing the eml document";
-        push(@errorMessages, $error);
-    } else {
+		#Able to login - try to delete the file
 
-        $findType = $xmldoc->findnodes('//dataset/identifier');
-        if ($findType->size() > 0) {
-            # This is a eml beta6 document
-            # Delete the documents mentioned in triples also
+		my $parser;
+		my @fileArray;
+		my $httpMessage;
+		my $xmldoc;
+		my $doc;
+		my $pushDoc;
+		my $alreadyInArray;
+		my $findType;
+		my $node;
+		my $element;
 
-            $findType = $xmldoc->findnodes('//dataset/triple');
-            if ($findType->size() > 0) {
-                foreach $node ($findType->get_nodelist) {
-                    $pushDoc = findValue($node, 'subject');
+		push( @fileArray, $docid );
+		$parser = XML::LibXML->new();
 
-                    # If the file is already in the @fileArray then do not add it 
-                    $alreadyInArray = 0;
-                    foreach $element (@fileArray) {
-                        if ($element eq $pushDoc) {
-                            $alreadyInArray = 1;
-                        }
-                    }
+		$httpMessage = $metacat->read($docid);
+		$doc         = $httpMessage->content();
+		$doc         = delNormalize($doc);
+		$xmldoc      = $parser->parse_string($doc);
 
-                    if (!$alreadyInArray) {
-                        # If not already in array then delete the file. 
-                        push (@fileArray, $pushDoc);
-                        $response = $metacat->delete($pushDoc);
-                        
-                        if (!$response) {
-                            # Could not delete
-                            push(@errorMessages, $metacat->getMessage());
-                            push(@errorMessages, "Failed during deleting $pushDoc. Please check if you are authorized to delete this document.\n");
-                        }
-                    }
-                }
-            }
-        }
-    }
+		if ( $xmldoc eq "" ) {
+			$error = "Error in parsing the eml document";
+			push( @errorMessages, $error );
+		}
+		else {
 
-    # Delete the main document. 
-    if ($deleteAll) {
-        $response = $metacat->delete($docid);
-        if (! $response) {
-            # Could not delete
-            push(@errorMessages, $metacat->getMessage());
-            push(@errorMessages, "Failed during deleting $docid. Please check if you are authorized to delete this document.\n");
-        }
-    }
-    }
+			$findType = $xmldoc->findnodes('//dataset/identifier');
+			if ( $findType->size() > 0 ) {
 
-    if (scalar(@errorMessages)) {
-        # If any errors, print them in the response template 
-        $$templateVars{'status'} = 'failure';
-        $$templateVars{'errorMessages'} = \@errorMessages;
-        $error = 1;
-    }
+				# This is a eml beta6 document
+				# Delete the documents mentioned in triples also
 
-    # Process the response template
-    if ($deleteAll) {
-        $$templateVars{'function'} = "deleted";
-        $$templateVars{'section'} = "Deletion Status";
-        $template->process($templates->{'response'}, $templateVars);
-    }
+				$findType = $xmldoc->findnodes('//dataset/triple');
+				if ( $findType->size() > 0 ) {
+					foreach $node ( $findType->get_nodelist ) {
+						$pushDoc = findValue( $node, 'subject' );
+
+				   # If the file is already in the @fileArray then do not add it
+						$alreadyInArray = 0;
+						foreach $element (@fileArray) {
+							if ( $element eq $pushDoc ) {
+								$alreadyInArray = 1;
+							}
+						}
+
+						if ( !$alreadyInArray ) {
+
+							# If not already in array then delete the file.
+							push( @fileArray, $pushDoc );
+							$response = $metacat->delete($pushDoc);
+
+							if ( !$response ) {
+
+								# Could not delete
+								push( @errorMessages, $metacat->getMessage() );
+								push( @errorMessages,
+"Failed during deleting $pushDoc. Please check if you are authorized to delete this document.\n"
+								);
+							}
+						}
+					}
+				}
+			}
+		}
+
+		# Delete the main document.
+		if ($deleteAll) {
+			$response = $metacat->delete($docid);
+			if ( !$response ) {
+
+				# Could not delete
+				push( @errorMessages, $metacat->getMessage() );
+				push( @errorMessages,
+"Failed during deleting $docid. Please check if you are authorized to delete this document.\n"
+				);
+			}
+		}
+	}
+
+	if ( scalar(@errorMessages) ) {
+
+		# If any errors, print them in the response template
+		$$templateVars{'status'}        = 'failure';
+		$$templateVars{'errorMessages'} = \@errorMessages;
+		$error                          = 1;
+	}
+
+	# Process the response template
+	if ($deleteAll) {
+		$$templateVars{'function'} = "deleted";
+		$$templateVars{'section'}  = "Deletion Status";
+		$template->process( $templates->{'response'}, $templateVars );
+	}
 }
 
 ################################################################################
-# 
-# function to handle login request  
 #
+# function to handle login request
+#
 ################################################################################
-sub handleLoginRequest(){
-    # Check if a session already exists
-    my $session = CGI::Session->load() or die CGI::Session->errstr();
-    if ($session->is_empty) {
-        # no session found ... check if the login is correct
-        my $username = $FORM::username;
-        my $password = $FORM::password;
+sub handleLoginRequest() {
 
-        my $metacat = Metacat->new($metacatUrl);
-        my $returnVal = $metacat->login($username, $password);
-        debug("Login was $returnVal for login attempt to $metacatUrl, with $username");
-        if ($returnVal > 0) {
-            # valid username and passwd
-            # create a new session and store username and passswd
-            $session = new CGI::Session();
+	# Check if a session already exists
+	my $session = CGI::Session->load() or die CGI::Session->errstr();
+	if ( $session->is_empty ) {
 
-            $session->param('username', $username);
-            $session->param('password', $password);
+		# no session found ... check if the login is correct
+		my $username = $FORM::username;
+		my $password = $FORM::password;
 
-            if ($returnVal == 2 || $returnVal == 4) {
-                # is a moderator. store this information in the session
-                $session->param('moderator', 'true'); 
-            }
+		my $metacat = Metacat->new($metacatUrl);
+		my $returnVal = $metacat->login( $username, $password );
+		debug(
+"Login was $returnVal for login attempt to $metacatUrl, with $username"
+		);
+		if ( $returnVal > 0 ) {
 
-            # send redirect to metacat and action = login
-            my $html = "<html><head>";
-            $html .= "</head><body onload=\"document.loginForm.submit()\">";
-            $html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
-            $html .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
-            $html .= "<input type=\"hidden\" name=\"username\" value=\"".$FORM::username."\" />";
-            $html .= "<input type=\"hidden\" name=\"password\" value=\"".$FORM::password."\" />";
-            $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$skinName."\" />";
-            $html .= "</form></body></html>";
-            print $session->header();
-            print $html;
-        } else {
-            # send back the error template with error message as wrong username password
-            # push(@errorMessages, $metacat->getMessage());
-            print "Content-type: text/html\n\n";
-            push(@errorMessages, "Failed during login.\n");
-            $$templateVars{'status'} = 'login_failure';
-            $$templateVars{'errorMessages'} = \@errorMessages;
-            $$templateVars{'cfg'} = $skinName;
-            $$templateVars{'section'} = "Login Status";
-            $template->process($templates->{'response'}, $templateVars);
-        }
+			# valid username and passwd
+			# create a new session and store username and passswd
+			$session = new CGI::Session();
 
-        exit();
-    } else {
-        # session found ... redirect to index page
-        my $url = "$skinsDir/$skinName/index.html";
-        redirect($url);
-        exit();
-   }
+			$session->param( 'username', $username );
+			$session->param( 'password', $password );
+
+			if ( $returnVal == 2 || $returnVal == 4 ) {
+
+				# is a moderator. store this information in the session
+				$session->param( 'moderator', 'true' );
+			}
+
+			# send redirect to metacat and action = login
+			my $html = "<html><head>";
+			$html .= "</head><body onload=\"document.loginForm.submit()\">";
+			$html .= "<form name=\"loginForm\" method=\"post\" action=\""
+			  . $metacatUrl . "\">";
+			$html .=
+			  "<input type=\"hidden\" name=\"action\" value=\"login\" />";
+			$html .= "<input type=\"hidden\" name=\"username\" value=\""
+			  . $FORM::username . "\" />";
+			$html .= "<input type=\"hidden\" name=\"password\" value=\""
+			  . $FORM::password . "\" />";
+			$html .= "<input type=\"hidden\" name=\"qformat\" value=\""
+			  . $skinName . "\" />";
+			$html .= "</form></body></html>";
+			print $session->header();
+			print $html;
+		}
+		else {
+
+	# send back the error template with error message as wrong username password
+	# push(@errorMessages, $metacat->getMessage());
+			print "Content-type: text/html\n\n";
+			push( @errorMessages, "Failed during login.\n" );
+			$$templateVars{'status'}        = 'login_failure';
+			$$templateVars{'errorMessages'} = \@errorMessages;
+			$$templateVars{'cfg'}           = $skinName;
+			$$templateVars{'section'}       = "Login Status";
+			$template->process( $templates->{'response'}, $templateVars );
+		}
+
+		exit();
+	}
+	else {
+
+		# session found ... redirect to index page
+		my $url = "/";
+		redirect($url);
+		exit();
+	}
 }
 
 ################################################################################
-# 
-# function to handle logout request  
 #
+# function to handle logout request
+#
 ################################################################################
-sub handleLogoutRequest(){
-    print "Content-type: text/html\n\n";
-    # Check if the session exists
-    debug("Stage is logout");
-    my $session = CGI::Session->load();
-    if ($session->is_empty || $session->is_expired) {
-        # no session found ... send back to index.html page ... 
-        debug("Session empty or not found");
-        my $url = "$skinsDir/$skinName/index.html";
-        redirect($url);
-        # should logout request be sent to metacat??? 
-    } else {
-        # get the user name and delete the session
-        debug("Session found");
-        my $uname = $session->param("username");
-        $session->delete();
-        # send redirect to metacat and action = login
-        my $html = "<html><head>";
-        $html .= "</head><body onload=\"document.loginForm.submit()\">";
-        $html .= "<form name=\"loginForm\" method=\"post\" action=\"". $metacatUrl ."\">";
-        $html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
-        $html .= "<input type=\"hidden\" name=\"username\" value=\"".$uname."\" />";
-        $html .= "<input type=\"hidden\" name=\"qformat\" value=\"".$skinName."\" />";
-        $html .= "</form></body></html>";
-        print($html);
-    }
+sub handleLogoutRequest() {
+	print "Content-type: text/html\n\n";
+
+	# Check if the session exists
+	debug("Stage is logout");
+	my $session = CGI::Session->load();
+	if ( $session->is_empty || $session->is_expired ) {
+
+		# no session found ... send back to index.html page ...
+		debug("Session empty or not found");
+		my $url = "/";
+		redirect($url);
+
+		# should logout request be sent to metacat???
+	}
+	else {
+
+		# get the user name and delete the session
+		debug("Session found");
+		my $uname = $session->param("username");
+		$session->delete();
+
+		# send redirect to metacat and action = login
+		my $html = "<html><head>";
+		$html .= "</head><body onload=\"document.loginForm.submit()\">";
+		$html .= "<form name=\"loginForm\" method=\"post\" action=\""
+		  . $metacatUrl . "\">";
+		$html .= "<input type=\"hidden\" name=\"action\" value=\"logout\" />";
+		$html .= "<input type=\"hidden\" name=\"username\" value=\"" 
+		  . $uname . "\" />";
+		$html .= "<input type=\"hidden\" name=\"qformat\" value=\""
+		  . $skinName . "\" />";
+		$html .= "</form></body></html>";
+		print($html);
+	}
 }
 
 ################################################################################
@@ -2906,554 +3596,677 @@
 #
 ################################################################################
 sub getCredentials {
-    my $userDN = $FORM::username;
-    my $userOrg = $FORM::organization;
-    my $userPass = $FORM::password;
-    my $dname = "uid=$userDN,o=$userOrg,dc=ecoinformatics,dc=org";
+	my $userDN   = $FORM::username;
+	my $userOrg  = $FORM::organization;
+	my $userPass = $FORM::password;
+	my $dname    = "uid=$userDN,o=$userOrg,dc=ecoinformatics,dc=org";
 
-    my $session = CGI::Session->load();
-    if (!($session->is_empty || $session->is_expired)) {
-        $dname = $session->param("username");
-        $userPass = $session->param("password");
-    }
+	my $session = CGI::Session->load();
+	if ( !( $session->is_empty || $session->is_expired ) ) {
+		$dname    = $session->param("username");
+		$userPass = $session->param("password");
+	}
 
-    return ($dname, $userPass);
+	return ( $dname, $userPass );
 }
 
 ################################################################################
-# 
+#
+# get user groups from metacat for the currently logged in user
+#
+################################################################################
+sub getUserGroups {
+	my $sessionId = shift;
+	
+	#debug("getting user info for session id: $sessionId");
+	my $metacat = Metacat->new($metacatUrl);
+	
+	my ( $username, $password ) = getCredentials();
+	$metacat->login( $username, $password );
+	
+	my $userInfo = $metacat->getUserInfo($sessionId);
+	
+	debug("user info xml: $userInfo");
+	
+	my $parser = XML::LibXML->new();
+	my $parsedDoc = $parser->parse_string($userInfo);
+	
+	my $groupString = $parsedDoc->findvalue('//user/groupNames');
+	
+	my @groupArray;
+	foreach (split(":", $groupString)) {
+		$_ =~ s/^\s+//;
+		$_ =~ s/\s+$//;
+		debug("pushing: $_");
+		push(@groupArray, $_);
+	}
+
+	return @groupArray;
+}
+
+################################################################################
+#
 # function to check if the moderator is logged in - if yes, then username and
 # password are set
 #
 ################################################################################
 sub isModerator {
-    my $stage = shift;
+	my $stage = shift;
 
-    my $returnValue = 1;
+	my $returnValue = 1;
 
-    # Check if the session exists
-    my $session = CGI::Session->load();
-    if ($session->is_empty || $session->is_expired) {
-        # no session found ... send back to index.html page ... 
-        processResultTemplate($stage, 'failure', "Moderator is not logged in.\n");
-        $returnValue = -1;
-    } 
+	# Check if the session exists
+	my $session = CGI::Session->load();
+	if ( $session->is_empty || $session->is_expired ) {
 
-    # check if logged in user is moderator
-    my $moderator = $session->param("moderator");
-    if ($moderator ne 'true') {
-        # no session found ... send back to index.html page ... 
-        debug("Logged in user is not moderator");
-        processResultTemplate($stage, 'failure', "Logged in user is not moderator.\n");
-        $returnValue = -1;
-    }
+		# no session found ... send back to index.html page ...
+		processResultTemplate( $stage, 'failure',
+			"Moderator is not logged in.\n" );
+		$returnValue = -1;
+	}
 
-    if ($returnValue eq 1) {
-        ($modUsername, $modPassword) = getCredentials();
-    }
+	# check if logged in user is moderator
+	my $moderator = $session->param("moderator");
+	if ( $moderator ne 'true' ) {
 
-    return $returnValue;
+		# no session found ... send back to index.html page ...
+		debug("Logged in user is not moderator");
+		processResultTemplate( $stage, 'failure',
+			"Logged in user is not moderator.\n" );
+		$returnValue = -1;
+	}
+
+	if ( $returnValue eq 1 ) {
+		( $modUsername, $modPassword ) = getCredentials();
+	}
+
+	return $returnValue;
 }
 
 sub handleRead {
-    my $docid = $FORM::docid;
-    my $errorMessage;
-    #debug("\n\n\n\n$docid");
-    print "Content-type: text/html\n\n";
+	my $docid = $FORM::docid;
+	my $sessionId = $FORM::sessionid;
+	my $errorMessage;
 
-    # Check if the session exists
-    my $session = CGI::Session->load();
-    if ($session->is_empty || $session->is_expired) {
-        # no session found ... send back the regular read page ...
-        my $url = "$skinsDir/$skinName/index.html";
-        redirect($url);
-    } else {
-        my $htmldoc = qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
+	#debug("\n\n\n\n$docid");
+	print "Content-type: text/html\n\n";
+
+	# Check if the session exists
+	my $session = CGI::Session->load();
+	if ( $session->is_empty || $session->is_expired ) {
+
+		# no session found ... send back the regular read page ...
+		my $url = "$skinsDir/$skinName/index.html";
+		redirect($url);
+	}
+	else {
+		my $htmldoc =
+qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
         <html><head><title>Dataset Description: $docid</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
           <frameset rows="150,*" cols="*" frameborder="NO" border="0" framespacing="0">
             <frame src="$skinsDir/$skinName/header.jsp" marginwidth="40" name="topFrame" scrolling="NO" noresize>
             <frameset cols="200,*" frameborder="NO" border="0" framespacing="0">
               <body></body><frame src="$cgiPrefix/register-dataset.cgi?cfg=$skinName&stage=review_frame&docid=$docid" name="rightFrame" scrolling="NO" noresize></frame>
-              <frame src="$metacatUrl?action=read&qformat=$skinName&docid=$docid&insertTemplate=0" name="mainFrame">
+              <frame src="$metacatUrl?action=read&qformat=$skinName&docid=$docid&insertTemplate=0&sessionid=$sessionId" name="mainFrame">
             </frameset>
           </frameset>
         </html>
 |;
-        print $htmldoc;    
-    }
+		print $htmldoc;
+	}
 }
 
 sub handleReviewFrame {
-    print "Content-type: text/html\n\n";
-    my $session = CGI::Session->load();
-        if ($session->is_empty || $session->is_expired) {
-        return;
-    }
+	print "Content-type: text/html\n\n";
+	my $session = CGI::Session->load();
+	if ( $session->is_empty || $session->is_expired ) {
+		return;
+	}
 
-    my $moderator = $session->param("moderator");
-    $$templateVars{'reviewdocid'} = getReviewHistoryHTML();
-    $$templateVars{'docid'} = $FORM::docid;
-    if ($moderator eq 'true') {
-        $$templateVars{'isModerator'} = "true";
-    }
-    $template->process($templates->{'getReviews'}, $templateVars);
+	my $moderator = $session->param("moderator");
+	$$templateVars{'reviewdocid'} = getReviewHistoryHTML();
+	$$templateVars{'docid'}       = $FORM::docid;
+	if ( $moderator eq 'true' ) {
+		$$templateVars{'isModerator'} = "true";
+	}
+	$template->process( $templates->{'getReviews'}, $templateVars );
 }
 
 sub getReviewHistoryHTML {
-    my $metacat = Metacat->new($metacatUrl);
-    my ($username, $password) = getCredentials();
-    $metacat->login($username, $password);
-    my $parser = XML::LibXML->new();
-    my $docid = $FORM::docid;
-    my ($x, $y, $z) = split(/\./, $docid);
-    if ($x eq "") {
-        return "Error: Unable to find review for invalid docid.";
-    }
-    my $docidWithoutRev = $x.".".$y;
-    my $reviewDocumentId = '';
-    my $reviewQuery = "<pathquery><querytitle>Moderator-Search</querytitle><querygroup operator='INTERSECT'><queryterm searchmode='contains' casesensitive='false'><value>$docidWithoutRev</value><pathexpr>/reviewHistory/review/packageId</pathexpr></queryterm></querygroup></pathquery>";
-    my $response = $metacat->squery($reviewQuery);
-    my $doc = $response->content();
-    my $xmldoc = $parser->parse_string($doc);
-    my $reviewHTML = '';
+	my $metacat = Metacat->new($metacatUrl);
+	my ( $username, $password ) = getCredentials();
+	$metacat->login( $username, $password );
+	my $parser = XML::LibXML->new();
+	my $docid  = $FORM::docid;
+	my ( $x, $y, $z ) = split( /\./, $docid );
+	if ( $x eq "" ) {
+		return "Error: Unable to find review for invalid docid.";
+	}
+	my $docidWithoutRev  = $x . "." . $y;
+	my $reviewDocumentId = '';
+	#debug("find review history for docid $docidWithoutRev");
+	my $reviewQuery = "<pathquery><querytitle>Moderator-Search</querytitle><querygroup operator='INTERSECT'><queryterm searchmode='contains' casesensitive='false'><value>$docidWithoutRev</value><pathexpr>/reviewHistory/review/packageId</pathexpr></queryterm></querygroup></pathquery>";
+	my $response   = $metacat->squery($reviewQuery);
+	my $doc        = $response->content();
+	my $xmldoc     = $parser->parse_string($doc);
+	my $reviewHTML = '';
 
-    if ($xmldoc eq "" || $doc=~ /<error/) {
-        # not able to parse
-        return "Error: Unable to search for review for the docid:".$docid;
-    } else {
-        my $findNodes = $xmldoc->findnodes('//resultset/document');
-        if ($findNodes->size() > 0) {
-            # found contact email address
-            my $node = '';
-            foreach $node ($findNodes->get_nodelist) {
-                $reviewDocumentId = findValue($node,'docid');
-            }
-        }
-    }
-    return $reviewDocumentId;
+	if ( $xmldoc eq "" || $doc =~ /<error/ ) {
+
+		# not able to parse
+		return "Error: Unable to search for review for the docid:" . $docid;
+	}
+	else {
+		my $findNodes = $xmldoc->findnodes('//resultset/document');
+		if ( $findNodes->size() > 0 ) {
+			#debug("//resultset/document section found");
+			# found contact email address
+			my $node = '';
+			foreach $node ( $findNodes->get_nodelist ) {
+				$reviewDocumentId = findValue( $node, 'docid' );
+			}
+		}
+	}
+	return $reviewDocumentId;
 }
 
 ################################################################################
-# 
-# function to handle accept request for moderator  
 #
+# function to handle accept request for moderator
+#
 ################################################################################
-sub handleModAccept(){
+sub handleModAccept() {
 
-    my $errorMessage = '';
-    my $metacat = Metacat->new($metacatUrl);
+	my $errorMessage = '';
+	my $metacat      = Metacat->new($metacatUrl);
 
-    print "Content-type: text/html\n\n";
+	print "Content-type: text/html\n\n";
 
-    debug("Stage is mod_accept");
+	debug("Stage is mod_accept");
 
-    my $isMod = isModerator("accept");
-    if ($isMod < 0) {
-        return;
-    }
+	my $isMod = isModerator("accept");
+	if ( $isMod < 0 ) {
+		return;
+	}
 
-    # read the document from 
-    my $parser = XML::LibXML->new();
-    my $title = '';
-    my $contactEmailAddress = '';
-    my $contactName = '';
-    my $userDN = '';
-    # Log into metacat
-    my $response = $metacat->login($modUsername, $modPassword);
-    my $docid = $FORM::docid;
+	# read the document from
+	my $parser              = XML::LibXML->new();
+	my $title               = '';
+	my $contactEmailAddress = '';
+	my $contactName         = '';
+	my $userDN              = '';
 
-    if (!$response) {
-        # Could not login
-        $errorMessage = $errorMessage." Failed during moderator login.";
-    } else {
-        # read the document and get the contact name and address
-        $response = $metacat->read($docid);
-        my $docFromMetacat = $response->content();
-        my $xmldoc = $parser->parse_string($docFromMetacat);
-        my $dataElem = '';
-        my $results;
+	# Log into metacat
+	my $response = $metacat->login( $modUsername, $modPassword );
+	my $docid = $FORM::docid;
 
-        if ($xmldoc eq "" || $docFromMetacat=~ /<error/) {
-            # not able to parse
-            $errorMessage = $errorMessage." Error in reading the following docid:".$docid;
-        } else {
-            my $emldoc = '';
-            $xmldoc = transformEml($xmldoc);
-          
-            # pull out existing dataset entry 
-            $results = $xmldoc->findnodes('//dataset');
-            foreach my $r ($results->get_nodelist) {
-                $dataElem .= $r->toString();
-            }
-            
-            $emldoc .= EMLStart();
-            $emldoc .= accessElement("true");
-            $emldoc .= $dataElem;
-            $emldoc .= EMLEnd();
+	if ( !$response ) {
 
-            #debug("Document created by handleModAccept is " . $emldoc);
-            # update the document
-            my $docid = incrementRevision($docid);
+		# Could not login
+		$errorMessage = $errorMessage . " Failed during moderator login.";
+	}
+	else {
 
-            $emldoc =~ s/packageId="docid"/packageId=\"$docid\"/;
-            debugDoc($emldoc);
-            $response = $metacat->update($docid, $emldoc);
+		# read the document and get the contact name and address
+		$response = $metacat->read($docid);
+		my $docFromMetacat = $response->content();
+		my $xmldoc         = $parser->parse_string($docFromMetacat);
+		my $dataElem       = '';
+		my $results;
 
-            if (! $response) {
-                debug("Error while updating in handleModAccept.");
-                #push(@errorMessages, $metacat->getMessage());
-                $errorMessage = $errorMessage." Failed while updating the document with new access rules.";  
-            }
+		if ( $xmldoc eq "" || $docFromMetacat =~ /<error/ ) {
 
-            # get the contact email address from the 
-            $xmldoc = $parser->parse_string($emldoc);
+			# not able to parse
+			$errorMessage =
+			  $errorMessage . " Error in reading the following docid:" . $docid;
+		}
+		else {
+			my $emldoc = '';
+			$xmldoc = transformEml($xmldoc);
 
-            if ($xmldoc eq "" || $xmldoc=~ /<error/) {
-                # not able to parse
-                $errorMessage = $errorMessage." Error in reading the docid:".$docid;
-            } else {
-                my $findNodes = $xmldoc->findnodes('//dataset/contact');
-                if ($findNodes->size() > 0) {
-                    # found contact email address
-                    my $node = '';
-                    foreach $node ($findNodes->get_nodelist) {
-                        $contactEmailAddress = findValue($node,'electronicMailAddress');
-                        my $surName = findValue($node,'individualName/surName');
-                        my $givenName = findValue($node,'individualName/givenName');
-                        my $organizationName = findValue($node,'organizaitionName');
+			# pull out existing dataset entry
+			$results = $xmldoc->findnodes('//dataset');
+			foreach my $r ( $results->get_nodelist ) {
+				$dataElem .= $r->toString();
+			}
 
-                        if ($surName ne '') {
-                            $contactName = $givenName.' '.$surName;
-                        } else {
-                            $contactName = $organizationName;
-                        }
-                    }
-                } else {
-                    $contactEmailAddress = '';
-                }
-                $findNodes = $xmldoc->findnodes('//dataset/title');
-                if ($findNodes->size() > 0) {
-                    # found title
-                    my $node = '';
-                    foreach $node ($findNodes->get_nodelist) {
-                        $title = findValue($node,'../title');
-                    }
-                } else {
-                    $title = '';
-                }
+			$emldoc .= EMLStart();
+			$emldoc .= accessElement("true");
+			$emldoc .= $dataElem;
+			$emldoc .= EMLEnd();
 
-                $findNodes = $xmldoc->findnodes('//access/allow');
-                if ($findNodes->size() > 0) {
-                    # found title
-                    my $node = '';
-                    foreach $node ($findNodes->get_nodelist) {
-                        my $perm = findValue($node,'permission');
-                        if ($perm ne 'all') {
-                            $userDN = findValue($node,'principal');
-                        }
-                    }
-                } else {
-                    $userDN = '';
-                }
-            }
-        }
-    }
+			#debug("Document created by handleModAccept is " . $emldoc);
+			# update the document
+			my $docid = incrementRevision($docid);
 
-    # give the system a chance to finish databasing and indexing
-    sleep(5);
+			$emldoc =~ s/packageId="docid"/packageId=\"$docid\"/;
+			debugDoc($emldoc);
+			$response = $metacat->update( $docid, $emldoc );
 
-    # send notification to the user and the moderator
-    if ($errorMessage eq '') {
-        modSendNotification($title, $contactEmailAddress, $contactName, "Document $docid Accepted");
-        if ($FORM::review ne '') {
-            $errorMessage = modStoreReview('accept', $metacat, $userDN);
-            if ($errorMessage ne '') {
-                processResultTemplate('accept', 'failure', $errorMessage);
-                return;
-            }
-        }
-        # send notifications
-        processResultTemplate('accept', 'success', $errorMessage);
-    } else {
-        processResultTemplate('accept', 'failure', $errorMessage);
-    }
+			if ( !$response ) {
+				debug("Error while updating in handleModAccept.");
+
+				#push(@errorMessages, $metacat->getMessage());
+				$errorMessage = $errorMessage
+				  . " Failed while updating the document with new access rules.";
+			}
+
+			# get the contact email address from the
+			$xmldoc = $parser->parse_string($emldoc);
+
+			if ( $xmldoc eq "" || $xmldoc =~ /<error/ ) {
+
+				# not able to parse
+				$errorMessage =
+				  $errorMessage . " Error in reading the docid:" . $docid;
+			}
+			else {
+				my $findNodes = $xmldoc->findnodes('//dataset/contact');
+				if ( $findNodes->size() > 0 ) {
+
+					# found contact email address
+					my $node = '';
+					foreach $node ( $findNodes->get_nodelist ) {
+						$contactEmailAddress =
+						  findValue( $node, 'electronicMailAddress' );
+						my $surName =
+						  findValue( $node, 'individualName/surName' );
+						my $givenName =
+						  findValue( $node, 'individualName/givenName' );
+						my $organizationName =
+						  findValue( $node, 'organizaitionName' );
+
+						if ( $surName ne '' ) {
+							$contactName = $givenName . ' ' . $surName;
+						}
+						else {
+							$contactName = $organizationName;
+						}
+					}
+				}
+				else {
+					$contactEmailAddress = '';
+				}
+				$findNodes = $xmldoc->findnodes('//dataset/title');
+				if ( $findNodes->size() > 0 ) {
+
+					# found title
+					my $node = '';
+					foreach $node ( $findNodes->get_nodelist ) {
+						$title = findValue( $node, '../title' );
+					}
+				}
+				else {
+					$title = '';
+				}
+
+				$findNodes = $xmldoc->findnodes('//access/allow');
+				if ( $findNodes->size() > 0 ) {
+
+					# found title
+					my $node = '';
+					foreach $node ( $findNodes->get_nodelist ) {
+						my $perm = findValue( $node, 'permission' );
+						if ( $perm ne 'all' ) {
+							$userDN = findValue( $node, 'principal' );
+						}
+					}
+				}
+				else {
+					$userDN = '';
+				}
+			}
+		}
+	}
+
+	# give the system a chance to finish databasing and indexing
+	sleep(5);
+
+	# send notification to the user and the moderator
+	if ( $errorMessage eq '' ) {
+		modSendNotification(
+			$title,       $contactEmailAddress,
+			$contactName, "Document $docid Accepted"
+		);
+		if ( $FORM::review ne '' ) {
+			$errorMessage = modStoreReview( 'accept', $metacat, $userDN );
+			if ( $errorMessage ne '' ) {
+				processResultTemplate( 'accept', 'failure', $errorMessage );
+				return;
+			}
+		}
+
+		# send notifications
+		processResultTemplate( 'accept', 'success', $errorMessage );
+	}
+	else {
+		processResultTemplate( 'accept', 'failure', $errorMessage );
+	}
 }
 
 ################################################################################
-# 
-# function to handle decline request for moderator  
 #
+# function to handle decline request for moderator
+#
 ################################################################################
-sub handleModDecline(){
+sub handleModDecline() {
 
-    my $errorMessage = '';
-    my $userDN = '';
-    my $metacat = Metacat->new($metacatUrl);
-    my $docid = $FORM::docid;
+	my $errorMessage = '';
+	my $userDN       = '';
+	my $metacat      = Metacat->new($metacatUrl);
+	my $docid        = $FORM::docid;
 
-    print "Content-type: text/html\n\n";
+	print "Content-type: text/html\n\n";
 
-    debug("Stage is mod_decline");
+	debug("Stage is mod_decline");
 
-    if (isModerator('decline') < 0) {
-        return;
-    }
+	if ( isModerator('decline') < 0 ) {
+		return;
+	}
 
-    # variables for contact information
-    my $contactEmailAddress;
-    my $contactName;
-    my $title;
+	# variables for contact information
+	my $contactEmailAddress;
+	my $contactName;
+	my $title;
 
-    # Log into metacat
-    my $response = $metacat->login($modUsername, $modPassword);
-    
-    if (! $response) {
-        # Could not login
-        #push(@errorMessages, $metacat->getMessage());
-        $errorMessage = $errorMessage." Failed during moderator login.";
-    } else {
-        # read the document and get the contact name and address
-        my $parser = XML::LibXML->new();
+	# Log into metacat
+	my $response = $metacat->login( $modUsername, $modPassword );
 
-        $response = $metacat->read($docid);
-        my $doc = $response->content();
-        my $xmldoc = $parser->parse_string($doc);
+	if ( !$response ) {
 
-        if ($xmldoc eq "" || $doc=~ /<error/) {
-            # not able to parse
-            $errorMessage = $errorMessage." Error in reading the docid:".$docid;
-        } else {
-            my $findNodes = $xmldoc->findnodes('//dataset/contact');
-            if ($findNodes->size() > 0) {
-                # found contact email address
-                my $node = '';
-                foreach $node ($findNodes->get_nodelist) {
-                    $contactEmailAddress = findValue($node,'electronicMailAddress');
-                    my $surName = findValue($node,'individualName/surName');
-                    my $givenName = findValue($node,'individualName/givenName');
-                    my $organizationName = findValue($node,'organizaitionName');
+		# Could not login
+		#push(@errorMessages, $metacat->getMessage());
+		$errorMessage = $errorMessage . " Failed during moderator login.";
+	}
+	else {
 
-                    if ($surName ne '') {
-                        $contactName = $givenName.' '.$surName;
-                    } else {
-                        $contactName = $organizationName;
-                    }
-                }
-            } else {
-                $contactEmailAddress = '';
-            }
-            $findNodes = $xmldoc->findnodes('//dataset/title');
-            if ($findNodes->size() > 0) {
-                # found title
-                my $node = '';
-                foreach $node ($findNodes->get_nodelist) {
-                    $title = findValue($node,'../title');
-                }
-            } else {
-                $title = '';
-            }
+		# read the document and get the contact name and address
+		my $parser = XML::LibXML->new();
 
-            $findNodes = $xmldoc->findnodes('//access/allow');
-            if ($findNodes->size() > 0) {
-                # found allow
-                my $node = '';
-                foreach $node ($findNodes->get_nodelist) {
-                     my $perm = findValue($node,'permission');
-                     if ($perm ne 'all') {
-                          $userDN = findValue($node,'principal');
-                     }
-                }
-            } else {
-                $userDN = '';
-            }
-        }
+		$response = $metacat->read($docid);
+		my $doc    = $response->content();
+		my $xmldoc = $parser->parse_string($doc);
 
-        $response = $metacat->delete($docid);
-        if (!$response) {
-            debug("Error while deleting document in handleModDecline.");
-            #push(@errorMessages, $metacat->getMessage());
-            $errorMessage = $errorMessage." Failed during deleting $docid. Please check if you are authorized to delete this document or if the document is not already deleted."; 
-        } else {
-            debug("Document deleted by handleModDecline is " . $docid);
-        }
-    }
+		if ( $xmldoc eq "" || $doc =~ /<error/ ) {
 
-    if ($errorMessage eq '') {
-        modSendNotification($title, $contactEmailAddress, $contactName, "Document $docid Rejected");
-        if ($FORM::review ne '') {
-            $errorMessage = modStoreReview('decline', $metacat, $userDN);
-            if ($errorMessage ne '') {
-                processResultTemplate('decline', 'failure', $errorMessage);
-                return;
-            }
-        }
-        # send notifications
-        processResultTemplate('decline', 'success', $errorMessage);
-    } else {
-        processResultTemplate('decline', 'failure', $errorMessage);
-    }
+			# not able to parse
+			$errorMessage =
+			  $errorMessage . " Error in reading the docid:" . $docid;
+		}
+		else {
+			my $findNodes = $xmldoc->findnodes('//dataset/contact');
+			if ( $findNodes->size() > 0 ) {
+
+				# found contact email address
+				my $node = '';
+				foreach $node ( $findNodes->get_nodelist ) {
+					$contactEmailAddress =
+					  findValue( $node, 'electronicMailAddress' );
+					my $surName = findValue( $node, 'individualName/surName' );
+					my $givenName =
+					  findValue( $node, 'individualName/givenName' );
+					my $organizationName =
+					  findValue( $node, 'organizaitionName' );
+
+					if ( $surName ne '' ) {
+						$contactName = $givenName . ' ' . $surName;
+					}
+					else {
+						$contactName = $organizationName;
+					}
+				}
+			}
+			else {
+				$contactEmailAddress = '';
+			}
+			$findNodes = $xmldoc->findnodes('//dataset/title');
+			if ( $findNodes->size() > 0 ) {
+
+				# found title
+				my $node = '';
+				foreach $node ( $findNodes->get_nodelist ) {
+					$title = findValue( $node, '../title' );
+				}
+			}
+			else {
+				$title = '';
+			}
+
+			$findNodes = $xmldoc->findnodes('//access/allow');
+			if ( $findNodes->size() > 0 ) {
+
+				# found allow
+				my $node = '';
+				foreach $node ( $findNodes->get_nodelist ) {
+					my $perm = findValue( $node, 'permission' );
+					if ( $perm ne 'all' ) {
+						$userDN = findValue( $node, 'principal' );
+					}
+				}
+			}
+			else {
+				$userDN = '';
+			}
+		}
+
+		$response = $metacat->delete($docid);
+		if ( !$response ) {
+			debug("Error while deleting document in handleModDecline.");
+
+			#push(@errorMessages, $metacat->getMessage());
+			$errorMessage = $errorMessage
+			  . " Failed during deleting $docid. Please check if you are authorized to delete this document or if the document is not already deleted.";
+		}
+		else {
+			debug( "Document deleted by handleModDecline is " . $docid );
+		}
+	}
+
+	if ( $errorMessage eq '' ) {
+		modSendNotification(
+			$title,       $contactEmailAddress,
+			$contactName, "Document $docid Rejected"
+		);
+		if ( $FORM::review ne '' ) {
+			$errorMessage = modStoreReview( 'decline', $metacat, $userDN );
+			if ( $errorMessage ne '' ) {
+				processResultTemplate( 'decline', 'failure', $errorMessage );
+				return;
+			}
+		}
+
+		# send notifications
+		processResultTemplate( 'decline', 'success', $errorMessage );
+	}
+	else {
+		processResultTemplate( 'decline', 'failure', $errorMessage );
+	}
 }
 
 ################################################################################
-# 
-# function to handle revise request for moderator  
 #
+# function to handle revise request for moderator
+#
 ################################################################################
-sub handleModRevise(){
-    my $errorMessage = '';
-    my $metacat = Metacat->new($metacatUrl);
-    my $docid = $FORM::docid;
+sub handleModRevise() {
+	my $errorMessage = '';
+	my $metacat      = Metacat->new($metacatUrl);
+	my $docid        = $FORM::docid;
 
-    print "Content-type: text/html\n\n";
+	print "Content-type: text/html\n\n";
 
-    debug("Stage is mod_revise");
+	debug("Stage is mod_revise");
 
-    if (isModerator('revise') < 0) {
-        return;
-    }
+	if ( isModerator('revise') < 0 ) {
+		return;
+	}
 
-    # variables for contact information
-    my $contactEmailAddress;
-    my $contactName;
-    my $title;
-    my $userDN = '';
+	# variables for contact information
+	my $contactEmailAddress;
+	my $contactName;
+	my $title;
+	my $userDN = '';
 
-    # Log into metacat
-    my $response = $metacat->login($modUsername, $modPassword);
+	# Log into metacat
+	my $response = $metacat->login( $modUsername, $modPassword );
 
-    if (! $response) {
-        # Could not login
-        #push(@errorMessages, $metacat->getMessage());
-        $errorMessage = $errorMessage." Failed during moderator login.";
+	if ( !$response ) {
 
-    } else {
-        # read the document and get the contact name and address
-        my $parser = XML::LibXML->new();
+		# Could not login
+		#push(@errorMessages, $metacat->getMessage());
+		$errorMessage = $errorMessage . " Failed during moderator login.";
 
-        $response = $metacat->read($docid);
-        my $doc = $response->content();
-        my $xmldoc = $parser->parse_string($doc);
-        $xmldoc = transformEml($xmldoc); 
-        if ($xmldoc eq "" || $doc=~ /<error/) {
-            # not able to parse
-            $errorMessage = $errorMessage." Error in reading the docid:".$docid;
-        } else {
-            $xmldoc = transformEml($xmldoc);
-            my $findNodes = $xmldoc->findnodes('//dataset/contact');
-            if ($findNodes->size() > 0) {
-                # found contact email address
-                my $node = '';
-                foreach $node ($findNodes->get_nodelist) {
-                    $contactEmailAddress = findValue($node,'electronicMailAddress');
+	}
+	else {
 
-                    my $surName = findValue($node,'individualName/surName');
-                    my $givenName = findValue($node,'individualName/givenName');
-                    my $organizationName = findValue($node,'organizaitionName');
+		# read the document and get the contact name and address
+		my $parser = XML::LibXML->new();
 
-                    if ($surName ne '') {
-                        $contactName = $givenName.' '.$surName;
-                    } else {
-                        $contactName = $organizationName;
-                    }
-                }
-            } else {
-                $contactEmailAddress = '';
-            }
+		$response = $metacat->read($docid);
+		my $doc    = $response->content();
+		my $xmldoc = $parser->parse_string($doc);
+		$xmldoc = transformEml($xmldoc);
+		if ( $xmldoc eq "" || $doc =~ /<error/ ) {
 
-            $findNodes = $xmldoc->findnodes('//dataset/title');
-            if ($findNodes->size() > 0) {
-                # found title
-                my $node = '';
-                foreach $node ($findNodes->get_nodelist) {
-                    $title = findValue($node,'../title');
-                }
-            } else {
-                $title = '';
-            }
+			# not able to parse
+			$errorMessage =
+			  $errorMessage . " Error in reading the docid:" . $docid;
+		}
+		else {
+			$xmldoc = transformEml($xmldoc);
+			my $findNodes = $xmldoc->findnodes('//dataset/contact');
+			if ( $findNodes->size() > 0 ) {
 
-            $findNodes = $xmldoc->findnodes('//access/allow');
-            if ($findNodes->size() > 0) {
-                # found title
-                my $node = '';
-                foreach $node ($findNodes->get_nodelist) {
-                    my $perm = findValue($node,'permission');
-                    if ($perm ne 'all') {
-                        $userDN = findValue($node,'principal');
-                    }
-                }
-            } else {
-                $userDN = '';
-            }
-        }
-        
-        my $emldoc = '';
-        my $dataElem = '';
-        my $accessElem = '';
+				# found contact email address
+				my $node = '';
+				foreach $node ( $findNodes->get_nodelist ) {
+					$contactEmailAddress =
+					  findValue( $node, 'electronicMailAddress' );
 
-        # pull out existing dataset entry 
-        my $results = $xmldoc->findnodes('/eml:eml/dataset');
-        foreach my $r ($results->get_nodelist) {
-            $dataElem .= $r->toString();
-        }
-        # also grab the access element
-        $results = $xmldoc->findnodes('/eml:eml/access');
-        foreach my $r ($results->get_nodelist) {
-          $accessElem .= $r->toString();
-        }
-    
-        my $addlMetadata = qq|
+					my $surName = findValue( $node, 'individualName/surName' );
+					my $givenName =
+					  findValue( $node, 'individualName/givenName' );
+					my $organizationName =
+					  findValue( $node, 'organizaitionName' );
+
+					if ( $surName ne '' ) {
+						$contactName = $givenName . ' ' . $surName;
+					}
+					else {
+						$contactName = $organizationName;
+					}
+				}
+			}
+			else {
+				$contactEmailAddress = '';
+			}
+
+			$findNodes = $xmldoc->findnodes('//dataset/title');
+			if ( $findNodes->size() > 0 ) {
+
+				# found title
+				my $node = '';
+				foreach $node ( $findNodes->get_nodelist ) {
+					$title = findValue( $node, '../title' );
+				}
+			}
+			else {
+				$title = '';
+			}
+
+			$findNodes = $xmldoc->findnodes('//access/allow');
+			if ( $findNodes->size() > 0 ) {
+
+				# found title
+				my $node = '';
+				foreach $node ( $findNodes->get_nodelist ) {
+					my $perm = findValue( $node, 'permission' );
+					if ( $perm ne 'all' ) {
+						$userDN = findValue( $node, 'principal' );
+					}
+				}
+			}
+			else {
+				$userDN = '';
+			}
+		}
+
+		my $emldoc     = '';
+		my $dataElem   = '';
+		my $accessElem = '';
+
+		# pull out existing dataset entry
+		my $results = $xmldoc->findnodes('/eml:eml/dataset');
+		foreach my $r ( $results->get_nodelist ) {
+			$dataElem .= $r->toString();
+		}
+
+		# also grab the access element
+		$results = $xmldoc->findnodes('/eml:eml/access');
+		foreach my $r ( $results->get_nodelist ) {
+			$accessElem .= $r->toString();
+		}
+
+		my $addlMetadata = qq|
         <additionalMetadata>
             <metadata>
                 <moderatorComment>Revision Requested</moderatorComment>
             </metadata>
         </additionalMetadata>|;
-      
-        $emldoc .= EMLStart();
-        $emldoc .= $accessElem;
-        $emldoc .= $dataElem;
-        $emldoc .= $addlMetadata;
-        $emldoc .= EMLEnd();
-        
-        # update the document
-        my $docid = incrementRevision($docid);
 
-        $emldoc =~ s/packageId="docid"/packageId="$docid"/;
-        debugDoc($emldoc);
-        $response = $metacat->update($docid, $emldoc);
+		$emldoc .= EMLStart();
+		$emldoc .= $accessElem;
+		$emldoc .= $dataElem;
+		$emldoc .= $addlMetadata;
+		$emldoc .= EMLEnd();
 
-        if (!$response) {
-            debug("Error while updating in handleModAccept.".$metacat->getMessage());
-            $errorMessage = $errorMessage." Failed while updating the document with additional metadata.";
-        }
+		# update the document
+		my $docid = incrementRevision($docid);
 
-    }
-    if ($errorMessage eq '') {
-        modSendNotification($title, $contactEmailAddress, $contactName, "Revise document: $docid");
-        if ($FORM::review ne '') {
-            $errorMessage = modStoreReview('revise', $metacat, $userDN);
-            if ($errorMessage ne '') {
-                processResultTemplate('revise', 'failure', $errorMessage);
-                return;
-            }
-        }
-        # send notifications
-        processResultTemplate('revise', 'success', $errorMessage);
-    } else {
-        processResultTemplate('revise', 'failure', $errorMessage);
-    }
+		$emldoc =~ s/packageId="docid"/packageId="$docid"/;
+		debugDoc($emldoc);
+		$response = $metacat->update( $docid, $emldoc );
+
+		if ( !$response ) {
+			debug( "Error while updating in handleModAccept."
+				  . $metacat->getMessage() );
+			$errorMessage = $errorMessage
+			  . " Failed while updating the document with additional metadata.";
+		}
+
+	}
+	if ( $errorMessage eq '' ) {
+		modSendNotification(
+			$title,       $contactEmailAddress,
+			$contactName, "Revise document: $docid"
+		);
+		if ( $FORM::review ne '' ) {
+			$errorMessage = modStoreReview( 'revise', $metacat, $userDN );
+			if ( $errorMessage ne '' ) {
+				processResultTemplate( 'revise', 'failure', $errorMessage );
+				return;
+			}
+		}
+
+		# send notifications
+		processResultTemplate( 'revise', 'success', $errorMessage );
+	}
+	else {
+		processResultTemplate( 'revise', 'failure', $errorMessage );
+	}
 }
 
 sub modStoreReview {
-    my $action = shift;
-    my $metacat = shift;
-    my $userDN = shift;
-    
-    my $gmt = gmtime($now);
-    my $docid = $FORM::docid;
-    my $parser = XML::LibXML->new();
+	my $action  = shift;
+	my $metacat = shift;
+	my $userDN  = shift;
 
-    # create the xml part that has to be inserted
-    my $review = qq|
+	my $gmt    = gmtime($now);
+	my $docid  = $FORM::docid;
+	my $parser = XML::LibXML->new();
+
+	# create the xml part that has to be inserted
+	my $review = qq|
     <review>
       <packageId>$docid</packageId>
       <action>$action</action>
@@ -3461,855 +4274,1026 @@
       <text>$FORM::review</text>
     </review>|;
 
-    # find out if a docid already exists...
-    my ($x, $y, $z) = split(/\./, $docid);
-    my $docidWithoutRev = $x . "." . $y;
-    debug("docid without rev: $docidWithoutRev");
-    my $reviewDocumentId = '';
-    my $response = $metacat->squery("<pathquery><querytitle>Moderator-Search</querytitle><querygroup operator='INTERSECT'><queryterm searchmode='contains' casesensitive='false'><value>$docidWithoutRev</value><pathexpr>/reviewHistory/review/packageId</pathexpr></queryterm></querygroup></pathquery>"); 
+	# find out if a docid already exists...
+	my ( $x, $y, $z ) = split( /\./, $docid );
+	my $docidWithoutRev = $x . "." . $y;
+	debug("docid without rev: $docidWithoutRev");
+	my $reviewDocumentId = '';
+	my $response         = $metacat->squery(
+"<pathquery><querytitle>Moderator-Search</querytitle><querygroup operator='INTERSECT'><queryterm searchmode='contains' casesensitive='false'><value>$docidWithoutRev</value><pathexpr>/reviewHistory/review/packageId</pathexpr></queryterm></querygroup></pathquery>"
+	);
 
-    my $doc = $response->content();
-    my $xmldoc = $parser->parse_string($doc);
+	my $doc    = $response->content();
+	my $xmldoc = $parser->parse_string($doc);
 
-    if ($xmldoc eq "" || $doc=~ /<error/) {
-        # not able to parse
-        debug("Unable to parse results for $docidWithoutRev query.");
-        return "Error: Unable to store review for the docid:".$docid;
-    } else {
-        my $findNodes = $xmldoc->findnodes('//resultset/document');
-        if ($findNodes->size() > 0) {
-            # found contact email address
-            my $node = '';
-            foreach $node ($findNodes->get_nodelist) {
-                $reviewDocumentId = findValue($node,'docid');
-            }
+	if ( $xmldoc eq "" || $doc =~ /<error/ ) {
 
-            # update the old document
-            $response = $metacat->read($reviewDocumentId);
-            $doc = $response->content();
-            $xmldoc = $parser->parse_string($doc);
+		# not able to parse
+		debug("Unable to parse results for $docidWithoutRev query.");
+		return "Error: Unable to store review for the docid:" . $docid;
+	}
+	else {
+		my $findNodes = $xmldoc->findnodes('//resultset/document');
+		if ( $findNodes->size() > 0 ) {
 
-            if ($xmldoc eq "" || $doc=~ /<error/) {
-                return " Unable to read the document from Metacat which has the old reviews for the docid:".$docid;
-            } else {
-                my ($reviewdoc, $temp) = split('</reviewHistory>', $doc);
-                $reviewdoc .= $review."\n</reviewHistory>\n";
-                $reviewDocumentId = incrementRevision($reviewDocumentId);
-                debug("Generating review history document for $reviewDocumentId");
-                debugDoc($reviewdoc);
-                $response = $metacat->update($reviewDocumentId, $reviewdoc);
-                if ($response != '1') {
-                    return " Unable to update the review on Metacat for the docid:".$docid;
-                } else {
-                    $response = $metacat->setaccess($reviewDocumentId, $userDN, "read", "allow", "denyFirst");
-                    if ($response != '1') {
-                        return " Unable to set access for the review document in Metacat for the docid:".$docid;
-                    }
-                    foreach (split(":", $moderators)) {
-                        $response = $metacat->setaccess($reviewDocumentId, $_, "all", "allow", "denyFirst");
-                        if ($response != '1') {
-                            return " Unable to set access for the review document in Metacat for the docid:".$docid;
-                        }
-                    }
-                }
-            }
-        } else {
-            #insert a new document
-            debug("no review history document found, generating a new one.");
+			# found contact email address
+			my $node = '';
+			foreach $node ( $findNodes->get_nodelist ) {
+				$reviewDocumentId = findValue( $node, 'docid' );
+			}
 
-            my $id = newAccessionNumber('esa_reviews', $metacat);
-            my $reviewDoc = '';
-            my $failMessage = " Unable to insert the review on Metacat for the docid:".$docid;
+			# update the old document
+			$response = $metacat->read($reviewDocumentId);
+			$doc      = $response->content();
+			$xmldoc   = $parser->parse_string($doc);
 
-            $reviewDoc .= "<?xml version=\"1.0\"?>";
-            $reviewDoc .= "<reviewHistory registryName=\"".$skinName."\">";
-            $reviewDoc .= $review;
-            $reviewDoc .= "</reviewHistory>";
-            $response = $metacat->insert($id, $reviewDoc);
+			if ( $xmldoc eq "" || $doc =~ /<error/ ) {
+				return
+" Unable to read the document from Metacat which has the old reviews for the docid:"
+				  . $docid;
+			}
+			else {
+				my ( $reviewdoc, $temp ) = split( '</reviewHistory>', $doc );
+				$reviewdoc .= $review . "\n</reviewHistory>\n";
+				$reviewDocumentId = incrementRevision($reviewDocumentId);
+				debug(
+					"Generating review history document for $reviewDocumentId");
+				debugDoc($reviewdoc);
+				$response = $metacat->update( $reviewDocumentId, $reviewdoc );
+				if ( $response != '1' ) {
+					return
+					  " Unable to update the review on Metacat for the docid:"
+					  . $docid;
+				}
+				else {
+					$response =
+					  $metacat->setaccess( $reviewDocumentId, $userDN, "read",
+						"allow", "denyFirst" );
+					if ( $response != '1' ) {
+						return
+" Unable to set access for the review document in Metacat for the docid:"
+						  . $docid;
+					}
+					foreach ( split( ":", $moderators ) ) {
+						$response =
+						  $metacat->setaccess( $reviewDocumentId, $_, "all",
+							"allow", "denyFirst" );
+						if ( $response != '1' ) {
+							return
+" Unable to set access for the review document in Metacat for the docid:"
+							  . $docid;
+						}
+					}
+				}
+			}
+		}
+		else {
 
-            if ($response != '1') {
-                return $failMessage;
-            } else {
-                # set access
-                $response = $metacat->setaccess($id, $userDN, "read", "allow", "denyFirst");
-                if ($response != '1') {
-                    return $failMessage;
-                }
-                foreach (split(":", $moderators)) {
-                    $response = $metacat->setaccess($id, $_, "all", "allow", "denyFirst");
-                    if ($response != '1') {
-                        return $failMessage;
-                    }
-                }
-                # DENY all public access to these documents
-                $response = $metacat->setaccess($id, 'public', "all", "deny", "denyFirst");
-                if ($response != '1') {
-                    return $failMessage;
-                }
+			#insert a new document
+			debug("no review history document found, generating a new one.");
 
-            }
-        }
-    }
+			my $id = newAccessionNumber( 'esa_reviews', $metacat );
+			my $reviewDoc = '';
+			my $failMessage =
+			  " Unable to insert the review on Metacat for the docid:" . $docid;
 
-    return '';
-    # find out if a document already exist. if not then insert a new one. otherwise update the old one    
-    # the owner of the document is the moderator 
+			$reviewDoc .= "<?xml version=\"1.0\"?>";
+			$reviewDoc .= "<reviewHistory registryName=\"" . $skinName . "\">";
+			$reviewDoc .= $review;
+			$reviewDoc .= "</reviewHistory>";
+			$response = $metacat->insert( $id, $reviewDoc );
+
+			if ( $response != '1' ) {
+				return $failMessage;
+			}
+			else {
+
+				# set access
+				$response = $metacat->setaccess( $id, $userDN, "read", "allow",
+					"denyFirst" );
+				if ( $response != '1' ) {
+					return $failMessage;
+				}
+				foreach ( split( ":", $moderators ) ) {
+					$response = $metacat->setaccess( $id, $_, "all", "allow",
+						"denyFirst" );
+					if ( $response != '1' ) {
+						return $failMessage;
+					}
+				}
+
+				# DENY all public access to these documents
+				$response = $metacat->setaccess( $id, 'public', "all", "deny",
+					"denyFirst" );
+				if ( $response != '1' ) {
+					return $failMessage;
+				}
+
+			}
+		}
+	}
+
+	return '';
+
+# find out if a document already exist. if not then insert a new one. otherwise update the old one
+# the owner of the document is the moderator
 }
 
 ################################################################################
-# 
-# send an email message to the moderator and the contact 
 #
+# send an email message to the moderator and the contact
+#
 ################################################################################
 sub modSendNotification {
-    my $title = shift;
-    my $contactEmailAddress = shift;
-    my $contactName = shift;
-    my $subject = shift;
+	my $title               = shift;
+	my $contactEmailAddress = shift;
+	my $contactName         = shift;
+	my $subject             = shift;
 
-    debug($subject);
-    # send notification to the user and the moderator
-    my $templateVars = { 'stage' => $FORM::stage };
-    my ($x, $y, $z) = split(/\./, $FORM::docid);
-    my $docidWithoutRev = $x.".".$y;
-    $$templateVars{'docid'} = $docidWithoutRev;
-    $$templateVars{'comment'} = $FORM::review;
-    $$templateVars{'contactName'} = $contactName;
-    $$templateVars{'dpTitle'} = $title;
-    $$templateVars{'registryUrl'} = $contextUrl . "/cgi-bin/register-dataset.cgi";
-    $$templateVars{'recipient_status'} = 'moderator';
-    sendNotification($email->{'sender'}, $email->{'recipient'}, $subject, 
-                            $templates->{'modEmailNotification'}, $templateVars);
-    if ($contactEmailAddress ne '') {
-        # send notification to contact email address specified in cfg   
-        $$templateVars{'recipient_status'} = 'user';
-        sendNotification($email->{'sender'}, $contactEmailAddress, 
-            $subject, $templates->{'modEmailNotification'}, $templateVars);
-    }
+	#debug($subject);
+	# send notification to the user and the moderator
+	my $templateVars = { 'stage' => $FORM::stage };
+	my ( $x, $y, $z ) = split( /\./, $FORM::docid );
+	my $docidWithoutRev = $x . "." . $y;
+	$$templateVars{'docid'}       = $docidWithoutRev;
+	$$templateVars{'fullDocid'}   = $FORM::docid;
+	if (hasContent($FORM::function)) {
+		$$templateVars{'function'}    = $FORM::function;
+	} else {
+		$$templateVars{'function'}    = 'unknown';
+	}
+	$$templateVars{'comment'}     = $FORM::review;
+	$$templateVars{'contactName'} = $contactName;
+	$$templateVars{'dpTitle'}     = $title;
+	$$templateVars{'registryUrl'} =
+	  $contextUrl . "/cgi-bin/register-dataset.cgi";
+	$$templateVars{'metacatUrl'}       = $metacatUrl;
+	$$templateVars{'contextUrl'}       = $contextUrl;
+	$$templateVars{'recipient_status'} = 'moderator';
+	debug(
+"modSendNotification - sending moderator notification to: $email->{'recipient'} with subject: $subject"
+	);
+	sendNotification( $email->{'sender'}, $email->{'recipient'}, $subject,
+		$templates->{'modEmailNotification'},
+		$templateVars );
+
+	if ( $contactEmailAddress ne '' ) {
+
+		# send notification to contact email address specified in cfg
+		$$templateVars{'recipient_status'} = 'user';
+		debug(
+"modSendNotification - sending user notification to: $contactEmailAddress with subject: $subject"
+		);
+		sendNotification( $email->{'sender'}, $contactEmailAddress, $subject,
+			$templates->{'modEmailNotification'},
+			$templateVars );
+	}
 }
 
 ################################################################################
-# 
-# send an email message notifying the moderator of a new submission 
 #
+# send an email message notifying the moderator of a new submission
+#
 ################################################################################
 sub sendNotification {
-    my $sender = shift;
-    my $recipient = shift;
-    my $subject = shift;
-    my $templateForm = shift;
-    my $templateVars = shift;
-    
-    # When testing, set recipient to your email address
-    # $recipient = 'walbridge@nceas.ucsb.edu';
-    my $smtp = Net::SMTP->new($email->{'mailhost'});
-    $smtp->mail($sender);
-    $smtp->to($recipient);
+	my $sender       = shift;
+	my $recipient    = shift;
+	my $subject      = shift;
+	my $templateForm = shift;
+	my $templateVars = shift;
 
-    $smtp->data;
-    $smtp->datasend("From: $sender\n");
-    $smtp->datasend("To: <$recipient>\n");
-    $smtp->datasend("Subject: $subject\n");
-    $smtp->datasend("\n");
+	# When testing, set recipient to your email address
+	# $recipient = 'walbridge@nceas.ucsb.edu';
+	my $smtp = Net::SMTP->new( $email->{'mailhost'} );
+	$smtp->mail($sender);
+	$smtp->to($recipient);
 
-    my $message;
-    $template->process($templateForm, $templateVars,\$message);
+	$smtp->data;
+	$smtp->datasend("From: $sender\n");
+	$smtp->datasend("To: <$recipient>\n");
+	$smtp->datasend("Subject: $subject\n");
+	$smtp->datasend("\n");
 
-    $smtp->datasend($message);
-    $smtp->dataend();
-    $smtp->quit;
+	my $message;
+	$template->process( $templateForm, $templateVars, \$message );
+
+	$smtp->datasend($message);
+	$smtp->dataend();
+	$smtp->quit;
 }
 
 ################################################################################
-# 
-# sends back the result to the use 
 #
+# sends back the result to the use
+#
 ################################################################################
-sub processResultTemplate(){
-    my $stage = shift;
-    my $result = shift;
-    my $message = shift;
+sub processResultTemplate() {
+	my $stage   = shift;
+	my $result  = shift;
+	my $message = shift;
 
-    if ($result eq 'success') {
-        if ($stage eq 'accept') {
-            $message = "Dataset (docid:".$FORM::docid.") accepted ";
-        } elsif ($stage eq 'decline') {
-            $message = "Dataset (docid:".$FORM::docid.") declined ";
-        } else {
-            $message = "Revision requested for dataset (docid:".$FORM::docid.") ";
-        }
-    } else {
-        if ($stage eq 'accept') {
-            $message = "Failure in accepting docid: ".$FORM::docid." (".$message.")";
-        } elsif($stage eq 'decline') {
-            $message = "Failure in declining docid: ".$FORM::docid." (".$message.")";
-        } else {
-            $message = "Failure in requesting revision of docid: ".$FORM::docid." (".$message.")";
-        }
-    }
-    $$templateVars{'message'} = $message;
-    $template->process($templates->{'modResult'}, $templateVars);
+	if ( $result eq 'success' ) {
+		if ( $stage eq 'accept' ) {
+			$message = "Dataset (docid:" . $FORM::docid . ") accepted ";
+		}
+		elsif ( $stage eq 'decline' ) {
+			$message = "Dataset (docid:" . $FORM::docid . ") declined ";
+		}
+		else {
+			$message =
+			  "Revision requested for dataset (docid:" . $FORM::docid . ") ";
+		}
+	}
+	else {
+		if ( $stage eq 'accept' ) {
+			$message =
+			    "Failure in accepting docid: "
+			  . $FORM::docid . " ("
+			  . $message . ")";
+		}
+		elsif ( $stage eq 'decline' ) {
+			$message =
+			    "Failure in declining docid: "
+			  . $FORM::docid . " ("
+			  . $message . ")";
+		}
+		else {
+			$message =
+			    "Failure in requesting revision of docid: "
+			  . $FORM::docid . " ("
+			  . $message . ")";
+		}
+	}
+	$$templateVars{'message'} = $message;
+	$template->process( $templates->{'modResult'}, $templateVars );
 }
 
-
 ################################################################################
-# 
+#
 # Do data validation and send the data to confirm data template.
 #
 ################################################################################
-sub toConfirmData{
-    # Check if any invalid parameters
+sub toConfirmData {
 
-    my $invalidParams;
-    if (! $error) {
-        $invalidParams = validateParameters(0);
-        if (scalar(@$invalidParams)) {
-            $$templateVars{'status'} = 'failure';
-            $$templateVars{'invalidParams'} = $invalidParams;
-            $error = 1;
-        }
-    }
+	# Check if any invalid parameters
 
-    $$templateVars{'providerGivenName'} = normalizeCD($FORM::providerGivenName);
-    $$templateVars{'providerSurName'} = normalizeCD($FORM::providerSurName);
-    if ($FORM::site eq "Select your station here.") {
-        $$templateVars{'site'} = "";
-    } else {
-        $$templateVars{'site'} = $FORM::site;
-    }
-    if ($skinName eq "nceas") {
-        $$templateVars{'wg'} = \@FORM::wg;
-    }
-    $$templateVars{'identifier'} = normalizeCD($FORM::identifier);
-    $$templateVars{'title'} = normalizeCD($FORM::title);
-    $$templateVars{'origNamefirst0'} = normalizeCD($FORM::origNamefirst0);
-    $$templateVars{'origNamelast0'} = normalizeCD($FORM::origNamelast0);
-    $$templateVars{'origNameOrg'} = normalizeCD($FORM::origNameOrg);
-    $$templateVars{'origDelivery'} = normalizeCD($FORM::origDelivery);
-    $$templateVars{'origCity'} = normalizeCD($FORM::origCity);
-    if ($FORM::origState =~ /select state/i) {
-        $$templateVars{'origState'} = "";
-    } else {
-        $$templateVars{'origState'} = $FORM::origState;
-    }
-    $$templateVars{'origStateOther'} = normalizeCD($FORM::origStateOther);
-    $$templateVars{'origZIP'} = normalizeCD($FORM::origZIP);
-    $$templateVars{'origCountry'} = normalizeCD($FORM::origCountry);
-    $$templateVars{'origPhone'} = normalizeCD($FORM::origPhone);
-    $$templateVars{'origFAX'} = normalizeCD($FORM::origFAX);
-    $$templateVars{'origEmail'} = normalizeCD($FORM::origEmail);
-    $$templateVars{'useOrigAddress'} = normalizeCD($FORM::useOrigAddress);
-    if ($FORM::useOrigAddress eq "on") {
-        $$templateVars{'origNamefirstContact'} = normalizeCD($FORM::origNamefirst0);
-        $$templateVars{'origNamelastContact'} = normalizeCD($FORM::origNamelast0);
-        $$templateVars{'origNameOrgContact'} = normalizeCD($FORM::origNameOrg);
-        $$templateVars{'origDeliveryContact'} = normalizeCD($FORM::origDelivery); 
-        $$templateVars{'origCityContact'} = normalizeCD($FORM::origCity);
-        if ($FORM::origState =~ /select state/i) {
-            $$templateVars{'origStateContact'} = "";
-        } else {
-            $$templateVars{'origStateContact'} = $FORM::origState;
-        }
-        $$templateVars{'origStateOtherContact'} = normalizeCD($FORM::origStateOther);
-        $$templateVars{'origZIPContact'} = normalizeCD($FORM::origZIP);
-        $$templateVars{'origCountryContact'} = normalizeCD($FORM::origCountry);
-        $$templateVars{'origPhoneContact'} = normalizeCD($FORM::origPhone);
-        $$templateVars{'origFAXContact'} = normalizeCD($FORM::origFAX);
-        $$templateVars{'origEmailContact'} = normalizeCD($FORM::origEmail);
-    } else {
-        $$templateVars{'origNamefirstContact'} = normalizeCD($FORM::origNamefirstContact);
-        $$templateVars{'origNamelastContact'} = normalizeCD($FORM::origNamelastContact);
-        $$templateVars{'origNameOrgContact'} = normalizeCD($FORM::origNameOrgContact);
-        $$templateVars{'origDeliveryContact'} = normalizeCD($FORM::origDeliveryContact); 
-        $$templateVars{'origCityContact'} = normalizeCD($FORM::origCityContact);
-        if ($FORM::origStateContact =~ /select state/i) {
-            $$templateVars{'origStateContact'} = "";
-        } else {
-            $$templateVars{'origStateContact'} = $FORM::origStateContact;
-        }
-        $$templateVars{'origStateOtherContact'} = normalizeCD($FORM::origStateOtherContact);
-        $$templateVars{'origZIPContact'} = normalizeCD($FORM::origZIPContact);
-        $$templateVars{'origCountryContact'} = normalizeCD($FORM::origCountryContact);
-        $$templateVars{'origPhoneContact'} = normalizeCD($FORM::origPhoneContact);
-        $$templateVars{'origFAXContact'} = normalizeCD($FORM::origFAXContact);
-        $$templateVars{'origEmailContact'} = normalizeCD($FORM::origEmailContact);    
-    }
+	my $invalidParams;
+	if ( !$error ) {
+		$invalidParams = validateParameters(0);
+		if ( scalar(@$invalidParams) ) {
+			$$templateVars{'status'}        = 'failure';
+			$$templateVars{'invalidParams'} = $invalidParams;
+			$error                          = 1;
+		}
+	}
 
-    my $aoFNArray = \@FORM::aoFirstName;
-    my $aoLNArray = \@FORM::aoLastName;
-    my $aoRoleArray = \@FORM::aoRole;
-    my $aoCount = 1;
+	$$templateVars{'providerGivenName'} = normalizeCD($FORM::providerGivenName);
+	$$templateVars{'providerSurName'}   = normalizeCD($FORM::providerSurName);
+	if ( $FORM::site eq "Select your station here." ) {
+		$$templateVars{'site'} = "";
+	}
+	else {
+		$$templateVars{'site'} = $FORM::site;
+	}
+	if ( $skinName eq "nceas" ) {
+		$$templateVars{'wg'} = \@FORM::wg;
+	}
+	$$templateVars{'identifier'}     = normalizeCD($FORM::identifier);
+	$$templateVars{'title'}          = normalizeCD($FORM::title);
+	$$templateVars{'origNamefirst0'} = normalizeCD($FORM::origNamefirst0);
+	$$templateVars{'origNamelast0'}  = normalizeCD($FORM::origNamelast0);
+	$$templateVars{'origNameOrg'}    = normalizeCD($FORM::origNameOrg);
+	$$templateVars{'origDelivery'}   = normalizeCD($FORM::origDelivery);
+	$$templateVars{'origCity'}       = normalizeCD($FORM::origCity);
 
-    for (my $i = 0; $i <= $#$aoRoleArray; $i++) {
-        if (hasContent($aoFNArray->[$i]) && hasContent($aoLNArray->[$i])) {
-            debug("Processing Associated Party: origName = ".$aoFNArray->[$i]
-                  ." origNamelast = ".$aoLNArray->[$i]." origRole = "
-                  .$aoRoleArray->[$i]);
-            $$templateVars{"origNamefirst".$aoCount} = normalizeCD($aoFNArray->[$i]);
-            $$templateVars{"origNamelast".$aoCount} = normalizeCD($aoLNArray->[$i]);
-            $$templateVars{"origRole".$aoCount} = normalizeCD($aoRoleArray->[$i]);
-            $aoCount++;
-        }
-    }
+	if ( $FORM::origState =~ /select state/i ) {
+		$$templateVars{'origState'} = "";
+	}
+	else {
+		$$templateVars{'origState'} = $FORM::origState;
+	}
+	$$templateVars{'origStateOther'} = normalizeCD($FORM::origStateOther);
+	$$templateVars{'origZIP'}        = normalizeCD($FORM::origZIP);
+	$$templateVars{'origCountry'}    = normalizeCD($FORM::origCountry);
+	$$templateVars{'origPhone'}      = normalizeCD($FORM::origPhone);
+	$$templateVars{'origFAX'}        = normalizeCD($FORM::origFAX);
+	$$templateVars{'origEmail'}      = normalizeCD($FORM::origEmail);
+	$$templateVars{'useOrigAddress'} = normalizeCD($FORM::useOrigAddress);
+	if ( $FORM::useOrigAddress eq "on" ) {
+		$$templateVars{'origNamefirstContact'} =
+		  normalizeCD($FORM::origNamefirst0);
+		$$templateVars{'origNamelastContact'} =
+		  normalizeCD($FORM::origNamelast0);
+		$$templateVars{'origNameOrgContact'} = normalizeCD($FORM::origNameOrg);
+		$$templateVars{'origDeliveryContact'} =
+		  normalizeCD($FORM::origDelivery);
+		$$templateVars{'origCityContact'} = normalizeCD($FORM::origCity);
+		if ( $FORM::origState =~ /select state/i ) {
+			$$templateVars{'origStateContact'} = "";
+		}
+		else {
+			$$templateVars{'origStateContact'} = $FORM::origState;
+		}
+		$$templateVars{'origStateOtherContact'} =
+		  normalizeCD($FORM::origStateOther);
+		$$templateVars{'origZIPContact'}     = normalizeCD($FORM::origZIP);
+		$$templateVars{'origCountryContact'} = normalizeCD($FORM::origCountry);
+		$$templateVars{'origPhoneContact'}   = normalizeCD($FORM::origPhone);
+		$$templateVars{'origFAXContact'}     = normalizeCD($FORM::origFAX);
+		$$templateVars{'origEmailContact'}   = normalizeCD($FORM::origEmail);
+	}
+	else {
+		$$templateVars{'origNamefirstContact'} =
+		  normalizeCD($FORM::origNamefirstContact);
+		$$templateVars{'origNamelastContact'} =
+		  normalizeCD($FORM::origNamelastContact);
+		$$templateVars{'origNameOrgContact'} =
+		  normalizeCD($FORM::origNameOrgContact);
+		$$templateVars{'origDeliveryContact'} =
+		  normalizeCD($FORM::origDeliveryContact);
+		$$templateVars{'origCityContact'} = normalizeCD($FORM::origCityContact);
+		if ( $FORM::origStateContact =~ /select state/i ) {
+			$$templateVars{'origStateContact'} = "";
+		}
+		else {
+			$$templateVars{'origStateContact'} = $FORM::origStateContact;
+		}
+		$$templateVars{'origStateOtherContact'} =
+		  normalizeCD($FORM::origStateOtherContact);
+		$$templateVars{'origZIPContact'} = normalizeCD($FORM::origZIPContact);
+		$$templateVars{'origCountryContact'} =
+		  normalizeCD($FORM::origCountryContact);
+		$$templateVars{'origPhoneContact'} =
+		  normalizeCD($FORM::origPhoneContact);
+		$$templateVars{'origFAXContact'} = normalizeCD($FORM::origFAXContact);
+		$$templateVars{'origEmailContact'} =
+		  normalizeCD($FORM::origEmailContact);
+	}
 
-    $$templateVars{'aoCount'} = $aoCount;
-    $$templateVars{'abstract'} = normalizeCD($FORM::abstract);
+	my $aoFNArray   = \@FORM::aoFirstName;
+	my $aoLNArray   = \@FORM::aoLastName;
+	my $aoRoleArray = \@FORM::aoRole;
+	my $aoCount     = 1;
 
+	for ( my $i = 0 ; $i <= $#$aoRoleArray ; $i++ ) {
+		if ( hasContent( $aoFNArray->[$i] ) && hasContent( $aoLNArray->[$i] ) )
+		{
+			debug(  "Processing Associated Party: origName = "
+				  . $aoFNArray->[$i]
+				  . " origNamelast = "
+				  . $aoLNArray->[$i]
+				  . " origRole = "
+				  . $aoRoleArray->[$i] );
+			$$templateVars{ "origNamefirst" . $aoCount } =
+			  normalizeCD( $aoFNArray->[$i] );
+			$$templateVars{ "origNamelast" . $aoCount } =
+			  normalizeCD( $aoLNArray->[$i] );
+			$$templateVars{ "origRole" . $aoCount } =
+			  normalizeCD( $aoRoleArray->[$i] );
+			$aoCount++;
+		}
+	}
 
-    my $keywordArray = \@FORM::keyword;
-    my $keywordTypeArray = \@FORM::keywordType;
-    my $keywordThArray = \@FORM::keywordTh;
-    my $keyCount = 1;
+	$$templateVars{'aoCount'}  = $aoCount;
+	$$templateVars{'abstract'} = normalizeCD($FORM::abstract);
 
-    for (my $i = 0; $i <= $#$keywordArray; $i++) {
-        if (hasContent($keywordArray->[$i])) {
-            debug("Processing keyword: keyword = ".$keywordArray->[$i]."
-                  keywordType = ".$keywordTypeArray->[$i]."
-                  keywordTh = ".$keywordThArray->[$i]);
-            $$templateVars{"keyword".$keyCount} = normalizeCD($keywordArray->[$i]);
-            $$templateVars{"kwType".$keyCount} = normalizeCD($keywordTypeArray->[$i]);
-            $$templateVars{"kwTh".$keyCount} = normalizeCD($keywordThArray->[$i]);
-            $keyCount++;
-        }
-    }
-    $$templateVars{'keyCount'} = $keyCount;
+	my $keywordArray     = \@FORM::keyword;
+	my $keywordTypeArray = \@FORM::keywordType;
+	my $keywordThArray   = \@FORM::keywordTh;
+	my $keyCount         = 1;
 
-    $$templateVars{'addComments'} = normalizeCD($FORM::addComments);
-    $$templateVars{'useConstraints'} = $FORM::useConstraints;
-    if ($FORM::useConstraints eq "other") {
-        $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
-    }
-    $$templateVars{'url'} = $FORM::url;
-    $$templateVars{'dataMedium'} = $FORM::dataMedium;
-    if ($FORM::dataMedium eq "other") {
-        $$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
-    }
-    $$templateVars{'beginningYear'} = $FORM::beginningYear;
-    $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
-    $$templateVars{'beginningDay'} = $FORM::beginningDay;
-    $$templateVars{'endingYear'} = $FORM::endingYear;
-    $$templateVars{'endingMonth'} = $FORM::endingMonth;
-    $$templateVars{'endingDay'} = $FORM::endingDay;
-    $$templateVars{'geogdesc'} = normalizeCD($FORM::geogdesc);
-    $$templateVars{'useSiteCoord'} = $FORM::useSiteCoord;
-    $$templateVars{'latDeg1'} = $FORM::latDeg1;
-    $$templateVars{'latMin1'} = $FORM::latMin1;
-    $$templateVars{'latSec1'} = $FORM::latSec1;
-    $$templateVars{'hemisphLat1'} = $FORM::hemisphLat1;
-    $$templateVars{'longDeg1'} = $FORM::longDeg1;
-    $$templateVars{'longMin1'} = $FORM::longMin1;
-    $$templateVars{'longSec1'} = $FORM::longSec1;
-    $$templateVars{'hemisphLong1'} = $FORM::hemisphLong1;
-    $$templateVars{'latDeg2'} = $FORM::latDeg2;
-    $$templateVars{'latMin2'} = $FORM::latMin2;
-    $$templateVars{'latSec2'} = $FORM::latSec2;
-    $$templateVars{'hemisphLat2'} = $FORM::hemisphLat2;
-    $$templateVars{'longDeg2'} = $FORM::longDeg2;
-    $$templateVars{'longMin2'} = $FORM::longMin2;
-    $$templateVars{'longSec2'} = $FORM::longSec2;
-    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
+	for ( my $i = 0 ; $i <= $#$keywordArray ; $i++ ) {
+		if ( hasContent( $keywordArray->[$i] ) ) {
+			debug(
+				"Processing keyword: keyword = " . $keywordArray->[$i] . "
+                  keywordType = " . $keywordTypeArray->[$i] . "
+                  keywordTh = " . $keywordThArray->[$i]
+			);
+			$$templateVars{ "keyword" . $keyCount } =
+			  normalizeCD( $keywordArray->[$i] );
+			$$templateVars{ "kwType" . $keyCount } =
+			  normalizeCD( $keywordTypeArray->[$i] );
+			$$templateVars{ "kwTh" . $keyCount } =
+			  normalizeCD( $keywordThArray->[$i] );
+			$keyCount++;
+		}
+	}
+	$$templateVars{'keyCount'} = $keyCount;
 
-    my $taxonRankArray = \@FORM::taxonRank;
-    my $taxonNameArray = \@FORM::taxonName;
-    my $taxonCount = 1;
+	$$templateVars{'addComments'}    = normalizeCD($FORM::addComments);
+	$$templateVars{'useConstraints'} = $FORM::useConstraints;
+	if ( $FORM::useConstraints eq "other" ) {
+		$$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
+	}
+	$$templateVars{'url'}        = $FORM::url;
+	$$templateVars{'dataMedium'} = $FORM::dataMedium;
+	if ( $FORM::dataMedium eq "other" ) {
+		$$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
+	}
+	$$templateVars{'beginningYear'}  = $FORM::beginningYear;
+	$$templateVars{'beginningMonth'} = $FORM::beginningMonth;
+	$$templateVars{'beginningDay'}   = $FORM::beginningDay;
+	$$templateVars{'endingYear'}     = $FORM::endingYear;
+	$$templateVars{'endingMonth'}    = $FORM::endingMonth;
+	$$templateVars{'endingDay'}      = $FORM::endingDay;
+	$$templateVars{'geogdesc'}       = normalizeCD($FORM::geogdesc);
+	$$templateVars{'useSiteCoord'}   = $FORM::useSiteCoord;
+	$$templateVars{'latDeg1'}        = $FORM::latDeg1;
+	$$templateVars{'latMin1'}        = $FORM::latMin1;
+	$$templateVars{'latSec1'}        = $FORM::latSec1;
+	$$templateVars{'hemisphLat1'}    = $FORM::hemisphLat1;
+	$$templateVars{'longDeg1'}       = $FORM::longDeg1;
+	$$templateVars{'longMin1'}       = $FORM::longMin1;
+	$$templateVars{'longSec1'}       = $FORM::longSec1;
+	$$templateVars{'hemisphLong1'}   = $FORM::hemisphLong1;
+	$$templateVars{'latDeg2'}        = $FORM::latDeg2;
+	$$templateVars{'latMin2'}        = $FORM::latMin2;
+	$$templateVars{'latSec2'}        = $FORM::latSec2;
+	$$templateVars{'hemisphLat2'}    = $FORM::hemisphLat2;
+	$$templateVars{'longDeg2'}       = $FORM::longDeg2;
+	$$templateVars{'longMin2'}       = $FORM::longMin2;
+	$$templateVars{'longSec2'}       = $FORM::longSec2;
+	$$templateVars{'hemisphLong2'}   = $FORM::hemisphLong2;
 
-    for (my $i = 0; $i <= $#$taxonNameArray; $i++) {
-        if (hasContent($taxonRankArray->[$i]) && hasContent($taxonNameArray->[$i])) {
-            debug("Processing keyword: trv = ".$taxonRankArray->[$i]
-                    ." trn = ".$taxonNameArray->[$i]);
-            $$templateVars{"taxonRankName".$taxonCount} = normalizeCD($taxonRankArray->[$i]);
-            $$templateVars{"taxonRankValue".$taxonCount} = normalizeCD($taxonNameArray->[$i]);
-            $taxonCount++;
-        }
-    }
+	my $taxonRankArray = \@FORM::taxonRank;
+	my $taxonNameArray = \@FORM::taxonName;
+	my $taxonCount     = 1;
 
-    $$templateVars{'taxaCount'} = $taxonCount-1;
-    $$templateVars{'taxaAuth'} = normalizeCD($FORM::taxaAuth);
-    my $deleteCount = 0;
+	for ( my $i = 0 ; $i <= $#$taxonNameArray ; $i++ ) {
+		if (   hasContent( $taxonRankArray->[$i] )
+			&& hasContent( $taxonNameArray->[$i] ) )
+		{
+			debug(  "Processing keyword: trv = "
+				  . $taxonRankArray->[$i]
+				  . " trn = "
+				  . $taxonNameArray->[$i] );
+			$$templateVars{ "taxonRankName" . $taxonCount } =
+			  normalizeCD( $taxonRankArray->[$i] );
+			$$templateVars{ "taxonRankValue" . $taxonCount } =
+			  normalizeCD( $taxonNameArray->[$i] );
+			$taxonCount++;
+		}
+	}
 
-    for (my $i = 0; $i <= scalar(@FORM::deletefile); $i++) {
-        my $delfile = pop(@FORM::deletefile);
-        $$templateVars{"deletefile_$deleteCount"} = $delfile;
-        debug(" creating deletefile_$deleteCount = $delfile"); 
-        $deleteCount++;
-    }
-    $$templateVars{"delCount"} = $deleteCount;
-    for (my $upNum = 0; $upNum <= $FORM::upCount; $upNum++) {
-        my $upn = "upload_$upNum";
-        if (hasContent(param($upn))) {
-            debug("Processing existing file: $upn");
-            $$templateVars{"upload_$upNum"} = param("upload_$upNum");
-            $$templateVars{"uploadname_$upNum"} = param("uploadname_$upNum");
-            $$templateVars{"uploadtype_$upNum"} = param("uploadtype_$upNum");
-            $$templateVars{"uploadperm_$upNum"} = param("uploadperm_$upNum");
-        }
-    }
+	$$templateVars{'taxaCount'} = $taxonCount - 1;
+	$$templateVars{'taxaAuth'}  = normalizeCD($FORM::taxaAuth);
+	my $deleteCount = 0;
 
-    my $uploadCount = 0;
-    for (my $fileNum = 0; $fileNum <= $FORM::fileCount; $fileNum++) {
-        my $fn = 'file_' . $fileNum;
-        if (hasContent(param($fn))) {
-            my $fileName = eval "\$FORM::file_$fileNum";
-            debug("Processing file: $fn");
-            # Upload the file object itself to a temporary file, copy file metadata to form
-            my $fileInfo = processFile($fileName);
-            $$templateVars{"upload_$fileNum"} = $fileInfo->{'fileHash'};
-            $$templateVars{"uploadname_$fileNum"} = $fileInfo->{'fileName'};
-            $$templateVars{"uploadtype_$fileNum"} = $fileInfo->{'contentType'};
-            $$templateVars{"uploadperm_$fileNum"} = param("uploadperm_$fileNum");
-            $uploadCount++;
-        }
-    }
-    # total uploads are: new uploads - deleted files + original uploads
-    $$templateVars{'upCount'} = $uploadCount + $FORM::upCount;
-    $$templateVars{'methodTitle'} = normalizeCD($FORM::methodTitle);
+	for ( my $i = 0 ; $i <= scalar(@FORM::deletefile) ; $i++ ) {
+		my $delfile = pop(@FORM::deletefile);
+		$$templateVars{"deletefile_$deleteCount"} = $delfile;
+		debug(" creating deletefile_$deleteCount = $delfile");
+		$deleteCount++;
+	}
+	$$templateVars{"delCount"} = $deleteCount;
+	for ( my $upNum = 0 ; $upNum <= $FORM::upCount ; $upNum++ ) {
+		my $upn = "upload_$upNum";
+		if ( hasContent( param($upn) ) ) {
+			debug("Processing existing file: $upn");
+			$$templateVars{"upload_$upNum"}     = param("upload_$upNum");
+			$$templateVars{"uploadname_$upNum"} = param("uploadname_$upNum");
+			$$templateVars{"uploadtype_$upNum"} = param("uploadtype_$upNum");
+			$$templateVars{"uploadperm_$upNum"} = param("uploadperm_$upNum");
+		}
+	}
 
-    my @tempMethodPara;
-    for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
-        $tempMethodPara[$i] = normalizeCD($FORM::methodPara[$i]);
-    }
-    $$templateVars{'methodPara'} = \@tempMethodPara;
-    $$templateVars{'studyExtentDescription'} = normalizeCD($FORM::studyExtentDescription);
-    $$templateVars{'samplingDescription'} = normalizeCD($FORM::samplingDescription);
-    $$templateVars{'modules'} = $modules;
-    $$templateVars{'required'} = $required;
-    $$templateVars{'show'} = $show;
-    $$templateVars{'site'} = $FORM::site;
-    $$templateVars{'docid'} = $FORM::docid;
+	my $uploadCount = 0;
+	for ( my $fileNum = 0 ; $fileNum <= $FORM::fileCount ; $fileNum++ ) {
+		my $fn = 'file_' . $fileNum;
+		if ( hasContent( param($fn) ) ) {
+			my $fileName = eval "\$FORM::file_$fileNum";
+			debug("Processing file: $fn");
 
-    # Check if the session exists
-    my $session = CGI::Session->load();
-    if (!($session->is_empty || $session->is_expired)) {
-        $$templateVars{'userLoggedIn'} = 'true';
-    }
-    
-    # Errors from validation function. print the errors out using the response template
-    if (scalar(@errorMessages)) {
-        debug("Error messages found when confirming data.");
-        $$templateVars{'status'} = 'failure';
-        $$templateVars{'errorMessages'} = \@errorMessages;
-        $error = 1;
-    }
+ # Upload the file object itself to a temporary file, copy file metadata to form
+			my $fileInfo = processFile($fileName);
+			$$templateVars{"upload_$fileNum"}     = $fileInfo->{'fileHash'};
+			$$templateVars{"uploadname_$fileNum"} = $fileInfo->{'fileName'};
+			$$templateVars{"uploadtype_$fileNum"} = $fileInfo->{'contentType'};
+			$$templateVars{"uploadperm_$fileNum"} =
+			  param("uploadperm_$fileNum");
+			$uploadCount++;
+		}
+	}
 
-    if (!$error) {
-        # If no errors, then print out data in confirm Data template
-        $$templateVars{'section'} = "Confirm Data";
-        $template->process($templates->{'confirmData'}, $templateVars);
+	# total uploads are: new uploads - deleted files + original uploads
+	$$templateVars{'upCount'}     = $uploadCount + $FORM::upCount;
+	$$templateVars{'methodTitle'} = normalizeCD($FORM::methodTitle);
 
-    } else {    
-        # Create our HTML response and send it back
-        $$templateVars{'function'} = "submitted";
-        $$templateVars{'section'} = "Submission Status";
-        $template->process($templates->{'response'}, $templateVars);
-    }
+	my @tempMethodPara;
+	for ( my $i = 0 ; $i < scalar(@FORM::methodPara) ; $i++ ) {
+		$tempMethodPara[$i] = normalizeCD( $FORM::methodPara[$i] );
+	}
+	$$templateVars{'methodPara'} = \@tempMethodPara;
+	$$templateVars{'studyExtentDescription'} =
+	  normalizeCD($FORM::studyExtentDescription);
+	$$templateVars{'samplingDescription'} =
+	  normalizeCD($FORM::samplingDescription);
+#	$$templateVars{'origStateContact'} = $FORM::origState;
+	$$templateVars{'modules'}          = $modules;
+	$$templateVars{'required'}         = $required;
+	$$templateVars{'show'}             = $show;
+	$$templateVars{'site'}             = $FORM::site;
+	$$templateVars{'docid'}            = $FORM::docid;
+
+	# Check if the session exists
+	my $session = CGI::Session->load();
+	if ( !( $session->is_empty || $session->is_expired ) ) {
+		$$templateVars{'userLoggedIn'} = 'true';
+	}
+
+# Errors from validation function. print the errors out using the response template
+	if ( scalar(@errorMessages) ) {
+		debug("Error messages found when confirming data.");
+		$$templateVars{'status'}        = 'failure';
+		$$templateVars{'errorMessages'} = \@errorMessages;
+		$error                          = 1;
+	}
+
+	if ( !$error ) {
+
+		# If no errors, then print out data in confirm Data template
+		$$templateVars{'section'} = "Confirm Data";
+		$template->process( $templates->{'confirmData'}, $templateVars );
+
+	}
+	else {
+
+		# Create our HTML response and send it back
+		$$templateVars{'function'} = "submitted";
+		$$templateVars{'section'}  = "Submission Status";
+		$template->process( $templates->{'response'}, $templateVars );
+	}
 }
 
-
 ################################################################################
-# 
+#
 # From confirm Data template - user wants to make some changes.
 #
 ################################################################################
-sub confirmDataToReEntryData{
-    my @sortedSites;
-    foreach my $site (sort @sitelist) {
-        push(@sortedSites, $site);
-    }
+sub confirmDataToReEntryData {
+	my @sortedSites;
+	foreach my $site ( sort @sitelist ) {
+		push( @sortedSites, $site );
+	}
 
-    $$templateVars{'siteList'} = \@sortedSites;
-    $$templateVars{'section'} = "Re-Entry Form";
-    copyFormToTemplateVars();
-    $$templateVars{'docid'} = $FORM::docid;
+	$$templateVars{'siteList'} = \@sortedSites;
+	$$templateVars{'section'}  = "Re-Entry Form";
+	copyFormToTemplateVars();
+	$$templateVars{'docid'} = $FORM::docid;
 
-    $$templateVars{'form'} = 're_entry';
-    $template->process($templates->{'entry'}, $templateVars);
+	$$templateVars{'form'} = 're_entry';
+	$template->process( $templates->{'entry'}, $templateVars );
 }
 
-
 ################################################################################
-# 
+#
 # Copy form data to templateVars.....
 #
 ################################################################################
-sub copyFormToTemplateVars{
-    $$templateVars{'providerGivenName'} = $FORM::providerGivenName;
-    $$templateVars{'providerSurName'} = $FORM::providerSurName;
-    $$templateVars{'site'} = $FORM::site;
-    if ($skinName eq "nceas") {
-        my $projects = getProjectList($properties);
-        $$templateVars{'projects'} = $projects;
-        $$templateVars{'wg'} = \@FORM::wg;
-    }
-    $$templateVars{'identifier'} = $FORM::identifier;
-    $$templateVars{'title'} = $FORM::title;
-    $$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
-    $$templateVars{'origNamelast0'} = $FORM::origNamelast0;
-    $$templateVars{'origNameOrg'} = $FORM::origNameOrg;
-    $$templateVars{'origDelivery'} = $FORM::origDelivery;
-    $$templateVars{'origCity'} = $FORM::origCity;
-    $$templateVars{'origState'} = $FORM::origState;
-    $$templateVars{'origStateOther'} = $FORM::origStateOther;
-    $$templateVars{'origZIP'} = $FORM::origZIP;
-    $$templateVars{'origCountry'} = $FORM::origCountry;
-    $$templateVars{'origPhone'} = $FORM::origPhone;
-    $$templateVars{'origFAX'} = $FORM::origFAX;
-    $$templateVars{'origEmail'} = $FORM::origEmail;
-    if ($FORM::useSiteCoord ne "") {
-        $$templateVars{'useOrigAddress'} = "CHECKED";
-    } else {
-        $$templateVars{'useOrigAddress'} = $FORM::useOrigAddress;
-    }
-    $$templateVars{'origNamefirstContact'} = $FORM::origNamefirstContact;
-    $$templateVars{'origNamelastContact'} = $FORM::origNamelastContact;
-    $$templateVars{'origNameOrgContact'} = $FORM::origNameOrgContact;
-    $$templateVars{'origDeliveryContact'} = $FORM::origDeliveryContact; 
-    $$templateVars{'origCityContact'} = $FORM::origCityContact;
-    $$templateVars{'origStateContact'} = $FORM::origStateContact;
-    $$templateVars{'origStateOtherContact'} = $FORM::origStateOtherContact;
-    $$templateVars{'origZIPContact'} = $FORM::origZIPContact;
-    $$templateVars{'origCountryContact'} = $FORM::origCountryContact;
-    $$templateVars{'origPhoneContact'} = $FORM::origPhoneContact;
-    $$templateVars{'origFAXContact'} = $FORM::origFAXContact;
-    $$templateVars{'origEmailContact'} = $FORM::origEmailContact;    
-    
-    $$templateVars{'aoCount'} = $FORM::aoCount;
-    foreach my $origName (param()) {
-    if ($origName =~ /origNamefirst/) {
-        my $origNameIndex = $origName;
-        $origNameIndex =~ s/origNamefirst//; # get the index of the parameter 0, ..., 10
-        my $origNamelast = "origNamelast".$origNameIndex;
-        my $origRole = "origRole".$origNameIndex;
-        if ($origNameIndex =~ /[0-9]+/  && $origNameIndex > 0) {
-        if (hasContent(param($origName)) && hasContent(param($origNamelast)) && hasContent(param($origRole))) {
-            debug("Processing keyword: $origName = ".param($origName)." $origNamelast = ".param($origNamelast)." $origRole = ".param($origRole));
-            $$templateVars{$origName} = normalizeCD(param($origName));
-            $$templateVars{$origNamelast} = normalizeCD(param($origNamelast));
-            $$templateVars{$origRole} = normalizeCD(param($origRole));
-        }
-        }
-    }
-    }
+sub copyFormToTemplateVars {
+	$$templateVars{'providerGivenName'} = $FORM::providerGivenName;
+	$$templateVars{'providerSurName'}   = $FORM::providerSurName;
+	$$templateVars{'site'}              = $FORM::site;
+	if ( $skinName eq "nceas" ) {
+		my $projects = getProjectList($properties);
+		$$templateVars{'projects'} = $projects;
+		$$templateVars{'wg'}       = \@FORM::wg;
+	}
+	$$templateVars{'identifier'}     = $FORM::identifier;
+	$$templateVars{'title'}          = $FORM::title;
+	$$templateVars{'origNamefirst0'} = $FORM::origNamefirst0;
+	$$templateVars{'origNamelast0'}  = $FORM::origNamelast0;
+	$$templateVars{'origNameOrg'}    = $FORM::origNameOrg;
+	$$templateVars{'origDelivery'}   = $FORM::origDelivery;
+	$$templateVars{'origCity'}       = $FORM::origCity;
+	$$templateVars{'origState'}      = $FORM::origState;
+	$$templateVars{'origStateOther'} = $FORM::origStateOther;
+	$$templateVars{'origZIP'}        = $FORM::origZIP;
+	$$templateVars{'origCountry'}    = $FORM::origCountry;
+	$$templateVars{'origPhone'}      = $FORM::origPhone;
+	$$templateVars{'origFAX'}        = $FORM::origFAX;
+	$$templateVars{'origEmail'}      = $FORM::origEmail;
 
-    $$templateVars{'abstract'} = $FORM::abstract;
-    $$templateVars{'keyCount'} = $FORM::keyCount;
-    foreach my $kyd (param()) {
-        if ($kyd =~ /keyword/) {
-            my $keyIndex = $kyd;
-            $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
-            my $keyType = "kwType".$keyIndex;
-            my $keyTh = "kwTh".$keyIndex;
-            if ($keyIndex =~ /[0-9]+/) {
-                if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
-                    debug("Processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
-                    $$templateVars{$kyd} = param($kyd);
-                    my $tmp = param($keyType);  #convert the first letter to upper case
-                    $tmp =~ s/\b(\w)/\U$1/g;
-                    $$templateVars{$keyType} = $tmp;
-                    $$templateVars{$keyTh} = param($keyTh);
-                }
-            }
-        }
-    }
+	if ( $FORM::useSiteCoord ne "" ) {
+		$$templateVars{'useOrigAddress'} = "CHECKED";
+	}
+	else {
+		$$templateVars{'useOrigAddress'} = $FORM::useOrigAddress;
+	}
+	$$templateVars{'origNamefirstContact'}  = $FORM::origNamefirstContact;
+	$$templateVars{'origNamelastContact'}   = $FORM::origNamelastContact;
+	$$templateVars{'origNameOrgContact'}    = $FORM::origNameOrgContact;
+	$$templateVars{'origDeliveryContact'}   = $FORM::origDeliveryContact;
+	$$templateVars{'origCityContact'}       = $FORM::origCityContact;
+	$$templateVars{'origStateContact'}      = $FORM::origStateContact;
+	$$templateVars{'origStateOtherContact'} = $FORM::origStateOtherContact;
+	$$templateVars{'origZIPContact'}        = $FORM::origZIPContact;
+	$$templateVars{'origCountryContact'}    = $FORM::origCountryContact;
+	$$templateVars{'origPhoneContact'}      = $FORM::origPhoneContact;
+	$$templateVars{'origFAXContact'}        = $FORM::origFAXContact;
+	$$templateVars{'origEmailContact'}      = $FORM::origEmailContact;
 
-    $$templateVars{'addComments'} = $FORM::addComments;
-    $$templateVars{'useConstraints'} = $FORM::useConstraints;
-    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
-    $$templateVars{'url'} = $FORM::url;
-    $$templateVars{'dataMedium'} = $FORM::dataMedium;
-    $$templateVars{'dataMediumOther'} = $FORM::dataMediumOther;
-    $$templateVars{'beginningYear'} = $FORM::beginningYear;
-    $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
-    $$templateVars{'beginningDay'} = $FORM::beginningDay;
-    $$templateVars{'endingYear'} = $FORM::endingYear;
-    $$templateVars{'endingMonth'} = $FORM::endingMonth;
-    $$templateVars{'endingDay'} = $FORM::endingDay;
-    $$templateVars{'geogdesc'} = $FORM::geogdesc;
-    if ($FORM::useSiteCoord ne "") {
-        $$templateVars{'useSiteCoord'} = "CHECKED";
-    } else {
-        $$templateVars{'useSiteCoord'} = "";
-    }
-    $$templateVars{'latDeg1'} = $FORM::latDeg1;
-    $$templateVars{'latMin1'} = $FORM::latMin1;
-    $$templateVars{'latSec1'} = $FORM::latSec1;
-    $$templateVars{'hemisphLat1'} = $FORM::hemisphLat1;
-    $$templateVars{'longDeg1'} = $FORM::longDeg1;
-    $$templateVars{'longMin1'} = $FORM::longMin1;
-    $$templateVars{'longSec1'} = $FORM::longSec1;
-    $$templateVars{'hemisphLong1'} = $FORM::hemisphLong1;
-    $$templateVars{'latDeg2'} = $FORM::latDeg2;
-    $$templateVars{'latMin2'} = $FORM::latMin2;
-    $$templateVars{'latSec2'} = $FORM::latSec2;
-    $$templateVars{'hemisphLat2'} = $FORM::hemisphLat2;
-    $$templateVars{'longDeg2'} = $FORM::longDeg2;
-    $$templateVars{'longMin2'} = $FORM::longMin2;
-    $$templateVars{'longSec2'} = $FORM::longSec2;
-    $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
-    $$templateVars{'taxaCount'} = $FORM::taxaCount;
-    foreach my $trn (param()) {
-        if ($trn =~ /taxonRankName/) {
-            my $taxIndex = $trn;
-            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
-            my $trv = "taxonRankValue".$taxIndex;
-            if ($taxIndex =~ /[0-9]+/) {
-                if (hasContent(param($trn)) && hasContent(param($trv))) {
-                    debug("Processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
-                    $$templateVars{$trn} = param($trn);
-                    $$templateVars{$trv} = param($trv);
-                }
-            }
-        }
-    }
-    $$templateVars{'taxaAuth'} = $FORM::taxaAuth;
-    $$templateVars{'methodTitle'} = $FORM::methodTitle;
-    $$templateVars{'methodPara'} = \@FORM::methodPara;
-    $$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
-    $$templateVars{'samplingDescription'} = $FORM::samplingDescription;
- 
-    $$templateVars{'modules'} = $modules; 
-    $$templateVars{'required'} = $required;
-    $$templateVars{'show'} = $show; 
-    $$templateVars{'site'} = $FORM::site;
-    $$templateVars{'fileCount'} = $FORM::fileCount;
-  
-    my $uploadCount = 0;
-    foreach my $upload (param()) {
-        if ($upload =~ /upload_/) {
-            my $fileIndex = $upload;
-            $fileIndex =~ s/upload_//;
-            if ($fileIndex =~ /[0-9]+/) {
-                if (hasContent(param($upload))) {
-                    debug("Returning filename: " . param($upload));
-                    $$templateVars{"upload_$fileIndex"} = param($upload);
-                    $$templateVars{"uploadname_$fileIndex"} = param("uploadname_$fileIndex");
-                    $$templateVars{"uploadtype_$fileIndex"} = param("uploadtype_$fileIndex");
-                    $$templateVars{"uploadperm_$fileIndex"} = param("uploadperm_$fileIndex");
-                    $uploadCount++;
-                }
-            }
-        }
-    }
+	$$templateVars{'aoCount'} = $FORM::aoCount;
+	foreach my $origName ( param() ) {
+		if ( $origName =~ /origNamefirst/ ) {
+			my $origNameIndex = $origName;
+			$origNameIndex =~
+			  s/origNamefirst//;    # get the index of the parameter 0, ..., 10
+			my $origNamelast = "origNamelast" . $origNameIndex;
+			my $origRole     = "origRole" . $origNameIndex;
+			if ( $origNameIndex =~ /[0-9]+/ && $origNameIndex > 0 ) {
+				if (   hasContent( param($origName) )
+					&& hasContent( param($origNamelast) )
+					&& hasContent( param($origRole) ) )
+				{
+					debug(  "Processing keyword: $origName = "
+						  . param($origName)
+						  . " $origNamelast = "
+						  . param($origNamelast)
+						  . " $origRole = "
+						  . param($origRole) );
+					$$templateVars{$origName} = normalizeCD( param($origName) );
+					$$templateVars{$origNamelast} =
+					  normalizeCD( param($origNamelast) );
+					$$templateVars{$origRole} = normalizeCD( param($origRole) );
+				}
+			}
+		}
+	}
 
-    $$templateVars{'upCount'} = $uploadCount;
+	$$templateVars{'abstract'} = $FORM::abstract;
+	$$templateVars{'keyCount'} = $FORM::keyCount;
+	foreach my $kyd ( param() ) {
+		if ( $kyd =~ /keyword/ ) {
+			my $keyIndex = $kyd;
+			$keyIndex =~
+			  s/keyword//;    # get the index of the parameter 0, ..., 10
+			my $keyType = "kwType" . $keyIndex;
+			my $keyTh   = "kwTh" . $keyIndex;
+			if ( $keyIndex =~ /[0-9]+/ ) {
+				if (   hasContent( param($kyd) )
+					&& hasContent( param($keyType) )
+					&& hasContent( param($keyTh) ) )
+				{
+					debug(  "Processing keyword: $kyd = "
+						  . param($kyd)
+						  . " $keyType = "
+						  . param($keyType)
+						  . " $keyTh = "
+						  . param($keyTh) );
+					$$templateVars{$kyd} = param($kyd);
+					my $tmp =
+					  param($keyType);   #convert the first letter to upper case
+					$tmp =~ s/\b(\w)/\U$1/g;
+					$$templateVars{$keyType} = $tmp;
+					$$templateVars{$keyTh}   = param($keyTh);
+				}
+			}
+		}
+	}
+
+	$$templateVars{'addComments'}         = $FORM::addComments;
+	$$templateVars{'useConstraints'}      = $FORM::useConstraints;
+	$$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
+	$$templateVars{'url'}                 = $FORM::url;
+	$$templateVars{'dataMedium'}          = $FORM::dataMedium;
+	$$templateVars{'dataMediumOther'}     = $FORM::dataMediumOther;
+	$$templateVars{'beginningYear'}       = $FORM::beginningYear;
+	$$templateVars{'beginningMonth'}      = $FORM::beginningMonth;
+	$$templateVars{'beginningDay'}        = $FORM::beginningDay;
+	$$templateVars{'endingYear'}          = $FORM::endingYear;
+	$$templateVars{'endingMonth'}         = $FORM::endingMonth;
+	$$templateVars{'endingDay'}           = $FORM::endingDay;
+	$$templateVars{'geogdesc'}            = $FORM::geogdesc;
+	if ( $FORM::useSiteCoord ne "" ) {
+		$$templateVars{'useSiteCoord'} = "CHECKED";
+	}
+	else {
+		$$templateVars{'useSiteCoord'} = "";
+	}
+	$$templateVars{'latDeg1'}      = $FORM::latDeg1;
+	$$templateVars{'latMin1'}      = $FORM::latMin1;
+	$$templateVars{'latSec1'}      = $FORM::latSec1;
+	$$templateVars{'hemisphLat1'}  = $FORM::hemisphLat1;
+	$$templateVars{'longDeg1'}     = $FORM::longDeg1;
+	$$templateVars{'longMin1'}     = $FORM::longMin1;
+	$$templateVars{'longSec1'}     = $FORM::longSec1;
+	$$templateVars{'hemisphLong1'} = $FORM::hemisphLong1;
+	$$templateVars{'latDeg2'}      = $FORM::latDeg2;
+	$$templateVars{'latMin2'}      = $FORM::latMin2;
+	$$templateVars{'latSec2'}      = $FORM::latSec2;
+	$$templateVars{'hemisphLat2'}  = $FORM::hemisphLat2;
+	$$templateVars{'longDeg2'}     = $FORM::longDeg2;
+	$$templateVars{'longMin2'}     = $FORM::longMin2;
+	$$templateVars{'longSec2'}     = $FORM::longSec2;
+	$$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
+	$$templateVars{'taxaCount'}    = $FORM::taxaCount;
+
+	foreach my $trn ( param() ) {
+		if ( $trn =~ /taxonRankName/ ) {
+			my $taxIndex = $trn;
+			$taxIndex =~
+			  s/taxonRankName//;    # get the index of the parameter 0, ..., 10
+			my $trv = "taxonRankValue" . $taxIndex;
+			if ( $taxIndex =~ /[0-9]+/ ) {
+				if ( hasContent( param($trn) ) && hasContent( param($trv) ) ) {
+					debug(  "Processing taxon: $trn = "
+						  . param($trn)
+						  . " $trv = "
+						  . param($trv) );
+					$$templateVars{$trn} = param($trn);
+					$$templateVars{$trv} = param($trv);
+				}
+			}
+		}
+	}
+	$$templateVars{'taxaAuth'}               = $FORM::taxaAuth;
+	$$templateVars{'methodTitle'}            = $FORM::methodTitle;
+	$$templateVars{'methodPara'}             = \@FORM::methodPara;
+	$$templateVars{'studyExtentDescription'} = $FORM::studyExtentDescription;
+	$$templateVars{'samplingDescription'}    = $FORM::samplingDescription;
+
+	$$templateVars{'modules'}   = $modules;
+	$$templateVars{'required'}  = $required;
+	$$templateVars{'show'}      = $show;
+	$$templateVars{'site'}      = $FORM::site;
+	$$templateVars{'fileCount'} = $FORM::fileCount;
+
+	my $uploadCount = 0;
+	foreach my $upload ( param() ) {
+		if ( $upload =~ /upload_/ ) {
+			my $fileIndex = $upload;
+			$fileIndex =~ s/upload_//;
+			if ( $fileIndex =~ /[0-9]+/ ) {
+				if ( hasContent( param($upload) ) ) {
+					debug( "Returning filename: " . param($upload) );
+					$$templateVars{"upload_$fileIndex"} = param($upload);
+					$$templateVars{"uploadname_$fileIndex"} =
+					  param("uploadname_$fileIndex");
+					$$templateVars{"uploadtype_$fileIndex"} =
+					  param("uploadtype_$fileIndex");
+					$$templateVars{"uploadperm_$fileIndex"} =
+					  param("uploadperm_$fileIndex");
+					$uploadCount++;
+				}
+			}
+		}
+	}
+
+	$$templateVars{'upCount'} = $uploadCount;
 }
 
 ################################################################################
-# 
+#
 # check if there is multiple occurence of the given tag and find its value.
 #
 ################################################################################
 
 sub findValue {
-    my $node = shift;
-    my $value = shift;
-    my $result;
-    my $tempNode;
+	my $node  = shift;
+	my $value = shift;
+	my $result;
+	my $tempNode;
 
-    $result = $node->findnodes("./$value");
-    if ($result->size > 1) {
-        errMoreThanOne("$value");
-    } else {
-        foreach $tempNode ($result->get_nodelist) {
-            #print $tempNode->nodeName().":".$tempNode->textContent();
-            #print "\n";
-            return $tempNode->textContent();
-        }
-    }
+	$result = $node->findnodes("./$value");
+	if ( $result->size > 1 ) {
+		errMoreThanOne("$value");
+	}
+	else {
+		foreach $tempNode ( $result->get_nodelist ) {
+
+			#print $tempNode->nodeName().":".$tempNode->textContent();
+			#print "\n";
+			return $tempNode->textContent();
+		}
+	}
 }
 
-
 ################################################################################
-# 
+#
 # check if given tags has any children. if not return the value
 #
 ################################################################################
 sub findValueNoChild {
-    my $node = shift;
-    my $value = shift;
-    my $tempNode;
-    my $childNodes;
-    my $result;
-    my $error;
+	my $node  = shift;
+	my $value = shift;
+	my $tempNode;
+	my $childNodes;
+	my $result;
+	my $error;
 
-    $result = $node->findnodes("./$value");
-    if ($result->size > 1) {
-       errMoreThanOne("$value");
-    } else {
-        foreach $tempNode ($result->get_nodelist) {
-            $childNodes = $tempNode->childNodes;
-            if ($childNodes->size() > 1) {
-                $error ="The tag $value has children which cannot be shown using the form. Please use Morpho to edit this document";    
-                push(@errorMessages, $error);
-            } else {
-                return $tempNode->textContent();
-            }
-        }
-    }
+	$result = $node->findnodes("./$value");
+	if ( $result->size > 1 ) {
+		errMoreThanOne("$value");
+	}
+	else {
+		foreach $tempNode ( $result->get_nodelist ) {
+			$childNodes = $tempNode->childNodes;
+			if ( $childNodes->size() > 1 ) {
+				$error =
+"The tag $value has children which cannot be shown using the form. Please use Morpho to edit this document";
+				push( @errorMessages, $error );
+			}
+			else {
+				return $tempNode->textContent();
+			}
+		}
+	}
 }
 
-
 ################################################################################
-# 
+#
 # check if given tags are children of given node.
 #
 ################################################################################
 sub dontOccur {
-    my $node = shift;
-    my $value = shift;
-    my $errVal = shift;
+	my $node   = shift;
+	my $value  = shift;
+	my $errVal = shift;
 
-    my $result = $node->findnodes("$value");
-    if ($result->size > 0) {
-        debug("Error trying to find $value, $errVal.");
-        $error ="One of the following tags found: $errVal. Please use Morpho to edit this document";
-        push(@errorMessages, $error."\n");
-    } 
+	my $result = $node->findnodes("$value");
+	if ( $result->size > 0 ) {
+		debug("Error trying to find $value, $errVal.");
+		$error = "One of the following tags found: $errVal. Please use Morpho to edit this document";
+		push( @errorMessages, $error . "\n" );
+	}
 }
 
-
 ################################################################################
-# 
+#
 # print out error for more than one occurence of a given tag
 #
 ################################################################################
 sub errMoreThanOne {
-    my $value = shift;
-    my $error ="More than one occurence of the tag $value found. Please use Morpho to edit this document";
-    push(@errorMessages, $error."\n");
+	my $value = shift;
+	my $error =
+"More than one occurence of the tag $value found. Please use Morpho to edit this document";
+	push( @errorMessages, $error . "\n" );
 }
 
-
 ################################################################################
-# 
+#
 # print out error for more than given number of occurences of a given tag
 #
 ################################################################################
 sub errMoreThanN {
-    my $value = shift;
-    my $error ="More occurences of the tag $value found than that can be shown in the form. Please use Morpho to edit this document";
-    push(@errorMessages, $error);
+	my $value = shift;
+	my $error =
+"More occurences of the tag $value found than that can be shown in the form. Please use Morpho to edit this document";
+	push( @errorMessages, $error );
 }
 
-
 ################################################################################
-# 
+#
 # print redirect html code
 #
 ################################################################################
-sub redirect(){
-    my $url = shift;
+sub redirect() {
+	my $url = shift;
 
-    print "<head>";
-    print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=".$url."\">";
-    print "</head><body></body></html>"; 
+	print "<head>";
+	print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=" . $url . "\">";
+	print "</head><body></body></html>";
 }
 
-
 ################################################################################
-# 
+#
 # print debugging messages to stderr
 #
 ################################################################################
 sub debug {
-    my $msg = shift;
-    
-    if ($debug_enabled) {
-        print STDERR "Registry: $msg\n";
-    }
-    else {
-        # This empty print statement is to prevent a bizzare error of the NCEAS
-        # skin failing when: debug = 0, and a file upload is attached. Maybe
-        # related to function return values?
-        print "";
-    }
+	my $msg = shift;
+
+	if ($debug_enabled) {
+		my $date = localtime();
+		print STDERR "Registry $date: $msg\n";
+	}
+	else {
+
+		# This empty print statement is to prevent a bizzare error of the NCEAS
+		# skin failing when: debug = 0, and a file upload is attached. Maybe
+		# related to function return values?
+		print "";
+	}
 }
 
 ################################################################################
-# 
+#
 # dump the EML document to disk
 #
 ################################################################################
 
 sub debugDoc {
-    my $doc = shift;
+	my $doc = shift;
 
-    if ($debug_enabled) {
-        # Write out the XML file for debugging purposes
-        my $testFile = $tempDir . "/registry-eml-upload.xml";
+	if ($debug_enabled) {
 
-        if (open (TFILE,">$testFile")) {
-        	print TFILE $doc;
-        	close(TFILE);
-        } else {
-        	debug("WARNING: Cant open xml file: $testFile");
-        }
-     }
+		# Write out the XML file for debugging purposes
+		my $testFile = $tempDir . "/registry-eml-upload.xml";
+
+		if ( open( TFILE, ">$testFile" ) ) {
+			print TFILE $doc;
+			close(TFILE);
+		}
+		else {
+			debug("WARNING: Cant open xml file: $testFile");
+		}
+	}
 }
 
 ################################################################################
-# 
+#
 # get the list of projects
 #
 ################################################################################
 sub getProjectList {
-    my $properties = shift;
-    my $projects;
+	my $properties = shift;
+	my $projects;
 
-    # Check for availability AdminDB.pm, for accessing NCEAS projects
-    eval { require NCEAS::AdminDB }; 
-    if ($@) {
-        $projects = getTestProjectList();
-    } else {
-        my $admindb = NCEAS::AdminDB->new();
+	# Check for availability AdminDB.pm, for accessing NCEAS projects
+	eval { require NCEAS::AdminDB };
+	if ($@) {
+		$projects = getTestProjectList();
+	}
+	else {
+		my $admindb = NCEAS::AdminDB->new();
 
-        # populate db parameters for NCEAS AdminDB
-        my $db = $skinProperties->splitToTree(qr/\./, 'registry.db');
+		# populate db parameters for NCEAS AdminDB
+		my $db = $skinProperties->splitToTree( qr/\./, 'registry.db' );
 
-        # check all neccessary parameters exist
-        if (!$db->{'connection'} || !$db->{'user'} || !$db->{'password'}) {
-            debug("NCEAS AdminDB misconfigured. Check database configuration parameters, in the registry.db section of nceas.properties.");
-            $projects = getTestProjectList();
-        } else {
-            $admindb->connect($db->{'connection'}, $db->{'user'}, $db->{'password'});
-            if ($admindb->{'connected'}) {
-                $projects = $admindb->getProjects();
-            } else {
-                $projects = getTestProjectList();
-            }
-        }
-    }
-    return $projects;
+		# check all neccessary parameters exist
+		if ( !$db->{'connection'} || !$db->{'user'} || !$db->{'password'} ) {
+			debug(
+"NCEAS AdminDB misconfigured. Check database configuration parameters, in the registry.db section of nceas.properties."
+			);
+			$projects = getTestProjectList();
+		}
+		else {
+			$admindb->connect( $db->{'connection'}, $db->{'user'},
+				$db->{'password'} );
+			if ( $admindb->{'connected'} ) {
+				$projects = $admindb->getProjects();
+			}
+			else {
+				$projects = getTestProjectList();
+			}
+		}
+	}
+	return $projects;
 }
 
 ################################################################################
-# 
+#
 # get a test list of projects for use only in testing where the NCEAS
 # admin db is not available.
 #
 ################################################################################
 sub getTestProjectList {
-    # This block is for testing only!  Remove for production use
-    my @row1;
-    $row1[0] = 6000; $row1[1] = 'Andelman'; $row1[2] = 'Sandy'; $row1[3] = 'The very long and windy path to an apparent ecological conclusion: statistics lie';
-    my @row2; 
-    $row2[0] = 7000; $row2[1] = 'Bascompte'; $row2[2] = 'Jordi'; $row2[3] = 'Postdoctoral Fellow';
-    my @row3; 
-    $row3[0] = 7001; $row3[1] = 'Hackett'; $row3[2] = 'Edward'; $row3[3] = 'Sociology rules the world';
-    my @row4; 
-    $row4[0] = 7002; $row4[1] = 'Jones'; $row4[2] = 'Matthew'; $row4[3] = 'Informatics rules the world';
-    my @row5; 
-    $row5[0] = 7003; $row5[1] = 'Schildhauer'; $row5[2] = 'Mark'; $row5[3] = 'Excel rocks my world, assuming a, b, and c';
-    my @row6; 
-    $row6[0] = 7004; $row6[1] = 'Rogers'; $row6[2] = 'Bill'; $row6[3] = 'Graduate Intern';
-    my @row7; 
-    $row7[0] = 7005; $row7[1] = 'Zedfried'; $row7[2] = 'Karl'; $row7[3] = 'A multivariate analysis of thing that go bump in the night';
-    my @projects;
-    $projects[0] = \@row1;
-    $projects[1] = \@row2;
-    $projects[2] = \@row3;
-    $projects[3] = \@row4;
-    $projects[4] = \@row5;
-    $projects[5] = \@row6;
-    $projects[6] = \@row7;
-    return \@projects;
+
+	# This block is for testing only!  Remove for production use
+	my @row1;
+	$row1[0] = 6000;
+	$row1[1] = 'Andelman';
+	$row1[2] = 'Sandy';
+	$row1[3] =
+'The very long and windy path to an apparent ecological conclusion: statistics lie';
+	my @row2;
+	$row2[0] = 7000;
+	$row2[1] = 'Bascompte';
+	$row2[2] = 'Jordi';
+	$row2[3] = 'Postdoctoral Fellow';
+	my @row3;
+	$row3[0] = 7001;
+	$row3[1] = 'Hackett';
+	$row3[2] = 'Edward';
+	$row3[3] = 'Sociology rules the world';
+	my @row4;
+	$row4[0] = 7002;
+	$row4[1] = 'Jones';
+	$row4[2] = 'Matthew';
+	$row4[3] = 'Informatics rules the world';
+	my @row5;
+	$row5[0] = 7003;
+	$row5[1] = 'Schildhauer';
+	$row5[2] = 'Mark';
+	$row5[3] = 'Excel rocks my world, assuming a, b, and c';
+	my @row6;
+	$row6[0] = 7004;
+	$row6[1] = 'Rogers';
+	$row6[2] = 'Bill';
+	$row6[3] = 'Graduate Intern';
+	my @row7;
+	$row7[0] = 7005;
+	$row7[1] = 'Zedfried';
+	$row7[2] = 'Karl';
+	$row7[3] = 'A multivariate analysis of thing that go bump in the night';
+	my @projects;
+	$projects[0] = \@row1;
+	$projects[1] = \@row2;
+	$projects[2] = \@row3;
+	$projects[3] = \@row4;
+	$projects[4] = \@row5;
+	$projects[5] = \@row6;
+	$projects[6] = \@row7;
+	return \@projects;
 }
Index: src/perl/Metacat/Metacat.pm
===================================================================
--- src/perl/Metacat/Metacat.pm	(revision 5310)
+++ src/perl/Metacat/Metacat.pm	(revision 5311)
@@ -175,6 +175,20 @@
 }
 
 #############################################################
+# subroutine to log into Metacat and get usr info xml for
+# a logged in user
+#############################################################
+sub getUserInfo {
+	my $self = shift;
+
+	my %postData = (action => 'getloggedinuserinfo');
+  
+	my $response = $self->sendData(%postData);
+
+	return $response->content;
+}
+
+#############################################################
 # subroutine to insert an XML document into Metacat
 # If success, return 1, else return 0
 #############################################################
Index: src/edu/ucsb/nceas/metacat/QuerySpecification.java
===================================================================
--- src/edu/ucsb/nceas/metacat/QuerySpecification.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/QuerySpecification.java	(revision 5311)
@@ -164,14 +164,12 @@
         // Initialize the parser and read the queryspec
         XMLReader parser = initializeParser();
         if (parser == null) {
-            System.err.println("SAX parser not instantiated properly.");
+        	logMetacat.error("QuerySpecification() - SAX parser not instantiated properly.");
         }
         try {
             parser.parse(new InputSource(queryspec));
-        } catch (SAXException e) {
-            System.err.println("error parsing data in "
-                    + "QuerySpecification.QuerySpecification");
-            System.err.println(e.getMessage());
+        } catch (SAXException se) {
+            logMetacat.error("QuerySpecification() - SAX error parsing data: " + se.getMessage());
         }
     }
 
@@ -260,7 +258,7 @@
 	            ownerQuery = ownerQuery + "lower(user_owner) ='" + userName + "'";
 	        }
         }
-        logMetacat.info("OwnerQuery: " + ownerQuery);
+        logMetacat.info("QuerySpecification.createOwerQuery - OwnerQuery: " + ownerQuery);
         return ownerQuery;
     }
 
@@ -274,7 +272,7 @@
         String allowString = constructAllowString();
         allowQuery = "SELECT docid from xml_access WHERE( " + allowString;
         allowQuery = allowQuery + ")";
-        logMetacat.info("allow query is: " + allowQuery);
+        logMetacat.info("QuerySpecification.createAllowRuleQuery - allow query is: " + allowQuery);
         return allowQuery;
 
     }
@@ -306,7 +304,7 @@
         }//if
         // add allow rule
         allowQuery = allowQuery + ") AND perm_type = 'allow'" + " AND permission > 3";
-        logMetacat.info("allow string is: " + allowQuery);
+        logMetacat.info("QuerySpecification.constructAllowString - allow string is: " + allowQuery);
         return allowQuery;
     }
 
@@ -321,7 +319,7 @@
         String denyString = constructDenyString();
         denyQuery = "SELECT docid from xml_access WHERE( " + denyString;
         denyQuery = denyQuery + ") ";
-        logMetacat.info("denyquery is: " + denyQuery);
+        logMetacat.info("QuerySpecification.createDenyRuleQuery - denyquery is: " + denyQuery);
         return denyQuery;
 
     }
@@ -353,7 +351,7 @@
          }//if
          // add deny rules
          denyQuery = denyQuery + ") AND perm_type = 'deny'" +  " AND perm_order ='allowFirst'" +" AND permission > 3";
-         logMetacat.info("allow string is: " + denyQuery);
+         logMetacat.info("QuerySpecification.constructDenyString - deny string is: " + denyQuery);
          return denyQuery;
         
     }
@@ -371,9 +369,7 @@
         String onwer = createOwerQuery();
         String allow = createAllowRuleQuery();
         String deny = createDenyRuleQuery();
-        //logMetacat.warn("onwer " +onwer);
-        //logMetacat.warn("allow "+allow);
-        //logMetacat.warn("deny "+deny);
+
         if (onwer != null)
         {
           accessQuery = " AND (docid IN(" + onwer + ")";
@@ -385,7 +381,7 @@
         	accessQuery = " AND (docid IN (" + allow + ")"
                 + " AND docid NOT IN (" + deny + "))";
         }
-        logMetacat.warn("accessquery is: " + accessQuery);
+        logMetacat.info("QuerySpecification.getAccessQuery - access query is: " + accessQuery);
         return accessQuery;
     }
 
@@ -548,8 +544,7 @@
             parser.setErrorHandler(this);
 
         } catch (Exception e) {
-            System.err.println("Error in QuerySpcecification.initializeParser "
-                    + e.toString());
+            logMetacat.error("QuerySpecification.getAccessQuery - Error: " + e.getMessage());
         }
 
         return parser;
@@ -563,7 +558,7 @@
     public void startElement(String uri, String localName, String qName,
             Attributes atts) throws SAXException
     {
-        logMetacat.debug("start at startElement "+localName);
+        logMetacat.debug("QuerySpecification.startElement - start element " + localName);
         BasicNode currentNode = new BasicNode(localName);
         //write element name into xml buffer.
         xml.append("<");
@@ -595,7 +590,7 @@
             }
             queryStack.push(currentGroup);
         }
-        logMetacat.debug("end in startElement "+localName);
+        logMetacat.debug("QuerySpecification.startElement - ending startElement " + localName);
     }
 
     /**
@@ -606,7 +601,7 @@
     public void endElement(String uri, String localName, String qName)
             throws SAXException
     {
-    	 logMetacat.debug("start in endElement "+localName);
+    	 logMetacat.debug("QuerySpecification.endElement - endElement "+localName);
         BasicNode leaving = (BasicNode) elementStack.pop();
         if (leaving.getTagName().equals("queryterm")) {
             boolean isCaseSensitive = (new Boolean(leaving
@@ -647,9 +642,9 @@
               ownerList.add(textBuffer.toString().trim());
         }
         String normalizedXML = textBuffer.toString().trim();
-        logMetacat.debug("================before normailze "+normalizedXML);
+        logMetacat.debug("QuerySpecification.endElement - before normalize: " + normalizedXML);
         normalizedXML =  MetacatUtil.normalize(normalizedXML);
-        logMetacat.debug("================after normailze "+normalizedXML);
+        logMetacat.debug("QuerySpecification.endElement - after normalize " + normalizedXML);
         xml.append(normalizedXML);
         xml.append("</");
         xml.append(localName);
@@ -680,7 +675,7 @@
       // buffer all text nodes for same element. This is for text was splited
       // into different nodes
       String text = new String(ch, start, length);
-      logMetacat.debug("the text in characters "+text);
+      logMetacat.debug("QuerySpecification.characters - the text in characters " + text);
       textBuffer.append(text);
 
     }
@@ -715,8 +710,7 @@
 
             if (predicateEnd == -1)
             {
-                logMetacat.warn("handleReturnField(): ");
-                logMetacat.warn("    Invalid path: " + inputString);
+                logMetacat.warn("QuerySpecification.handleReturnField - Invalid path: " + inputString);
                 return;
             }
 
@@ -736,15 +730,10 @@
         }
 
         containsExtendedSQL = true;
-
-     
+   
         // no attribute value will be returned
-        logMetacat.info("QuerySpecification.handleReturnField(): " );
-        logMetacat.info("  there are no attributes in the XPATH statement" );
-        returnFieldList.add(inputString);
-       
-
-       
+        logMetacat.info("QuerySpecification.handleReturnField - there are no attributes in the XPATH statement" );
+        returnFieldList.add(inputString);       
     }
 
     /**
@@ -768,8 +757,7 @@
         } else {
         	queryFromQueryGroup = "";
         }
-        logMetacat.info("Query from query in QuerySpec.printSQL: " 
-        		+ queryFromQueryGroup);
+        logMetacat.info("QuerySpecification.printSQL - Query : " + queryFromQueryGroup);
         
         if(!queryFromQueryGroup.trim().equals("")){
             self.append(" docid IN (");
@@ -837,13 +825,13 @@
         }
 
         // if there is only one percentage search item, this query is a
-        // percentage
-        // search query
-        logMetacat.info("percentage number: "
-                + query.getPercentageSymbolCount());
-        if (query.getPercentageSymbolCount() == 1) {
-            logMetacat.info("It is a percentage search");
-            percentageSearch = true;
+        // percentage search query
+        if (query != null) {
+        	logMetacat.info("QuerySpecification.printSQL - percentage number: " + query.getPercentageSymbolCount());
+			if (query.getPercentageSymbolCount() == 1) {
+				logMetacat.info("QuerySpecification.printSQL - It is a percentage search");
+				percentageSearch = true;
+			}
         }
 
         queryString.append(self.toString());
@@ -942,11 +930,11 @@
     	    	// if there is slash in the path, path should be replace by the last part
     	    	path = path.substring(slashIndex+1);
     	    }
-    	    logMetacat.debug("In QuerySpecification.returnFieldIsAttribute method, final path is "+path);
+    	    logMetacat.debug("QuerySpecification.returnFieldIsAttribute - final path is " + path);
     	    // if first of character of path is @, the path is attribute
     	    if (path.charAt(0) == '@')
     	    {
-    	    	logMetacat.debug("it is attribute");
+    	    	logMetacat.debug("QuerySpecification.returnFieldIsAttribute - it is an attribute");
     	    	isAttribute = true;
     	    }
     	}
@@ -964,7 +952,7 @@
      *            which this user should not access
      */
     private String printExtendedSQL(String doclist) {
-        logMetacat.info("querySpecification.printExtendedSQL called\n");
+        logMetacat.debug("QuerySpecification.printExtendedSQL - in printExtendedSQL");
         StringBuffer self = new StringBuffer();
         Vector elementVector = new Vector();
         Vector attributeVector = new Vector();
@@ -996,7 +984,7 @@
 					usePathIndex = false;   
 				}
 			} catch (MetacatUtilException mue) {
-				logMetacat.warn("Could not get index paths: "  + mue.getMessage());
+				logMetacat.warn("QuerySpecification.printExtendedSQL - Could not get index paths: "  + mue.getMessage());
 			}
          
         }
@@ -1187,7 +1175,7 @@
         if (index != 0) {
             newExpression = pathExpression.substring(0, index - 1);
         }
-        logMetacat.info("The path expression without attributes: "
+        logMetacat.info("QuerySpecification.newPathExpressionWithOutAttribute - The path expression without attributes: "
                 + newExpression);
         return newExpression;
     }
@@ -1202,8 +1190,7 @@
         if (index != 1) {
             attributeName = path.substring(index + 1, size);
         }
-        logMetacat.info("The attirbute name from path: "
-                + attributeName);
+        logMetacat.info("QuerySpecification.getAttributeName - The attirbute name from path: " + attributeName);
         return attributeName;
     }
 
Index: src/edu/ucsb/nceas/metacat/SubTree.java
===================================================================
--- src/edu/ucsb/nceas/metacat/SubTree.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/SubTree.java	(revision 5311)
@@ -86,7 +86,7 @@
     {
       try
       {
-        subTreeNodeStack = getSubTreeNodeList();
+        subTreeNodeStack = getSubTreeNodeListFromDB();
       }
       catch (McdbException e)
       {
@@ -174,7 +174,7 @@
     }
 
     /* Put a subtree node into a stack, on top is the start point of subtree*/
-    private Stack getSubTreeNodeList() throws McdbException
+    private Stack getSubTreeNodeListFromDB() throws McdbException
     {
        Stack nodeRecordList = new Stack();
        // make sure it works
Index: src/edu/ucsb/nceas/metacat/PermissionController.java
===================================================================
--- src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5311)
@@ -213,7 +213,7 @@
     }//try
     catch (Exception e)
     {
-      logMetacat.warn("There is a exception in hasPermission method: "
+      logMetacat.warn("PermissionController.hasPermission - There is a exception in hasPermission method: "
                          +e.getMessage());
     }
 
@@ -373,7 +373,7 @@
         }//try
         catch( Exception e)
         {
-          logMetacat.error("error in PermissionControl.has" +
+          logMetacat.error("PermissionController.hasUnaccessableSubTree - error in PermissionControl.has" +
                                    "UnaccessableSubTree "+e.getMessage());
           throw new McdbException(e);
         }
@@ -424,7 +424,7 @@
           if (startId > subTreeStartId && endId < subTreeEndId)
           {
             needDelete = true;
-            logMetacat.info("the subtree: "+ treeId +
+            logMetacat.info("PermissionController.mergeEquivalentSubtree - the subtree: "+ treeId +
                                      " need to be get rid of from unaccessable"+
                                      " subtree list becuase it is a subtree of"+
                                      " another subtree in the list");
@@ -532,7 +532,7 @@
         // Bind the values to the query
         pStmt.setString(1, docId);
         pStmt.setString(2, principals[i]);
-        logMetacat.info("the principle stack is : " +
+        logMetacat.info("PermissionController.containDocumentOwner - the principle stack is : " +
                                   principals[i]);
 
         pStmt.execute();
@@ -541,7 +541,7 @@
         if (hasRow)
         {
           pStmt.close();
-           logMetacat.info("find the owner");
+           logMetacat.info("PermissionController.containDocumentOwner - find the owner");
           return true;
         }//if
 
@@ -885,7 +885,7 @@
         if (user != null)
         {
           usersPackage[0]= user.toLowerCase();
-          logMetacat.info("after transfer to lower case(not null): "+
+          logMetacat.info("PermissionController.createUsersPackage - after transfer to lower case(not null): "+
                                      usersPackage[0]);
         }
         else
@@ -892,7 +892,7 @@
         {
           usersPackage[0] = user;
           usersPackage[0]= user.toLowerCase();
-          logMetacat.info("after transfer to lower case(null): "+
+          logMetacat.info("PermissionController.createUsersPackage - after transfer to lower case(null): "+
                                      usersPackage[0]);
         }
         usersPackage[1]=AccessControlInterface.PUBLIC;
@@ -1036,7 +1036,7 @@
         {
             if(withRevision)
             {
-                logMetacat.info("Put subtree id " + subTreeId +
+                logMetacat.info("PermissionController.getUnAccessableInlineDataIdList - Put subtree id " + subTreeId +
                                          " and " + "inline data file name " +
                                          fileId + " into " + "un" + permission +
                                          " hash");
@@ -1045,7 +1045,7 @@
             }
             else
             {
-                logMetacat.info("Put subtree id " + subTreeId +
+                logMetacat.info("PermissionController.getUnAccessableInlineDataIdList - Put subtree id " + subTreeId +
                                          " and " + "inline data file name " +
                                          DocumentUtil.getInlineDataIdWithoutRev(fileId) +
                                          " into " + "un" + permission +
Index: src/edu/ucsb/nceas/metacat/DBSAXNode.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBSAXNode.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/DBSAXNode.java	(revision 5311)
@@ -144,16 +144,20 @@
     // write a series of nodes that are MAXDATACHARS long, and then the
     // final node contains the remainder
     while (moredata) {
-        if (leftover > DBSAXHandler.MAXDATACHARS) {
+        if (leftover > (DBSAXHandler.MAXDATACHARS)) {
         	limitedData = data.substring(offset, DBSAXHandler.MAXDATACHARS);
-            leftover -= DBSAXHandler.MAXDATACHARS;
-            offset += DBSAXHandler.MAXDATACHARS;
+            leftover -= (DBSAXHandler.MAXDATACHARS - 1);
+            offset += (DBSAXHandler.MAXDATACHARS - 1);
         } else {
-        	limitedData = data;
-            moredata = false;
+        	if (data != null) {
+        		limitedData = data.substring(offset, offset + leftover);
+        	} else {
+        		limitedData = null;
+        	}
+        	moredata = false;
         }
-        endNodeId =  writeChildNodeToDBDataLimited(nodetype, nodename,
-              limitedData, docid);
+        
+        endNodeId =  writeChildNodeToDBDataLimited(nodetype, nodename, limitedData, docid);
     }
     
     return endNodeId;
Index: src/edu/ucsb/nceas/metacat/service/XMLSchema.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/XMLSchema.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/service/XMLSchema.java	(revision 5311)
@@ -98,10 +98,10 @@
 		try { 
 			this.localFileUri = SystemUtil.getContextURL() + XMLSchemaService.SCHEMA_DIR
 					+ fileName;
-			logMetacat.debug("localFileUri: " + this.localFileUri);
+			logMetacat.debug("XMLSchema.setFileName - localFileUri: " + this.localFileUri);
 		} catch (PropertyNotFoundException pnfe) {
 			localFileUri = XMLSchemaService.SCHEMA_DIR + fileName;
-			logMetacat.warn("Could not get context url. Setting localFileUri to: "
+			logMetacat.warn("XMLSchema.setFileName - Could not get context url. Setting localFileUri to: "
 					+ localFileUri);
 		}
 		try {
@@ -108,10 +108,10 @@
 			String fileDir = SystemUtil.getContextDir() + XMLSchemaService.SCHEMA_DIR
 				+ fileName;
 			this.localFileDir = FileUtil.normalizePath(fileDir);
-			logMetacat.debug("localFileDir: " + this.localFileDir);
+			logMetacat.debug("XMLSchema.setFileName - localFileDir: " + this.localFileDir);
 		} catch (PropertyNotFoundException pnfe) {
 			localFileDir = XMLSchemaService.SCHEMA_DIR + fileName;
-			logMetacat.warn("Could not get context directory. Setting localFileDir to: "
+			logMetacat.warn("XMLSchema.setFileName - Could not get context directory. Setting localFileDir to: "
 					+ localFileDir);
 		}
 	}
@@ -177,7 +177,7 @@
 			try {
 				localFileUri = SystemUtil.getContextURL() + XMLSchemaService.SCHEMA_DIR + localFileUri;
 			} catch (PropertyNotFoundException pnfe) {
-				logMetacat.warn("Could not find context url: " + pnfe.getMessage() + 
+				logMetacat.warn("XMLSchema.setLocalFileUri - Could not find context url: " + pnfe.getMessage() + 
 						". Setting schema file uri to: " + XMLSchemaService.SCHEMA_DIR + localFileUri);
 				localFileUri = XMLSchemaService.SCHEMA_DIR + localFileUri;
 			}
Index: src/edu/ucsb/nceas/metacat/service/SessionService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/SessionService.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/service/SessionService.java	(revision 5311)
@@ -28,6 +28,7 @@
 
 import java.io.PrintWriter;
 import java.util.Calendar;
+import java.util.Enumeration;
 import java.util.Hashtable;
 
 import javax.servlet.http.HttpServletResponse;
@@ -49,6 +50,8 @@
 	private static Hashtable<String, SessionData> sessionHash = null;
 	
 	private static final String PUBLIC_SESSION_ID = "0";
+	
+	private static Object lockObj = new Object();
 
 	/**
 	 * private constructor since this is a singleton
@@ -113,14 +116,16 @@
 	 */
 	public static void registerSession(String sessionId, String userName,
 			String[] groupNames, String password, String name) throws ServiceException {
-		if (sessionId == null) {
-			throw new ServiceException("SessionService.registerSession - " + 
-					"Cannot register a null session id");
+		synchronized(lockObj) {
+			if (sessionId == null) {
+				throw new ServiceException("SessionService.registerSession - " + 
+						"Cannot register a null session id");
+			}
+			logMetacat.debug("SessionService.registerSession - Registering session id: " + sessionId);
+			SessionData sessionData = new SessionData(sessionId, userName, groupNames,
+					password, name);
+			sessionHash.put(sessionId, sessionData);
 		}
-		logMetacat.debug("SessionService.registerSession - Registering session id: " + sessionId);
-		SessionData sessionData = new SessionData(sessionId, userName, groupNames,
-				password, name);
-		sessionHash.put(sessionId, sessionData);
 	}
 	
 	/**
@@ -130,13 +135,15 @@
 	 *            the session data object to add to the session hash
 	 */
 	public static void registerSession(SessionData sessionData) throws ServiceException {
-		if (sessionData == null) {
-			throw new ServiceException("SessionService.registerSession - " + 
-					"Cannot register null session data");
+		synchronized(lockObj) {
+			if (sessionData == null) {
+				throw new ServiceException("SessionService.registerSession - " + 
+						"Cannot register null session data");
+			}
+			logMetacat.debug("SessionService.registerSession - Registering session " + 
+					"data with id: " + sessionData.getId());
+			sessionHash.put(sessionData.getId(), sessionData);
 		}
-		logMetacat.debug("SessionService.registerSession - Registering session " + 
-				"data with id: " + sessionData.getId());
-		sessionHash.put(sessionData.getId(), sessionData);
 	}
 	
 	/**
@@ -146,16 +153,37 @@
 	 *            the id of the session to remove.
 	 */
 	public static void unRegisterSession(String sessionId) {
-		if (sessionId == null) {
-			logMetacat.error("SessionService.unRegisterSession - trying to " + 
+		synchronized(lockObj) {
+			if (sessionId == null) {
+				logMetacat.error("SessionService.unRegisterSession - trying to " + 
 					"unregister a session with null id");
+			}
+		
+			logMetacat.info("SessionService.unRegisterSession - unRegistering session: " + sessionId);
+			sessionHash.remove(sessionId);
 		}
-		
-		logMetacat.info("SessionService.unRegisterSession - unRegistering session: " + sessionId);
-		sessionHash.remove(sessionId);
 	}
 	
 	/**
+	 * Unregister all sessions from the session hash table except the public session.
+	 * 
+	 * @param sessionId
+	 *            the id of the session to remove.
+	 */
+	public static void unRegisterAllSessions() {
+		synchronized(lockObj) {
+			Enumeration<String> keyEnum = sessionHash.keys();
+			while (keyEnum.hasMoreElements()) {
+				String sessionId = keyEnum.nextElement();
+				if (!sessionId.equals(PUBLIC_SESSION_ID)) {
+					logMetacat.info("SessionService.unRegisterAllSessions - unRegistering session: " + sessionId);
+					sessionHash.remove(sessionId);
+				}
+			}
+		}
+	}
+	
+	/**
 	 * Check if a session is registered in the session hash table. 
 	 * 
 	 * @param sessionId
@@ -246,8 +274,10 @@
 		if (sessionId == null) {
 			logMetacat.error("SessionService.touchSession - trying to touch a session with null id");
 		} else if (isSessionRegistered(sessionId)) {
-			SessionData sessionData = getRegisteredSession(sessionId);
-			sessionData.setLastAccessedTime();
+			synchronized(lockObj) {
+				SessionData sessionData = getRegisteredSession(sessionId);
+				sessionData.setLastAccessedTime();
+			}
 		}
 	}
 	
@@ -260,9 +290,7 @@
 			if(lastAccessedTime.compareTo(expireTime) < 0 ) {
 				unRegisterSession(sessionId);
 			}
-		}
-		
-		
+		}		
 	}
 
 }
Index: src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 5310)
+++ src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 5311)
@@ -63,39 +63,33 @@
  */
 public class Eml210SAXHandler extends DBSAXHandler implements AccessControlInterface {
 
-	private boolean processTopLevelAccess = false;
+	private boolean processingTopLevelAccess = false;
 
-	private boolean processAdditionalAccess = false;
+	private boolean processingAdditionalAccess = false;
 
-	private boolean processOtherAccess = false;
+	private boolean processingOtherAccess = false;
 
 	private AccessSection accessObject = null;
 
 	private AccessRule accessRule = null;
 
-	private Vector<AccessSection> accessObjectList = new Vector<AccessSection>(); // store
-																					// every
-																					// access
-																					// rule
+	// all access rules
+	private Vector<AccessSection> accessObjectList = new Vector<AccessSection>(); 
 
 	private Hashtable<String, AccessSection> topLevelAccessControlMap = new Hashtable<String, AccessSection>();
 
-	private Hashtable<String, AccessSection> additionalAccessControlMap = new Hashtable<String, AccessSection>();// store
-
-	// subtree access for single additionalmetacat
-	private Vector<Hashtable<String, AccessSection>> additionalAccessMapList = new Vector<Hashtable<String, AccessSection>>();// store
-																																// maps
-																																// for
-
-	// every additionalmetadata
-	private Vector<String> describesId = new Vector<String>(); // store the ids
-																// in
-
-	// additionalmetadata/describes
+	// subtree access for additionalmetadata
+	private Hashtable<String, AccessSection> additionalAccessControlMap = new Hashtable<String, AccessSection>();
+	
+	
+	private Vector<Hashtable<String, AccessSection>> additionalAccessMapList = new Vector<Hashtable<String, AccessSection>>();
+	
+	// ids from additionalmetadata/describes
+	private Vector<String> describesId = new Vector<String>(); 
+	
 	private Stack<SubTree> subTreeInfoStack = new Stack<SubTree>();
 
-	private Vector<SubTree> subTreeList = new Vector<SubTree>();// store the
-																// final subtree
+	private Vector<SubTree> subTreeList = new Vector<SubTree>();
 	
 	private boolean needToCheckAccessModule = false;
 
@@ -204,8 +198,6 @@
 		try {
 			PermissionController control = new PermissionController(docid
 					+ PropertyService.getProperty("document.accNumSeparator") + revision);
-			// unChangableSubTreeHash = getUnchangableSubTree(control, user,
-			// groups);
 
 			// If the action is update and user doesn't have "ALL" permission
 			// we need to check if user can update access subtree			
@@ -333,13 +325,12 @@
 			if (hitTextNode && parentNode != null) {
 
 				// compare top level access module
-				if (processTopLevelAccess && needToCheckAccessModule) {
-					compareTextNode(currentUnchangeableAccessModuleNodeStack, textBuffer,
-							UPDATEACCESSERROR);
+				if (processingTopLevelAccess && needToCheckAccessModule) {
+					compareAccessTextNode(currentUnchangeableAccessModuleNodeStack, textBuffer);
 				}
 
 				if (needToCheckAccessModule
-						&& (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
+						&& (processingAdditionalAccess || processingOtherAccess || processingTopLevelAccess)) {
 					// stored the pull out nodes into storedNode stack
 					NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT", null,
 							null, MetacatUtil.normalize(textBuffer.toString()));
@@ -482,13 +473,13 @@
 			// handle access stuff
 			if (localName.equals(ACCESS)) {
 				if (parentNode.getTagName().equals(EML)) {
-					processTopLevelAccess = true;
+					processingTopLevelAccess = true;
 				} else if (parentNode.getTagName() == DISTRIBUTION) {
-					processAdditionalAccess = true;
+					processingAdditionalAccess = true;
 				} else {
 					// process other access embedded into resource level
 					// module
-					processOtherAccess = true;
+					processingOtherAccess = true;
 				}
 				// create access object
 				accessObject = new AccessSection();
@@ -500,13 +491,13 @@
 				accessObject.setSubTreeId(accessId);
 				accessObject.setStartNodeId(startNodeId);
 				accessObject.setDocId(docid);
-				if (processAdditionalAccess) {
+				if (processingAdditionalAccess) {
 					accessObject.setDataFileName(inlineDataFileName);
 				}
 
 				// load top level node stack to
 				// currentUnchangableAccessModuleNodeStack
-				if (processTopLevelAccess && needToCheckAccessModule) {
+				if (processingTopLevelAccess && needToCheckAccessModule) {
 					// get the node stack for
 					currentUnchangeableAccessModuleNodeStack = topAccessSection
 							.getSubTreeNodeStack();
@@ -552,7 +543,7 @@
 			nodeIndex.addElement(currentNode);
 
 			// compare top access level module
-			if (processTopLevelAccess && needToCheckAccessModule) {
+			if (processingTopLevelAccess && needToCheckAccessModule) {
 				compareElementNameSpaceAttributes(
 						currentUnchangeableAccessModuleNodeStack, namespaces, atts,
 						localName, UPDATEACCESSERROR);
@@ -561,7 +552,7 @@
 
 			// store access module element and attributes into stored stack
 			if (needToCheckAccessModule
-					&& (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
+					&& (processingAdditionalAccess || processingOtherAccess || processingTopLevelAccess)) {
 				// stored the pull out nodes into storedNode stack
 				NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "ELEMENT", localName,
 						prefix, MetacatUtil.normalize(null));
@@ -724,32 +715,32 @@
 	}
 
 	/* method to compare current text node and node in db */
-	private void compareTextNode(Stack<NodeRecord> nodeStack, StringBuffer text,
-			String error) throws SAXException {
+	private void compareAccessTextNode(Stack<NodeRecord> nodeStack, StringBuffer text) throws SAXException {
 		NodeRecord node = null;
 		// get node from current stack
 		try {
 			node = nodeStack.pop();
 		} catch (EmptyStackException ee) {
-			logMetacat.error("Node stack is empty for text data in startElement");
-			throw new SAXException(error);
+			logMetacat.error("Node stack is empty for text data in startElement for doc id " + docid);
+			throw new SAXException("Access rules could not be found in database.");
 		}
-		logMetacat.debug("current node type from xml is TEXT in start element");
-		logMetacat.debug("node type from stack: " + node.getNodeType());
-		logMetacat.debug("current node data from xml is: " + text.toString());
-		logMetacat.debug("node data from stack: " + node.getNodeData());
-		logMetacat.debug("node name from stack: " + node.getNodeName());
-		logMetacat.debug("node is: " + node.getNodeId());
+
+		String dbAccessData = node.getNodeData();
+		String docAccessData = text.toString().trim();
+		
+		logMetacat.debug("Eml210SAXHandler.compareAccessTextNode - \n" +
+					"\t access node type from db:       " + node.getNodeType() + "\n" +
+					"\t access node data from db:       " + node.getNodeData() + "\n" +
+					"\t access node data from document: " + text.toString());
+		
 		if (!node.getNodeType().equals("TEXT")
-				|| !(text.toString()).equals(node.getNodeData())) {
-			logMetacat.error("Inconsistence happened: ");
-			logMetacat.error("current node type from xml is TEXT in start element");
-			logMetacat.error("node type from stack: " + node.getNodeType());
-			logMetacat.error("current node data from xml is: " + text.toString());
-			logMetacat.error("node data from stack: " + node.getNodeData());
-			logMetacat.error("node name from stack: " + node.getNodeName());
-			logMetacat.error("node is: " + node.getNodeId());
-			throw new SAXException(error);
+				|| !docAccessData.equals(dbAccessData)) {
+			logMetacat.warn("Eml210SAXHandler.compareAccessTextNode - Access record mismatch: \n" +
+					"\t access node type from db:       " + node.getNodeType() + "\n" +
+					"\t access node data from db:       " + dbAccessData + "\n" +
+					"\t access node data from document: " + docAccessData);
+			
+			throw new SAXException(UPDATEACCESSERROR + " [Eml210SAXHandler.compareAccessTextNode]");
 		}// if
 	}
 
@@ -843,7 +834,7 @@
 					}
 					accessRule.setPermission(permission);
 				} else if (currentTag.equals(REFERENCES)
-						&& (processTopLevelAccess || processAdditionalAccess || processOtherAccess)) {
+						&& (processingTopLevelAccess || processingAdditionalAccess || processingOtherAccess)) {
 					// get reference
 					data = (textBuffer.toString()).trim();
 					// put reference id into accessSection
@@ -858,38 +849,30 @@
 						// vector
 						data = (textBuffer.toString()).trim();
 						handleOnlineUrlDataFile(data);
-						/*
-						 * if (data != null && (data.indexOf(MetacatUtil
-						 * .getProperty("httpserver")) != -1 || data
-						 * .indexOf(MetacatUtil .getProperty("server")) != -1)) { //
-						 * Get docid from url String dataId = MetacatUtil
-						 * .getDocIdWithRevFromOnlineURL(data); // add to vector
-						 * onlineDataFileIdVector.add(dataId); }//if
-						 */
+
 					}// if
 				}// else if
+				
 				// write text to db if it is not inline data
-				// if (!localName.equals(INLINE))
-				{
-					logMetacat.debug("Write text into DB in End Element");
+				logMetacat.debug("Write text into DB in End Element");
 
-					// compare top level access module
-					if (processTopLevelAccess && needToCheckAccessModule) {
-						compareTextNode(currentUnchangeableAccessModuleNodeStack,
-								textBuffer, UPDATEACCESSERROR);
-					}
-					// write text node into db
-					endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, currentNode);
+				// compare top level access module
+				if (processingTopLevelAccess && needToCheckAccessModule) {
+					compareAccessTextNode(currentUnchangeableAccessModuleNodeStack,
+							textBuffer);
 				}
-				if (needToCheckAccessModule
-						&& (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
-					// stored the pull out nodes into storedNode stack
-					NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT", null,
-							null, MetacatUtil.normalize(textBuffer.toString()));
-					storedAccessNodeStack.push(nodeElement);
+				// write text node into db
+				endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, currentNode);
+			}
+			
+			if (needToCheckAccessModule
+					&& (processingAdditionalAccess || processingOtherAccess || processingTopLevelAccess)) {
+				// stored the pull out nodes into storedNode stack
+				NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT", null,
+						null, MetacatUtil.normalize(textBuffer.toString()));
+				storedAccessNodeStack.push(nodeElement);
 
-				}
-			}// if
+			}
 
 			// set hitText false
 			hitTextNode = false;
@@ -943,7 +926,7 @@
 						newAccessObject.setStoredTmpNodeStack(storedAccessNodeStack);
 						accessObjectList.add(newAccessObject);
 					}
-					if (processTopLevelAccess) {
+					if (processingTopLevelAccess) {
 
 						// top level access control will handle whole document
 						// -docid
@@ -951,7 +934,7 @@
 						// reset processtopleveraccess tag
 
 					}// if
-					else if (processAdditionalAccess) {
+					else if (processingAdditionalAccess) {
 						// for additional control put everything in describes
 						// value
 						// and access object into hash
@@ -976,7 +959,7 @@
 				// check if access node stack is empty after parsing top access
 				// module
 
-				if (needToCheckAccessModule && processTopLevelAccess
+				if (needToCheckAccessModule && processingTopLevelAccess
 						&& !currentUnchangeableAccessModuleNodeStack.isEmpty()) {
 
 					logMetacat.error("Access node stack is not empty after "
@@ -993,9 +976,9 @@
 				storedAccessNodeStack = new Stack<NodeRecord>();
 
 				// reset flag
-				processAdditionalAccess = false;
-				processTopLevelAccess = false;
-				processOtherAccess = false;
+				processingAdditionalAccess = false;
+				processingTopLevelAccess = false;
+				processingOtherAccess = false;
 
 			} else if (currentTag.equals(DISTRIBUTION)) {
 				// If the current Distribution is inline or data and it doesn't have an access section
@@ -1045,13 +1028,13 @@
 				String str = new String(ch, start, length);
 
 				// compare top level access module
-				if (processTopLevelAccess && needToCheckAccessModule) {
+				if (processingTopLevelAccess && needToCheckAccessModule) {
 					compareCommentNode(currentUnchangeableAccessModuleNodeStack, str,
 							UPDATEACCESSERROR);
 				}
 				endNodeId = currentNode.writeChildNodeToDB("COMMENT", null, str, docid);
 				if (needToCheckAccessModule
-						&& (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
+						&& (processingAdditionalAccess || processingOtherAccess || processingTopLevelAccess)) {
 					// stored the pull out nodes into storedNode stack
 					NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "COMMENT", null,
 							null, MetacatUtil.normalize(str));
@@ -1141,13 +1124,13 @@
 			DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
 				String data = new String(cbuf, start, len);
 				// compare whitespace in access top module
-				if (processTopLevelAccess && needToCheckAccessModule) {
+				if (processingTopLevelAccess && needToCheckAccessModule) {
 					compareWhiteSpace(currentUnchangeableAccessModuleNodeStack, data,
 							UPDATEACCESSERROR);
 				}
 				// Write the content of the node to the database
 				if (needToCheckAccessModule
-						&& (processAdditionalAccess || processOtherAccess || processTopLevelAccess)) {
+						&& (processingAdditionalAccess || processingOtherAccess || processingTopLevelAccess)) {
 					// stored the pull out nodes into storedNode stack
 					NodeRecord nodeElement = new NodeRecord(-2, -2, -2, "TEXT", null,
 							null, MetacatUtil.normalize(data));
Index: docs/dev/workflowscheduler/createWorkflowSchedulerDB.txt
===================================================================
--- docs/dev/workflowscheduler/createWorkflowSchedulerDB.txt	(revision 5310)
+++ docs/dev/workflowscheduler/createWorkflowSchedulerDB.txt	(revision 5311)
@@ -30,9 +30,13 @@
 	Open the table creation script at:
 		<metacat>/src/scripts/workflowscheduler-db-scripts/ws-tables-postgres.sql
 	Copy each sql command and run in psql prompt.
+
+        Or at the psql prompt, type "\i <metacat>/src/scripts/workflowscheduler-db-scripts/ws-tables-postgres.sql"
 	
 Populate tables
 	Open the table creation script at:
 		<metacat>/src/scripts/workflowscheduler-db-scripts/ws-loaddtdschema-postgres.sql
 	Copy each sql command and run in psql prompt.
+	
+	Or  at the psql prompt, type "\i  <metacat>/src/scripts/workflowscheduler-db-scripts/ws-loaddtdschema-postgres.sql"
 		
Index: README
===================================================================
--- README	(revision 5310)
+++ README	(revision 5311)
@@ -53,14 +53,37 @@
 See the file "docs/user/metacat-<OS>-install.html" for detailed instructions
 for your OS.
 
-Release Notes for 1.9.1:
+Release Notes for 1.9.2:
 ------------------------
 This release primarily holds the addition of the Threshold of Potential
-Concern workflow functionality (TPC).  
+Concern workflow functionality (TPC).  The following issues were addressed:
 
- -- TPC workflow and workflow run pages added to SANParks skin.
-  
- -- Release supports running metacat on Java 1.6 JVM
+* Create a properties file for use by JUnit Tests (Bug 2994)
+* security issue with skins (Bug 3368)
+* reorganize classes into a more functional specific structure (Bug 3510)
+* Add admin names as dropdown in configuration login (Bug 3729)
+* KNB metacat replication error log file is empty (Bug 3885)
+* Create TPC Report web browse/search pages (Bug 4165)
+* Create archive extraction functionality (Bug 4166)
+* Create Workflow Scheduler (Bug 4167)
+* metacat didn't update xml_path_index table while a document was updated (Bug 4367)
+* Enforce permissions for tpc workflow viewing and scheduling (Bug 4420)
+* Fix cross platform TPC GUI issues (Bug 4556)
+* TPC Sanparks page content lenth issue (Bug 4557)
+* Create validate and isAuthorized unit tests (Bug 4558)
+* Cannot insert replication server via gui (Bug 4594)
+* Timed Replication takes many hours and drives the load up on KNB (Bug 4616)
+* [ESA] Update fails when document rev number is missing (Bug 4627)
+* fails to catch some insert and update failures (Bug 4637)
+* must support java 1.6 (Bug 4641)
+* Convert build to pull eml from svn instead of cvs (Bug 4644)
+* handleGetRevisionAndDocTypeAction should search both xml_documents and xml_revisions table (Bug 4645)
+* Metacat couldn't update a document from client, which previous versions only stay in xml_revisions table (Bug 4649)
+* metacat runs out of memory (Bug 4658)
+* ESA skin links are hard coded to data.esa.org (Bug 4698)
+* Update release 1.9.2 release notes (Bug 4707)
+* Handle writing a text node > 4000 characters to the db. (Bug 4708)
+* Metacat should run against Tomcat 6 (Bug 4716)
 
 Release Notes for 1.9.1:
 ------------------------
