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

Diff of /RAST/Upload3p2.tt2

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Thu Apr 29 20:38:51 2010 UTC revision 1.3, Tue Nov 23 21:04:04 2010 UTC
# Line 1  Line 1 
1  [% form.jshead %]  [% form.jshead %]
2    <script type="text/javascript">
3    function lookup_taxid(form)
4    {
5        var id = form.elements['taxonomy_id'].value;
6    
7        var http_request;
8        var agt=navigator.userAgent.toLowerCase();
9        if (agt.indexOf("msie") != -1) {
10            no_load_image = 1;
11            try {
12                http_request = new ActiveXObject("Microsoft.XMLHTTP");
13            }
14            catch (err) {
15                alert('You must enable ActiveX in your security settings to view all features of this page.');
16            }
17        } else {
18            http_request = new XMLHttpRequest();
19            http_request.overrideMimeType('text/plain');
20        }
21    
22        var parameters = "";
23    
24        parameters = parameters + "tax_id=" + encodeURIComponent(id);
25    
26        var script_url = form.elements['ajax_url'].value;
27        http_request.onreadystatechange = function() { ajax_result(http_request, id, form); };
28    
29        form.elements['lookup'].value = "Lookup in progress...";
30        http_request.open('POST', script_url, true);
31        http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
32        http_request.send(parameters);
33    }
34    
35    function ajax_result (http_request, tax_id, form) {
36        if (http_request.readyState == 4) {
37    //      alert("state=" +http_request.readyState + " " + http_request.responseText);
38            var obj = JSON.parse(http_request.responseText);
39            form.elements['lookup'].value = "Look up taxonomy ID at NCBI.";
40            if (obj == null || obj.domain == "")
41            {
42                alert("Could not find taxonomy id " + tax_id + " at NCBI.");
43                return;
44            }
45            set_radio(form, "domain", obj.domain);
46            set_form_field(form, "taxonomy_string", obj.taxonomy);
47            set_radio(form, "genetic_code", obj.genetic_code);
48            set_form_field(form, "genus", obj.genus);
49            set_form_field(form, "species", obj.species);
50            set_form_field(form, "strain", obj.strain);
51        }
52    }
53    
54    function set_form_field(form, name, val)
55    {
56        var elt = form.elements[name];
57        if (elt == null)
58        {
59            return;
60        }
61    
62        elt.value = val;
63    }
64    
65    function set_radio(form, name, val) {
66        var elt = form.elements[name];
67        if (elt == null)
68        {
69            return;
70        }
71    
72        for (var loop = 0; loop < elt.length; loop++)
73        {
74            if (elt[loop].value == val)
75            {
76                elt[loop].checked = 1;
77            }
78            else
79            {
80                elt[loop].checked = 0;
81            }
82        }
83    }
84    
85    </script>
86    
87  <h1> Upload a Genome </h1>  <h1> Upload a Genome </h1>
88  <h2>Review genome data</h2>  <h2>Review genome data</h2>
89  <p>  <p>
# Line 11  Line 96 
96  </p>  </p>
97    
98  [% form.start %]  [% form.start %]
99    [% form.field.ajax_url.field %]
100  <fieldset>  <fieldset>
101  <legend>Required information:</legend>  <legend>Required information:</legend>
102  <div id="organism">  <div id="organism">
# Line 22  Line 107 
107  </tr>  </tr>
108  <tr>  <tr>
109  <td></td>  <td></td>
110    <td><input type="button" onclick="lookup_taxid(this.form)"  name="lookup" value="Look up taxonomy ID at NCBI.">
111    <tr>
112    <td></td>
113  <td> Find the taxonomy id for your organism by searching for its name in the  <td> Find the taxonomy id for your organism by searching for its name in the
114  <a target="_blank" href="http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/">  <a target="_blank" href="http://www.ncbi.nlm.nih.gov/Taxonomy/taxonomyhome.html/">
115  NCBI taxonomy browser</a>. </td>  NCBI taxonomy browser</a>. </td>
116  </tr>  </tr>
117  <tr>  <tr>
118    <td><strong>Taxonomy string:</strong></td>
119    <td>[% form.field.taxonomy_string.field %] </td>
120    </tr>
121    <tr>
122  <td><strong>Domain:</strong></td>  <td><strong>Domain:</strong></td>
123  <td>[% form.field.domain.field %] </td>  <td>[% form.field.domain.field %] </td>
124  </tr>  </tr>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3