Changeset dd1716
- Timestamp:
- 04/19/2010 02:35:33 PM (15 years ago)
- Branches:
- 2.0.x, develop, extjs4-port, master
- Children:
- 76483b
- Parents:
- c176ff
- git-author:
- Damien Churchill <damoxc@gmail.com> (04/19/2010 12:59:21 PM)
- git-committer:
- Damien Churchill <damoxc@gmail.com> (04/19/2010 02:35:33 PM)
- Location:
- deluge/ui/web/js/deluge-all/add
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/ui/web/js/deluge-all/add/FilesTab.js
rc176ff rdd1716 66 66 tpl: new Ext.XTemplate('{download:this.format}', { 67 67 format: function(v) { 68 return '<div class="x-grid3-check-col'+(v?'-on':'')+'"> </div>';68 return '<div rel="chkbox" class="x-grid3-check-col'+(v?'-on':'')+'"> </div>'; 69 69 } 70 70 }) … … 85 85 }, 86 86 87 onNodeClick: function(node, e) { 88 node.attributes.download = !node.attributes.download; 89 var newNode = new Ext.tree.TreeNode(node.attributes); 90 node.parentNode.replaceChild(newNode, node); 91 this.fireEvent('filechecked', newNode, node.attributes.download, !node.attributes.download); 87 setDownload: function(node, value) { 88 node.attributes.download = value; 89 node.ui.updateColumns(); 90 91 if (node.isLeaf()) { 92 return this.fireEvent('filechecked', node, value, !value); 93 } else { 94 node.cascade(function(n) { 95 n.attributes.download = value; 96 n.ui.updateColumns(); 97 return this.fireEvent('filechecked', n, value, !value); 98 }, this); 99 } 92 100 }, 93 101 94 onFolderCheck: function(node, checked) { 95 var priorities = this.optionsManager.get('file_priorities'); 96 node.cascade(function(child) { 97 if (!child.ui.checkbox) { 98 child.attributes.checked = checked; 99 } else { 100 child.ui.checkbox.checked = checked; 101 } 102 priorities[child.attributes.fileindex] = checked; 103 }, this); 104 this.optionsManager.setDefault('file_priorities', priorities); 102 onNodeClick: function(node, e) { 103 var el = new Ext.Element(e.target); 104 if (el.getAttribute('rel') == 'chkbox') { 105 this.setDownload(node, !node.attributes.download); 106 } 105 107 } 106 108 }); -
deluge/ui/web/js/deluge-all/add/OptionsPanel.js
rc176ff rdd1716 98 98 99 99 this.walkFileTree(this.torrents[torrentId]['files_tree'], function(filename, type, entry, parentNode) { 100 if (type == 'dir') { 101 var folder = new Ext.tree.TreeNode({ 102 filename: filename, 103 size: entry.length, 104 download: true 105 }); 106 folder.on('checkchange', this.onFolderCheck, this); 107 parentNode.appendChild(folder); 108 return folder; 109 } else { 110 var node = new Ext.tree.TreeNode({ 111 filename: filename, 112 fileindex: entry.index, 113 size: entry.length, 114 leaf: true, 115 download: priorities[entry.index], 116 uiProvider: Ext.tree.ColumnNodeUI 117 }); 118 node.on('checkchange', this.onNodeCheck, this); 119 parentNode.appendChild(node); 120 } 100 var node = new Ext.tree.TreeNode({ 101 download: (entry.index) ? priorities[entry.index] : true, 102 filename: filename, 103 fileindex: entry.index, 104 leaf: type != 'dir', 105 size: entry.length 106 }); 107 parentNode.appendChild(node); 108 if (type == 'dir') return node; 121 109 }, this, root); 122 110 root.firstChild.expand(); … … 139 127 140 128 onFileChecked: function(node, newValue, oldValue) { 129 if (!Ext.isNumber(node.attributes.fileindex)) return; 130 131 // if (this.form.optionsManager.get('compact_allocation')) { 132 // Ext.Msg.show({ 133 // title: _('Unable to set file priority!'), 134 // msg: _('File prioritization is unavailable when using Compact allocation. Would you like to switch to Full allocation?'), 135 // buttons: Ext.Msg.YESNO, 136 // fn: function(result) { 137 // if (result == 'yes') { 138 // var priorities = this.form.optionsManager.get('file_priorities'); 139 // priorities[node.attributes.fileindex] = (result) ? newValue : oldValue; 140 // this.form.optionsManager.update('file_priorities', priorities); 141 // } else { 142 // node.attributes.download = oldValue; 143 // node.ui.updateColumns(); 144 // } 145 // }, 146 // scope: this, 147 // icon: Ext.MessageBox.QUESTION 148 // }); 149 // } else { 150 // var priorities = this.form.optionsManager.get('file_priorities'); 151 // priorities[node.attributes.fileindex] = newValue; 152 // this.form.optionsManager.update('file_priorities', priorities); 153 // } 141 154 var priorities = this.form.optionsManager.get('file_priorities'); 142 155 priorities[node.attributes.fileindex] = newValue;
Note:
See TracChangeset
for help on using the changeset viewer.