diff --git a/deluge/ui/web/js/ext-extensions/Spinner.js b/deluge/ui/web/js/ext-extensions/Spinner.js deleted file mode 100644 index 292fbbb3e..000000000 --- a/deluge/ui/web/js/ext-extensions/Spinner.js +++ /dev/null @@ -1,438 +0,0 @@ -/*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license - */ -/** - * @class Ext.ux.Spinner - * @extends Ext.util.Observable - * Creates a Spinner control utilized by Ext.ux.form.SpinnerField - */ -Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { - incrementValue: 1, - alternateIncrementValue: 5, - triggerClass: 'x-form-spinner-trigger', - splitterClass: 'x-form-spinner-splitter', - alternateKey: Ext.EventObject.shiftKey, - defaultValue: 0, - accelerate: false, - - constructor: function(config){ - Ext.ux.Spinner.superclass.constructor.call(this, config); - Ext.apply(this, config); - this.mimicing = false; - }, - - init: function(field){ - this.field = field; - - field.afterMethod('onRender', this.doRender, this); - field.afterMethod('onEnable', this.doEnable, this); - field.afterMethod('onDisable', this.doDisable, this); - field.afterMethod('afterRender', this.doAfterRender, this); - field.afterMethod('onResize', this.doResize, this); - field.afterMethod('onFocus', this.doFocus, this); - field.beforeMethod('onDestroy', this.doDestroy, this); - }, - - doRender: function(ct, position){ - var el = this.el = this.field.getEl(); - var f = this.field; - - if (!f.wrap) { - f.wrap = this.wrap = el.wrap({ - cls: "x-form-field-wrap" - }); - } - else { - this.wrap = f.wrap.addClass('x-form-field-wrap'); - } - - this.trigger = this.wrap.createChild({ - tag: "img", - src: Ext.BLANK_IMAGE_URL, - cls: "x-form-trigger " + this.triggerClass - }); - - if (!f.width) { - this.wrap.setWidth(el.getWidth() + this.trigger.getWidth()); - } - - this.splitter = this.wrap.createChild({ - tag: 'div', - cls: this.splitterClass, - style: 'width:13px; height:2px;' - }); - this.splitter.setRight((Ext.isIE) ? 1 : 2).setTop(10).show(); - - this.proxy = this.trigger.createProxy('', this.splitter, true); - this.proxy.addClass("x-form-spinner-proxy"); - this.proxy.setStyle('left', '0px'); - this.proxy.setSize(14, 1); - this.proxy.hide(); - this.dd = new Ext.dd.DDProxy(this.splitter.dom.id, "SpinnerDrag", { - dragElId: this.proxy.id - }); - - this.initTrigger(); - this.initSpinner(); - }, - - doAfterRender: function(){ - var y; - if (Ext.isIE && this.el.getY() != (y = this.trigger.getY())) { - this.el.position(); - this.el.setY(y); - } - }, - - doEnable: function(){ - if (this.wrap) { - this.wrap.removeClass(this.field.disabledClass); - } - }, - - doDisable: function(){ - if (this.wrap) { - this.wrap.addClass(this.field.disabledClass); - this.el.removeClass(this.field.disabledClass); - } - }, - - doResize: function(w, h){ - if (typeof w == 'number') { - this.el.setWidth(w - this.trigger.getWidth()); - } - this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth()); - }, - - doFocus: function(){ - if (!this.mimicing) { - this.wrap.addClass('x-trigger-wrap-focus'); - this.mimicing = true; - Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, { - delay: 10 - }); - this.el.on('keydown', this.checkTab, this); - } - }, - - // private - checkTab: function(e){ - if (e.getKey() == e.TAB) { - this.triggerBlur(); - } - }, - - // private - mimicBlur: function(e){ - if (!this.wrap.contains(e.target) && this.field.validateBlur(e)) { - this.triggerBlur(); - } - }, - - // private - triggerBlur: function(){ - this.mimicing = false; - Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); - this.el.un("keydown", this.checkTab, this); - this.field.beforeBlur(); - this.wrap.removeClass('x-trigger-wrap-focus'); - this.field.onBlur.call(this.field); - }, - - initTrigger: function(){ - this.trigger.addClassOnOver('x-form-trigger-over'); - this.trigger.addClassOnClick('x-form-trigger-click'); - }, - - initSpinner: function(){ - this.field.addEvents({ - 'spin': true, - 'spinup': true, - 'spindown': true - }); - - this.keyNav = new Ext.KeyNav(this.el, { - "up": function(e){ - e.preventDefault(); - this.onSpinUp(); - }, - - "down": function(e){ - e.preventDefault(); - this.onSpinDown(); - }, - - "pageUp": function(e){ - e.preventDefault(); - this.onSpinUpAlternate(); - }, - - "pageDown": function(e){ - e.preventDefault(); - this.onSpinDownAlternate(); - }, - - scope: this - }); - - this.repeater = new Ext.util.ClickRepeater(this.trigger, { - accelerate: this.accelerate - }); - this.field.mon(this.repeater, "click", this.onTriggerClick, this, { - preventDefault: true - }); - - this.field.mon(this.trigger, { - mouseover: this.onMouseOver, - mouseout: this.onMouseOut, - mousemove: this.onMouseMove, - mousedown: this.onMouseDown, - mouseup: this.onMouseUp, - scope: this, - preventDefault: true - }); - - this.field.mon(this.wrap, "mousewheel", this.handleMouseWheel, this); - - this.dd.setXConstraint(0, 0, 10) - this.dd.setYConstraint(1500, 1500, 10); - this.dd.endDrag = this.endDrag.createDelegate(this); - this.dd.startDrag = this.startDrag.createDelegate(this); - this.dd.onDrag = this.onDrag.createDelegate(this); - }, - - onMouseOver: function(){ - if (this.disabled) { - return; - } - var middle = this.getMiddle(); - this.tmpHoverClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-overup' : 'x-form-spinner-overdown'; - this.trigger.addClass(this.tmpHoverClass); - }, - - //private - onMouseOut: function(){ - this.trigger.removeClass(this.tmpHoverClass); - }, - - //private - onMouseMove: function(){ - if (this.disabled) { - return; - } - var middle = this.getMiddle(); - if (((Ext.EventObject.getPageY() > middle) && this.tmpHoverClass == "x-form-spinner-overup") || - ((Ext.EventObject.getPageY() < middle) && this.tmpHoverClass == "x-form-spinner-overdown")) { - } - }, - - //private - onMouseDown: function(){ - if (this.disabled) { - return; - } - var middle = this.getMiddle(); - this.tmpClickClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-clickup' : 'x-form-spinner-clickdown'; - this.trigger.addClass(this.tmpClickClass); - }, - - //private - onMouseUp: function(){ - this.trigger.removeClass(this.tmpClickClass); - }, - - //private - onTriggerClick: function(){ - if (this.disabled || this.el.dom.readOnly) { - return; - } - var middle = this.getMiddle(); - var ud = (Ext.EventObject.getPageY() < middle) ? 'Up' : 'Down'; - this['onSpin' + ud](); - }, - - //private - getMiddle: function(){ - var t = this.trigger.getTop(); - var h = this.trigger.getHeight(); - var middle = t + (h / 2); - return middle; - }, - - //private - //checks if control is allowed to spin - isSpinnable: function(){ - if (this.disabled || this.el.dom.readOnly) { - Ext.EventObject.preventDefault(); //prevent scrolling when disabled/readonly - return false; - } - return true; - }, - - handleMouseWheel: function(e){ - //disable scrolling when not focused - if (this.wrap.hasClass('x-trigger-wrap-focus') == false) { - return; - } - - var delta = e.getWheelDelta(); - if (delta > 0) { - this.onSpinUp(); - e.stopEvent(); - } - else - if (delta < 0) { - this.onSpinDown(); - e.stopEvent(); - } - }, - - //private - startDrag: function(){ - this.proxy.show(); - this._previousY = Ext.fly(this.dd.getDragEl()).getTop(); - }, - - //private - endDrag: function(){ - this.proxy.hide(); - }, - - //private - onDrag: function(){ - if (this.disabled) { - return; - } - var y = Ext.fly(this.dd.getDragEl()).getTop(); - var ud = ''; - - if (this._previousY > y) { - ud = 'Up'; - } //up - if (this._previousY < y) { - ud = 'Down'; - } //down - if (ud != '') { - this['onSpin' + ud](); - } - - this._previousY = y; - }, - - //private - onSpinUp: function(){ - if (this.isSpinnable() == false) { - return; - } - if (Ext.EventObject.shiftKey == true) { - this.onSpinUpAlternate(); - return; - } - else { - this.spin(false, false); - } - this.field.fireEvent("spin", this); - this.field.fireEvent("spinup", this); - }, - - //private - onSpinDown: function(){ - if (this.isSpinnable() == false) { - return; - } - if (Ext.EventObject.shiftKey == true) { - this.onSpinDownAlternate(); - return; - } - else { - this.spin(true, false); - } - this.field.fireEvent("spin", this); - this.field.fireEvent("spindown", this); - }, - - //private - onSpinUpAlternate: function(){ - if (this.isSpinnable() == false) { - return; - } - this.spin(false, true); - this.field.fireEvent("spin", this); - this.field.fireEvent("spinup", this); - }, - - //private - onSpinDownAlternate: function(){ - if (this.isSpinnable() == false) { - return; - } - this.spin(true, true); - this.field.fireEvent("spin", this); - this.field.fireEvent("spindown", this); - }, - - spin: function(down, alternate){ - var v = parseFloat(this.field.getValue()); - var incr = (alternate == true) ? this.alternateIncrementValue : this.incrementValue; - (down == true) ? v -= incr : v += incr; - - v = (isNaN(v)) ? this.defaultValue : v; - v = this.fixBoundries(v); - this.field.setRawValue(v); - }, - - fixBoundries: function(value){ - var v = value; - - if (this.field.minValue != undefined && v < this.field.minValue) { - v = this.field.minValue; - } - if (this.field.maxValue != undefined && v > this.field.maxValue) { - v = this.field.maxValue; - } - - return this.fixPrecision(v); - }, - - // private - fixPrecision: function(value){ - var nan = isNaN(value); - if (!this.field.allowDecimals || this.field.decimalPrecision == -1 || nan || !value) { - return nan ? '' : value; - } - return parseFloat(parseFloat(value).toFixed(this.field.decimalPrecision)); - }, - - doDestroy: function(){ - if (this.trigger) { - this.trigger.remove(); - } - if (this.wrap) { - this.wrap.remove(); - delete this.field.wrap; - } - - if (this.splitter) { - this.splitter.remove(); - } - - if (this.dd) { - this.dd.unreg(); - this.dd = null; - } - - if (this.proxy) { - this.proxy.remove(); - } - - if (this.repeater) { - this.repeater.purgeListeners(); - } - } -}); - -//backwards compat -Ext.form.Spinner = Ext.ux.Spinner; diff --git a/deluge/ui/web/js/ext-extensions/StatusBar.js b/deluge/ui/web/js/ext-extensions/StatusBar.js index 07b85c6c5..eb2ad9e00 100644 --- a/deluge/ui/web/js/ext-extensions/StatusBar.js +++ b/deluge/ui/web/js/ext-extensions/StatusBar.js @@ -1,20 +1,14 @@ -/*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license - */ /** * @class Ext.ux.StatusBar *

Basic status bar component that can be used as the bottom toolbar of any {@link Ext.Panel}. In addition to - * supporting the standard {@link Ext.Toolbar} interface for adding buttons, menus and other items, the StatusBar + * supporting the standard {@link Ext.toolbar.Toolbar} interface for adding buttons, menus and other items, the StatusBar * provides a greedy status element that can be aligned to either side and has convenient methods for setting the * status text and icon. You can also indicate that something is processing using the {@link #showBusy} method.

*

-new Ext.Panel({
+Ext.create('Ext.Panel', {
     title: 'StatusBar',
     // etc.
-    bbar: new Ext.ux.StatusBar({
+    bbar: Ext.create('Ext.ux.StatusBar', {
         id: 'my-status',
 
         // defaults to use when the status is cleared:
@@ -47,12 +41,16 @@ sb.showBusy();
 
 sb.clearStatus(); // once completeed
 
- * @extends Ext.Toolbar + * @extends Ext.toolbar.Toolbar * @constructor * Creates a new StatusBar * @param {Object/Array} config A config object */ -Ext.ux.StatusBar = Ext.extend(Ext.Toolbar, { +Ext.define('Ext.ux.statusbar.StatusBar', { + extend: 'Ext.toolbar.Toolbar', + alternateClassName: 'Ext.ux.StatusBar', + alias: 'widget.statusbar', + requires: ['Ext.toolbar.TextItem'], /** * @cfg {String} statusAlign * The alignment of the status element within the overall StatusBar layout. When the StatusBar is rendered, @@ -63,10 +61,10 @@ Ext.ux.StatusBar = Ext.extend(Ext.Toolbar, { *

 // Create a left-aligned status bar containing a button,
 // separator and text item that will be right-aligned (default):
-new Ext.Panel({
+Ext.create('Ext.Panel', {
     title: 'StatusBar',
     // etc.
-    bbar: new Ext.ux.StatusBar({
+    bbar: Ext.create('Ext.ux.StatusBar', {
         defaultText: 'Default status text',
         id: 'status-id',
         items: [{
@@ -78,10 +76,10 @@ new Ext.Panel({
 // By adding the statusAlign config, this will create the
 // exact same toolbar, except the status and toolbar item
 // layout will be reversed from the previous example:
-new Ext.Panel({
+Ext.create('Ext.Panel', {
     title: 'StatusBar',
     // etc.
-    bbar: new Ext.ux.StatusBar({
+    bbar: Ext.create('Ext.ux.StatusBar', {
         defaultText: 'Default status text',
         id: 'status-id',
         statusAlign: 'right',
@@ -121,7 +119,7 @@ new Ext.Panel({
 }
 
 // Setting a default icon:
-var sb = new Ext.ux.StatusBar({
+var sb = Ext.create('Ext.ux.StatusBar', {
     defaultIconCls: 'x-status-custom'
 });
 
@@ -184,42 +182,32 @@ sb.setStatus({
 
     // private
     initComponent : function(){
-        if(this.statusAlign=='right'){
+        if (this.statusAlign === 'right') {
             this.cls += ' x-status-right';
         }
-        Ext.ux.StatusBar.superclass.initComponent.call(this);
+        this.callParent(arguments);
     },
 
     // private
     afterRender : function(){
-        Ext.ux.StatusBar.superclass.afterRender.call(this);
+        this.callParent(arguments);
 
-        var right = this.statusAlign == 'right';
+        var right = this.statusAlign === 'right';
         this.currIconCls = this.iconCls || this.defaultIconCls;
-        this.statusEl = new Ext.Toolbar.TextItem({
+        this.statusEl = Ext.create('Ext.toolbar.TextItem', {
             cls: 'x-status-text ' + (this.currIconCls || ''),
             text: this.text || this.defaultText || ''
         });
 
-        if(right){
+        if (right) {
             this.add('->');
             this.add(this.statusEl);
-        }else{
+        } else {
             this.insert(0, this.statusEl);
             this.insert(1, '->');
         }
-
-//         this.statusEl = td.createChild({
-//             cls: 'x-status-text ' + (this.iconCls || this.defaultIconCls || ''),
-//             html: this.text || this.defaultText || ''
-//         });
-//         this.statusEl.unselectable();
-
-//         this.spacerEl = td.insertSibling({
-//             tag: 'td',
-//             style: 'width:100%',
-//             cn: [{cls:'ytb-spacer'}]
-//         }, right ? 'before' : 'after');
+        this.height = 27;
+        this.doLayout();
     },
 
     /**
@@ -271,39 +259,40 @@ statusBar.setStatus({
 
* @return {Ext.ux.StatusBar} this */ - setStatus : function(o){ + setStatus : function(o) { o = o || {}; - if(typeof o == 'string'){ + if (Ext.isString(o)) { o = {text:o}; } - if(o.text !== undefined){ + if (o.text !== undefined) { this.setText(o.text); } - if(o.iconCls !== undefined){ + if (o.iconCls !== undefined) { this.setIcon(o.iconCls); } - if(o.clear){ + if (o.clear) { var c = o.clear, wait = this.autoClear, defaults = {useDefaults: true, anim: true}; - if(typeof c == 'object'){ + if (Ext.isObject(c)) { c = Ext.applyIf(c, defaults); - if(c.wait){ + if (c.wait) { wait = c.wait; } - }else if(typeof c == 'number'){ + } else if (Ext.isNumber(c)) { wait = c; c = defaults; - }else if(typeof c == 'boolean'){ + } else if (Ext.isBoolean(c)) { c = defaults; } c.threadId = this.activeThreadId; - this.clearStatus.defer(wait, this, [c]); + Ext.defer(this.clearStatus, wait, this, [c]); } + this.doLayout(); return this; }, @@ -318,10 +307,10 @@ statusBar.setStatus({ * * @return {Ext.ux.StatusBar} this */ - clearStatus : function(o){ + clearStatus : function(o) { o = o || {}; - if(o.threadId && o.threadId !== this.activeThreadId){ + if (o.threadId && o.threadId !== this.activeThreadId) { // this means the current call was made internally, but a newer // thread has set a message since this call was deferred. Since // we don't want to overwrite a newer message just ignore. @@ -331,30 +320,31 @@ statusBar.setStatus({ var text = o.useDefaults ? this.defaultText : this.emptyText, iconCls = o.useDefaults ? (this.defaultIconCls ? this.defaultIconCls : '') : ''; - if(o.anim){ - // animate the statusEl Ext.Element - this.statusEl.el.fadeOut({ + if (o.anim) { + // animate the statusEl Ext.core.Element + this.statusEl.el.puff({ remove: false, useDisplay: true, scope: this, callback: function(){ this.setStatus({ - text: text, - iconCls: iconCls - }); + text: text, + iconCls: iconCls + }); this.statusEl.el.show(); } }); - }else{ + } else { // hide/show the el to avoid jumpy text or icon - this.statusEl.hide(); - this.setStatus({ - text: text, - iconCls: iconCls - }); - this.statusEl.show(); + this.statusEl.hide(); + this.setStatus({ + text: text, + iconCls: iconCls + }); + this.statusEl.show(); } + this.doLayout(); return this; }, @@ -366,7 +356,7 @@ statusBar.setStatus({ setText : function(text){ this.activeThreadId++; this.text = text || ''; - if(this.rendered){ + if (this.rendered) { this.statusEl.setText(this.text); } return this; @@ -390,16 +380,16 @@ statusBar.setStatus({ this.activeThreadId++; cls = cls || ''; - if(this.rendered){ - if(this.currIconCls){ - this.statusEl.removeClass(this.currIconCls); - this.currIconCls = null; - } - if(cls.length > 0){ - this.statusEl.addClass(cls); - this.currIconCls = cls; - } - }else{ + if (this.rendered) { + if (this.currIconCls) { + this.statusEl.removeCls(this.currIconCls); + this.currIconCls = null; + } + if (cls.length > 0) { + this.statusEl.addCls(cls); + this.currIconCls = cls; + } + } else { this.currIconCls = cls; } return this; @@ -416,8 +406,8 @@ statusBar.setStatus({ * @return {Ext.ux.StatusBar} this */ showBusy : function(o){ - if(typeof o == 'string'){ - o = {text:o}; + if (Ext.isString(o)) { + o = { text: o }; } o = Ext.applyIf(o || {}, { text: this.busyText, @@ -426,4 +416,3 @@ statusBar.setStatus({ return this.setStatus(o); } }); -Ext.reg('statusbar', Ext.ux.StatusBar); diff --git a/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js b/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js deleted file mode 100644 index f5a325829..000000000 --- a/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Ext.ux.form.RadioGroup.js - * - * Copyright (c) Damien Churchill 2009-2010 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give - * permission to link the code of portions of this program with the OpenSSL - * library. - * You must obey the GNU General Public License in all respects for all of - * the code used other than OpenSSL. If you modify file(s) with this - * exception, you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete - * this exception statement from your version. If you delete this exception - * statement from all source files in the program, then also delete it here. - */ - -// Allow radiogroups to be treated as a single form element. -Ext.override(Ext.form.RadioGroup, { - - afterRender: function() { - this.items.each(function(i) { - this.relayEvents(i, ['check']); - }, this); - if (this.lazyValue) { - this.setValue(this.value); - delete this.value; - delete this.lazyValue; - } - Ext.form.RadioGroup.superclass.afterRender.call(this) - }, - - getName: function() { - return this.items.first().getName(); - }, - - getValue: function() { - return this.items.first().getGroupValue(); - }, - - setValue: function(v) { - if (!this.items.each) { - this.value = v; - this.lazyValue = true; - return; - } - this.items.each(function(item) { - if (item.rendered) { - var checked = (item.el.getValue() == String(v)); - item.el.dom.checked = checked; - item.el.dom.defaultChecked = checked; - item.wrap[checked ? 'addClass' : 'removeClass'](item.checkedCls); - } - }); - } -}); diff --git a/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js b/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js index 7e042fb5a..6ff690437 100644 --- a/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js +++ b/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js @@ -1,6 +1,6 @@ /*! * Ext.ux.form.SpinnerGroup.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This program is free software; you can redistribute it and/or modify @@ -29,12 +29,20 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.ns('Ext.ux.form'); /** + * Ext.ux.form.SpinnerGroup class * + * @author Damien Churchill + * @version v0.1 + * + * @class Ext.ux.form.SpinnerGroup + * @extends Ext.form.CheckboxGroup */ -Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { +Ext.define('Ext.ux.form.SpinnerGroup', { + + extend: 'Ext.form.CheckboxGroup', + alias: 'widget.spinnergroup', // private defaultType: 'spinnerfield', @@ -169,7 +177,7 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { } } - Ext.ux.form.SpinnerGroup.superclass.onRender.call(this, ct, position); + this.callParent(arguments); }, onFieldChange: function(spinner) { @@ -216,4 +224,3 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { } } }); -Ext.reg('spinnergroup', Ext.ux.form.SpinnerGroup); diff --git a/deluge/ui/web/js/ext-extensions/form/ToggleField.js b/deluge/ui/web/js/ext-extensions/form/ToggleField.js index ccc36ac80..abcfc94e5 100644 --- a/deluge/ui/web/js/ext-extensions/form/ToggleField.js +++ b/deluge/ui/web/js/ext-extensions/form/ToggleField.js @@ -1,7 +1,7 @@ /*! * Ext.ux.form.ToggleField.js - * - * Copyright (c) Damien Churchill 2009-2010 + * + * Copyright (c) Damien Churchill 2009-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,6 @@ * this exception statement from your version. If you delete this exception * statement from all source files in the program, then also delete it here. */ -Ext.namespace("Ext.ux.form"); /** * Ext.ux.form.ToggleField class @@ -40,12 +39,15 @@ Ext.namespace("Ext.ux.form"); * @class Ext.ux.form.ToggleField * @extends Ext.form.TriggerField */ -Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { +Ext.define('Ext.ux.form.ToggleField', { + + extend: 'Ext.form.Field', + alias: 'widget.togglefield', cls: 'x-toggle-field', initComponent: function() { - Ext.ux.form.ToggleField.superclass.initComponent.call(this); + this.callParent(arguments); this.toggle = new Ext.form.Checkbox(); this.toggle.on('check', this.onToggleCheck, this); @@ -75,7 +77,7 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { this.toggle.getEl().parent().setStyle('padding-right', '10px'); } - Ext.ux.form.ToggleField.superclass.onRender.call(this, ct, position); + this.callParent(arguments); }, // private @@ -92,4 +94,3 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { this.input.setDisabled(!checked); } }); -Ext.reg('togglefield', Ext.ux.form.ToggleField); diff --git a/deluge/ui/web/js/ext-extensions/grid/BufferView.js b/deluge/ui/web/js/ext-extensions/grid/BufferView.js deleted file mode 100644 index c42a108e7..000000000 --- a/deluge/ui/web/js/ext-extensions/grid/BufferView.js +++ /dev/null @@ -1,219 +0,0 @@ -/*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license - */ -Ext.ns('Ext.ux.grid'); - -/** - * @class Ext.ux.grid.BufferView - * @extends Ext.grid.GridView - * A custom GridView which renders rows on an as-needed basis. - */ -Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { - /** - * @cfg {Number} rowHeight - * The height of a row in the grid. - */ - rowHeight: 19, - - /** - * @cfg {Number} borderHeight - * The combined height of border-top and border-bottom of a row. - */ - borderHeight: 2, - - /** - * @cfg {Boolean/Number} scrollDelay - * The number of milliseconds before rendering rows out of the visible - * viewing area. Defaults to 100. Rows will render immediately with a config - * of false. - */ - scrollDelay: 100, - - /** - * @cfg {Number} cacheSize - * The number of rows to look forward and backwards from the currently viewable - * area. The cache applies only to rows that have been rendered already. - */ - cacheSize: 20, - - /** - * @cfg {Number} cleanDelay - * The number of milliseconds to buffer cleaning of extra rows not in the - * cache. - */ - cleanDelay: 500, - - initTemplates : function(){ - Ext.ux.grid.BufferView.superclass.initTemplates.call(this); - var ts = this.templates; - // empty div to act as a place holder for a row - ts.rowHolder = new Ext.Template( - '
' - ); - ts.rowHolder.disableFormats = true; - ts.rowHolder.compile(); - - ts.rowBody = new Ext.Template( - '', - '{cells}', - (this.enableRowBody ? '' : ''), - '
{body}
' - ); - ts.rowBody.disableFormats = true; - ts.rowBody.compile(); - }, - - getStyleRowHeight : function(){ - return Ext.isBorderBox ? (this.rowHeight + this.borderHeight) : this.rowHeight; - }, - - getCalculatedRowHeight : function(){ - return this.rowHeight + this.borderHeight; - }, - - getVisibleRowCount : function(){ - var rh = this.getCalculatedRowHeight(); - var visibleHeight = this.scroller.dom.clientHeight; - return (visibleHeight < 1) ? 0 : Math.ceil(visibleHeight / rh); - }, - - getVisibleRows: function(){ - var count = this.getVisibleRowCount(); - var sc = this.scroller.dom.scrollTop; - var start = (sc == 0 ? 0 : Math.floor(sc/this.getCalculatedRowHeight())-1); - return { - first: Math.max(start, 0), - last: Math.min(start + count + 2, this.ds.getCount()-1) - }; - }, - - doRender : function(cs, rs, ds, startRow, colCount, stripe, onlyBody){ - var ts = this.templates, ct = ts.cell, rt = ts.row, rb = ts.rowBody, last = colCount-1; - var rh = this.getStyleRowHeight(); - var vr = this.getVisibleRows(); - var tstyle = 'width:'+this.getTotalWidth()+';height:'+rh+'px;'; - // buffers - var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r; - for (var j = 0, len = rs.length; j < len; j++) { - r = rs[j]; cb = []; - var rowIndex = (j+startRow); - var visible = rowIndex >= vr.first && rowIndex <= vr.last; - if (visible) { - for (var i = 0; i < colCount; i++) { - c = cs[i]; - p.id = c.id; - p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : ''); - p.attr = p.cellAttr = ""; - p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds); - p.style = c.style; - if (p.value == undefined || p.value === "") { - p.value = " "; - } - if (r.dirty && typeof r.modified[c.name] !== 'undefined') { - p.css += ' x-grid3-dirty-cell'; - } - cb[cb.length] = ct.apply(p); - } - } - var alt = []; - if(stripe && ((rowIndex+1) % 2 == 0)){ - alt[0] = "x-grid3-row-alt"; - } - if(r.dirty){ - alt[1] = " x-grid3-dirty-row"; - } - rp.cols = colCount; - if(this.getRowClass){ - alt[2] = this.getRowClass(r, rowIndex, rp, ds); - } - rp.alt = alt.join(" "); - rp.cells = cb.join(""); - buf[buf.length] = !visible ? ts.rowHolder.apply(rp) : (onlyBody ? rb.apply(rp) : rt.apply(rp)); - } - return buf.join(""); - }, - - isRowRendered: function(index){ - var row = this.getRow(index); - return row && row.childNodes.length > 0; - }, - - syncScroll: function(){ - Ext.ux.grid.BufferView.superclass.syncScroll.apply(this, arguments); - this.update(); - }, - - // a (optionally) buffered method to update contents of gridview - update: function(){ - if (this.scrollDelay) { - if (!this.renderTask) { - this.renderTask = new Ext.util.DelayedTask(this.doUpdate, this); - } - this.renderTask.delay(this.scrollDelay); - }else{ - this.doUpdate(); - } - }, - - onRemove : function(ds, record, index, isUpdate){ - Ext.ux.grid.BufferView.superclass.onRemove.apply(this, arguments); - if(isUpdate !== true){ - this.update(); - } - }, - - doUpdate: function(){ - if (this.getVisibleRowCount() > 0) { - var g = this.grid, cm = g.colModel, ds = g.store; - var cs = this.getColumnData(); - - var vr = this.getVisibleRows(); - for (var i = vr.first; i <= vr.last; i++) { - // if row is NOT rendered and is visible, render it - if(!this.isRowRendered(i)){ - var html = this.doRender(cs, [ds.getAt(i)], ds, i, cm.getColumnCount(), g.stripeRows, true); - this.getRow(i).innerHTML = html; - } - } - this.clean(); - } - }, - - // a buffered method to clean rows - clean : function(){ - if(!this.cleanTask){ - this.cleanTask = new Ext.util.DelayedTask(this.doClean, this); - } - this.cleanTask.delay(this.cleanDelay); - }, - - doClean: function(){ - if (this.getVisibleRowCount() > 0) { - var vr = this.getVisibleRows(); - vr.first -= this.cacheSize; - vr.last += this.cacheSize; - - var i = 0, rows = this.getRows(); - // if first is less than 0, all rows have been rendered - // so lets clean the end... - if(vr.first <= 0){ - i = vr.last + 1; - } - for(var len = this.ds.getCount(); i < len; i++){ - // if current row is outside of first and last and - // has content, update the innerHTML to nothing - if ((i < vr.first || i > vr.last) && rows[i].innerHTML) { - rows[i].innerHTML = ''; - } - } - } - }, - - layout: function(){ - Ext.ux.grid.BufferView.superclass.layout.call(this); - this.update(); - } -}); diff --git a/deluge/ui/web/js/ext-extensions/layout/FormLayoutFix.js b/deluge/ui/web/js/ext-extensions/layout/FormLayoutFix.js deleted file mode 100644 index 5f4121574..000000000 --- a/deluge/ui/web/js/ext-extensions/layout/FormLayoutFix.js +++ /dev/null @@ -1,56 +0,0 @@ -/*! - * Ext.ux.layout.FormLayoutFix.js - * - * Copyright (c) Damien Churchill 2009-2010 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, write to: - * The Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, the copyright holders give - * permission to link the code of portions of this program with the OpenSSL - * library. - * You must obey the GNU General Public License in all respects for all of - * the code used other than OpenSSL. If you modify file(s) with this - * exception, you may extend this exception to your version of the file(s), - * but you are not obligated to do so. If you do not wish to do so, delete - * this exception statement from your version. If you delete this exception - * statement from all source files in the program, then also delete it here. - */ - -// Taken from http://extjs.com/forum/showthread.php?t=75273 -// remove spaces for hidden elements and make show(), hide(), enable() and disable() act on -// the label. don't use hideLabel with this. -Ext.override(Ext.layout.FormLayout, { - renderItem : function(c, position, target){ - if(c && !c.rendered && (c.isFormField || c.fieldLabel) && c.inputType != 'hidden'){ - var args = this.getTemplateArgs(c); - if(typeof position == 'number'){ - position = target.dom.childNodes[position] || null; - } - if(position){ - c.formItem = this.fieldTpl.insertBefore(position, args, true); - }else{ - c.formItem = this.fieldTpl.append(target, args, true); - } - c.actionMode = 'formItem'; - c.render('x-form-el-'+c.id); - c.container = c.formItem; - c.actionMode = 'container'; - }else { - Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments); - } - } -});