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 Using Lists</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>Inspect Datasets</h4>
91 <table class="table table-bordered" >
102 <div id="phenotype_download_dataset_list">
110 <div class="well well-sm">
111 <h4>Download Metadata</h4><p>Select Parameters:</p>
112 <form id="download_metadata_form" action="/breeders/download_action" method="POST" >
113 <table class="table table-bordered" >
130 <div id="trial_metadata_list">
135 <select class="form-control" id="metadata_format" name="metadata_format">
136 <option value=".xls">XLS</option>
137 <option value=".csv">CSV</option>
138 <option value="html">HTML</option>
141 <div id="datalevel" style="display:none">
142 <select class="form-control" id="metadata_datalevel" name="metadata_datalevel">
143 <option value="metadata">Metadata</option>
148 <button class="btn btn-primary" type="button" id="metadata">Download</button>
149 <input type="hidden" id="metadata_download_token" name="metadata_download_token"/>
158 $(document).ready(function() {
160 var lo = new CXGN.List();
162 $('#accession_list').html(lo.listSelect('accession_list', [ 'accessions' ], 'select', undefined, undefined));
163 $('#trial_list').html(lo.listSelect('trial_list', [ 'trials' ], 'select', undefined, undefined ));
164 $('#trait_list').html(lo.listSelect('trait_list', [ 'traits' ], 'select', undefined, undefined ));
165 $('#trial_metadata_list').html(lo.listSelect('trial_metadata_list', ['trials'], 'select', undefined, undefined));
167 get_select_box('datasets', 'phenotype_download_dataset_list');
169 $('#metadata').click(function() {
170 var trial_list_id = $('#trial_metadata_list_list_select').val();
171 var trial_validation = 1;
172 if (trial_list_id) { trial_validation = lo.validate(trial_list_id, 'trials', true); }
174 var problem_lists = new Array();
175 if (trial_validation != 1) {
176 problem_lists.push('trials');
179 if (problem_lists.length > 0) {
180 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
184 var ladda = Ladda.create(this);
186 var token = new Date().getTime(); //use the current timestamp as the token name and value
187 manage_dl_with_cookie(token, ladda);
188 jQuery('#metadata_download_token').val(token);
189 jQuery('#download_metadata_form').submit();
193 $('#phenotype').click(function() {
195 var accession_list_id = $('#accession_list_list_select').val();
196 var trial_list_id = $('#trial_list_list_select').val();
197 var trait_list_id = $('#trait_list_list_select').val();
199 var accession_validation = 1;
200 if (accession_list_id) { accession_validation = lo.validate(accession_list_id, 'accessions', true); }
202 var trial_validation = 1;
203 if (trial_list_id) { trial_validation = lo.validate(trial_list_id, 'trials', true); }
205 var trait_validation = 1;
206 if (trait_list_id) { trait_validation = lo.validate(trait_list_id, 'traits', true); }
208 var problem_lists = new Array();
210 if (accession_validation != 1) {
211 problem_lists.push('accessions');
213 if (trial_validation != 1) {
214 problem_lists.push('trials');
216 if (trait_validation != 1) {
217 problem_lists.push('trials');
220 if (problem_lists.length > 0) {
221 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
225 var ladda = Ladda.create(this);
227 var token = new Date().getTime(); //use the current timestamp as the token name and value
228 manage_dl_with_cookie(token, ladda);
229 jQuery('#phenotype_download_token').val(token);
230 jQuery('#download_form').submit();
239 <!-- start of code for pedigree download -->
241 <div class="well well-sm">
242 <form id="download_pedigree" action="/breeders/download_pedigree_action" method="POST">
243 <table class="table" cellpadding="10">
245 <tr><td colspan="2"><h4>Download Pedigree </h4><p>Select parameter:</p></tr>
261 <div id="accession_list4">
266 <label><input type="radio" id="ped_format" name="ped_format" value="parents_only" checked>Direct parents only</label>
269 <label><input type="radio" id="ped_format" name="ped_format" value="full">Full pedigrees</label>
273 <button class="btn btn-primary" type="button" id="pedigree">Download</button>
274 <input type="hidden" id="pedigree_download_token" name="pedigree_download_token"/>
284 $(document).ready(function() {
286 var lo = new CXGN.List();
288 $('#accession_list4').html(lo.listSelect('pedigree_accession_list', [ 'accessions' ], 'select', undefined, undefined));
290 $('#pedigree').click(function() {
292 var accession_list_id = $('#pedigree_accession_list_list_select').val();
293 if (!accession_list_id) {
294 alert("You need to select an accession list!");
298 var accession_validation = 1;
299 if (accession_list_id) {
300 accession_validation = lo.validate(accession_list_id, 'accessions', true);
304 if (accession_validation != 1) {
305 alert("The accession list did not pass validation. Please correct the list and try again");
309 var ladda = Ladda.create(this);
311 var token = new Date().getTime(); //use the current timestamp as the token name and value
312 manage_dl_with_cookie(token, ladda);
313 jQuery('#pedigree_download_token').val(token);
314 jQuery('#download_pedigree').submit();
321 <!-- end of code for pedigree download -->
324 <div class="well well-sm">
325 <form id="download_gbs" action="/breeders/download_gbs_action" method="POST">
326 <table class="table" cellpadding="10">
328 <tr><td colspan="2"><h4>Download GBS Genotype </h4><p>Select parameter:</p></tr>
344 <div id="accession_list2">
348 <div id="protocol_list">
352 <button class="btn btn-primary" type="button" id="genotype">Download</button>
353 <input type="hidden" id="gbs_download_token" name="gbs_download_token"/>
362 $(document).ready(function() {
364 var lo = new CXGN.List();
366 $('#accession_list2').html(lo.listSelect('genotype_accession_list', [ 'accessions' ], 'select', undefined, undefined));
367 get_select_box("genotyping_protocol", "protocol_list");
369 $('#genotype').click(function() {
371 var accession_list_id = $('#genotype_accession_list_list_select').val();
372 var protocol_list_id = $('#protocol_list').val();
374 var accession_validation = 1;
375 if (accession_list_id) {
376 accession_validation = lo.validate(accession_list_id, 'accessions', true);
379 if (!( accession_list_id || protocol_list_id) ) {
380 alert("You need to select a list of accessions and a protocol !");
384 var problem_lists = new Array();
386 if (accession_validation != 1) {
387 problem_lists.push('accessions');
391 console.log(problem_lists);
393 if (problem_lists.length > 0) {
394 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
398 var ladda = Ladda.create(this);
400 var token = new Date().getTime(); //use the current timestamp as the token name and value
401 manage_dl_with_cookie(token, ladda);
402 jQuery('#gbs_download_token').val(token);
403 jQuery('#download_gbs').submit();
410 <div class="well well-sm">
411 <form id="gbs_qc" action="/breeders/gbs_qc_action" method="POST">
412 <table class="table" cellpadding="10">
414 <tr><td colspan="3"><h4>GBS Genotype QC</h4><p>Select parameter:</p></tr>
433 <div id="trial_list3">
437 <div id="accession_list3">
441 <div id="protocol_list2">
445 <button class="btn btn-primary" type="button" id="genotype_qc">Download</button>
446 <input type="hidden" id="qc_download_token" name="qc_download_token"/>
457 $(document).ready(function() {
459 var lo = new CXGN.List();
461 $('#accession_list3').html(lo.listSelect('genotype_qc_accession_list', [ 'accessions' ], 'select', undefined, undefined));
462 $('#trial_list3').html(lo.listSelect('genotype_trial_list', [ 'trials' ], 'select', undefined, undefined ));
463 get_select_box("genotyping_protocol", "protocol_list2", {'id':'protocol_list2_select', 'name':'protocol_list2_select'});
465 $('#genotype_qc').click(function() {
467 $('#working').dialog( {
475 open: function() { $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide(); },
476 title: 'Downloading genotype...'
479 var accession_list_id = $('#genotype_qc_accession_list_list_select').val();
480 var trial_list_id = $('#genotype_trial_list_list_select').val();
482 var accession_validation = lo.validate(accession_list_id, 'accessions', true);
483 var trial_validation = lo.validate(trial_list_id, 'trials', true);
485 if (! (accession_list_id || trial_list_id) ) {
486 alert("You need to select an accession or a trail !");
490 var problem_lists = new Array();
492 if (accession_validation != 1) {
493 problem_lists.push('accessions');
496 if (trial_validation != 1) {
497 problem_lists.push('trials');
501 //alert("problem_lists is " + problem_lists);
503 console.log(problem_lists);
505 if (problem_lists.length > 0) {
506 alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
510 var ladda = Ladda.create(this);
512 var token = new Date().getTime(); //use the current timestamp as the token name and value
513 manage_dl_with_cookie(token, ladda);
514 jQuery('#qc_download_token').val(token);
515 jQuery('#gbs_qc').submit();