summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/js/ext-extensions-debug.js
diff options
context:
space:
mode:
authorDamien Churchill <damoc@gmail.com>2009-04-18 16:20:07 +0000
committerDamien Churchill <damoc@gmail.com>2009-04-18 16:20:07 +0000
commit491f4a44385a4fca481c2ac338fca4aba1d00dd3 (patch)
treeace98198242b6492978c93a595325af6a8fb6c73 /deluge/ui/web/js/ext-extensions-debug.js
parent843deae4cd87c2a5cc66e4d212d7f11bd4284c72 (diff)
downloaddeluge-491f4a44385a4fca481c2ac338fca4aba1d00dd3.tar.gz
deluge-491f4a44385a4fca481c2ac338fca4aba1d00dd3.tar.bz2
deluge-491f4a44385a4fca481c2ac338fca4aba1d00dd3.zip
move the classes in deluge-ext to ext-extensions and remove deluge-ext
Diffstat (limited to 'deluge/ui/web/js/ext-extensions-debug.js')
-rw-r--r--deluge/ui/web/js/ext-extensions-debug.js277
1 files changed, 275 insertions, 2 deletions
diff --git a/deluge/ui/web/js/ext-extensions-debug.js b/deluge/ui/web/js/ext-extensions-debug.js
index 6f0dece7a..b9b0eda1f 100644
--- a/deluge/ui/web/js/ext-extensions-debug.js
+++ b/deluge/ui/web/js/ext-extensions-debug.js
@@ -458,7 +458,6 @@ Ext.extend(Ext.ux.form.Spinner.DateStrategy, Ext.ux.form.Spinner.Strategy, {
});
-
/***
* Concrete Strategy: Time
*/
@@ -472,4 +471,278 @@ Ext.extend(Ext.ux.form.Spinner.TimeStrategy, Ext.ux.form.Spinner.DateStrategy, {
incrementConstant : Date.MINUTE,
alternateIncrementValue : 1,
alternateIncrementConstant : Date.HOUR
-}); \ No newline at end of file
+});
+
+Ext.tree.ColumnTree = Ext.extend(Ext.tree.TreePanel, {
+ lines:false,
+ borderWidth: Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
+ cls:'x-column-tree',
+
+ onRender : function(){
+ Ext.tree.ColumnTree.superclass.onRender.apply(this, arguments);
+ this.headers = this.body.createChild(
+ {cls:'x-tree-headers'},this.innerCt.dom);
+
+ var cols = this.columns, c;
+ var totalWidth = 0;
+
+ for(var i = 0, len = cols.length; i < len; i++){
+ c = cols[i];
+ totalWidth += c.width;
+ this.headers.createChild({
+ cls:'x-tree-hd ' + (c.cls?c.cls+'-hd':''),
+ cn: {
+ cls:'x-tree-hd-text',
+ html: c.header
+ },
+ style:'width:'+(c.width-this.borderWidth)+'px;'
+ });
+ }
+ this.headers.createChild({cls:'x-clear'});
+ // prevent floats from wrapping when clipped
+ this.headers.setWidth(totalWidth);
+ this.innerCt.setWidth(totalWidth);
+ }
+});
+
+Ext.tree.ColumnTreeNode = Ext.extend(Ext.tree.TreeNode, {
+
+ setColumnValue: function(index, value) {
+ var t = this.getOwnerTree();
+ var oldValue = this[t.columns[index].dataIndex];
+ this[t.columns[index].dataIndex] = value;
+ this.attributes[[t.columns[index].dataIndex]] = value;
+ if (this.rendered) {
+ this.ui.onColumnValueChange(this, index, value, oldValue);
+ }
+ this.fireEvent('columnvaluechange', this, index, value, oldValue);
+ }
+});
+
+Ext.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
+ focus: Ext.emptyFn, // prevent odd scrolling behavior
+
+ onColumnValueChange: function(n, colIndex, value, oldValue) {
+ if (this.rendered) {
+ var c = n.getOwnerTree().columns[colIndex];
+ this.columnNodes[colIndex].innerHTML = (c.renderer ? c.renderer(value, n, null) : value);
+ }
+ },
+
+ renderElements : function(n, a, targetNode, bulkRender){
+ this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
+
+ var t = n.getOwnerTree();
+ var cols = t.columns;
+ var bw = t.borderWidth;
+ var c = cols[0];
+
+ var cb = typeof a.checked == 'boolean';
+ var href = a.href ? a.href : Ext.isGecko ? "" : "#";
+
+ var buf = [
+ '<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',
+ '<div class="x-tree-col" style="width:',c.width-bw,'px;">',
+ '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
+ '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow">',
+ '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',
+ cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
+ '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
+ a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '>',
+ '<span unselectable="on">', n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</span></a>",
+ "</div>"];
+ for(var i = 1, len = cols.length; i < len; i++){
+ c = cols[i];
+
+ buf.push('<div class="x-tree-col ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">',
+ '<div class="x-tree-col-text">',(c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</div>",
+ "</div>");
+ }
+ buf.push(
+ '<div class="x-clear"></div></div>',
+ '<ul class="x-tree-node-ct" style="display:none;"></ul>',
+ "</li>");
+
+ if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
+ this.wrap = Ext.DomHelper.insertHtml("beforeBegin",
+ n.nextSibling.ui.getEl(), buf.join(""));
+ }else{
+ this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
+ }
+
+ this.elNode = this.wrap.childNodes[0];
+ this.ctNode = this.wrap.childNodes[1];
+ var cs = this.elNode.firstChild.childNodes;
+ this.indentNode = cs[0];
+ this.ecNode = cs[1];
+ this.iconNode = cs[2];
+ var index = 3;
+ if(cb){
+ this.checkbox = cs[3];
+ // fix for IE6
+ this.checkbox.defaultChecked = this.checkbox.checked;
+ index++;
+ }
+ this.anchor = cs[index];
+ this.columnNodes = [cs[index].firstChild];
+ for(var i = 1, len = cols.length; i < len; i++){
+ this.columnNodes[i] = this.elNode.childNodes[i].firstChild;
+ }
+ }
+});
+
+Ext.form.FileUploadField = Ext.extend(Ext.form.TextField, {
+ /**
+ * @cfg {String} buttonText The button text to display on the upload button (defaults to
+ * 'Browse...'). Note that if you supply a value for {@link #buttonCfg}, the buttonCfg.text
+ * value will be used instead if available.
+ */
+ buttonText: 'Browse...',
+ /**
+ * @cfg {Boolean} buttonOnly True to display the file upload field as a button with no visible
+ * text field (defaults to false). If true, all inherited TextField members will still be available.
+ */
+ buttonOnly: false,
+ /**
+ * @cfg {Number} buttonOffset The number of pixels of space reserved between the button and the text field
+ * (defaults to 3). Note that this only applies if {@link #buttonOnly} = false.
+ */
+ buttonOffset: 3,
+ /**
+ * @cfg {Object} buttonCfg A standard {@link Ext.Button} config object.
+ */
+
+ // private
+ readOnly: true,
+
+ /**
+ * @hide
+ * @method autoSize
+ */
+ autoSize: Ext.emptyFn,
+
+ // private
+ initComponent: function(){
+ Ext.form.FileUploadField.superclass.initComponent.call(this);
+
+ this.addEvents(
+ /**
+ * @event fileselected
+ * Fires when the underlying file input field's value has changed from the user
+ * selecting a new file from the system file selection dialog.
+ * @param {Ext.form.FileUploadField} this
+ * @param {String} value The file value returned by the underlying file input field
+ */
+ 'fileselected'
+ );
+ },
+
+ // private
+ onRender : function(ct, position){
+ Ext.form.FileUploadField.superclass.onRender.call(this, ct, position);
+
+ this.wrap = this.el.wrap({cls:'x-form-field-wrap x-form-file-wrap'});
+ this.el.addClass('x-form-file-text');
+ this.el.dom.removeAttribute('name');
+
+ this.fileInput = this.wrap.createChild({
+ id: this.getFileInputId(),
+ name: this.name||this.getId(),
+ cls: 'x-form-file',
+ tag: 'input',
+ type: 'file',
+ size: 1
+ });
+
+ var btnCfg = Ext.applyIf(this.buttonCfg || {}, {
+ text: this.buttonText
+ });
+ this.button = new Ext.Button(Ext.apply(btnCfg, {
+ renderTo: this.wrap
+ }));
+
+ if(this.buttonOnly){
+ this.el.hide();
+ this.wrap.setWidth(this.button.getEl().getWidth());
+ }
+
+ this.fileInput.on('change', function(){
+ var v = this.fileInput.dom.value;
+ this.setValue(v);
+ this.fireEvent('fileselected', this, v);
+ }, this);
+ },
+
+ // private
+ getFileInputId: function(){
+ return this.id+'-file';
+ },
+
+ // private
+ onResize : function(w, h){
+ Ext.form.FileUploadField.superclass.onResize.call(this, w, h);
+
+ this.wrap.setWidth(w);
+
+ if(!this.buttonOnly){
+ var w = this.wrap.getWidth() - this.button.getEl().getWidth() - this.buttonOffset;
+ this.el.setWidth(w);
+ }
+ },
+
+ // private
+ preFocus : Ext.emptyFn,
+
+ // private
+ getResizeEl : function(){
+ return this.wrap;
+ },
+
+ // private
+ getPositionEl : function(){
+ return this.wrap;
+ },
+
+ // private
+ alignErrorIcon : function(){
+ this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
+ }
+
+});
+Ext.reg('fileuploadfield', Ext.form.FileUploadField);
+
+/**
+ * Ext.ux.FullProgressBar Class
+ *
+ * @author Damien Churchill <damoxc@gmail.com>
+ * @version 1.2
+ *
+ * @class Ext.deluge.ProgressBar
+ * @extends Ext.ProgressBar
+ * @constructor
+ * @param {Object} config Configuration options
+ */
+Ext.ux.FullProgressBar = Ext.extend(Ext.ProgressBar, {
+ initComponent: function() {
+ Ext.ux.FullProgressBar.superclass.initComponent.call(this);
+ },
+
+ updateProgress: function(value, text, animate) {
+ this.value = value || 0;
+ if (text) {
+ this.updateText(text);
+ }
+
+ if (this.rendered) {
+ var w = Math.floor(value*this.el.dom.firstChild.offsetWidth / 100.0);
+ this.progressBar.setWidth(w, animate === true || (animate !== false && this.animate));
+ if (this.textTopEl) {
+ //textTopEl should be the same width as the bar so overflow will clip as the bar moves
+ this.textTopEl.removeClass('x-hidden').setWidth(w);
+ }
+ }
+ this.fireEvent('update', this, value, text);
+ return this;
+ }
+});
+Ext.reg('fullprogressbar', Ext.ux.FullProgressBar); \ No newline at end of file