[hg] galaxy 2809: Allow for a specified target for display links...
details: http://www.bx.psu.edu/hg/galaxy/rev/3bd7acfe34cc changeset: 2809:3bd7acfe34cc user: Greg Von Kuster <greg@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
participants (1)
-
Nate Coraor