5 <& /util/import_javascript.mas, classes => [ 'jqueryui', 'jquery.cookie', 'CXGN.BreederSearch', 'CXGN.List', 'CXGN.BreedersToolbox.HTMLSelect', 'spin_min', 'ladda_min' ] &>
7 <& /page/page_title.mas, title=>"Download Using Lists" &>
9 <div class="container-fluid">
12 Choose a list for each parameter and click "Download".
15 <div class="well well-sm">
16 <form id="download_form" action="/breeders/download_action" method="POST" >
17 <table class="table" cellpadding="10" border="0" >
19 <tr><td colspan="4"><h4>Download Phenotype</h4><p>Select parameter:</p></tr>
47 <div id="accession_list">
60 <label><input type="radio" id="format" name="format" value=".csv" checked>.csv</label>
63 <label><input type="radio" id="format" name="format" value=".xls">.xls</label>
66 <label><input type="radio" id="format" name="format" value="html">html</label>
70 <select class="form-control" id="timestamp" name="timestamp">
71 <option value="0">No</option>
72 <option value="1">Yes</option>
76 <select class="form-control" id="phenotype_datalevel" name="phenotype_datalevel">
77 <option value="all">All</option>
78 <option value="plot">Plot</option>
79 <option value="plant">Plant</option>
83 <button class="btn btn-primary" type="button" id="phenotype">Download</button>
84 <input type="hidden" id="phenotype_download_token" name="phenotype_download_token"/>
93 $(document).ready(function() {
95 var lo = new CXGN.List();
97 $('#accession_list').html(lo.listSelect('accession_list', [ 'accessions' ], 'select'));
98 $('#trial_list').html(lo.listSelect('trial_list', [ 'trials' ], 'select' ));
99 $('#trait_list').html(lo.listSelect('trait_list', [ 'traits' ], 'select' ));
101 $('#phenotype').click(function() {
103 var accession_list_id = $('#accession_list_list_select').val();
104 var trial_list_id = $('#trial_list_list_select').val();
105 var trait_list_id = $('#trait_list_list_select').val();
107 var accession_validation = 1;
108 if (accession_list_id) { accession_validation = lo.validate(accession_list_id, 'accessions', true); }
110 var trial_validation = 1;
111 if (trial_list_id) { trial_validation = lo.validate(trial_list_id, 'trials', true); }
113 var trait_validation = 1;
114 if (trait_list_id) { trait_validation = lo.validate(trait_list_id, 'traits', true); }
116 var problem_lists = new Array();
118 if (accession_validation != 1) {
119 problem_lists.push('accessions');
121 if (trial_validation != 1) {
122 problem_lists.push('trials');
124 if (trait_validation != 1) {
125 problem_lists.push('trials');
128 if (problem_lists.length > 0) {
129 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
133 var ladda = Ladda.create(this);
135 var token = new Date().getTime(); //use the current timestamp as the token name and value
136 manage_dl_with_cookie(token, ladda);
137 jQuery('#phenotype_download_token').val(token);
138 jQuery('#download_form').submit();
147 <!-- start of code for pedigree download -->
149 <div class="well well-sm">
150 <form id="download_pedigree" action="/breeders/download_pedigree_action" method="POST">
151 <table class="table" cellpadding="10">
153 <tr><td colspan="2"><h4>Download Pedigree </h4><p>Select parameter:</p></tr>
169 <div id="accession_list4">
174 <label><input type="radio" id="ped_format" name="ped_format" value="parents_only" checked>Direct parents only</label>
177 <label><input type="radio" id="ped_format" name="ped_format" value="full">Full pedigrees</label>
181 <button class="btn btn-primary" type="button" id="pedigree">Download</button>
182 <input type="hidden" id="pedigree_download_token" name="pedigree_download_token"/>
192 $(document).ready(function() {
194 var lo = new CXGN.List();
196 $('#accession_list4').html(lo.listSelect('pedigree_accession_list', [ 'accessions' ], 'select'));
198 $('#pedigree').click(function() {
200 var accession_list_id = $('#pedigree_accession_list_list_select').val();
201 if (!accession_list_id) {
202 alert("You need to select an accession list!");
206 var accession_validation = 1;
207 if (accession_list_id) {
208 accession_validation = lo.validate(accession_list_id, 'accessions', true);
212 if (accession_validation != 1) {
213 alert("The accession list did not pass validation. Please correct the list and try again");
217 var ladda = Ladda.create(this);
219 var token = new Date().getTime(); //use the current timestamp as the token name and value
220 manage_dl_with_cookie(token, ladda);
221 jQuery('#pedigree_download_token').val(token);
222 jQuery('#download_pedigree').submit();
229 <!-- end of code for pedigree download -->
232 <div class="well well-sm">
233 <form id="download_gbs" action="/breeders/download_gbs_action" method="POST">
234 <table class="table" cellpadding="10">
236 <tr><td colspan="2"><h4>Download GBS Genotype </h4><p>Select parameter:</p></tr>
252 <div id="accession_list2">
256 <div id="protocol_list">
260 <button class="btn btn-primary" type="button" id="genotype">Download</button>
261 <input type="hidden" id="gbs_download_token" name="gbs_download_token"/>
270 $(document).ready(function() {
272 var lo = new CXGN.List();
274 $('#accession_list2').html(lo.listSelect('genotype_accession_list', [ 'accessions' ], 'select'));
275 get_select_box("genotyping_protocols", "protocol_list");
277 $('#genotype').click(function() {
279 var accession_list_id = $('#genotype_accession_list_list_select').val();
280 var protocol_list_id = $('#protocol_list').val();
282 var accession_validation = 1;
283 if (accession_list_id) {
284 accession_validation = lo.validate(accession_list_id, 'accessions', true);
287 if (!( accession_list_id || protocol_list_id) ) {
288 alert("You need to select a list of accessions and a protocol !");
292 var problem_lists = new Array();
294 if (accession_validation != 1) {
295 problem_lists.push('accessions');
299 console.log(problem_lists);
301 if (problem_lists.length > 0) {
302 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
306 var ladda = Ladda.create(this);
308 var token = new Date().getTime(); //use the current timestamp as the token name and value
309 manage_dl_with_cookie(token, ladda);
310 jQuery('#gbs_download_token').val(token);
311 jQuery('#download_gbs').submit();
318 <div class="well well-sm">
319 <form id="gbs_qc" action="/breeders/gbs_qc_action" method="POST">
320 <table class="table" cellpadding="10">
322 <tr><td colspan="3"><h4>GBS Genotype QC</h4><p>Select parameter:</p></tr>
338 <div id="trial_list3">
342 <div id="accession_list3">
346 <div id="protocol_list2">
350 <button class="btn btn-primary" type="button" id="genotype_qc">Download</button>
351 <input type="hidden" id="qc_download_token" name="qc_download_token"/>
362 $(document).ready(function() {
364 var lo = new CXGN.List();
366 $('#accession_list3').html(lo.listSelect('genotype_qc_accession_list', [ 'accessions' ], 'select'));
367 $('#trial_list3').html(lo.listSelect('genotype_trial_list', [ 'trials' ], 'select' ));
368 get_select_box("genotyping_protocols", "protocol_list2", {'id':'protocol_list2_select', 'name':'protocol_list2_select'});
370 $('#genotype_qc').click(function() {
372 $('#working').dialog( {
380 open: function() { $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide(); },
381 title: 'Downloading genotype...'
384 var accession_list_id = $('#genotype_qc_accession_list_list_select').val();
385 var trial_list_id = $('#genotype_trial_list_list_select').val();
387 var accession_validation = lo.validate(accession_list_id, 'accessions', true);
388 var trial_validation = lo.validate(trial_list_id, 'trials', true);
390 if (! (accession_list_id || trial_list_id) ) {
391 alert("You need to select an accession or a trail !");
395 var problem_lists = new Array();
397 if (accession_validation != 1) {
398 problem_lists.push('accessions');
401 if (trial_validation != 1) {
402 problem_lists.push('trials');
406 //alert("problem_lists is " + problem_lists);
408 console.log(problem_lists);
410 if (problem_lists.length > 0) {
411 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
415 var ladda = Ladda.create(this);
417 var token = new Date().getTime(); //use the current timestamp as the token name and value
418 manage_dl_with_cookie(token, ladda);
419 jQuery('#qc_download_token').val(token);
420 jQuery('#gbs_qc').submit();