[Bio] / RAST / Upload3p2.tt2 Repository:
ViewVC logotype

View of /RAST/Upload3p2.tt2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (annotate)
Tue Nov 23 21:04:04 2010 UTC (9 years, 6 months ago) by olson
Branch: MAIN
Changes since 1.2: +93 -1 lines
Put the javascript taxid lookup code back in. Other cleanups.

[% form.jshead %]
<script type="text/javascript">
function lookup_taxid(form)
{
    var id = form.elements['taxonomy_id'].value;

    var http_request;
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("msie") != -1) {
	no_load_image = 1;
	try {
	    http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (err) {
	    alert('You must enable ActiveX in your security settings to view all features of this page.');
	}
    } else {
	http_request = new XMLHttpRequest();
	http_request.overrideMimeType('text/plain');
    }

    var parameters = "";

    parameters = parameters + "tax_id=" + encodeURIComponent(id);
    
    var script_url = form.elements['ajax_url'].value;
    http_request.onreadystatechange = function() { ajax_result(http_request, id, form); };

    form.elements['lookup'].value = "Lookup in progress...";
    http_request.open('POST', script_url, true);
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.send(parameters);
}

function ajax_result (http_request, tax_id, form) {
    if (http_request.readyState == 4) {
//	alert("state=" +http_request.readyState + " " + http_request.responseText);
	var obj = JSON.parse(http_request.responseText);
	form.elements['lookup'].value = "Look up taxonomy ID at NCBI.";
	if (obj == null || obj.domain == "")
	{ 
	    alert("Could not find taxonomy id " + tax_id + " at NCBI.");
	    return;
	}
	set_radio(form, "domain", obj.domain);
	set_form_field(form, "taxonomy_string", obj.taxonomy);
	set_radio(form, "genetic_code", obj.genetic_code);
	set_form_field(form, "genus", obj.genus);
	set_form_field(form, "species", obj.species);
	set_form_field(form, "strain", obj.strain);
    }
}

function set_form_field(form, name, val)
{
    var elt = form.elements[name];
    if (elt == null)
    {
	return;
    }

    elt.value = val;
}

function set_radio(form, name, val) {
    var elt = form.elements[name];
    if (elt == null)
    {
	return;
    }

    for (var loop = 0; loop < elt.length; loop++)
    {
	if (elt[loop].value == val)
	{
	    elt[loop].checked = 1;
	}
	else
	{
	    elt[loop].checked = 0;
	}
    }
}

</script>

<h1> Upload a Genome </h1>
<h2>Review genome data</h2>
<p>
<strong>We have analyzed your upload and have computed the following information.</strong>
</p>
[% statistics %]

<p>
<strong>Please enter or verify the following information about this organism:</strong>
</p>

[% form.start %]
[% form.field.ajax_url.field %]
<fieldset>
<legend>Required information:</legend>
<div id="organism">
<table>
<tr>
<td> <strong>Taxonomy ID:</strong> </td>
<td> [% form.field.taxonomy_id.field %] <i>(leave blank if NCBI Taxonomy ID unknown)</i> </td>
</tr>
<tr>
<td></td>
<td><input type="button" onclick="lookup_taxid(this.form)"  name="lookup" value="Look up taxonomy ID at NCBI.">
<tr>
<td></td>
<td> Find the taxonomy id for your organism by searching for its name in the
<a target="_blank" href="http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/">
NCBI taxonomy browser</a>. </td>
</tr>
<tr>
<td><strong>Taxonomy string:</strong></td>
<td>[% form.field.taxonomy_string.field %] </td>
</tr>
<tr>
<td><strong>Domain:</strong></td>
<td>[% form.field.domain.field %] </td>
</tr>
<tr>
<td> <strong>Genus:</strong></td>
<td> [% form.field.genus.field %] </td>
</tr>
<tr>
<td> <strong>Species:</strong></td>
<td> [% form.field.species.field %] </td>
</tr>
<tr>
<td> <strong>Strain:</strong></td>
<td> [% form.field.strain.field %] </td>
</tr>
<tr>
<td> <strong>Genetic Code:</strong></td>
<td> [% form.field.genetic_code.field %] </td>
</tr>
</table>
</div>
</fieldset>
[% form.submit %]
[% form.end %]


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3