Author: damoxc

Revision: 4943

Log:
        display the torrents files in the files tab

Diff:
Modified: trunk/deluge/ui/web/js/deluge-details.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-details.js    2009-03-30 22:15:13 UTC (rev 
4942)
+++ trunk/deluge/ui/web/js/deluge-details.js    2009-03-30 22:25:16 UTC (rev 
4943)
@@ -203,12 +203,47 @@
                this.panel.update = this.update.bind(this);
        },
        
+       onRequestComplete: function(files) {
+               function walk(files, parent) {
+                       $each(files, function(item, file) {
+                               var child = parent.findChild('id', file);
+                               if ($type(item) == 'object') {
+                                       if (!child) {
+                                               child = new Ext.tree.TreeNode({
+                                                       id: file,
+                                                       text: file
+                                               });
+                                               parent.appendChild(child);
+                                       }
+                                       walk(item, child);
+                               } else {
+                                       if (!child) {
+                                               child = new Ext.tree.TreeNode({
+                                                       id: file,
+                                                       filename: file,
+                                                       size: fsize(item[0]),
+                                                       progress: item[1],
+                                                       leaf: true,
+                                                       iconCls: 
'x-deluge-file',
+                                                       uiProvider: 
Ext.tree.ColumnNodeUI
+                                               });
+                                               parent.appendChild(child);
+                                       }
+                               }
+                       });
+               }
+               var root = this.panel.getRootNode();
+               walk(files, root);
+       },
+       
        clear: function() {
                
        },
        
        update: function(torrentId) {
-               
+               Deluge.Client.web.get_torrent_files(torrentId, {
+                       onSuccess: this.onRequestComplete.bindWithEvent(this, 
torrentId)
+               });
        }
 }
 
@@ -318,15 +353,10 @@
                        dataIndex: 'priority'
                }],
                
-               loader: new Deluge.FilesTreeLoader({
-                       uiProviders: {
-                               'col': Ext.tree.ColumnNodeUI
-                       }
-               }),
-               
-               root: new Ext.tree.AsyncTreeNode({
-            text:'Tasks'
-        })
+               root: new Ext.tree.TreeNode({
+            text: 'Files'
+        }),
+               listeners: {'render': {fn: Deluge.Details.Files.onRender, 
scope: Deluge.Details.Files}}
        }), new Ext.grid.GridPanel({
                id: 'peers',
                title: _('Peers'),



--~--~---------~--~----~------------~-------~--~----~
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