[hg] galaxy 3490: Update embedded item styles and functionality....
details: http://www.bx.psu.edu/hg/galaxy/rev/97fe4a44b3bf changeset: 3490:97fe4a44b3bf user: jeremy goecks <jeremy.goecks@emory.edu> date: Mon Mar 08 11:37:35 2010 -0500 description: Update embedded item styles and functionality. Specific enhancements include: (a) colors for each embedded item; (b) option to make items accessible during embedding; (c) viewing and importing embedded items. To import a dataset, a generic 'dataset copy' was implemented. This functionality was also added to the HDA grid, so users can now copy any dataset they own to their current history. This Fixes #233 diffstat: lib/galaxy/web/base/controller.py | 3 + lib/galaxy/web/controllers/dataset.py | 67 +++++++++++++++++++++++- lib/galaxy/web/controllers/history.py | 4 - lib/galaxy/web/controllers/library_admin.py | 3 - lib/galaxy/web/controllers/page.py | 2 +- lib/galaxy/web/controllers/workflow.py | 1 - static/images/fugue/arrow-045.png | 0 static/images/fugue/plus-circle.png | 0 static/june_2007_style/base.css.tmpl | 8 ++ static/june_2007_style/blue/base.css | 2 + static/june_2007_style/blue/embed_item.css | 6 +- static/june_2007_style/embed_item.css.tmpl | 62 +++++++++++++++++----- templates/dataset/embed.mako | 13 +++- templates/display_base.mako | 4 +- templates/embed_base.mako | 38 +++++++++---- templates/history/embed.mako | 13 ++-- templates/page/display.mako | 75 ++++++++++++++++++--------- templates/page/editor.mako | 56 +++++++++++++------- templates/workflow/embed.mako | 12 ++-- 19 files changed, 265 insertions(+), 104 deletions(-) diffs (675 lines): diff -r 3563fade2c86 -r 97fe4a44b3bf lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py Fri Mar 05 17:21:16 2010 -0500 +++ b/lib/galaxy/web/base/controller.py Mon Mar 08 11:37:35 2010 -0500 @@ -13,6 +13,9 @@ from Cheetah.Template import Template log = logging.getLogger( __name__ ) + +# States for passing messages +SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error" class BaseController( object ): """ diff -r 3563fade2c86 -r 97fe4a44b3bf lib/galaxy/web/controllers/dataset.py --- a/lib/galaxy/web/controllers/dataset.py Fri Mar 05 17:21:16 2010 -0500 +++ b/lib/galaxy/web/controllers/dataset.py Mon Mar 08 11:37:35 2010 -0500 @@ -85,12 +85,11 @@ columns = [ grids.TextColumn( "Name", key="name", model_class=model.HistoryDatasetAssociation, # Link name to dataset's history. - link=( lambda item: iff( item.history.deleted, None, dict( operation="switch", id=item.id ) ) ), filterable="advanced" ), + link=( lambda item: iff( item.history.deleted, None, dict( operation="switch", id=item.id ) ) ), filterable="advanced", attach_popup=True ), HistoryColumn( "History", key="history", link=( lambda item: iff( item.history.deleted, None, dict( operation="switch_history", id=item.id ) ) ) ), grids.IndividualTagsColumn( "Tags", "tags", model.HistoryDatasetAssociation, model.HistoryDatasetAssociationTagAssociation, filterable="advanced", grid_name="HistoryDatasetAssocationListGrid" ), StatusColumn( "Status", key="deleted", attach_popup=False ), - grids.GridColumn( "Created", key="create_time", format=time_ago ), grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), ] columns.append( @@ -99,7 +98,9 @@ cols_to_filter=[ columns[0], columns[2] ], key="free-text-search", visible=False, filterable="standard" ) ) - operations = [] + operations = [ + grids.GridOperation( "Copy to current history", condition=( lambda item: not item.deleted ), async_compatible=False ), + ] standard_filters = [] default_filter = dict( name="All", deleted="False", tags="All" ) preserve_state = False @@ -284,11 +285,32 @@ if operation == "switch": hda_ids = [ trans.security.encode_id( hda.id ) for hda in hdas ] trans.template_context[ 'seek_hda_ids' ] = hda_ids + elif operation == "copy to current history": + # Copy a dataset to the current history. + target_histories = [ trans.get_history() ] + status, message = self._copy_datasets( trans, hda_ids, target_histories ) + + # Current history changed, refresh history frame. + trans.template_context['refresh_frames'] = ['history'] # Render the list view return self.stored_list_grid( trans, status=status, message=message, **kwargs ) @web.expose + def imp( self, trans, id=None, **kwd ): + """ Import another user's dataset via a shared URL; dataset is added to user's current history. """ + msg = "" + + # Error checking. + if not id: + return trans.show_error_message( "You must specify an ID for a dataset to import." ) + + # Do import. + cur_history = trans.get_history( create=True ) + status, message = self._copy_datasets( trans, [ id ], [ cur_history ] ) + return trans.show_message( message, type=status ) + + @web.expose @web.json @web.require_login( "use Galaxy datasets" ) def get_name_and_link_async( self, trans, id=None ): @@ -324,7 +346,6 @@ raise web.httpexceptions.HTTPNotFound() @web.expose - @web.require_login("get item content asynchronously") def get_item_content_async( self, trans, id ): """ Returns item content in HTML format. """ @@ -534,4 +555,40 @@ new_history_name = new_history_name, done_msg = done_msg, error_msg = error_msg, - refresh_frames = refresh_frames ) \ No newline at end of file + refresh_frames = refresh_frames ) + + def _copy_datasets( self, trans, dataset_ids, target_histories ): + """ Helper method for copying datasets. """ + user = trans.get_user() + done_msg = error_msg = "" + + invalid_datasets = 0 + if not dataset_ids or not target_histories: + error_msg = "You must provide both source datasets and target histories." + else: + # User must own target histories to copy datasets to them. + for history in target_histories: + if user != history.user: + error_msg = error_msg + "You do not have permission to add datasets to %i requested histories. " % ( len( target_histories ) ) + for dataset_id in dataset_ids: + data = self.get_dataset( trans, dataset_id ) + if data is None: + error_msg = error_msg + "You tried to copy a dataset that does not exist or that you do not have access to. " + invalid_datasets += 1 + else: + for hist in target_histories: + hist.add_dataset( data.copy( copy_children = True ) ) + trans.sa_session.flush() + num_datasets_copied = len( dataset_ids ) - invalid_datasets + done_msg = "%i dataset%s copied to %i histor%s." % \ + ( num_datasets_copied, iff( num_datasets_copied == 1, "", "s"), len( target_histories ), iff( len ( target_histories ) == 1, "y", "ies") ) + trans.sa_session.refresh( history ) + + if error_msg != "": + status = ERROR + message = error_msg + else: + status = SUCCESS + message = done_msg + return status, message + \ No newline at end of file diff -r 3563fade2c86 -r 97fe4a44b3bf lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Fri Mar 05 17:21:16 2010 -0500 +++ b/lib/galaxy/web/controllers/history.py Mon Mar 08 11:37:35 2010 -0500 @@ -13,9 +13,6 @@ log = logging.getLogger( __name__ ) -# States for passing messages -SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error" - class NameColumn( grids.TextColumn ): def get_value( self, trans, grid, history ): return history.get_display_name() @@ -475,7 +472,6 @@ return history.slug @web.expose - @web.require_login("get item content asynchronously") def get_item_content_async( self, trans, id ): """ Returns item content in HTML format. """ diff -r 3563fade2c86 -r 97fe4a44b3bf lib/galaxy/web/controllers/library_admin.py --- a/lib/galaxy/web/controllers/library_admin.py Fri Mar 05 17:21:16 2010 -0500 +++ b/lib/galaxy/web/controllers/library_admin.py Mon Mar 08 11:37:35 2010 -0500 @@ -12,9 +12,6 @@ import logging log = logging.getLogger( __name__ ) -# States for passing messages -SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error" - class LibraryListGrid( grids.Grid ): class NameColumn( grids.TextColumn ): def get_value( self, trans, grid, library ): diff -r 3563fade2c86 -r 97fe4a44b3bf lib/galaxy/web/controllers/page.py --- a/lib/galaxy/web/controllers/page.py Fri Mar 05 17:21:16 2010 -0500 +++ b/lib/galaxy/web/controllers/page.py Mon Mar 08 11:37:35 2010 -0500 @@ -48,7 +48,7 @@ grids.GridOperation( "Edit attributes", allow_multiple=False, url_args=dict( action='edit') ), grids.GridOperation( "Edit content", allow_multiple=False, url_args=dict( action='edit_content') ), grids.GridOperation( "Share or Publish", allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ), - grids.GridOperation( "Delete" ), + grids.GridOperation( "Delete", confirm="Are you sure you want to delete this page?" ), ] def apply_default_filter( self, trans, query, **kwargs ): return query.filter_by( user=trans.user, deleted=False ) diff -r 3563fade2c86 -r 97fe4a44b3bf lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py Fri Mar 05 17:21:16 2010 -0500 +++ b/lib/galaxy/web/controllers/workflow.py Mon Mar 08 11:37:35 2010 -0500 @@ -182,7 +182,6 @@ return trans.fill_template_mako( "workflow/display.mako", item=stored_workflow, item_data=stored_workflow.latest_workflow.steps ) @web.expose - @web.require_login("get item content asynchronously") def get_item_content_async( self, trans, id ): """ Returns item content in HTML format. """ diff -r 3563fade2c86 -r 97fe4a44b3bf static/images/fugue/arrow-045.png Binary file static/images/fugue/arrow-045.png has changed diff -r 3563fade2c86 -r 97fe4a44b3bf static/images/fugue/plus-circle.png Binary file static/images/fugue/plus-circle.png has changed diff -r 3563fade2c86 -r 97fe4a44b3bf static/june_2007_style/base.css.tmpl --- a/static/june_2007_style/base.css.tmpl Fri Mar 05 17:21:16 2010 -0500 +++ b/static/june_2007_style/base.css.tmpl Mon Mar 08 11:37:35 2010 -0500 @@ -792,6 +792,14 @@ -sprite-image: fugue/sticky-note-text.png; } +.icon-button.go-to-full-screen { + background: url(/static/images/fugue/arrow-045.png) no-repeat +} + +.icon-button.import { + background:url(/static/images/fugue/plus-circle.png) no-repeat +} + .tipsy { padding: 5px; font-size: 10px; diff -r 3563fade2c86 -r 97fe4a44b3bf static/june_2007_style/blue/base.css --- a/static/june_2007_style/blue/base.css Fri Mar 05 17:21:16 2010 -0500 +++ b/static/june_2007_style/blue/base.css Mon Mar 08 11:37:35 2010 -0500 @@ -136,6 +136,8 @@ .icon-button.bug{background:url(fugue.png) no-repeat 0px -182px;} .icon-button.disk{background:url(fugue.png) no-repeat 0px -208px;} .icon-button.annotate{background:url(fugue.png) no-repeat 0px -234px;} +.icon-button.go-to-full-screen{background:url(/static/images/fugue/arrow-045.png) no-repeat} +.icon-button.import{background:url(/static/images/fugue/plus-circle.png) no-repeat} .tipsy{padding:5px;font-size:10px;filter:alpha(opacity=80);background-repeat:no-repeat;background-image:url(../images/tipsy.gif);} .tipsy-inner{padding:5px 8px 4px 8px;background-color:black;color:white;max-width:200px;text-align:center;} .tipsy-north{background-position:top center;} diff -r 3563fade2c86 -r 97fe4a44b3bf static/june_2007_style/blue/embed_item.css --- a/static/june_2007_style/blue/embed_item.css Fri Mar 05 17:21:16 2010 -0500 +++ b/static/june_2007_style/blue/embed_item.css Mon Mar 08 11:37:35 2010 -0500 @@ -1,5 +1,9 @@ -.embedded-item{background-color:#BBBBBB;margin-left:auto;margin-right:auto;width:90%;max-height:25em;overflow:auto;padding: 0.5em;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em;} +.embedded-item{margin-left:auto;margin-right:auto;width:90%;padding: 0.5em;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em;} +.embedded-item.history{background-color:#C1C9E5} +.embedded-item.dataset{background-color:#CFC} +.embedded-item.workflow{background-color:#EBD9B2} .embedded-item.placeholder{} +.embedded-item .item-content{max-height:25em;overflow:auto;} .embedded-item .title{vertical-align:top;text-align:center;} .embedded-item.placeholder .content{padding: 1em 1em;font-style:italic;text-align:center;} table.annotated-item{width:100%;border-collapse:collapse;} diff -r 3563fade2c86 -r 97fe4a44b3bf static/june_2007_style/embed_item.css.tmpl --- a/static/june_2007_style/embed_item.css.tmpl Fri Mar 05 17:21:16 2010 -0500 +++ b/static/june_2007_style/embed_item.css.tmpl Mon Mar 08 11:37:35 2010 -0500 @@ -1,24 +1,58 @@ .embedded-item { - background-color: #BBBBBB; - margin-left: auto; - margin-right: auto; - width: 90%; - max-height: 25em; - overflow: auto; + margin-left:auto; + margin-right:auto; + width:90%; padding: 0.5em; - -moz-border-radius: .5em; - -webkit-border-radius: .5em; - border-radius: .5em; + -moz-border-radius:0.5em; + -webkit-border-radius:0.5em; + border-radius:0.5em; } -.embedded-item.placeholder {} + +.embedded-item.history { + background-color:#C1C9E5 +} + +.embedded-item.dataset { + background-color:#CFC +} + +.embedded-item.workflow { + background-color:#EBD9B2 +} + +.embedded-item.placeholder{} + +.embedded-item .item-content { + max-height: 25em; + overflow: auto; +} + .embedded-item .title { - font-weight: bold; - font-size:120%; vertical-align:top; text-align:center; } -.embedded-item.placeholder .content{ + +.embedded-item.placeholder .content { padding: 1em 1em; font-style:italic; text-align:center; - } \ No newline at end of file +} + +table.annotated-item { + width:100%; + border-collapse:collapse; +} + +table.annotated-item td,th { + padding:0; +} + +table.annotated-item .annotation { + padding-left:2em; + width:40%; +} + +table.annotated-item td.annotation { + vertical-align:text-top; + padding-top:1em; +} \ No newline at end of file diff -r 3563fade2c86 -r 97fe4a44b3bf templates/dataset/embed.mako --- a/templates/dataset/embed.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/dataset/embed.mako Mon Mar 08 11:37:35 2010 -0500 @@ -3,8 +3,13 @@ from galaxy.web.framework.helpers import iff %> -<%def name="content( dataset, data )"> - <ul> - <li>Format : ${dataset.extension} - </ul> +<%def name="render_item_specific_title_links( dataset )"> + <a href="${h.url_for( controller='/dataset', action='display', dataset_id=trans.security.encode_id( dataset.id ), to_ext=dataset.ext )}" title="Save dataset" class="icon-button disk tooltip"></a> </%def> + +<%def name="render_summary_content( dataset, data )"> +## <ul> +## <li>Format : ${dataset.extension} +## <pre>${dataset.peek}</pre> +## </ul> +</%def> diff -r 3563fade2c86 -r 97fe4a44b3bf templates/display_base.mako --- a/templates/display_base.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/display_base.mako Mon Mar 08 11:37:35 2010 -0500 @@ -32,7 +32,7 @@ <%def name="javascripts()"> ${parent.javascripts()} - ${h.js( "galaxy.base", "jquery", "json2", "jquery.autocomplete", "autocomplete_tagging" )} + ${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "jquery.autocomplete", "jquery.jstore-all", "autocomplete_tagging" )} <script type="text/javascript"> // @@ -102,7 +102,7 @@ <%def name="render_item_header( item )"> <h3>Galaxy ${get_class_display_name( item.__class__ )} '${get_item_name( item )| h}'</h3> %if hasattr( item, "annotation"): - <div class="annotation">Description/Notes: ${item.annotation}</div> + <div class="annotation">Annotation: ${item.annotation}</div> %endif <hr/> </%def> diff -r 3563fade2c86 -r 97fe4a44b3bf templates/embed_base.mako --- a/templates/embed_base.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/embed_base.mako Mon Mar 08 11:37:35 2010 -0500 @@ -6,36 +6,50 @@ <%namespace file="/display_common.mako" import="*" /> ## HTML structure. -<div class='embedded-item'> +<div class='embedded-item ${get_class_display_name( item.__class__ ).lower()}'> <div class='title'> - ${self.title( item )} + ${self.render_title( item )} + <hr/> </div> - <hr/> <div class='summary-content'> - ${self.content( item, item_data )} + ${self.render_summary_content( item, item_data )} </div> <div class='item-content'> </div> </div> -<%def name="title( item )"> - <h4>Galaxy ${get_class_display_name( item.__class__ )} | ${get_item_name( item )}</h4> +## Render item-specific title links. +<%def name="render_item_specific_title_links( item )"> +</%def> + +<%def name="render_title( item )"> <% + item_display_name = get_class_display_name( item.__class__ ).lower() item_controller = "/%s" % get_controller_name( item ) item_user = get_item_user( item ) item_slug = get_item_slug( item ) display_href = h.url_for( controller=item_controller, action='display_by_username_and_slug', username=item_user.username, slug=item_slug ) %> - <a class="display_in_embed icon-button toggle-expand" item_id="${trans.security.encode_id( item.id )}" item_class="$item.__class__.__name__" href="${display_href}"></a> - <a class="toggle-contract icon-button" href="${display_href}"></a> - %if hasattr( item, "annotation"): - <div class="annotation">Description/Notes: ${item.annotation}</div> + <div style="float: left"> + <a class="display_in_embed icon-button toggle-expand tooltip" item_id="${trans.security.encode_id( item.id )}" item_class="$item.__class__.__name__" href="${display_href}" + title="Show ${item_display_name} content"></a> + <a class="toggle-contract icon-button tooltip" href="${display_href}" title="Hide ${item_display_name} content"></a> + </div> + <div style="float: right"> + ${self.render_item_specific_title_links( item )} + ## Links applicable for all items. + <a href="${h.url_for( controller=item_controller, action='imp', id=trans.security.encode_id( item.id ) )}" title="Import ${item_display_name}" class="icon-button import tooltip"></a> + <a class="icon-button go-to-full-screen tooltip" href="${display_href}" title="Go to ${item_display_name}"></a> + </div> + <h4><a class="toggle-embed tooltip" href="${display_href}" title="Show or hide ${item_display_name} content">Galaxy ${get_class_display_name( item.__class__ )} | ${get_item_name( item )}</a></h4> + %if hasattr( item, "annotation") and item.annotation: + <div class="annotation">${item.annotation}</div> %endif ## Use a hidden var to store the ajax URL for getting an item's content. <input type="hidden" name="ajax-item-content-url" value="${h.url_for( controller=item_controller, action='get_item_content_async', id=trans.security.encode_id( item.id ) )}"/> </%def> -## Methods to override to generate content. -<%def name="content( item, item_data )"> +## Methods to override to render summary content. +<%def name="render_summary_content( item, item_data )"> </%def> diff -r 3563fade2c86 -r 97fe4a44b3bf templates/history/embed.mako --- a/templates/history/embed.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/history/embed.mako Mon Mar 08 11:37:35 2010 -0500 @@ -3,10 +3,11 @@ from galaxy.web.framework.helpers import iff %> -<%def name="content( history, datasets )"> - <ul> - <% num_datasets = len ( datasets ) %> - <li>${num_datasets} dataset${iff( num_datasets != 1, "s", "" )} - <li>Operations: ... - </ul> +<%def name="render_summary_content( history, datasets )"> + +## <ul> +## <% num_datasets = len ( datasets ) %> +## <li>${num_datasets} dataset${iff( num_datasets != 1, "s", "" )} +## <li>Operations: ... +## </ul> </%def> diff -r 3563fade2c86 -r 97fe4a44b3bf templates/page/display.mako --- a/templates/page/display.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/page/display.mako Mon Mar 08 11:37:35 2010 -0500 @@ -2,7 +2,6 @@ <%def name="javascripts()"> ${parent.javascripts()} - ${h.js( "jquery", "json2", "jquery.jstore-all", "jquery.autocomplete", "autocomplete_tagging" )} <script type="text/javascript"> $(function() { // Load jStore for local storage @@ -31,47 +30,68 @@ // (b) ... $('.embedded-item').each( function() { - // Setup toggle expand. var container = $(this); - var toggle_expand = $(this).find('.toggle-expand'); - toggle_expand.click( function() - { + + // Show embedded item. + var show_embedded_item = function() { var ajax_url = container.find("input[type=hidden]").val(); // Only get item content if it's not already there. var item_content = $.trim(container.find(".item-content").text()); if (item_content == "") - $.ajax({ - type: "GET", - url: ajax_url, - error: function() { alert("Getting item content failed."); }, - success: function( item_content ) { - container.find(".summary-content").hide("fast"); - container.find(".item-content").html(item_content).show("fast"); - container.find(".toggle-expand").hide(); - container.find(".toggle-contract").show(); - } - }); + $.ajax({ + type: "GET", + url: ajax_url, + error: function() { alert("Getting item content failed."); }, + success: function( item_content ) { + container.find(".summary-content").hide("fast"); + container.find(".item-content").html(item_content).show("fast"); + container.find(".toggle-expand").hide(); + container.find(".toggle-contract").show(); + } + }); else { - container.find(".summary-content").hide("fast"); - container.find(".item-content").show("fast"); - container.find(".toggle-expand").hide(); - container.find(".toggle-contract").show(); - } + container.find(".summary-content").hide("fast"); + container.find(".item-content").show("fast"); + container.find(".toggle-expand").hide(); + container.find(".toggle-contract").show(); + } + }; + + // Hide embedded item. + var hide_embedded_item = function() { + container.find(".item-content").hide("fast"); + container.find(".summary-content").show("fast"); + container.find(".toggle-contract").hide(); + container.find(".toggle-expand").show(); + }; + + // Setup toggle expand. + var toggle_expand = $(this).find('.toggle-expand'); + toggle_expand.click( function() + { + show_embedded_item(); return false; }); + // Setup toggle contract. var toggle_contract = $(this).find('.toggle-contract'); toggle_contract.click( function() { - container.find(".item-content").hide("fast"); - container.find(".summary-content").show("fast"); - container.find(".toggle-contract").hide(); - container.find(".toggle-expand").show(); + hide_embedded_item(); return false; }); - + // Setup toggle embed. + var toggle_embed = $(this).find('.toggle-embed'); + toggle_embed.click( function() + { + if (container.find(".item-content").is(":visible")) + hide_embedded_item(); + else + show_embedded_item(); + return false; + }); }); }); // Functionized so AJAX'd datasets can call them @@ -199,6 +219,9 @@ <style type="text/css"> .toggle-contract { display: none; } .item-content { overflow: auto; } + .embedded-item h4 { + margin: 0px; + } </style> </%def> diff -r 3563fade2c86 -r 97fe4a44b3bf templates/page/editor.mako --- a/templates/page/editor.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/page/editor.mako Mon Mar 08 11:37:35 2010 -0500 @@ -119,6 +119,19 @@ }; }; + // Make an item importable. + function make_item_importable( item_controller, item_id, item_type ) + { + url_template = "${h.url_for( controller='ITEM_CONTROLLER', action='set_accessible_async' )}"; + ajax_url = url_template.replace( "ITEM_CONTROLLER", item_controller ); + $.ajax({ + type: "POST", + url: ajax_url, + data: { id: item_id, accessible: 'True' }, + error: function() { alert("Making " + item_type + " accessible failed"); } + }); + }; + ## Completely replace WYM's dialog handling WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHtml ) { @@ -340,7 +353,7 @@ { "Insert": function() { - // Make items accessible (importable) ? + // Make selected items accessible (importable) ? var make_importable = false; if ( $('#make-importable:checked').val() !== null ) make_importable = true; @@ -352,16 +365,7 @@ // Make item importable? if (make_importable) - { - url_template = "${h.url_for( controller='ITEM_CONTROLLER', action='set_accessible_async' )}"; - ajax_url = url_template.replace( "ITEM_CONTROLLER", item_info.controller); - $.ajax({ - type: "POST", - url: ajax_url, - data: { id: item_id, accessible: 'True' }, - error: function() { alert("Making " + item_info.plural.toLowerCase() + " accessible failed"); } - }); - } + make_item_importable(item_info.controller, item_id, item_info.singular); // Insert link(s) to item(s). This is done by getting item info and then manipulating wym. url_template = "${h.url_for( controller='ITEM_CONTROLLER', action='get_name_and_link_async' )}?id=" + item_id; @@ -427,29 +431,43 @@ error: function() { alert( "Failed to list " + item_info.plural.toLowerCase() + " for selection"); }, success: function(list_html) { + // Can make histories, workflows importable; cannot make datasets importable. + if (dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW) + list_html = list_html + "<div><input id='make-importable' type='checkbox' checked/>" + + "Make the selected " + item_info.plural.toLowerCase() + " accessible so that they can viewed by everyone.</div>"; show_modal( "Embed " + item_info.plural, list_html, { "Embed": function() - { - // Embed a Galaxy item. - var item_ids = new Array(); + { + // Make selected items accessible (importable) ? + var make_importable = false; + if ( $('#make-importable:checked').val() != null ) + make_importable = true; + $('input[name=id]:checked').each(function() { // Get item ID and name. var item_id = $(this).val(); // Use ':first' because there are many labels in table; the first one is the item name. var item_name = $("label[for='" + item_id + "']:first").text(); + if (make_importable) + make_item_importable(item_info.controller, item_id, item_info.singular); + // Embedded item HTML; item class is embedded in div container classes; this is necessary because the editor strips // all non-standard attributes when it returns its content (e.g. it will not return an element attribute of the form // item_class='History'). - var item_embed_html = - "<p><div id='" + item_info.iclass + "-" + item_id + "' class='embedded-item placeholder'> \ + var item_embed_html = + "<p> \ + <div id='" + item_info.iclass + "-" + item_id + "' class='embedded-item " + item_info.singular.toLowerCase() + + " placeholder'> \ <div class='title'> Embedded Galaxy " + item_info.singular + " '" + item_name + "'</div> \ - <div class='content'>[Do not edit this block; Galaxy will fill it in with the annotated " + \ - item_info.singular.toLowerCase() + " when it is displayed.]</div> \ - </div></p><p>"; + <div class='content'> \ + [Do not edit this block; Galaxy will fill it in with the annotated " + + item_info.singular.toLowerCase() + " when it is displayed.]</div> \ + </div> \ + </div></p>"; // Insert embedded representation into document. wym.insert(item_embed_html); diff -r 3563fade2c86 -r 97fe4a44b3bf templates/workflow/embed.mako --- a/templates/workflow/embed.mako Fri Mar 05 17:21:16 2010 -0500 +++ b/templates/workflow/embed.mako Mon Mar 08 11:37:35 2010 -0500 @@ -3,10 +3,10 @@ from galaxy.web.framework.helpers import iff %> -<%def name="content( workflow, steps )"> - <ul> - <% num_steps = len ( steps ) %> - <li>${num_steps} step${iff( num_steps != 1, "s", "" )} - <li>Operations: ... - </ul> +<%def name="render_summary_content( workflow, steps )"> +## <ul> +## <% num_steps = len ( steps ) %> +## <li>${num_steps} step${iff( num_steps != 1, "s", "" )} +## <li>Operations: ... +## </ul> </%def>
participants (1)
-
Greg Von Kuster