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 <h4>Download Phenotypes</h4><p>Select Parameters:</p>
17 <form id="download_form" action="/breeders/download_action" method="POST" >
18 <table class="table table-bordered" >
41 <div id="accession_list">
54 <select class="form-control" id="format" name="format">
55 <option value=".csv">CSV</option>
56 <option value=".xls">XLS</option>
57 <option value="html">HTML</option>
60 <b>Data Level:</b><br/>
61 <select class="form-control" id="phenotype_datalevel" name="phenotype_datalevel">
62 <option value="all">All</option>
63 <option value="plot">Plot</option>
64 <option value="plant">Plant</option>
67 <b>Timestamp:</b><br/>
68 <select class="form-control" id="timestamp" name="timestamp">
69 <option value="0">No</option>
70 <option value="1">Yes</option>
73 <b>Exclude Phenotype Outliers:</b><br/>
74 <select class="form-control" id="exclude_phenotype_outlier" name="exclude_phenotype_outlier">
75 <option value="0">No</option>
76 <option value="1">Yes</option>
80 <button class="btn btn-primary" type="button" id="phenotype">Download</button>
81 <input type="hidden" id="phenotype_download_token" name="phenotype_download_token"/>
89 <div class="well well-sm">
90 <h4>Download Metadata</h4><p>Select Parameters:</p>
91 <form id="download_metadata_form" action="/breeders/download_action" method="POST" >
92 <table class="table table-bordered" >
109 <div id="trial_metadata_list">
114 <select class="form-control" id="metadata_format" name="metadata_format">
115 <option value=".xls">XLS</option>
116 <option value=".csv">CSV</option>
117 <option value="html">HTML</option>
120 <div id="datalevel" style="display:none">
121 <select class="form-control" id="metadata_datalevel" name="metadata_datalevel">
122 <option value="metadata">Metadata</option>
127 <button class="btn btn-primary" type="button" id="metadata">Download</button>
128 <input type="hidden" id="metadata_download_token" name="metadata_download_token"/>
137 $(document).ready(function() {
139 var lo = new CXGN.List();
141 $('#accession_list').html(lo.listSelect('accession_list', [ 'accessions' ], 'select', undefined, undefined));
142 $('#trial_list').html(lo.listSelect('trial_list', [ 'trials' ], 'select', undefined, undefined ));
143 $('#trait_list').html(lo.listSelect('trait_list', [ 'traits' ], 'select', undefined, undefined ));
144 $('#trial_metadata_list').html(lo.listSelect('trial_metadata_list', ['trials'], 'select', undefined, undefined));
146 $('#metadata').click(function() {
147 var trial_list_id = $('#trial_metadata_list_list_select').val();
148 var trial_validation = 1;
149 if (trial_list_id) { trial_validation = lo.validate(trial_list_id, 'trials', true); }
151 var problem_lists = new Array();
152 if (trial_validation != 1) {
153 problem_lists.push('trials');
156 if (problem_lists.length > 0) {
157 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
161 var ladda = Ladda.create(this);
163 var token = new Date().getTime(); //use the current timestamp as the token name and value
164 manage_dl_with_cookie(token, ladda);
165 jQuery('#metadata_download_token').val(token);
166 jQuery('#download_metadata_form').submit();
170 $('#phenotype').click(function() {
172 var accession_list_id = $('#accession_list_list_select').val();
173 var trial_list_id = $('#trial_list_list_select').val();
174 var trait_list_id = $('#trait_list_list_select').val();
176 var accession_validation = 1;
177 if (accession_list_id) { accession_validation = lo.validate(accession_list_id, 'accessions', true); }
179 var trial_validation = 1;
180 if (trial_list_id) { trial_validation = lo.validate(trial_list_id, 'trials', true); }
182 var trait_validation = 1;
183 if (trait_list_id) { trait_validation = lo.validate(trait_list_id, 'traits', true); }
185 var problem_lists = new Array();
187 if (accession_validation != 1) {
188 problem_lists.push('accessions');
190 if (trial_validation != 1) {
191 problem_lists.push('trials');
193 if (trait_validation != 1) {
194 problem_lists.push('trials');
197 if (problem_lists.length > 0) {
198 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
202 var ladda = Ladda.create(this);
204 var token = new Date().getTime(); //use the current timestamp as the token name and value
205 manage_dl_with_cookie(token, ladda);
206 jQuery('#phenotype_download_token').val(token);
207 jQuery('#download_form').submit();
216 <!-- start of code for pedigree download -->
218 <div class="well well-sm">
219 <form id="download_pedigree" action="/breeders/download_pedigree_action" method="POST">
220 <table class="table" cellpadding="10">
222 <tr><td colspan="2"><h4>Download Pedigree </h4><p>Select parameter:</p></tr>
238 <div id="accession_list4">
243 <label><input type="radio" id="ped_format" name="ped_format" value="parents_only" checked>Direct parents only</label>
246 <label><input type="radio" id="ped_format" name="ped_format" value="full">Full pedigrees</label>
250 <button class="btn btn-primary" type="button" id="pedigree">Download</button>
251 <input type="hidden" id="pedigree_download_token" name="pedigree_download_token"/>
261 $(document).ready(function() {
263 var lo = new CXGN.List();
265 $('#accession_list4').html(lo.listSelect('pedigree_accession_list', [ 'accessions' ], 'select', undefined, undefined));
267 $('#pedigree').click(function() {
269 var accession_list_id = $('#pedigree_accession_list_list_select').val();
270 if (!accession_list_id) {
271 alert("You need to select an accession list!");
275 var accession_validation = 1;
276 if (accession_list_id) {
277 accession_validation = lo.validate(accession_list_id, 'accessions', true);
281 if (accession_validation != 1) {
282 alert("The accession list did not pass validation. Please correct the list and try again");
286 var ladda = Ladda.create(this);
288 var token = new Date().getTime(); //use the current timestamp as the token name and value
289 manage_dl_with_cookie(token, ladda);
290 jQuery('#pedigree_download_token').val(token);
291 jQuery('#download_pedigree').submit();
298 <!-- end of code for pedigree download -->
301 <div class="well well-sm">
302 <form id="download_gbs" action="/breeders/download_gbs_action" method="POST">
303 <table class="table" cellpadding="10">
305 <tr><td colspan="2"><h4>Download GBS Genotype </h4><p>Select parameter:</p></tr>
321 <div id="accession_list2">
325 <div id="protocol_list">
329 <button class="btn btn-primary" type="button" id="genotype">Download</button>
330 <input type="hidden" id="gbs_download_token" name="gbs_download_token"/>
339 $(document).ready(function() {
341 var lo = new CXGN.List();
343 $('#accession_list2').html(lo.listSelect('genotype_accession_list', [ 'accessions' ], 'select', undefined, undefined));
344 get_select_box("genotyping_protocol", "protocol_list");
346 $('#genotype').click(function() {
348 var accession_list_id = $('#genotype_accession_list_list_select').val();
349 var protocol_list_id = $('#protocol_list').val();
351 var accession_validation = 1;
352 if (accession_list_id) {
353 accession_validation = lo.validate(accession_list_id, 'accessions', true);
356 if (!( accession_list_id || protocol_list_id) ) {
357 alert("You need to select a list of accessions and a protocol !");
361 var problem_lists = new Array();
363 if (accession_validation != 1) {
364 problem_lists.push('accessions');
368 console.log(problem_lists);
370 if (problem_lists.length > 0) {
371 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
375 var ladda = Ladda.create(this);
377 var token = new Date().getTime(); //use the current timestamp as the token name and value
378 manage_dl_with_cookie(token, ladda);
379 jQuery('#gbs_download_token').val(token);
380 jQuery('#download_gbs').submit();
387 <div class="well well-sm">
388 <form id="gbs_qc" action="/breeders/gbs_qc_action" method="POST">
389 <table class="table" cellpadding="10">
391 <tr><td colspan="3"><h4>GBS Genotype QC</h4><p>Select parameter:</p></tr>
410 <div id="trial_list3">
414 <div id="accession_list3">
418 <div id="protocol_list2">
422 <button class="btn btn-primary" type="button" id="genotype_qc">Download</button>
423 <input type="hidden" id="qc_download_token" name="qc_download_token"/>
434 $(document).ready(function() {
436 var lo = new CXGN.List();
438 $('#accession_list3').html(lo.listSelect('genotype_qc_accession_list', [ 'accessions' ], 'select', undefined, undefined));
439 $('#trial_list3').html(lo.listSelect('genotype_trial_list', [ 'trials' ], 'select', undefined, undefined ));
440 get_select_box("genotyping_protocol", "protocol_list2", {'id':'protocol_list2_select', 'name':'protocol_list2_select'});
442 $('#genotype_qc').click(function() {
444 $('#working').dialog( {
452 open: function() { $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide(); },
453 title: 'Downloading genotype...'
456 var accession_list_id = $('#genotype_qc_accession_list_list_select').val();
457 var trial_list_id = $('#genotype_trial_list_list_select').val();
459 var accession_validation = lo.validate(accession_list_id, 'accessions', true);
460 var trial_validation = lo.validate(trial_list_id, 'trials', true);
462 if (! (accession_list_id || trial_list_id) ) {
463 alert("You need to select an accession or a trail !");
467 var problem_lists = new Array();
469 if (accession_validation != 1) {
470 problem_lists.push('accessions');
473 if (trial_validation != 1) {
474 problem_lists.push('trials');
478 //alert("problem_lists is " + problem_lists);
480 console.log(problem_lists);
482 if (problem_lists.length > 0) {
483 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
487 var ladda = Ladda.create(this);
489 var token = new Date().getTime(); //use the current timestamp as the token name and value
490 manage_dl_with_cookie(token, ladda);
491 jQuery('#qc_download_token').val(token);
492 jQuery('#gbs_qc').submit();