1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/197878e9908c/ Changeset: 197878e9908c User: carlfeberhard Date: 2014-04-28 20:59:25 Summary: Bugfixes: do not render entire document from grid_base if embedded, use embedded in published grids, fix permission issue in visualization/saved Affected #: 14 files diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -1295,6 +1295,7 @@ else: decoded_id = trans.security.decode_id( id ) vis = session.query( trans.model.Visualization ).get( decoded_id ) + #TODO: security check? # Create new VisualizationRevision that will be attached to the viz vis_rev = trans.model.VisualizationRevision() diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e lib/galaxy/webapps/galaxy/controllers/history.py --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -208,12 +208,14 @@ @web.expose def list_published( self, trans, **kwargs ): + if 'async' in kwargs: + kwargs[ 'embedded' ] = True + return self.published_list_grid( trans, **kwargs ) + + kwargs[ 'embedded' ] = True grid = self.published_list_grid( trans, **kwargs ) - if 'async' in kwargs: - return grid - else: - # Render grid wrapped in panels - return trans.fill_template( "history/list_published.mako", grid=grid ) + return trans.fill_template( "history/list_published.mako", embedded_grid=grid ) + @web.expose @web.require_login( "work with multiple histories" ) diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e lib/galaxy/webapps/galaxy/controllers/page.py --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -302,6 +302,8 @@ return self.sharing( trans, **kwargs ) session.flush() + #HACK: to prevent the insertion of an entire html document inside another + kwargs[ 'embedded' ] = True # Build grid HTML. grid = self._page_list( trans, *args, **kwargs ) @@ -315,16 +317,17 @@ .all() # Render grid wrapped in panels - return trans.fill_template( "page/index.mako", grid=grid, shared_by_others=shared_by_others ) + return trans.fill_template( "page/index.mako", embedded_grid=grid, shared_by_others=shared_by_others ) @web.expose def list_published( self, trans, *args, **kwargs ): + kwargs[ 'embedded' ] = True grid = self._all_published_list( trans, *args, **kwargs ) if 'async' in kwargs: return grid - else: - # Render grid wrapped in panels - return trans.fill_template( "page/list_published.mako", grid=grid ) + + # Render grid wrapped in panels + return trans.fill_template( "page/list_published.mako", embedded_grid=grid ) @web.expose diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e lib/galaxy/webapps/galaxy/controllers/root.py --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -541,3 +541,8 @@ raise HTTPBadGateway() trans.response.status = code return { 'error': 'Fake error!' } + + @web.expose + def test( self, trans, **kwargs ): + #trans.response.headers[ 'Content-Type' ] = 'text/plain' + return trans.fill_template( 'test/test.mako', **kwargs ) diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e lib/galaxy/webapps/galaxy/controllers/visualization.py --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -340,7 +340,6 @@ @web.require_login( "see all available datasets" ) def list_datasets( self, trans, **kwargs ): """List all datasets that can be added as tracks""" - # Render the list view return self._data_grid( trans, **kwargs ) @@ -350,12 +349,13 @@ @web.expose def list_published( self, trans, *args, **kwargs ): + kwargs[ 'embedded' ] = True grid = self._published_list_grid( trans, **kwargs ) if 'async' in kwargs: return grid - else: - # Render grid wrapped in panels - return trans.fill_template( "visualization/list_published.mako", grid=grid ) + + # Render grid wrapped in panels + return trans.fill_template( "visualization/list_published.mako", embedded_grid=grid ) @web.expose @web.require_login( "use Galaxy visualizations", use_panels=True ) @@ -385,7 +385,9 @@ .order_by( desc( model.Visualization.update_time ) ) \ .all() - return trans.fill_template( "visualization/list.mako", grid=self._user_list_grid( trans, *args, **kwargs ), shared_by_others=shared_by_others ) + kwargs[ 'embedded' ] = True + grid = self._user_list_grid( trans, *args, **kwargs ) + return trans.fill_template( "visualization/list.mako", embedded_grid=grid, shared_by_others=shared_by_others ) # # -- Functions for operating on visualizations. -- @@ -571,7 +573,7 @@ raise web.httpexceptions.HTTPNotFound() # Security check raises error if user cannot access visualization. - self.security_check( trans, visualization, False, True) + self.security_check( trans, visualization, check_ownership=False, check_accessible=True ) # Get rating data. user_item_rating = 0 @@ -747,8 +749,15 @@ if isinstance( config, basestring ): config = from_json_string( config ) title = title or DEFAULT_VISUALIZATION_NAME + #TODO: allow saving to (updating) a specific revision - should be part of UsesVisualization #TODO: would be easier if this returned the visualization directly + # check security if posting to existing visualization + if id is not None: + visualization = self.get_visualization( trans, id, check_ownership=True, check_accessible=False ) + #??: on not owner: error raised, but not returned (status = 200) + + #TODO: there's no security check in save visualization (if passed an id) returned = self.save_visualization( trans, config, type, id, title ) # redirect to GET to prevent annoying 'Do you want to post again?' dialog on page reload @@ -760,7 +769,8 @@ # render the saved visualization by passing to render, sending latest revision config #TODO: allow loading a specific revision - should be part of UsesVisualization - visualization = self.get_visualization( trans, id, check_ownership=True, check_accessible=False ) + #visualization = self.get_visualization( trans, id, check_ownership=True, check_accessible=False ) + visualization = self.get_visualization( trans, id, check_ownership=False, check_accessible=True ) config = copy.copy( visualization.latest_revision.config ) # re-add title to kwargs for passing to render diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e lib/galaxy/webapps/galaxy/controllers/workflow.py --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -216,12 +216,13 @@ @web.expose def list_published( self, trans, **kwargs ): + kwargs[ 'embedded' ] = True grid = self.published_list_grid( trans, **kwargs ) if 'async' in kwargs: return grid - else: - # Render grid wrapped in panels - return trans.fill_template( "workflow/list_published.mako", grid=grid ) + + # Render grid wrapped in panels + return trans.fill_template( "workflow/list_published.mako", embedded_grid=grid ) @web.expose def display_by_username_and_slug( self, trans, username, slug, format='html' ): diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/grid_base.mako --- a/templates/grid_base.mako +++ b/templates/grid_base.mako @@ -1,6 +1,12 @@ <%! from galaxy.web.framework.helpers.grids import TextColumn + def inherit(context): + kwargs = context.get( 'kwargs', {} ) + if kwargs.get( 'embedded', False ): + # No inheritance - using only embeddable content (self.body) + return None + if context.get('use_panels'): if context.get('webapp'): webapp = context.get('webapp') @@ -10,17 +16,39 @@ else: return '/base.mako' %> - -## import/inherit makos <%inherit file="${inherit(context)}"/><%namespace file="/display_common.mako" import="get_class_plural" /> +## +## Override methods from base.mako and base_panels.mako +## + +<%def name="init( embedded=False, insert=None )"> +<% + self.has_left_panel = False + self.has_right_panel = False + self.message_box_visible = False + self.overlay_visible = False + self.active_view = 'user' +%> +</%def> + +## render title +<%def name="title()">${grid.title}</%def> + +## render in center panel +<%def name="center_panel()"> + ${self.load()} +</%def> + +## render in body +<%def name="body()"> + ${self.load()} +</%def> + ## creates grid -<%def name="load(embedded=False, insert=None)"> - - ## create dictionary - ${self.init(embedded, insert)} - +<%def name="load( embedded=False, insert=None )"> + <!-- grid_base.mako --> ## imports ${h.css( "autocomplete_tagging", "jquery.rating" )} ${h.js("libs/jquery/jquery.autocomplete", "galaxy.autocom_tagging", "libs/jquery/jquery.rating" )} @@ -31,37 +59,29 @@ ## load javascript <script type="text/javascript"> var gridView = null; - function add_tag_to_grid_filter (tag_name, tag_value) - { - ## Put tag name and value together. - var tag = tag_name + (tag_value !== undefined && tag_value !== "" ? ":" + tag_value : ""); - var advanced_search = $('#advanced-search').is(":visible"); - if (!advanced_search) - { + function add_tag_to_grid_filter( tag_name, tag_value ){ + // Put tag name and value together. + var tag = tag_name + ( tag_value !== undefined && tag_value !== "" ? ":" + tag_value : "" ); + var advanced_search = $( '#advanced-search').is(":visible" ); + if( !advanced_search ){ $('#standard-search').slideToggle('fast'); $('#advanced-search').slideToggle('fast'); } - gridView.add_filter_condition("tags", tag); + gridView.add_filter_condition( "tags", tag ); }; - ## load grid viewer - $(function() { - require(['mvc/grid/grid-view'], function(GridView) { - gridView = new GridView(${h.to_json_string(self.grid_config)}); + // load grid viewer + require(['mvc/grid/grid-view'], function(GridView) { + $(function() { + gridView = new GridView( ${ h.to_json_string( self.grid_config() ) } ); }); }); </script></%def> +<%def name="grid_config( embedded=False, insert=None )"> ## generates dictionary -<%def name="init(embedded=False, insert=None)"><% - self.has_left_panel = False - self.has_right_panel = False - self.message_box_visible = False - self.overlay_visible = False - self.active_view = 'user' - self.grid_config = { 'title' : grid.title, 'url_base' : trans.request.path_url, @@ -108,7 +128,7 @@ ## column for column in grid.columns: - + ## add column sort links href = None extra = '' @@ -138,7 +158,7 @@ 'extra' : extra }) endfor - + ## operations for operation in grid.operations: self.grid_config['operations'].append({ @@ -152,7 +172,7 @@ }) if operation.allow_multiple: self.grid_config['show_item_checkboxes'] = True - + if operation.global_operation: self.grid_config['global_operation'] = url( ** (operation.global_operation()) ) endfor @@ -177,7 +197,7 @@ self.grid_config['categorical_filters'][column.key] = dict([ (filter.label, filter.args) for filter in column.get_accepted_filters() ]) endif endfor - + # items for i, item in enumerate( query ): item_dict = { @@ -230,22 +250,8 @@ ## add item to list self.grid_config['items'].append(item_dict) endfor + + return self.grid_config %></%def> -## -## Override methods from base.mako and base_panels.mako -## - -## render title -<%def name="title()">${self.grid_config['title']}</%def> - -## render in center panel -<%def name="center_panel()"> - ${self.load()} -</%def> - -## render in body -<%def name="body()"> - ${self.load()} -</%def> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/history/list_published.mako --- a/templates/webapps/galaxy/history/list_published.mako +++ b/templates/webapps/galaxy/history/list_published.mako @@ -23,12 +23,10 @@ </%def><%def name="center_panel()"> - <div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;"> - ${h.to_unicode( grid )} + <!-- embedded grid --> + ${h.to_unicode( embedded_grid )} </div></div> - - </%def> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/page/index.mako --- a/templates/webapps/galaxy/page/index.mako +++ b/templates/webapps/galaxy/page/index.mako @@ -13,7 +13,8 @@ <div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;"> - ${h.to_unicode( grid )} + <!-- embedded grid --> + ${h.to_unicode( embedded_grid )} <br><br><h2>Pages shared with you by others</h2> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/page/list_published.mako --- a/templates/webapps/galaxy/page/list_published.mako +++ b/templates/webapps/galaxy/page/list_published.mako @@ -26,7 +26,8 @@ <div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;"> - ${h.to_unicode( grid )} + <!-- embedded grid --> + ${h.to_unicode( embedded_grid )} </div></div></%def> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/root/index.mako --- a/templates/webapps/galaxy/root/index.mako +++ b/templates/webapps/galaxy/root/index.mako @@ -17,6 +17,9 @@ <%def name="javascripts()"> ${parent.javascripts()} ${tool_menu_javascripts()} + ${h.js( + "utils/LazyDataLoader" + )} </%def><%def name="late_javascripts()"> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/visualization/list.mako --- a/templates/webapps/galaxy/visualization/list.mako +++ b/templates/webapps/galaxy/visualization/list.mako @@ -26,7 +26,8 @@ </div> %endif - ${h.to_unicode( grid )} + <!-- embedded grid --> + ${h.to_unicode( embedded_grid )} <br><br><h2>Visualizations shared with you by others</h2> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/visualization/list_published.mako --- a/templates/webapps/galaxy/visualization/list_published.mako +++ b/templates/webapps/galaxy/visualization/list_published.mako @@ -26,7 +26,8 @@ <div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;"> - ${h.to_unicode( grid )} + <!-- embedded grid --> + ${h.to_unicode( embedded_grid )} </div></div> diff -r 8f6cba970f9ee28477a4e763218d0cce73cb9a21 -r 197878e9908c647916f460d4d110a90940c8317e templates/webapps/galaxy/workflow/list_published.mako --- a/templates/webapps/galaxy/workflow/list_published.mako +++ b/templates/webapps/galaxy/workflow/list_published.mako @@ -23,12 +23,10 @@ </%def><%def name="center_panel()"> - <div style="overflow: auto; height: 100%;"><div class="page-container" style="padding: 10px;"> - ${h.to_unicode( grid )} + <!-- embedded grid --> + ${h.to_unicode( embedded_grid )} </div></div> - - </%def> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.