7 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form','CXGN.BreedersToolbox.AddTrial','CXGN.BreedersToolbox.UploadTrial','CXGN.BreedersToolbox.Trial', 'jstree.dist.jstree', 'CXGN.Trial', 'CXGN.BreedersToolbox.HTMLSelect', 'CXGN.TrialTreeFolders','CXGN.BreedersToolbox.AddMultipleTrial' ] &>
9 <link rel="stylesheet" href="/static/documents/inc/jstree_theme/jstree-bstheme-min.css" />
11 <& /breeders_toolbox/folder/folder_set.mas &>
12 <& /breeders_toolbox/folder/folder_new.mas &>
13 <& /breeders_toolbox/folder/folder_move.mas &>
14 <& /breeders_toolbox/folder/folders_edit.mas, folder_tree_type => 'Trial', folder_tree_identifier => 'trial_list', folder_tree_refresh_name => 'refresh_jstree_html' &>
16 <& /breeders_toolbox/trial/trial_create_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
17 <& /breeders_toolbox/trial/trial_upload_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
18 <& /breeders_toolbox/trial/trial_create_multiloc_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
20 <& /breeders_toolbox/trial/download_trials_phenotypes_dialog.mas &>
22 <table class="table table-bordered">
26 <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>
33 <input type="text" class="form-control input-sm" id="trial_tree_search" placeholder="Search" />
35 <h4>Download Trial Phenotypes</h4>
36 <h5><i>Select multiple trials by holding 'Ctrl'.</i></h5>
37 <button class="btn btn-primary" id="trials_download_phenotypes_button" disabled="disabled" title="First Select Trial(s) to Download">Download Phenotypes</button>
39 <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>
40 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
43 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
44 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move trial to folder</button><br/><br/>
45 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
47 <div id="folder_edit_options" style="display:none">
49 <h5><i>Select multiple folders by holding 'Ctrl'.</i></h5>
50 <button class="btn btn-primary" id="edit_folders_button" title="First Select Folder(s) to Edit">Edit Folder(s)</button>
54 <!--<button id="delete" disabled="disabled" >Delete</button -->
58 <div id="trial_list" >[loading...]</div>
69 jQuery(document).ready(function($) {
72 url: '/ajax/breeders/get_trials_with_folders_cached',
73 success: function(response) {
74 var html = '<ul>'+response.html+'</ul>';
76 jQuery('#trial_list').html(html);
78 jQuery('#trial_list').jstree( {
79 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
80 "valid_children" : [ "folder", "trial", "breeding_program" ],
82 "breeding_program" : {
83 "icon": 'glyphicon glyphicon-briefcase text-info',
86 "icon": 'glyphicon glyphicon-folder-open text-danger',
89 "icon": 'glyphicon glyphicon-leaf text-success',
93 "case_insensitive" : true,
95 "plugins" : ["html_data","types","search"],
100 error: function(response) {
101 alert("An error occurred while loading the trial data.");
105 jQuery("#trial_tree_search").keyup(function() {
106 var v = jQuery("#trial_tree_search").val();
107 jQuery("#trial_list").jstree(true).search(v);
112 jQuery('#trial_list').on("changed.jstree", function (e, data) {
114 if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'trial') {
115 jQuery('#trials_download_phenotypes_button').removeAttr('disabled');
116 jQuery("#folder_edit_options").hide();
118 else if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'folder') {
119 jQuery('#trials_download_phenotypes_button').attr('disabled', 'disabled');
120 jQuery("#folder_edit_options").show();
123 jQuery('#trials_download_phenotypes_button').attr('disabled', 'disabled');
124 jQuery("#folder_edit_options").hide();
129 $("#trial_list").delegate("li", "dblclick", function(event){
130 var node = $("#trial_list").jstree("get_node", this);
132 if (node.id.substr(0,1) !== 'j') {
133 if (node.type == 'folder') {
134 window.open('/folder/'+node.id);
135 event.stopPropagation();
136 } else if (node.type == 'trial') {
137 window.open('/breeders_toolbox/trial/'+node.id);
138 event.stopPropagation();