13 use URI::Encode qw| uri_encode |;
15 print STDERR "trial names = ".(join ",",@trial_names)."\n";
19 my @trial_name_params = map { 'trial_name='.uri_encode($_) } @trial_names;
20 my $trial_names_url = join "&", @trial_name_params;
21 $url_params = $trial_names_url;
26 <& '/page/page_title.mas', title => "Compare trials" &>
28 <& '/util/import_javascript.mas', classes => [ 'jquery', 'jqueryui', 'popup', 'CXGN.List', 'CXGN.Login' ] &>
30 Comparison of trials <b><% join ",",@trial_names %></b>
32 Total accession count: <span id="total_accession_count"></span><br />
33 Common accession count: <span id="common_accession_count"></span><br />
34 Common traits: <span id="common_trait_count"></span><br />
36 Trait: <select id="trait_select"><option disabled="1">select trials first</option></select>
40 <img id="result_image" />
46 jQuery('#trait_select').change( function() {
47 var trait_id = jQuery('#trait_select').val();
52 beforeSend: function() { working_modal_show(); },
53 url: '/ajax/trial/common_traits?<% $url_params %>',
54 success: function(response) {
56 if (response.error) { jQuery('#trait_select').val('error'); }
59 for (var i =0 ; i < response.options.length; i++) {
61 var cvterm_id = '<% $cvterm_id %>';
62 if (response.options[i][0]== cvterm_id) { selected="selected"; }
63 option_html += '<option value="'+response.options[i][0]+'" '+selected+'>'+(response.options[i][1])+'</option>\n';
65 jQuery('#trait_select').html(option_html);
66 jQuery('#total_accession_count').html(response.total_accession_count);
67 jQuery('#common_accession_count').html(response.common_accession_count);
68 jQuery('#common_trait_count').html(response.common_trait_count);
69 compare(jQuery('#trait_select').val);
73 error: function(response) {
74 //alert("An error occurred, the service may temporarily be unavailable");
79 jQuery(document).ready( function() {
80 compare(<% $cvterm_id %>);
83 function compare(cvterm_id) {
86 url: '/ajax/trial/compare?<% $url_params %>&cvterm_id='+cvterm_id,
87 success: function(response) {
89 alert(response.error);
92 jQuery('#result_image').attr('src', response.png);