5 /genefamily/manual/add_locus.mas - a component for adding a locus to a locusgroup
25 Naama Menda <nm249@cornell.edu>
35 $add_locus_uri => '/ajax/genefamily/manual/add'
36 $members_div => 'locusgroup_members'
37 $locus_autocomplete_uri => '/ajax/locus/autocomplete'
41 <script language="javascript">
44 var common_name = jQuery('#organism_select option:selected').attr("value");
45 jQuery("#locus").autocomplete({
46 source: '<% $locus_autocomplete_uri %>' + "?common_name=" + common_name + "&mode=no_alleles",
49 select: function(event, ui) {
50 Ontology.populateEvidence( 'locus_evidence_code_select', '/ajax/cvterm/evidence');
54 jQuery("#organism_select").change(function(){
55 common_name = jQuery('#organism_select option:selected').attr("value");
56 jQuery("#locus").autocomplete('option', 'source', '<% $locus_autocomplete_uri %>' + "?mode=no_alleles" + "&common_name=" + common_name );
61 function update_references() {
62 var locus_info = jQuery("#locus").val();
63 var mySplitResult = locus_info.split("|");
64 var locus_id = mySplitResult[2];
65 Ontology.populateEvidence('locus_reference_select', '/locus/'+locus_id+'/references');
68 function submit_add_locus_form() {
69 //make an AJAX request with the form params
70 var locus = jQuery("#locus").val();
71 var reference_id = jQuery("#locus_reference_select").val();
72 var evidence_code_id = jQuery("#locus_evidence_code_select").val();
74 url: "<% $add_locus_uri %>" ,
76 data: 'locusgroup_id='+<% $locusgroup_id %>+'&locus='+locus +'&evidence_id='+evidence_code_id +'&reference_id=' + reference_id,
77 success: function(response) {
78 var error = response.error;
79 if (error) { alert(error) ; }
80 Locus.displayMembers( "<% $members_div %>", "<% $locusgroup_id %>" );
86 function reset_form() {
87 Effects.hideElement('associateLocusForm');
88 jQuery("#locus_evidence_code_select").html();
93 <& /util/import_javascript.mas, classes=>[qw[ jqueryui popup CXGN.Phenome.Locus CXGN.AJAX.Ontology ] ]&>
96 <div id='associateLocusForm' style="display: none">
97 <div id='locus_search'>
102 <select id = "organism_select" onchange="jQuery('#locus').val('--type a locus name--');$('associate_locus_button').disabled=true""
106 <select id="locus_evidence_code_select" style="width: 50%"
107 onchange="$('associate_locus_button').disabled=false;javascript:update_references()">
109 <select id="locus_reference_select" style="width: 100%">
113 id="associate_locus_button"
114 value="Associate locus"
116 onclick="javascript:submit_add_locus_form();this.disabled=true;" />