1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/66e4224cfb5e/ Changeset: 66e4224cfb5e User: greg Date: 2013-06-17 21:29:20 Summary: Fixes for rendering Repository Actions menus when browsing the tool shed from Galaxy, and fixes for rendering workflow images for exported workflows contained in tool shed repositories. Affected #: 10 files diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -1049,6 +1049,7 @@ def display_tool( self, trans, repository_id, tool_config, changeset_revision, **kwd ): message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) + render_repository_actions_for = kwd.get( 'render_repository_actions_for', 'tool_shed' ) repository, tool, message = tool_util.load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) if message: status = 'error' @@ -1057,6 +1058,7 @@ try: return trans.fill_template( "/webapps/tool_shed/repository/tool_form.mako", repository=repository, + render_repository_actions_for=render_repository_actions_for, metadata=metadata, changeset_revision=changeset_revision, tool=tool, @@ -1065,7 +1067,7 @@ status=status ) except Exception, e: message = "Error displaying tool, probably due to a problem in the tool config. The exception is: %s." % str( e ) - if trans.webapp.name == 'galaxy': + if trans.webapp.name == 'galaxy' or render_repository_actions_for == 'galaxy': return trans.response.send_redirect( web.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=repository_id, @@ -1896,6 +1898,7 @@ def load_invalid_tool( self, trans, repository_id, tool_config, changeset_revision, **kwd ): message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'error' ) + render_repository_actions_for = kwd.get( 'render_repository_actions_for', 'tool_shed' ) repository, tool, error_message = tool_util.load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) tool_state = self.__new_state( trans ) invalid_file_tups = [] @@ -1912,6 +1915,7 @@ try: return trans.fill_template( "/webapps/tool_shed/repository/tool_form.mako", repository=repository, + render_repository_actions_for=render_repository_actions_for, changeset_revision=changeset_revision, tool=tool, tool_state=tool_state, @@ -2990,6 +2994,7 @@ def view_tool_metadata( self, trans, repository_id, changeset_revision, tool_id, **kwd ): message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) + render_repository_actions_for = kwd.get( 'render_repository_actions_for', 'tool_shed' ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) repo_files_dir = repository.repo_path( trans.app ) repo = hg.repository( suc.get_configured_ui(), repo_files_dir ) @@ -3044,6 +3049,7 @@ downloadable=False ) trans.app.config.tool_data_path = original_tool_data_path return trans.fill_template( "/webapps/tool_shed/repository/view_tool_metadata.mako", + render_repository_actions_for=render_repository_actions_for, repository=repository, repository_metadata_id=repository_metadata_id, metadata=metadata, @@ -3061,6 +3067,7 @@ """Retrieve necessary information about a workflow from the database so that it can be displayed in an svg image.""" message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) + render_repository_actions_for = kwd.get( 'render_repository_actions_for', 'tool_shed' ) if workflow_name: workflow_name = encoding_util.tool_shed_decode( workflow_name ) repository_metadata = metadata_util.get_repository_metadata_by_id( trans, repository_metadata_id ) @@ -3069,6 +3076,7 @@ metadata = repository_metadata.metadata return trans.fill_template( "/webapps/tool_shed/repository/view_workflow.mako", repository=repository, + render_repository_actions_for=render_repository_actions_for, changeset_revision=changeset_revision, repository_metadata_id=repository_metadata_id, workflow_name=workflow_name, diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/admin/tool_shed_repository/manage_repository.mako --- a/templates/admin/tool_shed_repository/manage_repository.mako +++ b/templates/admin/tool_shed_repository/manage_repository.mako @@ -107,5 +107,5 @@ </div><p/> %if not in_error_state: - ${render_repository_items( repository.metadata, containers_dict, can_set_metadata=False )} + ${render_repository_items( repository.metadata, containers_dict, can_set_metadata=False, render_repository_actions_for='galaxy' )} %endif diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/admin/tool_shed_repository/view_workflow.mako --- a/templates/admin/tool_shed_repository/view_workflow.mako +++ b/templates/admin/tool_shed_repository/view_workflow.mako @@ -19,25 +19,25 @@ <%def name="render_workflow( workflow_name, repository_id )"><% center_url = h.url_for( controller='admin_toolshed', action='generate_workflow_image', workflow_name=tool_shed_encode( workflow_name ), repository_id=repository_id ) %> - <iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe> + <iframe name="workflow_image" id="workflow_image" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def><br/><br/><ul class="manage-table-actions"><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> - <li><a class="action-button" href="${h.url_for( controller='admin_toolshed', action='import_workflow', workflow_name=tool_shed_encode( workflow_name ), repository_id=repository_id )}">Import workflow to Galaxy</a></li> - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">Browse repository files</a> - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a> - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get repository updates</a> + <li><a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='import_workflow', workflow_name=tool_shed_encode( workflow_name ), repository_id=repository_id )}">Import workflow to Galaxy</a></li> + <a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">Browse repository files</a> + <a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=trans.security.encode_id( repository.id ) )}">Manage repository</a> + <a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='check_for_updates', id=trans.security.encode_id( repository.id ) )}">Get repository updates</a> %if repository.can_reset_metadata: - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='reset_repository_metadata', id=trans.security.encode_id( repository.id ) )}">Reset repository metadata</a> + <a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='reset_repository_metadata', id=trans.security.encode_id( repository.id ) )}">Reset repository metadata</a> %endif %if repository.tool_dependencies: <% tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in repository.tool_dependencies ] %> - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', tool_dependency_ids=tool_dependency_ids )}">Manage tool dependencies</a> + <a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', tool_dependency_ids=tool_dependency_ids )}">Manage tool dependencies</a> %endif - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a> + <a class="action-button" target='galaxy_main' href="${h.url_for( controller='admin_toolshed', action='deactivate_or_uninstall_repository', id=trans.security.encode_id( repository.id ) )}">Deactivate or uninstall repository</a></div></ul> diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/common.mako --- a/templates/webapps/tool_shed/repository/common.mako +++ b/templates/webapps/tool_shed/repository/common.mako @@ -179,7 +179,7 @@ hg clone <a href="${clone_str}">${clone_str}</a></%def> -<%def name="render_folder( folder, folder_pad, parent=None, row_counter=None, is_root_folder=False )"> +<%def name="render_folder( folder, folder_pad, parent=None, row_counter=None, is_root_folder=False, render_repository_actions_for='tool_shed' )"><% encoded_id = trans.security.encode_id( folder.id ) @@ -275,7 +275,7 @@ %> %endif %for sub_folder in folder.folders: - ${render_folder( sub_folder, pad, parent=my_row, row_counter=row_counter, is_root_folder=False )} + ${render_folder( sub_folder, pad, parent=my_row, row_counter=row_counter, is_root_folder=False, render_repository_actions_for=render_repository_actions_for )} %endfor %for readme in folder.readme_files: ${render_readme( readme, pad, my_row, row_counter )} @@ -297,16 +297,16 @@ %if folder.valid_tools: %for index, tool in enumerate( folder.valid_tools ): <% row_is_header = index == 0 %> - ${render_tool( tool, pad, my_row, row_counter, row_is_header )} + ${render_tool( tool, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )} %endfor %endif %for invalid_tool in folder.invalid_tools: - ${render_invalid_tool( invalid_tool, pad, my_row, row_counter )} + ${render_invalid_tool( invalid_tool, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )} %endfor %if folder.workflows: %for index, workflow in enumerate( folder.workflows ): <% row_is_header = index == 0 %> - ${render_workflow( workflow, pad, my_row, row_counter, row_is_header )} + ${render_workflow( workflow, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )} %endfor %endif %if folder.datatypes: @@ -472,7 +472,7 @@ %></%def> -<%def name="render_invalid_tool( invalid_tool, pad, parent, row_counter, valid=True )"> +<%def name="render_invalid_tool( invalid_tool, pad, parent, row_counter, valid=True, render_repository_actions_for='tool_shed' )"><% encoded_id = trans.security.encode_id( invalid_tool.id ) %><tr class="datasetRow" %if parent is not None: @@ -481,7 +481,7 @@ id="libraryItem-${encoded_id}"><td style="padding-left: ${pad+20}px;"> %if trans.webapp.name == 'tool_shed' and invalid_tool.repository_id and invalid_tool.tool_config and invalid_tool.changeset_revision: - <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( invalid_tool.repository_id ), tool_config=invalid_tool.tool_config, changeset_revision=invalid_tool.changeset_revision )}"> + <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( invalid_tool.repository_id ), tool_config=invalid_tool.tool_config, changeset_revision=invalid_tool.changeset_revision, render_repository_actions_for=render_repository_actions_for )}"> ${invalid_tool.tool_config | h} </a> %else: @@ -796,7 +796,7 @@ %></%def> -<%def name="render_tool( tool, pad, parent, row_counter, row_is_header )"> +<%def name="render_tool( tool, pad, parent, row_counter, row_is_header, render_repository_actions_for='tool_shed' )"><% encoded_id = trans.security.encode_id( tool.id ) if row_is_header: @@ -816,10 +816,10 @@ %if tool.repository_id: %if trans.webapp.name == 'tool_shed': <div style="float:left;" class="menubutton split popup" id="tool-${encoded_id}-popup"> - <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( tool.repository_id ), tool_config=tool.tool_config, changeset_revision=tool.changeset_revision )}">${tool.name | h}</a> + <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( tool.repository_id ), tool_config=tool.tool_config, changeset_revision=tool.changeset_revision, render_repository_actions_for=render_repository_actions_for )}">${tool.name | h}</a></div><div popupmenu="tool-${encoded_id}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id )}">View tool metadata</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id, render_repository_actions_for=render_repository_actions_for )}">View tool metadata</a></div> %else: %if tool.repository_installation_status == trans.model.ToolShedRepository.installation_status.INSTALLED: @@ -965,7 +965,7 @@ %></%def> -<%def name="render_workflow( workflow, pad, parent, row_counter, row_is_header=False )"> +<%def name="render_workflow( workflow, pad, parent, row_counter, row_is_header=False, render_repository_actions_for='tool_shed' )"><% from tool_shed.util.encoding_util import tool_shed_encode encoded_id = trans.security.encode_id( workflow.id ) @@ -990,7 +990,7 @@ %if row_is_header: ${workflow.workflow_name | h} %elif trans.webapp.name == 'tool_shed' and encoded_repository_metadata_id: - <a href="${h.url_for( controller='repository', action='view_workflow', workflow_name=encoded_workflow_name, repository_metadata_id=encoded_repository_metadata_id )}">${workflow.workflow_name | h}</a> + <a href="${h.url_for( controller='repository', action='view_workflow', workflow_name=encoded_workflow_name, repository_metadata_id=encoded_repository_metadata_id, render_repository_actions_for=render_repository_actions_for )}">${workflow.workflow_name | h}</a> %elif trans.webapp.name == 'galaxy' and encoded_repository_id: <a href="${h.url_for( controller='admin_toolshed', action='view_workflow', workflow_name=encoded_workflow_name, repository_id=encoded_repository_id )}">${workflow.workflow_name | h}</a> %else: @@ -1007,7 +1007,7 @@ %></%def> -<%def name="render_repository_items( metadata, containers_dict, can_set_metadata=False )"> +<%def name="render_repository_items( metadata, containers_dict, can_set_metadata=False, render_repository_actions_for='tool_shed' )"><% from tool_shed.util.encoding_util import tool_shed_encode @@ -1118,14 +1118,14 @@ <p/><% row_counter = RowCounter() %><table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="valid_tools"> - ${render_folder( valid_tools_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True )} + ${render_folder( valid_tools_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )} </table> %endif %if invalid_tools_root_folder: <p/><% row_counter = RowCounter() %><table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="invalid_tools"> - ${render_folder( invalid_tools_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True )} + ${render_folder( invalid_tools_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )} </table> %endif %if valid_data_managers_root_folder: @@ -1146,7 +1146,7 @@ <p/><% row_counter = RowCounter() %><table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="workflows"> - ${render_folder( workflows_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True )} + ${render_folder( workflows_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )} </table> %endif %if datatypes_root_folder: diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/manage_repository.mako --- a/templates/webapps/tool_shed/repository/manage_repository.mako +++ b/templates/webapps/tool_shed/repository/manage_repository.mako @@ -197,7 +197,7 @@ </form></div></div> -${render_repository_items( metadata, containers_dict, can_set_metadata=True )} +${render_repository_items( metadata, containers_dict, can_set_metadata=True, render_repository_actions_for='tool_shed' )} %if includes_tools: <p/><div class="toolForm"> diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/preview_tools_in_changeset.mako --- a/templates/webapps/tool_shed/repository/preview_tools_in_changeset.mako +++ b/templates/webapps/tool_shed/repository/preview_tools_in_changeset.mako @@ -44,7 +44,7 @@ %> ${changeset_revision_select_field.get_html()} <i>${tip_str | h}</i><div class="toolParamHelp" style="clear: both;"> - Select a revision to inspect and download versions of tools from this repository. + Select a revision to inspect and download versions of Galaxy utilities from this repository. </div></div></form> @@ -57,4 +57,4 @@ </div></div><p/> -${render_repository_items( metadata, containers_dict, can_set_metadata=False )} +${render_repository_items( metadata, containers_dict, can_set_metadata=False, render_repository_actions_for='galaxy' )} diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/tool_form.mako --- a/templates/webapps/tool_shed/repository/tool_form.mako +++ b/templates/webapps/tool_shed/repository/tool_form.mako @@ -104,7 +104,7 @@ </div></%def> - %if trans.webapp.name == 'galaxy': + %if render_repository_actions_for == 'galaxy': ${render_galaxy_repository_actions( repository=repository )} %else: ${render_tool_shed_repository_actions( repository, metadata=None, changeset_revision=None )} diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/view_repository.mako --- a/templates/webapps/tool_shed/repository/view_repository.mako +++ b/templates/webapps/tool_shed/repository/view_repository.mako @@ -71,7 +71,7 @@ <div class="form-row"> ${changeset_revision_select_field.get_html()} <i>${tip_str}</i><div class="toolParamHelp" style="clear: both;"> - Select a revision to inspect and download versions of tools from this repository. + Select a revision to inspect and download versions of Galaxy utilities from this repository. </div></div></form> @@ -135,7 +135,7 @@ %endif </div></div> -${render_repository_items( metadata, containers_dict, can_set_metadata=False )} +${render_repository_items( metadata, containers_dict, can_set_metadata=False, render_repository_actions_for='tool_shed' )} %if repository.categories: <p/><div class="toolForm"> diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/view_tool_metadata.mako --- a/templates/webapps/tool_shed/repository/view_tool_metadata.mako +++ b/templates/webapps/tool_shed/repository/view_tool_metadata.mako @@ -21,7 +21,7 @@ %><%inherit file="${inherit(context)}"/> -%if trans.webapp.name == 'tool_shed': +%if render_repository_actions_for == 'tool_shed': ${render_tool_shed_repository_actions( repository=repository, changeset_revision=changeset_revision )} %else: ${render_galaxy_repository_actions( repository=repository )} diff -r 179ed7d7e31576e141f9329facc7c37abe222147 -r 66e4224cfb5ecd128092c1fe383540ad8ef7e3ee templates/webapps/tool_shed/repository/view_workflow.mako --- a/templates/webapps/tool_shed/repository/view_workflow.mako +++ b/templates/webapps/tool_shed/repository/view_workflow.mako @@ -2,11 +2,7 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> -<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /> - -<% - from tool_shed.util.encoding_util import tool_shed_encode -%> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="*" /><%! def inherit(context): @@ -18,12 +14,18 @@ <%inherit file="${inherit(context)}"/> +<% from tool_shed.util.encoding_util import tool_shed_encode %> + <%def name="render_workflow( workflow_name, repository_metadata_id )"><% center_url = h.url_for( controller='repository', action='generate_workflow_image', workflow_name=tool_shed_encode( workflow_name ), repository_metadata_id=repository_metadata_id ) %> - <iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe> + <iframe name="workflow_image" id="workflow_image" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def> -${render_tool_shed_repository_actions( repository=repository )} +%if render_repository_actions_for == 'tool_shed': + ${render_tool_shed_repository_actions( repository=repository )} +%else: + ${render_galaxy_repository_actions( repository=repository )} +%endif %if message: ${render_msg( message, status )} Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.