Author: damoxc

Revision: 6133

Log:
        partially working files tab added back in

Diff:
Modified: trunk/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js   2010-01-24 
03:29:44 UTC (rev 6132)
+++ trunk/deluge/ui/web/js/deluge-all/Deluge.Details.Files.js   2010-01-24 
04:06:06 UTC (rev 6133)
@@ -40,7 +40,7 @@
                return String.format('<div class="{0}">{1}</div>', 
FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value]));
        }
        
-       Ext.deluge.details.FilesTab = Ext.extend(Ext.tree.ColumnTree, {
+       Ext.deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
                
                constructor: function(config) {
                        config = Ext.apply({
@@ -54,16 +54,19 @@
                                        width: 330,
                                        dataIndex: 'filename'
                                }, {
+                                       xtype: 'tgcustomcolumn',
                                        header: _('Size'),
                                        width: 150,
                                        dataIndex: 'size',
                                        renderer: fsize
                                }, {
+                                       xtype: 'tgcustomcolumn',
                                        header: _('Progress'),
                                        width: 150,
                                        dataIndex: 'progress',
                                        renderer: fileProgressRenderer
                                }, {
+                                       xtype: 'tgcustomcolumn',
                                        header: _('Priority'),
                                        width: 150,
                                        dataIndex: 'priority',
@@ -74,8 +77,14 @@
                                        text: 'Files'
                                })
                        }, config);
+
                        
Ext.deluge.details.FilesTab.superclass.constructor.call(this, config);
                },
+
+               initComponent: function() {
+                       
+                       
Ext.deluge.details.FilesTab.superclass.initComponent.call(this);
+               },
                
                onRender: function(ct, position) {
                        
Ext.deluge.details.FilesTab.superclass.onRender.call(this, ct, position);
@@ -173,14 +182,15 @@
                                                if (!child) {
                                                        child = new 
Ext.tree.TreeNode({
                                                                id: file,
-                                                               text: file
+                                                               text: file,
+                                                               filename: file
                                                        });
                                                        
parent.appendChild(child);
                                                }
                                                walk(item, child);
                                        } else {
                                                if (!child) {
-                                                       child = new 
Ext.tree.ColumnTreeNode({
+                                                       child = new 
Ext.tree.TreeNode({
                                                                id: file,
                                                                filename: file,
                                                                text: file, // 
this needs to be here for sorting
@@ -190,13 +200,10 @@
                                                                priority: 
item[3],
                                                                leaf: true,
                                                                iconCls: 
'x-deluge-file',
-                                                               uiProvider: 
Ext.tree.ColumnNodeUI
+                                                               uiProvider: 
Ext.ux.tree.TreeGridNodeUI
                                                        });
                                                        
parent.appendChild(child);
                                                }
-                                               child.setColumnValue(1, 
item[1]);
-                                               child.setColumnValue(2, 
item[2]);
-                                               child.setColumnValue(3, 
item[3]);
                                        }
                                }
                        }

Modified: trunk/deluge/ui/web/js/deluge-all/Deluge.Formatters.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-all/Deluge.Formatters.js      2010-01-24 
03:29:44 UTC (rev 6132)
+++ trunk/deluge/ui/web/js/deluge-all/Deluge.Formatters.js      2010-01-24 
04:06:06 UTC (rev 6133)
@@ -64,6 +64,7 @@
         * @returns {string} formatted string with KiB, MiB or GiB units.
         */
        size: function(bytes) {
+               if (!bytes) return '';
                bytes = bytes / 1024.0;
        
                if (bytes < 1024) { return bytes.toFixed(1)  + ' KiB'; }

Modified: trunk/deluge/ui/web/js/ext-extensions/.build
===================================================================
--- trunk/deluge/ui/web/js/ext-extensions/.build        2010-01-24 03:29:44 UTC 
(rev 6132)
+++ trunk/deluge/ui/web/js/ext-extensions/.build        2010-01-24 04:06:06 UTC 
(rev 6133)
@@ -12,4 +12,5 @@
 add_file "TreeGridNodeUI.js"
 add_file "TreeGridLoader.js"
 add_file "TreeGridColumns.js"
+add_file "TreeGridCustomColumn.js"
 add_file "TreeGrid.js"

Added: trunk/deluge/ui/web/js/ext-extensions/TreeGridCustomColumn.js
===================================================================
--- trunk/deluge/ui/web/js/ext-extensions/TreeGridCustomColumn.js               
                (rev 0)
+++ trunk/deluge/ui/web/js/ext-extensions/TreeGridCustomColumn.js       
2010-01-24 04:06:06 UTC (rev 6133)
@@ -0,0 +1,9 @@
+Ext.tree.CustomColumn = Ext.extend(Ext.tree.Column, {
+       
+       constructor: function(c) {
+               c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + 
':this.format}');
+               c.tpl.format = c.renderer;
+               Ext.tree.CustomColumn.superclass.constructor.call(this, c);
+       }
+});
+Ext.reg('tgcustomcolumn', Ext.tree.CustomColumn);

Modified: trunk/deluge/ui/web/server.py
===================================================================
--- trunk/deluge/ui/web/server.py       2010-01-24 03:29:44 UTC (rev 6132)
+++ trunk/deluge/ui/web/server.py       2010-01-24 04:06:06 UTC (rev 6133)
@@ -331,6 +331,7 @@
         "/js/ext-extensions/TreeGridNodeUI.js",
         "/js/ext-extensions/TreeGridLoader.js",
         "/js/ext-extensions/TreeGridColumns.js",
+        "/js/ext-extensions/TreeGridCustomColumn.js",
         "/js/ext-extensions/TreeGrid.js",
         "/config.js",
         "/gettext.js",


-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to