From f4da57df630f5506f320c1c1b417a91d0d60edee Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 1 May 2008 15:10:38 +0000 Subject: [PATCH] Upgraded to jquery-ui ~1.5b2. Workflow now uses *no* iframes, closer to working on IE6. --- lib/galaxy/web/controllers/workflow.py | 7 - static/june_2007_style/blue/panel_layout.css | 73 +- static/june_2007_style/panel_layout.css.tmpl | 72 +- static/scripts/galaxy.panels.js | 10 +- .../scripts/galaxy.workflow_editor.canvas.js | 53 +- static/scripts/jquery.ui.js | 1651 +++++++++-------- static/scripts/pack_scripts.py | 16 +- static/scripts/packed/galaxy.panels.js | 2 +- .../packed/galaxy.workflow_editor.canvas.js | 2 +- static/scripts/packed/jquery.ui.js | 2 +- templates/base_panels.mako | 12 +- templates/workflow/editor.mako | 259 ++- templates/workflow/editor_canvas.mako | 163 -- 13 files changed, 1228 insertions(+), 1094 deletions(-) delete mode 100644 templates/workflow/editor_canvas.mako diff --git a/lib/galaxy/web/controllers/workflow.py b/lib/galaxy/web/controllers/workflow.py index cdc3cd82210..52a34ebe7d1 100644 --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -79,13 +79,6 @@ class WorkflowController( BaseController ): return trans.show_error_message( "Must be logged in to create or modify workflows" ) return trans.fill_template( "workflow/editor.mako", workflow_id=id ) - - @web.expose - def editor_canvas( self, trans ): - """ - Render the workflow editor canvas. - """ - return trans.fill_template( "workflow/editor_canvas.mako" ) @web.json def editor_tool_form( self, trans, tool_id=None, **incoming ): diff --git a/static/june_2007_style/blue/panel_layout.css b/static/june_2007_style/blue/panel_layout.css index b5d29693bba..3e93a3a7d09 100644 --- a/static/june_2007_style/blue/panel_layout.css +++ b/static/june_2007_style/blue/panel_layout.css @@ -13,8 +13,11 @@ body } #background { + position: absolute; background: #eee; z-index: -1; + top: 0; + left: 0; margin: 0; padding: 0; width: 100%; @@ -141,7 +144,7 @@ table.column-layout height: 100%; } -div.unified-panel-header { +.unified-panel-header { height: 2em; overflow: hidden; z-index: 1000; @@ -158,7 +161,7 @@ div.unified-panel-header { font-weight: bold; } -div.unified-panel-header-inner { +.unified-panel-header-inner { padding-top: 0.45em; } @@ -175,37 +178,6 @@ div.unified-panel-body { margin-top: 1px; } -.dialog-wrapper { - position: fixed; - top: 0; left: 0; width: 100%; height: 100%; - z-index: 30000; -} -.dialog-box { - top: 80px; - position: fixed; - border: solid #999 1px; - background: white; - min-width: 230px; - z-index: 80000; -} -.dialog-box .title, .dialog-box .body, .dialog-box .buttons { - padding: 5px; -} -.dialog-box .title { - height: 2em; - z-index: 1000; - background: #cccccc; - background-image: url(panel_header_bg.png); - background-position: top center; - background-repeat: repeat-x; - border-bottom: solid #999 1px; - margin: 0; - padding: 0; - padding-right: 10px; - padding-left: 10px; - font-weight: bold; -} - .panel-header-button { color: #333; text-decoration: none; @@ -268,16 +240,45 @@ div.popupmenu-item:hover { } #overlay { - position: fixed; + position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20000; } -#overlay-inner -{ +#overlay-inner { width: 100%; height: 100%; background-color:#FFF; filter:alpha(opacity=75); -moz-opacity: 0.75; opacity: 0.75; z-index: 20000; +} + +.dialog-box-container { + position: relative; + margin-top: 80px; + margin-right: auto; + margin-left: auto; +} +.dialog-box-underlay { + position: absolute; + left: -1em; + right: -1em; + top: -1em; + bottom: -1em; + opacity: 0.5; + background: black; + z-index: -1; + -moz-border-radius: 1em; + -webkit-border-radius: 1em; +} + +.dialog-box { + border: solid #999 1px; + background: white; + min-width: 230px; + z-index: 80000; +} + +.dialog-box .body, .dialog-box .buttons { + padding: 5px; } \ No newline at end of file diff --git a/static/june_2007_style/panel_layout.css.tmpl b/static/june_2007_style/panel_layout.css.tmpl index d37a0e52228..a150fc42cef 100644 --- a/static/june_2007_style/panel_layout.css.tmpl +++ b/static/june_2007_style/panel_layout.css.tmpl @@ -13,8 +13,11 @@ body } #background { + position: absolute; background: ${layout_bg}; z-index: -1; + top: 0; + left: 0; margin: 0; padding: 0; width: 100%; @@ -141,7 +144,7 @@ table.column-layout height: 100%; } -div.unified-panel-header { +.unified-panel-header { height: 2em; z-index: 1000; background: ${panel_header_bg_bottom}; @@ -157,7 +160,7 @@ div.unified-panel-header { font-weight: bold; } -div.unified-panel-header-inner { +.unified-panel-header-inner { padding-top: 0.45em; } @@ -173,37 +176,6 @@ div.unified-panel-body { margin-top: 1px; } -.dialog-wrapper { - position: fixed; - top: 0; left: 0; width: 100%; height: 100%; - z-index: 30000; -} -.dialog-box { - top: 80px; - position: fixed; - border: solid ${layout_border} 1px; - background: white; - min-width: 230px; - z-index: 80000; -} -.dialog-box .title, .dialog-box .body, .dialog-box .buttons { - padding: 5px; -} -.dialog-box .title { - height: 2em; - z-index: 1000; - background: ${panel_header_bg_bottom}; - background-image: url(panel_header_bg.png); - background-position: top center; - background-repeat: repeat-x; - border-bottom: solid ${layout_border} 1px; - margin: 0; - padding: 0; - padding-right: 10px; - padding-left: 10px; - font-weight: bold; -} - .panel-header-button { color: #333; text-decoration: none; @@ -271,12 +243,42 @@ div.popupmenu-item:hover { top: 0; left: 0; width: 100%; height: 100%; z-index: 20000; } -#overlay-inner -{ + +#overlay-inner { width: 100%; height: 100%; background-color:#FFF; filter:alpha(opacity=75); -moz-opacity: 0.75; opacity: 0.75; z-index: 20000; +} + +.dialog-box-container { + position: relative; + margin-top: 80px; + margin-right: auto; + margin-left: auto; +} +.dialog-box-underlay { + position: absolute; + left: -1em; + right: -1em; + top: -1em; + bottom: -1em; + opacity: 0.5; + background: black; + z-index: -1; + -moz-border-radius: 1em; + -webkit-border-radius: 1em; +} + +.dialog-box { + border: solid #999 1px; + background: white; + min-width: 230px; + z-index: 80000; +} + +.dialog-box .body, .dialog-box .buttons { + padding: 5px; } \ No newline at end of file diff --git a/static/scripts/galaxy.panels.js b/static/scripts/galaxy.panels.js index 716d554b295..f163a692fe8 100644 --- a/static/scripts/galaxy.panels.js +++ b/static/scripts/galaxy.panels.js @@ -84,8 +84,8 @@ function make_left_panel( panel_el, center_el, border_el ) { } resize( x ); // Constrain helper position - ui.draggable.pos[0] = x; - ui.draggable.pos[1] = ui.options.co.top; + ui.position.left = x; + ui.position.top = ui.instance.originalPosition.top; }, click: function() { toggle(); @@ -151,7 +151,7 @@ function make_right_panel( panel_el, center_el, border_el ) { function() { jq( this ).removeClass( "hover" ) } ).draggable( { start: function( _, ui ) { - jq( '#DD-helper' ).show(); + jq( '#DD-helper' ).show(); }, stop: function( _, ui ) { x = ui.position.left; @@ -181,8 +181,8 @@ function make_right_panel( panel_el, center_el, border_el ) { } resize( w - x - border_tweak ); // Constrain helper position - ui.draggable.pos[0] = x; - ui.draggable.pos[1] = ui.options.co.top; + ui.position.left = x; + ui.position.top = ui.instance.originalPosition.top; } } ).find( "div" ).show(); diff --git a/static/scripts/galaxy.workflow_editor.canvas.js b/static/scripts/galaxy.workflow_editor.canvas.js index 1ab9e051df1..46c35322a25 100644 --- a/static/scripts/galaxy.workflow_editor.canvas.js +++ b/static/scripts/galaxy.workflow_editor.canvas.js @@ -81,18 +81,19 @@ $.extend( Connector.prototype, { $(this.canvas).remove(); }, redraw : function () { + var canvas_container = $("#canvas-container"); if ( ! this.canvas ) { this.canvas = document.createElement( "canvas" ); - $("body").append( this.canvas ); + canvas_container.append( $(this.canvas) ); if ( this.dragging ) { this.canvas.style.zIndex = "300" } } + var relativeLeft = function( e ) { return $(e).offset().left - canvas_container.offset().left + canvas_container.scrollLeft(); } + var relativeTop = function( e ) { return $(e).offset().top - canvas_container.offset().top + canvas_container.scrollTop(); } // Find the position of each handle - var o = $(this.handle1.element).offset(); - var start_x = o.left + 5; - var start_y = o.top + 5; - var o = $(this.handle2.element).offset(); - var end_x = o.left + 5; - var end_y = o.top + 5; + var start_x = relativeLeft( this.handle1.element ) + 5; + var start_y = relativeTop( this.handle1.element ) + 5; + var end_x = relativeLeft( this.handle2.element ) + 5; + var end_y = relativeTop( this.handle2.element ) + 5; // Calculate canvas area var canvas_extra = 100; var canvas_min_x = Math.min( start_x, end_x ); @@ -109,11 +110,6 @@ $.extend( Connector.prototype, { this.canvas.style.top = canvas_top + "px"; this.canvas.setAttribute( "width", canvas_width ); this.canvas.setAttribute( "height", canvas_height ); - // HACK: Calling this again makes drawing work in Safari and I have - // no idea why. Need to figure out what this refreshes (some - // sort of side effect) - var o = $(this.handle1.element).offset() - var o = $(this.handle2.element).offset() // Adjust points to be relative to the canvas start_x -= canvas_left; start_y -= canvas_top; @@ -149,24 +145,25 @@ $.extend( Node.prototype, { node = this; $(elements).each( function() { var terminal = this.terminal = new InputTerminal( this, types ); - terminal.node = node; - terminal.name = name + terminal.node = node; + terminal.name = name $(this).droppable( { tolerance: 'intersect', accept: function( draggable ) { + draggable = draggable.get( 0 ); return ( draggable.terminal ) && ( terminal.can_accept( draggable.terminal ) ); }, activeClass: 'input-terminal-active', // hoverClass: 'input-terminal-active', over: function( e, ui ) { - ui.helper.terminal.connectors[0].inner_color = "#BBFFBB"; + ui.helper.get(0).terminal.connectors[0].inner_color = "#BBFFBB"; }, out: function( e, ui ) { - ui.helper.terminal.connectors[0].inner_color = "#EEEEEE"; + ui.helper.get(0).terminal.connectors[0].inner_color = "#EEEEEE"; }, drop: function( e, ui ) { - var source = ui.draggable.element.terminal; - var target = ui.droppable.element.terminal; + var source = ui.draggable.get(0).terminal; + var target = ui.element.get(0).terminal; var c = new Connector(); c.connect( source, target ); c.redraw(); @@ -187,7 +184,7 @@ $.extend( Node.prototype, { // appendTo: "body", // cursorAt: { top: 5, left: 5 }, helper: function () { - var h = $( '
' ).get(0); + var h = $( '
' ).appendTo( "#canvas-container" ).get(0); h.terminal = new OutputTerminal( h ); // // Already a connector? Destroy... no wait, don't // if ( this.terminal.connector ) { @@ -200,7 +197,8 @@ $.extend( Node.prototype, { return h; }, drag: function ( e, options ) { - options.helper.terminal.redraw(); + h = options.helper.get(0); + h.terminal.redraw(); }, stop: function( e, options ) { this.drag_temp_connector.destroy(); @@ -397,7 +395,7 @@ function prebuild_node_for_tool( id, title_text ) { function() { $(this).attr( 'src', "../images/delete_icon_dark.png" ) }, function() { $(this).attr( 'src', "../images/delete_icon.png" ) } ) ); - f.appendTo( "body" ); + f.appendTo( "#canvas-container" ); var width = f.width(); buttons.prependTo( title ); width += ( buttons.width() + 10 ); @@ -409,11 +407,10 @@ function prebuild_node_for_tool( id, title_text ) { scroll: true, scrollSensitivity: 10, scrollSpeed: 20, - containment: $("#shim"), + // containment: $("#shim"), // grow: true, - click: function() { - document.body.removeChild( this ); - document.body.appendChild( this ); + click: function( _, element ) { + (function(p) { p.removeChild( element ); p.appendChild( element ) })(element.parentNode) workflow.activate_node( node ); }, start: function() { @@ -425,9 +422,9 @@ function prebuild_node_for_tool( id, title_text ) { this.terminal.redraw(); }) }, - stop: function() { - document.body.removeChild( this ); - document.body.appendChild( this ); + stop: function( _, ui ) { + element = ui.element.get(0); + (function(p) { p.removeChild( element ); p.appendChild( element ) })(element.parentNode) $(this).css( 'z-index', '100' ); $(this).find( ".terminal" ).each( function() { this.terminal.redraw(); diff --git a/static/scripts/jquery.ui.js b/static/scripts/jquery.ui.js index c9cbe11f2a7..61314337a1c 100644 --- a/static/scripts/jquery.ui.js +++ b/static/scripts/jquery.ui.js @@ -1,906 +1,1097 @@ -(function($) { - - //If the UI scope is not availalable, add it +/* + * jQuery UI @VERSION + * + * Copyright (c) 2008 Paul Bakaus (ui.jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + * + * $Date: 2008-04-29 19:19:03 -0400 (Tue, 29 Apr 2008) $ + * $Rev: 5355 $ + */ +;(function($) { + + //If the UI scope is not available, add it $.ui = $.ui || {}; //Add methods that are vital for all mouse interaction stuff (plugin registering) $.extend($.ui, { plugin: { - add: function(w, c, o, p) { - var a = $.ui[w].prototype; if(!a.plugins[c]) a.plugins[c] = []; - a.plugins[c].push([o,p]); + add: function(module, option, set) { + var proto = $.ui[module].prototype; + for(var i in set) { + proto.plugins[i] = proto.plugins[i] || []; + proto.plugins[i].push([option, set[i]]); + } }, - call: function(instance, name, args) { - var c = instance.plugins[name]; if(!c) return; - var o = instance.interaction ? instance.interaction.options : instance.options; - var e = instance.interaction ? instance.interaction.element : instance.element; - - for (var i = 0; i < c.length; i++) { - if (o[c[i][0]]) c[i][1].apply(e, args); - } + call: function(instance, name, arguments) { + var set = instance.plugins[name]; if(!set) return; + for (var i = 0; i < set.length; i++) { + if (instance.options[set[i][0]]) set[i][1].apply(instance.element, arguments); + } } + }, + cssCache: {}, + css: function(name) { + if ($.ui.cssCache[name]) return $.ui.cssCache[name]; + var tmp = $('
').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); + + //if (!$.browser.safari) + //tmp.appendTo('body'); + + //Opera and Safari set width and height to 0px instead of auto + //Safari returns rgba(0,0,0,0) when bgcolor is not set + $.ui.cssCache[name] = !!( + (!/auto|default/.test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || + !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) + ); + try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){} + return $.ui.cssCache[name]; + }, + disableSelection: function(e) { + e.unselectable = "on"; + e.onselectstart = function() { return false; }; + if (e.style) e.style.MozUserSelect = "none"; + }, + enableSelection: function(e) { + e.unselectable = "off"; + e.onselectstart = function() { return true; }; + if (e.style) e.style.MozUserSelect = ""; + }, + hasScroll: function(e, a) { + var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false; + if (e[scroll] > 0) return true; e[scroll] = 1; + has = e[scroll] > 0 ? true : false; e[scroll] = 0; + return has; + } + }); + + /******* fn scope modifications ********/ + + var _remove = $.fn.remove; + $.fn.extend({ + mouseInteraction: function(o) { + return this.each(function() { + new $.ui.mouseInteraction(this, o); + }); + }, + removeMouseInteraction: function(o) { + return this.each(function() { + if($.data(this, "ui-mouse")) + $.data(this, "ui-mouse").destroy(); + }); + }, + remove: function() { + jQuery("*", this).add(this).trigger("remove"); + return _remove.apply(this, arguments ); } }); - $.fn.mouseInteractionDestroy = function() { - this.each(function() { - if($.data(this, "ui-mouse")) $.data(this, "ui-mouse").destroy(); - }); - }; - $.ui.mouseInteraction = function(el,o) { + /********** Mouse Interaction Plugin *********/ + + $.ui.mouseInteraction = function(element, options) { - if(!o) var o = {}; - this.element = el; - $.data(this.element, "ui-mouse", this); - - this.options = {}; - $.extend(this.options, o); - $.extend(this.options, { - handle : o.handle ? ($(o.handle, el)[0] ? $(o.handle, el) : $(el)) : $(el), - helper: o.helper || 'original', - preventionDistance: o.preventionDistance || 0, - dragPrevention: o.dragPrevention ? o.dragPrevention.toLowerCase().split(',') : ['input','textarea','button','select','option'], - cursorAt: { top: ((o.cursorAt && o.cursorAt.top) ? o.cursorAt.top : 0), left: ((o.cursorAt && o.cursorAt.left) ? o.cursorAt.left : 0), bottom: ((o.cursorAt && o.cursorAt.bottom) ? o.cursorAt.bottom : 0), right: ((o.cursorAt && o.cursorAt.right) ? o.cursorAt.right : 0) }, - cursorAtIgnore: (!o.cursorAt) ? true : false, //Internal property - appendTo: o.appendTo || 'parent' - }); - o = this.options; //Just Lazyness - - if(!this.options.nonDestructive && (o.helper == 'clone' || o.helper == 'original')) { - - // Let's save the margins for better reference - o.margins = { - top: parseInt($(el).css('marginTop')) || 0, - left: parseInt($(el).css('marginLeft')) || 0, - bottom: parseInt($(el).css('marginBottom')) || 0, - right: parseInt($(el).css('marginRight')) || 0 - }; - - // We have to add margins to our cursorAt - if(o.cursorAt.top != 0) o.cursorAt.top = o.margins.top; - if(o.cursorAt.left != 0) o.cursorAt.left += o.margins.left; - if(o.cursorAt.bottom != 0) o.cursorAt.bottom += o.margins.bottom; - if(o.cursorAt.right != 0) o.cursorAt.right += o.margins.right; - - - if(o.helper == 'original') - o.wasPositioned = $(el).css('position'); - - } else { - o.margins = { top: 0, left: 0, right: 0, bottom: 0 }; - } - var self = this; - this.mousedownfunc = function(e) { // Bind the mousedown event - return self.click.apply(self, [e]); - }; - o.handle.bind('mousedown', this.mousedownfunc); + this.element = element; + + $.data(this.element, "ui-mouse", this); + this.options = $.extend({}, options); - //Prevent selection of text when starting the drag in IE - if($.browser.msie) $(this.element).attr('unselectable', 'on'); + $(element).bind('mousedown.draggable', function() { return self.click.apply(self, arguments); }); + if($.browser.msie) $(element).attr('unselectable', 'on'); //Prevent text selection in IE + // prevent draggable-options-delay bug #2553 + $(element).mouseup(function() { + if(self.timer) clearInterval(self.timer); + }); }; $.extend($.ui.mouseInteraction.prototype, { - plugins: {}, - currentTarget: null, - lastTarget: null, - timer: null, - slowMode: false, - init: false, - destroy: function() { - this.options.handle.unbind('mousedown', this.mousedownfunc); - }, - trigger: function(e) { - return this.click.apply(this, arguments); - }, + + destroy: function() { $(this.element).unbind('mousedown.draggable'); }, + trigger: function() { return this.click.apply(this, arguments); }, click: function(e) { - - var o = this.options; - window.focus(); - if(e.which != 1) return true; //only left click starts dragging - - // Prevent execution on defined elements - var targetName = (e.target) ? e.target.nodeName.toLowerCase() : e.srcElement.nodeName.toLowerCase(); - for(var i=0;i= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) { + if(self.options.start) self.options.start.call(self.options.executor || self, e, self.element); + if(self.options.drag) self.options.drag.call(self.options.executor || self, e, this.element); //This is actually not correct, but expected + self.initialized = true; + } }; - - if(o.preventionTimeout) { //use prevention timeout + + if(this.options.delay) { if(this.timer) clearInterval(this.timer); - this.timer = setTimeout(function() { initFunc(); }, o.preventionTimeout); - return false; + this.timer = setTimeout(initialize, this.options.delay); + } else { + initialize(); } - - initFunc(); + return false; }, - start: function(e) { + stop: function(e) { - var o = this.options; var a = this.element; - o.co = $(a).offset(); //get the current offset - - this.helper = typeof o.helper == 'function' ? $(o.helper.apply(a, [e,this]))[0] : (o.helper == 'clone' ? $(a).clone()[0] : a); - - if(o.appendTo == 'parent') { // Let's see if we have a positioned parent - var cp = a.parentNode; - while (cp) { - if(cp.style && ($(cp).css('position') == 'relative' || $(cp).css('position') == 'absolute')) { - o.pp = cp; - o.po = $(cp).offset(); - o.ppOverflow = !!($(o.pp).css('overflow') == 'auto' || $(o.pp).css('overflow') == 'scroll'); //TODO! - break; - } - cp = cp.parentNode ? cp.parentNode : null; - }; - - if(!o.pp) o.po = { top: 0, left: 0 }; + var o = this.options; + if(!this.initialized) { + // james@bx.psu.edu + if(this.options.click) this.options.click.call(this.options.executor || this, e, this.element); + return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable'); } - - this.pos = [this.opos[0],this.opos[1]]; //Use the relative position - this.rpos = [this.pos[0],this.pos[1]]; //Save the absolute position - - if(o.cursorAtIgnore) { // If we want to pick the element where we clicked, we borrow cursorAt and add margins - o.cursorAt.left = this.pos[0] - o.co.left + o.margins.left; - o.cursorAt.top = this.pos[1] - o.co.top + o.margins.top; - } - - - - if(o.pp) { // If we have a positioned parent, we pick the draggable relative to it - this.pos[0] -= o.po.left; - this.pos[1] -= o.po.top; - } - - this.slowMode = (o.cursorAt && (o.cursorAt.top-o.margins.top > 0 || o.cursorAt.bottom-o.margins.bottom > 0) && (o.cursorAt.left-o.margins.left > 0 || o.cursorAt.right-o.margins.right > 0)) ? true : false; //If cursorAt is within the helper, set slowMode to true - - if(!o.nonDestructive) $(this.helper).css('position', 'absolute'); - if(o.helper != 'original') $(this.helper).appendTo((o.appendTo == 'parent' ? a.parentNode : o.appendTo)).show(); - - // Remap right/bottom properties for cursorAt to left/top - if(o.cursorAt.right && !o.cursorAt.left) o.cursorAt.left = this.helper.offsetWidth+o.margins.right+o.margins.left - o.cursorAt.right; - if(o.cursorAt.bottom && !o.cursorAt.top) o.cursorAt.top = this.helper.offsetHeight+o.margins.top+o.margins.bottom - o.cursorAt.bottom; - - this.init = true; - - if(o._start) o._start.apply(a, [this.helper, this.pos, o.cursorAt, this, e]); // Trigger the start callback - this.helperSize = { width: outerWidth(this.helper), height: outerHeight(this.helper) }; //Set helper size property - return false; - - }, - stop: function(e) { - - var o = this.options; var a = this.element; var self = this; - - $(document).unbind('mouseup', self.mouseup); - $(document).unbind('mousemove', self.mousemove); - - if(this.init == false) { - // james@bx.psu.edu - // if ( o.click ) o.click.apply(); - $(this.element).triggerHandler("click", [e], o.click); - this.opos = this.pos = null; - return null; - } - if(o._beforeStop) o._beforeStop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]); - - if(this.helper != a && !o.beQuietAtEnd) { // Remove helper, if it's not the original node - $(this.helper).remove(); this.helper = null; - } - - if(!o.beQuietAtEnd) { - //if(o.wasPositioned) $(a).css('position', o.wasPositioned); - if(o._stop) o._stop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]); - } - - this.init = false; - this.opos = this.pos = null; + if(this.options.stop) this.options.stop.call(this.options.executor || this, e, this.element); + $(document).unbind('mouseup.draggable').unbind('mousemove.draggable'); + this.initialized = false; return false; }, drag: function(e) { - if (!this.opos || ($.browser.msie && !e.button)) return this.stop.apply(this, [e]); // check for IE mouseup when moving into the document again var o = this.options; + if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check - this.pos = [e.pageX,e.pageY]; //relative mouse position - if(this.rpos && this.rpos[0] == this.pos[0] && this.rpos[1] == this.pos[1]) return false; - this.rpos = [this.pos[0],this.pos[1]]; //absolute mouse position - - if(o.pp) { //If we have a positioned parent, use a relative position - this.pos[0] -= o.po.left; - this.pos[1] -= o.po.top; + if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) { + if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element); + this.initialized = true; + } else { + if(!this.initialized) return false; } - - if( (Math.abs(this.rpos[0]-this.opos[0]) > o.preventionDistance || Math.abs(this.rpos[1]-this.opos[1]) > o.preventionDistance) && this.init == false) //If position is more than x pixels from original position, start dragging - this.start.apply(this,[e]); - else { - if(this.init == false) return false; - } - - if(o._drag) o._drag.apply(this.element, [this.helper, this.pos, o.cursorAt, this, e]); + + if(o.drag) o.drag.call(this.options.executor || this, e, this.element); return false; } }); - - var num = function(el, prop) { - return parseInt($.css(el.jquery?el[0]:el,prop))||0; - }; - function outerWidth(el) { - var $el = $(el), ow = $el.width(); - for (var i = 0, props = ['borderLeftWidth', 'paddingLeft', 'paddingRight', 'borderRightWidth']; i < props.length; i++) - ow += num($el, props[i]); - return ow; - }; - function outerHeight(el) { - var $el = $(el), oh = $el.width(); - for (var i = 0, props = ['borderTopWidth', 'paddingTop', 'paddingBottom', 'borderBottomWidth']; i < props.length; i++) - oh += num($el, props[i]); - return oh; - }; - - //Make nodes selectable by expression - $.extend($.expr[':'], { draggable: "(' '+a.className+' ').indexOf(' ui-draggable ')" }); - - - //Macros for external methods that support chaining - var methods = "destroy,enable,disable".split(","); - for(var i=0;i this.maxLeft - this.helperProportions.width) this.position.left = this.maxLeft - this.helperProportions.width; + if(this.position.top < this.minTop) this.position.top = this.minTop; + if(this.position.top > this.maxTop - this.helperProportions.height) this.position.top = this.maxTop - this.helperProportions.height; + }, + recallOffset: function(e) { + + var elementPosition = { left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top }; + var r = this.helper.css('position') == 'relative'; var o = this.options; + + //Generate the original position + this.originalPosition = { + left: (elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)), + top: (elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)) + }; + //Generate a flexible offset that will later be subtracted from e.pageX/Y + this.offset = {left: this._pageX - this.originalPosition.left, top: this._pageY - this.originalPosition.top }; + + //Substract margins + if(this.element[0] != this.helper[0]) { + this.offset.left += parseInt(this.element.css('marginLeft'),10) || 0; + this.offset.top += parseInt(this.element.css('marginTop'),10) || 0; + } + + }, + start: function(e) { var o = this.options; - $.ui.ddmanager.current = this; + if($.ui.ddmanager) $.ui.ddmanager.current = this; - $.ui.plugin.call(that, 'start', [e, that.prepareCallbackObj(this)]); - $(this.element).triggerHandler("dragstart", [e, that.prepareCallbackObj(this)], o.start); + //Create and append the visible helper + this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone().appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)) : this.element); + if(this.helper[0] != this.element[0]) this.helper.css('position', 'absolute'); + if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); - if (this.slowMode && $.ui.droppable && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, e); - return false; - - }, - stop: function(that, e) { + //Find out the next positioned parent + this.offsetParent = (function(cp) { + while(cp) { + if(cp.style && (/(absolute|relative|fixed)/).test($.css(cp,'position'))) return $(cp); + cp = cp.parentNode ? cp.parentNode : null; + }; return $("body"); + })(this.helper[0].parentNode); - var o = this.options; + //Prepare variables for position generation + this.elementOffset = this.element.offset(); + this.offsetParentOffset = this.offsetParent.offset(); + var elementPosition = { left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top }; + this._pageX = e.pageX; this._pageY = e.pageY; + this.clickOffset = { left: e.pageX - this.elementOffset.left, top: e.pageY - this.elementOffset.top }; + var r = this.helper.css('position') == 'relative'; + + //Generate the original position + this.originalPosition = { + left: (r ? parseInt(this.helper.css('left'),10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)), + top: (r ? parseInt(this.helper.css('top'),10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)) + }; - $.ui.plugin.call(that, 'stop', [e, that.prepareCallbackObj(this)]); - $(this.element).triggerHandler("dragstop", [e, that.prepareCallbackObj(this)], o.stop); - - if (this.slowMode && $.ui.droppable && !o.dropBehaviour) //If cursorAt is within the helper, we must use our drop manager - $.ui.ddmanager.fire(this, e); - - $.ui.ddmanager.current = null; - $.ui.ddmanager.last = this; - - return false; + //If we have a fixed element, we must subtract the scroll offset again + if(this.element.css('position') == 'fixed') { + this.originalPosition.top -= this.offsetParent[0] == document.body ? $(document).scrollTop() : this.offsetParent[0].scrollTop; + this.originalPosition.left -= this.offsetParent[0] == document.body ? $(document).scrollLeft() : this.offsetParent[0].scrollLeft; + } - }, - drag: function(that, e) { - - var o = this.options; - - $.ui.ddmanager.update(this, e); - - this.pos = [this.pos[0]-o.cursorAt.left, this.pos[1]-o.cursorAt.top]; - - $.ui.plugin.call(that, 'drag', [e, that.prepareCallbackObj(this)]); - var nv = $(this.element).triggerHandler("drag", [e, that.prepareCallbackObj(this)], o.drag); - - var nl = (nv && nv.left) ? nv.left : this.pos[0]; - var nt = (nv && nv.top) ? nv.top : this.pos[1]; + //Generate a flexible offset that will later be subtracted from e.pageX/Y + this.offset = {left: e.pageX - this.originalPosition.left, top: e.pageY - this.originalPosition.top }; - $(this.helper).css('left', nl+'px').css('top', nt+'px'); // Stick the helper to the cursor - return false; + //Substract margins + if(this.element[0] != this.helper[0]) { + this.offset.left += parseInt(this.element.css('marginLeft'),10) || 0; + this.offset.top += parseInt(this.element.css('marginTop'),10) || 0; + } - } - }); + //Call plugins and callbacks + this.propagate("start", e); - $.ui.plugin.add("draggable", "stop", "effect", function(e,ui) { - var t = ui.helper; - if(ui.options.effect[1]) { - if(t != this) { - ui.options.beQuietAtEnd = true; - switch(ui.options.effect[1]) { - case 'fade': - $(t).fadeOut(300, function() { $(this).remove(); }); - break; - default: - $(t).remove(); - break; + this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; + if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e); + + //If we have something in cursorAt, we'll use it + if(o.cursorAt) { + if(o.cursorAt.top != undefined || o.cursorAt.bottom != undefined) { + this.offset.top -= this.clickOffset.top - (o.cursorAt.top != undefined ? o.cursorAt.top : (this.helperProportions.height - o.cursorAt.bottom)); + this.clickOffset.top = (o.cursorAt.top != undefined ? o.cursorAt.top : (this.helperProportions.height - o.cursorAt.bottom)); + } + if(o.cursorAt.left != undefined || o.cursorAt.right != undefined) { + this.offset.left -= this.clickOffset.left - (o.cursorAt.left != undefined ? o.cursorAt.left : (this.helperProportions.width - o.cursorAt.right)); + this.clickOffset.left = (o.cursorAt.left != undefined ? o.cursorAt.left : (this.helperProportions.width - o.cursorAt.right)); } } + + return false; + + }, + clear: function() { + if($.ui.ddmanager) $.ui.ddmanager.current = null; + this.helper = null; + }, + stop: function(e) { + + //If we are using droppables, inform the manager about the drop + if ($.ui.ddmanager && !this.options.dropBehaviour) + $.ui.ddmanager.drop(this, e); + + //Call plugins and trigger callbacks + this.propagate("stop", e); + + if(this.cancelHelperRemoval) return false; + if(this.options.helper != 'original') this.helper.remove(); + this.clear(); + + return false; + }, + drag: function(e) { + + //Compute the helpers position + this.position = { top: e.pageY - this.offset.top, left: e.pageX - this.offset.left }; + this.positionAbs = { left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top }; + + //Call plugins and callbacks + this.checkConstrains(); + this.position = this.propagate("drag", e) || this.position; + this.checkConstrains(); + + $(this.helper).css({ left: this.position.left+'px', top: this.position.top+'px' }); // Stick the helper to the cursor + if($.ui.ddmanager) $.ui.ddmanager.drag(this, e); + return false; } }); - $.ui.plugin.add("draggable", "start", "effect", function(e,ui) { - if(ui.options.effect[0]) { - switch(ui.options.effect[0]) { - case 'fade': - $(ui.helper).hide().fadeIn(300); - break; - } +/* + * Draggable Extensions + */ + + $.ui.plugin.add("draggable", "cursor", { + start: function(e, ui) { + var t = $('body'); + if (t.css("cursor")) ui.options._cursor = t.css("cursor"); + t.css("cursor", ui.options.cursor); + }, + stop: function(e, ui) { + if (ui.options._cursor) $('body').css("cursor", ui.options._cursor); } }); -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "start", "cursor", function(e,ui) { - var t = $('body'); - if (t.css("cursor")) ui.options.ocursor = t.css("cursor"); - t.css("cursor", ui.options.cursor); - }); - - $.ui.plugin.add("draggable", "stop", "cursor", function(e,ui) { - if (ui.options.ocursor) $('body').css("cursor", ui.options.ocursor); - }); - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "start", "zIndex", function(e,ui) { - var t = $(ui.helper); - if(t.css("zIndex")) ui.options.ozIndex = t.css("zIndex"); - t.css('zIndex', ui.options.zIndex); - }); - - $.ui.plugin.add("draggable", "stop", "zIndex", function(e,ui) { - if(ui.options.ozIndex) $(ui.helper).css('zIndex', ui.options.ozIndex); - }); - - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "start", "opacity", function(e,ui) { - var t = $(ui.helper); - if(t.css("opacity")) ui.options.oopacity = t.css("opacity"); - t.css('opacity', ui.options.opacity); - }); - - $.ui.plugin.add("draggable", "stop", "opacity", function(e,ui) { - if(ui.options.oopacity) $(ui.helper).css('opacity', ui.options.oopacity); - }); - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "stop", "revert", function(e,ui) { - - var o = ui.options; - var rpos = { left: 0, top: 0 }; - o.beQuietAtEnd = true; - - if(ui.helper != this) { - - rpos = $(ui.draggable.sorthelper || this).offset({ border: false }); - - var nl = rpos.left-o.po.left-o.margins.left; - var nt = rpos.top-o.po.top-o.margins.top; - - } else { - var nl = o.co.left - (o.po ? o.po.left : 0); - var nt = o.co.top - (o.po ? o.po.top : 0); + $.ui.plugin.add("draggable", "zIndex", { + start: function(e, ui) { + var t = $(ui.helper); + if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex"); + t.css('zIndex', ui.options.zIndex); + }, + stop: function(e, ui) { + if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex); } - - var self = ui.draggable; - - $(ui.helper).animate({ - left: nl, - top: nt - }, 500, function() { - - if(o.wasPositioned) $(self.element).css('position', o.wasPositioned); - if(o.stop) o.stop.apply(self.element, [self.helper, self.pos, [o.co.left - o.po.left,o.co.top - o.po.top],self]); - - if(self.helper != self.element) window.setTimeout(function() { $(self.helper).remove(); }, 0); //Using setTimeout because of strange flickering in Firefox - - }); - }); -//---------------------------------------------------------------- + $.ui.plugin.add("draggable", "opacity", { + start: function(e, ui) { + var t = $(ui.helper); + if(t.css("opacity")) ui.options._opacity = t.css("opacity"); + t.css('opacity', ui.options.opacity); + }, + stop: function(e, ui) { + if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity); + } + }); - $.ui.plugin.add("draggable", "start", "iframeFix", function(e,ui) { - var o = ui.options; - if(!ui.draggable.slowMode) { // Make clones on top of iframes (only if we are not in slowMode) + $.ui.plugin.add("draggable", "revert", { + stop: function(e, ui) { + var self = ui.instance, helper = $(self.helper); + self.cancelHelperRemoval = true; + + $(ui.helper).animate({ left: self.originalPosition.left, top: self.originalPosition.top }, parseInt(ui.options.revert, 10) || 500, function() { + if(ui.options.helper != 'original') helper.remove(); + if (!helper) self.clear(); + }); + } + }); + + $.ui.plugin.add("draggable", "iframeFix", { + start: function(e, ui) { + + var o = ui.options; + if(ui.instance.slowMode) return; // Make clones on top of iframes (only if we are not in slowMode) + if(o.iframeFix.constructor == Array) { for(var i=0;i
").css("width", $(o.iframeFix[i])[0].offsetWidth+"px").css("height", $(o.iframeFix[i])[0].offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body"); + $('
').css("width", $(o.iframeFix[i])[0].offsetWidth+"px").css("height", $(o.iframeFix[i])[0].offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body"); } } else { $("iframe").each(function() { var co = $(this).offset({ border: false }); - $("
").css("width", this.offsetWidth+"px").css("height", this.offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body"); + $('
').css("width", this.offsetWidth+"px").css("height", this.offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body"); }); - } - } + } + }, + stop: function(e, ui) { + if(ui.options.iframeFix) $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers + } }); - $.ui.plugin.add("draggable","stop", "iframeFix", function(e,ui) { - if(ui.options.iframeFix) $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers - }); - -//---------------------------------------------------------------- + $.ui.plugin.add("draggable", "containment", { + start: function(e, ui) { - $.ui.plugin.add("draggable", "start", "containment", function(e,ui) { + var o = ui.options; + var self = ui.instance; + if((o.containment.left != undefined || o.containment.constructor == Array) && !o._containment) return; + if(!o._containment) o._containment = o.containment; - var o = ui.options; + if(o._containment == 'parent') o._containment = this[0].parentNode; + if(o._containment == 'document') { + o.containment = [ + 0, + 0, + $(document).width(), + ($(document).height() || document.body.parentNode.scrollHeight) + ]; + } else { //I'm a node, so compute top/left/right/bottom - if(!o.cursorAtIgnore || o.containment.left != undefined || o.containment.constructor == Array) return; - if(o.containment == 'parent') o.containment = this.parentNode; + var ce = $(o._containment)[0]; + var co = $(o._containment).offset(); + o.containment = [ + co.left + parseInt($(ce).css("borderLeftWidth")), + co.top + parseInt($(ce).css("borderTopWidth")), + co.left+(ce.offsetWidth || ce.scrollWidth) - parseInt($(ce).css("borderRightWidth")), + co.top+(ce.offsetHeight || ce.scrollHeight) - parseInt($(ce).css("borderBottomWidth")) + ]; + } + + var c = o.containment; + ui.instance.setContrains( + c[0] - (self.offset.left - self.clickOffset.left), //min left + c[2] - (self.offset.left - self.clickOffset.left), //max left + c[1] - (self.offset.top - self.clickOffset.top), //min top + c[3] - (self.offset.top - self.clickOffset.top) //max top + ); - if(o.containment == 'document') { - o.containment = [ - 0-o.margins.left, - 0-o.margins.top, - $(document).width()-o.margins.right, - ($(document).height() || document.body.parentNode.scrollHeight)-o.margins.bottom - ]; - } else { //I'm a node, so compute top/left/right/bottom - var ce = $(o.containment)[0]; - var co = $(o.containment).offset({ border: false }); - - o.containment = [ - co.left-o.margins.left, - co.top-o.margins.top, - co.left+(ce.offsetWidth || ce.scrollWidth)-o.margins.right, - co.top+(ce.offsetHeight || ce.scrollHeight)-o.margins.bottom - ]; } + }); + $.ui.plugin.add("draggable", "grid", { + drag: function(e, ui) { + var o = ui.options; + var newLeft = ui.instance.originalPosition.left + Math.round((e.pageX - ui.instance._pageX) / o.grid[0]) * o.grid[0]; + var newTop = ui.instance.originalPosition.top + Math.round((e.pageY - ui.instance._pageY) / o.grid[1]) * o.grid[1]; + + ui.instance.position.left = newLeft; + ui.instance.position.top = newTop; + + } + }); + + $.ui.plugin.add("draggable", "axis", { + drag: function(e, ui) { + var o = ui.options; + if(o.constraint) o.axis = o.constraint; //Legacy check + switch (o.axis) { + case 'x' : ui.instance.position.top = ui.instance.originalPosition.top; break; + case 'y' : ui.instance.position.left = ui.instance.originalPosition.left; break; + } + } + }); + + $.ui.plugin.add("draggable", "scroll", { + start: function(e, ui) { + var o = ui.options; + o.scrollSensitivity = o.scrollSensitivity || 20; + o.scrollSpeed = o.scrollSpeed || 20; + + ui.instance.overflowY = function(el) { + do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode); + return $(document); + }(this); + ui.instance.overflowX = function(el) { + do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode); + return $(document); + }(this); + }, + drag: function(e, ui) { + + var o = ui.options; + var i = ui.instance; + + if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') { + if(i.overflowY[0].offsetHeight - (ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity) + i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed; + if((ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity) + i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed; + } else { + //$(document.body).append('

'+(e.pageY - $(document).scrollTop())+'

'); + if(e.pageY - $(document).scrollTop() < o.scrollSensitivity) + $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) + $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } + + if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') { + if(i.overflowX[0].offsetWidth - (ui.position.left - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity) + i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed; + if((ui.position.top - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity) + i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed; + } else { + if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity) + $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } + + ui.instance.recallOffset(e); + + } }); - $.ui.plugin.add("draggable", "drag", "containment", function(e,ui) { - - var o = ui.options; - if(!o.cursorAtIgnore) return; + $.ui.plugin.add("draggable", "snap", { + start: function(e, ui) { - var h = $(ui.helper); - var c = o.containment; - if(c.constructor == Array) { + ui.instance.snapElements = []; + $(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() { + var $t = $(this); var $o = $t.offset(); + if(this != ui.instance.element[0]) ui.instance.snapElements.push({ + item: this, + width: $t.outerWidth(), + height: $t.outerHeight(), + top: $o.top, + left: $o.left + }); + }); - if((ui.draggable.pos[0] < c[0]-o.po.left)) ui.draggable.pos[0] = c[0]-o.po.left; - if((ui.draggable.pos[1] < c[1]-o.po.top)) ui.draggable.pos[1] = c[1]-o.po.top; - if(ui.draggable.pos[0]+h[0].offsetWidth > c[2]-o.po.left) ui.draggable.pos[0] = c[2]-o.po.left-h[0].offsetWidth; - if(ui.draggable.pos[1]+h[0].offsetHeight > c[3]-o.po.top) ui.draggable.pos[1] = c[3]-o.po.top-h[0].offsetHeight; - - } else { + }, + drag: function(e, ui) { - if(c.left && (ui.draggable.pos[0] < c.left)) ui.draggable.pos[0] = c.left; - if(c.top && (ui.draggable.pos[1] < c.top)) ui.draggable.pos[1] = c.top; + var d = ui.options.snapTolerance || 20; + var x1 = ui.absolutePosition.left, x2 = x1 + ui.instance.helperProportions.width, + y1 = ui.absolutePosition.top, y2 = y1 + ui.instance.helperProportions.height; - var p = $(o.pp); - if(c.right && ui.draggable.pos[0]+h[0].offsetWidth > p[0].offsetWidth-c.right) ui.draggable.pos[0] = (p[0].offsetWidth-c.right)-h[0].offsetWidth; - if(c.bottom && ui.draggable.pos[1]+h[0].offsetHeight > p[0].offsetHeight-c.bottom) ui.draggable.pos[1] = (p[0].offsetHeight-c.bottom)-h[0].offsetHeight; - + for (var i = ui.instance.snapElements.length - 1; i >= 0; i--){ + + var l = ui.instance.snapElements[i].left, r = l + ui.instance.snapElements[i].width, + t = ui.instance.snapElements[i].top, b = t + ui.instance.snapElements[i].height; + + //Yes, I know, this is insane ;) + if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) continue; + + if(ui.options.snapMode != 'inner') { + var ts = Math.abs(t - y2) <= 20; + var bs = Math.abs(b - y1) <= 20; + var ls = Math.abs(l - x2) <= 20; + var rs = Math.abs(r - x1) <= 20; + if(ts) ui.position.top = t - ui.instance.offset.top + ui.instance.clickOffset.top - ui.instance.helperProportions.height; + if(bs) ui.position.top = b - ui.instance.offset.top + ui.instance.clickOffset.top; + if(ls) ui.position.left = l - ui.instance.offset.left + ui.instance.clickOffset.left - ui.instance.helperProportions.width; + if(rs) ui.position.left = r - ui.instance.offset.left + ui.instance.clickOffset.left; + } + + if(ui.options.snapMode != 'outer') { + var ts = Math.abs(t - y1) <= 20; + var bs = Math.abs(b - y2) <= 20; + var ls = Math.abs(l - x1) <= 20; + var rs = Math.abs(r - x2) <= 20; + if(ts) ui.position.top = t - ui.instance.offset.top + ui.instance.clickOffset.top; + if(bs) ui.position.top = b - ui.instance.offset.top + ui.instance.clickOffset.top - ui.instance.helperProportions.height; + if(ls) ui.position.left = l - ui.instance.offset.left + ui.instance.clickOffset.left; + if(rs) ui.position.left = r - ui.instance.offset.left + ui.instance.clickOffset.left - ui.instance.helperProportions.width; + } + + }; } - - }); - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "drag", "grid", function(e,ui) { - var o = ui.options; - if(!o.cursorAtIgnore) return; - ui.draggable.pos[0] = o.co.left + o.margins.left - o.po.left + Math.round((ui.draggable.pos[0] - o.co.left - o.margins.left + o.po.left) / o.grid[0]) * o.grid[0]; - ui.draggable.pos[1] = o.co.top + o.margins.top - o.po.top + Math.round((ui.draggable.pos[1] - o.co.top - o.margins.top + o.po.top) / o.grid[1]) * o.grid[1]; - }); - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "drag", "axis", function(e,ui) { - var o = ui.options; - if(!o.cursorAtIgnore) return; - if(o.constraint) o.axis = o.constraint; //Legacy check - o.axis ? ( o.axis == 'x' ? ui.draggable.pos[1] = o.co.top - o.margins.top - o.po.top : ui.draggable.pos[0] = o.co.left - o.margins.left - o.po.left ) : null; - }); - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "drag", "scroll", function(e,ui) { - - var o = ui.options; - o.scrollSensitivity = o.scrollSensitivity || 20; - o.scrollSpeed = o.scrollSpeed || 20; - - if(o.pp && o.ppOverflow) { // If we have a positioned parent, we only scroll in this one - // TODO: Extremely strange issues are waiting here..handle with care - } else { - if((ui.draggable.rpos[1] - $(window).height()) - $(document).scrollTop() > -o.scrollSensitivity) window.scrollBy(0,o.scrollSpeed); - if(ui.draggable.rpos[1] - $(document).scrollTop() < o.scrollSensitivity) window.scrollBy(0,-o.scrollSpeed); - if((ui.draggable.rpos[0] - $(window).width()) - $(document).scrollLeft() > -o.scrollSensitivity) window.scrollBy(o.scrollSpeed,0); - if(ui.draggable.rpos[0] - $(document).scrollLeft() < o.scrollSensitivity) window.scrollBy(-o.scrollSpeed,0); - } - - }); - -//---------------------------------------------------------------- - - $.ui.plugin.add("draggable", "drag", "wrapHelper", function(e,ui) { - - var o = ui.options; - if(o.cursorAtIgnore) return; - var t = ui.helper; - - if(!o.pp || !o.ppOverflow) { - var wx = $(window).width() - ($.browser.mozilla ? 20 : 0); - var sx = $(document).scrollLeft(); - - var wy = $(window).height(); - var sy = $(document).scrollTop(); - } else { - var wx = o.pp.offsetWidth + o.po.left - 20; - var sx = o.pp.scrollLeft; - - var wy = o.pp.offsetHeight + o.po.top - 20; - var sy = o.pp.scrollTop; - } - - ui.draggable.pos[0] -= ((ui.draggable.rpos[0]-o.cursorAt.left - wx + t.offsetWidth+o.margins.right) - sx > 0 || (ui.draggable.rpos[0]-o.cursorAt.left+o.margins.left) - sx < 0) ? (t.offsetWidth+o.margins.left+o.margins.right - o.cursorAt.left * 2) : 0; - - ui.draggable.pos[1] -= ((ui.draggable.rpos[1]-o.cursorAt.top - wy + t.offsetHeight+o.margins.bottom) - sy > 0 || (ui.draggable.rpos[1]-o.cursorAt.top+o.margins.top) - sy < 0) ? (t.offsetHeight+o.margins.top+o.margins.bottom - o.cursorAt.top * 2) : 0; - - }); - - //Make nodes selectable by expression - $.extend($.expr[':'], { droppable: "(' '+a.className+' ').indexOf(' ui-droppable ')" }); - - //Macros for external methods that support chaining - var methods = "destroy,enable,disable".split(","); - for(var i=0;i t && y1 < t) || (y1 < b && y2 > b) || (x2 > l && x1 < l) || (x1 < r && x2 > r))) return false; + + if(y2-(draggable.helperProportions.height/2) > t && y1 < t) return 1; //Crosses top edge + if(y1 < b && y2 > b) return 2; //Crosses bottom edge + if(x2 > l && x1 < l) return 1; //Crosses left edge + if(x1 < r && x2 > r) return 2; //Crosses right edge + + //return ( l < x1 && x2 < r + // && t < y1 && y2 < b); break; case 'intersect': - return ( l < x1 + (oDrag.helperSize.width / 2) // Right Half - && x2 - (oDrag.helperSize.width / 2) < r // Left Half - && t < y1 + (oDrag.helperSize.height / 2) // Bottom Half - && y2 - (oDrag.helperSize.height / 2) < b ); // Top Half + return ( l < x1 + (draggable.helperProportions.width / 2) // Right Half + && x2 - (draggable.helperProportions.width / 2) < r // Left Half + && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half + && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half break; case 'pointer': - return ( l < oDrag.rpos[0] && oDrag.rpos[0] < r - && t < oDrag.rpos[1] && oDrag.rpos[1] < b); + return ( l < ((draggable.positionAbs || draggable.position.absolute).left + draggable.clickOffset.left) && ((draggable.positionAbs || draggable.position.absolute).left + draggable.clickOffset.left) < r + && t < ((draggable.positionAbs || draggable.position.absolute).top + draggable.clickOffset.top) && ((draggable.positionAbs || draggable.position.absolute).top + draggable.clickOffset.top) < b); break; case 'touch': - return ( (l < x1 && x1 < r && t < y1 && y1 < b) // Top-Left Corner - || (l < x1 && x1 < r && t < y2 && y2 < b) // Bottom-Left Corner - || (l < x2 && x2 < r && t < y1 && y1 < b) // Top-Right Corner - || (l < x2 && x2 < r && t < y2 && y2 < b) ); // Bottom-Right Corner + return ( (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); break; default: return false; break; + } + + }; + + /* + This manager tracks offsets of draggables and droppables + */ + $.ui.ddmanager = { + current: null, + droppables: [], + prepareOffsets: function(t, e) { + + var m = $.ui.ddmanager.droppables; + var type = e ? e.type : null; // workaround for #2317 + for (var i = 0; i < m.length; i++) { + + if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue; + m[i].visible = m[i].element.is(":visible"); if(!m[i].visible) continue; //If the element is not visible, continue + m[i].offset = m[i].element.offset(); + m[i].proportions = { width: m[i].element.outerWidth(), height: m[i].element.outerHeight() }; + + if(type == "dragstart") m[i].activate.call(m[i], e); //Activate the droppable if used directly from draggables + } + + }, + drop: function(draggable, e) { + + var dropped = false; + $.each($.ui.ddmanager.droppables, function() { + + if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) + dropped = this.drop.call(this, e); + + if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { + this.isout = 1; this.isover = 0; + this.deactivate.call(this, e); + } + + }); + return dropped; + + }, + drag: function(draggable, e) { + + //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. + if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e); + + //Run through all droppables and check their positions based on specific tolerance options + $.each($.ui.ddmanager.droppables, function() { + + if(this.disabled || this.greedyChild || !this.visible) return; + var intersects = $.ui.intersect(draggable, this, this.options.tolerance); + + var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); + if(!c) return; + + var parentInstance; + if (this.options.greedy) { + var parent = this.element.parents('.ui-droppable:eq(0)'); + if (parent.length) { + parentInstance = $.data(parent[0], 'droppable'); + parentInstance.greedyChild = (c == 'isover' ? 1 : 0); + } + } + + // we just moved into a greedy child + if (parentInstance && c == 'isover') { + parentInstance['isover'] = 0; + parentInstance['isout'] = 1; + parentInstance.out.call(parentInstance, e); + } + + this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; + this[c == "isover" ? "over" : "out"].call(this, e); + + // we just moved out of a greedy child + if (parentInstance && c == 'isout') { + parentInstance['isout'] = 0; + parentInstance['isover'] = 1; + parentInstance.over.call(parentInstance, e); + } + }); + } }; - // options.activeClass - $.ui.plugin.add("droppable", "activate", "activeClass", function(e,ui) { - $(this).addClass(ui.options.activeClass); +/* + * Droppable Extensions + */ + + $.ui.plugin.add("droppable", "activeClass", { + activate: function(e, ui) { + $(this).addClass(ui.options.activeClass); + }, + deactivate: function(e, ui) { + $(this).removeClass(ui.options.activeClass); + }, + drop: function(e, ui) { + $(this).removeClass(ui.options.activeClass); + } }); - $.ui.plugin.add("droppable", "deactivate", "activeClass", function(e,ui) { - $(this).removeClass(ui.options.activeClass); + + $.ui.plugin.add("droppable", "hoverClass", { + over: function(e, ui) { + $(this).addClass(ui.options.hoverClass); + }, + out: function(e, ui) { + $(this).removeClass(ui.options.hoverClass); + }, + drop: function(e, ui) { + $(this).removeClass(ui.options.hoverClass); + } }); - $.ui.plugin.add("droppable", "drop", "activeClass", function(e,ui) { - $(this).removeClass(ui.options.activeClass); - }); - - // options.hoverClass - $.ui.plugin.add("droppable", "over", "hoverClass", function(e,ui) { - $(this).addClass(ui.options.hoverClass); - }); - $.ui.plugin.add("droppable", "out", "hoverClass", function(e,ui) { - $(this).removeClass(ui.options.hoverClass); - }); - $.ui.plugin.add("droppable", "drop", "hoverClass", function(e,ui) { - $(this).removeClass(ui.options.hoverClass); - }); - + })(jQuery); diff --git a/static/scripts/pack_scripts.py b/static/scripts/pack_scripts.py index 732eda31ee2..0bf5ac4e68b 100755 --- a/static/scripts/pack_scripts.py +++ b/static/scripts/pack_scripts.py @@ -1,16 +1,26 @@ #!/usr/bin/env python +import sys + from glob import glob from subprocess import call from shutil import copyfile from os import path -# Scripts that should not be packed +# Scripts that should not be packed -- just copied do_not_pack = set( [ "ie_pngfix.js", "aflax.js" ] ) -cmd = "java -jar ../../scripts/yuicompressor.jar --warn %(fname)s > packed/%(fname)s" +cmd = "java -jar ../../scripts/yuicompressor.jar --type js -v %(fname)s -o packed/%(fname)s" -for fname in glob( "*.js" ): +# If specific scripts specified on command line, just pack them, otherwise pack +# all. + +if len( sys.argv ) > 1: + to_pack = sys.argv[1:] +else: + to_pack = glob( "*.js" ) + +for fname in to_pack: d = dict( fname=fname ) print "%(fname)s --> packed/%(fname)s" % d if fname in do_not_pack: diff --git a/static/scripts/packed/galaxy.panels.js b/static/scripts/packed/galaxy.panels.js index 6f5da46ac99..dfe7e95e8bb 100644 --- a/static/scripts/packed/galaxy.panels.js +++ b/static/scripts/packed/galaxy.panels.js @@ -1 +1 @@ -var hidden_width=7;var border_tweak=jQuery.browser.msie?14:9;var jq=jQuery;function ensure_dd_helper(){if(jq("#DD-helper").length==0){var A=jq("
");if(jq.browser.ie){A.css("opacity","0.01")}A.appendTo("body").hide()}}function make_left_panel(E,A,B){var D=false;var C=null;resize=function(F){var G=F;if(F<0){F=0}jq(E).css("width",F);jq(B).css("left",G);jq(A).css("left",F+7)};toggle=function(){if(D){jq(B).removeClass("hover");jq(B).animate({left:C},"fast");jq(E).css("left",-C).show().animate({"left":0},"fast",function(){resize(C);jq(B).removeClass("hidden")});D=false}else{C=jq(B).position().left;jq(A).css("left",hidden_width);jq(B).removeClass("hover");jq(E).animate({left:-C},"fast");jq(B).animate({left:-1},"fast",function(){jq(this).addClass("hidden")});D=true}};jq(B).hover(function(){jq(this).addClass("hover")},function(){jq(this).removeClass("hover")}).draggable({start:function(F,G){jq("#DD-helper").show()},stop:function(F,G){jq("#DD-helper").hide();return false},drag:function(F,G){x=G.position.left;x=Math.min(400,Math.max(100,x));if(D){jq(E).css("left",0);jq(B).removeClass("hidden");D=false}resize(x);G.draggable.pos[0]=x;G.draggable.pos[1]=G.options.co.top},click:function(){toggle()}}).find("div").show()}function make_right_panel(A,E,G){var I=false;var F=false;var C=null;var D=function(J){jq(A).css("width",J);jq(E).css("right",J+9);jq(G).css("right",J).css("left","")};var H=function(){if(I){jq(G).removeClass("hover");jq(G).animate({right:C},"fast");jq(A).css("right",-C).show().animate({"right":0},"fast",function(){D(C);jq(G).removeClass("hidden")});I=false}else{C=jq(document).width()-jq(G).position().left-border_tweak;jq(E).css("right",hidden_width+1);jq(G).removeClass("hover");jq(A).animate({right:-C},"fast");jq(G).animate({right:-1},"fast",function(){jq(this).addClass("hidden")});I=true}F=false};var B=function(J){var K=jq(E).width()-(I?C:0);if(K");if(jq.browser.ie){A.css("opacity","0.01")}A.appendTo("body").hide()}if(jq("#popup-helper").length==0){var A=jq("");if(jq.browser.ie){A.css("opacity","0.01")}A.appendTo("body").hide()}}function make_left_panel(E,A,B){var D=false;var C=null;resize=function(F){var G=F;if(F<0){F=0}jq(E).css("width",F);jq(B).css("left",G);jq(A).css("left",F+7);if(document.recalc){document.recalc()}};toggle=function(){if(D){jq(B).removeClass("hover");jq(B).animate({left:C},"fast");jq(E).css("left",-C).show().animate({left:0},"fast",function(){resize(C);jq(B).removeClass("hidden")});D=false}else{C=jq(B).position().left;jq(A).css("left",hidden_width);if(document.recalc){document.recalc()}jq(B).removeClass("hover");jq(E).animate({left:-C},"fast");jq(B).animate({left:-1},"fast",function(){jq(this).addClass("hidden")});D=true}};jq(B).hover(function(){jq(this).addClass("hover")},function(){jq(this).removeClass("hover")}).draggable({start:function(F,G){jq("#DD-helper").show()},stop:function(F,G){jq("#DD-helper").hide();return false},drag:function(F,G){x=G.position.left;x=Math.min(400,Math.max(100,x));if(D){jq(E).css("left",0);jq(B).removeClass("hidden");D=false}resize(x);G.position.left=x;G.position.top=G.instance.originalPosition.top},click:function(){toggle()}}).find("div").show()}function make_right_panel(A,E,G){var I=false;var F=false;var C=null;var D=function(J){jq(A).css("width",J);jq(E).css("right",J+9);jq(G).css("right",J).css("left","");if(document.recalc){document.recalc()}};var H=function(){if(I){jq(G).removeClass("hover");jq(G).animate({right:C},"fast");jq(A).css("right",-C).show().animate({right:0},"fast",function(){D(C);jq(G).removeClass("hidden")});I=false}else{C=jq(document).width()-jq(G).position().left-border_tweak;jq(E).css("right",hidden_width+1);if(document.recalc){document.recalc()}jq(G).removeClass("hover");jq(A).animate({right:-C},"fast");jq(G).animate({right:-1},"fast",function(){jq(this).addClass("hidden")});I=true}F=false};var B=function(J){var K=jq(E).width()-(I?C:0);if(K
").appendTo("body");$.each(B,function(G,F){$("
").html(G).click(F).appendTo(A)});var C=function(){$(A).unbind().hide();$("#popup-helper").unbind().hide()};var E=function(){var F=$(D).offset();$("#popup-helper").mousedown(C).show();$(A).click(C).css({top:-1000}).show().css({top:F.top+$(D).height()+9,left:F.left+$(D).width()-$(A).width()})};$(D).click(E)}; \ No newline at end of file diff --git a/static/scripts/packed/galaxy.workflow_editor.canvas.js b/static/scripts/packed/galaxy.workflow_editor.canvas.js index 5367766d9df..bc9e6317cd3 100644 --- a/static/scripts/packed/galaxy.workflow_editor.canvas.js +++ b/static/scripts/packed/galaxy.workflow_editor.canvas.js @@ -1 +1 @@ -function OutputTerminal(A,B){this.element=A;this.connectors=[];this.datatype=B}$.extend(OutputTerminal.prototype,{connect:function(A){this.connectors.push(A)},disconnect:function(A){this.connectors.splice($.inArray(A,this.connectors),1)},redraw:function(){$.each(this.connectors,function(A,B){B.redraw()})},destroy:function(){$.each(this.connectors.slice(),function(A,B){B.destroy()})}});function InputTerminal(A,B){this.element=A;this.connectors=[];this.max_connections=1;this.datatypes=B}$.extend(InputTerminal.prototype,{connect:function(A){this.connectors.push(A)},disconnect:function(A){this.connectors.splice($.inArray(A,this.connectors),1)},can_accept:function(A){if(this.connectors.length
').get(0);E.terminal=new OutputTerminal(E);var F=new Connector();this.drag_temp_connector=F;F.dragging=true;F.connect(this.terminal,E.terminal);return E},drag:function(F,E){E.helper.terminal.redraw()},stop:function(F,E){this.drag_temp_connector.destroy()}});node.output_terminals[A]=D})},destroy:function(){$.each(this.input_terminals,function(A,B){B.destroy();$(B.element).droppableDestroy()});$.each(this.output_terminals,function(A,B){B.destroy();$(B.element).draggableDestroy()});$(this.element).draggableDestroy().remove();workflow.remove_node(this)},make_active:function(){$(this.element).addClass("toolForm-active")},make_inactive:function(){$(this.element).removeClass("toolForm-active")},init_field_data:function(C){var B=this.element;this.form_html=C.form_html;this.tool_state=C.tool_state;var A=this;b=B.find(".toolFormBody");b.find("div").remove();$.each(C.data_inputs,function(E,D){t=$("
");A.enable_input_terminal(t,D.name,D.extensions);b.append($("
"+D.name+"
").prepend(t))});if((C.data_inputs.length>0)&&(C.data_outputs.length>0)){b.append($("
"))}$.each(C.data_outputs,function(F,D){var E=$("
");A.enable_output_terminal(E,D.name,D.extension);b.append($("
"+D.name+"
").append(E))});workflow.node_changed(this)},update_field_data:function(A){this.tool_state=A.state;this.form_html=A.form_html;this.has_errors=A.has_errors;if(this.has_errors){$(this.element).addClass("tool-node-error")}else{$(this.element).removeClass("tool-node-error")}if(workflow.active_node==this){workflow.activate_node(this)}},error:function(C){var A=$(this.element).find(".toolFormBody");A.find("div").remove();var B="
"+C+"
";this.form_html=$(B);A.html(B);workflow.node_changed(this)}});function Workflow(){this.id_counter=0;this.nodes={};this.name=null;this.has_changes=false}$.extend(Workflow.prototype,{add_node:function(A){A.id=String(this.id_counter);this.id_counter++;this.nodes[A.id]=A;this.has_changes=true},remove_node:function(A){if(this.active_node==A){this.clear_active_node()}delete this.nodes[A.id];this.has_changes=true},remove_all:function(){wf=this;$.each(this.nodes,function(B,A){A.destroy();wf.remove_node(A)})},to_simple:function(){var A={};$.each(this.nodes,function(B,D){var E={};$.each(D.input_terminals,function(F,G){E[G.name]=null;$.each(G.connectors,function(H,I){E[G.name]={node_id:I.handle1.node.id,output_name:I.handle1.name}})});var C={id:D.id,tool_id:D.tool_id,tool_state:D.tool_state,has_errors:D.has_errors,input_connections:E,position:$(D.element).position()};A[D.id]=C});return{steps:A}},from_simple:function(A){wf=this;var B=0;wf.name=A.name;$.each(A.steps,function(E,D){var C=prebuild_node_for_tool(D.tool_id,D.name);C.init_field_data(D);if(D.position){C.element.css({top:D.position.top,left:D.position.left})}C.id=E;wf.nodes[C.id]=C;B=Math.max(B,parseInt(E))});wf.id_counter=B+1;$.each(A.steps,function(E,D){var C=wf.nodes[E];$.each(D.input_connections,function(G,F){if(F){var H=wf.nodes[F.node_id];var I=new Connector();I.connect(H.output_terminals[F.output_name],C.input_terminals[G]);I.redraw()}})})},clear_active_node:function(){if(this.active_node){this.active_node.make_inactive()}parent.show_form_for_tool("
No node selected
")},activate_node:function(A){this.clear_active_node();parent.show_form_for_tool(A.form_html,A);A.make_active();this.active_node=A},node_changed:function(A){if(this.active_node==A){this.activate_node(A)}}});function prebuild_node_for_tool(B,F){var E=$("
");var C=new Node(E);C.tool_id=B;var I=$("
"+F+"
");E.append(I);E.css("left",$(window).scrollLeft()+20);E.css("top",$(window).scrollTop()+20);var H=$("
");var D="
loading tool info...
";H.append(D);C.form_html=$(D);E.append(H);var G=$("
");G.append($("").click(function(){C.destroy()}).hover(function(){$(this).attr("src","../images/delete_icon_dark.png")},function(){$(this).attr("src","../images/delete_icon.png")}));E.appendTo("body");var A=E.width();G.prependTo(I);A+=(G.width()+10);E.css("width",A);$(E).draggable({cursor:"move",scroll:true,scrollSensitivity:10,scrollSpeed:20,containment:$("#shim"),click:function(){document.body.removeChild(this);document.body.appendChild(this);workflow.activate_node(C)},start:function(){workflow.activate_node(C);$(this).css("z-index","1000")},drag:function(){$(this).find(".terminal").each(function(){this.terminal.redraw()})},stop:function(){document.body.removeChild(this);document.body.appendChild(this);$(this).css("z-index","100");$(this).find(".terminal").each(function(){this.terminal.redraw()})}});return C}var ext_to_type=null;var type_to_type=null;function issubtype(B,A){B=ext_to_type[B];A=ext_to_type[A];return(A in type_to_type[B])}function populate_datatype_info(A){ext_to_type=A.ext_to_class_name;type_to_type=A.class_to_classes} \ No newline at end of file +function OutputTerminal(A,B){this.element=A;this.connectors=[];this.datatype=B}$.extend(OutputTerminal.prototype,{connect:function(A){this.connectors.push(A)},disconnect:function(A){this.connectors.splice($.inArray(A,this.connectors),1)},redraw:function(){$.each(this.connectors,function(A,B){B.redraw()})},destroy:function(){$.each(this.connectors.slice(),function(A,B){B.destroy()})}});function InputTerminal(A,B){this.element=A;this.connectors=[];this.max_connections=1;this.datatypes=B}$.extend(InputTerminal.prototype,{connect:function(A){this.connectors.push(A)},disconnect:function(A){this.connectors.splice($.inArray(A,this.connectors),1)},can_accept:function(A){if(this.connectors.length').appendTo("#canvas-container").get(0);E.terminal=new OutputTerminal(E);var F=new Connector();this.drag_temp_connector=F;F.dragging=true;F.connect(this.terminal,E.terminal);return E},drag:function(F,E){h=E.helper.get(0);h.terminal.redraw()},stop:function(F,E){this.drag_temp_connector.destroy()}});node.output_terminals[A]=D})},destroy:function(){$.each(this.input_terminals,function(A,B){B.destroy();$(B.element).droppableDestroy()});$.each(this.output_terminals,function(A,B){B.destroy();$(B.element).draggableDestroy()});$(this.element).draggableDestroy().remove();workflow.remove_node(this)},make_active:function(){$(this.element).addClass("toolForm-active")},make_inactive:function(){$(this.element).removeClass("toolForm-active")},init_field_data:function(C){var B=this.element;this.form_html=C.form_html;this.tool_state=C.tool_state;var A=this;b=B.find(".toolFormBody");b.find("div").remove();$.each(C.data_inputs,function(E,D){t=$("
");A.enable_input_terminal(t,D.name,D.extensions);b.append($("
"+D.name+"
").prepend(t))});if((C.data_inputs.length>0)&&(C.data_outputs.length>0)){b.append($("
"))}$.each(C.data_outputs,function(F,D){var E=$("
");A.enable_output_terminal(E,D.name,D.extension);b.append($("
"+D.name+"
").append(E))});workflow.node_changed(this)},update_field_data:function(A){this.tool_state=A.state;this.form_html=A.form_html;this.tool_errors=A.tool_errors;if(this.tool_errors){$(this.element).addClass("tool-node-error")}else{$(this.element).removeClass("tool-node-error")}if(workflow.active_node==this){workflow.activate_node(this)}},error:function(C){var A=$(this.element).find(".toolFormBody");A.find("div").remove();var B="
"+C+"
";this.form_html=B;A.html(B);workflow.node_changed(this)}});function Workflow(){this.id_counter=0;this.nodes={};this.name=null;this.has_changes=false}$.extend(Workflow.prototype,{add_node:function(A){A.id=this.id_counter;this.id_counter++;this.nodes[A.id]=A;this.has_changes=true},remove_node:function(A){if(this.active_node==A){this.clear_active_node()}delete this.nodes[A.id];this.has_changes=true},remove_all:function(){wf=this;$.each(this.nodes,function(B,A){A.destroy();wf.remove_node(A)})},to_simple:function(){var A={};$.each(this.nodes,function(B,D){var E={};$.each(D.input_terminals,function(F,G){E[G.name]=null;$.each(G.connectors,function(H,I){E[G.name]={id:I.handle1.node.id,output_name:I.handle1.name}})});var C={id:D.id,tool_id:D.tool_id,tool_state:D.tool_state,tool_errors:D.tool_errors,input_connections:E,position:$(D.element).position()};A[D.id]=C});return{steps:A}},from_simple:function(A){wf=this;var B=0;wf.name=A.name;$.each(A.steps,function(E,D){var C=prebuild_node_for_tool(D.tool_id,D.name);C.init_field_data(D);if(D.position){C.element.css({top:D.position.top,left:D.position.left})}C.id=D.id;wf.nodes[C.id]=C;B=Math.max(B,parseInt(E))});wf.id_counter=B+1;$.each(A.steps,function(E,D){var C=wf.nodes[E];$.each(D.input_connections,function(G,F){if(F){var H=wf.nodes[F.id];var I=new Connector();I.connect(H.output_terminals[F.output_name],C.input_terminals[G]);I.redraw()}})})},clear_active_node:function(){if(this.active_node){this.active_node.make_inactive()}parent.show_form_for_tool("
No node selected
")},activate_node:function(A){this.clear_active_node();parent.show_form_for_tool(A.form_html,A);A.make_active();this.active_node=A},node_changed:function(A){if(this.active_node==A){this.activate_node(A)}}});function prebuild_node_for_tool(B,F){var E=$("
");var C=new Node(E);C.tool_id=B;var I=$("
"+F+"
");E.append(I);E.css("left",$(window).scrollLeft()+20);E.css("top",$(window).scrollTop()+20);var H=$("
");var D="
loading tool info...
";H.append(D);C.form_html=D;E.append(H);var G=$("
");G.append($("").click(function(){C.destroy()}).hover(function(){$(this).attr("src","../images/delete_icon_dark.png")},function(){$(this).attr("src","../images/delete_icon.png")}));E.appendTo("#canvas-container");var A=E.width();G.prependTo(I);A+=(G.width()+10);E.css("width",A);$(E).draggable({cursor:"move",scroll:true,scrollSensitivity:10,scrollSpeed:20,click:function(J,K){(function(L){L.removeChild(K);L.appendChild(K)})(K.parentNode);workflow.activate_node(C)},start:function(){workflow.activate_node(C);$(this).css("z-index","1000")},drag:function(){$(this).find(".terminal").each(function(){this.terminal.redraw()})},stop:function(J,K){element=K.element.get(0);(function(L){L.removeChild(element);L.appendChild(element)})(element.parentNode);$(this).css("z-index","100");$(this).find(".terminal").each(function(){this.terminal.redraw()})}});return C}var ext_to_type=null;var type_to_type=null;function issubtype(B,A){B=ext_to_type[B];A=ext_to_type[A];return(A in type_to_type[B])}function populate_datatype_info(A){ext_to_type=A.ext_to_class_name;type_to_type=A.class_to_classes}; \ No newline at end of file diff --git a/static/scripts/packed/jquery.ui.js b/static/scripts/packed/jquery.ui.js index 9dad2730910..6a912e5cc87 100644 --- a/static/scripts/packed/jquery.ui.js +++ b/static/scripts/packed/jquery.ui.js @@ -1 +1 @@ -(function($){$.ui=$.ui||{};$.extend($.ui,{plugin:{add:function(w,c,o,p){var a=$.ui[w].prototype;if(!a.plugins[c]){a.plugins[c]=[]}a.plugins[c].push([o,p])},call:function(instance,name,args){var c=instance.plugins[name];if(!c){return }var o=instance.interaction?instance.interaction.options:instance.options;var e=instance.interaction?instance.interaction.element:instance.element;for(var i=0;i0||o.cursorAt.bottom-o.margins.bottom>0)&&(o.cursorAt.left-o.margins.left>0||o.cursorAt.right-o.margins.right>0))?true:false;if(!o.nonDestructive){$(this.helper).css("position","absolute")}if(o.helper!="original"){$(this.helper).appendTo((o.appendTo=="parent"?a.parentNode:o.appendTo)).show()}if(o.cursorAt.right&&!o.cursorAt.left){o.cursorAt.left=this.helper.offsetWidth+o.margins.right+o.margins.left-o.cursorAt.right}if(o.cursorAt.bottom&&!o.cursorAt.top){o.cursorAt.top=this.helper.offsetHeight+o.margins.top+o.margins.bottom-o.cursorAt.bottom}this.init=true;if(o._start){o._start.apply(a,[this.helper,this.pos,o.cursorAt,this,e])}this.helperSize={width:outerWidth(this.helper),height:outerHeight(this.helper)};return false},stop:function(e){var o=this.options;var a=this.element;var self=this;$(document).unbind("mouseup",self.mouseup);$(document).unbind("mousemove",self.mousemove);if(this.init==false){$(this.element).triggerHandler("click",[e],o.click);this.opos=this.pos=null;return null}if(o._beforeStop){o._beforeStop.apply(a,[this.helper,this.pos,o.cursorAt,this,e])}if(this.helper!=a&&!o.beQuietAtEnd){$(this.helper).remove();this.helper=null}if(!o.beQuietAtEnd){if(o._stop){o._stop.apply(a,[this.helper,this.pos,o.cursorAt,this,e])}}this.init=false;this.opos=this.pos=null;return false},drag:function(e){if(!this.opos||($.browser.msie&&!e.button)){return this.stop.apply(this,[e])}var o=this.options;this.pos=[e.pageX,e.pageY];if(this.rpos&&this.rpos[0]==this.pos[0]&&this.rpos[1]==this.pos[1]){return false}this.rpos=[this.pos[0],this.pos[1]];if(o.pp){this.pos[0]-=o.po.left;this.pos[1]-=o.po.top}if((Math.abs(this.rpos[0]-this.opos[0])>o.preventionDistance||Math.abs(this.rpos[1]-this.opos[1])>o.preventionDistance)&&this.init==false){this.start.apply(this,[e])}else{if(this.init==false){return false}}if(o._drag){o._drag.apply(this.element,[this.helper,this.pos,o.cursorAt,this,e])}return false}});var num=function(el,prop){return parseInt($.css(el.jquery?el[0]:el,prop))||0};function outerWidth(el){var $el=$(el),ow=$el.width();for(var i=0,props=["borderLeftWidth","paddingLeft","paddingRight","borderRightWidth"];i").css("width",$(o.iframeFix[i])[0].offsetWidth+"px").css("height",$(o.iframeFix[i])[0].offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",co.top+"px").css("left",co.left+"px").appendTo("body")}}else{$("iframe").each(function(){var co=$(this).offset({border:false});$("
").css("width",this.offsetWidth+"px").css("height",this.offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",co.top+"px").css("left",co.left+"px").appendTo("body")})}}});$.ui.plugin.add("draggable","stop","iframeFix",function(e,ui){if(ui.options.iframeFix){$("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}});$.ui.plugin.add("draggable","start","containment",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore||o.containment.left!=undefined||o.containment.constructor==Array){return }if(o.containment=="parent"){o.containment=this.parentNode}if(o.containment=="document"){o.containment=[0-o.margins.left,0-o.margins.top,$(document).width()-o.margins.right,($(document).height()||document.body.parentNode.scrollHeight)-o.margins.bottom]}else{var ce=$(o.containment)[0];var co=$(o.containment).offset({border:false});o.containment=[co.left-o.margins.left,co.top-o.margins.top,co.left+(ce.offsetWidth||ce.scrollWidth)-o.margins.right,co.top+(ce.offsetHeight||ce.scrollHeight)-o.margins.bottom]}});$.ui.plugin.add("draggable","drag","containment",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore){return }var h=$(ui.helper);var c=o.containment;if(c.constructor==Array){if((ui.draggable.pos[0]c[2]-o.po.left){ui.draggable.pos[0]=c[2]-o.po.left-h[0].offsetWidth}if(ui.draggable.pos[1]+h[0].offsetHeight>c[3]-o.po.top){ui.draggable.pos[1]=c[3]-o.po.top-h[0].offsetHeight}}else{if(c.left&&(ui.draggable.pos[0]p[0].offsetWidth-c.right){ui.draggable.pos[0]=(p[0].offsetWidth-c.right)-h[0].offsetWidth}if(c.bottom&&ui.draggable.pos[1]+h[0].offsetHeight>p[0].offsetHeight-c.bottom){ui.draggable.pos[1]=(p[0].offsetHeight-c.bottom)-h[0].offsetHeight}}});$.ui.plugin.add("draggable","drag","grid",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore){return }ui.draggable.pos[0]=o.co.left+o.margins.left-o.po.left+Math.round((ui.draggable.pos[0]-o.co.left-o.margins.left+o.po.left)/o.grid[0])*o.grid[0];ui.draggable.pos[1]=o.co.top+o.margins.top-o.po.top+Math.round((ui.draggable.pos[1]-o.co.top-o.margins.top+o.po.top)/o.grid[1])*o.grid[1]});$.ui.plugin.add("draggable","drag","axis",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore){return }if(o.constraint){o.axis=o.constraint}o.axis?(o.axis=="x"?ui.draggable.pos[1]=o.co.top-o.margins.top-o.po.top:ui.draggable.pos[0]=o.co.left-o.margins.left-o.po.left):null});$.ui.plugin.add("draggable","drag","scroll",function(e,ui){var o=ui.options;o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;if(o.pp&&o.ppOverflow){}else{if((ui.draggable.rpos[1]-$(window).height())-$(document).scrollTop()>-o.scrollSensitivity){window.scrollBy(0,o.scrollSpeed)}if(ui.draggable.rpos[1]-$(document).scrollTop()-o.scrollSensitivity){window.scrollBy(o.scrollSpeed,0)}if(ui.draggable.rpos[0]-$(document).scrollLeft()0||(ui.draggable.rpos[0]-o.cursorAt.left+o.margins.left)-sx<0)?(t.offsetWidth+o.margins.left+o.margins.right-o.cursorAt.left*2):0;ui.draggable.pos[1]-=((ui.draggable.rpos[1]-o.cursorAt.top-wy+t.offsetHeight+o.margins.bottom)-sy>0||(ui.draggable.rpos[1]-o.cursorAt.top+o.margins.top)-sy<0)?(t.offsetHeight+o.margins.top+o.margins.bottom-o.cursorAt.top*2):0});$.extend($.expr[":"],{droppable:"(' '+a.className+' ').indexOf(' ui-droppable ')"});var methods="destroy,enable,disable".split(",");for(var i=0;i').addClass(C).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");B.ui.cssCache[C]=!!((!/auto|default/.test(D.css("cursor"))||(/^[1-9]/).test(D.css("height"))||(/^[1-9]/).test(D.css("width"))||!(/none/).test(D.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(D.css("backgroundColor"))));try{B("body").get(0).removeChild(D.get(0))}catch(E){}return B.ui.cssCache[C]},disableSelection:function(C){C.unselectable="on";C.onselectstart=function(){return false};if(C.style){C.style.MozUserSelect="none"}},enableSelection:function(C){C.unselectable="off";C.onselectstart=function(){return true};if(C.style){C.style.MozUserSelect=""}},hasScroll:function(F,D){var C=/top/.test(D||"top")?"scrollTop":"scrollLeft",E=false;if(F[C]>0){return true}F[C]=1;E=F[C]>0?true:false;F[C]=0;return E}});var A=B.fn.remove;B.fn.extend({mouseInteraction:function(C){return this.each(function(){new B.ui.mouseInteraction(this,C)})},removeMouseInteraction:function(C){return this.each(function(){if(B.data(this,"ui-mouse")){B.data(this,"ui-mouse").destroy()}})},remove:function(){jQuery("*",this).add(this).trigger("remove");return A.apply(this,arguments)}});B.ui.mouseInteraction=function(E,D){var C=this;this.element=E;B.data(this.element,"ui-mouse",this);this.options=B.extend({},D);B(E).bind("mousedown.draggable",function(){return C.click.apply(C,arguments)});if(B.browser.msie){B(E).attr("unselectable","on")}B(E).mouseup(function(){if(C.timer){clearInterval(C.timer)}})};B.extend(B.ui.mouseInteraction.prototype,{destroy:function(){B(this.element).unbind("mousedown.draggable")},trigger:function(){return this.click.apply(this,arguments)},click:function(E){if(E.which!=1||B.inArray(E.target.nodeName.toLowerCase(),this.options.dragPrevention||[])!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[E,this.element]))){return true}var D=this;var C=function(){D._MP={left:E.pageX,top:E.pageY};B(document).bind("mouseup.draggable",function(){return D.stop.apply(D,arguments)});B(document).bind("mousemove.draggable",function(){return D.drag.apply(D,arguments)});if(!D.initalized&&Math.abs(D._MP.left-E.pageX)>=D.options.distance||Math.abs(D._MP.top-E.pageY)>=D.options.distance){if(D.options.start){D.options.start.call(D.options.executor||D,E,D.element)}if(D.options.drag){D.options.drag.call(D.options.executor||D,E,this.element)}D.initialized=true}};if(this.options.delay){if(this.timer){clearInterval(this.timer)}this.timer=setTimeout(C,this.options.delay)}else{C()}return false},stop:function(C){var D=this.options;if(!this.initialized){if(this.options.click){this.options.click.call(this.options.executor||this,C,this.element)}return B(document).unbind("mouseup.draggable").unbind("mousemove.draggable")}if(this.options.stop){this.options.stop.call(this.options.executor||this,C,this.element)}B(document).unbind("mouseup.draggable").unbind("mousemove.draggable");this.initialized=false;return false},drag:function(C){var D=this.options;if(B.browser.msie&&!C.button){return this.stop.apply(this,[C])}if(!this.initialized&&(Math.abs(this._MP.left-C.pageX)>=D.distance||Math.abs(this._MP.top-C.pageY)>=D.distance)){if(this.options.start){this.options.start.call(this.options.executor||this,C,this.element)}this.initialized=true}else{if(!this.initialized){return false}}if(D.drag){D.drag.call(this.options.executor||this,C,this.element)}return false}})})(jQuery);(function(A){A.fn.extend({draggable:function(C){var B=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof C=="string"){var D=A.data(this,"draggable");if(D){D[C].apply(D,B)}}else{if(!A.data(this,"draggable")){new A.ui.draggable(this,C)}}})}});A.ui.draggable=function(D,C){var B=this;this.element=A(D);A.data(D,"draggable",this);this.element.addClass("ui-draggable");this.options=A.extend({},C);var E=this.options;A.extend(E,{helper:E.ghosting==true?"clone":(E.helper||"original"),handle:E.handle?(A(E.handle,D)[0]?A(E.handle,D):this.element):this.element,appendTo:E.appendTo||"parent"});A(D).bind("setData.draggable",function(G,F,H){B.options[F]=H}).bind("getData.draggable",function(G,F){return B.options[F]});A(E.handle).mouseInteraction({executor:this,delay:E.delay,distance:E.distance||1,dragPrevention:E.cancel||E.cancel===""?E.cancel.toLowerCase().split(","):["input","textarea","button","select","option"],start:this.start,stop:this.stop,drag:this.drag,click:this.options.click,condition:function(F){return !(F.target.className.indexOf("ui-resizable-handle")!=-1||this.options.disabled)}});if(E.helper=="original"&&(this.element.css("position")=="static"||this.element.css("position")=="")){this.element.css("position","relative")}if(E.cursorAt&&E.cursorAt.constructor==Array){E.cursorAt={left:E.cursorAt[0],top:E.cursorAt[1]}}};A.extend(A.ui.draggable.prototype,{plugins:{},ui:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,instance:this,options:this.options,element:this.element}},propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);return this.element.triggerHandler(C=="drag"?C:"drag"+C,[B,this.ui()],this.options[C])},destroy:function(){if(!A.data(this.element[0],"draggable")){return }this.options.handle.removeMouseInteraction();this.element.removeClass("ui-draggable ui-draggable-disabled").removeData("draggable").unbind(".draggable")},enable:function(){this.element.removeClass("ui-draggable-disabled");this.options.disabled=false},disable:function(){this.element.addClass("ui-draggable-disabled");this.options.disabled=true},setContrains:function(B,C,E,D){this.minLeft=B;this.maxLeft=C;this.minTop=E;this.maxTop=D;this.constrainsSet=true},checkConstrains:function(){if(!this.constrainsSet){return }if(this.position.leftthis.maxLeft-this.helperProportions.width){this.position.left=this.maxLeft-this.helperProportions.width}if(this.position.topthis.maxTop-this.helperProportions.height){this.position.top=this.maxTop-this.helperProportions.height}},recallOffset:function(D){var C={left:this.elementOffset.left-this.offsetParentOffset.left,top:this.elementOffset.top-this.offsetParentOffset.top};var B=this.helper.css("position")=="relative";var E=this.options;this.originalPosition={left:(C.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft)),top:(C.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop))};this.offset={left:this._pageX-this.originalPosition.left,top:this._pageY-this.originalPosition.top};if(this.element[0]!=this.helper[0]){this.offset.left+=parseInt(this.element.css("marginLeft"),10)||0;this.offset.top+=parseInt(this.element.css("marginTop"),10)||0}},start:function(D){var E=this.options;if(A.ui.ddmanager){A.ui.ddmanager.current=this}this.helper=typeof E.helper=="function"?A(E.helper.apply(this.element[0],[D])):(E.helper=="clone"?this.element.clone().appendTo((E.appendTo=="parent"?this.element[0].parentNode:E.appendTo)):this.element);if(this.helper[0]!=this.element[0]){this.helper.css("position","absolute")}if(!this.helper.parents("body").length){this.helper.appendTo((E.appendTo=="parent"?this.element[0].parentNode:E.appendTo))}this.offsetParent=(function(F){while(F){if(F.style&&(/(absolute|relative|fixed)/).test(A.css(F,"position"))){return A(F)}F=F.parentNode?F.parentNode:null}return A("body")})(this.helper[0].parentNode);this.elementOffset=this.element.offset();this.offsetParentOffset=this.offsetParent.offset();var C={left:this.elementOffset.left-this.offsetParentOffset.left,top:this.elementOffset.top-this.offsetParentOffset.top};this._pageX=D.pageX;this._pageY=D.pageY;this.clickOffset={left:D.pageX-this.elementOffset.left,top:D.pageY-this.elementOffset.top};var B=this.helper.css("position")=="relative";this.originalPosition={left:(B?parseInt(this.helper.css("left"),10)||0:C.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft)),top:(B?parseInt(this.helper.css("top"),10)||0:C.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop))};if(this.element.css("position")=="fixed"){this.originalPosition.top-=this.offsetParent[0]==document.body?A(document).scrollTop():this.offsetParent[0].scrollTop;this.originalPosition.left-=this.offsetParent[0]==document.body?A(document).scrollLeft():this.offsetParent[0].scrollLeft}this.offset={left:D.pageX-this.originalPosition.left,top:D.pageY-this.originalPosition.top};if(this.element[0]!=this.helper[0]){this.offset.left+=parseInt(this.element.css("marginLeft"),10)||0;this.offset.top+=parseInt(this.element.css("marginTop"),10)||0}this.propagate("start",D);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(A.ui.ddmanager&&!E.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,D)}if(E.cursorAt){if(E.cursorAt.top!=undefined||E.cursorAt.bottom!=undefined){this.offset.top-=this.clickOffset.top-(E.cursorAt.top!=undefined?E.cursorAt.top:(this.helperProportions.height-E.cursorAt.bottom));this.clickOffset.top=(E.cursorAt.top!=undefined?E.cursorAt.top:(this.helperProportions.height-E.cursorAt.bottom))}if(E.cursorAt.left!=undefined||E.cursorAt.right!=undefined){this.offset.left-=this.clickOffset.left-(E.cursorAt.left!=undefined?E.cursorAt.left:(this.helperProportions.width-E.cursorAt.right));this.clickOffset.left=(E.cursorAt.left!=undefined?E.cursorAt.left:(this.helperProportions.width-E.cursorAt.right))}}return false},clear:function(){if(A.ui.ddmanager){A.ui.ddmanager.current=null}this.helper=null},stop:function(B){if(A.ui.ddmanager&&!this.options.dropBehaviour){A.ui.ddmanager.drop(this,B)}this.propagate("stop",B);if(this.cancelHelperRemoval){return false}if(this.options.helper!="original"){this.helper.remove()}this.clear();return false},drag:function(B){this.position={top:B.pageY-this.offset.top,left:B.pageX-this.offset.left};this.positionAbs={left:B.pageX-this.clickOffset.left,top:B.pageY-this.clickOffset.top};this.checkConstrains();this.position=this.propagate("drag",B)||this.position;this.checkConstrains();A(this.helper).css({left:this.position.left+"px",top:this.position.top+"px"});if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false}});A.ui.plugin.add("draggable","cursor",{start:function(D,C){var B=A("body");if(B.css("cursor")){C.options._cursor=B.css("cursor")}B.css("cursor",C.options.cursor)},stop:function(C,B){if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("draggable","zIndex",{start:function(D,C){var B=A(C.helper);if(B.css("zIndex")){C.options._zIndex=B.css("zIndex")}B.css("zIndex",C.options.zIndex)},stop:function(C,B){if(B.options._zIndex){A(B.helper).css("zIndex",B.options._zIndex)}}});A.ui.plugin.add("draggable","opacity",{start:function(D,C){var B=A(C.helper);if(B.css("opacity")){C.options._opacity=B.css("opacity")}B.css("opacity",C.options.opacity)},stop:function(C,B){if(B.options._opacity){A(B.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("draggable","revert",{stop:function(E,D){var B=D.instance,C=A(B.helper);B.cancelHelperRemoval=true;A(D.helper).animate({left:B.originalPosition.left,top:B.originalPosition.top},parseInt(D.options.revert,10)||500,function(){if(D.options.helper!="original"){C.remove()}if(!C){B.clear()}})}});A.ui.plugin.add("draggable","iframeFix",{start:function(D,C){var F=C.options;if(C.instance.slowMode){return }if(F.iframeFix.constructor==Array){for(var B=0;B').css("width",A(F.iframeFix[B])[0].offsetWidth+"px").css("height",A(F.iframeFix[B])[0].offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",E.top+"px").css("left",E.left+"px").appendTo("body")}}else{A("iframe").each(function(){var G=A(this).offset({border:false});A('
').css("width",this.offsetWidth+"px").css("height",this.offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",G.top+"px").css("left",G.left+"px").appendTo("body")})}},stop:function(C,B){if(B.options.iframeFix){A("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}}});A.ui.plugin.add("draggable","containment",{start:function(E,C){var G=C.options;var B=C.instance;if((G.containment.left!=undefined||G.containment.constructor==Array)&&!G._containment){return }if(!G._containment){G._containment=G.containment}if(G._containment=="parent"){G._containment=this[0].parentNode}if(G._containment=="document"){G.containment=[0,0,A(document).width(),(A(document).height()||document.body.parentNode.scrollHeight)]}else{var D=A(G._containment)[0];var F=A(G._containment).offset();G.containment=[F.left+parseInt(A(D).css("borderLeftWidth")),F.top+parseInt(A(D).css("borderTopWidth")),F.left+(D.offsetWidth||D.scrollWidth)-parseInt(A(D).css("borderRightWidth")),F.top+(D.offsetHeight||D.scrollHeight)-parseInt(A(D).css("borderBottomWidth"))]}var H=G.containment;C.instance.setContrains(H[0]-(B.offset.left-B.clickOffset.left),H[2]-(B.offset.left-B.clickOffset.left),H[1]-(B.offset.top-B.clickOffset.top),H[3]-(B.offset.top-B.clickOffset.top))}});A.ui.plugin.add("draggable","grid",{drag:function(E,D){var F=D.options;var C=D.instance.originalPosition.left+Math.round((E.pageX-D.instance._pageX)/F.grid[0])*F.grid[0];var B=D.instance.originalPosition.top+Math.round((E.pageY-D.instance._pageY)/F.grid[1])*F.grid[1];D.instance.position.left=C;D.instance.position.top=B}});A.ui.plugin.add("draggable","axis",{drag:function(C,B){var D=B.options;if(D.constraint){D.axis=D.constraint}switch(D.axis){case"x":B.instance.position.top=B.instance.originalPosition.top;break;case"y":B.instance.position.left=B.instance.originalPosition.left;break}}});A.ui.plugin.add("draggable","scroll",{start:function(C,B){var D=B.options;D.scrollSensitivity=D.scrollSensitivity||20;D.scrollSpeed=D.scrollSpeed||20;B.instance.overflowY=function(E){do{if(/auto|scroll/.test(E.css("overflow"))||(/auto|scroll/).test(E.css("overflow-y"))){return E}E=E.parent()}while(E[0].parentNode);return A(document)}(this);B.instance.overflowX=function(E){do{if(/auto|scroll/.test(E.css("overflow"))||(/auto|scroll/).test(E.css("overflow-x"))){return E}E=E.parent()}while(E[0].parentNode);return A(document)}(this)},drag:function(D,C){var E=C.options;var B=C.instance;if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){if(B.overflowY[0].offsetHeight-(C.position.top-B.overflowY[0].scrollTop+B.clickOffset.top)=0;H--){var E=M.instance.snapElements[H].left,B=E+M.instance.snapElements[H].width,Q=M.instance.snapElements[H].top,L=Q+M.instance.snapElements[H].height;if(!((E-KK&&IG)||(C>E&&DB))){return false}if(H-(L.helperProportions.height/2)>K&&IG){return 2}if(C>E&&DB){return 2}break;case"intersect":return(E=K&&I<=G)||(H>=K&&H<=G)||(IG))&&((D>=E&&D<=B)||(C>=E&&C<=B)||(DB));break;default:return false;break}};A.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(D,F){var B=A.ui.ddmanager.droppables;var E=F?F.type:null;for(var C=0;C - - + + ## Default javascripts @@ -65,8 +65,10 @@ - ## Scripts can be loaded later since they progressively add features to - ## the panels, but do not change layout - ${self.late_javascripts()} + ## Allow other body level elements + ${next.body()} + ## Scripts can be loaded later since they progressively add features to + ## the panels, but do not change layout + ${self.late_javascripts()} diff --git a/templates/workflow/editor.mako b/templates/workflow/editor.mako index edafb5fe853..a1faadda4a4 100644 --- a/templates/workflow/editor.mako +++ b/templates/workflow/editor.mako @@ -1,30 +1,41 @@ <%inherit file="/base_panels.mako"/> <%def name="late_javascripts()"> + ## + ## + ## + + + + +<%def name="javascripts()"> - ## ${parent.late_javascripts()} + ## ${parent.javascripts()} - - + ## + ## - - - - + ## + ## + + @@ -242,6 +279,8 @@
-
-
-
-
-
-
Loading workflow editor...
-
+ ## Need a table here for centering in IE6 +
+
+
+
+
Loading workflow editor...
+
+
-
- -
-
- - -
+ ##
<%def name="masthead()"> -
Workflow support is currently in beta
+
Workflow support is currently in beta
Galaxy workflow editor
@@ -412,17 +508,22 @@ <%def name="center_panel()"> +
-
Save
+ Save
Workflow canvas
-
- + +
+
+
+
+ <%def name="right_panel()"> diff --git a/templates/workflow/editor_canvas.mako b/templates/workflow/editor_canvas.mako deleted file mode 100644 index 1d8c0ea7b78..00000000000 --- a/templates/workflow/editor_canvas.mako +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - \ No newline at end of file