From e1d02e9806c3df1f3a95aec768262d375fdce99f Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 8 Feb 2013 11:23:04 -0500 Subject: [PATCH 01/18] Added tag release_2013.02.08 for changeset 1c7174911392 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ebae9a07218..ef00a92d3fb 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,2 @@ a4113cc1cb5eaa68091c9a73375f00555b66dd11 release_2013.01.13 +1c717491139269651bb59687563da9410b84c65d release_2013.02.08 From 259052352f99b89e2f4e8acbd1f57ef99699b3ba Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Tue, 12 Feb 2013 08:46:28 -0500 Subject: [PATCH 02/18] Allow the CLI runner to handle command stdout >65K. --- lib/galaxy/jobs/runners/cli.py | 1 + lib/galaxy/jobs/runners/cli_shell/rsh.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/jobs/runners/cli.py b/lib/galaxy/jobs/runners/cli.py index b444562dcf9..ace4df7f190 100644 --- a/lib/galaxy/jobs/runners/cli.py +++ b/lib/galaxy/jobs/runners/cli.py @@ -316,6 +316,7 @@ class ShellJobRunner( BaseJobRunner ): if which_try == self.app.config.retry_job_output_collection: stdout = '' stderr = 'Job output not returned from cluster' + exit_code = 0 log.debug( stderr ) else: time.sleep(1) diff --git a/lib/galaxy/jobs/runners/cli_shell/rsh.py b/lib/galaxy/jobs/runners/cli_shell/rsh.py index 67e4bffe118..621abc7a703 100644 --- a/lib/galaxy/jobs/runners/cli_shell/rsh.py +++ b/lib/galaxy/jobs/runners/cli_shell/rsh.py @@ -4,6 +4,7 @@ Interface for remote shell commands (rsh, rcp) and derivatives that use the same import time import logging +import tempfile import subprocess from galaxy.util.bunch import Bunch @@ -28,7 +29,9 @@ class RemoteShell(BaseShellExec): fullcmd = '%s %s %s' % (self.rsh, self.hostname, cmd) else: fullcmd = '%s -l %s %s %s' % (self.rsh, self.username, self.hostname, cmd) - p = subprocess.Popen(fullcmd, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # Read stdout to a tempfile in case it's large (>65K) + outf = tempfile.TemporaryFile() + p = subprocess.Popen(fullcmd, shell=True, stdin=None, stdout=outf, stderr=subprocess.PIPE) # poll until timeout for i in range(timeout/3): r = p.poll() @@ -44,7 +47,8 @@ class RemoteShell(BaseShellExec): except: log.warning('Killing pid %s (cmd: "%s") with signal %s failed' % (p.pid, fullcmd, sig)) return Bunch(stdout='', stderr='Execution timed out', returncode=-1) - return Bunch(stdout=p.stdout.read(), stderr=p.stderr.read(), returncode=p.returncode) + outf.seek(0) + return Bunch(stdout=outf.read(), stderr=p.stderr.read(), returncode=p.returncode) class SecureShell(RemoteShell): From 348f07d21866236b8395b3d871d3548c3bd64157 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 15 Feb 2013 10:53:20 -0500 Subject: [PATCH 03/18] Handle the Torque 'E' job state in the CLI runner. --- lib/galaxy/jobs/runners/cli_job/torque.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/runners/cli_job/torque.py b/lib/galaxy/jobs/runners/cli_job/torque.py index dab29769d8a..7171421cd71 100644 --- a/lib/galaxy/jobs/runners/cli_job/torque.py +++ b/lib/galaxy/jobs/runners/cli_job/torque.py @@ -128,5 +128,6 @@ class Torque(BaseJobExec): return job_states.OK def __get_job_state(self, state): - return { 'R' : job_states.RUNNING, + return { 'E' : job_states.RUNNING, + 'R' : job_states.RUNNING, 'Q' : job_states.QUEUED }.get(state, state) From 12ccf1010d5d076b34d13b20734b99fe84a41e3d Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Mon, 18 Feb 2013 11:04:29 -0500 Subject: [PATCH 04/18] Fix for handling proprietary datatyps definitions in repositories being installed from the tool shed when only datatyes that subclass from those in the Galaxy frameowrk are defined (i.e., there are no proprietary datatype class files for the datatypes). In addition, this changeset now properly handles installing a tool shed repository that included prioretary datatype definitions (they were failing due to a bug in this same method). --- lib/galaxy/util/shed_util.py | 52 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/galaxy/util/shed_util.py b/lib/galaxy/util/shed_util.py index d1fdc6d3465..1b748119ede 100644 --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -120,12 +120,24 @@ def alter_config_and_load_prorietary_datatypes( app, datatypes_config, relative_ be False when a tool shed repository is being installed. Since installation is occurring after the datatypes registry has been initialized, the registry's contents cannot be overridden by conflicting data types. """ - tree = util.parse_xml( datatypes_config ) + try: + tree = util.parse_xml( datatypes_config ) + except Exception, e: + log.debug( "Error parsing %s, exception: %s" % ( datatypes_config, str( e ) ) ) + return None, None datatypes_config_root = tree.getroot() - # Path to datatype converters - converter_path = None - # Path to datatype display applications - display_path = None + registration = datatypes_config_root.find( 'registration' ) + if registration is None: + # We have valid XML, but not a valid proprietary datatypes definition. + return None, None + sniffers = datatypes_config_root.find( 'sniffers' ) + converter_path, display_path = get_converter_and_display_paths( registration, relative_install_dir ) + if converter_path: + # Path to datatype converters + registration.attrib[ 'proprietary_converter_path' ] = converter_path + if display_path: + # Path to datatype display applications + registration.attrib[ 'proprietary_display_path' ] = display_path relative_path_to_datatype_file_name = None datatype_files = datatypes_config_root.find( 'datatype_files' ) datatype_class_modules = [] @@ -148,12 +160,6 @@ def alter_config_and_load_prorietary_datatypes( app, datatypes_config, relative_ break break if datatype_class_modules: - registration = datatypes_config_root.find( 'registration' ) - converter_path, display_path = get_converter_and_display_paths( registration, relative_install_dir ) - if converter_path: - registration.attrib[ 'proprietary_converter_path' ] = converter_path - if display_path: - registration.attrib[ 'proprietary_display_path' ] = display_path for relative_path_to_datatype_file_name in datatype_class_modules: datatype_file_name_path, datatype_file_name = os.path.split( relative_path_to_datatype_file_name ) for elem in registration.findall( 'datatype' ): @@ -170,20 +176,16 @@ def alter_config_and_load_prorietary_datatypes( app, datatypes_config, relative_ # The value of proprietary_path must be an absolute path due to job_working_directory. elem.attrib[ 'proprietary_path' ] = os.path.abspath( datatype_file_name_path ) elem.attrib[ 'proprietary_datatype_module' ] = proprietary_datatype_module - sniffers = datatypes_config_root.find( 'sniffers' ) - else: - sniffers = None - fd, proprietary_datatypes_config = tempfile.mkstemp() - os.write( fd, '\n' ) - os.write( fd, '\n' ) - os.write( fd, '%s' % util.xml_to_string( registration ) ) - if sniffers: - os.write( fd, '%s' % util.xml_to_string( sniffers ) ) - os.write( fd, '\n' ) - os.close( fd ) - os.chmod( proprietary_datatypes_config, 0644 ) - else: - proprietary_datatypes_config = datatypes_config + # Temporarily persist the proprietary datatypes configuration file so it can be loaded into the datatypes registry. + fd, proprietary_datatypes_config = tempfile.mkstemp() + os.write( fd, '\n' ) + os.write( fd, '\n' ) + os.write( fd, '%s' % util.xml_to_string( registration ) ) + if sniffers: + os.write( fd, '%s' % util.xml_to_string( sniffers ) ) + os.write( fd, '\n' ) + os.close( fd ) + os.chmod( proprietary_datatypes_config, 0644 ) # Load proprietary datatypes app.datatypes_registry.load_datatypes( root_dir=app.config.root, config=proprietary_datatypes_config, deactivate=deactivate, override=override ) if datatype_files: From 134b1159e05fc1c15289322b39177f913726beb4 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Mon, 18 Feb 2013 15:28:06 -0500 Subject: [PATCH 05/18] Fix for installing a repository from the tool shed that includes a repository dependency defintion where the required repository is owned by a user other than the dependent repository. --- lib/galaxy/util/shed_util.py | 6 +++++- lib/galaxy/util/shed_util_common.py | 6 ++++++ .../webapps/community/controllers/repository.py | 15 +++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/util/shed_util.py b/lib/galaxy/util/shed_util.py index 1b748119ede..1000c666913 100644 --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -714,7 +714,11 @@ def get_installed_and_missing_repository_dependencies_for_new_install( trans, re for rd_tup in rd_tups: tool_shed, name, owner, changeset_revision = rd_tup # Updates to installed repository revisions may have occurred, so make sure to locate the appropriate repository revision if one exists. - repository, current_changeset_revision = repository_was_previously_installed( trans, tool_shed, name, repo_info_tuple ) + # We need to create a temporary repo_info_tuple that includes the correct repository owner which we get from the current rd_tup. The current + # tuple looks like: ( description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, installed_td ) + tmp_clone_url = suc.generate_clone_url_from_repo_info_tup( rd_tup ) + tmp_repo_info_tuple = ( None, tmp_clone_url, changeset_revision, None, owner, None, None ) + repository, current_changeset_revision = repository_was_previously_installed( trans, tool_shed, name, tmp_repo_info_tuple ) if repository: new_rd_tup = [ tool_shed, name, owner, changeset_revision, repository.id, repository.status ] if repository.status == trans.model.ToolShedRepository.installation_status.INSTALLED: diff --git a/lib/galaxy/util/shed_util_common.py b/lib/galaxy/util/shed_util_common.py index e22df6d12d8..6e3f47a5ca2 100644 --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -953,6 +953,12 @@ def generate_clone_url_for_repository_in_tool_shed( trans, repository ): return '%s://%s%s/repos/%s/%s' % ( protocol, username, base, repository.user.username, repository.name ) else: return '%s/repos/%s/%s' % ( base_url, repository.user.username, repository.name ) +def generate_clone_url_from_repo_info_tup( repo_info_tup ): + """Generate teh URL for cloning a repositoyr given a tuple of toolshed, name, owner, changeset_revision.""" + # Example tuple: ['http://localhost:9009', 'blast_datatypes', 'test', '461a4216e8ab'] + toolshed, name, owner, changeset_revision = repo_info_tup + # Don't include the changeset_revision in clone urls. + return url_join( toolshed, 'repos', owner, name ) def generate_datatypes_metadata( datatypes_config, metadata_dict ): """Update the received metadata_dict with information from the parsed datatypes_config.""" tree = ElementTree.parse( datatypes_config ) diff --git a/lib/galaxy/webapps/community/controllers/repository.py b/lib/galaxy/webapps/community/controllers/repository.py index e265db08456..a7a05e66757 100644 --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -1461,12 +1461,15 @@ class RepositoryController( BaseUIController, common_util.ItemRatings ): repository_clone_url = suc.generate_clone_url_for_repository_in_tool_shed( trans, repository ) repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) metadata = repository_metadata.metadata - if not includes_tools and 'tools' in metadata: - includes_tools = True - if not has_repository_dependencies and 'repository_dependencies' in metadata: - has_repository_dependencies = True - if not includes_tool_dependencies and 'tool_dependencies' in metadata: - includes_tool_dependencies = True + if not includes_tools: + if 'tools' in metadata: + includes_tools = True + if not has_repository_dependencies: + if 'repository_dependencies' in metadata: + has_repository_dependencies = True + if not includes_tool_dependencies: + if 'tool_dependencies' in metadata: + includes_tool_dependencies = True repo_dir = repository.repo_path( trans.app ) repo = hg.repository( suc.get_configured_ui(), repo_dir ) ctx = suc.get_changectx_for_changeset( repo, changeset_revision ) From 578e6daae0839e8402434bf03b182000ea87ed07 Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Tue, 19 Feb 2013 12:29:29 -0500 Subject: [PATCH 06/18] Fix for installing a repository that only contains a workflow, then importing that workflow to Galaxy. --- lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index 814d73379e0..60d0bb13384 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -740,8 +740,8 @@ class AdminToolshed( AdminGalaxy ): repository = suc.get_tool_shed_repository_by_id( trans, repository_id ) changeset_revision = repository.changeset_revision metadata = repository.metadata - workflows = metadata[ 'workflows' ] - tools_metadata = metadata[ 'tools' ] + workflows = metadata.get( 'workflows', [] ) + tools_metadata = metadata.get( 'tools', [] ) workflow_dict = None for workflow_data_tuple in workflows: # The value of workflow_data_tuple is ( relative_path_to_workflow_file, exported_workflow_dict ). From eaa7abf045e22b96c0f7ac765c9157517730553b Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Wed, 20 Feb 2013 08:56:36 -0500 Subject: [PATCH 07/18] Fix missing import in repository controller. --- lib/galaxy/webapps/community/controllers/repository.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/community/controllers/repository.py b/lib/galaxy/webapps/community/controllers/repository.py index a7a05e66757..1efbaba5802 100644 --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -1,4 +1,4 @@ -import os, logging, re, tempfile, shutil, ConfigParser +import os, logging, re, tempfile, shutil, ConfigParser, string from time import gmtime, strftime from datetime import date, datetime from galaxy import util, web From c88a954b756d9a81d107323eb9b8ff529c710d90 Mon Sep 17 00:00:00 2001 From: Jeremy Goecks Date: Sun, 17 Feb 2013 14:59:02 -0500 Subject: [PATCH 08/18] Move grid element initialization to main body to prevent it from happening too early. Pack scripts. --- static/scripts/galaxy.grids.js | 12 ------------ static/scripts/packed/galaxy.grids.js | 2 +- static/scripts/packed/viz/visualization.js | 2 +- templates/grid_base.mako | 13 +++++++++++++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/static/scripts/galaxy.grids.js b/static/scripts/galaxy.grids.js index 881053b2371..72e6561e132 100644 --- a/static/scripts/galaxy.grids.js +++ b/static/scripts/galaxy.grids.js @@ -4,18 +4,6 @@ // not appended to the identifier of a nested array. jQuery.ajaxSettings.traditional = true; -// Initialize grid objects on load. -$(document).ready(function() { - init_grid_elements(); - init_grid_controls(); - - // Initialize text filters to select text on click and use normal font when user is typing. - $('input[type=text]').each(function() { - $(this).click(function() { $(this).select(); } ) - .keyup(function () { $(this).css("font-style", "normal"); }); - }); -}); - /** * A Galaxy grid. */ diff --git a/static/scripts/packed/galaxy.grids.js b/static/scripts/packed/galaxy.grids.js index a982db79c4c..e7aaedb84b1 100644 --- a/static/scripts/packed/galaxy.grids.js +++ b/static/scripts/packed/galaxy.grids.js @@ -1 +1 @@ -jQuery.ajaxSettings.traditional=true;$(document).ready(function(){init_grid_elements();init_grid_controls();$("input[type=text]").each(function(){$(this).click(function(){$(this).select()}).keyup(function(){$(this).css("font-style","normal")})})});var Grid=Backbone.Model.extend({defaults:{url_base:"",async:false,async_ops:[],categorical_filters:[],filters:{},sort_key:null,show_item_checkboxes:false,cur_page:1,num_pages:1,operation:undefined,item_ids:undefined},can_async_op:function(a){return _.indexOf(this.attributes.async_ops,a)!==-1},add_filter:function(e,f,b){if(b){var c=this.attributes.key,a;if(c===null||c===undefined){a=f}else{if(typeof(c)=="string"){if(c=="All"){a=f}else{var d=[];d[0]=c;d[1]=f;a=d}}else{a=c;a.push(f)}}this.attributes.filters[e]=a}else{this.attributes.filters[e]=f}},remove_filter:function(b,e){var a=this.attributes.filters[b];if(a===null||a===undefined){return false}var d=true;if(typeof(a)==="string"){if(a=="All"){d=false}else{delete this.attributes.filters[b]}}else{var c=_.indexOf(a,e);if(c!==-1){a.splice(c,1)}else{d=false}}return d},get_url_data:function(){var a={async:this.attributes.async,sort:this.attributes.sort_key,page:this.attributes.cur_page,show_item_checkboxes:this.attributes.show_item_checkboxes};if(this.attributes.operation){a.operation=this.attributes.operation}if(this.attributes.item_ids){a.id=this.attributes.item_ids}var b=this;_.each(_.keys(b.attributes.filters),function(c){a["f-"+c]=b.attributes.filters[c]});return a}});function init_operation_buttons(){$("input[name=operation]:submit").each(function(){$(this).click(function(){var b=$(this).val();var a=[];$("input[name=id]:checked").each(function(){a.push($(this).val())});do_operation(b,a)})})}function init_grid_controls(){init_operation_buttons();$(".submit-image").each(function(){$(this).mousedown(function(){$(this).addClass("gray-background")});$(this).mouseup(function(){$(this).removeClass("gray-background")})});$(".sort-link").each(function(){$(this).click(function(){set_sort_condition($(this).attr("sort_key"));return false})});$(".page-link > a").each(function(){$(this).click(function(){set_page($(this).attr("page_num"));return false})});$(".categorical-filter > a").each(function(){$(this).click(function(){set_categorical_filter($(this).attr("filter_key"),$(this).attr("filter_val"));return false})});$(".text-filter-form").each(function(){$(this).submit(function(){var d=$(this).attr("column_key");var c=$("#input-"+d+"-filter");var e=c.val();c.val("");add_filter_condition(d,e,true);return false})});var a=$("#input-tags-filter");if(a.length){a.autocomplete(history_tag_autocomplete_url,{selectFirst:false,autoFill:false,highlight:false,mustMatch:false})}var b=$("#input-name-filter");if(b.length){b.autocomplete(history_name_autocomplete_url,{selectFirst:false,autoFill:false,highlight:false,mustMatch:false})}$(".advanced-search-toggle").each(function(){$(this).click(function(){$("#standard-search").slideToggle("fast");$("#advanced-search").slideToggle("fast");return false})})}function init_grid_elements(){$(".grid").each(function(){var b=$(this).find("input.grid-row-select-checkbox");var a=$(this).find("span.grid-selected-count");var c=function(){a.text($(b).filter(":checked").length)};$(b).each(function(){$(this).change(c)});c()});$(".label").each(function(){var a=$(this).attr("href");if(a!==undefined&&a.indexOf("operation=")!=-1){$(this).click(function(){do_operation_from_href($(this).attr("href"));return false})}});$(".community_rating_star").rating({});make_popup_menus()}function go_page_one(){var a=grid.get("cur_page");if(a!==null&&a!==undefined&&a!=="all"){grid.set("cur_page",1)}}function add_filter_condition(c,e,a){if(e===""){return false}grid.add_filter(c,e,a);var d=$(""+e+"");d.addClass("text-filter-val");d.click(function(){grid.remove_filter(c,e);$(this).remove();go_page_one();update_grid()});var b=$("#"+c+"-filtering-criteria");b.append(d);go_page_one();update_grid()}function add_tag_to_grid_filter(c,b){var a=c+(b!==undefined&&b!==""?":"+b:"");$("#advanced-search").show("fast");add_filter_condition("tags",a,true)}function set_sort_condition(f){var e=grid.get("sort_key");var d=f;if(e.indexOf(f)!==-1){if(e.substring(0,1)!=="-"){d="-"+f}else{}}$(".sort-arrow").remove();var c=(d.substring(0,1)=="-")?"↑":"↓";var a=$(""+c+"").addClass("sort-arrow");var b=$("#"+f+"-header");b.append(a);grid.set("sort_key",d);go_page_one();update_grid()}function set_categorical_filter(b,d){var a=grid.get("categorical_filters")[b],c=grid.get("filters")[b];$("."+b+"-filter").each(function(){var h=$.trim($(this).text());var f=a[h];var g=f[b];if(g==d){$(this).empty();$(this).addClass("current-filter");$(this).append(h)}else{if(g==c){$(this).empty();var e=$(""+h+"");e.click(function(){set_categorical_filter(b,g)});$(this).removeClass("current-filter");$(this).append(e)}}});grid.add_filter(b,d);go_page_one();update_grid()}function set_page(a){$(".page-link").each(function(){var g=$(this).attr("id"),e=parseInt(g.split("-")[2],10),c=grid.get("cur_page"),f;if(e===a){f=$(this).children().text();$(this).empty();$(this).addClass("inactive-link");$(this).text(f)}else{if(e===c){f=$(this).text();$(this).empty();$(this).removeClass("inactive-link");var d=$(""+f+"");d.click(function(){set_page(e)});$(this).append(d)}}});var b=true;if(a==="all"){grid.set("cur_page",a);b=false}else{grid.set("cur_page",parseInt(a,10))}update_grid(b)}function do_operation(b,a){b=b.toLowerCase();grid.set({operation:b,item_ids:a});if(grid.can_async_op(b)){update_grid(true)}else{go_to_URL()}}function do_operation_from_href(c){var f=c.split("?");if(f.length>1){var a=f[1];var e=a.split("&");var b=null;var g=-1;for(var d=0;d a").each(function(){$(this).click(function(){set_page($(this).attr("page_num"));return false})});$(".categorical-filter > a").each(function(){$(this).click(function(){set_categorical_filter($(this).attr("filter_key"),$(this).attr("filter_val"));return false})});$(".text-filter-form").each(function(){$(this).submit(function(){var d=$(this).attr("column_key");var c=$("#input-"+d+"-filter");var e=c.val();c.val("");add_filter_condition(d,e,true);return false})});var a=$("#input-tags-filter");if(a.length){a.autocomplete(history_tag_autocomplete_url,{selectFirst:false,autoFill:false,highlight:false,mustMatch:false})}var b=$("#input-name-filter");if(b.length){b.autocomplete(history_name_autocomplete_url,{selectFirst:false,autoFill:false,highlight:false,mustMatch:false})}$(".advanced-search-toggle").each(function(){$(this).click(function(){$("#standard-search").slideToggle("fast");$("#advanced-search").slideToggle("fast");return false})})}function init_grid_elements(){$(".grid").each(function(){var b=$(this).find("input.grid-row-select-checkbox");var a=$(this).find("span.grid-selected-count");var c=function(){a.text($(b).filter(":checked").length)};$(b).each(function(){$(this).change(c)});c()});$(".label").each(function(){var a=$(this).attr("href");if(a!==undefined&&a.indexOf("operation=")!=-1){$(this).click(function(){do_operation_from_href($(this).attr("href"));return false})}});$(".community_rating_star").rating({});make_popup_menus()}function go_page_one(){var a=grid.get("cur_page");if(a!==null&&a!==undefined&&a!=="all"){grid.set("cur_page",1)}}function add_filter_condition(c,e,a){if(e===""){return false}grid.add_filter(c,e,a);var d=$(""+e+"");d.addClass("text-filter-val");d.click(function(){grid.remove_filter(c,e);$(this).remove();go_page_one();update_grid()});var b=$("#"+c+"-filtering-criteria");b.append(d);go_page_one();update_grid()}function add_tag_to_grid_filter(c,b){var a=c+(b!==undefined&&b!==""?":"+b:"");$("#advanced-search").show("fast");add_filter_condition("tags",a,true)}function set_sort_condition(f){var e=grid.get("sort_key");var d=f;if(e.indexOf(f)!==-1){if(e.substring(0,1)!=="-"){d="-"+f}else{}}$(".sort-arrow").remove();var c=(d.substring(0,1)=="-")?"↑":"↓";var a=$(""+c+"").addClass("sort-arrow");var b=$("#"+f+"-header");b.append(a);grid.set("sort_key",d);go_page_one();update_grid()}function set_categorical_filter(b,d){var a=grid.get("categorical_filters")[b],c=grid.get("filters")[b];$("."+b+"-filter").each(function(){var h=$.trim($(this).text());var f=a[h];var g=f[b];if(g==d){$(this).empty();$(this).addClass("current-filter");$(this).append(h)}else{if(g==c){$(this).empty();var e=$(""+h+"");e.click(function(){set_categorical_filter(b,g)});$(this).removeClass("current-filter");$(this).append(e)}}});grid.add_filter(b,d);go_page_one();update_grid()}function set_page(a){$(".page-link").each(function(){var g=$(this).attr("id"),e=parseInt(g.split("-")[2],10),c=grid.get("cur_page"),f;if(e===a){f=$(this).children().text();$(this).empty();$(this).addClass("inactive-link");$(this).text(f)}else{if(e===c){f=$(this).text();$(this).empty();$(this).removeClass("inactive-link");var d=$(""+f+"");d.click(function(){set_page(e)});$(this).append(d)}}});var b=true;if(a==="all"){grid.set("cur_page",a);b=false}else{grid.set("cur_page",parseInt(a,10))}update_grid(b)}function do_operation(b,a){b=b.toLowerCase();grid.set({operation:b,item_ids:a});if(grid.can_async_op(b)){update_grid(true)}else{go_to_URL()}}function do_operation_from_href(c){var f=c.split("?");if(f.length>1){var a=f[1];var e=a.split("&");var b=null;var g=-1;for(var d=0;d")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(u)}u.manager=this;return u}});var q=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(u){this.clear()},get_elt:function(v){var w=this.attributes.obj_cache,x=this.attributes.key_ary,u=x.indexOf(v);if(u!==-1){if(w[v].stale){x.splice(u,1);delete w[v]}else{this.move_key_to_end(v,u)}}return w[v]},set_elt:function(v,x){var y=this.attributes.obj_cache,z=this.attributes.key_ary,w=this.attributes.num_elements;if(!y[v]){if(z.length>=w){var u=z.shift();delete y[u]}z.push(v)}y[v]=x;return x},move_key_to_end:function(v,u){this.attributes.key_ary.splice(u,1);this.attributes.key_ary.push(v)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var d=q.extend({defaults:s.extend({},q.prototype.defaults,{dataset:null,init_data:null,filters_manager:null,data_type:"data",data_mode_compatible:function(u,v){return true},can_subset:function(u){return false}}),initialize:function(u){q.prototype.initialize.call(this);var v=this.get("init_data");if(v){this.add_data(v)}},add_data:function(u){if(this.get("num_elements")1){return{data:null}}return d.prototype.load_data.call(this,w,x,u,v)}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(u){this.id=u.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(u){var v=s.find(this.get_chroms_info(),function(w){return w.chrom==u});return new g({chrom:v.chrom,end:v.len})}});var g=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0},initialize:function(v){if(v.from_str){var x=v.from_str.split(":"),w=x[0],u=x[1].split("-");this.set({chrom:w,start:parseInt(u[0],10),end:parseInt(u[1],10)})}},copy:function(){return new g({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(B){var v=this.get("chrom"),A=B.get("chrom"),z=this.get("start"),x=B.get("start"),y=this.get("end"),w=B.get("end"),u;if(v&&A&&v!==A){return g.overlap_results.DIF_CHROMS}if(zw){u=g.overlap_results.AFTER}else{if(y<=w){u=g.overlap_results.CONTAINED_BY}else{u=g.overlap_results.OVERLAP_END}}}return u},contains:function(u){return this.compute_overlap(u)===g.overlap_results.CONTAINS},overlaps:function(u){return s.intersection([this.compute_overlap(u)],[g.overlap_results.DIF_CHROMS,g.overlap_results.BEFORE,g.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var m=Backbone.Collection.extend({model:g});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:g}]});var r=Backbone.Collection.extend({model:e});var t=i.Dataset.extend({initialize:function(u){this.set("id",u.dataset_id);this.set("config",p.ConfigSettingCollection.from_config_dict(u.prefs));this.get("config").add([{key:"name",value:this.get("name")},{key:"color"}]);var v=this.get("preloaded_data");if(v){v=v.data}else{v=[]}this.set("data_manager",new d({dataset:this,init_data:v}))}});var o=Backbone.RelationalModel.extend({defaults:{title:"",type:""},url:galaxy_paths.get("visualization_url"),save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=o.extend({defaults:s.extend({},o.prototype.defaults,{dbkey:"",tracks:null,bookmarks:null,viewport:null}),relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:t}],add_tracks:function(u){this.get("tracks").add(u)}});var b=Backbone.Model.extend({});var h=Backbone.Router.extend({initialize:function(v){this.view=v.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var u=this;u.view.on("navigate",function(w){u.navigate(w)})},change_location:function(u){this.view.go_to(u)}});return{BackboneTrack:t,BrowserBookmark:e,BrowserBookmarkCollection:r,Cache:q,CanvasManager:f,Genome:c,GenomeDataManager:d,GenomeRegion:g,GenomeRegionCollection:m,GenomeVisualization:k,ReferenceTrackDataManager:n,TrackBrowserRouter:h,TrackConfig:b,Visualization:o,select_datasets:a}}); \ No newline at end of file +define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(s,i,l,p){var a=function(u,x,w,v){$.ajax({url:u,data:w,error:function(){alert("Grid failed")},success:function(y){show_modal("Select datasets for new tracks",y,{Cancel:function(){hide_modal()},Add:function(){var z=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var A={data_type:"track_config",hda_ldda:"hda"},B=$(this).val();if($(this).attr("name")!=="id"){A.hda_ldda="ldda"}z[z.length]=$.ajax({url:x+"/"+B,data:A,dataType:"json"})});$.when.apply($,z).then(function(){var A=(arguments[0] instanceof Array?$.map(arguments,function(B){return B[0]}):[arguments[0]]);v(A)});hide_modal()}})}})};var j=function(u){return("isResolved" in u)};var f=function(u){this.default_font=u!==undefined?u:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};s.extend(f.prototype,{load_pattern:function(u,y){var v=this.patterns,w=this.dummy_context,x=new Image();x.src=galaxy_paths.attributes.image_path+y;x.onload=function(){v[u]=w.createPattern(x,"repeat")}},get_pattern:function(u){return this.patterns[u]},new_canvas:function(){var u=$("")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(u)}u.manager=this;return u}});var q=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(u){this.clear()},get_elt:function(v){var w=this.attributes.obj_cache,x=this.attributes.key_ary,u=x.indexOf(v);if(u!==-1){if(w[v].stale){x.splice(u,1);delete w[v]}else{this.move_key_to_end(v,u)}}return w[v]},set_elt:function(v,x){var y=this.attributes.obj_cache,z=this.attributes.key_ary,w=this.attributes.num_elements;if(!y[v]){if(z.length>=w){var u=z.shift();delete y[u]}z.push(v)}y[v]=x;return x},move_key_to_end:function(v,u){this.attributes.key_ary.splice(u,1);this.attributes.key_ary.push(v)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var d=q.extend({defaults:s.extend({},q.prototype.defaults,{dataset:null,init_data:null,filters_manager:null,data_type:"data",data_mode_compatible:function(u,v){return true},can_subset:function(u){return false}}),initialize:function(u){q.prototype.initialize.call(this);var v=this.get("init_data");if(v){this.add_data(v)}},add_data:function(u){if(this.get("num_elements")1){return{data:null}}return d.prototype.load_data.call(this,w,x,u,v)}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(u){this.id=u.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(u){var v=s.find(this.get_chroms_info(),function(w){return w.chrom===u});return new g({chrom:v.chrom,end:v.len})}});var g=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0},initialize:function(v){if(v.from_str){var x=v.from_str.split(":"),w=x[0],u=x[1].split("-");this.set({chrom:w,start:parseInt(u[0],10),end:parseInt(u[1],10)})}},copy:function(){return new g({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(B){var v=this.get("chrom"),A=B.get("chrom"),z=this.get("start"),x=B.get("start"),y=this.get("end"),w=B.get("end"),u;if(v&&A&&v!==A){return g.overlap_results.DIF_CHROMS}if(zw){u=g.overlap_results.AFTER}else{if(y<=w){u=g.overlap_results.CONTAINED_BY}else{u=g.overlap_results.OVERLAP_END}}}return u},contains:function(u){return this.compute_overlap(u)===g.overlap_results.CONTAINS},overlaps:function(u){return s.intersection([this.compute_overlap(u)],[g.overlap_results.DIF_CHROMS,g.overlap_results.BEFORE,g.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var m=Backbone.Collection.extend({model:g});var e=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:g}]});var r=Backbone.Collection.extend({model:e});var t=i.Dataset.extend({initialize:function(u){this.set("id",u.dataset_id);this.set("config",p.ConfigSettingCollection.from_config_dict(u.prefs));this.get("config").add([{key:"name",value:this.get("name")},{key:"color"}]);var v=this.get("preloaded_data");if(v){v=v.data}else{v=[]}this.set("data_manager",new d({dataset:this,init_data:v}))}});var o=Backbone.RelationalModel.extend({defaults:{title:"",type:""},url:galaxy_paths.get("visualization_url"),save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=o.extend({defaults:s.extend({},o.prototype.defaults,{dbkey:"",tracks:null,bookmarks:null,viewport:null}),relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:t}],add_tracks:function(u){this.get("tracks").add(u)}});var b=Backbone.Model.extend({});var h=Backbone.Router.extend({initialize:function(v){this.view=v.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var u=this;u.view.on("navigate",function(w){u.navigate(w)})},change_location:function(u){this.view.go_to(u)}});return{BackboneTrack:t,BrowserBookmark:e,BrowserBookmarkCollection:r,Cache:q,CanvasManager:f,Genome:c,GenomeDataManager:d,GenomeRegion:g,GenomeRegionCollection:m,GenomeVisualization:k,ReferenceTrackDataManager:n,TrackBrowserRouter:h,TrackConfig:b,Visualization:o,select_datasets:a}}); \ No newline at end of file diff --git a/templates/grid_base.mako b/templates/grid_base.mako index d37ed911ff4..8571c8013b3 100644 --- a/templates/grid_base.mako +++ b/templates/grid_base.mako @@ -129,6 +129,19 @@ cur_page: ${cur_page_num}, num_pages: ${num_pages} }); + + // Initialize grid objects on load. + // FIXME: use a grid view object eventually. + $(document).ready(function() { + init_grid_elements(); + init_grid_controls(); + + // Initialize text filters to select text on click and use normal font when user is typing. + $('input[type=text]').each(function() { + $(this).click(function() { $(this).select(); } ) + .keyup(function () { $(this).css("font-style", "normal"); }); + }); + }); From 8d356485eaabcb744cac0fa03e4e9aa66fa8204c Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Thu, 21 Feb 2013 11:06:11 -0500 Subject: [PATCH 09/18] Changed to_safe_string to use markupsafe.escape for unsafe characters. --- lib/galaxy/util/shed_util_common.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/galaxy/util/shed_util_common.py b/lib/galaxy/util/shed_util_common.py index 6e3f47a5ca2..85afe4682ab 100644 --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -30,17 +30,11 @@ import markupsafe log = logging.getLogger( __name__ ) INITIAL_CHANGELOG_HASH = '000000000000' -# Characters that must be html escaped -MAPPED_CHARS = { '>' :'>', - '<' :'<', - '"' : '"', - '&' : '&', - '\'' : ''' } MAX_CONTENT_SIZE = 32768 NOT_TOOL_CONFIGS = [ 'datatypes_conf.xml', 'repository_dependencies.xml', 'tool_dependencies.xml' ] GALAXY_ADMIN_TOOL_SHED_CONTROLLER = 'GALAXY_ADMIN_TOOL_SHED_CONTROLLER' TOOL_SHED_ADMIN_CONTROLLER = 'TOOL_SHED_ADMIN_CONTROLLER' -VALID_CHARS = set( string.letters + string.digits + "'\"-=_.()/+*^,:?!#[]%\\$@;{}" ) +VALID_CHARS = set( string.letters + string.digits + "'\"-=_.()/+*^,:?!#[]%\\$@;{}&<>" ) new_repo_email_alert_template = """ Repository name: ${repository_name} @@ -3420,12 +3414,14 @@ def tool_dependency_is_orphan_in_tool_shed( type, name, version, tools ): def to_safe_string( text, to_html=True ): """Translates the characters in text to an html string""" if text: + if to_html: + escaped_text = str( markupsafe.escape( text ) ) + else: + escaped_text = str( text ) translated = [] - for c in text: + for c in escaped_text: if c in VALID_CHARS: translated.append( c ) - elif c in MAPPED_CHARS: - translated.append( MAPPED_CHARS[ c ] ) elif c in [ '\n' ]: if to_html: translated.append( '
' ) @@ -3437,8 +3433,6 @@ def to_safe_string( text, to_html=True ): translated.append( c ) else: translated.append( '' ) - if to_html: - str( markupsafe.escape( ''.join( translated ) ) ) return ''.join( translated ) return text def tool_shed_from_repository_clone_url( repository_clone_url ): From 0d9b986437c8e4b4bf6bc719a92d06c77b0f74b0 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Thu, 21 Feb 2013 11:49:21 -0500 Subject: [PATCH 10/18] Add styles to the readme container. --- templates/webapps/community/repository/common.mako | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/templates/webapps/community/repository/common.mako b/templates/webapps/community/repository/common.mako index 770894d506f..7b9886af2f2 100644 --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -349,13 +349,25 @@ from galaxy.util.shed_util_common import to_safe_string encoded_id = trans.security.encode_id( readme.id ) %> + - ${ to_safe_string( readme.text, to_html=True ) } + + +
${ to_safe_string( readme.text, to_html=True ) }
<% From 622cd9a64e033ef54f96f0cb29df53d5f9686971 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Thu, 21 Feb 2013 15:26:15 -0500 Subject: [PATCH 11/18] Fix for display_in_upload --- lib/galaxy/datatypes/registry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/registry.py b/lib/galaxy/datatypes/registry.py index 384bc091606..ccb02fa9011 100644 --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -90,7 +90,7 @@ class Registry( object ): dtype = elem.get( 'type', None ) type_extension = elem.get( 'type_extension', None ) mimetype = elem.get( 'mimetype', None ) - display_in_upload = elem.get( 'display_in_upload', False ) + display_in_upload = galaxy.util.string_as_bool( elem.get( 'display_in_upload', False ) ) make_subclass = galaxy.util.string_as_bool( elem.get( 'subclass', False ) ) # Proprietary datatypes included in installed tool shed repositories will include two special attributes # (proprietary_path and proprietary_datatype_module) if they depend on proprietary datatypes classes. @@ -107,7 +107,7 @@ class Registry( object ): in_memory_dtype = elem.get( 'type', None ) in_memory_type_extension = elem.get( 'type_extension', None ) in_memory_mimetype = elem.get( 'mimetype', None ) - in_memory_display_in_upload = elem.get( 'display_in_upload', False ) + in_memory_display_in_upload = galaxy.util.string_as_bool( elem.get( 'display_in_upload', False ) ) in_memory_make_subclass = galaxy.util.string_as_bool( elem.get( 'subclass', False ) ) if in_memory_dtype == dtype and in_memory_type_extension == type_extension and in_memory_mimetype == mimetype \ and in_memory_display_in_upload == display_in_upload and in_memory_make_subclass == make_subclass: From 21248457173239610730055ed7de4362395f6b5c Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 22 Feb 2013 17:03:49 -0500 Subject: [PATCH 12/18] Fix for displaying error messages on DataToolParameter where optional=True. --- lib/galaxy/tools/parameters/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 8eb77ff50bd..5b84392d717 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1552,7 +1552,7 @@ class DataToolParameter( ToolParameter ): # although, this should never be called in workflow mode right? if trans.workflow_building_mode: return None - if not value: + if not value and not self.optional: raise ValueError( "History does not include a dataset of the required format / build" ) if value in [None, "None"]: return None From 3407ef783c8ba08321132afe2cf704e4a5d9c8f7 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 6 Mar 2013 12:40:31 -0500 Subject: [PATCH 13/18] Make maf-to-bed object-store aware --- tools/maf/maf_to_bed_code.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/maf/maf_to_bed_code.py b/tools/maf/maf_to_bed_code.py index 2d4860db3f6..b3f552a22ce 100644 --- a/tools/maf/maf_to_bed_code.py +++ b/tools/maf/maf_to_bed_code.py @@ -1,3 +1,4 @@ +import os import pkg_resources; pkg_resources.require( "bx-python" ) from bx.align import maf from galaxy import datatypes, config, jobs @@ -38,7 +39,8 @@ def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr app.model.context.add( history ) app.model.context.flush() try: - move(filepath,newdata.file_name) + app.object_store.update_from_file( newdata.dataset, file_name=filepath, create=True ) + os.unlink( filepath ) newdata.info = newdata.name newdata.state = newdata.states.OK except: From ed606d42efce7db160991bd72e162d2674b911b1 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 6 Mar 2013 13:47:00 -0500 Subject: [PATCH 14/18] Fix display bug for DrillDown Fields and parameters. --- lib/galaxy/tools/parameters/basic.py | 16 ++++++++-------- lib/galaxy/web/form_builder.py | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 5b84392d717..1b0b4ff5177 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1072,9 +1072,9 @@ class DrillDownSelectToolParameter( SelectToolParameter ): >>> print p.get_html()
- +
Heading 1 -
+
Option 1
@@ -1082,9 +1082,9 @@ class DrillDownSelectToolParameter( SelectToolParameter ): Option 2
- +
Heading 1 -
+
Option 3
@@ -1118,9 +1118,9 @@ class DrillDownSelectToolParameter( SelectToolParameter ): >>> print p.get_html()
- +
Heading 1 -
+
Option 1
@@ -1128,9 +1128,9 @@ class DrillDownSelectToolParameter( SelectToolParameter ): Option 2
- +
Heading 1 -
+
Option 3
diff --git a/lib/galaxy/web/form_builder.py b/lib/galaxy/web/form_builder.py index 6741af38003..a153140094b 100644 --- a/lib/galaxy/web/form_builder.py +++ b/lib/galaxy/web/form_builder.py @@ -396,9 +396,9 @@ class DrillDownField( BaseField ): >>> print t.get_html()
- +
Heading 1 -
+
Option 1
@@ -406,9 +406,9 @@ class DrillDownField( BaseField ): Option 2
- +
Heading 1 -
+
Option 3
@@ -427,9 +427,9 @@ class DrillDownField( BaseField ): >>> print t.get_html()
- +
Heading 1 -
+
Option 1
@@ -437,9 +437,9 @@ class DrillDownField( BaseField ): Option 2
- +
Heading 1 -
+
Option 3
@@ -501,10 +501,10 @@ class DrillDownField( BaseField ): html.append( '
') drilldown_group_id = "%s-%s" % ( base_id, hexlify( option['value'] ) ) if option['options']: - html.append( '' % ( span_class, drilldown_group_id ) ) + html.append( '
' % ( span_class, drilldown_group_id ) ) html.append( '%s' % ( self.display, prefix, self.name, escaped_option_value, selected, option['name']) ) if option['options']: - html.append( '
' % ( drilldown_group_id ) ) + html.append( '
' % ( drilldown_group_id ) ) recurse_options( html, option['options'], drilldown_group_id, expanded_options ) html.append( '
') html.append( '
') From 88238a122ddd962693c8babde61eb133f4e4aba8 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 22 Mar 2013 11:43:42 -0400 Subject: [PATCH 15/18] Allow old-style display applications to be disabled. --- lib/galaxy/config.py | 1 + lib/galaxy/webapps/galaxy/controllers/dataset.py | 2 ++ universe_wsgi.ini.sample | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index 036eba7a01a..fd1e1176ea8 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -141,6 +141,7 @@ class Configuration( object ): self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) ) self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) ) self.sanitize_all_html = string_as_bool( kwargs.get( 'sanitize_all_html', True ) ) + self.enable_old_display_applications = string_as_bool( kwargs.get( "enable_old_display_applications", "True" ) ) self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",") self.gbrowse_display_sites = kwargs.get( 'gbrowse_display_sites', "modencode,sgd_yeast,tair,wormbase,wormbase_ws120,wormbase_ws140,wormbase_ws170,wormbase_ws180,wormbase_ws190,wormbase_ws200,wormbase_ws204,wormbase_ws210,wormbase_ws220,wormbase_ws225" ).lower().split(",") self.genetrack_display_sites = kwargs.get( 'genetrack_display_sites', "main,test" ).lower().split(",") diff --git a/lib/galaxy/webapps/galaxy/controllers/dataset.py b/lib/galaxy/webapps/galaxy/controllers/dataset.py index 007225a2aba..d24ab5284d6 100644 --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -700,6 +700,8 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesHistoryMixin, Use @web.expose def display_at( self, trans, dataset_id, filename=None, **kwd ): """Sets up a dataset permissions so it is viewable at an external site""" + if not trans.app.config.enable_old_display_applications: + return trans.show_error_message( "This method of accessing external display applications has been disabled by a Galaxy administrator." ) site = filename data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( dataset_id ) if not data: diff --git a/universe_wsgi.ini.sample b/universe_wsgi.ini.sample index 354ecfda7e6..36e3db897ff 100644 --- a/universe_wsgi.ini.sample +++ b/universe_wsgi.ini.sample @@ -247,6 +247,16 @@ paste.app_factory = galaxy.web.buildapp:app_factory # them). #display_servers = hgw1.cse.ucsc.edu,hgw2.cse.ucsc.edu,hgw3.cse.ucsc.edu,hgw4.cse.ucsc.edu,hgw5.cse.ucsc.edu,hgw6.cse.ucsc.edu,hgw7.cse.ucsc.edu,hgw8.cse.ucsc.edu,lowepub.cse.ucsc.edu +# To disable the old-style display applications that are hardcoded into datatype classes, +# set enable_old_display_applications = False. +# This may be desirable due to using the new-style, XML-defined, display applications that +# have been defined for many of the datatypes that have the old-style. +# There is also a potential security concern with the old-style applications, +# where a malicious party could provide a link that appears to reference the Galaxy server, +# but contains a redirect to a third-party server, tricking a Galaxy user to access said +# site. +#enable_old_display_applications = True + # -- Next gen LIMS interface on top of existing Galaxy Sample/Request management code. use_nglims = False From b7c256dffc2d3c6b9bc3d68b86ae75db3b0af796 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Fri, 22 Mar 2013 12:23:05 -0400 Subject: [PATCH 16/18] Do not display old-style display links in server-side history when they are disabled. --- lib/galaxy/datatypes/data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/data.py b/lib/galaxy/datatypes/data.py index bbc86c5ef1e..2667254aca1 100644 --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -437,12 +437,12 @@ class Data( object ): apply anyway. """ try: - if type in self.get_display_types(): + if app.config.enable_old_display_applications and type in self.get_display_types(): 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 ) ) - return [] + return target_frame, [] def get_converter_types(self, original_dataset, datatypes_registry): """Returns available converters by type for this dataset""" return datatypes_registry.get_converters_by_datatype(original_dataset.ext) From 599e009f478eec4f8d4f0b26228aaa38ac6f2724 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Mon, 1 Apr 2013 12:35:49 -0400 Subject: [PATCH 17/18] Close the next-stable branch. From 3008447c20062fc4c601f1c95f8ecdbe11248f8a Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Mon, 1 Apr 2013 13:16:32 -0400 Subject: [PATCH 18/18] Added tag release_2013.04.01 for changeset 75f09617abaa --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ef00a92d3fb..6d740e3dfb0 100644 --- a/.hgtags +++ b/.hgtags @@ -1,2 +1,3 @@ a4113cc1cb5eaa68091c9a73375f00555b66dd11 release_2013.01.13 1c717491139269651bb59687563da9410b84c65d release_2013.02.08 +75f09617abaadbc8cc732bb8ee519decaeb56ea7 release_2013.04.01