10 <& /util/import_javascript.mas, classes => [ 'jstree.dist.jstree', 'bootstrap_min.js', 'jquery.iframe-post-form', 'CXGN.List', 'CXGN.BreedersToolbox.AddTrial','CXGN.BreedersToolbox.UploadTrial','CXGN.BreedersToolbox.Trial', 'CXGN.Trial','CXGN.BreedersToolbox.GenotypingTrial','CXGN.BreedersToolbox.Accessions', 'CXGN.BreedersToolbox.UploadPedigrees','CXGN.BreedersToolbox.Crosses','CXGN.BreedersToolbox.FieldBook','CXGN.BreedersToolbox.UploadPhenotype', 'CXGN.BreederSearch', 'CXGN.Trial','CXGN.TrialTreeFolders' ] &>
12 <& /util/import_css.mas, paths => ['/static/documents/inc/jstree_theme/jstree-bstheme-min.css'] &>
14 <& /breeders_toolbox/folder/folder_set.mas, project_type => 'Trial' &>
15 <& /breeders_toolbox/folder/folder_new.mas &>
16 <& /breeders_toolbox/folder/folder_move.mas &>
17 <& /breeders_toolbox/folder/folders_edit.mas, folder_tree_type => 'Trial', folder_tree_identifier => 'trial_list', folder_tree_refresh_name => 'refresh_jstree_html' &>
19 <& /breeders_toolbox/trial/trial_create_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
21 <& /breeders_toolbox/trial/download_trials_phenotypes_dialog.mas &>
23 <& /breeders_toolbox/trial/trial_upload_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
24 <& /breeders_toolbox/add_accessions_dialogs.mas, preferred_species=>$preferred_species, editable_stock_props=>$editable_stock_props &>
25 <& /breeders_toolbox/upload_seedlots_dialogs.mas &>
26 <& /breeders_toolbox/add_seedlot_dialogs.mas, timestamp=>$timestamp &>
28 <table class="table table-bordered">
32 <th>Breeding Programs -- Folders -- Trials <button class="btn btn-sm btn-default" id="refresh_jstree_html_trialtree_button" name="refresh_jstree_html">Refresh</button></th>
39 <input type="text" class="form-control input-sm" id="trial_tree_search" placeholder="Search" />
41 <h4>Download Trial Phenotypes</h4>
42 <h5><i>Select multiple trials by holding 'Ctrl'.</i></h5>
43 <button class="btn btn-primary" id="trials_download_phenotypes_button" disabled="disabled" title="First Select Trial(s) to Download">Download Phenotypes</button>
45 <h5><i>Double click<br />trial ( <span class="glyphicon glyphicon-leaf text-success"></span> ) or folder ( <span class="glyphicon glyphicon-folder-open text-danger"></span> )<br/>to view detail page.</i></h5>
46 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
49 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
50 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move trial(s) to folder</button><br/><br/>
51 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
53 <div id="folder_edit_options" style="display:none">
55 <h5><i>Select multiple folders by holding 'Ctrl'.</i></h5>
56 <button class="btn btn-primary" id="edit_folders_button" title="First Select Folder(s) to Edit">Edit Folder(s)</button>
60 <!--<button id="delete" disabled="disabled" >Delete</button -->
64 <div id="trial_list" >[loading...]</div>
75 jQuery(document).ready(function($) {
78 url: '/ajax/breeders/get_trials_with_folders_cached?type=trial',
79 success: function(response) {
80 var html = '<ul>'+response.html+'</ul>';
82 jQuery('#trial_list').html(html);
84 jQuery('#trial_list').jstree( {
85 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
86 "valid_children" : [ "folder", "trial", "breeding_program" ],
88 "breeding_program" : {
89 "icon": 'glyphicon glyphicon-briefcase text-info',
92 "icon": 'glyphicon glyphicon-folder-open text-danger',
95 "icon": 'glyphicon glyphicon-leaf text-success',
99 "case_insensitive" : true,
101 "plugins" : ["html_data","types","search"],
106 error: function(response) {
107 alert("An error occurred while loading the trial data.");
111 jQuery("#trial_tree_search").keyup(function() {
112 var v = jQuery("#trial_tree_search").val();
113 jQuery("#trial_list").jstree(true).search(v);
118 jQuery('#trial_list').on("changed.jstree", function (e, data) {
120 if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'trial') {
121 jQuery('#trials_download_phenotypes_button').removeAttr('disabled');
122 jQuery("#folder_edit_options").hide();
124 else if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'folder') {
125 jQuery('#trials_download_phenotypes_button').attr('disabled', 'disabled');
126 jQuery("#folder_edit_options").show();
129 jQuery('#trials_download_phenotypes_button').attr('disabled', 'disabled');
130 jQuery("#folder_edit_options").hide();
135 $("#trial_list").delegate("li", "dblclick", function(event){
136 var node = $("#trial_list").jstree("get_node", this);
138 if (node.id.substr(0,1) !== 'j') {
139 if (node.type == 'folder') {
140 window.open('/folder/'+node.id);
141 event.stopPropagation();
142 } else if (node.type == 'trial') {
143 window.open('/breeders_toolbox/trial/'+node.id);
144 event.stopPropagation();