galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
details: http://www.bx.psu.edu/hg/galaxy/rev/0571bc517c2f
changeset: 3704:0571bc517c2f
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Tue Apr 27 13:52:26 2010 -0400
description:
Rollback to unencoded HDAs.
diffstat:
lib/galaxy/web/controllers/root.py | 3 +--
templates/dataset/edit_attributes.mako | 2 +-
templates/root/history_common.mako | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 6ba1b83f5f3a -r 0571bc517c2f lib/galaxy/web/controllers/root.py
--- a/lib/galaxy/web/controllers/root.py Tue Apr 27 13:23:05 2010 -0400
+++ b/lib/galaxy/web/controllers/root.py Tue Apr 27 13:52:26 2010 -0400
@@ -253,8 +253,7 @@
history = trans.get_history()
# TODO: hid handling
data = history.datasets[ int( hid ) - 1 ]
- elif id is not None:
- id = trans.security.decode_id( id )
+ elif id is not None:
data = trans.sa_session.query( self.app.model.HistoryDatasetAssociation ).get( id )
else:
trans.log_event( "Problem loading dataset id %s with history id %s." % ( str( id ), str( hid ) ) )
diff -r 6ba1b83f5f3a -r 0571bc517c2f templates/dataset/edit_attributes.mako
--- a/templates/dataset/edit_attributes.mako Tue Apr 27 13:23:05 2010 -0400
+++ b/templates/dataset/edit_attributes.mako Tue Apr 27 13:52:26 2010 -0400
@@ -32,7 +32,7 @@
<div class="toolFormTitle">${_('Edit Attributes')}</div>
<div class="toolFormBody">
<form name="edit_attributes" action="${h.url_for( controller='root', action='edit' )}" method="post">
- <input type="hidden" name="id" value="${trans.security.encode_id( data.id )}"/>
+ <input type="hidden" name="id" value="${data.id}"/>
<div class="form-row">
<label>
Name:
diff -r 6ba1b83f5f3a -r 0571bc517c2f templates/root/history_common.mako
--- a/templates/root/history_common.mako Tue Apr 27 13:23:05 2010 -0400
+++ b/templates/root/history_common.mako Tue Apr 27 13:52:26 2010 -0400
@@ -47,7 +47,7 @@
%endif
></a>
%if for_editing:
- <a class="icon-button edit tooltip" title="Edit attributes" href="${h.url_for( controller='root', action='edit', id=trans.security.encode_id( data.id ) )}" target="galaxy_main"></a>
+ <a class="icon-button edit tooltip" title="Edit attributes" href="${h.url_for( controller='root', action='edit', id=data.id )}" target="galaxy_main"></a>
%endif
%endif
%if for_editing:
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/6ba1b83f5f3a
changeset: 3703:6ba1b83f5f3a
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Tue Apr 27 13:23:05 2010 -0400
description:
Encode HDA id in Edit Attributes form.
diffstat:
templates/dataset/edit_attributes.mako | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diffs (12 lines):
diff -r 3009820dfc51 -r 6ba1b83f5f3a templates/dataset/edit_attributes.mako
--- a/templates/dataset/edit_attributes.mako Tue Apr 27 11:31:23 2010 -0400
+++ b/templates/dataset/edit_attributes.mako Tue Apr 27 13:23:05 2010 -0400
@@ -32,7 +32,7 @@
<div class="toolFormTitle">${_('Edit Attributes')}</div>
<div class="toolFormBody">
<form name="edit_attributes" action="${h.url_for( controller='root', action='edit' )}" method="post">
- <input type="hidden" name="id" value="${data.id}"/>
+ <input type="hidden" name="id" value="${trans.security.encode_id( data.id )}"/>
<div class="form-row">
<label>
Name:
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/3009820dfc51
changeset: 3702:3009820dfc51
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue Apr 27 11:31:23 2010 -0400
description:
Fix managing tool categories and separate the different forms on the edit tool page.
diffstat:
lib/galaxy/webapps/community/controllers/admin.py | 22 +-
lib/galaxy/webapps/community/controllers/common.py | 150 ++++++-------
lib/galaxy/webapps/community/controllers/tool.py | 43 ++-
lib/galaxy/webapps/community/security/__init__.py | 17 +-
templates/webapps/community/category/add_to_category.mako | 24 --
templates/webapps/community/tool/edit_tool.mako | 45 +---
templates/webapps/community/tool/manage_categories.mako | 63 +++++
7 files changed, 188 insertions(+), 176 deletions(-)
diffs (576 lines):
diff -r b633d836ce07 -r 3009820dfc51 lib/galaxy/webapps/community/controllers/admin.py
--- a/lib/galaxy/webapps/community/controllers/admin.py Tue Apr 27 10:59:46 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/admin.py Tue Apr 27 11:31:23 2010 -0400
@@ -6,6 +6,9 @@
import logging
log = logging.getLogger( __name__ )
+# States for passing messages
+SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
+
class UserListGrid( grids.Grid ):
class EmailColumn( grids.TextColumn ):
def get_value( self, trans, grid, user ):
@@ -346,9 +349,6 @@
def build_initial_query( self, session ):
return session.query( self.model_class )
-# States for passing messages
-SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
-
class ToolListGrid( grids.Grid ):
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool ):
@@ -399,7 +399,7 @@
NameColumn( "Name",
key="name",
model_class=model.Tool,
- link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
attach_popup=True,
filterable="advanced" ),
CategoryColumn( "Category",
@@ -424,15 +424,14 @@
grids.GridAction( "Upload tool", dict( controller='upload', action='upload', type='tool' ) )
]
operations = [
- grids.GridOperation( "Add to category",
+ grids.GridOperation( "Edit information",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( controller="common", action="add_category", cntrller="admin", webapp="community" ) ),
- grids.GridOperation( "Remove from category",
+ url_args=dict( controller="common", action="edit_tool", cntrller="admin", webapp="community" ) ),
+ grids.GridOperation( "Manage categories",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( controller="common", action="remove_category", cntrller="admin", webapp="community" ) ),
- grids.GridOperation( "View versions", condition=( lambda item: not item.deleted ), allow_multiple=False )
+ url_args=dict( controller="common", action="manage_categories", cntrller="admin", webapp="community" ) )
]
standard_filters = [
grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
@@ -469,6 +468,11 @@
action='edit_tool',
cntrller='admin',
**kwargs ) )
+ elif operation == "view tool":
+ return trans.response.send_redirect( web.url_for( controller='common',
+ action='view_tool',
+ cntrller='admin',
+ **kwargs ) )
# Render the list view
return self.tool_list_grid( trans, **kwargs )
@web.expose
diff -r b633d836ce07 -r 3009820dfc51 lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py Tue Apr 27 10:59:46 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Apr 27 11:31:23 2010 -0400
@@ -9,123 +9,106 @@
class CommunityCommon( BaseController ):
@web.expose
- def edit_tool( self, trans, cntrller, id=None, **kwd ):
+ def edit_tool( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- # Get the tool
- tool = None
- if id is not None:
- encoded_id = id
- id = trans.app.security.decode_id( id )
- tool = trans.sa_session.query( trans.model.Tool ).get( id )
- if tool is None:
+ id = params.get( 'id', None )
+ if not id:
return trans.response.send_redirect( web.url_for( controller=cntrller,
action='browse_tools',
- message='Please select a Tool to edit (the tool ID provided was invalid)',
+ message='Select a tool to edit',
status='error' ) )
- if params.save_button and ( params.file_data != '' or params.url != '' ):
- # TODO: call the upload method in the upload controller.
- message = 'Uploading new version not implemented'
- status = 'error'
- elif params.save_button:
+ tool = get_tool( trans, id )
+ if params.get( 'edit_tool_button', False ):
tool.user_description = util.restore_text( params.description )
- categories = []
- set_categories( trans, tool, util.listify( params.category_id ) )
trans.sa_session.add( tool )
trans.sa_session.flush()
- return trans.response.send_redirect( web.url_for( controller=cntrller,
- action='browse_tools',
- message="Saved categories and description for tool '%s'" % tool.name,
+ return trans.response.send_redirect( web.url_for( controller='common',
+ action='edit_tool',
+ cntrller=cntrller,
+ id=id,
+ message="The information was updated",
status='done' ) )
- categories = trans.sa_session.query( trans.model.Category ).order_by( trans.model.Category.table.c.name ).all()
return trans.fill_template( '/webapps/community/tool/edit_tool.mako',
cntrller=cntrller,
- encoded_id = encoded_id,
+ id=id,
tool=tool,
- categories=categories,
message=message,
status=status )
@web.expose
- def view_tool( self, trans, cntrller, id=None, **kwd ):
+ def view_tool( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- # Get the tool
- tool = None
- if id is not None:
- id = trans.app.security.decode_id( id )
- tool = trans.sa_session.query( trans.model.Tool ).get( id )
- if tool is None:
+ id = params.get( 'id', None )
+ if not id:
return trans.response.send_redirect( web.url_for( controller=cntrller,
action='browse_tools',
- message='Please select a Tool to edit (the tool ID provided was invalid)',
+ message='Select a tool to view',
status='error' ) )
+ tool = get_tool( trans, id )
return trans.fill_template( '/webapps/community/tool/view_tool.mako',
tool=tool,
message=message,
status=status )
@web.expose
- def add_category( self, trans, cntrller, **kwd ):
- # TODO: we currently assume we are setting a tool category, so this method may need
- # tweaking if / when we decide to set history or workflow categories
+ def manage_categories( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
id = params.get( 'id', None )
- # TODO: redirect if no id
- tool = trans.sa_session.query( trans.model.Tool ).get( trans.security.decode_id( id ) )
- if params.get( 'add_category_button', False ):
- category_ids = util.listify( params.get( 'category_id', '' ) )
- # TODO: redirect if no category_id
- message = "The tool '%s' has been added to the categories: " % ( tool.name )
- for category_id in category_ids:
- category = trans.sa_session.query( trans.model.Category ).get( trans.security.decode_id( category_id ) )
- tca = trans.app.model.ToolCategoryAssociation( tool, category )
- trans.sa_session.add( tca )
- trans.sa_session.flush()
- message += " %s " % category.name
- trans.response.send_redirect( web.url_for( controller=cntrller,
- action='browse_tools',
- use_panels=use_panels,
+ if not id:
+ return trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ message='Select a tool to manage categories',
+ status='error' ) )
+ tool = get_tool( trans, id )
+ if params.get( 'manage_categories_button', False ):
+ in_categories = [ trans.sa_session.query( trans.app.model.Category ).get( x ) for x in util.listify( params.in_categories ) ]
+ trans.app.security_agent.set_entity_category_associations( tools=[ tool ], categories=in_categories )
+ trans.sa_session.refresh( tool )
+ message = "Tool '%s' has been updated with %d associated categories" % ( tool.name, len( in_categories ) )
+ trans.response.send_redirect( web.url_for( controller='common',
+ action='manage_categories',
cntrller=cntrller,
+ id=id,
message=util.sanitize_text( message ),
- status=status ) )
- category_select_list = SelectField( 'category_id', multiple=True )
- for category in get_unassociated_categories( trans, tool ):
- category_select_list.add_option( category.name, trans.security.encode_id( category.id ) )
- return trans.fill_template( '/webapps/community/category/add_to_category.mako',
+ status=status ) )
+ in_categories = []
+ out_categories = []
+ for category in get_categories( trans ):
+ if category in [ x.category for x in tool.categories ]:
+ in_categories.append( ( category.id, category.name ) )
+ else:
+ out_categories.append( ( category.id, category.name ) )
+ return trans.fill_template( '/webapps/community/tool/manage_categories.mako',
+ tool=tool,
+ in_categories=in_categories,
+ out_categories=out_categories,
cntrller=cntrller,
- id=id,
- category_select_list=category_select_list,
- use_panels=use_panels )
+ message=message,
+ status=status )
@web.expose
- def remove_category( self, trans, cntrller, **kwd ):
- # TODO: we currently assume we are setting a tool category, so this method may need
- # tweaking if / when we decide to set history or workflow categories
+ def upload_new_tool_version( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
id = params.get( 'id', None )
- # TODO: redirect if no id
- tool = trans.sa_session.query( trans.model.Tool ).get( trans.security.decode_id( id ) )
- category_id = params.get( 'category_id', None )
- category = trans.sa_session.query( trans.model.Category ).get( trans.security.decode_id( category_id ) )
- # TODO: redirect if no category_id
- for tca in tool.categories:
- if tca.category == category:
- trans.sa_session.delete( tca )
- trans.sa_session.flush()
- break
- message = "The tool '%s' has been removed from the category '%s'" % ( tool.name, category.name )
- trans.response.send_redirect( web.url_for( controller=cntrller,
- action='browse_tools',
- use_panels=use_panels,
- cntrller=cntrller,
- message=util.sanitize_text( message ),
- status=status ) )
+ if not id:
+ return trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ message='Select a tool to to upload a new version',
+ status='error' ) )
+ tool = get_tool( trans, id )
+ if params.save_button and ( params.file_data != '' or params.url != '' ):
+ # TODO: call the upload method in the upload controller.
+ message = 'Uploading new version not implemented'
+ status = 'error'
+ return trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ message='Not yet implemented, sorry...',
+ status='error' ) )
## ---- Utility methods -------------------------------------------------------
@@ -147,13 +130,7 @@
categories.append( category )
return categories
def get_category( trans, id ):
- """Get a Category from the database by id."""
- # Load user from database
- id = trans.security.decode_id( id )
- category = trans.sa_session.query( trans.model.Category ).get( id )
- if not category:
- return trans.show_error_message( "Category not found for id (%s)" % str( id ) )
- return category
+ return trans.sa_session.query( trans.model.Category ).get( trans.security.decode_id( id ) )
def set_categories( trans, obj, category_ids, delete_existing_assocs=True ):
if delete_existing_assocs:
for assoc in obj.categories:
@@ -164,3 +141,6 @@
# tweaking if / when we decide to set history or workflow categories
category = trans.sa_session.query( trans.model.Category ).get( category_id )
obj.categories.append( trans.model.ToolCategoryAssociation( obj, category ) )
+def get_tool( trans, id ):
+ return trans.sa_session.query( trans.model.Tool ).get( trans.app.security.decode_id( id ) )
+
diff -r b633d836ce07 -r 3009820dfc51 lib/galaxy/webapps/community/controllers/tool.py
--- a/lib/galaxy/webapps/community/controllers/tool.py Tue Apr 27 10:59:46 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/tool.py Tue Apr 27 11:31:23 2010 -0400
@@ -18,7 +18,10 @@
class CategoryColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool ):
if tool.categories:
- return tool.categories
+ rval = ''
+ for tca in tool.categories:
+ rval = '%s%s<br/>' % ( rval, tca.category.name )
+ return rval
return 'not set'
class StateColumn( grids.GridColumn ):
def get_value( self, trans, grid, tool ):
@@ -58,15 +61,19 @@
NameColumn( "Name",
key="name",
model_class=model.Tool,
- link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
attach_popup=True,
filterable="advanced" ),
CategoryColumn( "Category",
- key="category",
- model_class=model.Category,
- link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
- attach_popup=False,
- filterable="advanced" ),
+ key="category",
+ model_class=model.Category,
+ attach_popup=False,
+ filterable="advanced" ),
+ StateColumn( "State",
+ key="state",
+ model_class=model.Event,
+ attach_popup=False,
+ filterable="advanced" ),
# Columns that are valid for filtering but are not visible.
grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" )
]
@@ -79,15 +86,18 @@
grids.GridAction( "Upload tool", dict( controller='upload', action='upload', type='tool' ) )
]
operations = [
- grids.GridOperation( "Add to category",
+ grids.GridOperation( "Edit information",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( controller="common", action="add_category", webapp="community" ) ),
- grids.GridOperation( "Remove from category",
+ url_args=dict( controller="common", action="edit_tool", cntrller="tool", webapp="community" ) ),
+ grids.GridOperation( "Manage categories",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( controller="common", action="remove_category", webapp="community" ) ),
- grids.GridOperation( "View versions", condition=( lambda item: not item.deleted ), allow_multiple=False )
+ url_args=dict( controller="common", action="manage_categories", cntrller="tool", webapp="community" ) ),
+ grids.GridOperation( "Upload a new version",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="upload_new_tool_version", cntrller="tool", webapp="community" ) ),
]
standard_filters = [
grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
@@ -117,17 +127,18 @@
if 'operation' in kwargs:
operation = kwargs['operation'].lower()
if operation == "browse":
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ return trans.response.send_redirect( web.url_for( controller='tool',
action='browse_tool',
**kwargs ) )
elif operation == "view tool":
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ return trans.response.send_redirect( web.url_for( controller='common',
action='view_tool',
+ cntrller='tool',
**kwargs ) )
elif operation == "edit tool":
return trans.response.send_redirect( web.url_for( controller='common',
action='edit_tool',
- cntrller='tool_browser',
+ cntrller='tool',
**kwargs ) )
# Render the list view
return self.tool_list_grid( trans, **kwargs )
@@ -150,7 +161,7 @@
id = trans.app.security.decode_id( id )
tool = trans.sa_session.query( trans.model.Tool ).get( id )
if tool is None:
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ return trans.response.send_redirect( web.url_for( controller='tool',
action='browse_tools',
message='Please select a Tool to edit (the tool ID provided was invalid)',
status='error' ) )
diff -r b633d836ce07 -r 3009820dfc51 lib/galaxy/webapps/community/security/__init__.py
--- a/lib/galaxy/webapps/community/security/__init__.py Tue Apr 27 10:59:46 2010 -0400
+++ b/lib/galaxy/webapps/community/security/__init__.py Tue Apr 27 11:31:23 2010 -0400
@@ -76,6 +76,8 @@
elif 'role' in kwd:
if 'group' in kwd:
return self.associate_group_role( kwd['group'], kwd['role'] )
+ elif 'tool' in kwd:
+ return self.associate_tool_category( kwd['tool'], kwd['category'] )
raise 'No valid method of associating provided components: %s' % kwd
def associate_group_role( self, group, role ):
assoc = self.model.GroupRoleAssociation( group, role )
@@ -92,6 +94,11 @@
self.sa_session.add( assoc )
self.sa_session.flush()
return assoc
+ def associate_tool_category( self, tool, category ):
+ assoc = self.model.ToolCategoryAssociation( tool, category )
+ self.sa_session.add( assoc )
+ self.sa_session.flush()
+ return assoc
def create_private_user_role( self, user ):
# Create private role
role = self.model.Role( name=user.email, description='Private Role for ' + user.email, type=self.model.Role.types.PRIVATE )
@@ -147,7 +154,15 @@
self.associate_components( user=user, role=role )
for group in groups:
self.associate_components( user=user, group=group )
-
+ def set_entity_category_associations( self, tools=[], categories=[], delete_existing_assocs=True ):
+ for tool in tools:
+ if delete_existing_assocs:
+ for a in tool.categories:
+ self.sa_session.delete( a )
+ self.sa_session.flush()
+ self.sa_session.refresh( tool )
+ for category in categories:
+ self.associate_components( tool=tool, category=category )
def get_permitted_actions( filter=None ):
'''Utility method to return a subset of RBACAgent's permitted actions'''
if filter is None:
diff -r b633d836ce07 -r 3009820dfc51 templates/webapps/community/category/add_to_category.mako
--- a/templates/webapps/community/category/add_to_category.mako Tue Apr 27 10:59:46 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Select a category</div>
- <div class="toolFormBody">
- <form id="select_category" name="select_category" action="${h.url_for( controller='common', action='add_category', cntrller=cntrller, id=id, use_panels=use_panels )}" method="post" >
- <div class="form-row">
- <label>Category:</label>
- ${category_select_list.get_html()}
- </div>
- <div class="toolParamHelp" style="clear: both;">
- Multi-select list - hold the appropriate key while clicking to select multiple columns
- </div>
- <div class="form-row">
- <input type="submit" name="add_category_button" value="Add tool to categories"/>
- </div>
- </form>
- </div>
-</div>
diff -r b633d836ce07 -r 3009820dfc51 templates/webapps/community/tool/edit_tool.mako
--- a/templates/webapps/community/tool/edit_tool.mako Tue Apr 27 10:59:46 2010 -0400
+++ b/templates/webapps/community/tool/edit_tool.mako Tue Apr 27 11:31:23 2010 -0400
@@ -11,62 +11,25 @@
<%def name="title()">Edit Tool</%def>
-<h2>Edit Tool: ${tool.name} ${tool.version} (${tool.tool_id})</h2>
+<h2>Edit Tool</h2>
%if message:
${render_msg( message, status )}
%endif
-<form id="tool_edit_form" name="tool_edit_form" action="${h.url_for( controller='common', action='edit_tool' )}" enctype="multipart/form-data" method="post">
+<form id="edit_tool" name="edit_tool" action="${h.url_for( controller='common', action='edit_tool' )}" method="post">
<input type="hidden" name="id" value="${trans.app.security.encode_id( tool.id )}"/>
<input type="hidden" name="cntrller" value="${cntrller}"/>
<div class="toolForm">
- <div class="toolFormTitle">Edit Tool</div>
+ <div class="toolFormTitle">${tool.name} Version: ${tool.version}</div>
<div class="toolFormBody">
<div class="form-row">
- <label>Categories:</label>
- <div class="form-row-input">
- <select name="category_id" multiple size=5 style="min-width: 250px;">
- %for category in categories:
- %if category.id in [ tool_category.id for tool_category in tool.categories ]:
- <option value="${category.id}" selected>${category.name}</option>
- %else:
- <option value="${category.id}">${category.name}</option>
- %endif
- %endfor
- </select>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
<label>Description:</label>
<div class="form-row-input"><textarea name="description" rows="5" cols="35">${tool.user_description}</textarea></div>
<div style="clear: both"></div>
</div>
<div class="form-row">
- <input type="submit" class="primary-button" name="save_button" value="Save">
- </div>
- </div>
- </div>
- <p/>
- <div class="toolForm">
- <div class="toolFormTitle">Upload new version</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>File:</label>
- <div class="form-row-input"><input type="file" name="file_data"/></div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>URL:</label>
- <div class="form-row-input"><input type="text" name="url" style="width: 100%;"/></div>
- <div class="toolParamHelp" style="clear: both;">
- Instead of uploading directly from your computer, you may instruct Galaxy to download the file from a Web or FTP address.
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" class="primary-button" name="save_button" value="Save">
+ <input type="submit" class="primary-button" name="edit_tool_button" value="Save">
</div>
</div>
</form>
diff -r b633d836ce07 -r 3009820dfc51 templates/webapps/community/tool/manage_categories.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/webapps/community/tool/manage_categories.mako Tue Apr 27 11:31:23 2010 -0400
@@ -0,0 +1,63 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ <script type="text/javascript">
+ $(function(){
+ $("input:text:first").focus();
+ })
+ </script>
+</%def>
+
+<%def name="render_select( name, options )">
+ <select name="${name}" id="${name}" style="min-width: 250px; height: 150px;" multiple>
+ %for option in options:
+ <option value="${option[0]}">${option[1]}</option>
+ %endfor
+ </select>
+</%def>
+
+<script type="text/javascript">
+$().ready(function() {
+ $('#categories_add_button').click(function() {
+ return !$('#out_categories option:selected').remove().appendTo('#in_categories');
+ });
+ $('#categories_remove_button').click(function() {
+ return !$('#in_categories option:selected').remove().appendTo('#out_categories');
+ });
+ $('form#associate_tool_category').submit(function() {
+ $('#in_categories option').each(function(i) {
+ $(this).attr("selected", "selected");
+ });
+ });
+});
+</script>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Tool '${tool.name}'</div>
+ <div class="toolFormBody">
+ <form name="associate_tool_category" id="associate_tool_category" action="${h.url_for( controller='common', action='manage_categories', id=trans.security.encode_id( tool.id ) )}" method="post" >
+ <input name="cntrller" type="hidden" value="${cntrller}" size=40"/>
+ <div class="form-row">
+ <div style="float: left; margin-right: 10px;">
+ <label>Categories associated with '${tool.name}'</label>
+ ${render_select( "in_categories", in_categories )}<br/>
+ <input type="submit" id="categories_remove_button" value=">>"/>
+ </div>
+ <div>
+ <label>Categories not associated with '${tool.name}'</label>
+ ${render_select( "out_categories", out_categories )}<br/>
+ <input type="submit" id="categories_add_button" value="<<"/>
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="manage_categories_button" value="Save"/>
+ </div>
+ </form>
+ </div>
+</div>
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/b633d836ce07
changeset: 3701:b633d836ce07
user: Dan Blankenberg <dan(a)bx.psu.edu>
date: Tue Apr 27 10:59:46 2010 -0400
description:
Add eland and elandmulti formats. Enhance MACs peakcaller to properly handle these formats.
diffstat:
datatypes_conf.xml.sample | 2 ++
lib/galaxy/datatypes/tabular.py | 12 ++++++++++++
tools/peak_calling/macs_wrapper.xml | 20 +++++++++++---------
3 files changed, 25 insertions(+), 9 deletions(-)
diffs (77 lines):
diff -r c2a80b197ba5 -r b633d836ce07 datatypes_conf.xml.sample
--- a/datatypes_conf.xml.sample Tue Apr 27 10:12:59 2010 -0400
+++ b/datatypes_conf.xml.sample Tue Apr 27 10:59:46 2010 -0400
@@ -42,6 +42,8 @@
<datatype extension="fastqsolexa" type="galaxy.datatypes.sequence:FastqSolexa" display_in_upload="true"/>
<datatype extension="fastqcssanger" type="galaxy.datatypes.sequence:FastqCSSanger" display_in_upload="true"/>
<datatype extension="fastqillumina" type="galaxy.datatypes.sequence:FastqIllumina" display_in_upload="true"/>
+ <datatype extension="eland" type="galaxy.datatypes.tabular:Eland" display_in_upload="true"/>
+ <datatype extension="elandmulti" type="galaxy.datatypes.tabular:ElandMulti" display_in_upload="true"/>
<datatype extension="genetrack" type="galaxy.datatypes.tracks:GeneTrack">
<!-- <display file="genetrack.xml" /> -->
</datatype>
diff -r c2a80b197ba5 -r b633d836ce07 lib/galaxy/datatypes/tabular.py
--- a/lib/galaxy/datatypes/tabular.py Tue Apr 27 10:12:59 2010 -0400
+++ b/lib/galaxy/datatypes/tabular.py Tue Apr 27 10:59:46 2010 -0400
@@ -420,3 +420,15 @@
return True
except:
return False
+
+class Eland( Tabular ):
+ file_ext = 'eland'
+
+ def sniff( self, filename ):
+ return False
+
+class ElandMulti( Tabular ):
+ file_ext = 'elandmulti'
+
+ def sniff( self, filename ):
+ return False
diff -r c2a80b197ba5 -r b633d836ce07 tools/peak_calling/macs_wrapper.xml
--- a/tools/peak_calling/macs_wrapper.xml Tue Apr 27 10:12:59 2010 -0400
+++ b/tools/peak_calling/macs_wrapper.xml Tue Apr 27 10:59:46 2010 -0400
@@ -9,19 +9,19 @@
<param name="experiment_name" type="text" value="MACS in Galaxy" size="50" label="Experiment Name"/>
<conditional name="input_type">
<param name="input_type_selector" type="select" label="Paired End Sequencing">
- <option value="paired_end">Paired End (requires elandmultipet format)</option>
+ <option value="paired_end">Paired End (requires elandmulti format)</option>
<option value="single_end" selected="true">Single End</option>
</param>
<when value="paired_end">
- <param name="input_chipseq_file1" type="data" format="elandmultipet" label="ChIP-Seq Tag File 1" />
- <param name="input_chipseq_file2" type="data" format="elandmultipet" label="ChIP-Seq Tag File 2" />
- <param name="input_control_file1" type="data" format="elandmultipet" optional="True" label="ChIP-Seq Control File 1" />
- <param name="input_control_file2" type="data" format="elandmultipet" optional="True" label="ChIP-Seq Control File 2" />
+ <param name="input_chipseq_file1" type="data" format="elandmulti" label="ChIP-Seq Tag File 1" />
+ <param name="input_chipseq_file2" type="data" format="elandmulti" label="ChIP-Seq Tag File 2" />
+ <param name="input_control_file1" type="data" format="elandmulti" optional="True" label="ChIP-Seq Control File 1" />
+ <param name="input_control_file2" type="data" format="elandmulti" optional="True" label="ChIP-Seq Control File 2" />
<param name="petdist" type="integer" label="Best distance between Pair-End Tags" value="200"/>
</when>
<when value="single_end">
- <param name="input_chipseq_file1" type="data" format="bed,sam,bam" label="ChIP-Seq Tag File" />
- <param name="input_control_file1" type="data" format="bed,sam,bam" optional="True" label="ChIP-Seq Control File" />
+ <param name="input_chipseq_file1" type="data" format="bed,sam,bam,eland,elandmulti" label="ChIP-Seq Tag File" />
+ <param name="input_control_file1" type="data" format="bed,sam,bam,eland,elandmulti" optional="True" label="ChIP-Seq Control File" />
</when>
</conditional>
<param name="gsize" type="float" label="Effective genome size" value="2.7e+9" help="default: 2.7e+9"/>
@@ -101,11 +101,13 @@
#else:
#set $__options['xls_to_interval'] = False
#end if
-#set $__options['format'] = $input_type['input_chipseq_file1'].extension.upper()
-##treatment/tag input files
+##treatment/tag input files and format
#set $__options['input_chipseq'] = [ str( $input_type['input_chipseq_file1'] ) ]
#if $input_type['input_type_selector'] == 'paired_end':
#set $_hole = __options['input_chipseq'].append( str( $input_type['input_chipseq_file2'] ) )
+#set $__options['format'] = 'ELANDMULTIPET'
+#else:
+#set $__options['format'] = $input_type['input_chipseq_file1'].extension.upper()
#end if
##control/input files
#set $__options['input_control'] = []
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/c2a80b197ba5
changeset: 3700:c2a80b197ba5
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Tue Apr 27 10:12:59 2010 -0400
description:
Encode HDA id for edit link in history panel.
diffstat:
lib/galaxy/web/controllers/root.py | 3 ++-
templates/root/history_common.mako | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r ba5b796311f3 -r c2a80b197ba5 lib/galaxy/web/controllers/root.py
--- a/lib/galaxy/web/controllers/root.py Tue Apr 27 09:32:38 2010 -0400
+++ b/lib/galaxy/web/controllers/root.py Tue Apr 27 10:12:59 2010 -0400
@@ -253,7 +253,8 @@
history = trans.get_history()
# TODO: hid handling
data = history.datasets[ int( hid ) - 1 ]
- elif id is not None:
+ elif id is not None:
+ id = trans.security.decode_id( id )
data = trans.sa_session.query( self.app.model.HistoryDatasetAssociation ).get( id )
else:
trans.log_event( "Problem loading dataset id %s with history id %s." % ( str( id ), str( hid ) ) )
diff -r ba5b796311f3 -r c2a80b197ba5 templates/root/history_common.mako
--- a/templates/root/history_common.mako Tue Apr 27 09:32:38 2010 -0400
+++ b/templates/root/history_common.mako Tue Apr 27 10:12:59 2010 -0400
@@ -47,7 +47,7 @@
%endif
></a>
%if for_editing:
- <a class="icon-button edit tooltip" title="Edit attributes" href="${h.url_for( controller='root', action='edit', id=data.id )}" target="galaxy_main"></a>
+ <a class="icon-button edit tooltip" title="Edit attributes" href="${h.url_for( controller='root', action='edit', id=trans.security.encode_id( data.id ) )}" target="galaxy_main"></a>
%endif
%endif
%if for_editing:
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/ba5b796311f3
changeset: 3699:ba5b796311f3
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue Apr 27 09:32:38 2010 -0400
description:
Rename the tool_browser controller and add a link to the masthead.
diffstat:
lib/galaxy/webapps/community/buildapp.py | 2 +-
lib/galaxy/webapps/community/controllers/admin.py | 2 +-
lib/galaxy/webapps/community/controllers/tool.py | 161 +++++++++++++++
lib/galaxy/webapps/community/controllers/tool_browser.py | 161 ---------------
lib/galaxy/webapps/community/controllers/upload.py | 4 +-
templates/webapps/community/base_panels.mako | 1 +
templates/webapps/community/index.mako | 4 +-
templates/webapps/community/tool/browse_tool.mako | 2 +-
templates/webapps/community/tool/view_tool.mako | 6 +-
9 files changed, 172 insertions(+), 171 deletions(-)
diffs (441 lines):
diff -r 83102f27fd1d -r ba5b796311f3 lib/galaxy/webapps/community/buildapp.py
--- a/lib/galaxy/webapps/community/buildapp.py Mon Apr 26 17:02:37 2010 -0400
+++ b/lib/galaxy/webapps/community/buildapp.py Tue Apr 27 09:32:38 2010 -0400
@@ -76,7 +76,7 @@
add_controllers( webapp, app )
# These two routes handle our simple needs at the moment
webapp.add_route( '/:controller/:action', action='index' )
- webapp.add_route( '/:action', controller='tool_browser', action='index' )
+ webapp.add_route( '/:action', controller='tool', action='index' )
webapp.finalize_config()
# Wrap the webapp in some useful middleware
if kwargs.get( 'middleware', True ):
diff -r 83102f27fd1d -r ba5b796311f3 lib/galaxy/webapps/community/controllers/admin.py
--- a/lib/galaxy/webapps/community/controllers/admin.py Mon Apr 26 17:02:37 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/admin.py Tue Apr 27 09:32:38 2010 -0400
@@ -461,7 +461,7 @@
if 'operation' in kwargs:
operation = kwargs['operation'].lower()
if operation == "browse":
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ return trans.response.send_redirect( web.url_for( controller='tool',
action='browse_tool',
**kwargs ) )
elif operation == "edit tool":
diff -r 83102f27fd1d -r ba5b796311f3 lib/galaxy/webapps/community/controllers/tool.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/webapps/community/controllers/tool.py Tue Apr 27 09:32:38 2010 -0400
@@ -0,0 +1,161 @@
+import sys, os, operator, string, shutil, re, socket, urllib, time, logging, mimetypes
+
+from galaxy.web.base.controller import *
+from galaxy.webapps.community import model
+from galaxy.web.framework.helpers import time_ago, iff, grids
+from galaxy.model.orm import *
+from common import *
+
+log = logging.getLogger( __name__ )
+
+# States for passing messages
+SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
+
+class ToolListGrid( grids.Grid ):
+ class NameColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ return tool.name
+ class CategoryColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ if tool.categories:
+ return tool.categories
+ return 'not set'
+ class StateColumn( grids.GridColumn ):
+ def get_value( self, trans, grid, tool ):
+ state = tool.state()
+ if state == tool.states.NEW:
+ return '<div class="count-box state-color-queued">%s</div>' % state
+ if state == tool.states.WAITING:
+ return '<div class="count-box state-color-running">%s</div>' % state
+ if state == tool.states.APPROVED:
+ return '<div class="count-box state-color-ok">%s</div>' % state
+ if state == tool.states.REJECTED or state == tool.states.ERROR:
+ return '<div class="count-box state-color-error">%s</div>' % state
+ return state
+ def get_accepted_filters( self ):
+ """ Returns a list of accepted filters for this column."""
+ accepted_filter_labels_and_vals = [ model.Tool.states.NEW,
+ model.Tool.states.WAITING,
+ model.Tool.states.APPROVED,
+ model.Tool.states.REJECTED,
+ model.Tool.states.DELETED,
+ "All" ]
+ accepted_filters = []
+ for val in accepted_filter_labels_and_vals:
+ label = val.lower()
+ args = { self.key: val }
+ accepted_filters.append( grids.GridColumnFilter( label, args ) )
+ return accepted_filters
+ class UserColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ return tool.user.email
+ # Grid definition
+ title = "Tools"
+ model_class = model.Tool
+ template='/webapps/community/tool/grid.mako'
+ default_sort_key = "name"
+ columns = [
+ NameColumn( "Name",
+ key="name",
+ model_class=model.Tool,
+ link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
+ attach_popup=True,
+ filterable="advanced" ),
+ CategoryColumn( "Category",
+ key="category",
+ model_class=model.Category,
+ link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
+ attach_popup=False,
+ filterable="advanced" ),
+ # Columns that are valid for filtering but are not visible.
+ grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" )
+ ]
+ columns.append( grids.MulticolFilterColumn( "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search",
+ visible=False,
+ filterable="standard" ) )
+ global_actions = [
+ grids.GridAction( "Upload tool", dict( controller='upload', action='upload', type='tool' ) )
+ ]
+ operations = [
+ grids.GridOperation( "Add to category",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="add_category", webapp="community" ) ),
+ grids.GridOperation( "Remove from category",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="remove_category", webapp="community" ) ),
+ grids.GridOperation( "View versions", condition=( lambda item: not item.deleted ), allow_multiple=False )
+ ]
+ standard_filters = [
+ grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
+ grids.GridColumnFilter( "All", args=dict( deleted='All' ) )
+ ]
+ default_filter = dict( name="All", deleted="False" )
+ num_rows_per_page = 50
+ preserve_state = False
+ use_paging = True
+ def build_initial_query( self, session ):
+ return session.query( self.model_class )
+ def apply_default_filter( self, trans, query, **kwargs ):
+ return query.filter( self.model_class.deleted==False )
+
+class ToolBrowserController( BaseController ):
+
+ tool_list_grid = ToolListGrid()
+
+ @web.expose
+ def index( self, trans, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ return trans.fill_template( '/webapps/community/index.mako', message=message, status=status )
+ @web.expose
+ def browse_tools( self, trans, **kwargs ):
+ if 'operation' in kwargs:
+ operation = kwargs['operation'].lower()
+ if operation == "browse":
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='browse_tool',
+ **kwargs ) )
+ elif operation == "view tool":
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='view_tool',
+ **kwargs ) )
+ elif operation == "edit tool":
+ return trans.response.send_redirect( web.url_for( controller='common',
+ action='edit_tool',
+ cntrller='tool_browser',
+ **kwargs ) )
+ # Render the list view
+ return self.tool_list_grid( trans, **kwargs )
+ @web.expose
+ def browse_tool( self, trans, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ return trans.fill_template( '/webapps/community/tool/browse_tool.mako',
+ tools=tools,
+ message=message,
+ status=status )
+ @web.expose
+ def download_tool( self, trans, id=None, **kwd ):
+ params = util.Params( kwd )
+ tool = None
+ # Get the tool
+ tool = None
+ if id is not None:
+ id = trans.app.security.decode_id( id )
+ tool = trans.sa_session.query( trans.model.Tool ).get( id )
+ if tool is None:
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='browse_tools',
+ message='Please select a Tool to edit (the tool ID provided was invalid)',
+ status='error' ) )
+
+ trans.response.set_content_type(tool.mimetype)
+ trans.response.headers['Content-Length'] = int( os.stat( tool.file_name ).st_size )
+ trans.response.headers['Content-Disposition'] = 'attachment; filename=%s' % tool.download_file_name
+ return open( tool.file_name )
diff -r 83102f27fd1d -r ba5b796311f3 lib/galaxy/webapps/community/controllers/tool_browser.py
--- a/lib/galaxy/webapps/community/controllers/tool_browser.py Mon Apr 26 17:02:37 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-import sys, os, operator, string, shutil, re, socket, urllib, time, logging, mimetypes
-
-from galaxy.web.base.controller import *
-from galaxy.webapps.community import model
-from galaxy.web.framework.helpers import time_ago, iff, grids
-from galaxy.model.orm import *
-from common import *
-
-log = logging.getLogger( __name__ )
-
-# States for passing messages
-SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
-
-class ToolListGrid( grids.Grid ):
- class NameColumn( grids.TextColumn ):
- def get_value( self, trans, grid, tool ):
- return tool.name
- class CategoryColumn( grids.TextColumn ):
- def get_value( self, trans, grid, tool ):
- if tool.categories:
- return tool.categories
- return 'not set'
- class StateColumn( grids.GridColumn ):
- def get_value( self, trans, grid, tool ):
- state = tool.state()
- if state == tool.states.NEW:
- return '<div class="count-box state-color-queued">%s</div>' % state
- if state == tool.states.WAITING:
- return '<div class="count-box state-color-running">%s</div>' % state
- if state == tool.states.APPROVED:
- return '<div class="count-box state-color-ok">%s</div>' % state
- if state == tool.states.REJECTED or state == tool.states.ERROR:
- return '<div class="count-box state-color-error">%s</div>' % state
- return state
- def get_accepted_filters( self ):
- """ Returns a list of accepted filters for this column."""
- accepted_filter_labels_and_vals = [ model.Tool.states.NEW,
- model.Tool.states.WAITING,
- model.Tool.states.APPROVED,
- model.Tool.states.REJECTED,
- model.Tool.states.DELETED,
- "All" ]
- accepted_filters = []
- for val in accepted_filter_labels_and_vals:
- label = val.lower()
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args ) )
- return accepted_filters
- class UserColumn( grids.TextColumn ):
- def get_value( self, trans, grid, tool ):
- return tool.user.email
- # Grid definition
- title = "Tools"
- model_class = model.Tool
- template='/webapps/community/tool/grid.mako'
- default_sort_key = "name"
- columns = [
- NameColumn( "Name",
- key="name",
- model_class=model.Tool,
- link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
- attach_popup=True,
- filterable="advanced" ),
- CategoryColumn( "Category",
- key="category",
- model_class=model.Category,
- link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
- attach_popup=False,
- filterable="advanced" ),
- # Columns that are valid for filtering but are not visible.
- grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" )
- ]
- columns.append( grids.MulticolFilterColumn( "Search",
- cols_to_filter=[ columns[0], columns[1] ],
- key="free-text-search",
- visible=False,
- filterable="standard" ) )
- global_actions = [
- grids.GridAction( "Upload tool", dict( controller='upload', action='upload', type='tool' ) )
- ]
- operations = [
- grids.GridOperation( "Add to category",
- condition=( lambda item: not item.deleted ),
- allow_multiple=False,
- url_args=dict( controller="common", action="add_category", webapp="community" ) ),
- grids.GridOperation( "Remove from category",
- condition=( lambda item: not item.deleted ),
- allow_multiple=False,
- url_args=dict( controller="common", action="remove_category", webapp="community" ) ),
- grids.GridOperation( "View versions", condition=( lambda item: not item.deleted ), allow_multiple=False )
- ]
- standard_filters = [
- grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
- grids.GridColumnFilter( "All", args=dict( deleted='All' ) )
- ]
- default_filter = dict( name="All", deleted="False" )
- num_rows_per_page = 50
- preserve_state = False
- use_paging = True
- def build_initial_query( self, session ):
- return session.query( self.model_class )
- def apply_default_filter( self, trans, query, **kwargs ):
- return query.filter( self.model_class.deleted==False )
-
-class ToolBrowserController( BaseController ):
-
- tool_list_grid = ToolListGrid()
-
- @web.expose
- def index( self, trans, **kwd ):
- params = util.Params( kwd )
- message = util.restore_text( params.get( 'message', '' ) )
- status = params.get( 'status', 'done' )
- return trans.fill_template( '/webapps/community/index.mako', message=message, status=status )
- @web.expose
- def browse_tools( self, trans, **kwargs ):
- if 'operation' in kwargs:
- operation = kwargs['operation'].lower()
- if operation == "browse":
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='browse_tool',
- **kwargs ) )
- elif operation == "view tool":
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='view_tool',
- **kwargs ) )
- elif operation == "edit tool":
- return trans.response.send_redirect( web.url_for( controller='common',
- action='edit_tool',
- cntrller='tool_browser',
- **kwargs ) )
- # Render the list view
- return self.tool_list_grid( trans, **kwargs )
- @web.expose
- def browse_tool( self, trans, **kwd ):
- params = util.Params( kwd )
- message = util.restore_text( params.get( 'message', '' ) )
- status = params.get( 'status', 'done' )
- return trans.fill_template( '/webapps/community/tool/browse_tool.mako',
- tools=tools,
- message=message,
- status=status )
- @web.expose
- def download_tool( self, trans, id=None, **kwd ):
- params = util.Params( kwd )
- tool = None
- # Get the tool
- tool = None
- if id is not None:
- id = trans.app.security.decode_id( id )
- tool = trans.sa_session.query( trans.model.Tool ).get( id )
- if tool is None:
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='browse_tools',
- message='Please select a Tool to edit (the tool ID provided was invalid)',
- status='error' ) )
-
- trans.response.set_content_type(tool.mimetype)
- trans.response.headers['Content-Length'] = int( os.stat( tool.file_name ).st_size )
- trans.response.headers['Content-Disposition'] = 'attachment; filename=%s' % tool.download_file_name
- return open( tool.file_name )
diff -r 83102f27fd1d -r ba5b796311f3 lib/galaxy/webapps/community/controllers/upload.py
--- a/lib/galaxy/webapps/community/controllers/upload.py Mon Apr 26 17:02:37 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Apr 27 09:32:38 2010 -0400
@@ -62,10 +62,10 @@
os.link( uploaded_file.name, obj.file_name )
except OSError:
shutil.copy( uploaded_file.name, obj.file_name )
- # We're setting cntrller to 'tool_browser' since that is the only controller from which we can upload
+ # We're setting cntrller to 'tool' since that is the only controller from which we can upload
return trans.response.send_redirect( web.url_for( controller='common',
action='edit_tool',
- cntrller='tool_browser',
+ cntrller='tool',
id=trans.app.security.encode_id( obj.id ),
message='Uploaded %s' % meta.message,
status='done' ) )
diff -r 83102f27fd1d -r ba5b796311f3 templates/webapps/community/base_panels.mako
--- a/templates/webapps/community/base_panels.mako Mon Apr 26 17:02:37 2010 -0400
+++ b/templates/webapps/community/base_panels.mako Tue Apr 27 09:32:38 2010 -0400
@@ -26,6 +26,7 @@
<td class="${cls}" style="${style}"><a target="${target}" href="${href}">${display}</a></td>
</%def>
+ ${tab( "tools", "Tools", h.url_for( controller='/tool', action='index', webapp='community' ) )}
${tab( "admin", "Admin", h.url_for( controller='/admin', action='index', webapp='community' ), extra_class="admin-only", visible=( trans.user and app.config.is_admin_user( trans.user ) ) )}
<td class="tab">
diff -r 83102f27fd1d -r ba5b796311f3 templates/webapps/community/index.mako
--- a/templates/webapps/community/index.mako Mon Apr 26 17:02:37 2010 -0400
+++ b/templates/webapps/community/index.mako Tue Apr 27 09:32:38 2010 -0400
@@ -29,7 +29,7 @@
</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='tool_browser', action='browse_tools' )}" target="galaxy_main">Browse tools</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='tool', action='browse_tools' )}" target="galaxy_main">Browse tools</a></div>
</div>
</div>
<div class="toolSectionPad"></div>
@@ -51,7 +51,7 @@
if trans.app.config.require_login and not trans.user:
center_url = h.url_for( controller='user', action='login', message=message, status=status )
else:
- center_url = h.url_for( controller='tool_browser', action='browse_tools', message=message, status=status )
+ center_url = h.url_for( controller='tool', action='browse_tools', message=message, status=status )
%>
<iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"> </iframe>
</%def>
diff -r 83102f27fd1d -r ba5b796311f3 templates/webapps/community/tool/browse_tool.mako
--- a/templates/webapps/community/tool/browse_tool.mako Mon Apr 26 17:02:37 2010 -0400
+++ b/templates/webapps/community/tool/browse_tool.mako Tue Apr 27 09:32:38 2010 -0400
@@ -29,7 +29,7 @@
</thead>
<tbody>
<tr class="formRow id="toolRow">
- <td><a href="${h.url_for( controller='tool_browser', action='browse', id=trans.security.encode_id( tool.id ) )}">${tool.name}</a></td>
+ <td><a href="${h.url_for( controller='tool', action='browse', id=trans.security.encode_id( tool.id ) )}">${tool.name}</a></td>
<td>${tool.description}</td>
</tr>
</tbody>
diff -r 83102f27fd1d -r ba5b796311f3 templates/webapps/community/tool/view_tool.mako
--- a/templates/webapps/community/tool/view_tool.mako Mon Apr 26 17:02:37 2010 -0400
+++ b/templates/webapps/community/tool/view_tool.mako Tue Apr 27 09:32:38 2010 -0400
@@ -19,7 +19,7 @@
<div class="toolFormTitle">${tool.name} <em>${tool.description}</em> ${tool.version} (ID: ${tool.tool_id})</div>
<div class="toolFormBody">
<div class="form-row">
- Uploaded by <a href="${h.url_for(controller='tool_browser', action='user_tools')}">${tool.user.username}</a> on ${tool.create_time.strftime('%B %d, %Y')}
+ Uploaded by <a href="${h.url_for(controller='tool', action='user_tools')}">${tool.user.username}</a> on ${tool.create_time.strftime('%B %d, %Y')}
<div style="clear: both"></div>
</div>
<div class="form-row">
@@ -36,12 +36,12 @@
</div>
<div class="form-row">
<label>Download:</label>
- <a href="${h.url_for(controller='tool_browser', action='download_tool', id=trans.app.security.encode_id( tool.id ))}"><img src="${h.url_for('/static/images/silk/page_white_compressed.png')}"> ${tool.tool_id}_${tool.version}</a>
+ <a href="${h.url_for(controller='tool', action='download_tool', id=trans.app.security.encode_id( tool.id ))}"><img src="${h.url_for('/static/images/silk/page_white_compressed.png')}"> ${tool.tool_id}_${tool.version}</a>
<div style="clear: both"></div>
</div>
%if trans.user.id == tool.user_id:
<div class="form-row">
- <em>This is your tool. You may <a href="${h.url_for(controller='tool_browser', action='edit_tool', id=trans.app.security.encode_id( tool.id ) )}">edit it</a>.</em>
+ <em>This is your tool. You may <a href="${h.url_for(controller='tool', action='edit_tool', id=trans.app.security.encode_id( tool.id ) )}">edit it</a>.</em>
<div style="clear: both"></div>
</div>
%endif
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/83102f27fd1d
changeset: 3698:83102f27fd1d
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Mon Apr 26 17:02:37 2010 -0400
description:
Community space fixes and enhancements: separate the ToolListGrids into both controllers, add a new common controller for common methods across admin and tool_browser, first pass of tool category and tool state features.
diffstat:
lib/galaxy/web/controllers/requests_admin.py | 2 +-
lib/galaxy/webapps/community/controllers/admin.py | 137 +++++++-
lib/galaxy/webapps/community/controllers/common.py | 166 ++++++++++
lib/galaxy/webapps/community/controllers/tool_browser.py | 119 +++----
lib/galaxy/webapps/community/controllers/upload.py | 26 +-
lib/galaxy/webapps/community/model/__init__.py | 68 ++-
lib/galaxy/webapps/community/model/mapping.py | 28 +-
lib/galaxy/webapps/community/model/migrate/versions/0001_initial_tables.py | 14 +-
templates/webapps/community/admin/category/category_create.mako | 35 --
templates/webapps/community/admin/category/category_rename.mako | 44 --
templates/webapps/community/admin/category/grid.mako | 1 -
templates/webapps/community/admin/category/role.mako | 118 -------
templates/webapps/community/admin/index.mako | 2 +-
templates/webapps/community/category/add_to_category.mako | 24 +
templates/webapps/community/category/create_category.mako | 35 ++
templates/webapps/community/category/grid.mako | 1 +
templates/webapps/community/category/rename_category.mako | 44 ++
templates/webapps/community/tool/edit_tool.mako | 99 ++---
templates/webapps/community/upload/upload.mako | 15 +
19 files changed, 617 insertions(+), 361 deletions(-)
diffs (1285 lines):
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Mon Apr 26 17:02:37 2010 -0400
@@ -48,7 +48,7 @@
elif request.state() == request.states.COMPLETE:
return '<div class="count-box state-color-ok">%s</div>' % request.state()
return request.state()
- def filter( self, db_session, user, query, column_filter ):
+ def filter( self, trans, user, query, column_filter ):
""" Modify query to filter request by state. """
if column_filter == "All":
return query
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/controllers/admin.py
--- a/lib/galaxy/webapps/community/controllers/admin.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/admin.py Mon Apr 26 17:02:37 2010 -0400
@@ -1,8 +1,8 @@
from galaxy.web.base.controller import *
-#from galaxy.web.controllers.admin import get_user, get_group, get_role
from galaxy.webapps.community import model
from galaxy.model.orm import *
from galaxy.web.framework.helpers import time_ago, iff, grids
+from common import get_categories, get_category
import logging
log = logging.getLogger( __name__ )
@@ -294,7 +294,7 @@
webapp = "community"
title = "Categories"
model_class = model.Category
- template='/webapps/community/admin/category/grid.mako'
+ template='/webapps/community/category/grid.mako'
default_sort_key = "name"
columns = [
NameColumn( "Name",
@@ -346,15 +346,133 @@
def build_initial_query( self, session ):
return session.query( self.model_class )
+# States for passing messages
+SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
+
+class ToolListGrid( grids.Grid ):
+ class NameColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ return tool.name
+ class CategoryColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ if tool.categories:
+ rval = ''
+ for tca in tool.categories:
+ rval = '%s%s<br/>' % ( rval, tca.category.name )
+ return rval
+ return 'not set'
+ class StateColumn( grids.GridColumn ):
+ def get_value( self, trans, grid, tool ):
+ state = tool.state()
+ if state == tool.states.NEW:
+ return '<div class="count-box state-color-queued">%s</div>' % state
+ if state == tool.states.WAITING:
+ return '<div class="count-box state-color-running">%s</div>' % state
+ if state == tool.states.APPROVED:
+ return '<div class="count-box state-color-ok">%s</div>' % state
+ if state == tool.states.REJECTED or state == tool.states.ERROR:
+ return '<div class="count-box state-color-error">%s</div>' % state
+ return state
+ def get_accepted_filters( self ):
+ """ Returns a list of accepted filters for this column."""
+ accepted_filter_labels_and_vals = [ model.Tool.states.NEW,
+ model.Tool.states.WAITING,
+ model.Tool.states.APPROVED,
+ model.Tool.states.REJECTED,
+ model.Tool.states.DELETED,
+ "All" ]
+ accepted_filters = []
+ for val in accepted_filter_labels_and_vals:
+ label = val.lower()
+ args = { self.key: val }
+ accepted_filters.append( grids.GridColumnFilter( label, args ) )
+ return accepted_filters
+ class UserColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ return tool.user.email
+ # Grid definition
+ title = "Tools"
+ model_class = model.Tool
+ template='/webapps/community/tool/grid.mako'
+ default_sort_key = "name"
+ columns = [
+ NameColumn( "Name",
+ key="name",
+ model_class=model.Tool,
+ link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
+ attach_popup=True,
+ filterable="advanced" ),
+ CategoryColumn( "Category",
+ key="category",
+ model_class=model.Category,
+ attach_popup=False,
+ filterable="advanced" ),
+ StateColumn( "State",
+ key="state",
+ model_class=model.Event,
+ attach_popup=False,
+ filterable="advanced" ),
+ # Columns that are valid for filtering but are not visible.
+ grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" )
+ ]
+ columns.append( grids.MulticolFilterColumn( "Search",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search",
+ visible=False,
+ filterable="standard" ) )
+ global_actions = [
+ grids.GridAction( "Upload tool", dict( controller='upload', action='upload', type='tool' ) )
+ ]
+ operations = [
+ grids.GridOperation( "Add to category",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="add_category", cntrller="admin", webapp="community" ) ),
+ grids.GridOperation( "Remove from category",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="remove_category", cntrller="admin", webapp="community" ) ),
+ grids.GridOperation( "View versions", condition=( lambda item: not item.deleted ), allow_multiple=False )
+ ]
+ standard_filters = [
+ grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
+ grids.GridColumnFilter( "All", args=dict( deleted='All' ) )
+ ]
+ default_filter = dict( name="All", deleted="False" )
+ num_rows_per_page = 50
+ preserve_state = False
+ use_paging = True
+ def build_initial_query( self, session ):
+ return session.query( self.model_class )
+ def apply_default_filter( self, trans, query, **kwargs ):
+ return query.filter( self.model_class.deleted==False )
+
class AdminCommunity( BaseController, Admin ):
user_list_grid = UserListGrid()
role_list_grid = RoleListGrid()
group_list_grid = GroupListGrid()
category_list_grid = CategoryListGrid()
+ tool_list_grid = ToolListGrid()
@web.expose
@web.require_admin
+ def browse_tools( self, trans, **kwargs ):
+ if 'operation' in kwargs:
+ operation = kwargs['operation'].lower()
+ if operation == "browse":
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='browse_tool',
+ **kwargs ) )
+ elif operation == "edit tool":
+ return trans.response.send_redirect( web.url_for( controller='common',
+ action='edit_tool',
+ cntrller='admin',
+ **kwargs ) )
+ # Render the list view
+ return self.tool_list_grid( trans, **kwargs )
+ @web.expose
+ @web.require_admin
def categories( self, trans, **kwargs ):
if 'operation' in kwargs:
operation = kwargs['operation'].lower()
@@ -401,7 +519,7 @@
webapp=webapp,
message=util.sanitize_text( message ),
status='error' ) )
- return trans.fill_template( '/webapps/community/admin/category/category_create.mako',
+ return trans.fill_template( '/webapps/community/category/create_category.mako',
webapp=webapp,
message=message,
status=status )
@@ -442,7 +560,7 @@
webapp=webapp,
message=util.sanitize_text( message ),
status='done' ) )
- return trans.fill_template( '/webapps/community/admin/category/category_rename.mako',
+ return trans.fill_template( '/webapps/community/category/rename_category.mako',
category=category,
webapp=webapp,
message=message,
@@ -546,14 +664,3 @@
webapp=webapp,
message=util.sanitize_text( message ),
status='done' ) )
-
-## ---- Utility methods -------------------------------------------------------
-
-def get_category( trans, id ):
- """Get a User from the database by id."""
- # Load user from database
- id = trans.security.decode_id( id )
- category = trans.sa_session.query( trans.model.Category ).get( id )
- if not category:
- return trans.show_error_message( "Category not found for id (%s)" % str( id ) )
- return category
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/controllers/common.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/webapps/community/controllers/common.py Mon Apr 26 17:02:37 2010 -0400
@@ -0,0 +1,166 @@
+from galaxy.web.base.controller import *
+#from galaxy.web.controllers.admin import get_user, get_group, get_role
+from galaxy.webapps.community import model
+from galaxy.model.orm import *
+from galaxy.web.framework.helpers import time_ago, iff, grids
+from galaxy.web.form_builder import SelectField
+import logging
+log = logging.getLogger( __name__ )
+
+class CommunityCommon( BaseController ):
+ @web.expose
+ def edit_tool( self, trans, cntrller, id=None, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ # Get the tool
+ tool = None
+ if id is not None:
+ encoded_id = id
+ id = trans.app.security.decode_id( id )
+ tool = trans.sa_session.query( trans.model.Tool ).get( id )
+ if tool is None:
+ return trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ message='Please select a Tool to edit (the tool ID provided was invalid)',
+ status='error' ) )
+ if params.save_button and ( params.file_data != '' or params.url != '' ):
+ # TODO: call the upload method in the upload controller.
+ message = 'Uploading new version not implemented'
+ status = 'error'
+ elif params.save_button:
+ tool.user_description = util.restore_text( params.description )
+ categories = []
+ set_categories( trans, tool, util.listify( params.category_id ) )
+ trans.sa_session.add( tool )
+ trans.sa_session.flush()
+ return trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ message="Saved categories and description for tool '%s'" % tool.name,
+ status='done' ) )
+ categories = trans.sa_session.query( trans.model.Category ).order_by( trans.model.Category.table.c.name ).all()
+ return trans.fill_template( '/webapps/community/tool/edit_tool.mako',
+ cntrller=cntrller,
+ encoded_id = encoded_id,
+ tool=tool,
+ categories=categories,
+ message=message,
+ status=status )
+ @web.expose
+ def view_tool( self, trans, cntrller, id=None, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ # Get the tool
+ tool = None
+ if id is not None:
+ id = trans.app.security.decode_id( id )
+ tool = trans.sa_session.query( trans.model.Tool ).get( id )
+ if tool is None:
+ return trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ message='Please select a Tool to edit (the tool ID provided was invalid)',
+ status='error' ) )
+ return trans.fill_template( '/webapps/community/tool/view_tool.mako',
+ tool=tool,
+ message=message,
+ status=status )
+ @web.expose
+ def add_category( self, trans, cntrller, **kwd ):
+ # TODO: we currently assume we are setting a tool category, so this method may need
+ # tweaking if / when we decide to set history or workflow categories
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
+ id = params.get( 'id', None )
+ # TODO: redirect if no id
+ tool = trans.sa_session.query( trans.model.Tool ).get( trans.security.decode_id( id ) )
+ if params.get( 'add_category_button', False ):
+ category_ids = util.listify( params.get( 'category_id', '' ) )
+ # TODO: redirect if no category_id
+ message = "The tool '%s' has been added to the categories: " % ( tool.name )
+ for category_id in category_ids:
+ category = trans.sa_session.query( trans.model.Category ).get( trans.security.decode_id( category_id ) )
+ tca = trans.app.model.ToolCategoryAssociation( tool, category )
+ trans.sa_session.add( tca )
+ trans.sa_session.flush()
+ message += " %s " % category.name
+ trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ use_panels=use_panels,
+ cntrller=cntrller,
+ message=util.sanitize_text( message ),
+ status=status ) )
+ category_select_list = SelectField( 'category_id', multiple=True )
+ for category in get_unassociated_categories( trans, tool ):
+ category_select_list.add_option( category.name, trans.security.encode_id( category.id ) )
+ return trans.fill_template( '/webapps/community/category/add_to_category.mako',
+ cntrller=cntrller,
+ id=id,
+ category_select_list=category_select_list,
+ use_panels=use_panels )
+ @web.expose
+ def remove_category( self, trans, cntrller, **kwd ):
+ # TODO: we currently assume we are setting a tool category, so this method may need
+ # tweaking if / when we decide to set history or workflow categories
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ use_panels = util.string_as_bool( params.get( 'use_panels', False ) )
+ id = params.get( 'id', None )
+ # TODO: redirect if no id
+ tool = trans.sa_session.query( trans.model.Tool ).get( trans.security.decode_id( id ) )
+ category_id = params.get( 'category_id', None )
+ category = trans.sa_session.query( trans.model.Category ).get( trans.security.decode_id( category_id ) )
+ # TODO: redirect if no category_id
+ for tca in tool.categories:
+ if tca.category == category:
+ trans.sa_session.delete( tca )
+ trans.sa_session.flush()
+ break
+ message = "The tool '%s' has been removed from the category '%s'" % ( tool.name, category.name )
+ trans.response.send_redirect( web.url_for( controller=cntrller,
+ action='browse_tools',
+ use_panels=use_panels,
+ cntrller=cntrller,
+ message=util.sanitize_text( message ),
+ status=status ) )
+
+## ---- Utility methods -------------------------------------------------------
+
+def get_categories( trans ):
+ """Get all categories from the database"""
+ return trans.sa_session.query( trans.model.Category ) \
+ .filter( trans.model.Category.table.c.deleted==False ) \
+ .order_by( trans.model.Category.table.c.name )
+def get_unassociated_categories( trans, obj ):
+ """Get all categories from the database that are not associated with obj"""
+ # TODO: we currently assume we are setting a tool category, so this method may need
+ # tweaking if / when we decide to set history or workflow categories
+ associated_categories = []
+ for tca in obj.categories:
+ associated_categories.append( tca.category )
+ categories = []
+ for category in get_categories( trans ):
+ if category not in associated_categories:
+ categories.append( category )
+ return categories
+def get_category( trans, id ):
+ """Get a Category from the database by id."""
+ # Load user from database
+ id = trans.security.decode_id( id )
+ category = trans.sa_session.query( trans.model.Category ).get( id )
+ if not category:
+ return trans.show_error_message( "Category not found for id (%s)" % str( id ) )
+ return category
+def set_categories( trans, obj, category_ids, delete_existing_assocs=True ):
+ if delete_existing_assocs:
+ for assoc in obj.categories:
+ trans.sa_session.delete( assoc )
+ trans.sa_session.flush()
+ for category_id in category_ids:
+ # TODO: we currently assume we are setting a tool category, so this method may need
+ # tweaking if / when we decide to set history or workflow categories
+ category = trans.sa_session.query( trans.model.Category ).get( category_id )
+ obj.categories.append( trans.model.ToolCategoryAssociation( obj, category ) )
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/controllers/tool_browser.py
--- a/lib/galaxy/webapps/community/controllers/tool_browser.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/tool_browser.py Mon Apr 26 17:02:37 2010 -0400
@@ -4,6 +4,7 @@
from galaxy.webapps.community import model
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.model.orm import *
+from common import *
log = logging.getLogger( __name__ )
@@ -13,15 +14,41 @@
class ToolListGrid( grids.Grid ):
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool ):
- if tool.name:
- return tool.name
- return 'not set'
+ return tool.name
class CategoryColumn( grids.TextColumn ):
def get_value( self, trans, grid, tool ):
- if tool.category:
- return tool.category
+ if tool.categories:
+ return tool.categories
return 'not set'
-
+ class StateColumn( grids.GridColumn ):
+ def get_value( self, trans, grid, tool ):
+ state = tool.state()
+ if state == tool.states.NEW:
+ return '<div class="count-box state-color-queued">%s</div>' % state
+ if state == tool.states.WAITING:
+ return '<div class="count-box state-color-running">%s</div>' % state
+ if state == tool.states.APPROVED:
+ return '<div class="count-box state-color-ok">%s</div>' % state
+ if state == tool.states.REJECTED or state == tool.states.ERROR:
+ return '<div class="count-box state-color-error">%s</div>' % state
+ return state
+ def get_accepted_filters( self ):
+ """ Returns a list of accepted filters for this column."""
+ accepted_filter_labels_and_vals = [ model.Tool.states.NEW,
+ model.Tool.states.WAITING,
+ model.Tool.states.APPROVED,
+ model.Tool.states.REJECTED,
+ model.Tool.states.DELETED,
+ "All" ]
+ accepted_filters = []
+ for val in accepted_filter_labels_and_vals:
+ label = val.lower()
+ args = { self.key: val }
+ accepted_filters.append( grids.GridColumnFilter( label, args ) )
+ return accepted_filters
+ class UserColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, tool ):
+ return tool.user.email
# Grid definition
title = "Tools"
model_class = model.Tool
@@ -31,9 +58,15 @@
NameColumn( "Name",
key="name",
model_class=model.Tool,
- link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
- attach_popup=False,
+ link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
+ attach_popup=True,
filterable="advanced" ),
+ CategoryColumn( "Category",
+ key="category",
+ model_class=model.Category,
+ link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
+ attach_popup=False,
+ filterable="advanced" ),
# Columns that are valid for filtering but are not visible.
grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" )
]
@@ -46,6 +79,14 @@
grids.GridAction( "Upload tool", dict( controller='upload', action='upload', type='tool' ) )
]
operations = [
+ grids.GridOperation( "Add to category",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="add_category", webapp="community" ) ),
+ grids.GridOperation( "Remove from category",
+ condition=( lambda item: not item.deleted ),
+ allow_multiple=False,
+ url_args=dict( controller="common", action="remove_category", webapp="community" ) ),
grids.GridOperation( "View versions", condition=( lambda item: not item.deleted ), allow_multiple=False )
]
standard_filters = [
@@ -84,8 +125,9 @@
action='view_tool',
**kwargs ) )
elif operation == "edit tool":
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ return trans.response.send_redirect( web.url_for( controller='common',
action='edit_tool',
+ cntrller='tool_browser',
**kwargs ) )
# Render the list view
return self.tool_list_grid( trans, **kwargs )
@@ -99,65 +141,6 @@
message=message,
status=status )
@web.expose
- def view_tool( self, trans, id=None, **kwd ):
- params = util.Params( kwd )
- message = util.restore_text( params.get( 'message', '' ) )
- status = params.get( 'status', 'done' )
- # Get the tool
- tool = None
- if id is not None:
- id = trans.app.security.decode_id( id )
- tool = trans.sa_session.query( trans.model.Tool ).get( id )
- if tool is None:
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='browse_tools',
- message='Please select a Tool to edit (the tool ID provided was invalid)',
- status='error' ) )
- return trans.fill_template( '/webapps/community/tool/view_tool.mako',
- tool=tool,
- message=message,
- status=status )
- @web.expose
- def edit_tool( self, trans, id=None, **kwd ):
- params = util.Params( kwd )
- message = util.restore_text( params.get( 'message', '' ) )
- status = params.get( 'status', 'done' )
- # Get the tool
- tool = None
- if id is not None:
- id = trans.app.security.decode_id( id )
- tool = trans.sa_session.query( trans.model.Tool ).get( id )
- if tool is None:
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='browse_tools',
- message='Please select a Tool to edit (the tool ID provided was invalid)',
- status='error' ) )
- if tool.user_id != trans.user.id:
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='view_tool',
- message='You are not the owner of this tool and therefore cannot edit it',
- status='error' ) )
- if params.save_button and ( params.file_data != '' or params.url != '' ):
- # TODO: call the upload method in the upload controller.
- message = 'Uploading new version not implemented'
- status = 'error'
- elif params.save_button:
- tool.user_description = util.restore_text( params.description )
- categories = []
- tool.set_categories( trans, util.listify( params.category ) )
- trans.sa_session.add( tool )
- trans.sa_session.flush()
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
- action='browse_tools',
- message='Saved categories and description for %s' % tool.name,
- status='done' ) )
- categories = trans.sa_session.query( trans.model.Category ).order_by( trans.model.Category.table.c.name ).all()
- return trans.fill_template( '/webapps/community/tool/edit_tool.mako',
- tool=tool,
- categories=categories,
- message=message,
- status=status )
- @web.expose
def download_tool( self, trans, id=None, **kwd ):
params = util.Params( kwd )
tool = None
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/controllers/upload.py
--- a/lib/galaxy/webapps/community/controllers/upload.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Mon Apr 26 17:02:37 2010 -0400
@@ -1,9 +1,9 @@
import sys, os, shutil, logging, urllib2
-
from galaxy.web.base.controller import *
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.model.orm import *
from galaxy.webapps.community import datatypes
+from common import get_categories, get_category
log = logging.getLogger( __name__ )
@@ -17,6 +17,7 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
+ category_ids = util.listify( params.get( 'category_id', '' ) )
uploaded_file = None
if params.file_data == '' and params.url.strip() == '':
message = 'No files were entered on the upload form.'
@@ -35,22 +36,36 @@
if params.upload_button and uploaded_file:
datatype = trans.app.datatypes_registry.get_datatype_by_extension( params.upload_type )
if datatype is None:
- message = 'An unknown filetype was selected. This should not be possble, please report the error.'
+ message = 'An unknown file type was selected. This should not be possible, please report the error.'
status = 'error'
else:
try:
+ # Initialize the tool object
meta = datatype.verify( uploaded_file )
meta.user = trans.user
meta.guid = trans.app.security.get_new_guid()
obj = datatype.create_model_object( meta )
trans.sa_session.add( obj )
+ if isinstance( obj, trans.app.model.Tool ):
+ if category_ids:
+ for category_id in category_ids:
+ category = trans.app.model.Category.get( trans.security.decode_id( category_id ) )
+ # Initialize the tool category
+ tca = trans.app.model.ToolCategoryAssociation( obj, category )
+ trans.sa_session.add( tca )
+ # Initialize the tool event
+ event = trans.app.model.Event( trans.app.model.Tool.states.NEW )
+ tea = trans.app.model.ToolEventAssociation( obj, event )
+ trans.sa_session.add_all( ( event, tea ) )
trans.sa_session.flush()
try:
os.link( uploaded_file.name, obj.file_name )
except OSError:
shutil.copy( uploaded_file.name, obj.file_name )
- return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ # We're setting cntrller to 'tool_browser' since that is the only controller from which we can upload
+ return trans.response.send_redirect( web.url_for( controller='common',
action='edit_tool',
+ cntrller='tool_browser',
id=trans.app.security.encode_id( obj.id ),
message='Uploaded %s' % meta.message,
status='done' ) )
@@ -62,8 +77,11 @@
status = 'error'
uploaded_file.close()
selected_upload_type = params.get( 'type', 'tool' )
+ selected_categories = [ trans.security.decode_id( id ) for id in category_ids ]
return trans.fill_template( '/webapps/community/upload/upload.mako',
message=message,
status=status,
selected_upload_type=selected_upload_type,
- upload_types=trans.app.datatypes_registry.get_datatypes_for_select_list() )
+ upload_types=trans.app.datatypes_registry.get_datatypes_for_select_list(),
+ selected_categories=selected_categories,
+ categories=get_categories( trans ) )
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/model/__init__.py
--- a/lib/galaxy/webapps/community/model/__init__.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/webapps/community/model/__init__.py Mon Apr 26 17:02:37 2010 -0400
@@ -87,6 +87,12 @@
class Tool( object ):
file_path = '/tmp'
+ states = Bunch( NEW = 'new',
+ ERROR = 'error',
+ DELETED = 'deleted',
+ WAITING = 'waiting for approval',
+ APPROVED = 'approved',
+ REJECTED = 'rejected' )
def __init__( self, guid=None, tool_id=None, name=None, description=None, user_description=None, category=None, version=None, user_id=None, external_filename=None ):
self.guid = guid
self.tool_id = tool_id
@@ -124,15 +130,27 @@
self.description = datatype_bunch.description
self.version = datatype_bunch.version
self.user_id = datatype_bunch.user.id
- def set_categories( self, trans, categories, delete_existing_assocs=True ):
- if delete_existing_assocs:
- for a in self.categories:
- trans.sa_session.delete( a )
- trans.sa_session.flush()
- for category in categories:
- if not isinstance( category, Category ):
- category = trans.sa_session.query( Category ).get( int( category ) )
- self.categories.append( ToolCategoryAssociation( self, category ) )
+ def state( self ):
+ if self.events:
+ return self.events[0].event.state
+ return None
+ def last_comment( self ):
+ if self.events:
+ if self.events[0].comment:
+ return self.events[0].comment
+ else:
+ return ''
+ return 'No comment'
+ def is_new( self ):
+ return self.state() == self.states.NEW
+ def is_error( self ):
+ return self.state() == self.states.ERROR
+ def is_deleted( self ):
+ return self.state() == self.states.DELETED
+ def is_approved( self ):
+ return self.state() == self.states.APPROVED
+ def is_rejected( self ):
+ return self.state() == self.states.REJECTED
@property
def extension( self ):
# if instantiated via a query, this unmapped property won't exist
@@ -162,6 +180,27 @@
def mimetype( self ):
return mimetypes.guess_type( self.download_file_name )[0]
+class Event( object ):
+ def __init__( self, state=None, comment='' ):
+ self.state = state
+ self.comment = comment
+
+class ToolEventAssociation( object ):
+ def __init__( self, tool=None, event=None ):
+ self.tool = tool
+ self.event = event
+
+class Category( object ):
+ def __init__( self, name=None, description=None, deleted=False ):
+ self.name = name
+ self.description = description
+ self.deleted = deleted
+
+class ToolCategoryAssociation( object ):
+ def __init__( self, tool=None, category=None ):
+ self.tool = tool
+ self.category = category
+
class Tag ( object ):
def __init__( self, id=None, type=None, parent_id=None, name=None ):
self.id = id
@@ -170,12 +209,6 @@
self.name = name
def __str__ ( self ):
return "Tag(id=%s, type=%i, parent_id=%s, name=%s)" % ( self.id, self.type, self.parent_id, self.name )
-
-class Category( object ):
- def __init__( self, name=None, description=None, deleted=False ):
- self.name = name
- self.description = description
- self.deleted = deleted
class ItemTagAssociation ( object ):
def __init__( self, id=None, user=None, item_id=None, tag_id=None, user_tname=None, value=None ):
@@ -193,11 +226,6 @@
class ToolAnnotationAssociation( object ):
pass
-class ToolCategoryAssociation( object ):
- def __init__( self, tool=None, category=None ):
- self.tool = tool
- self.category = category
-
## ---- Utility methods -------------------------------------------------------
def directory_hash_id( id ):
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/model/mapping.py
--- a/lib/galaxy/webapps/community/model/mapping.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/webapps/community/model/mapping.py Mon Apr 26 17:02:37 2010 -0400
@@ -112,7 +112,7 @@
Column( "version", TrimmedString( 255 ) ),
Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
Column( "external_filename" , TEXT ),
- Column( "deleted", Boolean, default=False ) )
+ Column( "deleted", Boolean, index=True, default=False ) )
Category.table = Table( "category", metadata,
Column( "id", Integer, primary_key=True ),
@@ -127,6 +127,18 @@
Column( "tool_id", Integer, ForeignKey( "tool.id" ), index=True ),
Column( "category_id", Integer, ForeignKey( "category.id" ), index=True ) )
+Event.table = Table( 'event', metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "create_time", DateTime, default=now ),
+ Column( "update_time", DateTime, default=now, onupdate=now ),
+ Column( "state", TrimmedString( 255 ), index=True ),
+ Column( "comment", TEXT ) )
+
+ToolEventAssociation.table = Table( "tool_event_association", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "tool_id", Integer, ForeignKey( "tool.id" ), index=True ),
+ Column( "event_id", Integer, ForeignKey( "event.id" ), index=True ) )
+
Tag.table = Table( "tag", metadata,
Column( "id", Integer, primary_key=True ),
Column( "type", Integer ),
@@ -202,7 +214,17 @@
assign_mapper( context, Tool, Tool.table,
properties = dict(
categories=relation( ToolCategoryAssociation ),
+ events=relation( ToolEventAssociation ),
user=relation( User.mapper )
+ ) )
+
+assign_mapper( context, Event, Event.table,
+ properties=None )
+
+assign_mapper( context, ToolEventAssociation, ToolEventAssociation.table,
+ properties=dict(
+ tool=relation( Tool ),
+ event=relation( Event )
)
)
@@ -211,8 +233,8 @@
assign_mapper( context, ToolCategoryAssociation, ToolCategoryAssociation.table,
properties=dict(
- category=relation(Category),
- tool=relation(Tool)
+ category=relation( Category ),
+ tool=relation( Tool )
)
)
diff -r 054527415fac -r 83102f27fd1d lib/galaxy/webapps/community/model/migrate/versions/0001_initial_tables.py
--- a/lib/galaxy/webapps/community/model/migrate/versions/0001_initial_tables.py Mon Apr 26 15:40:52 2010 -0400
+++ b/lib/galaxy/webapps/community/model/migrate/versions/0001_initial_tables.py Mon Apr 26 17:02:37 2010 -0400
@@ -89,7 +89,19 @@
Column( "version", TrimmedString( 255 ) ),
Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
Column( "external_filename" , TEXT ),
- Column( "deleted", Boolean, default=False ) )
+ Column( "deleted", Boolean, index=True, default=False ) )
+
+Event_table = Table( 'event', metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "create_time", DateTime, default=now ),
+ Column( "update_time", DateTime, default=now, onupdate=now ),
+ Column( "state", TrimmedString( 255 ), index=True ),
+ Column( "comment", TEXT ) )
+
+ToolEventAssociation_table = Table( "tool_event_association", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "tool_id", Integer, ForeignKey( "tool.id" ), index=True ),
+ Column( "event_id", Integer, ForeignKey( "event.id" ), index=True ) )
Category_table = Table( "category", metadata,
Column( "id", Integer, primary_key=True ),
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/admin/category/category_create.mako
--- a/templates/webapps/community/admin/category/category_create.mako Mon Apr 26 15:40:52 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%def name="javascripts()">
- ${parent.javascripts()}
- <script type="text/javascript">
- $(function(){
- $("input:text:first").focus();
- })
- </script>
-</%def>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Create Role</div>
- <div class="toolFormBody">
- <form name="create_category_form" id="create_category_form" action="${h.url_for( action='create_category' )}" method="post" >
- <div class="form-row">
- <input name="webapp" type="hidden" value="${webapp}" size=40"/>
- <label>Name:</label>
- <input name="name" type="textfield" value="" size=40"/>
- </div>
- <div class="form-row">
- <label>Description:</label>
- <input name="description" type="textfield" value="" size=40"/>
- </div>
- <div class="form-row">
- <input type="submit" name="create_category_button" value="Save"/>
- </div>
- </form>
- </div>
-</div>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/admin/category/category_rename.mako
--- a/templates/webapps/community/admin/category/category_rename.mako Mon Apr 26 15:40:52 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Change category name and description</div>
- <div class="toolFormBody">
- <form name="library" action="${h.url_for( controller='admin', action='rename_category' )}" method="post" >
- <div class="form-row">
- <input name="webapp" type="hidden" value="${webapp}" size=40"/>
- <label>Name:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="text" name="name" value="${category.name}" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>Description:</label>
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input name="description" type="textfield" value="${category.description}" size=40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="rename" value="submitted"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="id" value="${trans.security.encode_id( category.id )}"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="rename_category_button" value="Save"/>
- </div>
- </form>
- </div>
-</div>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/admin/category/grid.mako
--- a/templates/webapps/community/admin/category/grid.mako Mon Apr 26 15:40:52 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-<%inherit file="/grid_base.mako"/>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/admin/category/role.mako
--- a/templates/webapps/community/admin/category/role.mako Mon Apr 26 15:40:52 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%def name="javascripts()">
- ${parent.javascripts()}
- <script type="text/javascript">
- $(function(){
- $("input:text:first").focus();
- })
- </script>
-</%def>
-
-<%def name="render_select( name, options )">
- <select name="${name}" id="${name}" style="min-width: 250px; height: 150px;" multiple>
- %for option in options:
- <option value="${option[0]}">${option[1]}</option>
- %endfor
- </select>
-</%def>
-
-<script type="text/javascript">
-$().ready(function() {
- $('#users_add_button').click(function() {
- return !$('#out_users option:selected').remove().appendTo('#in_users');
- });
- $('#users_remove_button').click(function() {
- return !$('#in_users option:selected').remove().appendTo('#out_users');
- });
- $('#groups_add_button').click(function() {
- return !$('#out_groups option:selected').remove().appendTo('#in_groups');
- });
- $('#groups_remove_button').click(function() {
- return !$('#in_groups option:selected').remove().appendTo('#out_groups');
- });
- $('form#associate_role_user_group').submit(function() {
- $('#in_users option').each(function(i) {
- $(this).attr("selected", "selected");
- });
- $('#in_groups option').each(function(i) {
- $(this).attr("selected", "selected");
- });
- });
-});
-</script>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Role '${role.name}'</div>
- <div class="toolFormBody">
- <form name="associate_role_user_group" id="associate_role_user_group" action="${h.url_for( action='manage_users_and_groups_for_role', id=trans.security.encode_id( role.id ) )}" method="post" >
- <input name="webapp" type="hidden" value="${webapp}" size=40"/>
- <div class="form-row">
- <div style="float: left; margin-right: 10px;">
- <label>Users associated with '${role.name}'</label>
- ${render_select( "in_users", in_users )}<br/>
- <input type="submit" id="users_remove_button" value=">>"/>
- </div>
- <div>
- <label>Users not associated with '${role.name}'</label>
- ${render_select( "out_users", out_users )}<br/>
- <input type="submit" id="users_add_button" value="<<"/>
- </div>
- </div>
- <div class="form-row">
- <div style="float: left; margin-right: 10px;">
- <label>Groups associated with '${role.name}'</label>
- ${render_select( "in_groups", in_groups )}<br/>
- <input type="submit" id="groups_remove_button" value=">>"/>
- </div>
- <div>
- <label>Groups not associated with '${role.name}'</label>
- ${render_select( "out_groups", out_groups )}<br/>
- <input type="submit" id="groups_add_button" value="<<"/>
- </div>
- </div>
- <div class="form-row">
- <input type="submit" name="role_members_edit_button" value="Save"/>
- </div>
- </form>
- </div>
-</div>
-<br clear="left"/>
-<br/>
-%if len( library_dataset_actions ) > 0:
- <h3>Data library datasets associated with role '${role.name}'</h3>
- <table class="manage-table colored" border="0" cellspacing="0" cellpadding="0" width="100%">
- <tr>
- <td>
- <ul>
- %for ctr, library, in enumerate( library_dataset_actions.keys() ):
- <li>
- <img src="${h.url_for( '/static/images/silk/book_open.png' )}" class="rowIcon"/>
- ${library.name}
- <ul>
- %for folder_path, permissions in library_dataset_actions[ library ].items():
- <li>
- <img src="/static/images/silk/folder_page.png" class="rowIcon"/>
- ${folder_path}
- <ul>
- % for permission in permissions:
- <ul>
- <li>${permission}</li>
- </ul>
- %endfor
- </ul>
- </li>
- %endfor
- </ul>
- </li>
- %endfor
- </ul>
- </td>
- </tr>
- </table>
-%endif
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/admin/index.mako
--- a/templates/webapps/community/admin/index.mako Mon Apr 26 15:40:52 2010 -0400
+++ b/templates/webapps/community/admin/index.mako Mon Apr 26 17:02:37 2010 -0400
@@ -85,7 +85,7 @@
</div>
<div class="toolSectionBody">
<div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='tool_browser', action='browse_tools', webapp='community' )}" target="galaxy_main">Manage tools</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='browse_tools', webapp='community' )}" target="galaxy_main">Manage tools</a></div>
</div>
</div>
<div class="toolSectionPad"></div>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/category/add_to_category.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/webapps/community/category/add_to_category.mako Mon Apr 26 17:02:37 2010 -0400
@@ -0,0 +1,24 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Select a category</div>
+ <div class="toolFormBody">
+ <form id="select_category" name="select_category" action="${h.url_for( controller='common', action='add_category', cntrller=cntrller, id=id, use_panels=use_panels )}" method="post" >
+ <div class="form-row">
+ <label>Category:</label>
+ ${category_select_list.get_html()}
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ Multi-select list - hold the appropriate key while clicking to select multiple columns
+ </div>
+ <div class="form-row">
+ <input type="submit" name="add_category_button" value="Add tool to categories"/>
+ </div>
+ </form>
+ </div>
+</div>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/category/create_category.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/webapps/community/category/create_category.mako Mon Apr 26 17:02:37 2010 -0400
@@ -0,0 +1,35 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<%def name="javascripts()">
+ ${parent.javascripts()}
+ <script type="text/javascript">
+ $(function(){
+ $("input:text:first").focus();
+ })
+ </script>
+</%def>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Create Role</div>
+ <div class="toolFormBody">
+ <form name="create_category_form" id="create_category_form" action="${h.url_for( action='create_category' )}" method="post" >
+ <div class="form-row">
+ <input name="webapp" type="hidden" value="${webapp}" size=40"/>
+ <label>Name:</label>
+ <input name="name" type="textfield" value="" size=40"/>
+ </div>
+ <div class="form-row">
+ <label>Description:</label>
+ <input name="description" type="textfield" value="" size=40"/>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="create_category_button" value="Save"/>
+ </div>
+ </form>
+ </div>
+</div>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/category/grid.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/webapps/community/category/grid.mako Mon Apr 26 17:02:37 2010 -0400
@@ -0,0 +1,1 @@
+<%inherit file="/grid_base.mako"/>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/category/rename_category.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/webapps/community/category/rename_category.mako Mon Apr 26 17:02:37 2010 -0400
@@ -0,0 +1,44 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Change category name and description</div>
+ <div class="toolFormBody">
+ <form name="library" action="${h.url_for( controller='admin', action='rename_category' )}" method="post" >
+ <div class="form-row">
+ <input name="webapp" type="hidden" value="${webapp}" size=40"/>
+ <label>Name:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input type="text" name="name" value="${category.name}" size="40"/>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Description:</label>
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input name="description" type="textfield" value="${category.description}" size=40"/>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input type="hidden" name="rename" value="submitted"/>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input type="hidden" name="id" value="${trans.security.encode_id( category.id )}"/>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="rename_category_button" value="Save"/>
+ </div>
+ </form>
+ </div>
+</div>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/tool/edit_tool.mako
--- a/templates/webapps/community/tool/edit_tool.mako Mon Apr 26 15:40:52 2010 -0400
+++ b/templates/webapps/community/tool/edit_tool.mako Mon Apr 26 17:02:37 2010 -0400
@@ -17,57 +17,56 @@
${render_msg( message, status )}
%endif
-<form id="tool_edit_form" name="tool_edit_form" action="${h.url_for( controller='tool_browser', action='edit_tool' )}" enctype="multipart/form-data" method="post">
-<input type="hidden" name="id" value="${trans.app.security.encode_id( tool.id )}"/>
-<div class="toolForm">
- <div class="toolFormTitle">Edit Tool</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>Categories:</label>
- <div class="form-row-input">
- <select name="category" multiple size=5 style="min-width: 250px;">
- %for category in categories:
- %if category.id in [ tool_category.id for tool_category in tool.categories ]:
- <option value="${category.id}" selected>${category.name}</option>
- %else:
- <option value="${category.id}">${category.name}</option>
- %endif
- %endfor
- </select>
+<form id="tool_edit_form" name="tool_edit_form" action="${h.url_for( controller='common', action='edit_tool' )}" enctype="multipart/form-data" method="post">
+ <input type="hidden" name="id" value="${trans.app.security.encode_id( tool.id )}"/>
+ <input type="hidden" name="cntrller" value="${cntrller}"/>
+ <div class="toolForm">
+ <div class="toolFormTitle">Edit Tool</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ <label>Categories:</label>
+ <div class="form-row-input">
+ <select name="category_id" multiple size=5 style="min-width: 250px;">
+ %for category in categories:
+ %if category.id in [ tool_category.id for tool_category in tool.categories ]:
+ <option value="${category.id}" selected>${category.name}</option>
+ %else:
+ <option value="${category.id}">${category.name}</option>
+ %endif
+ %endfor
+ </select>
+ </div>
+ <div style="clear: both"></div>
</div>
- <div style="clear: both"></div>
+ <div class="form-row">
+ <label>Description:</label>
+ <div class="form-row-input"><textarea name="description" rows="5" cols="35">${tool.user_description}</textarea></div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" class="primary-button" name="save_button" value="Save">
+ </div>
+ </div>
</div>
- <div class="form-row">
- <label>Description:</label>
- <div class="form-row-input"><textarea name="description" rows="5" cols="35">${tool.user_description}</textarea></div>
- <div style="clear: both"></div>
+ <p/>
+ <div class="toolForm">
+ <div class="toolFormTitle">Upload new version</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ <label>File:</label>
+ <div class="form-row-input"><input type="file" name="file_data"/></div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>URL:</label>
+ <div class="form-row-input"><input type="text" name="url" style="width: 100%;"/></div>
+ <div class="toolParamHelp" style="clear: both;">
+ Instead of uploading directly from your computer, you may instruct Galaxy to download the file from a Web or FTP address.
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" class="primary-button" name="save_button" value="Save">
+ </div>
</div>
- <div class="form-row">
- <input type="submit" class="primary-button" name="save_button" value="Save">
- </div>
- </div>
-</div>
-
-<p/>
-
-<div class="toolForm">
- <div class="toolFormTitle">Upload new version</div>
- <div class="toolFormBody">
- <div class="form-row">
- <label>File:</label>
- <div class="form-row-input"><input type="file" name="file_data"/></div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>URL:</label>
- <div class="form-row-input"><input type="text" name="url" style="width: 100%;"/></div>
- <div class="toolParamHelp" style="clear: both;">
- Instead of uploading directly from your computer, you may instruct Galaxy to download the file from a Web or FTP address.
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" class="primary-button" name="save_button" value="Save">
- </div>
-</div>
</form>
diff -r 054527415fac -r 83102f27fd1d templates/webapps/community/upload/upload.mako
--- a/templates/webapps/community/upload/upload.mako Mon Apr 26 15:40:52 2010 -0400
+++ b/templates/webapps/community/upload/upload.mako Mon Apr 26 17:02:37 2010 -0400
@@ -46,6 +46,21 @@
<div style="clear: both"></div>
</div>
<div class="form-row">
+ <label>Category</label>
+ <div class="form-row-input">
+ <select name="category_id">
+ %for category in categories:
+ %if category.id in selected_categories:
+ <option value="${trans.security.encode_id( category.id )}" selected>${category.name}</option>
+ %else:
+ <option value="${trans.security.encode_id( category.id )}">${category.name}</option>
+ %endif
+ %endfor
+ </select>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
<label>URL:</label>
<div class="form-row-input"><input type="text" name="url" style="width: 100%;"/></div>
<div class="toolParamHelp" style="clear: both;">
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/054527415fac
changeset: 3697:054527415fac
user: Nate Coraor <nate(a)bx.psu.edu>
date: Mon Apr 26 15:40:52 2010 -0400
description:
Community app: Add the "view tool" interface and make tools downloadable.
diffstat:
lib/galaxy/webapps/community/config.py | 3 +
lib/galaxy/webapps/community/controllers/tool_browser.py | 53 +++++++++++++-
lib/galaxy/webapps/community/controllers/upload.py | 1 +
lib/galaxy/webapps/community/datatypes/__init__.py | 2 +-
lib/galaxy/webapps/community/model/__init__.py | 31 ++++++++-
static/images/silk/page_white_compressed.png | 0
templates/webapps/community/tool/edit_tool.mako | 2 +-
templates/webapps/community/tool/view_tool.mako | 49 +++++++++++++
8 files changed, 134 insertions(+), 7 deletions(-)
diffs (261 lines):
diff -r 5002f66739e1 -r 054527415fac lib/galaxy/webapps/community/config.py
--- a/lib/galaxy/webapps/community/config.py Mon Apr 26 13:53:48 2010 -0400
+++ b/lib/galaxy/webapps/community/config.py Mon Apr 26 15:40:52 2010 -0400
@@ -62,6 +62,9 @@
self.log_events = False
self.cloud_controller_instance = False
self.datatypes_config = kwargs.get( 'datatypes_config_file', 'community_datatypes_conf.xml' )
+ # Proxy features
+ self.apache_xsendfile = kwargs.get( 'apache_xsendfile', False )
+ self.nginx_x_accel_redirect_base = kwargs.get( 'nginx_x_accel_redirect_base', False )
# Parse global_conf and save the parser
global_conf = kwargs.get( 'global_conf', None )
global_conf_parser = ConfigParser.ConfigParser()
diff -r 5002f66739e1 -r 054527415fac lib/galaxy/webapps/community/controllers/tool_browser.py
--- a/lib/galaxy/webapps/community/controllers/tool_browser.py Mon Apr 26 13:53:48 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/tool_browser.py Mon Apr 26 15:40:52 2010 -0400
@@ -1,4 +1,4 @@
-import sys, os, operator, string, shutil, re, socket, urllib, time, logging
+import sys, os, operator, string, shutil, re, socket, urllib, time, logging, mimetypes
from galaxy.web.base.controller import *
from galaxy.webapps.community import model
@@ -31,7 +31,7 @@
NameColumn( "Name",
key="name",
model_class=model.Tool,
- link=( lambda item: dict( operation="Edit Tool", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="View Tool", id=item.id, webapp="community" ) ),
attach_popup=False,
filterable="advanced" ),
# Columns that are valid for filtering but are not visible.
@@ -79,6 +79,10 @@
return trans.response.send_redirect( web.url_for( controller='tool_browser',
action='browse_tool',
**kwargs ) )
+ elif operation == "view tool":
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='view_tool',
+ **kwargs ) )
elif operation == "edit tool":
return trans.response.send_redirect( web.url_for( controller='tool_browser',
action='edit_tool',
@@ -95,6 +99,25 @@
message=message,
status=status )
@web.expose
+ def view_tool( self, trans, id=None, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ # Get the tool
+ tool = None
+ if id is not None:
+ id = trans.app.security.decode_id( id )
+ tool = trans.sa_session.query( trans.model.Tool ).get( id )
+ if tool is None:
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='browse_tools',
+ message='Please select a Tool to edit (the tool ID provided was invalid)',
+ status='error' ) )
+ return trans.fill_template( '/webapps/community/tool/view_tool.mako',
+ tool=tool,
+ message=message,
+ status=status )
+ @web.expose
def edit_tool( self, trans, id=None, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
@@ -102,7 +125,6 @@
# Get the tool
tool = None
if id is not None:
- encoded_id = id
id = trans.app.security.decode_id( id )
tool = trans.sa_session.query( trans.model.Tool ).get( id )
if tool is None:
@@ -110,6 +132,11 @@
action='browse_tools',
message='Please select a Tool to edit (the tool ID provided was invalid)',
status='error' ) )
+ if tool.user_id != trans.user.id:
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='view_tool',
+ message='You are not the owner of this tool and therefore cannot edit it',
+ status='error' ) )
if params.save_button and ( params.file_data != '' or params.url != '' ):
# TODO: call the upload method in the upload controller.
message = 'Uploading new version not implemented'
@@ -126,8 +153,26 @@
status='done' ) )
categories = trans.sa_session.query( trans.model.Category ).order_by( trans.model.Category.table.c.name ).all()
return trans.fill_template( '/webapps/community/tool/edit_tool.mako',
- encoded_id = encoded_id,
tool=tool,
categories=categories,
message=message,
status=status )
+ @web.expose
+ def download_tool( self, trans, id=None, **kwd ):
+ params = util.Params( kwd )
+ tool = None
+ # Get the tool
+ tool = None
+ if id is not None:
+ id = trans.app.security.decode_id( id )
+ tool = trans.sa_session.query( trans.model.Tool ).get( id )
+ if tool is None:
+ return trans.response.send_redirect( web.url_for( controller='tool_browser',
+ action='browse_tools',
+ message='Please select a Tool to edit (the tool ID provided was invalid)',
+ status='error' ) )
+
+ trans.response.set_content_type(tool.mimetype)
+ trans.response.headers['Content-Length'] = int( os.stat( tool.file_name ).st_size )
+ trans.response.headers['Content-Disposition'] = 'attachment; filename=%s' % tool.download_file_name
+ return open( tool.file_name )
diff -r 5002f66739e1 -r 054527415fac lib/galaxy/webapps/community/controllers/upload.py
--- a/lib/galaxy/webapps/community/controllers/upload.py Mon Apr 26 13:53:48 2010 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Mon Apr 26 15:40:52 2010 -0400
@@ -51,6 +51,7 @@
shutil.copy( uploaded_file.name, obj.file_name )
return trans.response.send_redirect( web.url_for( controller='tool_browser',
action='edit_tool',
+ id=trans.app.security.encode_id( obj.id ),
message='Uploaded %s' % meta.message,
status='done' ) )
except datatypes.DatatypeVerificationError, e:
diff -r 5002f66739e1 -r 054527415fac lib/galaxy/webapps/community/datatypes/__init__.py
--- a/lib/galaxy/webapps/community/datatypes/__init__.py Mon Apr 26 13:53:48 2010 -0400
+++ b/lib/galaxy/webapps/community/datatypes/__init__.py Mon Apr 26 15:40:52 2010 -0400
@@ -99,7 +99,7 @@
def verify( self, file ):
msg = ''
try:
- tar = tarfile.TarFile( fileobj = file )
+ tar = tarfile.open( file.name )
except tarfile.ReadError:
raise DatatypeVerificationError( 'The tool file is not a readable tar file' )
xml_names = filter( lambda x: x.lower().endswith( '.xml' ), tar.getnames() )
diff -r 5002f66739e1 -r 054527415fac lib/galaxy/webapps/community/model/__init__.py
--- a/lib/galaxy/webapps/community/model/__init__.py Mon Apr 26 13:53:48 2010 -0400
+++ b/lib/galaxy/webapps/community/model/__init__.py Mon Apr 26 15:40:52 2010 -0400
@@ -4,7 +4,7 @@
Naming: try to use class names that have a distinct plural form so that
the relationship cardinalities are obvious (e.g. prefer Dataset to Data)
"""
-import os.path, os, errno, sys, codecs, operator, tempfile, logging, tarfile
+import os.path, os, errno, sys, codecs, operator, tempfile, logging, tarfile, mimetypes
from galaxy.util.bunch import Bunch
from galaxy import util
from galaxy.util.hash_util import *
@@ -96,6 +96,7 @@
self.version = version or "1.0.0"
self.user_id = user_id
self.external_filename = external_filename
+ self.__extension = None
def get_file_name( self ):
if not self.external_filename:
assert self.id is not None, "ID must be set before filename used (commit the object)"
@@ -132,6 +133,34 @@
if not isinstance( category, Category ):
category = trans.sa_session.query( Category ).get( int( category ) )
self.categories.append( ToolCategoryAssociation( self, category ) )
+ @property
+ def extension( self ):
+ # if instantiated via a query, this unmapped property won't exist
+ if '_Tool__extension' not in dir( self ):
+ self.__extension = None
+ if self.__extension is None:
+ head = open( self.file_name, 'rb' ).read( 4 )
+ try:
+ assert head[:3] == 'BZh'
+ assert int( head[-1] ) in range( 0, 10 )
+ self.__extension = 'tar.bz2'
+ except AssertionError:
+ pass
+ if self.__extension is None:
+ try:
+ assert head[:2] == '\037\213'
+ self.__extension = 'tar.gz'
+ except:
+ pass
+ if self.__extension is None:
+ self.__extension = 'tar'
+ return self.__extension
+ @property
+ def download_file_name( self ):
+ return '%s_%s.%s' % ( self.tool_id, self.version, self.extension )
+ @property
+ def mimetype( self ):
+ return mimetypes.guess_type( self.download_file_name )[0]
class Tag ( object ):
def __init__( self, id=None, type=None, parent_id=None, name=None ):
diff -r 5002f66739e1 -r 054527415fac static/images/silk/page_white_compressed.png
Binary file static/images/silk/page_white_compressed.png has changed
diff -r 5002f66739e1 -r 054527415fac templates/webapps/community/tool/edit_tool.mako
--- a/templates/webapps/community/tool/edit_tool.mako Mon Apr 26 13:53:48 2010 -0400
+++ b/templates/webapps/community/tool/edit_tool.mako Mon Apr 26 15:40:52 2010 -0400
@@ -18,7 +18,7 @@
%endif
<form id="tool_edit_form" name="tool_edit_form" action="${h.url_for( controller='tool_browser', action='edit_tool' )}" enctype="multipart/form-data" method="post">
-<input type="hidden" name="id" value="${encoded_id}"/>
+<input type="hidden" name="id" value="${trans.app.security.encode_id( tool.id )}"/>
<div class="toolForm">
<div class="toolFormTitle">Edit Tool</div>
<div class="toolFormBody">
diff -r 5002f66739e1 -r 054527415fac templates/webapps/community/tool/view_tool.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/webapps/community/tool/view_tool.mako Mon Apr 26 15:40:52 2010 -0400
@@ -0,0 +1,49 @@
+<%namespace file="/message.mako" import="render_msg" />
+
+<%!
+ def inherit(context):
+ if context.get('use_panels'):
+ return '/webapps/community/base_panels.mako'
+ else:
+ return '/base.mako'
+%>
+<%inherit file="${inherit(context)}"/>
+
+<%def name="title()">View Tool</%def>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">${tool.name} <em>${tool.description}</em> ${tool.version} (ID: ${tool.tool_id})</div>
+ <div class="toolFormBody">
+ <div class="form-row">
+ Uploaded by <a href="${h.url_for(controller='tool_browser', action='user_tools')}">${tool.user.username}</a> on ${tool.create_time.strftime('%B %d, %Y')}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Categories:</label>
+ %for category in [ tca.category for tca in tool.categories ]:
+ ${category.name}
+ %endfor
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Description:</label>
+ ${tool.user_description}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Download:</label>
+ <a href="${h.url_for(controller='tool_browser', action='download_tool', id=trans.app.security.encode_id( tool.id ))}"><img src="${h.url_for('/static/images/silk/page_white_compressed.png')}"> ${tool.tool_id}_${tool.version}</a>
+ <div style="clear: both"></div>
+ </div>
+ %if trans.user.id == tool.user_id:
+ <div class="form-row">
+ <em>This is your tool. You may <a href="${h.url_for(controller='tool_browser', action='edit_tool', id=trans.app.security.encode_id( tool.id ) )}">edit it</a>.</em>
+ <div style="clear: both"></div>
+ </div>
+ %endif
+ </div>
+</div>
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/5002f66739e1
changeset: 3696:5002f66739e1
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Mon Apr 26 13:53:48 2010 -0400
description:
Fix indentations.
diffstat:
templates/root/history_common.mako | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diffs (32 lines):
diff -r 0ed61e8bd1d5 -r 5002f66739e1 templates/root/history_common.mako
--- a/templates/root/history_common.mako Mon Apr 26 13:48:24 2010 -0400
+++ b/templates/root/history_common.mako Mon Apr 26 13:53:48 2010 -0400
@@ -127,17 +127,17 @@
## icons.
<div style="clear: both"></div>
%endif
- <div style="clear: both"></div>
- %for display_app in data.datatype.get_display_types():
- <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
- %if len( display_links ) > 0:
- | ${data.datatype.get_display_label(display_app)}
- %for display_name, display_link in display_links:
- <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
- %endfor
- %endif
- %endfor
- %endif
+ <div style="clear: both"></div>
+ %for display_app in data.datatype.get_display_types():
+ <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
+ %if len( display_links ) > 0:
+ | ${data.datatype.get_display_label(display_app)}
+ %for display_name, display_link in display_links:
+ <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
+ %endfor
+ %endif
+ %endfor
+ %endif
%for display_app in data.get_display_applications( trans ).itervalues():
| ${display_app.name}
%for link_app in display_app.links.itervalues():
1
0
10 May '10
details: http://www.bx.psu.edu/hg/galaxy/rev/0ed61e8bd1d5
changeset: 3695:0ed61e8bd1d5
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Mon Apr 26 13:48:24 2010 -0400
description:
Rollback display links/peek ordering in history datasets so that links appear above peek.
diffstat:
templates/root/history_common.mako | 41 ++++++++++++++++++-------------------
1 files changed, 20 insertions(+), 21 deletions(-)
diffs (53 lines):
diff -r 1a3bc21d3a8e -r 0ed61e8bd1d5 templates/root/history_common.mako
--- a/templates/root/history_common.mako Mon Apr 26 09:58:21 2010 -0400
+++ b/templates/root/history_common.mako Mon Apr 26 13:48:24 2010 -0400
@@ -127,29 +127,28 @@
## icons.
<div style="clear: both"></div>
%endif
+ <div style="clear: both"></div>
+ %for display_app in data.datatype.get_display_types():
+ <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
+ %if len( display_links ) > 0:
+ | ${data.datatype.get_display_label(display_app)}
+ %for display_name, display_link in display_links:
+ <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
+ %endfor
+ %endif
+ %endfor
+ %endif
+ %for display_app in data.get_display_applications( trans ).itervalues():
+ | ${display_app.name}
+ %for link_app in display_app.links.itervalues():
+ <a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a>
+ %endfor
+ %endfor
+
+ </div>
%if data.peek != "no peek":
<div><pre id="peek${data.id}" class="peek">${_(data.display_peek())}</pre></div>
- %endif
- <div style="clear: both"></div>
- %for display_app in data.datatype.get_display_types():
- <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
- %if len( display_links ) > 0:
- | ${data.datatype.get_display_label(display_app)}
- %for display_name, display_link in display_links:
- <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
- %endfor
- %endif
- %endfor
- %endif
- %for display_app in data.get_display_applications( trans ).itervalues():
- | ${display_app.name}
- %for link_app in display_app.links.itervalues():
- <a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a>
- %endfor
- %endfor
-
- </div>
-
+ %endif
%else:
<div>${_('Error: unknown dataset state "%s".') % data_state}</div>
%endif
1
0