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' ] &>
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 &>
15 <& /breeders_toolbox/trial/trial_create_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
16 <& /breeders_toolbox/trial/trial_upload_dialogs.mas, locations => \@locations, breeding_programs => $breeding_programs &>
18 <& /breeders_toolbox/trial/download_trials_phenotypes_dialog.mas &>
20 <table class="table table-bordered">
24 <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>
31 <input type="text" class="form-control input-sm" id="trial_tree_search" placeholder="Search" />
33 <h4>Download Trial Phenotypes</h4>
34 <h5><i>Select multiple trials by holding 'Ctrl'.</i></h5>
35 <button class="btn btn-primary" id="trials_download_phenotypes_button" disabled="disabled" title="First Select Trial(s) to Download">Download Phenotypes</button>
37 <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>
38 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
41 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
42 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move trial to folder</button><br/><br/>
43 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
46 <!--<button id="delete" disabled="disabled" >Delete</button -->
50 <div id="trial_list" >[loading...]</div>
59 jQuery(document).ready(function($) {
62 url: '/ajax/breeders/get_trials_with_folders_cached',
63 success: function(response) {
64 var html = '<ul>'+response.html+'</ul>';
66 jQuery('#trial_list').html(html);
68 jQuery('#trial_list').jstree( {
69 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
70 "valid_children" : [ "folder", "trial", "breeding_program" ],
72 "breeding_program" : {
73 "icon": 'glyphicon glyphicon-briefcase text-info',
76 "icon": 'glyphicon glyphicon-folder-open text-danger',
79 "icon": 'glyphicon glyphicon-leaf text-success',
83 "case_insensitive" : true,
85 "plugins" : ["html_data","types","search"],
90 error: function(response) {
91 alert("An error occurred while loading the trial data.");
95 jQuery("#trial_tree_search").keyup(function() {
96 var v = jQuery("#trial_tree_search").val();
97 jQuery("#trial_list").jstree(true).search(v);
102 $('#trial_list').on("changed.jstree", function (e, data) {
104 if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'trial') {
105 $('#trials_download_phenotypes_button').removeAttr('disabled');
108 $('#trials_download_phenotypes_button').attr('disabled', 'disabled');
113 $("#trial_list").delegate("li", "dblclick", function(event){
114 var node = $("#trial_list").jstree("get_node", this);
116 if (node.id.substr(0,1) !== 'j') {
117 if (node.type == 'folder') {
118 window.open('/folder/'+node.id);
119 event.stopPropagation();
120 } else if (node.type == 'trial') {
121 window.open('/breeders_toolbox/trial/'+node.id);
122 event.stopPropagation();