[2] | 1 | <%def name="render_template_field( field, render_as_hidden=False )"> |
---|
| 2 | <% |
---|
| 3 | from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField |
---|
| 4 | |
---|
| 5 | widget = field[ 'widget' ] |
---|
| 6 | has_contents = False |
---|
| 7 | label = field[ 'label' ] |
---|
| 8 | value = '' |
---|
| 9 | if isinstance( widget, TextArea ) and widget.value: |
---|
| 10 | has_contents = True |
---|
| 11 | if render_as_hidden: |
---|
| 12 | value = widget.value |
---|
| 13 | else: |
---|
| 14 | value = '<pre>%s</pre>' % widget.value |
---|
| 15 | elif isinstance( widget, TextField ) and widget.value: |
---|
| 16 | has_contents = True |
---|
| 17 | value = widget.value |
---|
| 18 | elif isinstance( widget, SelectField ) and widget.options: |
---|
| 19 | for option_label, option_value, selected in widget.options: |
---|
| 20 | if selected: |
---|
| 21 | has_contents = True |
---|
| 22 | value = option_value |
---|
| 23 | elif isinstance( widget, CheckboxField ) and widget.checked: |
---|
| 24 | has_contents = True |
---|
| 25 | if render_as_hidden: |
---|
| 26 | value = 'true' |
---|
| 27 | else: |
---|
| 28 | value = 'checked' |
---|
| 29 | elif isinstance( widget, WorkflowField ) and str( widget.value ).lower() not in [ 'none' ]: |
---|
| 30 | has_contents = True |
---|
| 31 | if render_as_hidden: |
---|
| 32 | value = widget.value |
---|
| 33 | else: |
---|
| 34 | workflow_user = widget.user |
---|
| 35 | if workflow_user: |
---|
| 36 | for workflow in workflow_user.stored_workflows: |
---|
| 37 | if not workflow.deleted and str( widget.value ) == str( workflow.id ): |
---|
| 38 | value = workflow.name |
---|
| 39 | break |
---|
| 40 | else: |
---|
| 41 | # If we didn't find the selected workflow option above, we'll just print the value |
---|
| 42 | value = widget.value |
---|
| 43 | elif isinstance( widget, AddressField ) and str( widget.value ).lower() not in [ 'none' ]: |
---|
| 44 | has_contents = True |
---|
| 45 | if render_as_hidden: |
---|
| 46 | value = widget.value |
---|
| 47 | else: |
---|
| 48 | address = trans.sa_session.query( trans.model.UserAddress ).get( int( widget.value ) ) |
---|
| 49 | label = address.desc |
---|
| 50 | value = address.get_html() |
---|
| 51 | %> |
---|
| 52 | %if has_contents: |
---|
| 53 | % if render_as_hidden: |
---|
| 54 | <input type="hidden" name="${widget.name}" value="${value}"/> |
---|
| 55 | %else: |
---|
| 56 | <div class="form-row"> |
---|
| 57 | <label>${label}</label> |
---|
| 58 | ${value} |
---|
| 59 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 60 | ${field[ 'helptext' ]} |
---|
| 61 | </div> |
---|
| 62 | <div style="clear: both"></div> |
---|
| 63 | </div> |
---|
| 64 | %endif |
---|
| 65 | %endif |
---|
| 66 | </%def> |
---|
| 67 | |
---|
| 68 | <%def name="render_template_fields( cntrller, item_type, library_id, widgets, widget_fields_have_contents, info_association, inherited, folder_id=None, ldda_id=None, editable=True )"> |
---|
| 69 | <% |
---|
| 70 | if item_type == 'library': |
---|
| 71 | item = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) |
---|
| 72 | elif item_type == 'folder': |
---|
| 73 | item = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( folder_id ) ) |
---|
| 74 | elif item_type == 'ldda': |
---|
| 75 | item = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) ) |
---|
| 76 | if trans.user_is_admin() and cntrller == 'library_admin': |
---|
| 77 | can_modify = True |
---|
| 78 | elif cntrller == 'library': |
---|
| 79 | can_modify = trans.app.security_agent.can_modify_library_item( trans.get_current_user_roles(), item ) |
---|
| 80 | else: |
---|
| 81 | can_modify = False |
---|
| 82 | %> |
---|
| 83 | %if editable and can_modify: |
---|
| 84 | <p/> |
---|
| 85 | <div class="toolForm"> |
---|
| 86 | <div class="toolFormTitle">Other information |
---|
| 87 | <a id="item-${item.id}-popup" class="popup-arrow" style="display: none;">▼</a> |
---|
| 88 | <div popupmenu="item-${item.id}-popup"> |
---|
| 89 | %if info_association and inherited and can_modify: |
---|
| 90 | ## "inherited" will be true only if the info_association is not associated with the current item, |
---|
| 91 | ## which means that the currently display template has not yet been saved for the current item. |
---|
| 92 | <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Select a different template</a> |
---|
| 93 | %elif info_association and not inherited and can_modify: |
---|
| 94 | <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Edit template</a> |
---|
| 95 | <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Delete template</a> |
---|
| 96 | %if item_type not in [ 'ldda', 'library_dataset' ]: |
---|
| 97 | %if info_association.inheritable: |
---|
| 98 | <a class="action-button" href="${h.url_for( controller='library_common', action='manage_template_inheritance', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Dis-inherit template</a> |
---|
| 99 | %else: |
---|
| 100 | <a class="action-button" href="${h.url_for( controller='library_common', action='manage_template_inheritance', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}">Inherit template</a> |
---|
| 101 | %endif |
---|
| 102 | %endif |
---|
| 103 | %endif |
---|
| 104 | </div> |
---|
| 105 | </div> |
---|
| 106 | <div class="toolFormBody"> |
---|
| 107 | %if inherited: |
---|
| 108 | <div class="form-row"> |
---|
| 109 | <font color="red"> |
---|
| 110 | <b> |
---|
| 111 | This is an inherited template and is not required to be used with this ${item_type}. You can |
---|
| 112 | <a href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}"><font color="red">select a different template</font></a> |
---|
| 113 | or fill in the desired fields and save this one. This template will not be assocaiated with this ${item_type} until you click the Save button. |
---|
| 114 | </b> |
---|
| 115 | </font> |
---|
| 116 | </div> |
---|
| 117 | %endif |
---|
| 118 | <form name="edit_info" id="edit_info" action="${h.url_for( controller='library_common', action='edit_template_info', cntrller=cntrller, item_type=item_type, library_id=library_id, folder_id=folder_id, ldda_id=ldda_id, show_deleted=show_deleted )}" method="post"> |
---|
| 119 | %for i, field in enumerate( widgets ): |
---|
| 120 | <div class="form-row"> |
---|
| 121 | <label>${field[ 'label' ]}</label> |
---|
| 122 | ${field[ 'widget' ].get_html()} |
---|
| 123 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 124 | ${field[ 'helptext' ]} |
---|
| 125 | </div> |
---|
| 126 | <div style="clear: both"></div> |
---|
| 127 | </div> |
---|
| 128 | %endfor |
---|
| 129 | <div class="form-row"> |
---|
| 130 | <input type="submit" name="edit_info_button" value="Save"/> |
---|
| 131 | </div> |
---|
| 132 | </form> |
---|
| 133 | </div> |
---|
| 134 | </div> |
---|
| 135 | <p/> |
---|
| 136 | %elif widget_fields_have_contents: |
---|
| 137 | <p/> |
---|
| 138 | <div class="toolForm"> |
---|
| 139 | <div class="toolFormTitle">Other information about ${item.name}</div> |
---|
| 140 | <div class="toolFormBody"> |
---|
| 141 | %for i, field in enumerate( widgets ): |
---|
| 142 | ${render_template_field( field )} |
---|
| 143 | %endfor |
---|
| 144 | </div> |
---|
| 145 | </div> |
---|
| 146 | <p/> |
---|
| 147 | %endif |
---|
| 148 | </%def> |
---|
| 149 | |
---|
| 150 | <%def name="render_upload_form( cntrller, upload_option, action, library_id, folder_id, replace_dataset, file_formats, dbkeys, space_to_tab, link_data_only, widgets, roles_select_list, history, show_deleted )"> |
---|
| 151 | <% |
---|
| 152 | import os, os.path |
---|
| 153 | from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField |
---|
| 154 | %> |
---|
| 155 | %if upload_option in [ 'upload_file', 'upload_directory', 'upload_paths' ]: |
---|
| 156 | <div class="toolForm" id="upload_library_dataset_tool_form"> |
---|
| 157 | <% |
---|
| 158 | if upload_option == 'upload_directory': |
---|
| 159 | tool_form_title = 'Upload a directory of files' |
---|
| 160 | elif upload_option == 'upload_paths': |
---|
| 161 | tool_form_title = 'Upload files from filesystem paths' |
---|
| 162 | else: |
---|
| 163 | tool_form_title = 'Upload files' |
---|
| 164 | %> |
---|
| 165 | <div class="toolFormTitle">${tool_form_title}</div> |
---|
| 166 | <div class="toolFormBody"> |
---|
| 167 | <form name="upload_library_dataset" id="upload_library_dataset" action="${action}" enctype="multipart/form-data" method="post"> |
---|
| 168 | <input type="hidden" name="tool_id" value="upload1"/> |
---|
| 169 | <input type="hidden" name="tool_state" value="None"/> |
---|
| 170 | <input type="hidden" name="cntrller" value="${cntrller}"/> |
---|
| 171 | <input type="hidden" name="library_id" value="${library_id}"/> |
---|
| 172 | <input type="hidden" name="folder_id" value="${folder_id}"/> |
---|
| 173 | <input type="hidden" name="show_deleted" value="${show_deleted}"/> |
---|
| 174 | %if replace_dataset not in [ None, 'None' ]: |
---|
| 175 | <input type="hidden" name="replace_id" value="${trans.security.encode_id( replace_dataset.id )}"/> |
---|
| 176 | <div class="form-row"> |
---|
| 177 | You are currently selecting a new file to replace '<a href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=library_id, folder_id=folder_id, id=trans.security.encode_id( replace_dataset.library_dataset_dataset_association.id ) )}">${replace_dataset.name}</a>'. |
---|
| 178 | <div style="clear: both"></div> |
---|
| 179 | </div> |
---|
| 180 | %endif |
---|
| 181 | %if replace_dataset in [ None, 'None' ]: |
---|
| 182 | ## Don't allow multiple datasets to be uploaded when replacing a dataset with a new version |
---|
| 183 | <div class="form-row"> |
---|
| 184 | <label>Upload option:</label> |
---|
| 185 | <div class="form-row-input"> |
---|
| 186 | ${upload_option_select_list.get_html()} |
---|
| 187 | </div> |
---|
| 188 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 189 | Choose upload option (file, directory, filesystem paths, current history). |
---|
| 190 | </div> |
---|
| 191 | <div style="clear: both"></div> |
---|
| 192 | </div> |
---|
| 193 | %else: |
---|
| 194 | <input type="hidden" name="upload_option" value="upload_file"/> |
---|
| 195 | %endif |
---|
| 196 | <div class="form-row"> |
---|
| 197 | <label>File Format:</label> |
---|
| 198 | <div class="form-row-input"> |
---|
| 199 | <select name="file_type"> |
---|
| 200 | <option value="auto" selected>Auto-detect</option> |
---|
| 201 | %for file_format in file_formats: |
---|
| 202 | <option value="${file_format}">${file_format}</option> |
---|
| 203 | %endfor |
---|
| 204 | </select> |
---|
| 205 | </div> |
---|
| 206 | <div style="clear: both"></div> |
---|
| 207 | </div> |
---|
| 208 | %if upload_option == 'upload_file': |
---|
| 209 | <div class="form-row"> |
---|
| 210 | <input type="hidden" name="async_datasets" value="None"/> |
---|
| 211 | <div style="clear: both"></div> |
---|
| 212 | </div> |
---|
| 213 | <div class="form-row"> |
---|
| 214 | <label>File:</label> |
---|
| 215 | <div class="form-row-input"> |
---|
| 216 | <input type="file" name="files_0|file_data" galaxy-ajax-upload="true"/> |
---|
| 217 | </div> |
---|
| 218 | <div style="clear: both"></div> |
---|
| 219 | </div> |
---|
| 220 | <div class="form-row"> |
---|
| 221 | <label>URL/Text:</label> |
---|
| 222 | <div class="form-row-input"> |
---|
| 223 | <textarea name="files_0|url_paste" rows="5" cols="35"></textarea> |
---|
| 224 | </div> |
---|
| 225 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 226 | Specify a list of URLs (one per line) or paste the contents of a file. |
---|
| 227 | </div> |
---|
| 228 | <div style="clear: both"></div> |
---|
| 229 | </div> |
---|
| 230 | %elif upload_option == 'upload_directory': |
---|
| 231 | <% |
---|
| 232 | if ( trans.user_is_admin() and cntrller == 'library_admin' ): |
---|
| 233 | import_dir = trans.app.config.library_import_dir |
---|
| 234 | else: |
---|
| 235 | # Directories of files from the Data Libraries view are restricted to a |
---|
| 236 | # sub-directory named the same as the current user's email address |
---|
| 237 | # contained within the configured setting for user_library_import_dir |
---|
| 238 | import_dir = os.path.join( trans.app.config.user_library_import_dir, trans.user.email ) |
---|
| 239 | %> |
---|
| 240 | <div class="form-row"> |
---|
| 241 | <% |
---|
| 242 | # See if we have any contained sub-directories, if not the only option |
---|
| 243 | # in the server_dir select list will be library_import_dir |
---|
| 244 | contains_directories = False |
---|
| 245 | for entry in os.listdir( import_dir ): |
---|
| 246 | if os.path.isdir( os.path.join( import_dir, entry ) ): |
---|
| 247 | contains_directories = True |
---|
| 248 | break |
---|
| 249 | %> |
---|
| 250 | <label>Server Directory</label> |
---|
| 251 | <div class="form-row-input"> |
---|
| 252 | <select name="server_dir"> |
---|
| 253 | %if contains_directories: |
---|
| 254 | <option>None</option> |
---|
| 255 | %for entry in os.listdir( import_dir ): |
---|
| 256 | ## Do not include entries that are not directories |
---|
| 257 | %if os.path.isdir( os.path.join( import_dir, entry ) ): |
---|
| 258 | <option>${entry}</option> |
---|
| 259 | %endif |
---|
| 260 | %endfor |
---|
| 261 | %else: |
---|
| 262 | %if ( trans.user_is_admin() and cntrller == 'library_admin' ): |
---|
| 263 | <option>${import_dir}</option> |
---|
| 264 | %else: |
---|
| 265 | <option>${trans.user.email}</option> |
---|
| 266 | %endif |
---|
| 267 | %endif |
---|
| 268 | </select> |
---|
| 269 | </div> |
---|
| 270 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 271 | %if contains_directories: |
---|
| 272 | Upload all files in a sub-directory of <strong>${import_dir}</strong> on the Galaxy server. |
---|
| 273 | %else: |
---|
| 274 | Upload all files in <strong>${import_dir}</strong> on the Galaxy server. |
---|
| 275 | %endif |
---|
| 276 | </div> |
---|
| 277 | <div style="clear: both"></div> |
---|
| 278 | </div> |
---|
| 279 | %elif upload_option == 'upload_paths': |
---|
| 280 | <div class="form-row"> |
---|
| 281 | <label>Paths to upload</label> |
---|
| 282 | <div class="form-row-input"> |
---|
| 283 | <textarea name="filesystem_paths" rows="10" cols="35"></textarea> |
---|
| 284 | </div> |
---|
| 285 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 286 | Upload all files pasted in the box. The (recursive) contents of any pasted directories will be added as well. |
---|
| 287 | </div> |
---|
| 288 | </div> |
---|
| 289 | <div class="form-row"> |
---|
| 290 | <label>Preserve directory structure?</label> |
---|
| 291 | <div class="form-row-input"> |
---|
| 292 | <input type="checkbox" name="dont_preserve_dirs" value="No"/>No |
---|
| 293 | </div> |
---|
| 294 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 295 | If checked, all files in subdirectories on the filesystem will be placed at the top level of the folder, instead of into subfolders. |
---|
| 296 | </div> |
---|
| 297 | </div> |
---|
| 298 | %endif |
---|
| 299 | %if upload_option in ( 'upload_directory', 'upload_paths' ): |
---|
| 300 | <div class="form-row"> |
---|
| 301 | <% |
---|
| 302 | if link_data_only == 'No': |
---|
| 303 | checked = ' checked' |
---|
| 304 | else: |
---|
| 305 | checked = '' |
---|
| 306 | link_data_only_field = '<input type="checkbox" name="link_data_only" value="No"%s/>No' % checked |
---|
| 307 | %> |
---|
| 308 | <label>Copy data into Galaxy?</label> |
---|
| 309 | <div class="form-row-input"> |
---|
| 310 | ${link_data_only_field} |
---|
| 311 | </div> |
---|
| 312 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 313 | Normally data uploaded with this tool is copied into Galaxy's "files" directory |
---|
| 314 | so any later changes to the data will not affect Galaxy. However, this may not |
---|
| 315 | be desired (especially for large NGS datasets), so use of this option will |
---|
| 316 | force Galaxy to always read the data from its original path. |
---|
| 317 | %if upload_option == 'upload_directory': |
---|
| 318 | Any symlinks encountered in the upload directory will be dereferenced once - |
---|
| 319 | that is, Galaxy will point directly to the file that is linked, but no other |
---|
| 320 | symlinks further down the line will be dereferenced. |
---|
| 321 | %endif |
---|
| 322 | </div> |
---|
| 323 | </div> |
---|
| 324 | %endif |
---|
| 325 | <div class="form-row"> |
---|
| 326 | <label> |
---|
| 327 | Convert spaces to tabs: |
---|
| 328 | </label> |
---|
| 329 | <div class="form-row-input"> |
---|
| 330 | <% |
---|
| 331 | if space_to_tab == 'true': |
---|
| 332 | checked = ' checked' |
---|
| 333 | else: |
---|
| 334 | checked = '' |
---|
| 335 | if upload_option == 'upload_file': |
---|
| 336 | name = 'files_0|space_to_tab' |
---|
| 337 | else: |
---|
| 338 | name = 'space_to_tab' |
---|
| 339 | space2tab = '<input type="checkbox" name="%s" value="true"%s/>Yes' % ( name, checked ) |
---|
| 340 | %> |
---|
| 341 | ${space2tab} |
---|
| 342 | </div> |
---|
| 343 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 344 | Use this option if you are entering intervals by hand. |
---|
| 345 | </div> |
---|
| 346 | </div> |
---|
| 347 | <div style="clear: both"></div> |
---|
| 348 | <div class="form-row"> |
---|
| 349 | <label>Genome:</label> |
---|
| 350 | <div class="form-row-input"> |
---|
| 351 | <select name="dbkey" last_selected_value="?"> |
---|
| 352 | %for dbkey in dbkeys: |
---|
| 353 | %if dbkey[1] == last_used_build: |
---|
| 354 | <option value="${dbkey[1]}" selected>${dbkey[0]}</option> |
---|
| 355 | %else: |
---|
| 356 | <option value="${dbkey[1]}">${dbkey[0]}</option> |
---|
| 357 | %endif |
---|
| 358 | %endfor |
---|
| 359 | </select> |
---|
| 360 | </div> |
---|
| 361 | <div style="clear: both"></div> |
---|
| 362 | </div> |
---|
| 363 | <div class="form-row"> |
---|
| 364 | <label>Message:</label> |
---|
| 365 | <div class="form-row-input"> |
---|
| 366 | %if ldda_message: |
---|
| 367 | <textarea name="ldda_message" rows="3" cols="35">${ldda_message}</textarea> |
---|
| 368 | %else: |
---|
| 369 | <textarea name="ldda_message" rows="3" cols="35"></textarea> |
---|
| 370 | %endif |
---|
| 371 | </div> |
---|
| 372 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 373 | This information will be displayed in the "Information" column for this dataset in the data library browser |
---|
| 374 | </div> |
---|
| 375 | <div style="clear: both"></div> |
---|
| 376 | </div> |
---|
| 377 | %if roles_select_list: |
---|
| 378 | <div class="form-row"> |
---|
| 379 | <label>Restrict dataset access to specific roles:</label> |
---|
| 380 | <div class="form-row-input"> |
---|
| 381 | ${roles_select_list.get_html()} |
---|
| 382 | </div> |
---|
| 383 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 384 | Multi-select list - hold the appropriate key while clicking to select multiple roles. More restrictions can be applied after the upload is complete. Selecting no roles makes a dataset public. |
---|
| 385 | </div> |
---|
| 386 | </div> |
---|
| 387 | <div style="clear: both"></div> |
---|
| 388 | %endif |
---|
| 389 | %if widgets: |
---|
| 390 | %for i, field in enumerate( widgets ): |
---|
| 391 | <div class="form-row"> |
---|
| 392 | <label>${field[ 'label' ]}</label> |
---|
| 393 | <div class="form-row-input"> |
---|
| 394 | ${field[ 'widget' ].get_html()} |
---|
| 395 | </div> |
---|
| 396 | <div class="toolParamHelp" style="clear: both;"> |
---|
| 397 | %if field[ 'helptext' ]: |
---|
| 398 | ${field[ 'helptext' ]}<br/> |
---|
| 399 | %endif |
---|
| 400 | *Inherited template field |
---|
| 401 | </div> |
---|
| 402 | <div style="clear: both"></div> |
---|
| 403 | </div> |
---|
| 404 | %endfor |
---|
| 405 | %endif |
---|
| 406 | <div class="form-row"> |
---|
| 407 | <input type="submit" class="primary-button" name="runtool_btn" value="Upload to library"/> |
---|
| 408 | </div> |
---|
| 409 | </form> |
---|
| 410 | </div> |
---|
| 411 | </div> |
---|
| 412 | ## Script to replace dbkey select with select+search. |
---|
| 413 | <script type="text/javascript"> |
---|
| 414 | // Replace dbkey select with search+select. |
---|
| 415 | jQuery(document).ready( function() { |
---|
| 416 | replace_big_select_inputs(); |
---|
| 417 | }); |
---|
| 418 | </script> |
---|
| 419 | %elif upload_option == 'import_from_history': |
---|
| 420 | <div class="toolForm"> |
---|
| 421 | <div class="toolFormTitle">Active datasets in your current history (${history.name})</div> |
---|
| 422 | <div class="toolFormBody"> |
---|
| 423 | %if history and history.active_datasets: |
---|
| 424 | <form name="add_history_datasets_to_library" action="${h.url_for( controller='library_common', action='add_history_datasets_to_library', cntrller=cntrller, library_id=library_id )}" enctype="multipart/form-data" method="post"> |
---|
| 425 | <input type="hidden" name="folder_id" value="${folder_id}"/> |
---|
| 426 | <input type="hidden" name="show_deleted" value="${show_deleted}"/> |
---|
| 427 | <input type="hidden" name="upload_option" value="import_from_history"/> |
---|
| 428 | <input type="hidden" name="ldda_message" value="${ldda_message}"/> |
---|
| 429 | <% |
---|
| 430 | if roles_select_list: |
---|
| 431 | role_ids_selected = roles_select_list.get_selected( return_value=True, multi=True ) |
---|
| 432 | if role_ids_selected: |
---|
| 433 | role_ids_selected = ','.join( role_ids_selected ) |
---|
| 434 | else: |
---|
| 435 | role_ids_selected = '' |
---|
| 436 | else: |
---|
| 437 | role_ids_selected = '' |
---|
| 438 | %> |
---|
| 439 | <input type="hidden" name="roles" value="${role_ids_selected}"/> |
---|
| 440 | %if replace_dataset not in [ None, 'None' ]: |
---|
| 441 | <input type="hidden" name="replace_id" value="${trans.security.encode_id( replace_dataset.id )}"/> |
---|
| 442 | <div class="form-row"> |
---|
| 443 | You are currently selecting a new file to replace '<a href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=library_id, folder_id=folder_id, id=trans.security.encode_id( replace_dataset.library_dataset_dataset_association.id ) )}">${replace_dataset.name}</a>'. |
---|
| 444 | <div style="clear: both"></div> |
---|
| 445 | </div> |
---|
| 446 | %endif |
---|
| 447 | ## Render hidden template fields so the contents will be associated with the dataset |
---|
| 448 | %if widgets: |
---|
| 449 | %for i, field in enumerate( widgets ): |
---|
| 450 | ${render_template_field( field, render_as_hidden=True )} |
---|
| 451 | %endfor |
---|
| 452 | %endif |
---|
| 453 | %for hda in history.active_datasets: |
---|
| 454 | <div class="form-row"> |
---|
| 455 | <input name="hda_ids" value="${trans.security.encode_id( hda.id )}" type="checkbox"/>${hda.hid}: ${hda.name} |
---|
| 456 | </div> |
---|
| 457 | %endfor |
---|
| 458 | <div class="form-row"> |
---|
| 459 | <input type="submit" name="add_history_datasets_to_library_button" value="Import to library"/> |
---|
| 460 | </div> |
---|
| 461 | </form> |
---|
| 462 | %else: |
---|
| 463 | <p/> |
---|
| 464 | Your current history is empty |
---|
| 465 | <p/> |
---|
| 466 | %endif |
---|
| 467 | </div> |
---|
| 468 | </div> |
---|
| 469 | %endif |
---|
| 470 | </%def> |
---|
| 471 | |
---|
| 472 | <%def name="render_actions_on_multiple_items()"> |
---|
| 473 | <tfoot> |
---|
| 474 | <tr> |
---|
| 475 | <td colspan="5" style="padding-left: 42px;"> |
---|
| 476 | For selected items: |
---|
| 477 | <select name="do_action" id="action_on_selected_items"> |
---|
| 478 | %if ( trans.user_is_admin() and cntrller=='library_admin' ): |
---|
| 479 | <option value="manage_permissions">Edit permissions</option> |
---|
| 480 | <option value="delete">Delete</option> |
---|
| 481 | %elif cntrller=='library': |
---|
| 482 | %if default_action == 'add': |
---|
| 483 | <option value="add" selected>Import into your current history</option> |
---|
| 484 | %else: |
---|
| 485 | <option value="add">Import into your current history</option> |
---|
| 486 | %endif |
---|
| 487 | %if default_action == 'manage_permissions': |
---|
| 488 | <option value="manage_permissions" selected>Edit permissions</option> |
---|
| 489 | # This condition should not contain an else clause because the user is not authorized |
---|
| 490 | # to manage dataset permissions unless the default action is 'manage_permissions' |
---|
| 491 | %endif |
---|
| 492 | %if 'gz' in comptypes: |
---|
| 493 | <option value="tgz" |
---|
| 494 | %if default_action == 'download': |
---|
| 495 | selected |
---|
| 496 | %endif> |
---|
| 497 | >Download as a .tar.gz file</option> |
---|
| 498 | %endif |
---|
| 499 | %if 'bz2' in comptypes: |
---|
| 500 | <option value="tbz">Download as a .tar.bz2 file</option> |
---|
| 501 | %endif |
---|
| 502 | %if 'zip' in comptypes: |
---|
| 503 | <option value="zip">Download as a .zip file</option> |
---|
| 504 | %endif |
---|
| 505 | %if 'ngxzip' in comptypes: |
---|
| 506 | ## We can safely have two default selected items since ngxzip, if present, will always be the only available type. |
---|
| 507 | <option value="ngxzip" |
---|
| 508 | %if default_action == 'download': |
---|
| 509 | selected |
---|
| 510 | %endif> |
---|
| 511 | >Download as a .zip file</option> |
---|
| 512 | %endif |
---|
| 513 | %endif |
---|
| 514 | </select> |
---|
| 515 | <input type="submit" class="primary-button" name="action_on_datasets_button" id="action_on_datasets_button" value="Go"/> |
---|
| 516 | </td> |
---|
| 517 | </tr> |
---|
| 518 | </tfoot> |
---|
| 519 | </%def> |
---|