details: http://www.bx.psu.edu/hg/galaxy/rev/5ea7bb062c22 changeset: 3310:5ea7bb062c22 user: Greg Von Kuster <greg@bx.psu.edu> date: Mon Feb 01 15:43:07 2010 -0500 description: A few improvements to library templates. Behavior is still not optimal, but at least now functional. Functional tests still needed, and coming shortly. diffstat: lib/galaxy/web/controllers/library_common.py | 3 +-- templates/library/common/browse_library.mako | 4 ++-- templates/library/common/common.mako | 2 +- templates/library/common/ldda_info.mako | 26 +++++++++++++++----------- test/functional/test_security_and_libraries.py | 5 ++++- 5 files changed, 23 insertions(+), 17 deletions(-) diffs (118 lines): diff -r 25b70e6cdd85 -r 5ea7bb062c22 lib/galaxy/web/controllers/library_common.py --- a/lib/galaxy/web/controllers/library_common.py Mon Feb 01 14:56:23 2010 -0500 +++ b/lib/galaxy/web/controllers/library_common.py Mon Feb 01 15:43:07 2010 -0500 @@ -1287,8 +1287,7 @@ filter=dict( deleted=False ), form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) if not forms: - msg = "There are no forms on which to base the template, so create a form and " - msg += "try again to add the information template to the %s." % library_item_desc + msg = "There are no forms on which to base the template, so create a form and try to add the template again." trans.response.send_redirect( web.url_for( controller='forms', action='new', msg=msg, diff -r 25b70e6cdd85 -r 5ea7bb062c22 templates/library/common/browse_library.mako --- a/templates/library/common/browse_library.mako Mon Feb 01 14:56:23 2010 -0500 +++ b/templates/library/common/browse_library.mako Mon Feb 01 15:43:07 2010 -0500 @@ -196,7 +196,7 @@ <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_display_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">View this dataset's information</a> %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and ( ( cntrller in [ 'library_admin', 'requests_admin' ] or can_add ) and not info_association ): - <a class="action-button" href="${h.url_for( controller='library_common', action='add_info_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Add template to this dataset</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_info_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Add a template to this dataset</a> %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and cntrller == 'library_admin' and info_association: <a class="action-button" href="${h.url_for( controller='library_common', action='delete_info_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Delete this dataset's template</a> @@ -294,7 +294,7 @@ <a class="action-button" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=library_id, show_deleted=show_deleted )}">Edit this folder's information</a> %endif %if not branch_deleted( folder ) and ( ( cntrller in [ 'library_admin', 'requests_admin' ] or can_add ) and not info_association ): - <a class="action-button" href="${h.url_for( controller='library_common', action='add_info_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), show_deleted=show_deleted )}">Add template to this folder</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='add_info_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), show_deleted=show_deleted )}">Add a template to this folder</a> %endif %if not branch_deleted( folder ) and cntrller == 'library_admin' and info_association: <a class="action-button" href="${h.url_for( controller='library_common', action='delete_info_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), show_deleted=show_deleted )}">Delete this folder's template</a> diff -r 25b70e6cdd85 -r 5ea7bb062c22 templates/library/common/common.mako --- a/templates/library/common/common.mako Mon Feb 01 14:56:23 2010 -0500 +++ b/templates/library/common/common.mako Mon Feb 01 15:43:07 2010 -0500 @@ -265,7 +265,7 @@ ${field[ 'widget' ].get_html()} </div> <div class="toolParamHelp" style="clear: both;"> - ${field[ 'helptext' ]} + ${field[ 'helptext' ]}, leave blank to add a different template to this dataset after upload. </div> <div style="clear: both"></div> </div> diff -r 25b70e6cdd85 -r 5ea7bb062c22 templates/library/common/ldda_info.mako --- a/templates/library/common/ldda_info.mako Mon Feb 01 14:56:23 2010 -0500 +++ b/templates/library/common/ldda_info.mako Mon Feb 01 15:43:07 2010 -0500 @@ -1,13 +1,19 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/library/common/common.mako" import="render_template_info" /> -<% from galaxy import util %> +<% + from galaxy import util + from galaxy.web.controllers.library_common import branch_deleted -<% if ldda == ldda.library_dataset.library_dataset_dataset_association: current_version = True else: current_version = False + if ldda.user: + uploaded_by = ldda.user.email + else: + uploaded_by = 'anonymous' + info_association, inherited = ldda.get_info_association( restrict=True ) %> %if current_version: @@ -27,24 +33,22 @@ ${render_msg( msg, messagetype )} %endif -<% - if ldda.user: - uploaded_by = ldda.user.email - else: - uploaded_by = 'anonymous' -%> - <div class="toolForm"> <div class="toolFormTitle"> Information about ${ldda.name} - %if not library.deleted and not ldda.library_dataset.folder.deleted and not ldda.deleted: + %if not library.deleted and not branch_deleted( ldda.library_dataset.folder ) and not ldda.library_dataset.deleted: <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a> <div popupmenu="dataset-${ldda.id}-popup"> %if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda.library_dataset ): <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Edit this dataset's information</a> + %if not info_association: + <a class="action-button" href="${h.url_for( controller='library_common', action='add_info_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Add a template to this dataset</a> + %else: + <a class="action-button" href="${h.url_for( controller='library_common', action='delete_info_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), ldda_id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Delete this dataset's template</a> + %endif %endif %if cntrller=='library_admin' or trans.app.security_agent.can_manage_dataset( current_user_roles, ldda.dataset ) and trans.app.security_agent.can_manage_library_item( current_user_roles, ldda.library_dataset ): - <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_permissions', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Edit this dataset's permissions</a> + <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_permissions', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), id=trans.security.encode_id( ldda.id ), show_deleted=show_deleted )}">Edit this dataset's permissions</a> %endif %if current_version and ( cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda.library_dataset ) ): <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( ldda.library_dataset.folder.id ), replace_id=trans.security.encode_id( ldda.library_dataset.id ), show_deleted=show_deleted )}">Upload a new version of this dataset</a> diff -r 25b70e6cdd85 -r 5ea7bb062c22 test/functional/test_security_and_libraries.py --- a/test/functional/test_security_and_libraries.py Mon Feb 01 14:56:23 2010 -0500 +++ b/test/functional/test_security_and_libraries.py Mon Feb 01 15:43:07 2010 -0500 @@ -118,7 +118,10 @@ dp = sa_session.query( galaxy.model.DatasetPermissions ) \ .filter( galaxy.model.DatasetPermissions.table.c.dataset_id==latest_dataset.id ) \ .first() - if not dp.action == galaxy.model.Dataset.permitted_actions.DATASET_MANAGE_PERMISSIONS.action: + if not dp.action: + raise AssertionError( 'The Dataset id %d has no associated DatasetPermissions when is should have "manage permissions".' \ + % latest_dataset.id ) + elif not dp.action == galaxy.model.Dataset.permitted_actions.DATASET_MANAGE_PERMISSIONS.action: raise AssertionError( 'The DatasetPermissions.action for dataset id %d is "%s", but it should be "manage permissions"' \ % ( latest_dataset.id, dp.action ) ) # Change DefaultHistoryPermissions for regular_user1