4 * Function used for printing ontology annotations
5 * and helper functions for populating the menus of the associate_ontology tool
6 * @author Naama Menda <nm249@cornell.edu>
13 JSAN.use('CXGN.Phenome.Tools');
16 submitCvtermForm: function(cvterm_add_uri, ontology_url) {
17 var onto_html = this.displayOntologies( "ontology" , ontology_url);
18 //make an AJAX request with the form params
19 var object_id = jQuery('#object_id').val();
20 var relationship = jQuery('#relationship_select').val();
21 var evidence_code = jQuery('#evidence_code_select').val();
22 var evidence_description = jQuery('#evidence_description_select').val();
23 var evidence_with = jQuery('#evidence_with_select').val();
24 var reference = jQuery('#reference_select').val();
25 var term_name = jQuery('#term_name').val();
27 url: "/ajax/locus/associate_ontology" ,
32 'term_name': term_name,
33 'object_id': object_id,
34 'relationship': relationship,
35 'evidence_code': evidence_code,
36 'evidence_description': evidence_description,
37 'evidence_with': evidence_with,
38 'reference': reference ,
40 success: function(response) {
41 var error = response.error;
42 if (error) { alert(error) ; }
45 alert('Error submitting ontology term');
49 Tools.toggleContent('associate_cvterm_form', 'locus_ontology')
50 jQuery("#ontology").html( this.displayOntologies( "ontology" , ontology_url) );
53 displayOntologies: function(div_id, url) {
54 //alternate show the annotation and the detailed evidence
56 jQuery("#ontology_show_details").show()
57 jQuery("#ontology_show_details input").click(function() {
59 jQuery("#ontology .evidence").show();
60 jQuery(this).addClass('active');
62 jQuery("#ontology .evidence").hide();
63 jQuery(this).removeClass('active');
67 jQuery.ajax( { url: url , dataType: "json",
68 success: function(response) {
70 jQuery("#"+div_id).html(response.html);
71 if ( response.error ) { alert(x.error) ; }
73 jQuery("#ontology_show_details input").first()[0].disabled = false;
74 jQuery("#ontology .evidence").hide();
75 } else { jQuery('#ontology_show_details').hide(); }
82 //Make an ajax request for finding the available objects for ontology evidence
83 //(relationships, evidence codes, evidence description
84 populateEvidence: function(div_id, uri, dummy_option) {
85 jQuery.ajax({ url: uri , method:"GET" ,
87 success: function(response) {
88 var error = response.error;
89 if (error) { alert(error) ; }
90 var select = jQuery('#'+div_id);
93 for(var k in response) {arraykeys.push(k); }
96 for(var i=0; i<arraykeys.length; i++) {
97 outputarray[arraykeys[i]]=response[arraykeys[i]];
101 if (!dummy_option) dummy_option = '--Please select one--';
102 options += '<option value="">' + dummy_option + '</option>';
103 for ( var j in outputarray) {
104 if ( !(isNaN(outputarray[j])) ) {
105 options += '<option value="' + outputarray[j] + '">' + j + '</option>';
108 jQuery("#"+div_id).html(options);
112 getEvidenceWith: function() {
114 getReference: function() {