<%def name="render_template_field( field, render_as_hidden=False )"> <% from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField widget = field[ 'widget' ] has_contents = False label = field[ 'label' ] value = '' if isinstance( widget, TextArea ) and widget.value: has_contents = True if render_as_hidden: value = widget.value else: value = '
%s
' % widget.value elif isinstance( widget, TextField ) and widget.value: has_contents = True value = widget.value elif isinstance( widget, SelectField ) and widget.options: for option_label, option_value, selected in widget.options: if selected: has_contents = True value = option_value elif isinstance( widget, CheckboxField ) and widget.checked: has_contents = True if render_as_hidden: value = 'true' else: value = 'checked' elif isinstance( widget, WorkflowField ) and str( widget.value ).lower() not in [ 'none' ]: has_contents = True if render_as_hidden: value = widget.value else: workflow_user = widget.user if workflow_user: for workflow in workflow_user.stored_workflows: if not workflow.deleted and str( widget.value ) == str( workflow.id ): value = workflow.name break else: # If we didn't find the selected workflow option above, we'll just print the value value = widget.value elif isinstance( widget, AddressField ) and str( widget.value ).lower() not in [ 'none' ]: has_contents = True if render_as_hidden: value = widget.value else: address = trans.sa_session.query( trans.model.UserAddress ).get( int( widget.value ) ) label = address.desc value = address.get_html() %> %if has_contents: % if render_as_hidden: %else:
${value}
${field[ 'helptext' ]}
%endif %endif <%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 )"> <% if item_type == 'library': item = trans.sa_session.query( trans.app.model.Library ).get( trans.security.decode_id( library_id ) ) elif item_type == 'folder': item = trans.sa_session.query( trans.app.model.LibraryFolder ).get( trans.security.decode_id( folder_id ) ) elif item_type == 'ldda': item = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) ) if trans.user_is_admin() and cntrller == 'library_admin': can_modify = True elif cntrller == 'library': can_modify = trans.app.security_agent.can_modify_library_item( trans.get_current_user_roles(), item ) else: can_modify = False %> %if editable and can_modify:

Other information
%if info_association and inherited and can_modify: ## "inherited" will be true only if the info_association is not associated with the current item, ## which means that the currently display template has not yet been saved for the current item. Select a different template %elif info_association and not inherited and can_modify: Edit template Delete template %if item_type not in [ 'ldda', 'library_dataset' ]: %if info_association.inheritable: Dis-inherit template %else: Inherit template %endif %endif %endif
%if inherited:
This is an inherited template and is not required to be used with this ${item_type}. You can select a different template 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.
%endif
%for i, field in enumerate( widgets ):
${field[ 'widget' ].get_html()}
${field[ 'helptext' ]}
%endfor

%elif widget_fields_have_contents:

Other information about ${item.name}
%for i, field in enumerate( widgets ): ${render_template_field( field )} %endfor

%endif <%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 )"> <% import os, os.path from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField %> %if upload_option in [ 'upload_file', 'upload_directory', 'upload_paths' ]:

<% if upload_option == 'upload_directory': tool_form_title = 'Upload a directory of files' elif upload_option == 'upload_paths': tool_form_title = 'Upload files from filesystem paths' else: tool_form_title = 'Upload files' %>
${tool_form_title}
%if replace_dataset not in [ None, 'None' ]:
You are currently selecting a new file to replace '${replace_dataset.name}'.
%endif %if replace_dataset in [ None, 'None' ]: ## Don't allow multiple datasets to be uploaded when replacing a dataset with a new version
${upload_option_select_list.get_html()}
Choose upload option (file, directory, filesystem paths, current history).
%else: %endif
%if upload_option == 'upload_file':
Specify a list of URLs (one per line) or paste the contents of a file.
%elif upload_option == 'upload_directory': <% if ( trans.user_is_admin() and cntrller == 'library_admin' ): import_dir = trans.app.config.library_import_dir else: # Directories of files from the Data Libraries view are restricted to a # sub-directory named the same as the current user's email address # contained within the configured setting for user_library_import_dir import_dir = os.path.join( trans.app.config.user_library_import_dir, trans.user.email ) %>
<% # See if we have any contained sub-directories, if not the only option # in the server_dir select list will be library_import_dir contains_directories = False for entry in os.listdir( import_dir ): if os.path.isdir( os.path.join( import_dir, entry ) ): contains_directories = True break %>
%if contains_directories: Upload all files in a sub-directory of ${import_dir} on the Galaxy server. %else: Upload all files in ${import_dir} on the Galaxy server. %endif
%elif upload_option == 'upload_paths':
Upload all files pasted in the box. The (recursive) contents of any pasted directories will be added as well.
No
If checked, all files in subdirectories on the filesystem will be placed at the top level of the folder, instead of into subfolders.
%endif %if upload_option in ( 'upload_directory', 'upload_paths' ):
<% if link_data_only == 'No': checked = ' checked' else: checked = '' link_data_only_field = 'No' % checked %>
${link_data_only_field}
Normally data uploaded with this tool is copied into Galaxy's "files" directory so any later changes to the data will not affect Galaxy. However, this may not be desired (especially for large NGS datasets), so use of this option will force Galaxy to always read the data from its original path. %if upload_option == 'upload_directory': Any symlinks encountered in the upload directory will be dereferenced once - that is, Galaxy will point directly to the file that is linked, but no other symlinks further down the line will be dereferenced. %endif
%endif
<% if space_to_tab == 'true': checked = ' checked' else: checked = '' if upload_option == 'upload_file': name = 'files_0|space_to_tab' else: name = 'space_to_tab' space2tab = 'Yes' % ( name, checked ) %> ${space2tab}
Use this option if you are entering intervals by hand.
%if ldda_message: %else: %endif
This information will be displayed in the "Information" column for this dataset in the data library browser
%if roles_select_list:
${roles_select_list.get_html()}
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.
%endif %if widgets: %for i, field in enumerate( widgets ):
${field[ 'widget' ].get_html()}
%if field[ 'helptext' ]: ${field[ 'helptext' ]}
%endif *Inherited template field
%endfor %endif
## Script to replace dbkey select with select+search. %elif upload_option == 'import_from_history':
Active datasets in your current history (${history.name})
%if history and history.active_datasets:
<% if roles_select_list: role_ids_selected = roles_select_list.get_selected( return_value=True, multi=True ) if role_ids_selected: role_ids_selected = ','.join( role_ids_selected ) else: role_ids_selected = '' else: role_ids_selected = '' %> %if replace_dataset not in [ None, 'None' ]:
You are currently selecting a new file to replace '${replace_dataset.name}'.
%endif ## Render hidden template fields so the contents will be associated with the dataset %if widgets: %for i, field in enumerate( widgets ): ${render_template_field( field, render_as_hidden=True )} %endfor %endif %for hda in history.active_datasets:
${hda.hid}: ${hda.name}
%endfor
%else:

Your current history is empty

%endif

%endif <%def name="render_actions_on_multiple_items()"> For selected items: