[hg] galaxy 3663: Fix issue where you cannot expand datasets in ...
details: http://www.bx.psu.edu/hg/galaxy/rev/efd404f7a60b changeset: 3663:efd404f7a60b user: Kanwei Li <kanwei@gmail.com> date: Fri Apr 16 18:46:35 2010 -0400 description: Fix issue where you cannot expand datasets in history pane after uploading a new dataset Alphanumeric sort when generating select field for dbkeys trackster now supports custom dbkeys (but datasets don't yet) diffstat: lib/galaxy/web/controllers/tracks.py | 37 ++++++++++++++----- static/images/fugue/chart.png | 0 static/june_2007_style/base.css.tmpl | 8 ++- static/june_2007_style/blue/base.css | 1 + static/scripts/galaxy.base.js | 48 +++++++++++++++++++++---- static/scripts/packed/galaxy.base.js | 2 +- templates/display_base.mako | 2 +- templates/history/view.mako | 2 +- templates/page/display.mako | 2 +- templates/root/history.mako | 29 +++++++++++++++ templates/root/history_common.mako | 14 +++++-- templates/tracks/browser.mako | 65 +++++++++++++++++++--------------- templates/tracks/new_browser.mako | 16 +++++-- templates/user/dbkeys.mako | 4 +- 14 files changed, 165 insertions(+), 65 deletions(-) diffs (527 lines): diff -r 6be8d5818087 -r efd404f7a60b lib/galaxy/web/controllers/tracks.py --- a/lib/galaxy/web/controllers/tracks.py Thu Apr 15 21:41:50 2010 -0400 +++ b/lib/galaxy/web/controllers/tracks.py Fri Apr 16 18:46:35 2010 -0400 @@ -13,14 +13,15 @@ need to support that, but need to make user defined build support better) """ -import math, re, logging +import math, re, logging, glob log = logging.getLogger(__name__) -from galaxy.util.json import to_json_string +from galaxy.util.json import to_json_string, from_json_string from galaxy.web.base.controller import * from galaxy.web.framework import simplejson from galaxy.web.framework.helpers import time_ago, grids from galaxy.util.bunch import Bunch +from galaxy.util import dbnames from galaxy.visualization.tracks.data.array_tree import ArrayTreeDataProvider from galaxy.visualization.tracks.data.interval_index import IntervalIndexDataProvider @@ -78,8 +79,10 @@ """ available_tracks = None + len_dbkeys = None @web.expose + @web.require_login() def index( self, trans ): config = {} @@ -88,12 +91,17 @@ @web.expose @web.require_login() def new_browser( self, trans ): - dbkeys = [ d.metadata.dbkey for d in trans.get_history().datasets if not d.deleted ] - dbkey_set = set( dbkeys ) - if not dbkey_set: - return trans.show_error_message( "Current history has no valid datasets to visualize." ) - else: - return trans.fill_template( "tracks/new_browser.mako", dbkey_set=dbkey_set ) + if not self.len_dbkeys: + len_files = glob.glob(os.path.join( trans.app.config.tool_data_path, 'shared','ucsc','chrom', "*.len" )) + len_files = [ os.path.split(f)[1].split(".len")[0] for f in len_files ] # get xxx.len + loaded_dbkeys = dbnames + self.len_dbkeys = [ (k, v) for k, v in loaded_dbkeys if k in len_files ] + + user_keys = None + user = trans.get_user() + if 'dbkeys' in user.preferences: + user_keys = from_json_string( user.preferences['dbkeys'] ) + return trans.fill_template( "tracks/new_browser.mako", user_keys=user_keys, dbkeys=self.len_dbkeys ) @web.json @web.require_login() @@ -150,6 +158,7 @@ return trans.fill_template( 'tracks/browser.mako', config=config ) @web.json + @web.require_login() def chroms(self, trans, dbkey=None ): """ Returns a naturally sorted list of chroms/contigs for the given dbkey @@ -173,6 +182,12 @@ Called by the browser to get a list of valid chromosomes and lengths """ # If there is any dataset in the history of extension `len`, this will use it + user = trans.get_user() + if 'dbkeys' in user.preferences: + user_keys = from_json_string( user.preferences['dbkeys'] ) + if dbkey in user_keys: + return user_keys[dbkey]['chroms'] + db_manifest = trans.db_dataset_for( dbkey ) if not db_manifest: db_manifest = os.path.join( trans.app.config.tool_data_path, 'shared','ucsc','chrom', "%s.len" % dbkey ) @@ -214,8 +229,6 @@ if not converted_dataset or converted_dataset.state != model.Dataset.states.OK: return messages.PENDING - - extra_info = None if 'index' in data_sources: @@ -236,6 +249,10 @@ data = data_provider.get_data( chrom, low, high, **kwargs ) return { "dataset_type": dataset_type, "extra_info": extra_info, "data": data } + @web.expose + def list_tracks( self, trans, hid ): + return None + @web.json def save( self, trans, **kwargs ): session = trans.sa_session diff -r 6be8d5818087 -r efd404f7a60b static/images/fugue/chart.png Binary file static/images/fugue/chart.png has changed diff -r 6be8d5818087 -r efd404f7a60b static/june_2007_style/base.css.tmpl --- a/static/june_2007_style/base.css.tmpl Thu Apr 15 21:41:50 2010 -0400 +++ b/static/june_2007_style/base.css.tmpl Fri Apr 16 18:46:35 2010 -0400 @@ -791,13 +791,15 @@ -sprite-group: fugue; -sprite-image: fugue/sticky-note-text.png; } - +.icon-button.vis-chart { + background: url(/static/images/fugue/chart.png) no-repeat; +} .icon-button.go-to-full-screen { - background: url(/static/images/fugue/arrow-045.png) no-repeat + background: url(/static/images/fugue/arrow-045.png) no-repeat; } .icon-button.import { - background:url(/static/images/fugue/plus-circle.png) no-repeat + background:url(/static/images/fugue/plus-circle.png) no-repeat; } .tipsy { diff -r 6be8d5818087 -r efd404f7a60b static/june_2007_style/blue/base.css --- a/static/june_2007_style/blue/base.css Thu Apr 15 21:41:50 2010 -0400 +++ b/static/june_2007_style/blue/base.css Fri Apr 16 18:46:35 2010 -0400 @@ -136,6 +136,7 @@ .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.vis-chart{background:url(/static/images/fugue/chart.png) no-repeat;} .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);} diff -r 6be8d5818087 -r efd404f7a60b static/scripts/galaxy.base.js --- a/static/scripts/galaxy.base.js Thu Apr 15 21:41:50 2010 -0400 +++ b/static/scripts/galaxy.base.js Fri Apr 16 18:46:35 2010 -0400 @@ -119,6 +119,31 @@ return count; } +// Alphanumeric/natural sort fn +function naturalSort(a, b){ + // setup temp-scope variables for comparison evauluation + var re = /(-?[0-9\.]+)/g, + x = a.toString().toLowerCase() || '', + y = b.toString().toLowerCase() || '', + nC = String.fromCharCode(0), + xN = x.replace( re, nC + '$1' + nC ).split(nC), + yN = y.replace( re, nC + '$1' + nC ).split(nC), + xD = (new Date(x)).getTime(), + yD = xD ? (new Date(y)).getTime() : null; + // natural sorting of dates + if ( yD ) + if ( xD < yD ) return -1; + else if ( xD > yD ) return 1; + // natural sorting through split numeric strings and default strings + for( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) { + oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc]; + oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc]; + if (oFxNcL < oFyNcL) return -1; + else if (oFxNcL > oFyNcL) return 1; + } + return 0; +} + // Replace any select box with 20+ options with a text input box + autocomplete. // TODO: make work with dynamic tool inputs and then can replace all big selects. function replace_big_select_inputs() { @@ -135,6 +160,7 @@ var text_input_elt = $("<input type='text' class='text-and-autocomplete-select'></input>"); text_input_elt.attr('size', 40); text_input_elt.attr('name', select_elt.attr('name')); + text_input_elt.attr('id', select_elt.attr('id')); text_input_elt.click( function() { // Show all. Also provide note that load is happening since this can be slow. var cur_value = $(this).attr('value'); @@ -175,12 +201,15 @@ select_options.push( "unspecified (?)" ); select_mapping[ "unspecified (?)" ] = "?"; select_mapping[ "?" ] = "?"; - + // Set initial text if it's empty. if ( text_input_elt.attr('value') == '' ) { text_input_elt.attr('value', 'Click to Search or Select'); } + // Sort option list + select_options = select_options.sort(naturalSort); + // Do autocomplete. var autocomplete_options = { selectFirst: false, autoFill: false, mustMatch: false, matchContains: true, max: 1000, minChars : 0, hideForLessThanMinChars : false }; text_input_elt.autocomplete(select_options, autocomplete_options); @@ -189,7 +218,7 @@ select_elt.replaceWith(text_input_elt); // Set trigger to replace text with value when element's form is submitted. If text doesn't correspond to value, default to start value. - text_input_elt.parents('form').submit( function() { + var submit_hook = function() { // Try to convert text to value. var cur_value = text_input_elt.attr('value'); var new_value = select_mapping[cur_value]; @@ -205,7 +234,10 @@ text_input_elt.attr('value', '?'); } } - }); + }; + + text_input_elt.parents('form').submit( function() { submit_hook(); } ); + $(document).bind("convert_dbkeys", function() { submit_hook(); } ); }); } @@ -282,7 +314,7 @@ }); } -function init_history_items(historywrapper, noinit) { +function init_history_items(historywrapper, noinit, nochanges) { var action = function() { // Load saved state and show as necessary @@ -309,13 +341,13 @@ var id = this.id; var body = $(this).children( "div.historyItemBody" ); var peek = body.find( "pre.peek" ) - $(this).children( ".historyItemTitleBar" ).find( ".historyItemTitle" ).wrap( "<a href='#'></a>" ).click( function() { + $(this).find( ".historyItemTitleBar > .historyItemTitle" ).wrap( "<a href='javascript:void();'></a>" ).click( function() { if ( body.is(":visible") ) { // Hiding stuff here - if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ) } + if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ); } body.slideUp( "fast" ); - if (!noinit) { // Ignore embedded item actions + if (!nochanges) { // Ignore embedded item actions // Save setting var prefs = $.jStore.store("history_expand_state"); if (prefs) { @@ -329,7 +361,7 @@ if ( $.browser.mozilla ) { peek.css( "overflow", "auto" ); } }); - if (!noinit) { + if (!nochanges) { // Save setting var prefs = $.jStore.store("history_expand_state"); if (prefs === undefined) { prefs = {}; } diff -r 6be8d5818087 -r efd404f7a60b static/scripts/packed/galaxy.base.js --- a/static/scripts/packed/galaxy.base.js Thu Apr 15 21:41:50 2010 -0400 +++ b/static/scripts/packed/galaxy.base.js Fri Apr 16 18:46:35 2010 -0400 @@ -1,1 +1,1 @@ -$(document).ready(function(){replace_big_select_inputs()});$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scrollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).click(c)}function make_popupmen! u(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id")+"-menu'></ul>");$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d)}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("target");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function array_length(b){if(b.length){return b.length}var c=0;for(var a in b){c++}return c}function replace_big_select_inputs(){$("select[name=dbkey]").each(function(){var a=$(this);if(a! .find("option").length<20){return}var b=a.attr("value");var c=$("<inpu t type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",a.attr("name"));c.click(function(){var g=$(this).attr("value");$(this).attr("value","Loading...");$(this).showAllInCache();$(this).attr("value",g);$(this).select()});var f=[];var e={};a.children("option").each(function(){var h=$(this).text();var g=$(this).attr("value");if(g=="?"){return}f.push(h);e[h]=g;e[g]=g;if(g==b){c.attr("value",h)}});f.push("unspecified (?)");e["unspecified (?)"]="?";e["?"]="?";if(c.attr("value")==""){c.attr("value","Click to Search or Select")}var d={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:1000,minChars:0,hideForLessThanMinChars:false};c.autocomplete(f,d);a.replaceWith(c);c.parents("form").submit(function(){var h=c.attr("value");var g=e[h];if(g!==null&&g!==undefined){c.attr("value",g)}else{if(b!=""){c.attr("value",b)}else{c.attr("value","?")}}})})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefin! ed){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text(k)}else{j=$("<input type='text'></input>").attr({value:k,size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){l.text(o);if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(c,a){var b=function(){try{var d=$.jStore.store("history_expand_state");if(d){for(var f in d){$("#"+f+" div.historyItemBody").show()}}}catch(e){$.jStore.remove("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.pee! k").css("overflow","hidden")}})}c.each(function(){var i=this.id;var g= $(this).children("div.historyItemBody");var h=g.find("pre.peek");$(this).children(".historyItemTitleBar").find(".historyItemTitle").wrap("<a href='#'></a>").click(function(){if(g.is(":visible")){if($.browser.mozilla){h.css("overflow","hidden")}g.slideUp("fast");if(!a){var j=$.jStore.store("history_expand_state");if(j){delete j[i];$.jStore.store("history_expand_state",j)}}}else{g.slideDown("fast",function(){if($.browser.mozilla){h.css("overflow","auto")}});if(!a){var j=$.jStore.store("history_expand_state");if(j===undefined){j={}}j[i]=true;$.jStore.store("history_expand_state",j)}}return false})});$("#top-links > a.toggle").click(function(){var g=$.jStore.store("history_expand_state");if(g===undefined){g={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(g){delete g[$(this).parent().attr("id")]}});$.jStore.store("history_expand_state",g)}).show()};if(a){b()}else{$.jStore.init("! galaxy");$.jStore.engineReady(function(){b()})}}$(document).ready(function(){$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus()}); \ No newline at end of file +$(document).ready(function(){replace_big_select_inputs()});$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scrollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).click(c)}function make_popupmen! u(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id")+"-menu'></ul>");$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d)}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("target");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function array_length(b){if(b.length){return b.length}var c=0;for(var a in b){c++}return c}function naturalSort(i,g){var n=/(-?[0-9\.]+)/g,j=i.toString().toLowerCase()||"",f=g.toString()! .toLowerCase()||"",k=String.fromCharCode(0),l=j.replace(n,k+"$1"+k).sp lit(k),e=f.replace(n,k+"$1"+k).split(k),d=(new Date(j)).getTime(),m=d?(new Date(f)).getTime():null;if(m){if(d<m){return -1}else{if(d>m){return 1}}}for(var h=0,c=Math.max(l.length,e.length);h<c;h++){oFxNcL=parseFloat(l[h])||l[h];oFyNcL=parseFloat(e[h])||e[h];if(oFxNcL<oFyNcL){return -1}else{if(oFxNcL>oFyNcL){return 1}}}return 0}function replace_big_select_inputs(){$("select[name=dbkey]").each(function(){var a=$(this);if(a.find("option").length<20){return}var b=a.attr("value");var c=$("<input type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",a.attr("name"));c.attr("id",a.attr("id"));c.click(function(){var h=$(this).attr("value");$(this).attr("value","Loading...");$(this).showAllInCache();$(this).attr("value",h);$(this).select()});var g=[];var f={};a.children("option").each(function(){var i=$(this).text();var h=$(this).attr("value");if(h=="?"){return}g.push(i);f[i]=h;f[h]=h;if(h==b){c.attr("value",i)}});g.push("unspecified (?)");f["unsp! ecified (?)"]="?";f["?"]="?";if(c.attr("value")==""){c.attr("value","Click to Search or Select")}g=g.sort(naturalSort);var e={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:1000,minChars:0,hideForLessThanMinChars:false};c.autocomplete(g,e);a.replaceWith(c);var d=function(){var i=c.attr("value");var h=f[i];if(h!==null&&h!==undefined){c.attr("value",h)}else{if(b!=""){c.attr("value",b)}else{c.attr("value","?")}}};c.parents("form").submit(function(){d()});$(document).bind("convert_dbkeys",function(){d()})})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text(k)}else{j=$("<input type='text'></input>").attr({value:k,size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this! ).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val(); $(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){l.text(o);if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStore.store("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStore.remove("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id;var h=$(this).children("div.historyItemBody");var i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void();'></a>").click(function(){if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){var k=$.jStore.store("history_expand_state");if(k){delete k[j];$.jStore.store("history_expand_st! ate",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){var k=$.jStore.store("history_expand_state");if(k===undefined){k={}}k[j]=true;$.jStore.store("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStore.store("history_expand_state");if(h===undefined){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStore.store("history_expand_state",h)}).show()};if(a){b()}else{$.jStore.init("galaxy");$.jStore.engineReady(function(){b()})}}$(document).ready(function(){$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus()}); \ No newline at end of file diff -r 6be8d5818087 -r efd404f7a60b templates/display_base.mako --- a/templates/display_base.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/display_base.mako Fri Apr 16 18:46:35 2010 -0400 @@ -64,7 +64,7 @@ }); }); // Init history boxes - init_history_items( $("div.historyItemWrapper") ); + init_history_items( $("div.historyItemWrapper"), false, "nochanges" ); }); </script> </%def> diff -r 6be8d5818087 -r efd404f7a60b templates/history/view.mako --- a/templates/history/view.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/history/view.mako Fri Apr 16 18:46:35 2010 -0400 @@ -8,7 +8,7 @@ ${h.js( "galaxy.base", "jquery", "json2", "class", "jquery.jstore" )} <script type="text/javascript"> $(function() { - init_history_items( $("div.historyItemWrapper") ); + init_history_items( $("div.historyItemWrapper"), false, "nochanges" ); }); </script> </%def> diff -r 6be8d5818087 -r efd404f7a60b templates/page/display.mako --- a/templates/page/display.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/page/display.mako Fri Apr 16 18:46:35 2010 -0400 @@ -29,7 +29,7 @@ container.find(".toggle-contract").show(); // Init needed for history items. - init_history_items( container.find("div.historyItemWrapper"), true ); + init_history_items( container.find("div.historyItemWrapper"), "noinit", "nochanges" ); container.find( "div.historyItemBody:visible" ).each( function() { if ( $.browser.mozilla ) { $(this).find( "pre.peek" ).css( "overflow", "hidden" ); diff -r 6be8d5818087 -r efd404f7a60b templates/root/history.mako --- a/templates/root/history.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/root/history.mako Fri Apr 16 18:46:35 2010 -0400 @@ -155,6 +155,35 @@ }); }); + // Trackster links + function init_trackster_links() { + $("a.trackster").live( "click", function() { + var link = $(this), + hid = link.attr("id").split("_")[1]; // visualize_{id} + + $.ajax({ + url: "${h.url_for( controller='tracks', action='list_tracks' )}", + data: {'hid': hid}, + error: function() { alert( "Visualization error" ); }, + success: function(html) { + show_modal("Add Track — Select Dataset(s)", html, { + "New Browser": function() { + hide_modal(); + }, + "Insert": function() { + hide_modal(); + }, + "Cancel": function() { + hide_modal(); + } + }); + } + }); + }); + } + + init_trackster_links(); + // History rename functionality. async_save_text("history-name-container", "history-name", "${h.url_for( controller="/history", action="rename_async", id=trans.security.encode_id(history.id) )}", "new_name", 18); diff -r 6be8d5818087 -r efd404f7a60b templates/root/history_common.mako --- a/templates/root/history_common.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/root/history_common.mako Fri Apr 16 18:46:35 2010 -0400 @@ -91,6 +91,9 @@ <a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Save" class="icon-button disk tooltip"></a> %if user_owns_dataset: <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a> + %if app.config.get_bool( 'enable_tracks', False ) and data.ext in app.datatypes_registry.get_available_tracks(): + <a class="icon-button vis-chart tooltip trackster" title="Visualize in Trackster" id="visualize_${hid}"></a> + %endif %if trans.user: <div style="float: right"> <a href="${h.url_for( controller='tag', action='retag', item_class=data.__class__.__name__, item_id=dataset_id )}" target="galaxy_main" title="Edit dataset tags" class="icon-button tags tooltip"></a> @@ -105,8 +108,12 @@ <strong>Annotation:</strong> <div id="${dataset_id}-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt tooltip editable-text" title="Edit dataset annotation"></div> </div> + %endif %endif + %if data.peek != "no peek": + <div><pre id="peek${data.id}" class="peek">${_(data.display_peek())}</pre></div> + %endif <div style="clear: both"></div> %for display_app in data.datatype.get_display_types(): <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %> @@ -121,13 +128,12 @@ %for display_app in data.get_display_applications( trans ).itervalues(): | ${display_app.name} %for link_app in display_app.links.itervalues(): - <a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a> + <a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a> %endfor %endfor + </div> - %if data.peek != "no peek": - <div><pre id="peek${data.id}" class="peek">${_(data.display_peek())}</pre></div> - %endif + %else: <div>${_('Error: unknown dataset state "%s".') % data_state}</div> %endif diff -r 6be8d5818087 -r efd404f7a60b templates/tracks/browser.mako --- a/templates/tracks/browser.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/tracks/browser.mako Fri Apr 16 18:46:35 2010 -0400 @@ -12,7 +12,7 @@ <%def name="stylesheets()"> ${parent.stylesheets()} -${h.css( "history" )} +${h.css( "history", "autocomplete_tagging" )} <link rel="stylesheet" type="text/css" href="${h.url_for('/static/trackster.css')}" /> <style type="text/css"> ul#sortable-ul { @@ -82,7 +82,7 @@ <%def name="javascripts()"> ${parent.javascripts()} -${h.js( 'galaxy.base', 'galaxy.panels', "json2", "jquery", "jquery.event.drag", "jquery.mousewheel", "trackster", "ui.core", "ui.sortable" )} +${h.js( 'galaxy.base', 'galaxy.panels', "json2", "jquery", "jquery.event.drag", "jquery.autocomplete", "jquery.mousewheel", "trackster", "ui.core", "ui.sortable" )} <script type="text/javascript"> @@ -112,9 +112,10 @@ success: function(form_html) { show_modal("New Track Browser", form_html, { "Cancel": function() { window.location = "/"; }, - "Continue": continue_fn + "Continue": function() { $(document).trigger("convert_dbkeys"); continue_fn(); } }); $("#new-title").focus(); + replace_big_select_inputs(); } }); %endif @@ -194,7 +195,7 @@ $.ajax({ url: "${h.url_for( action='list_datasets' )}", data: {}, - error: function() { alert( "Grid refresh failed" ) }, + error: function() { alert( "Grid refresh failed" ); }, success: function(table_html) { show_modal("Add Track — Select Dataset(s)", table_html, { "Insert": function() { @@ -271,31 +272,39 @@ view.add_label_track( new LabelTrack( $("#top-labeltrack" ) ) ); view.add_label_track( new LabelTrack( $("#nav-labeltrack" ) ) ); - $.getJSON( "${h.url_for( action='chroms' )}", { dbkey: view.dbkey }, function ( data ) { - view.chrom_data = data; - var chrom_options = '<option value="">Select Chrom/Contig</option>'; - for (i in data) { - var chrom = data[i]['chrom'] - chrom_options += '<option value="' + chrom + '">' + chrom + '</option>'; + $.ajax({ + url: "${h.url_for( action='chroms' )}", + data: { dbkey: view.dbkey }, + dataType: "json", + success: function ( data ) { + view.chrom_data = data; + var chrom_options = '<option value="">Select Chrom/Contig</option>'; + for (i in data) { + var chrom = data[i]['chrom'] + chrom_options += '<option value="' + chrom + '">' + chrom + '</option>'; + } + $("#chrom").html(chrom_options); + $("#chrom").bind( "change", function () { + view.chrom = $("#chrom").val(); + var found = $.grep(view.chrom_data, function(v, i) { + return v.chrom === view.chrom; + })[0]; + view.max_high = found.len; + view.reset(); + view.redraw(true); + + for (var track_id in view.tracks) { + var track = view.tracks[track_id]; + if (track.init) { + track.init(); + } + } + view.redraw(); + }); + }, + error: function() { + alert( "Could not load chroms for this dbkey:", view.dbkey ); } - $("#chrom").html(chrom_options); - $("#chrom").bind( "change", function () { - view.chrom = $("#chrom").val(); - var found = $.grep(view.chrom_data, function(v, i) { - return v.chrom === view.chrom; - })[0]; - view.max_high = found.len; - view.reset(); - view.redraw(true); - - for (var track_id in view.tracks) { - var track = view.tracks[track_id]; - if (track.init) { - track.init(); - } - } - view.redraw(); - }); }); function sidebar_box(track) { diff -r 6be8d5818087 -r efd404f7a60b templates/tracks/new_browser.mako --- a/templates/tracks/new_browser.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/tracks/new_browser.mako Fri Apr 16 18:46:35 2010 -0400 @@ -1,18 +1,24 @@ -<form id="new-browser-form" method="post" onsubmit="continue_fn(); return false;"> +<form id="new-browser-form" action="javascript:void();" method="post" onsubmit="return false;"> <div class="form-row"> - <label for="title">Browser name:</label> + <label for="new-title">Browser name:</label> <div class="form-row-input"> <input type="text" name="title" id="new-title" value="Unnamed"></input> </div> <div style="clear: both;"></div> </div> <div class="form-row"> - <label for="dbkey">Reference genome build (dbkey): </label> + <label for="new-dbkey">Reference genome build (dbkey): </label> <div class="form-row-input"> <select name="dbkey" id="new-dbkey"> - %for dbkey in dbkey_set: - <option value="${dbkey}">${dbkey}</option> + %for dbkey in dbkeys: + <option value="${dbkey[0]}">${dbkey[1]}</option> %endfor + + %if user_keys: + %for key, chrom_dict in user_keys.iteritems(): + <option value="${key}">${chrom_dict['name']} (${key})</option> + %endfor + %endif </select> </div> <div style="clear: both;"></div> diff -r 6be8d5818087 -r efd404f7a60b templates/user/dbkeys.mako --- a/templates/user/dbkeys.mako Thu Apr 15 21:41:50 2010 -0400 +++ b/templates/user/dbkeys.mako Fri Apr 16 18:46:35 2010 -0400 @@ -28,9 +28,7 @@ % if message: <div class="errormessagelarge">${message}</div> -% endif - -% if lines_skipped > 0: +% elif lines_skipped > 0: <div class="warningmessagelarge">Skipped ${lines_skipped} lines that could not be parsed</div> % endif
participants (1)
-
Nate Coraor