diff --git a/lib/galaxy/web/controllers/history.py b/lib/galaxy/web/controllers/history.py index a74907f9efe..504f887528d 100644 --- a/lib/galaxy/web/controllers/history.py +++ b/lib/galaxy/web/controllers/history.py @@ -1114,16 +1114,18 @@ class HistoryController( BaseController, Sharable, UsesAnnotations, UsesItemRati history.importable = history.published = False elif 'unshare_user' in kwargs: user = trans.sa_session.query( trans.app.model.User ).get( trans.security.decode_id( kwargs[ 'unshare_user' ] ) ) - if not user: - message = 'History (%s) does not seem to be shared with user (%s)' % ( history.name, user.email ) - return trans.fill_template( 'history/sharing.mako', - histories=histories, - message=message, - status='error' ) + # Look for and delete sharing relation for history-user. + deleted_sharing_relation = False husas = trans.sa_session.query( trans.app.model.HistoryUserShareAssociation ).filter_by( user=user, history=history ).all() if husas: + deleted_sharing_relation = True for husa in husas: - trans.sa_session.delete( husa ) + trans.sa_session.delete( husa ) + if not deleted_sharing_relation: + message = "History '%s' does not seem to be shared with user '%s'" % ( history.name, user.email ) + return trans.fill_template( '/sharing_base.mako', item=history, + message=message, status='error' ) + # Legacy issue: histories made accessible before recent updates may not have a slug. Create slug for any histories that need them. for history in histories: @@ -1188,7 +1190,7 @@ class HistoryController( BaseController, Sharable, UsesAnnotations, UsesItemRati elif not send_to_err: # User seems to be sharing an empty history send_to_err = "You cannot share an empty history. " - return trans.fill_template( "/history/share.mako", histories=histories, email=email, send_to_err=send_to_err ) + return trans.fill_template( "/ind_sharing_base.mako", histories=histories, email=email, send_to_err=send_to_err ) @web.expose @web.require_login( "share restricted histories with other users" ) diff --git a/lib/galaxy/web/controllers/page.py b/lib/galaxy/web/controllers/page.py index a80e0c42502..410c6833071 100644 --- a/lib/galaxy/web/controllers/page.py +++ b/lib/galaxy/web/controllers/page.py @@ -470,11 +470,11 @@ class PageController( BaseController, Sharable, UsesAnnotations, UsesHistory, session.flush() return trans.fill_template( "/sharing_base.mako", - item=page ) + item=page, use_panels=True ) @web.expose @web.require_login( "use Galaxy pages" ) - def share( self, trans, id, email="" ): + def share( self, trans, id, email="", use_panels=False ): """ Handle sharing with an individual user. """ msg = mtype = None page = trans.sa_session.query( model.Page ).get( trans.security.decode_id( id ) ) @@ -503,11 +503,12 @@ class PageController( BaseController, Sharable, UsesAnnotations, UsesHistory, session.flush() trans.set_message( "Page '%s' shared with user '%s'" % ( page.title, other.email ) ) return trans.response.send_redirect( url_for( controller='page', action='sharing', id=id ) ) - return trans.fill_template( "/share_base.mako", + return trans.fill_template( "/ind_share_base.mako", message = msg, messagetype = mtype, item=page, - email=email ) + email=email, + use_panels=use_panels ) @web.expose @web.require_login() diff --git a/lib/galaxy/web/controllers/visualization.py b/lib/galaxy/web/controllers/visualization.py index d0721076aa9..04728980267 100644 --- a/lib/galaxy/web/controllers/visualization.py +++ b/lib/galaxy/web/controllers/visualization.py @@ -225,11 +225,11 @@ class VisualizationController( BaseController, Sharable, UsesAnnotations, UsesVi session.flush() - return trans.fill_template( "/sharing_base.mako", item=visualization ) + return trans.fill_template( "/sharing_base.mako", item=visualization, use_panels=True ) @web.expose @web.require_login( "share Galaxy visualizations" ) - def share( self, trans, id=None, email="", **kwd ): + def share( self, trans, id=None, email="", use_panels=False ): """ Handle sharing a visualization with a particular user. """ msg = mtype = None visualization = trans.sa_session.query( model.Visualization ).get( trans.security.decode_id( id ) ) @@ -258,11 +258,12 @@ class VisualizationController( BaseController, Sharable, UsesAnnotations, UsesVi session.flush() trans.set_message( "Visualization '%s' shared with user '%s'" % ( visualization.title, other.email ) ) return trans.response.send_redirect( url_for( action='sharing', id=id ) ) - return trans.fill_template( "/share_base.mako", + return trans.fill_template( "/ind_share_base.mako", message = msg, messagetype = mtype, item=visualization, - email=email ) + email=email, + use_panels=use_panels ) @web.expose diff --git a/lib/galaxy/web/controllers/workflow.py b/lib/galaxy/web/controllers/workflow.py index 8c286e427f7..c0f82ffb8be 100644 --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -239,7 +239,7 @@ class WorkflowController( BaseController, Sharable, UsesStoredWorkflow, UsesAnno @web.expose @web.require_login( "use Galaxy workflows" ) - def share( self, trans, id, email="" ): + def share( self, trans, id, email="", use_panels=False ): msg = mtype = None # Load workflow from database stored = self.get_stored_workflow( trans, id ) @@ -268,11 +268,12 @@ class WorkflowController( BaseController, Sharable, UsesStoredWorkflow, UsesAnno session.flush() trans.set_message( "Workflow '%s' shared with user '%s'" % ( stored.name, other.email ) ) return trans.response.send_redirect( url_for( controller='workflow', action='sharing', id=id ) ) - return trans.fill_template( "workflow/share.mako", + return trans.fill_template( "/ind_share_base.mako", message = msg, messagetype = mtype, - stored=stored, - email=email ) + item=stored, + email=email, + use_panels=use_panels ) @web.expose @web.require_login( "use Galaxy workflows" ) @@ -312,8 +313,7 @@ class WorkflowController( BaseController, Sharable, UsesStoredWorkflow, UsesAnno session.flush() - return trans.fill_template( "/sharing_base.mako", - item=stored ) + return trans.fill_template( "/workflow/sharing.mako", use_panels=True, item=stored ) @web.expose @web.require_login( "to import a workflow", use_panels=True ) diff --git a/templates/history/sharing.mako b/templates/history/sharing.mako deleted file mode 100644 index 5a4f573708c..00000000000 --- a/templates/history/sharing.mako +++ /dev/null @@ -1,71 +0,0 @@ -<%inherit file="/base.mako"/> -<%namespace file="/message.mako" import="render_msg" /> -<%namespace file="/display_base.mako" import="get_history_link" /> - -##
The following users will see this ${item_class_name_lc} in their ${item_class_name_lc} list and will be - able to run/view and import it. + able to view, import, and run it.
| @@ -208,7 +254,8 @@ |
- + Share with another user @@ -216,7 +263,8 @@
You have not shared this ${item_class_name_lc} with any users.
- + Share with a userAnyone can view and import this workflow by visiting the following URL: - <% url = h.url_for( action='display_by_username_and_slug', username=trans.get_user().username, slug=stored.slug, qualified=True ) %> -
- ${url} -- - %if stored.published: - This workflow is publicly listed and searchable in Galaxy's Published Workflows section. - %endif -
You can: -
-
- - %endif -- The following users will see this workflow in their workflow list and will be - able to run/view and import it. -
- -| - | |
|---|---|
| - ${user.email} - - | -
-
- Unshare
-
- |
-
You have not shared this workflow with any users.
- - - Share with another user - -
-Back to Workflows List
\ No newline at end of file