6 $parent_folder_id => undef
7 $parent_folder_name => undef
8 $breeding_program_id => undef
9 $breeding_program_name => undef
12 <& /util/import_javascript.mas, classes => [ 'CXGN.TrialTreeFolders' ] &>
14 % my $folder_for_trials;
15 % my $folder_for_crosses;
16 % my $folder_for_genotyping_trials;
17 % my $folder_for_genotyping_projects;
18 % my $folder_for_tracking_activities;
19 % if ($project_type eq 'field_trial') { $folder_for_trials = 1; $dialog_type = 'trial'}
20 % if ($project_type eq 'genotyping_plate') { $folder_for_genotyping_trials = 1; $dialog_type = 'genotyping plate' }
21 % if ($project_type eq 'crossing_experiment') { $folder_for_crosses = 1; $dialog_type = 'crossing experiment' }
22 % if ($project_type eq 'genotyping_project') { $folder_for_genotyping_projects = 1; $dialog_type = 'genotyping project' }
23 % if ($project_type eq 'activity_record') { $folder_for_tracking_activities = 1; $dialog_type = 'tracking activities' }
25 <div class="modal fade" id="move_folder_dialog" name="move_folder_dialog" tabindex="-1" role="dialog" aria-labelledby="moveFolderDialog">
26 <div class="modal-dialog" role="document">
27 <div class="modal-content">
28 <div class="modal-header">
29 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
30 <h4 class="modal-title" id="moveFolderDialog">Move a <% $dialog_type %> folder</h4>
32 <div class="modal-body">
33 <div class="container-fluid">
35 <form class="form-horizontal" role="form" method="post" id="move_folder_dialog_form" name="move_folder_dialog_form">
36 <div class="form-group">
37 <label class="col-sm-3 control-label">Breeding Program: </label>
38 <div class="col-sm-9" >
39 <div id="move_folder_breeding_program_select_div">
40 % if ($breeding_program_id) {
41 <input type="text" class="form-control" value="<% $breeding_program_name %>" disabled/>
42 <input type="hidden" id="move_folder_breeding_program_id" name="move_folder_breeding_program_id" value="<% $breeding_program_id %>" />
49 <div class="form-group">
50 <label class="col-sm-3 control-label">Parent Folder: </label>
51 <div class="col-sm-9" >
52 <div id="move_folder_parent_folder_select_div">
53 % if ($parent_folder_id) {
54 <input type="text" class="form-control" value="<% $parent_folder_name %>" disabled/>
55 <input type="hidden" id="move_folder_parent_folder_id" name="move_folder_parent_folder_id" value="<% $parent_folder_id %>" />
62 <div class="form-group">
63 <label class="col-sm-3 control-label">Folder Name: </label>
64 <div class="col-sm-9" >
65 <div id="move_folder_select_div">
67 <input type="text" class="form-control" value="<% $folder_name %>" disabled/>
68 <input type="hidden" id="move_folder_id" name="move_folder_id" value="<% $folder_id %>" />
78 <div class="modal-footer">
79 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
80 <button type="button" class="btn btn-primary" name="move_folder_submit" id="move_folder_submit" title="Move folder">Save</button>
86 <div class="modal fade" id="folder_move_success_dialog_message" name="folder_move_success_dialog_message" tabindex="-1" role="dialog" aria-labelledby="moveFolderSuccessDialog">
87 <div class="modal-dialog" role="document">
88 <div class="modal-content">
89 <div class="modal-header" style="text-align: center">
90 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
91 <h4 class="modal-title" id="moveFolderSuccessDialog">Folder Move Successful</h4>
93 <div class="modal-body">
94 <div class="container-fluid">
96 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
97 The folder was moved successfully
101 <div class="modal-footer">
102 <button id="close_move_folder_success_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
108 <script defer="defer">
109 jQuery(document).ready(function() {
111 if(jQuery("#move_folder_breeding_program_id").length == 0) {
112 get_select_box('breeding_programs', 'move_folder_breeding_program_select_div', { 'name' : 'move_folder_breeding_program_id', 'id' : 'move_folder_breeding_program_id' });
115 jQuery('#move_folder_dialog_link').click( function() {
116 jQuery('#move_folder_dialog').modal("show");
117 if(jQuery("#move_folder_parent_folder_id").length == 0) {
118 breeding_program_change_move_parent_folders();
120 if(jQuery("#move_folder_id").length == 0) {
121 breeding_program_change_move_folders();
125 jQuery("#move_folder_breeding_program_select_div").on('change', "#move_folder_breeding_program_id", function() {
126 breeding_program_change_move_parent_folders();
127 breeding_program_change_move_folders();
130 jQuery('#move_folder_submit').click( function() {
134 jQuery('#folder_move_success_dialog_message').on('hidden.bs.modal', function () {
140 function breeding_program_change_move_parent_folders() {
141 var breeding_program_id = jQuery("#move_folder_breeding_program_id").val();
142 var folder_for_trials;
143 var folder_for_crosses;
144 var folder_for_genotyping_trials;
145 var folder_for_genotyping_projects;
146 var folder_for_tracking_activities;
148 % if ($folder_for_trials){
149 folder_for_trials = true;
151 % if ($folder_for_crosses){
152 folder_for_crosses = true;
154 % if ($folder_for_genotyping_trials){
155 folder_for_genotyping_trials = true;
157 % if ($folder_for_genotyping_projects){
158 folder_for_genotyping_projects = true;
160 % if ($folder_for_tracking_activities){
161 folder_for_tracking_activities = true;
164 get_select_box('folders', 'move_folder_parent_folder_select_div', { 'name' : 'move_folder_parent_folder_id', 'id' : 'move_folder_parent_folder_id', 'breeding_program_id' : breeding_program_id, 'empty' : 1, 'folder_for_trials' : folder_for_trials, 'folder_for_crosses' : folder_for_crosses, 'folder_for_genotyping_trials': folder_for_genotyping_trials, 'folder_for_genotyping_projects': folder_for_genotyping_projects , 'folder_for_tracking_activities': folder_for_tracking_activities});
167 function breeding_program_change_move_folders() {
168 var breeding_program_id = jQuery("#move_folder_breeding_program_id").val();
169 var folder_for_trials;
170 var folder_for_crosses;
171 var folder_for_genotyping_trials;
172 var folder_for_genotyping_projects;
173 var folder_for_tracking_activities;
175 % if ($folder_for_trials){
176 folder_for_trials = true;
178 % if ($folder_for_crosses){
179 folder_for_crosses = true;
181 % if ($folder_for_genotyping_trials){
182 folder_for_genotyping_trials = true;
184 % if ($folder_for_genotyping_projects){
185 folder_for_genotyping_projects = true;
187 % if ($folder_for_tracking_activities){
188 folder_for_tracking_activities = true;
191 get_select_box('folders', 'move_folder_select_div', { 'name' : 'move_folder_id', 'id' : 'move_folder_id', 'breeding_program_id' : breeding_program_id, 'folder_for_trials' : folder_for_trials, 'folder_for_crosses' : folder_for_crosses, 'folder_for_genotyping_trials': folder_for_genotyping_trials, 'folder_for_genotyping_projects': folder_for_genotyping_projects , 'folder_for_tracking_activities': folder_for_tracking_activities});
194 function move_folder() {
195 var parent_folder_id = jQuery('#move_folder_parent_folder_id').val();
196 var folder_id = jQuery('#move_folder_id').val();
197 //console.log(parent_folder_id);
198 //console.log(folder_id);
199 if (parent_folder_id == folder_id) {
200 alert("Cannot make a folder its own parent.");
204 url: '/ajax/folder/'+folder_id+'/associate/parent/'+parent_folder_id,
205 success: function(response) {
206 if (response.error) {
207 alert(response.error);
208 jQuery('#move_folder_dialog').modal("hide");
211 refreshTrailJsTree(0);
212 jQuery('#folder_move_success_dialog_message').modal("show");
213 jQuery('#move_folder_dialog').modal("hide");
216 error: function(response) {
217 alert('An error occurred trying to move folder.');
218 jQuery('#move_folder_dialog').modal("hide");