Author: damoxc
Revision: 5879
Log:
create a simple html escape method and escape the fields in the details
tab
Diff:
Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.Details.Details.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.Details.Details.js 2009-10-27
10:25:16 UTC (rev 5878)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.Details.Details.js 2009-10-27
10:26:59 UTC (rev 5879)
@@ -33,56 +33,57 @@
*/
Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
- title: _('Details'),
- bodyStyle: 'padding 5px',
-
- onRender: function(ct, position) {
- Ext.deluge.details.DetailsTab.superclass.onRender.call(this,
ct, position);
- this.load({
- url: '/render/tab_details.html',
- text: _('Loading') + '...'
- });
- this.body.setStyle('padding', '5px');
- this.getUpdater().on('update', this.onPanelUpdate, this);
- },
-
- clear: function() {
- if (!this.fields) return;
- for (var k in this.fields) {
- this.fields[k].innerHTML = '';
- }
- },
-
- update: function(torrentId) {
- Deluge.Client.core.get_torrent_status(torrentId,
Deluge.Keys.Details, {
- success: this.onRequestComplete,
- scope: this,
- torrentId: torrentId
- });
- },
-
- onPanelUpdate: function(el, response) {
- this.fields = {};
- Ext.each(Ext.query('dd', this.body.dom), function(field) {
- this.fields[field.className] = field;
- }, this);
- },
-
- onRequestComplete: function(torrent, options) {
- var data = {
- torrent_name: torrent.name,
- hash: options.torrentId,
- path: torrent.save_path,
- size: fsize(torrent.total_size),
- files: torrent.num_files,
- status: torrent.tracker_status,
- tracker: torrent.tracker,
- comment: torrent.comment
- };
-
- for (var field in this.fields) {
- this.fields[field].innerHTML = data[field];
- }
+ title: _('Details'),
+ bodyStyle: 'padding 5px',
+
+ onRender: function(ct, position) {
+ Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct,
position);
+ this.load({
+ url: '/render/tab_details.html',
+ text: _('Loading') + '...'
+ });
+ this.body.setStyle('padding', '5px');
+ this.getUpdater().on('update', this.onPanelUpdate, this);
+ },
+
+ clear: function() {
+ if (!this.fields) return;
+ for (var k in this.fields) {
+ this.fields[k].innerHTML = '';
}
+ },
+
+ update: function(torrentId) {
+ Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, {
+ success: this.onRequestComplete,
+ scope: this,
+ torrentId: torrentId
+ });
+ },
+
+ onPanelUpdate: function(el, response) {
+ this.fields = {};
+ Ext.each(Ext.query('dd', this.body.dom), function(field) {
+ this.fields[field.className] = field;
+ }, this);
+ },
+
+ onRequestComplete: function(torrent, options) {
+ var data = {
+ torrent_name: torrent.name,
+ hash: options.torrentId,
+ path: torrent.save_path,
+ size: fsize(torrent.total_size),
+ files: torrent.num_files,
+ status: torrent.tracker_status,
+ tracker: torrent.tracker,
+ comment: torrent.comment
+ };
+
+ for (var field in this.fields) {
+ //this.fields[field].innerHTML = Ext.escapeHTML(data[field]);
+ this.fields[field].innerHTML = data[field];
+ }
+ }
});
Deluge.Details.add(new Ext.deluge.details.DetailsTab());
\ No newline at end of file
Modified: branches/1.2_RC/deluge/ui/web/js/Deluge.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/Deluge.js 2009-10-27 10:25:16 UTC (rev
5878)
+++ branches/1.2_RC/deluge/ui/web/js/Deluge.js 2009-10-27 10:26:59 UTC (rev
5879)
@@ -38,39 +38,44 @@
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
(function() {
- /* Add some helper functions to Ext */
- Ext.apply(Function.prototype, {
- bind: function(scope) {
- var self = this;
- return function() {
- return self.apply(scope, arguments);
- }
- }
- });
+ /* Add some helper functions to Ext */
+ Ext.apply(Function.prototype, {
+ bind: function(scope) {
+ var self = this;
+ return function() {
+ return self.apply(scope, arguments);
+ }
+ }
+ });
+
+ Ext.apply(Ext, {
+ escapeHTML: function(text) {
+ text = String(text);
+ return text.replace('&', '&');
+ },
- Ext.apply(Ext, {
- isObjectEmpty: function(obj) {
- for(var i in obj) { return false; }
- return true;
- },
-
- keys: function(obj) {
- var keys = [];
- for (i in obj) if (obj.hasOwnProperty(i))
- {
- keys.push(i);
- }
- return keys;
- },
-
- splat: function(obj) {
- var type = Ext.type(obj);
- return (type) ? ((type != 'array') ? [obj] : obj) : [];
- }
- });
- Ext.getKeys = Ext.keys;
-
- Ext.BLANK_IMAGE_URL = '/images/s.gif';
+ isObjectEmpty: function(obj) {
+ for(var i in obj) { return false; }
+ return true;
+ },
+
+ keys: function(obj) {
+ var keys = [];
+ for (i in obj) if (obj.hasOwnProperty(i))
+ {
+ keys.push(i);
+ }
+ return keys;
+ },
+
+ splat: function(obj) {
+ var type = Ext.type(obj);
+ return (type) ? ((type != 'array') ? [obj] : obj) : [];
+ }
+ });
+ Ext.getKeys = Ext.keys;
+
+ Ext.BLANK_IMAGE_URL = '/images/s.gif';
})();
(function() {
Modified: trunk/deluge/ui/web/js/Deluge.Details.Details.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.Details.Details.js 2009-10-27 10:25:16 UTC
(rev 5878)
+++ trunk/deluge/ui/web/js/Deluge.Details.Details.js 2009-10-27 10:26:59 UTC
(rev 5879)
@@ -33,56 +33,57 @@
*/
Ext.deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
- title: _('Details'),
- bodyStyle: 'padding 5px',
-
- onRender: function(ct, position) {
- Ext.deluge.details.DetailsTab.superclass.onRender.call(this,
ct, position);
- this.load({
- url: '/render/tab_details.html',
- text: _('Loading') + '...'
- });
- this.body.setStyle('padding', '5px');
- this.getUpdater().on('update', this.onPanelUpdate, this);
- },
-
- clear: function() {
- if (!this.fields) return;
- for (var k in this.fields) {
- this.fields[k].innerHTML = '';
- }
- },
-
- update: function(torrentId) {
- Deluge.Client.core.get_torrent_status(torrentId,
Deluge.Keys.Details, {
- success: this.onRequestComplete,
- scope: this,
- torrentId: torrentId
- });
- },
-
- onPanelUpdate: function(el, response) {
- this.fields = {};
- Ext.each(Ext.query('dd', this.body.dom), function(field) {
- this.fields[field.className] = field;
- }, this);
- },
-
- onRequestComplete: function(torrent, options) {
- var data = {
- torrent_name: torrent.name,
- hash: options.torrentId,
- path: torrent.save_path,
- size: fsize(torrent.total_size),
- files: torrent.num_files,
- status: torrent.tracker_status,
- tracker: torrent.tracker,
- comment: torrent.comment
- };
-
- for (var field in this.fields) {
- this.fields[field].innerHTML = data[field];
- }
+ title: _('Details'),
+ bodyStyle: 'padding 5px',
+
+ onRender: function(ct, position) {
+ Ext.deluge.details.DetailsTab.superclass.onRender.call(this, ct,
position);
+ this.load({
+ url: '/render/tab_details.html',
+ text: _('Loading') + '...'
+ });
+ this.body.setStyle('padding', '5px');
+ this.getUpdater().on('update', this.onPanelUpdate, this);
+ },
+
+ clear: function() {
+ if (!this.fields) return;
+ for (var k in this.fields) {
+ this.fields[k].innerHTML = '';
}
+ },
+
+ update: function(torrentId) {
+ Deluge.Client.core.get_torrent_status(torrentId, Deluge.Keys.Details, {
+ success: this.onRequestComplete,
+ scope: this,
+ torrentId: torrentId
+ });
+ },
+
+ onPanelUpdate: function(el, response) {
+ this.fields = {};
+ Ext.each(Ext.query('dd', this.body.dom), function(field) {
+ this.fields[field.className] = field;
+ }, this);
+ },
+
+ onRequestComplete: function(torrent, options) {
+ var data = {
+ torrent_name: torrent.name,
+ hash: options.torrentId,
+ path: torrent.save_path,
+ size: fsize(torrent.total_size),
+ files: torrent.num_files,
+ status: torrent.tracker_status,
+ tracker: torrent.tracker,
+ comment: torrent.comment
+ };
+
+ for (var field in this.fields) {
+ //this.fields[field].innerHTML = Ext.escapeHTML(data[field]);
+ this.fields[field].innerHTML = data[field];
+ }
+ }
});
Deluge.Details.add(new Ext.deluge.details.DetailsTab());
\ No newline at end of file
Modified: trunk/deluge/ui/web/js/Deluge.js
===================================================================
--- trunk/deluge/ui/web/js/Deluge.js 2009-10-27 10:25:16 UTC (rev 5878)
+++ trunk/deluge/ui/web/js/Deluge.js 2009-10-27 10:26:59 UTC (rev 5879)
@@ -38,39 +38,44 @@
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
(function() {
- /* Add some helper functions to Ext */
- Ext.apply(Function.prototype, {
- bind: function(scope) {
- var self = this;
- return function() {
- return self.apply(scope, arguments);
- }
- }
- });
+ /* Add some helper functions to Ext */
+ Ext.apply(Function.prototype, {
+ bind: function(scope) {
+ var self = this;
+ return function() {
+ return self.apply(scope, arguments);
+ }
+ }
+ });
+
+ Ext.apply(Ext, {
+ escapeHTML: function(text) {
+ text = String(text);
+ return text.replace('&', '&');
+ },
- Ext.apply(Ext, {
- isObjectEmpty: function(obj) {
- for(var i in obj) { return false; }
- return true;
- },
-
- keys: function(obj) {
- var keys = [];
- for (i in obj) if (obj.hasOwnProperty(i))
- {
- keys.push(i);
- }
- return keys;
- },
-
- splat: function(obj) {
- var type = Ext.type(obj);
- return (type) ? ((type != 'array') ? [obj] : obj) : [];
- }
- });
- Ext.getKeys = Ext.keys;
-
- Ext.BLANK_IMAGE_URL = '/images/s.gif';
+ isObjectEmpty: function(obj) {
+ for(var i in obj) { return false; }
+ return true;
+ },
+
+ keys: function(obj) {
+ var keys = [];
+ for (i in obj) if (obj.hasOwnProperty(i))
+ {
+ keys.push(i);
+ }
+ return keys;
+ },
+
+ splat: function(obj) {
+ var type = Ext.type(obj);
+ return (type) ? ((type != 'array') ? [obj] : obj) : [];
+ }
+ });
+ Ext.getKeys = Ext.keys;
+
+ Ext.BLANK_IMAGE_URL = '/images/s.gif';
})();
(function() {
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---