 <!------------------------------------------------------->
 <cfif action is "nothing">
 	<cfoutput>
-		Load names, optionally with classifications. This form will happily create garbage; use the Contact link below to ask questions and do not
-		click any buttons unless you KNOW what they do.
+		Load names. Do NOT load identifications. You may load classifications separately after the names exist.
 		 <p>
 			Upload a comma-delimited text file (csv). <a href="BulkloadTaxonomy.cfm?action=makeTemplate">[ Get the Template ]</a>
 		</p>
-		<p>
-			You can (and should) also pull classification from globalnames.
-		</p>
-		<p>subgeneric terms are multinomial</p>
-		<p>
-			Source is <a href="/info/ctDocumentation.cfm?table=CTTAXONOMY_SOURCE">CTTAXONOMY_SOURCE</a>
-		</p>
+
 		<cfform name="oids" method="post" enctype="multipart/form-data" action="BulkloadTaxonomy.cfm">
 			<input type="hidden" name="action" value="getFile">
 			<input type="file" name="FiletoUpload" size="45" onchange="checkCSV(this);">

<cfif action is "show">
<script src="/includes/sorttable.js"></script>
<cfoutput>
	<cfquery name="data" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
		select * from cf_temp_taxonomy
	</cfquery>
	<cfquery name="isProb" dbtype="query">
		select count(*) c from data where status ='valid'
	</cfquery>
	<p>
		This form will happily create garbage. CHECK <strong>ALL</strong> DATA CAREFULLY BEFORE LOADING!!!
	</p>
	<p>
		This form is not the preferred method of creating classifications. Use GNITE if you can.
	</p>
	<P>
		Some terms may not mean what you think they do. Ask us (contact link below) if you're uncertain.
	</P>
	<ul>
		<cfif isProb.c eq data.recordcount>
			<li><strong>Carefully</strong> check the table below, then <a href="BulkloadTaxonomy.cfm?action=loadData">continue to load</a></li>
		</cfif>
		<li>
			<a href="BulkloadTaxonomy.cfm?action=autogenmn">Click here to generate multinomials</a>
			<br>Do this BEFORE generating display_name
			<br>Do this BEFORE validation
			<br>CHECK THE RESULTS
		</li>
		<li>
			<a href="BulkloadTaxonomy.cfm?action=autogendispname">Click here to generate display_name</a>
			Do this BEFORE validation and CHECK THE RESULTS. This may not do what you want if you don't specify nomenclatural_code.
		</li>
		<li><a href="BulkloadTaxonomy.cfm?action=validate">validate</a></li>
		<li><a href="BulkloadTaxonomy.cfm?action=deleteDups">discard duplicate names</a></li>
		<li><a href="BulkloadTaxonomy.cfm?action=down">download</a></li>
		<li><a href="BulkloadTaxonomy.cfm?action=nothing">start over</a></li>
	</ul>
	<cfset h=data.columnlist>
	<table border id="t" class="sortable">
		<tr>

</cfoutput>
</cfif>
<!------------------------------------------------------->
<cfif action is "validate">
<cfoutput>
	<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
		select * from  cf_temp_taxonomy  where status is null and  upper(username)='#ucase(session.username)#'
	</cfquery>
	<cfset tc = CreateObject("component","component.taxonomy")>

	<cfloop query="d">
		<cfset result=tc.validateName(scientific_name)>
		<cfquery name="u" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
			update cf_temp_taxonomy set status='#result.consensus#' where scientific_name='#scientific_name#'
		</cfquery>
	</cfloop>
	<cflocation url="BulkloadTaxonomy.cfm" addtoken="false">
</cfoutput>
</cfif>



<!------------------------------------------------------->
<cfif action is "loadData">
<cfoutput>
	<cfquery name="d" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
		select * from  cf_temp_taxonomy  where  upper(username)='#ucase(session.username)#'
	</cfquery>
	<cfloop query="d">
		<cftransaction>
			<cfquery name="isn" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
				insert into taxon_name (scientific_name) values ('#scientific_name#')
			</cfquery>
			<cfquery name="dup" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
				delete from cf_temp_taxonomy  where scientific_name='#scientific_name#' and upper(username)='#ucase(session.username)#'
			</cfquery>
			<br>loaded #scientific_name#
		</cftransaction>
	</cfloop>
	Spiffy, all done.
</cfoutput>
</cfif>
