Author: damoxc

Revision: 5878

Log:
        fix a couple of bugs in the M.O.M and fix the options tab and file 
priorities in the torrent add window (success!)

Diff:
Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.Add.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.Add.js      2009-10-27 09:12:22 UTC 
(rev 5877)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.Add.js      2009-10-27 10:25:16 UTC 
(rev 5878)
@@ -85,7 +85,7 @@
             bodyStyle: 'padding: 5px;',
             border: false,
             height: 170,
-            disabled: true
+            //disabled: true
         });
     
         var fieldset = this.form.add({
@@ -198,8 +198,6 @@
         form.layout = new Ext.layout.FormLayout();
         form.layout.setContainer(form);
         form.doLayout();
-
-        this.optionsManager.changeId(null);
     },
 
     addTorrent: function(torrent) {
@@ -215,9 +213,9 @@
             priorities[index] = fileIndexes[index];
         });
         
-        var oldId = this.optionsManager.changeId(torrent['info_hash'], false);
-        this.optionsManager.set('file_priorities', priorities);
-        this.optionsManager.changeId(oldId, false);
+        var oldId = this.optionsManager.changeId(torrent['info_hash'], true);
+        this.optionsManager.setDefault('file_priorities', priorities);
+        this.optionsManager.changeId(oldId, true);
     },
 
     clear: function() {
@@ -263,9 +261,9 @@
     },
 
     getOptions: function(torrentId) {
-        var oldId = this.optionsManager.changeId(torrentId, false);
+        var oldId = this.optionsManager.changeId(torrentId, true);
         var options = this.optionsManager.get();
-        this.optionsManager.changeId(oldTorrentId, false);
+        this.optionsManager.changeId(oldId, true);
         Ext.each(options['file_priorities'], function(priority, index) {
             options['file_priorities'][index] = (priority) ? 1 : 0;
         });
@@ -334,7 +332,7 @@
             }
             priorities[child.attributes.fileindex] = checked;
         }, this);
-        this.optionsManager.update('file_priorities', priorities);
+        this.optionsManager.setDefault('file_priorities', priorities);
     },
 
     onNodeCheck: function(node, checked) {

Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.MultiOptionsManager.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.MultiOptionsManager.js      
2009-10-27 09:12:22 UTC (rev 5877)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.MultiOptionsManager.js      
2009-10-27 10:25:16 UTC (rev 5878)
@@ -48,10 +48,10 @@
         * Changes bound fields to use the specified id.
         * @param {String} id
         */
-       changeId: function(id, updateBinds) {
+       changeId: function(id, dontUpdateBinds) {
                var oldId = this.currentId;
                this.currentId = id;
-               if (updateBinds) {
+               if (!dontUpdateBinds) {
                        for (var option in this.options) {
                                if (!this.binds[option]) continue;
                                Ext.each(this.binds[option], function(bind) {
@@ -80,10 +80,15 @@
                if (arguments.length == 1) {
                        var option = arguments[0];
                        return (this.isDirty(option)) ? 
this.changed[this.currentId][option] : this.getDefault(option);
+               } else if (arguments.length == 0) {
+                       var options = {};
+                       for (var option in this.options) {
+                           options[option] = (this.isDirty(option)) ? 
this.changed[this.currentId][option] : this.getDefault(option);
+                       }
+                       return options;
                } else {
                        var options = {};
                        Ext.each(arguments, function(option) {
-                               if (!this.has(option)) return;
                                options[option] = (this.isDirty(option)) ? 
this.changed[this.currentId][option] : this.getDefault(option);
                        }, this);
                        return options;

Modified: trunk/deluge/ui/web/js/Deluge.Add.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Add.js        2009-10-27 09:12:22 UTC (rev 
5877)
+++ trunk/deluge/ui/web/js/Deluge.Add.js        2009-10-27 10:25:16 UTC (rev 
5878)
@@ -85,7 +85,7 @@
             bodyStyle: 'padding: 5px;',
             border: false,
             height: 170,
-            disabled: true
+            //disabled: true
         });
     
         var fieldset = this.form.add({
@@ -198,8 +198,6 @@
         form.layout = new Ext.layout.FormLayout();
         form.layout.setContainer(form);
         form.doLayout();
-
-        this.optionsManager.changeId(null);
     },
 
     addTorrent: function(torrent) {
@@ -215,9 +213,9 @@
             priorities[index] = fileIndexes[index];
         });
         
-        var oldId = this.optionsManager.changeId(torrent['info_hash'], false);
-        this.optionsManager.set('file_priorities', priorities);
-        this.optionsManager.changeId(oldId, false);
+        var oldId = this.optionsManager.changeId(torrent['info_hash'], true);
+        this.optionsManager.setDefault('file_priorities', priorities);
+        this.optionsManager.changeId(oldId, true);
     },
 
     clear: function() {
@@ -263,9 +261,9 @@
     },
 
     getOptions: function(torrentId) {
-        var oldId = this.optionsManager.changeId(torrentId, false);
+        var oldId = this.optionsManager.changeId(torrentId, true);
         var options = this.optionsManager.get();
-        this.optionsManager.changeId(oldTorrentId, false);
+        this.optionsManager.changeId(oldId, true);
         Ext.each(options['file_priorities'], function(priority, index) {
             options['file_priorities'][index] = (priority) ? 1 : 0;
         });
@@ -334,7 +332,7 @@
             }
             priorities[child.attributes.fileindex] = checked;
         }, this);
-        this.optionsManager.update('file_priorities', priorities);
+        this.optionsManager.setDefault('file_priorities', priorities);
     },
 
     onNodeCheck: function(node, checked) {

Modified: trunk/deluge/ui/web/js/Deluge.MultiOptionsManager.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.MultiOptionsManager.js        2009-10-27 
09:12:22 UTC (rev 5877)
+++ trunk/deluge/ui/web/js/Deluge.MultiOptionsManager.js        2009-10-27 
10:25:16 UTC (rev 5878)
@@ -48,10 +48,10 @@
         * Changes bound fields to use the specified id.
         * @param {String} id
         */
-       changeId: function(id, updateBinds) {
+       changeId: function(id, dontUpdateBinds) {
                var oldId = this.currentId;
                this.currentId = id;
-               if (updateBinds) {
+               if (!dontUpdateBinds) {
                        for (var option in this.options) {
                                if (!this.binds[option]) continue;
                                Ext.each(this.binds[option], function(bind) {
@@ -80,10 +80,15 @@
                if (arguments.length == 1) {
                        var option = arguments[0];
                        return (this.isDirty(option)) ? 
this.changed[this.currentId][option] : this.getDefault(option);
+               } else if (arguments.length == 0) {
+                       var options = {};
+                       for (var option in this.options) {
+                           options[option] = (this.isDirty(option)) ? 
this.changed[this.currentId][option] : this.getDefault(option);
+                       }
+                       return options;
                } else {
                        var options = {};
                        Ext.each(arguments, function(option) {
-                               if (!this.has(option)) return;
                                options[option] = (this.isDirty(option)) ? 
this.changed[this.currentId][option] : this.getDefault(option);
                        }, this);
                        return options;



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