9 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'jstree.dist.jstree', 'CXGN.TrialTreeFolders'] &>
11 <& /util/import_css.mas, paths => ['/static/documents/inc/jstree_theme/jstree-bstheme-min.css'] &>
13 <& /tracking_activities/add_new_activity_project.mas, user_id=>$user_id, locations=>$locations, programs=>$programs, roles=>$roles &>
14 <& /breeders_toolbox/folder/folder_set.mas, project_type=>'activity_record' &>
15 <& /breeders_toolbox/folder/folder_new.mas, project_type=>'activity_record' &>
16 <& /breeders_toolbox/folder/folder_move.mas, project_type=>'activity_record' &>
17 <& /breeders_toolbox/folder/folders_edit.mas, folder_tree_type => 'Tracking Activities', folder_tree_identifier => 'activities_list', folder_tree_refresh_name => 'refresh_activity_jstree_html' &>
19 <table class="table table-bordered">
23 <th>Breeding Programs -- Folders -- Tracking Activities <button class="btn btn-sm btn-default" id="refresh_activity_jstree_html_trialtree_button" name="refresh_activity_jstree_html">Refresh</button></th>
30 <input type="text" class="form-control input-sm" id="activity_tree_search" placeholder="Search" />
33 <h5><i>Double click<br />project ( <span class="glyphicon glyphicon-list-alt text-success"></span> ) or folder ( <span class="glyphicon glyphicon-folder-open text-danger"></span> )<br/>to view detail page.</i></h5>
34 <h5><i>Breeding programs ( <span class="glyphicon glyphicon-briefcase text-info"></span> )</i></h5>
38 <button class="btn btn-sm btn-default" id="new_folder_dialog_link">Create new folder</button><br/><br/>
39 <button class="btn btn-sm btn-default" id="open_folder_dialog_link">Move tracking project(s) to folder</button><br/><br/>
40 <button class="btn btn-sm btn-default" id="move_folder_dialog_link">Move folder</button>
42 <div id="folder_edit_options" style="display:none">
44 <h5><i>Select multiple folders by holding 'Ctrl'.</i></h5>
45 <button class="btn btn-primary" id="edit_folders_button" title="First Select Folder(s) to Edit">Edit Folder(s)</button>
49 <!--<button id="delete" disabled="disabled" >Delete</button -->
53 <div id="activities_list" >[loading...]</div>
64 jQuery(document).ready(function($) {
66 jQuery('#create_activity_project_link').click(function() {
67 var lo = new CXGN.List();
68 get_select_box('years', 'activity_project_year', {'id':'activity_project_year_select', 'name':'activity_project_year_select', 'auto_generate':1});
69 jQuery("#create_activity_project_dialog").modal("show");
74 url: '/ajax/breeders/get_trials_with_folders_cached?type=activity',
75 success: function(response) {
76 var html = '<ul>'+response.html+'</ul>';
78 jQuery('#activities_list').html(html);
80 jQuery('#activities_list').jstree( {
81 "core": { 'themes': { 'name': 'proton', 'responsive': true}},
82 "valid_children" : [ "folder", "trial", "breeding_program" ],
84 "breeding_program" : {
85 "icon": 'glyphicon glyphicon-briefcase text-info',
88 "icon": 'glyphicon glyphicon-folder-open text-danger',
91 "icon": 'glyphicon glyphicon-list-alt text-success',
95 "case_insensitive" : true,
97 "plugins" : ["html_data","types","search"],
102 error: function(response) {
103 alert("An error occurred while loading the trial data.");
107 jQuery("#activity_tree_search").keyup(function() {
108 var v = jQuery("#activity_tree_search").val();
109 jQuery("#activities_list").jstree(true).search(v);
112 jQuery('#activities_list').on("changed.jstree", function (e, data) {
114 if ($('#trial_list').jstree('is_leaf', data.node) && data.node.data.jstree.type == 'folder') {
115 jQuery("#folder_edit_options").show();
118 jQuery("#folder_edit_options").hide();
122 jQuery("#activities_list").delegate("li", "dblclick", function(event){
123 var node = $("#activities_list").jstree("get_node", this);
125 if (node.id.substr(0,1) !== 'j') {
126 if (node.type == 'folder') {
127 window.open('/folder/'+node.id);
128 event.stopPropagation();
129 } else if (node.type == 'activity') {
130 window.open('/breeders_toolbox/trial/'+node.id);
131 event.stopPropagation();