details: http://www.bx.psu.edu/hg/galaxy/rev/3bd7acfe34cc
changeset: 2809:3bd7acfe34cc
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Wed Sep 30 15:35:05 2009 -0400
description:
Allow for a specified target for display links, rahter than forcing it to be _blank - this will allow external tools like GeneTrack to run inside the Galaxy frame set.
3 file(s) affected in this change:
lib/galaxy/datatypes/data.py
lib/galaxy/datatypes/tracks.py
templates/root/history_common.mako
diffs (64 lines):
diff -r 9cc7a17e0ac7 -r 3bd7acfe34cc lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py Wed Sep 30 14:47:17 2009 -0400
+++ b/lib/galaxy/datatypes/data.py Wed Sep 30 15:35:05 2009 -0400
@@ -171,11 +171,11 @@
def get_mime(self):
"""Returns the mime type of the datatype"""
return 'application/octet-stream'
- def add_display_app (self, app_id, label, file_function, links_function ):
+ def add_display_app ( self, app_id, label, file_function, links_function ):
"""
Adds a display app to the datatype.
app_id is a unique id
- label is the primary display label, ie display at 'UCSC'
+ label is the primary display label, e.g., display at 'UCSC'
file_function is a string containing the name of the function that returns a properly formatted display
links_function is a string containing the name of the function that returns a list of (link_name,link)
"""
@@ -205,7 +205,7 @@
except:
log.exception('Function %s is referred to in datatype %s for displaying as type %s, but is not accessible' % (self.supported_display_apps[type]['file_function'], self.__class__.__name__, type) )
return "This display type (%s) is not implemented for this datatype (%s)." % ( type, dataset.ext)
- def get_display_links(self, dataset, type, app, base_url, **kwd):
+ def get_display_links( self, dataset, type, app, base_url, target_frame='_blank', **kwd ):
"""
Returns a list of tuples of (name, link) for a particular display type. No check on
'access' permissions is done here - if you can view the dataset, you can also save it
@@ -214,7 +214,7 @@
"""
try:
if type in self.get_display_types():
- return getattr (self, self.supported_display_apps[type]['links_function']) (dataset, type, app, base_url, **kwd)
+ return target_frame, getattr ( self, self.supported_display_apps[type]['links_function'] ) ( dataset, type, app, base_url, **kwd )
except:
log.exception( 'Function %s is referred to in datatype %s for generating links for type %s, but is not accessible' \
% ( self.supported_display_apps[type]['links_function'], self.__class__.__name__, type ) )
diff -r 9cc7a17e0ac7 -r 3bd7acfe34cc lib/galaxy/datatypes/tracks.py
--- a/lib/galaxy/datatypes/tracks.py Wed Sep 30 14:47:17 2009 -0400
+++ b/lib/galaxy/datatypes/tracks.py Wed Sep 30 15:35:05 2009 -0400
@@ -27,6 +27,8 @@
def __init__(self, **kwargs):
super( GeneTrack, self ).__init__( **kwargs )
self.add_display_app( 'genetrack', 'View in GeneTrack', '', 'genetrack_link' )
+ def get_display_links( self, dataset, type, app, base_url, target_frame='galaxy_main', **kwd ):
+ return data.Binary.get_display_links( self, dataset, type, app, base_url, target_frame=target_frame, **kwd )
def genetrack_link( self, hda, type, app, base_url ):
ret_val = []
if hda.has_data:
diff -r 9cc7a17e0ac7 -r 3bd7acfe34cc templates/root/history_common.mako
--- a/templates/root/history_common.mako Wed Sep 30 14:47:17 2009 -0400
+++ b/templates/root/history_common.mako Wed Sep 30 15:35:05 2009 -0400
@@ -83,11 +83,11 @@
<a href="${h.url_for( action='display', id=data.id, tofile='yes', toext=data.ext )}" target="_blank">save</a>
| <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main">rerun</a>
%for display_app in data.datatype.get_display_types():
- <% display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
+ <% 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="_blank" href="${display_link}">${_(display_name)}</a>
+ <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
%endfor
%endif
%endfor
details: http://www.bx.psu.edu/hg/galaxy/rev/3e5428b298b1
changeset: 2804:3e5428b298b1
user: rc
date: Wed Sep 30 10:40:08 2009 -0400
description:
More functional tests for Requests
2 file(s) affected in this change:
templates/admin/forms/show_form_read_only.mako
test/functional/test_forms_and_requests.py
diffs (141 lines):
diff -r 88fdb7f40b0e -r 3e5428b298b1 templates/admin/forms/show_form_read_only.mako
--- a/templates/admin/forms/show_form_read_only.mako Wed Sep 30 09:22:02 2009 -0400
+++ b/templates/admin/forms/show_form_read_only.mako Wed Sep 30 10:40:08 2009 -0400
@@ -62,7 +62,11 @@
</%def>
<div class="toolForm">
- <div class="toolFormTitle">${form.name} - <i>${form.desc}</i></div>
+ %if form.desc:
+ <div class="toolFormTitle">${form.name} - <i>${form.desc}</i></div>
+ %else:
+ <div class="toolFormTitle">${form.name}</div>
+ %endif
<form name="library" action="${h.url_for( controller='forms', action='manage' )}" method="post" >
%if form.type == trans.app.model.FormDefinition.types.SAMPLE:
%if not len(form.layout):
diff -r 88fdb7f40b0e -r 3e5428b298b1 test/functional/test_forms_and_requests.py
--- a/test/functional/test_forms_and_requests.py Wed Sep 30 09:22:02 2009 -0400
+++ b/test/functional/test_forms_and_requests.py Wed Sep 30 10:40:08 2009 -0400
@@ -169,9 +169,11 @@
#self.check_page_for_string( 'Address <b>%s</b> has been added' % user_address1[ 'short_desc' ] )
## TODO: FIX HACK
## the user address creation should be done as a test.
+ global regular_user
+ regular_user = galaxy.model.User.filter( galaxy.model.User.table.c.email=='test1(a)bx.psu.edu' ).first()
global user_address
user_address = galaxy.model.UserAddress()
- user_address.user = galaxy.model.User.filter( galaxy.model.User.table.c.email=='test1(a)bx.psu.edu' ).first()
+ user_address.user = regular_user
user_address.desc = address1[ 'short_desc' ]
user_address.name = address1[ 'name' ]
user_address.institution = address1[ 'institution' ]
@@ -211,14 +213,22 @@
for field_value in fields:
self.check_page_for_string( field_value )
# edit this request
- fields = ['field one value (editted)', 'field two value (editted)', str(user_address.id)]
+ fields = ['field one value (edited)', 'field two value (edited)', str(user_address.id)]
self.edit_request(request_one.id, request_one.name, request_one.name+' (Renamed)', request_one.desc+' (Re-described)', library_one.id, folder_one.id, fields)
request_one.refresh()
self.check_page_for_string( request_name+' (Renamed)' )
self.check_page_for_string( request_desc+' (Re-described)' )
+ # check if the request is showing in the 'unsubmitted' filter
+ self.home()
+ self.visit_url( '%s/requests/list?show_filter=Unsubmitted' % self.url )
+ self.check_page_for_string( request_one.name )
# submit the request
self.submit_request( request_one.id, request_one.name )
request_one.refresh()
+ # check if the request is showing in the 'submitted' filter
+ self.home()
+ self.visit_url( '%s/requests/list?show_filter=Submitted' % self.url )
+ self.check_page_for_string( request_one.name )
# check if the request's state is now set to 'submitted'
assert request_one.state is not request_one.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" % ( request_one.name, request_one.states.SUBMITTED )
def test_035_request_lifecycle( self ):
@@ -250,40 +260,50 @@
self.visit_url('%s/requests_admin/list?show_filter=Complete' % self.url)
self.check_page_for_string( request_one.name )
assert request_one.state is not request_one.states.COMPLETE, "The state of the request '%s' should be set to '%s'" % ( request_one.name, request_one.states.COMPLETE )
-# def test_40_admin_create_request_on_behalf_of_regular_user( self ):
-# """Testing creating and submitting a request as an admin on behalf of a regular user"""
-# self.logout()
-# self.login( email='test(a)bx.psu.edu' )
-## permissions_in = [ k for k, v in galaxy.model.Library.permitted_actions.items() ]
-## permissions_out = []
-## self.set_library_permissions( str( library_one.id ), library_one.name, str( admin_user_private_role.id ), permissions_in, permissions_out )
-# # set field values
-# fields = ['field one value', 'field two value', str(user_address.id)]
-# # create the request
-# request_name, request_desc = 'Request Two', 'Request Two Description'
-# self.create_request_admin(request_type.id, regular_user1.id, request_name, request_desc, library_one.id, fields)
-# self.check_page_for_string( request_name )
-# self.check_page_for_string( request_desc )
-# global request_two
-# request_one = galaxy.model.Request.filter( and_( galaxy.model.Request.table.c.name==request_name,
-# galaxy.model.Request.table.c.deleted==False ) ).first()
-# # check if the request's state is now set to 'unsubmitted'
-# assert request_two.state is not request_two.states.UNSUBMITTED, "The state of the request '%s' should be set to '%s'" % ( request_two.name, request_two.states.UNSUBMITTED )
-# # sample fields
-# samples = [ ( 'Sample One', [ 'S1 Field 0 Value' ] ),
-# ( 'Sample Two', [ 'S2 Field 0 Value' ] ) ]
-# # add samples to this request
-# self.add_samples( request_two.id, request_two.name, samples )
-# for sample_name, fields in samples:
-# self.check_page_for_string( sample_name )
-# self.check_page_for_string( 'Unsubmitted' )
-# for field_value in fields:
-# self.check_page_for_string( field_value )
-# # submit the request
-# self.submit_request( request_two.id, request_two.name )
-# request_two.refresh()
-# # check if the request's state is now set to 'submitted'
-# assert request_two.state is not request_two.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" % ( request_two.name, request_two.states.SUBMITTED )
+ def test_40_admin_create_request_on_behalf_of_regular_user( self ):
+ """Testing creating and submitting a request as an admin on behalf of a regular user"""
+ self.logout()
+ self.login( email='test(a)bx.psu.edu' )
+ request_name = "RequestTwo"
+ # simulate request creation
+ url_str = '%s/requests_admin/new?create=True&create_request_button=Save&select_request_type=%i&select_user=%i&name=%s&library_id=%i&folder_id=%i&refresh=True&field_1=%s&field_2=%i' \
+ % ( self.url, request_type.id, regular_user.id, request_name, library_one.id, library_one.root_folder.id, "field_1_value", user_address.id )
+ self.home()
+ self.visit_url( url_str )
+ self.check_page_for_string( "The new request named %s has been created" % request_name )
+ global request_two
+ request_two = galaxy.model.Request.filter( and_( galaxy.model.Request.table.c.name==request_name,
+ galaxy.model.Request.table.c.deleted==False ) ).first()
+ # check if the request is showing in the 'unsubmitted' filter
+ self.home()
+ self.visit_url( '%s/requests_admin/list?show_filter=Unsubmitted' % self.url )
+ self.check_page_for_string( request_two.name )
+ # check if the request's state is now set to 'unsubmitted'
+ assert request_two.state is not request_two.states.UNSUBMITTED, "The state of the request '%s' should be set to '%s'" % ( request_two.name, request_two.states.UNSUBMITTED )
+ # sample fields
+ samples = [ ( 'Sample One', [ 'S1 Field 0 Value' ] ),
+ ( 'Sample Two', [ 'S2 Field 0 Value' ] ) ]
+ # add samples to this request
+ self.add_samples( request_two.id, request_two.name, samples )
+ for sample_name, fields in samples:
+ self.check_page_for_string( sample_name )
+ self.check_page_for_string( 'Unsubmitted' )
+ for field_value in fields:
+ self.check_page_for_string( field_value )
+ # submit the request
+ self.submit_request( request_two.id, request_two.name )
+ request_two.refresh()
+ # check if the request is showing in the 'submitted' filter
+ self.home()
+ self.visit_url( '%s/requests_admin/list?show_filter=Submitted' % self.url )
+ self.check_page_for_string( request_two.name )
+ # check if the request's state is now set to 'submitted'
+ assert request_two.state is not request_two.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" % ( request_two.name, request_two.states.SUBMITTED )
+ # check if both the requests is showing in the 'All' filter
+ self.home()
+ self.visit_url( '%s/requests_admin/list?show_filter=All' % self.url )
+ self.check_page_for_string( request_one.name )
+ self.check_page_for_string( request_two.name )