Fix license headers

Remove ui/webui/ssl from package_data since it doesn't exist
This commit is contained in:
Andrew Resch 2009-01-28 00:36:33 +00:00
commit 040b4938e1
15 changed files with 473 additions and 285 deletions

View file

@ -1,6 +1,22 @@
/* /*
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com> # Copyright (C) Martijn Voncken 2008 <mvoncken@gmail.com>
# License : GPL v3. #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, write to:
# The Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301, USA.
#
*/ */
@ -77,4 +93,3 @@ Plugins.Label = {
window.addEvent('domready', function(e) { window.addEvent('domready', function(e) {
Plugins.Label.initialize(); Plugins.Label.initialize();
}); });

View file

@ -1,6 +1,22 @@
/* /*
(c) Martijn Voncken mvoncken@gmail.com # Copyright (C) Martijn Voncken 2008 <mvoncken@gmail.com>
License: GPL v3 #
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, write to:
# The Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301, USA.
#
*/ */
@ -57,6 +73,3 @@ var InputSensitivitySetter = new Class({
},this); },this);
} }
}); });

View file

@ -20,7 +20,7 @@
quick and dirty auto-refresh timer. quick and dirty auto-refresh timer.
Our users have waited too long for a new auto-refresh. Our users have waited too long for a new auto-refresh.
I need to get things done (even if it's ot pretty). ;with the least dependencies for a backport to 1.05 I need to get things done (even if it's not pretty). ;with the least dependencies for a backport to 1.05
*/ */
var seconds=0; var seconds=0;
var refresh_secs = 10; var refresh_secs = 10;

View file

@ -2,12 +2,29 @@
Script: Rpc.js Script: Rpc.js
A JSON-RPC proxy built ontop of mootools. A JSON-RPC proxy built ontop of mootools.
Copyright: *
Damien Churchill (c) 2008 <damoxc@gmail.com> * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
Class: JSON.RPC Class: JSON.RPC
Class to create a proxy to a json-rpc interface on a server. Class to create a proxy to a json-rpc interface on a server.
Example: Example:
client = new JSON.RPC('/json/rpc'); client = new JSON.RPC('/json/rpc');
client.hello_world({ client.hello_world({
@ -21,18 +38,18 @@ Copyright:
alert(result); alert(result);
} }
}); });
Returns: Returns:
The proxy that can be used to directly call methods on the server. The proxy that can be used to directly call methods on the server.
*/ */
JSON.RPC = new Class({ JSON.RPC = new Class({
Implements: Options, Implements: Options,
options: { options: {
async: true, async: true,
methods: [] methods: []
}, },
initialize: function(url, options) { initialize: function(url, options) {
this.setOptions(options) this.setOptions(options)
this.url = url this.url = url
@ -45,23 +62,23 @@ JSON.RPC = new Class({
}, this) }, this)
} }
}, },
/* /*
Property: _parseargs Property: _parseargs
Internal method for parsing the arguments given to the method Internal method for parsing the arguments given to the method
Arguments: Arguments:
args - A list of the methods arguments args - A list of the methods arguments
Returns: Returns:
An options object with the arguments set as options.params An options object with the arguments set as options.params
*/ */
_parseargs: function(args) { _parseargs: function(args) {
var params = $A(args), options = params.getLast() var params = $A(args), options = params.getLast()
if ($type(options) == 'object') { if ($type(options) == 'object') {
var option_keys = ['async', 'onRequest', 'onComplete', var option_keys = ['async', 'onRequest', 'onComplete',
'onSuccess', 'onFailure', 'onException', 'onCancel'], keys = 'onSuccess', 'onFailure', 'onException', 'onCancel'], keys =
new Hash(options).getKeys(), is_option = false new Hash(options).getKeys(), is_option = false
option_keys.each(function(key) { option_keys.each(function(key) {
@ -69,7 +86,7 @@ JSON.RPC = new Class({
is_option = true is_option = true
} }
}) })
if (is_option) { if (is_option) {
params.erase(options) params.erase(options)
} else { } else {
@ -79,19 +96,19 @@ JSON.RPC = new Class({
options.params = params options.params = params
return options return options
}, },
/* /*
Property: _execute Property: _execute
An internal method to make the call to the rpc page An internal method to make the call to the rpc page
Arguements: Arguements:
method - the name of the method method - the name of the method
options - An options dict providing any additional options for the options - An options dict providing any additional options for the
call. call.
Example: Example:
alert(client.hello_world({async: false;})); alert(client.hello_world({async: false;}));
Returns: Returns:
If not async returns the json result If not async returns the json result
*/ */
@ -99,7 +116,7 @@ JSON.RPC = new Class({
options = $pick(options, {}) options = $pick(options, {})
options.params = $pick(options.params, []) options.params = $pick(options.params, [])
options.async = $pick(options.async, this.options.async) options.async = $pick(options.async, this.options.async)
data = JSON.encode({ data = JSON.encode({
method: method, method: method,
params: options.params, params: options.params,

View file

@ -1,12 +1,25 @@
/* /*
Script: deluge-add.js Script: deluge-add.js
Contains the add torrent window and the torrent creator window. Contains the add torrent window and the torrent creator window.
*
License: * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
General Public License v3 *
* This program is free software; you can redistribute it and/or modify
Copyright: * it under the terms of the GNU General Public License as published by
Damien Churchill (c) 2008 <damoxc@gmail.com> * the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
*/ */
Deluge.Widgets.AddWindow = new Class({ Deluge.Widgets.AddWindow = new Class({
@ -17,7 +30,7 @@ Deluge.Widgets.AddWindow = new Class({
title: _('Add Torrents'), title: _('Add Torrents'),
url: '/template/render/html/window_add_torrent.html' url: '/template/render/html/window_add_torrent.html'
}, },
initialize: function() { initialize: function() {
this.parent(); this.parent();
this.bound = { this.bound = {
@ -32,7 +45,7 @@ Deluge.Widgets.AddWindow = new Class({
this.addEvent('loaded', this.bound.onLoad); this.addEvent('loaded', this.bound.onLoad);
this.addEvent('show', this.bound.onShow); this.addEvent('show', this.bound.onShow);
}, },
onLoad: function(e) { onLoad: function(e) {
this.content.id = 'addTorrent'; this.content.id = 'addTorrent';
this.torrents = this.content.getElement('select'); this.torrents = this.content.getElement('select');
@ -43,28 +56,28 @@ Deluge.Widgets.AddWindow = new Class({
this.optionsTab = new Deluge.Widgets.AddTorrent.OptionsTab(); this.optionsTab = new Deluge.Widgets.AddTorrent.OptionsTab();
this.tabs.addPage(this.filesTab); this.tabs.addPage(this.filesTab);
this.tabs.addPage(this.optionsTab); this.tabs.addPage(this.optionsTab);
this.fileWindow = new Deluge.Widgets.AddTorrent.File(); this.fileWindow = new Deluge.Widgets.AddTorrent.File();
this.fileWindow.addEvent('torrentAdded', this.bound.onTorrentAdded); this.fileWindow.addEvent('torrentAdded', this.bound.onTorrentAdded);
this.fileButton = this.content.getElement('button.file'); this.fileButton = this.content.getElement('button.file');
this.fileButton.addEvent('click', function(e) { this.fileButton.addEvent('click', function(e) {
this.fileWindow.show(); this.fileWindow.show();
}.bindWithEvent(this)); }.bindWithEvent(this));
this.urlWindow = new Deluge.Widgets.AddTorrent.Url(); this.urlWindow = new Deluge.Widgets.AddTorrent.Url();
this.urlWindow.addEvent('torrentAdded', this.bound.onTorrentAdded); this.urlWindow.addEvent('torrentAdded', this.bound.onTorrentAdded);
this.urlButton = this.content.getElement('button.url'); this.urlButton = this.content.getElement('button.url');
this.urlButton.addEvent('click', function(e) { this.urlButton.addEvent('click', function(e) {
this.urlWindow.show(); this.urlWindow.show();
}.bindWithEvent(this)); }.bindWithEvent(this));
this.removeButton = this.content.getElement('button.remove'); this.removeButton = this.content.getElement('button.remove');
this.removeButton.addEvent('click', this.bound.onRemoveClick); this.removeButton.addEvent('click', this.bound.onRemoveClick);
this.content.getElement('button.add').addEvent('click', this.bound.onAdd); this.content.getElement('button.add').addEvent('click', this.bound.onAdd);
this.content.getElement('button.cancel').addEvent('click', this.bound.onCancel); this.content.getElement('button.cancel').addEvent('click', this.bound.onCancel);
}, },
onTorrentAdded: function(torrentInfo) { onTorrentAdded: function(torrentInfo) {
var option = new Element('option'); var option = new Element('option');
option.set('value', torrentInfo['info_hash']); option.set('value', torrentInfo['info_hash']);
@ -74,11 +87,11 @@ Deluge.Widgets.AddWindow = new Class({
this.torrents.grab(option); this.torrents.grab(option);
this.torrentInfo[torrentInfo['info_hash']] = torrentInfo; this.torrentInfo[torrentInfo['info_hash']] = torrentInfo;
}, },
onTorrentChanged: function(e) { onTorrentChanged: function(e) {
this.filesTab.setTorrent(this.torrentInfo[this.torrents.value]); this.filesTab.setTorrent(this.torrentInfo[this.torrents.value]);
}, },
onAdd: function(e) { onAdd: function(e) {
torrents = new Array(); torrents = new Array();
$each(this.torrentInfo, function(torrent) { $each(this.torrentInfo, function(torrent) {
@ -90,18 +103,18 @@ Deluge.Widgets.AddWindow = new Class({
Deluge.Client.add_torrents(torrents); Deluge.Client.add_torrents(torrents);
this.onCancel() this.onCancel()
}, },
onShow: function(e) { onShow: function(e) {
this.optionsTab.getDefaults(); this.optionsTab.getDefaults();
}, },
onCancel: function(e) { onCancel: function(e) {
this.hide(); this.hide();
this.torrents.empty(); this.torrents.empty();
this.torrentInfo.empty(); this.torrentInfo.empty();
this.filesTab.table.empty(); this.filesTab.table.empty();
}, },
onRemoveClick: function(e) { onRemoveClick: function(e) {
delete this.torrentInfo[this.torrents.value]; delete this.torrentInfo[this.torrents.value];
this.torrents.options[this.torrents.selectedIndex].dispose(); this.torrents.options[this.torrents.selectedIndex].dispose();
@ -113,13 +126,13 @@ Deluge.Widgets.AddTorrent = {}
Deluge.Widgets.AddTorrent.File = new Class({ Deluge.Widgets.AddTorrent.File = new Class({
Extends: Widgets.Window, Extends: Widgets.Window,
options: { options: {
width: 400, width: 400,
height: 100, height: 100,
title: _('From File') title: _('From File')
}, },
initialize: function() { initialize: function() {
this.parent(); this.parent();
this.bound = { this.bound = {
@ -147,35 +160,35 @@ Deluge.Widgets.AddTorrent.File = new Class({
this.content.grab(this.iframe); this.content.grab(this.iframe);
this.iframe.addEvent('load', this.bound.onLoad); this.iframe.addEvent('load', this.bound.onLoad);
}, },
onLoad: function(e) { onLoad: function(e) {
var body = $(this.iframe.contentDocument.body); var body = $(this.iframe.contentDocument.body);
var form = body.getElement('form'); var form = body.getElement('form');
var cancelButton = form.getElement('button.cancel'); var cancelButton = form.getElement('button.cancel');
cancelButton.addEvent('click', this.bound.onCancel); cancelButton.addEvent('click', this.bound.onCancel);
var fileInputs = form.getElement('div.fileInputs'); var fileInputs = form.getElement('div.fileInputs');
var fileInput = fileInputs.getElement('input'); var fileInput = fileInputs.getElement('input');
fileInput.set('opacity', 0.000001); fileInput.set('opacity', 0.000001);
var fakeFile = fileInputs.getElement('div').getElement('input'); var fakeFile = fileInputs.getElement('div').getElement('input');
fileInput.addEvent('change', function(e) { fileInput.addEvent('change', function(e) {
fakeFile.value = fileInput.value; fakeFile.value = fileInput.value;
}); });
form.addEvent('submit', this.bound.onSubmit); form.addEvent('submit', this.bound.onSubmit);
this.iframe.removeEvent('load', this.bound.onLoad); this.iframe.removeEvent('load', this.bound.onLoad);
}, },
onCancel: function(e) { onCancel: function(e) {
this.hide(); this.hide();
}, },
onSubmit: function(e) { onSubmit: function(e) {
this.iframe.addEvent('load', this.bound.onComplete); this.iframe.addEvent('load', this.bound.onComplete);
this.iframe.set('opacity', 0); this.iframe.set('opacity', 0);
}, },
onComplete: function(e) { onComplete: function(e) {
filename = $(this.iframe.contentDocument.body).get('text'); filename = $(this.iframe.contentDocument.body).get('text');
this.hide(); this.hide();
@ -183,7 +196,7 @@ Deluge.Widgets.AddTorrent.File = new Class({
onSuccess: this.bound.onGetInfoSuccess onSuccess: this.bound.onGetInfoSuccess
}); });
}, },
onGetInfoSuccess: function(info) { onGetInfoSuccess: function(info) {
if (info) this.fireEvent('torrentAdded', info); if (info) this.fireEvent('torrentAdded', info);
} }
@ -191,13 +204,13 @@ Deluge.Widgets.AddTorrent.File = new Class({
Deluge.Widgets.AddTorrent.Url = new Class({ Deluge.Widgets.AddTorrent.Url = new Class({
Extends: Widgets.Window, Extends: Widgets.Window,
options: { options: {
width: 300, width: 300,
height: 100, height: 100,
title: _('From Url') title: _('From Url')
}, },
initialize: function() { initialize: function() {
this.parent(); this.parent();
this.bound = { this.bound = {
@ -206,7 +219,7 @@ Deluge.Widgets.AddTorrent.Url = new Class({
onDownloadSuccess: this.onDownloadSuccess.bindWithEvent(this), onDownloadSuccess: this.onDownloadSuccess.bindWithEvent(this),
onGetInfoSuccess: this.onGetInfoSuccess.bindWithEvent(this) onGetInfoSuccess: this.onGetInfoSuccess.bindWithEvent(this)
}; };
this.form = new Element('form'); this.form = new Element('form');
this.urlInput = new Element('input', { this.urlInput = new Element('input', {
'type': 'text', 'type': 'text',
@ -224,11 +237,11 @@ Deluge.Widgets.AddTorrent.Url = new Class({
this.form.grab(this.urlInput).grab(new Element('br')); this.form.grab(this.urlInput).grab(new Element('br'));
this.form.grab(this.okButton).grab(this.cancelButton); this.form.grab(this.okButton).grab(this.cancelButton);
this.content.grab(this.form); this.content.grab(this.form);
this.okButton.addEvent('click', this.bound.onOkClick); this.okButton.addEvent('click', this.bound.onOkClick);
this.cancelButton.addEvent('click', this.bound.onCancelClick); this.cancelButton.addEvent('click', this.bound.onCancelClick);
}, },
onOkClick: function(e) { onOkClick: function(e) {
e.stop(); e.stop();
var url = this.urlInput.get('value'); var url = this.urlInput.get('value');
@ -237,19 +250,19 @@ Deluge.Widgets.AddTorrent.Url = new Class({
}); });
this.hide(); this.hide();
}, },
onCancelClick: function(e) { onCancelClick: function(e) {
e.stop(); e.stop();
this.urlInput.set('value', ''); this.urlInput.set('value', '');
this.hide(); this.hide();
}, },
onDownloadSuccess: function(filename) { onDownloadSuccess: function(filename) {
Deluge.Client.get_torrent_info(filename, { Deluge.Client.get_torrent_info(filename, {
onSuccess: this.bound.onGetInfoSuccess onSuccess: this.bound.onGetInfoSuccess
}); });
}, },
onGetInfoSuccess: function(info) { onGetInfoSuccess: function(info) {
this.fireEvent('torrentAdded', info); this.fireEvent('torrentAdded', info);
} }
@ -257,20 +270,20 @@ Deluge.Widgets.AddTorrent.Url = new Class({
Deluge.Widgets.AddTorrent.FilesTab = new Class({ Deluge.Widgets.AddTorrent.FilesTab = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/add_torrent_files.html' url: '/template/render/html/add_torrent_files.html'
}, },
initialize: function() { initialize: function() {
this.addEvent('loaded', this.onLoad.bindWithEvent(this)); this.addEvent('loaded', this.onLoad.bindWithEvent(this));
this.parent('Files'); this.parent('Files');
}, },
onLoad: function(e) { onLoad: function(e) {
this.table = this.element.getElement('table'); this.table = this.element.getElement('table');
}, },
setTorrent: function(torrent) { setTorrent: function(torrent) {
this.table.empty(); this.table.empty();
if (!torrent) return; if (!torrent) return;
@ -292,19 +305,19 @@ Deluge.Widgets.AddTorrent.FilesTab = new Class({
Deluge.Widgets.AddTorrent.OptionsTab = new Class({ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/add_torrent_options.html' url: '/template/render/html/add_torrent_options.html'
}, },
initialize: function() { initialize: function() {
this.parent('Options'); this.parent('Options');
this.addEvent('loaded', this.onLoad.bindWithEvent(this)); this.addEvent('loaded', this.onLoad.bindWithEvent(this));
}, },
onLoad: function(e) { onLoad: function(e) {
this.form = this.element.getElement('form'); this.form = this.element.getElement('form');
new Widgets.Spinner(this.form.max_download_speed_per_torrent, { new Widgets.Spinner(this.form.max_download_speed_per_torrent, {
step: 10, step: 10,
precision: 1, precision: 1,
@ -313,7 +326,7 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.max_upload_speed_per_torrent, { new Widgets.Spinner(this.form.max_upload_speed_per_torrent, {
step: 10, step: 10,
precision: 1, precision: 1,
@ -322,7 +335,7 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.max_connections_per_torrent, { new Widgets.Spinner(this.form.max_connections_per_torrent, {
step: 1, step: 1,
precision: 0, precision: 0,
@ -331,7 +344,7 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.max_upload_slots_per_torrent, { new Widgets.Spinner(this.form.max_upload_slots_per_torrent, {
step: 1, step: 1,
precision: 0, precision: 0,
@ -341,7 +354,7 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
} }
}); });
}, },
getDefaults: function() { getDefaults: function() {
var keys = [ var keys = [
'add_paused', 'add_paused',
@ -357,12 +370,12 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
onSuccess: this.onGetConfigSuccess.bindWithEvent(this) onSuccess: this.onGetConfigSuccess.bindWithEvent(this)
}); });
}, },
onGetConfigSuccess: function(config) { onGetConfigSuccess: function(config) {
this.default_config = config; this.default_config = config;
this.setFormToDefault(); this.setFormToDefault();
}, },
setFormToDefault: function() { setFormToDefault: function() {
this.form.add_paused.checked = config['add_paused']; this.form.add_paused.checked = config['add_paused'];
$each(this.form.compact_allocation, function(el) { $each(this.form.compact_allocation, function(el) {
@ -378,22 +391,22 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
$$W(this.form.max_connections_per_torrent).setValue(config['max_connections_per_torrent']); $$W(this.form.max_connections_per_torrent).setValue(config['max_connections_per_torrent']);
$$W(this.form.max_upload_slots_per_torrent).setValue(config['max_upload_slots_per_torrent']); $$W(this.form.max_upload_slots_per_torrent).setValue(config['max_upload_slots_per_torrent']);
}, },
setTorrent: function(torrent) { setTorrent: function(torrent) {
} }
}); });
Deluge.Widgets.CreateTorrent = new Class({ Deluge.Widgets.CreateTorrent = new Class({
Extends: Widgets.Window, Extends: Widgets.Window,
options: { options: {
width: 400, width: 400,
height: 400, height: 400,
title: _('Create Torrent'), title: _('Create Torrent'),
url: '/template/render/html/window_create_torrent.html' url: '/template/render/html/window_create_torrent.html'
}, },
initialize: function() { initialize: function() {
this.parent(); this.parent();
this.bound = { this.bound = {
@ -403,21 +416,21 @@ Deluge.Widgets.CreateTorrent = new Class({
} }
this.addEvent('loaded', this.bound.onLoad); this.addEvent('loaded', this.bound.onLoad);
}, },
onLoad: function(e) { onLoad: function(e) {
this.tabs = new Deluge.Widgets.CreateTorrent.Tabs(this.content.getElement('.moouiTabs')); this.tabs = new Deluge.Widgets.CreateTorrent.Tabs(this.content.getElement('.moouiTabs'));
this.fileButton = this.content.getElement('button.file'); this.fileButton = this.content.getElement('button.file');
this.folderButton = this.content.getElement('button.folder'); this.folderButton = this.content.getElement('button.folder');
this.content.id = 'createTorrent'; this.content.id = 'createTorrent';
this.fileButton.addEvent('click', this.bound.onFileClick); this.fileButton.addEvent('click', this.bound.onFileClick);
}, },
onFileClick: function(e) { onFileClick: function(e) {
var desktop = google.gears.factory.create('beta.desktop'); var desktop = google.gears.factory.create('beta.desktop');
desktop.openFiles(this.onFilesPicked.bind(this)); desktop.openFiles(this.onFilesPicked.bind(this));
}, },
onFilesPicked: function(files) { onFilesPicked: function(files) {
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
alert(files[i].blob); alert(files[i].blob);
@ -427,7 +440,7 @@ Deluge.Widgets.CreateTorrent = new Class({
Deluge.Widgets.CreateTorrent.Tabs = new Class({ Deluge.Widgets.CreateTorrent.Tabs = new Class({
Extends: Widgets.Tabs, Extends: Widgets.Tabs,
initialize: function(element) { initialize: function(element) {
this.parent(element); this.parent(element);
this.info = new Deluge.Widgets.CreateTorrent.InfoTab(); this.info = new Deluge.Widgets.CreateTorrent.InfoTab();
@ -443,11 +456,11 @@ Deluge.Widgets.CreateTorrent.Tabs = new Class({
Deluge.Widgets.CreateTorrent.InfoTab = new Class({ Deluge.Widgets.CreateTorrent.InfoTab = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/create_torrent_info.html' url: '/template/render/html/create_torrent_info.html'
}, },
initialize: function() { initialize: function() {
this.parent('Info'); this.parent('Info');
} }
@ -455,11 +468,11 @@ Deluge.Widgets.CreateTorrent.InfoTab = new Class({
Deluge.Widgets.CreateTorrent.TrackersTab = new Class({ Deluge.Widgets.CreateTorrent.TrackersTab = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/create_torrent_trackers.html' url: '/template/render/html/create_torrent_trackers.html'
}, },
initialize: function() { initialize: function() {
this.parent('Trackers'); this.parent('Trackers');
} }
@ -467,11 +480,11 @@ Deluge.Widgets.CreateTorrent.TrackersTab = new Class({
Deluge.Widgets.CreateTorrent.WebseedsTab = new Class({ Deluge.Widgets.CreateTorrent.WebseedsTab = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/create_torrent_webseeds.html' url: '/template/render/html/create_torrent_webseeds.html'
}, },
initialize: function() { initialize: function() {
this.parent('Webseeds'); this.parent('Webseeds');
} }
@ -479,11 +492,11 @@ Deluge.Widgets.CreateTorrent.WebseedsTab = new Class({
Deluge.Widgets.CreateTorrent.OptionsTab = new Class({ Deluge.Widgets.CreateTorrent.OptionsTab = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/create_torrent_options.html' url: '/template/render/html/create_torrent_options.html'
}, },
initialize: function() { initialize: function() {
this.parent('Options'); this.parent('Options');
} }

View file

@ -2,11 +2,25 @@
Script: deluge-bars.js Script: deluge-bars.js
Contains the various bars (Sidebar, Toolbar, Statusbar) used within Deluge. Contains the various bars (Sidebar, Toolbar, Statusbar) used within Deluge.
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
Class: Deluge.Widgets.Toolbar Class: Deluge.Widgets.Toolbar
@ -22,7 +36,7 @@ Copyright:
Deluge.Widgets.Toolbar = new Class({ Deluge.Widgets.Toolbar = new Class({
Implements: Events, Implements: Events,
Extends: Widgets.Base, Extends: Widgets.Base,
initialize: function() { initialize: function() {
this.parent($('toolbar')); this.parent($('toolbar'));
this.buttons = this.element.getFirst(); this.buttons = this.element.getFirst();
@ -39,54 +53,54 @@ Deluge.Widgets.Toolbar = new Class({
/* /*
Class: Deluge.Widgets.StatusBar Class: Deluge.Widgets.StatusBar
Class to manage the bottom status bar Class to manage the bottom status bar
Example: Example:
status = new Deluge.Widgets.StatusBar(); status = new Deluge.Widgets.StatusBar();
Returns: Returns:
An instance of the class wrapped about the status div An instance of the class wrapped about the status div
*/ */
Deluge.Widgets.StatusBar = new Class({ Deluge.Widgets.StatusBar = new Class({
Extends: Widgets.Base, Extends: Widgets.Base,
initialize: function() { initialize: function() {
this.parent($('status')); this.parent($('status'));
this.bound = { this.bound = {
onContextMenu: this.onContextMenu.bindWithEvent(this) onContextMenu: this.onContextMenu.bindWithEvent(this)
}; };
this.element.getElements('li').each(function(el) { this.element.getElements('li').each(function(el) {
this[el.id] = el; this[el.id] = el;
}, this); }, this);
this.incoming_connections.setStyle('display', 'none'); this.incoming_connections.setStyle('display', 'none');
this.connections.addEvent('contextmenu', this.bound.onContextMenu); this.connections.addEvent('contextmenu', this.bound.onContextMenu);
var menu = new Widgets.PopupMenu(); var menu = new Widgets.PopupMenu();
menu.add(Deluge.Menus.Connections); menu.add(Deluge.Menus.Connections);
menu.addEvent('action', this.onMenuAction); menu.addEvent('action', this.onMenuAction);
this.connections.store('menu', menu); this.connections.store('menu', menu);
this.downspeed.addEvent('contextmenu', this.bound.onContextMenu); this.downspeed.addEvent('contextmenu', this.bound.onContextMenu);
menu = new Widgets.PopupMenu(); menu = new Widgets.PopupMenu();
menu.add(Deluge.Menus.Download); menu.add(Deluge.Menus.Download);
menu.addEvent('action', this.onMenuAction); menu.addEvent('action', this.onMenuAction);
this.downspeed.store('menu', menu); this.downspeed.store('menu', menu);
this.upspeed.addEvent('contextmenu', this.bound.onContextMenu); this.upspeed.addEvent('contextmenu', this.bound.onContextMenu);
menu = new Widgets.PopupMenu(); menu = new Widgets.PopupMenu();
menu.add(Deluge.Menus.Upload); menu.add(Deluge.Menus.Upload);
menu.addEvent('action', this.onMenuAction); menu.addEvent('action', this.onMenuAction);
this.upspeed.store('menu', menu); this.upspeed.store('menu', menu);
}, },
/* /*
Property: update Property: update
Takes thes stats part of the update_ui rpc call and Takes thes stats part of the update_ui rpc call and
performs the required changes on the statusbar. performs the required changes on the statusbar.
Arguments: Arguments:
stats - A dictionary of the returned stats stats - A dictionary of the returned stats
Example: Example:
statusbar.update(data['stats']); statusbar.update(data['stats']);
*/ */
@ -97,20 +111,20 @@ Deluge.Widgets.StatusBar = new Class({
this.dht.set('text', stats.dht_nodes); this.dht.set('text', stats.dht_nodes);
this.free_space.set('text', stats.free_space.toBytes()); this.free_space.set('text', stats.free_space.toBytes());
if (stats.has_incoming_connections) { if (stats.has_incoming_connections) {
this.incoming_connections.setStyle('display', 'none'); this.incoming_connections.setStyle('display', 'none');
} else { } else {
this.incoming_connections.setStyle('display', 'inline'); this.incoming_connections.setStyle('display', 'inline');
} }
}, },
/* /*
Property: onContextMenu Property: onContextMenu
Event handler for when certain parts of the statusbar have been Event handler for when certain parts of the statusbar have been
right clicked. right clicked.
Arguments: Arguments:
e - The event args e - The event args
Example: Example:
el.addEvent('contextmenu', this.onContextMenu.bindWithEvent(this)); el.addEvent('contextmenu', this.onContextMenu.bindWithEvent(this));
*/ */
@ -119,16 +133,16 @@ Deluge.Widgets.StatusBar = new Class({
var menu = e.target.retrieve('menu'); var menu = e.target.retrieve('menu');
if (menu) menu.show(e); if (menu) menu.show(e);
}, },
/* /*
Property: onMenuAction Property: onMenuAction
Event handler for when an item in one of the menus is clicked. Event handler for when an item in one of the menus is clicked.
Note that it does not need to be bound as it doesn't use `this` Note that it does not need to be bound as it doesn't use `this`
anywhere within the method. anywhere within the method.
Arguments: Arguments:
e - The event args e - The event args
Example: Example:
menu.addEvent('action', this.onMenuAction); menu.addEvent('action', this.onMenuAction);
*/ */
@ -145,17 +159,17 @@ Deluge.Widgets.StatusBar = new Class({
/* /*
Class: Deluge.Wdigets.Labels Class: Deluge.Wdigets.Labels
Class to manage the filtering labels in the sidebar Class to manage the filtering labels in the sidebar
Example: Example:
labels = new Deluge.Widgets.Labels(); labels = new Deluge.Widgets.Labels();
Returns: Returns:
An instance of the class wrapped about the labels div An instance of the class wrapped about the labels div
*/ */
Deluge.Widgets.Labels = new Class({ Deluge.Widgets.Labels = new Class({
Extends: Widgets.Base, Extends: Widgets.Base,
initialize: function() { initialize: function() {
this.parent($('labels')); this.parent($('labels'));
this.bound = { this.bound = {
@ -163,15 +177,15 @@ Deluge.Widgets.Labels = new Class({
}; };
this.filters = {}; this.filters = {};
}, },
/* /*
Property: update Property: update
Takes thes filters part of the update_ui rpc call and Takes thes filters part of the update_ui rpc call and
performs the required changes on the filtering performs the required changes on the filtering
Arguments: Arguments:
filters - A dictionary of the available filters filters - A dictionary of the available filters
Example: Example:
labels.update({'state': [['All', '3'], ['Downloading', '2']]); labels.update({'state': [['All', '3'], ['Downloading', '2']]);
*/ */
@ -194,13 +208,13 @@ Deluge.Widgets.Labels = new Class({
} }
}, this); }, this);
}, },
/* /*
Property: labelClicked Property: labelClicked
Arguments: Arguments:
e - The event args e - The event args
Example: Example:
labelSection.addEvent('labelClicked', this.bound.labelClicked); labelSection.addEvent('labelClicked', this.bound.labelClicked);
*/ */
@ -217,26 +231,26 @@ Deluge.Widgets.Labels = new Class({
/* /*
Class: Deluge.Widgets.LabelSection Class: Deluge.Widgets.LabelSection
Class to manage a section of filters within the labels block Class to manage a section of filters within the labels block
Arguments: Arguments:
string (the name of the section) string (the name of the section)
Returns: Returns:
A widget with the ability to manage the filters A widget with the ability to manage the filters
*/ */
Deluge.Widgets.LabelSection = new Class({ Deluge.Widgets.LabelSection = new Class({
Extends: Widgets.Base, Extends: Widgets.Base,
regex: /([\w]+)\s\((\d)\)/, regex: /([\w]+)\s\((\d)\)/,
initialize: function(name) { initialize: function(name) {
this.parent(new Element('div')); this.parent(new Element('div'));
this.name = name; this.name = name;
this.bound = { this.bound = {
'clicked': this.clicked.bindWithEvent(this) 'clicked': this.clicked.bindWithEvent(this)
} }
name = name.replace('_', ' '); name = name.replace('_', ' ');
parts = name.split(' '); parts = name.split(' ');
name = ''; name = '';
@ -246,21 +260,21 @@ Deluge.Widgets.LabelSection = new Class({
part = firstLetter + part.substring(1); part = firstLetter + part.substring(1);
name += part + ' '; name += part + ' ';
}); });
this.header = new Element('h3').set('text', name); this.header = new Element('h3').set('text', name);
this.list = new Element('ul'); this.list = new Element('ul');
this.element.grab(this.header); this.element.grab(this.header);
this.element.grab(this.list); this.element.grab(this.list);
}, },
/* /*
Property: update Property: update
Updates the filters list Updates the filters list
Arguments: Arguments:
values - a list of name/count values for the filters values - a list of name/count values for the filters
Example: Example:
labelSection.update([['All', '3'], ['Downloading', '2']]); labelSection.update([['All', '3'], ['Downloading', '2']]);
*/ */
@ -283,7 +297,7 @@ Deluge.Widgets.LabelSection = new Class({
} }
el.set('text', name + ' (' + count +')'); el.set('text', name + ' (' + count +')');
}, this); }, this);
// Clean out any labels that are no longer returned // Clean out any labels that are no longer returned
this.list.getElements('li').each(function(el) { this.list.getElements('li').each(function(el) {
var hasName = false; var hasName = false;
@ -291,20 +305,20 @@ Deluge.Widgets.LabelSection = new Class({
if (hasName) return; if (hasName) return;
hasName = el.hasClass(name); hasName = el.hasClass(name);
}); });
if (!hasName) { if (!hasName) {
el.destroy(); el.destroy();
} }
}); });
}, },
/* /*
Property: clicked Property: clicked
Event handler for when a list item is clicked Event handler for when a list item is clicked
Arguments: Arguments:
e - The event args e - The event args
Example: Example:
listItem.addEvent('click', this.clicked.bindWithEvent(this)); listItem.addEvent('click', this.clicked.bindWithEvent(this));
*/ */

View file

@ -2,25 +2,39 @@
Script: deluge-details.js Script: deluge-details.js
Contains the tabs for the torrent details. Contains the tabs for the torrent details.
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
*/ */
Deluge.Widgets.Details = new Class({ Deluge.Widgets.Details = new Class({
Extends: Widgets.Tabs, Extends: Widgets.Tabs,
initialize: function() { initialize: function() {
this.parent($$('#details .mooui-tabs')[0]); this.parent($$('#details .mooui-tabs')[0]);
this.statistics = new Deluge.Widgets.StatisticsPage(); this.statistics = new Deluge.Widgets.StatisticsPage();
this.details = new Deluge.Widgets.DetailsPage(); this.details = new Deluge.Widgets.DetailsPage();
this.files = new Deluge.Widgets.FilesPage(); this.files = new Deluge.Widgets.FilesPage();
this.peers = new Deluge.Widgets.PeersPage(); this.peers = new Deluge.Widgets.PeersPage();
this.options = new Deluge.Widgets.OptionsPage(); this.options = new Deluge.Widgets.OptionsPage();
this.addPage(this.statistics); this.addPage(this.statistics);
this.addPage(this.details); this.addPage(this.details);
this.addPage(this.files); this.addPage(this.files);
@ -30,7 +44,7 @@ Deluge.Widgets.Details = new Class({
this.update(this.torrentId); this.update(this.torrentId);
}.bindWithEvent(this)); }.bindWithEvent(this));
this.addEvent('resize', this.resized.bindWithEvent(this)); this.addEvent('resize', this.resized.bindWithEvent(this));
this.files.addEvent('menuAction', function(e) { this.files.addEvent('menuAction', function(e) {
files = []; files = [];
this.files.grid.getSelected().each(function(file) { this.files.grid.getSelected().each(function(file) {
@ -40,7 +54,7 @@ Deluge.Widgets.Details = new Class({
this.fireEvent('filesAction', e); this.fireEvent('filesAction', e);
}.bindWithEvent(this)); }.bindWithEvent(this));
}, },
keys: { keys: {
0: Deluge.Keys.Statistics, 0: Deluge.Keys.Statistics,
1: Deluge.Keys.Details, 1: Deluge.Keys.Details,
@ -48,7 +62,7 @@ Deluge.Widgets.Details = new Class({
3: Deluge.Keys.Peers, 3: Deluge.Keys.Peers,
4: Deluge.Keys.Options 4: Deluge.Keys.Options
}, },
clear: function() { clear: function() {
this.pages.each(function(page) { this.pages.each(function(page) {
page.element.getChildren().each(function(el) { page.element.getChildren().each(function(el) {
@ -57,7 +71,7 @@ Deluge.Widgets.Details = new Class({
if (page.clear) page.clear(); if (page.clear) page.clear();
}); });
}, },
update: function(torrentId) { update: function(torrentId) {
this.torrentId = torrentId; this.torrentId = torrentId;
if (!this.torrentId) { if (!this.torrentId) {
@ -75,7 +89,7 @@ Deluge.Widgets.Details = new Class({
}.bindWithEvent(this) }.bindWithEvent(this)
}); });
}, },
resized: function(event) { resized: function(event) {
this.pages.each(function(page) { this.pages.each(function(page) {
page.getSizeModifiers(); page.getSizeModifiers();
@ -89,16 +103,16 @@ Deluge.Widgets.Details = new Class({
Deluge.Widgets.StatisticsPage = new Class({ Deluge.Widgets.StatisticsPage = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/tab_statistics.html' url: '/template/render/html/tab_statistics.html'
}, },
initialize: function() { initialize: function() {
this.parent(_('Statistics')); this.parent(_('Statistics'));
this.addEvent('loaded', this.onLoad.bindWithEvent(this)); this.addEvent('loaded', this.onLoad.bindWithEvent(this));
}, },
onLoad: function(e) { onLoad: function(e) {
this.element.id = 'statistics'; this.element.id = 'statistics';
this.bar = new Widgets.ProgressBar(); this.bar = new Widgets.ProgressBar();
@ -107,19 +121,19 @@ Deluge.Widgets.StatisticsPage = new Class({
this.bar.update('', 0); this.bar.update('', 0);
this.addEvent('resize', this.onResize.bindWithEvent(this)); this.addEvent('resize', this.onResize.bindWithEvent(this));
}, },
onResize: function(e) { onResize: function(e) {
if (!$defined(this.bar)) return; if (!$defined(this.bar)) return;
this.bar.set('width', this.getWidth() - 12); this.bar.set('width', this.getWidth() - 12);
}, },
clear: function() { clear: function() {
if (this.bar) this.bar.update('', 0); if (this.bar) this.bar.update('', 0);
this.element.getElements('dd').each(function(item) { this.element.getElements('dd').each(function(item) {
item.set('text', ''); item.set('text', '');
}, this); }, this);
}, },
update: function(torrent) { update: function(torrent) {
var data = { var data = {
downloaded: torrent.total_done.toBytes()+' ('+torrent.total_payload_download.toBytes()+')', downloaded: torrent.total_done.toBytes()+' ('+torrent.total_payload_download.toBytes()+')',
@ -140,10 +154,10 @@ Deluge.Widgets.StatisticsPage = new Class({
} }
var text = torrent.state + ' ' + torrent.progress.toFixed(2) + '%'; var text = torrent.state + ' ' + torrent.progress.toFixed(2) + '%';
this.bar.update(text, torrent.progress); this.bar.update(text, torrent.progress);
if (torrent.is_auto_managed) {data.auto_managed = 'True'} if (torrent.is_auto_managed) {data.auto_managed = 'True'}
else {data.auto_managed = 'False'}; else {data.auto_managed = 'False'};
this.element.getElements('dd').each(function(item) { this.element.getElements('dd').each(function(item) {
item.set('text', data[item.getProperty('class')]); item.set('text', data[item.getProperty('class')]);
}, this); }, this);
@ -152,21 +166,21 @@ Deluge.Widgets.StatisticsPage = new Class({
Deluge.Widgets.DetailsPage = new Class({ Deluge.Widgets.DetailsPage = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/tab_details.html' url: '/template/render/html/tab_details.html'
}, },
initialize: function() { initialize: function() {
this.parent(_('Details')); this.parent(_('Details'));
}, },
clear: function() { clear: function() {
this.element.getElements('dd').each(function(item) { this.element.getElements('dd').each(function(item) {
item.set('text', ''); item.set('text', '');
}, this); }, this);
}, },
update: function(torrent) { update: function(torrent) {
var data = { var data = {
torrent_name: torrent.name, torrent_name: torrent.name,
@ -185,7 +199,7 @@ Deluge.Widgets.DetailsPage = new Class({
Deluge.Widgets.FilesGrid = new Class({ Deluge.Widgets.FilesGrid = new Class({
Extends: Widgets.DataGrid, Extends: Widgets.DataGrid,
options: { options: {
columns: [ columns: [
{name: 'filename',text: 'Filename',type:'text',width: 350}, {name: 'filename',text: 'Filename',type:'text',width: 350},
@ -194,21 +208,21 @@ Deluge.Widgets.FilesGrid = new Class({
{name: 'priority',text: 'Priority',type:'icon',width: 150} {name: 'priority',text: 'Priority',type:'icon',width: 150}
] ]
}, },
priority_texts: { priority_texts: {
0: 'Do Not Download', 0: 'Do Not Download',
1: 'Normal Priority', 1: 'Normal Priority',
2: 'High Priority', 2: 'High Priority',
5: 'Highest Priority' 5: 'Highest Priority'
}, },
priority_icons: { priority_icons: {
0: '/static/images/16/process-stop.png', 0: '/static/images/16/process-stop.png',
1: '/template/static/icons/16/gtk-yes.png', 1: '/template/static/icons/16/gtk-yes.png',
2: '/static/images/16/queue-down.png', 2: '/static/images/16/queue-down.png',
5: '/static/images/16/go-bottom.png' 5: '/static/images/16/go-bottom.png'
}, },
initialize: function(element, options) { initialize: function(element, options) {
this.parent(element, options); this.parent(element, options);
var menu = new Widgets.PopupMenu(); var menu = new Widgets.PopupMenu();
@ -220,7 +234,7 @@ Deluge.Widgets.FilesGrid = new Class({
icon: this.priority_icons[index] icon: this.priority_icons[index]
}); });
}, this); }, this);
menu.addEvent('action', function(e) { menu.addEvent('action', function(e) {
e = { e = {
action: e.action, action: e.action,
@ -228,20 +242,20 @@ Deluge.Widgets.FilesGrid = new Class({
}; };
this.fireEvent('menuAction', e); this.fireEvent('menuAction', e);
}.bind(this)); }.bind(this));
this.addEvent('rowMenu', function(e) { this.addEvent('rowMenu', function(e) {
e.stop(); e.stop();
menu.row = e.row; menu.row = e.row;
menu.show(e); menu.show(e);
}) })
}, },
clear: function() { clear: function() {
this.rows.empty(); this.rows.empty();
this.body.empty(); this.body.empty();
this.render(); this.render();
}, },
updateFiles: function(torrent) { updateFiles: function(torrent) {
torrent.files.each(function(file) { torrent.files.each(function(file) {
var p = torrent.file_priorities[file.index]; var p = torrent.file_priorities[file.index];
@ -249,7 +263,7 @@ Deluge.Widgets.FilesGrid = new Class({
text:this.priority_texts[p], text:this.priority_texts[p],
icon:this.priority_icons[p] icon:this.priority_icons[p]
}; };
var percent = torrent.file_progress[file.index]*100.0; var percent = torrent.file_progress[file.index]*100.0;
row = { row = {
id: torrent.id + '-' + file.index, id: torrent.id + '-' + file.index,
@ -261,7 +275,7 @@ Deluge.Widgets.FilesGrid = new Class({
}, },
fileIndex: file.index, fileIndex: file.index,
torrentId: torrent.id torrentId: torrent.id
}; };
if (this.has(row.id)) { if (this.has(row.id)) {
this.updateRow(row, true); this.updateRow(row, true);
@ -275,49 +289,49 @@ Deluge.Widgets.FilesGrid = new Class({
Deluge.Widgets.FilesPage = new Class({ Deluge.Widgets.FilesPage = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/tab_files.html' url: '/template/render/html/tab_files.html'
}, },
initialize: function(el) { initialize: function(el) {
this.parent(_('Files')); this.parent(_('Files'));
this.torrentId = -1; this.torrentId = -1;
this.addEvent('loaded', this.loaded.bindWithEvent(this)); this.addEvent('loaded', this.loaded.bindWithEvent(this));
this.addEvent('resize', this.resized.bindWithEvent(this)); this.addEvent('resize', this.resized.bindWithEvent(this));
}, },
loaded: function(event) { loaded: function(event) {
this.grid = new Deluge.Widgets.FilesGrid('files'); this.grid = new Deluge.Widgets.FilesGrid('files');
this.grid.addEvent('menuAction', this.menuAction.bindWithEvent(this)); this.grid.addEvent('menuAction', this.menuAction.bindWithEvent(this));
if (this.beenResized) { if (this.beenResized) {
this.resized(this.beenResized); this.resized(this.beenResized);
delete this.beenResized; delete this.beenResized;
}; };
}, },
clear: function() { clear: function() {
if (this.grid) this.grid.clear(); if (this.grid) this.grid.clear();
}, },
resized: function(e) { resized: function(e) {
if (!this.grid) { if (!this.grid) {
this.beenResized = e; this.beenResized = e;
return; return;
}; };
this.element.getPadding(); this.element.getPadding();
this.grid.sets({ this.grid.sets({
width: e.width - this.element.padding.x, width: e.width - this.element.padding.x,
height: e.height - this.element.padding.y height: e.height - this.element.padding.y
}); });
}, },
menuAction: function(e) { menuAction: function(e) {
this.fireEvent('menuAction', e); this.fireEvent('menuAction', e);
}, },
update: function(torrent) { update: function(torrent) {
if (this.torrentId != torrent.id) { if (this.torrentId != torrent.id) {
this.torrentId = torrent.id; this.torrentId = torrent.id;
@ -330,17 +344,17 @@ Deluge.Widgets.FilesPage = new Class({
Deluge.Widgets.PeersPage = new Class({ Deluge.Widgets.PeersPage = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/tab_peers.html' url: '/template/render/html/tab_peers.html'
}, },
initialize: function(el) { initialize: function(el) {
this.parent(_('Peers')); this.parent(_('Peers'));
this.addEvent('resize', this.resized.bindWithEvent(this)); this.addEvent('resize', this.resized.bindWithEvent(this));
this.addEvent('loaded', this.loaded.bindWithEvent(this)); this.addEvent('loaded', this.loaded.bindWithEvent(this));
}, },
loaded: function(event) { loaded: function(event) {
this.grid = new Widgets.DataGrid($('peers'), { this.grid = new Widgets.DataGrid($('peers'), {
columns: [ columns: [
@ -356,26 +370,26 @@ Deluge.Widgets.PeersPage = new Class({
delete this.been_resized; delete this.been_resized;
}; };
}, },
resized: function(e) { resized: function(e) {
if (!this.grid) { if (!this.grid) {
this.been_resized = e; this.been_resized = e;
return; return;
}; };
this.element.getPadding(); this.element.getPadding();
this.grid.sets({ this.grid.sets({
width: e.width - this.element.padding.x, width: e.width - this.element.padding.x,
height: e.height - this.element.padding.y height: e.height - this.element.padding.y
}); });
}, },
clear: function() { clear: function() {
if (!this.grid) return; if (!this.grid) return;
this.grid.rows.empty(); this.grid.rows.empty();
this.grid.body.empty(); this.grid.body.empty();
}, },
update: function(torrent) { update: function(torrent) {
if (this.torrentId != torrent.id) { if (this.torrentId != torrent.id) {
this.torrentId = torrent.id; this.torrentId = torrent.id;
@ -406,7 +420,7 @@ Deluge.Widgets.PeersPage = new Class({
} }
peers.include(peer.ip); peers.include(peer.ip);
}, this); }, this);
this.grid.rows.each(function(row) { this.grid.rows.each(function(row) {
if (!peers.contains(row.id)) { if (!peers.contains(row.id)) {
row.element.destroy(); row.element.destroy();
@ -419,11 +433,11 @@ Deluge.Widgets.PeersPage = new Class({
Deluge.Widgets.OptionsPage = new Class({ Deluge.Widgets.OptionsPage = new Class({
Extends: Widgets.TabPage, Extends: Widgets.TabPage,
options: { options: {
url: '/template/render/html/tab_options.html' url: '/template/render/html/tab_options.html'
}, },
initialize: function() { initialize: function() {
if (!this.element) if (!this.element)
this.parent(_('Options')); this.parent(_('Options'));
@ -431,7 +445,7 @@ Deluge.Widgets.OptionsPage = new Class({
this.loaded(event); this.loaded(event);
}.bindWithEvent(this)); }.bindWithEvent(this));
}, },
loaded: function(event) { loaded: function(event) {
this.bound = { this.bound = {
apply: this.apply.bindWithEvent(this), apply: this.apply.bindWithEvent(this),
@ -457,7 +471,7 @@ Deluge.Widgets.OptionsPage = new Class({
el.focused = false; el.focused = false;
}); });
}, this); }, this);
new Widgets.Spinner(this.form.max_download_speed, { new Widgets.Spinner(this.form.max_download_speed, {
step: 10, step: 10,
precision: 1, precision: 1,
@ -465,7 +479,7 @@ Deluge.Widgets.OptionsPage = new Class({
high: null, high: null,
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.max_upload_speed, { new Widgets.Spinner(this.form.max_upload_speed, {
step: 10, step: 10,
precision: 1, precision: 1,
@ -473,7 +487,7 @@ Deluge.Widgets.OptionsPage = new Class({
high: null, high: null,
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.max_connections, { new Widgets.Spinner(this.form.max_connections, {
step: 1, step: 1,
precision: 0, precision: 0,
@ -481,7 +495,7 @@ Deluge.Widgets.OptionsPage = new Class({
high: null, high: null,
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.max_upload_slots, { new Widgets.Spinner(this.form.max_upload_slots, {
step: 1, step: 1,
precision: 0, precision: 0,
@ -489,7 +503,7 @@ Deluge.Widgets.OptionsPage = new Class({
high: null, high: null,
low: -1 low: -1
} }
}); });
new Widgets.Spinner(this.form.stop_ratio, { new Widgets.Spinner(this.form.stop_ratio, {
step: 1, step: 1,
precision: 1, precision: 1,
@ -498,11 +512,11 @@ Deluge.Widgets.OptionsPage = new Class({
low: -1 low: -1
} }
}); });
this.form.apply_options.addEvent('click', this.bound.apply); this.form.apply_options.addEvent('click', this.bound.apply);
this.form.reset_options.addEvent('click', this.bound.reset); this.form.reset_options.addEvent('click', this.bound.reset);
}, },
apply: function(event) { apply: function(event) {
if (!this.torrentId) return; if (!this.torrentId) return;
var changed = this.changed[this.torrentId]; var changed = this.changed[this.torrentId];
@ -516,7 +530,7 @@ Deluge.Widgets.OptionsPage = new Class({
}.bindWithEvent(this) }.bindWithEvent(this)
}); });
}, },
clear: function() { clear: function() {
if (!this.form) return; if (!this.form) return;
$$W(this.form.max_download_speed).setValue(0); $$W(this.form.max_download_speed).setValue(0);
@ -531,7 +545,7 @@ Deluge.Widgets.OptionsPage = new Class({
this.form.private.disabled = false; this.form.private.disabled = false;
this.form.prioritize_first_last.checked = false; this.form.prioritize_first_last.checked = false;
}, },
reset: function(event) { reset: function(event) {
if (this.torrentId) { if (this.torrentId) {
delete this.changed[this.torrentId]; delete this.changed[this.torrentId];
@ -543,7 +557,7 @@ Deluge.Widgets.OptionsPage = new Class({
}.bindWithEvent(this) }.bindWithEvent(this)
}); });
}, },
update: function(torrent) { update: function(torrent) {
this.torrentId = torrent.id; this.torrentId = torrent.id;
$each(torrent, function(value, key) { $each(torrent, function(value, key) {

View file

@ -2,11 +2,25 @@
Script: deluge-menus.js Script: deluge-menus.js
Contains the layout for all the popup menus used within the ajax ui. Contains the layout for all the popup menus used within the ajax ui.
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
*/ */
Deluge.Menus = { Deluge.Menus = {
@ -240,7 +254,7 @@ Deluge.Menus = {
} }
] ]
}, },
{type: 'seperator'}, {type: 'seperator'},
{ {
type: 'text', type: 'text',
action: 'update_tracker', action: 'update_tracker',
@ -301,7 +315,7 @@ Deluge.Menus = {
icon: '/static/images/16/move.png' icon: '/static/images/16/move.png'
} }
], ],
Connections: [ Connections: [
{ {
type: 'text', type: 'text',
@ -340,7 +354,7 @@ Deluge.Menus = {
text: _('Unlimited') text: _('Unlimited')
} }
], ],
Download: [ Download: [
{ {
type: 'text', type: 'text',
@ -379,7 +393,7 @@ Deluge.Menus = {
text: _('Unlimited') text: _('Unlimited')
} }
], ],
Upload: [ Upload: [
{ {
type: 'text', type: 'text',

View file

@ -2,11 +2,25 @@
Script: deluge-mime.js Script: deluge-mime.js
Library for converting mimetypes to extensions and vica versa. Library for converting mimetypes to extensions and vica versa.
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
Object: Deluge.Mime Object: Deluge.Mime
@ -136,12 +150,12 @@ Deluge.Mime = {
'.avi': 'video/x-msvideo', '.avi': 'video/x-msvideo',
'.movie': 'video/x-sgi-movie' '.movie': 'video/x-sgi-movie'
}), }),
getMimeType: function(filename) { getMimeType: function(filename) {
var extension = filename.match(/^.*(\.\w+)$/) var extension = filename.match(/^.*(\.\w+)$/)
if (extension) extension = extension[1] if (extension) extension = extension[1]
else return null; else return null;
if (this.types_map.has(extension)) return this.types_map[extension]; if (this.types_map.has(extension)) return this.types_map[extension];
else return null; else return null;
} }

View file

@ -3,11 +3,25 @@ Script: deluge-preferences.js
Contains the classes that provides the preferences window with Contains the classes that provides the preferences window with
functionality functionality
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
*/ */
Deluge.Widgets.PreferencesCategory = new Class({ Deluge.Widgets.PreferencesCategory = new Class({
@ -20,7 +34,7 @@ Deluge.Widgets.PluginPreferencesCategory = new Class({
Deluge.Widgets.GenericPreferences = new Class({ Deluge.Widgets.GenericPreferences = new Class({
Extends: Deluge.Widgets.PreferencesCategory, Extends: Deluge.Widgets.PreferencesCategory,
initialize: function(name, options) { initialize: function(name, options) {
this.parent(name, options) this.parent(name, options)
this.core = true; this.core = true;
@ -41,16 +55,16 @@ Deluge.Widgets.GenericPreferences = new Class({
}); });
}.bindWithEvent(this)); }.bindWithEvent(this));
}, },
update: function(config) { update: function(config) {
this.fireEvent('beforeUpdate'); this.fireEvent('beforeUpdate');
this.original = config; this.original = config;
this.changed = new Hash(); this.changed = new Hash();
this.inputs = this.form.getElements('input, select'); this.inputs = this.form.getElements('input, select');
this.inputs.each(function(input) { this.inputs.each(function(input) {
if (!input.name) return; if (!input.name) return;
if (!$defined(config[input.name])) return; if (!$defined(config[input.name])) return;
widget = $$W(input); widget = $$W(input);
if (widget) { if (widget) {
widget.setValue(config[input.name]); widget.setValue(config[input.name]);
@ -71,7 +85,7 @@ Deluge.Widgets.GenericPreferences = new Class({
input.checked = true; input.checked = true;
} }
} }
input.addEvent('change', function(el) { input.addEvent('change', function(el) {
if (input.type == 'checkbox') { if (input.type == 'checkbox') {
if (this.original[input.name] == input.checked) { if (this.original[input.name] == input.checked) {
@ -111,18 +125,18 @@ Deluge.Widgets.GenericPreferences = new Class({
Deluge.Widgets.WebUIPreferences = new Class({ Deluge.Widgets.WebUIPreferences = new Class({
Extends: Deluge.Widgets.GenericPreferences, Extends: Deluge.Widgets.GenericPreferences,
options: { options: {
url: '/template/render/html/preferences_webui.html' url: '/template/render/html/preferences_webui.html'
}, },
initialize: function() { initialize: function() {
this.parent('Web UI'); this.parent('Web UI');
this.core = false; this.core = false;
this.addEvent('beforeUpdate', this.beforeUpdate.bindWithEvent(this)); this.addEvent('beforeUpdate', this.beforeUpdate.bindWithEvent(this));
this.addEvent('update', this.updated.bindWithEvent(this)); this.addEvent('update', this.updated.bindWithEvent(this));
}, },
beforeUpdate: function(event) { beforeUpdate: function(event) {
var templates = Deluge.Client.get_webui_templates({async: false}); var templates = Deluge.Client.get_webui_templates({async: false});
this.form.template.empty(); this.form.template.empty();
@ -132,16 +146,16 @@ Deluge.Widgets.WebUIPreferences = new Class({
this.form.template.grab(option); this.form.template.grab(option);
}, this); }, this);
}, },
updated: function(event) { updated: function(event) {
if (this.form.template.value != 'ajax') if (this.form.template.value != 'ajax')
this.form.theme.disabled = true; this.form.theme.disabled = true;
else else
this.form.theme.disabled = false; this.form.theme.disabled = false;
var theme = this.form.theme.getElement('option[value="' + Cookie.read('theme') + '"]') var theme = this.form.theme.getElement('option[value="' + Cookie.read('theme') + '"]')
theme.selected = true theme.selected = true
this.form.template.addEvent('change', function(e) { this.form.template.addEvent('change', function(e) {
if (this.form.template.value != 'ajax') { if (this.form.template.value != 'ajax') {
this.form.theme.disabled = true; this.form.theme.disabled = true;
@ -154,7 +168,7 @@ Deluge.Widgets.WebUIPreferences = new Class({
} }
}.bindWithEvent(this)); }.bindWithEvent(this));
}, },
apply: function() { apply: function() {
Deluge.UI.setTheme(this.form.theme.value); Deluge.UI.setTheme(this.form.theme.value);
Deluge.Client.set_webui_config(this.changed, { Deluge.Client.set_webui_config(this.changed, {
@ -173,7 +187,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
title: 'Preferences', title: 'Preferences',
url: '/template/render/html/window_preferences.html' url: '/template/render/html/window_preferences.html'
}, },
initialize: function() { initialize: function() {
this.parent(); this.parent();
this.categories = []; this.categories = [];
@ -181,18 +195,18 @@ Deluge.Widgets.PreferencesWindow = new Class({
this.addEvent('loaded', this.loaded.bindWithEvent(this)); this.addEvent('loaded', this.loaded.bindWithEvent(this));
this.addEvent('beforeShow', this.beforeShown.bindWithEvent(this)); this.addEvent('beforeShow', this.beforeShown.bindWithEvent(this));
}, },
loaded: function(event) { loaded: function(event) {
this.catlist = this.content.getElement('.categories ul'); this.catlist = this.content.getElement('.categories ul');
this.pages = this.content.getElement('.pref_pages'); this.pages = this.content.getElement('.pref_pages');
this.title = this.pages.getElement('h3'); this.title = this.pages.getElement('h3');
this.reset = this.content.getElement('.buttons .reset'); this.reset = this.content.getElement('.buttons .reset');
this.apply = this.content.getElement('.buttons .apply'); this.apply = this.content.getElement('.buttons .apply');
this.apply.addEvent('click', this.applied.bindWithEvent(this)); this.apply.addEvent('click', this.applied.bindWithEvent(this));
this.webui = new Deluge.Widgets.WebUIPreferences(); this.webui = new Deluge.Widgets.WebUIPreferences();
this.download = new Deluge.Widgets.GenericPreferences('Download', { this.download = new Deluge.Widgets.GenericPreferences('Download', {
url: '/template/render/html/preferences_download.html' url: '/template/render/html/preferences_download.html'
}); });
@ -208,7 +222,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
this.queue = new Deluge.Widgets.GenericPreferences('Queue', { this.queue = new Deluge.Widgets.GenericPreferences('Queue', {
url: '/template/render/html/preferences_queue.html' url: '/template/render/html/preferences_queue.html'
}); });
this.addCategory(this.webui); this.addCategory(this.webui);
this.addCategory(this.download); this.addCategory(this.download);
this.addCategory(this.network); this.addCategory(this.network);
@ -216,11 +230,11 @@ Deluge.Widgets.PreferencesWindow = new Class({
this.addCategory(this.daemon); this.addCategory(this.daemon);
this.addCategory(this.queue); this.addCategory(this.queue);
}, },
addCategory: function(category) { addCategory: function(category) {
this.categories.include(category); this.categories.include(category);
var categoryIndex = this.categories.indexOf(category); var categoryIndex = this.categories.indexOf(category);
var tab = new Element('li'); var tab = new Element('li');
tab.set('text', category.name); tab.set('text', category.name);
tab.addEvent('click', function(e) { tab.addEvent('click', function(e) {
@ -230,14 +244,14 @@ Deluge.Widgets.PreferencesWindow = new Class({
this.catlist.grab(tab); this.catlist.grab(tab);
this.pages.grab(category.addClass('deluge-prefs-page')); this.pages.grab(category.addClass('deluge-prefs-page'));
if (this.currentPage < 0) { if (this.currentPage < 0) {
this.currentPage = categoryIndex; this.currentPage = categoryIndex;
this.select(categoryIndex); this.select(categoryIndex);
}; };
}, },
select: function(id) { select: function(id) {
this.categories[this.currentPage].removeClass('deluge-prefs-page-active'); this.categories[this.currentPage].removeClass('deluge-prefs-page-active');
this.categories[this.currentPage].tab.removeClass('deluge-prefs-active'); this.categories[this.currentPage].tab.removeClass('deluge-prefs-active');
@ -247,13 +261,13 @@ Deluge.Widgets.PreferencesWindow = new Class({
this.currentPage = id; this.currentPage = id;
this.fireEvent('pageChanged'); this.fireEvent('pageChanged');
}, },
applied: function(event) { applied: function(event) {
var config = {}; var config = {};
this.categories.each(function(category) { this.categories.each(function(category) {
config = $merge(config, category.getConfig()); config = $merge(config, category.getConfig());
}); });
if ($defined(config['end_listen_port']) || $defined(config['start_listen_port'])) { if ($defined(config['end_listen_port']) || $defined(config['start_listen_port'])) {
var startport = $pick(config['start_listen_port'], this.config['listen_ports'][0]); var startport = $pick(config['start_listen_port'], this.config['listen_ports'][0]);
var endport = $pick(config['end_listen_port'], this.config['listen_ports'][1]); var endport = $pick(config['end_listen_port'], this.config['listen_ports'][1]);
@ -261,7 +275,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
delete config['start_listen_port']; delete config['start_listen_port'];
config['listen_ports'] = [startport, endport]; config['listen_ports'] = [startport, endport];
} }
if ($defined(config['end_outgoing_port']) || $defined(config['start_outgoing_port'])) { if ($defined(config['end_outgoing_port']) || $defined(config['start_outgoing_port'])) {
var startport = $pick(config['start_outgoing_port'], this.config['outgoing_ports'][0]); var startport = $pick(config['start_outgoing_port'], this.config['outgoing_ports'][0]);
var endport = $pick(config['end_outgoing_port'], this.config['outgoing_ports'][1]); var endport = $pick(config['end_outgoing_port'], this.config['outgoing_ports'][1]);
@ -269,7 +283,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
delete config['start_outgoing_port']; delete config['start_outgoing_port'];
config['outgoing_ports'] = [startport, endport]; config['outgoing_ports'] = [startport, endport];
} }
Deluge.Client.set_config(config, { Deluge.Client.set_config(config, {
onSuccess: function(e) { onSuccess: function(e) {
this.hide(); this.hide();
@ -286,7 +300,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
// in order to not have to modify the generic preferences class. // in order to not have to modify the generic preferences class.
this.config['start_listen_port'] = this.config['listen_ports'][0]; this.config['start_listen_port'] = this.config['listen_ports'][0];
this.config['end_listen_port'] = this.config['listen_ports'][1]; this.config['end_listen_port'] = this.config['listen_ports'][1];
this.config['start_outgoing_port'] = this.config['outgoing_ports'][0]; this.config['start_outgoing_port'] = this.config['outgoing_ports'][0];
this.config['end_outgoing_port'] = this.config['outgoing_ports'][1]; this.config['end_outgoing_port'] = this.config['outgoing_ports'][1];
@ -294,7 +308,7 @@ Deluge.Widgets.PreferencesWindow = new Class({
this.categories.each(function(category) { this.categories.each(function(category) {
if (category.update && category.core) category.update(this.config); if (category.update && category.core) category.update(this.config);
}, this); }, this);
// Update the config for the webui pages. // Update the config for the webui pages.
var webconfig = Deluge.Client.get_webui_config({async: false}); var webconfig = Deluge.Client.get_webui_config({async: false});
this.webui.update(webconfig); this.webui.update(webconfig);

View file

@ -2,11 +2,25 @@
Script: deluge-torrent-grid.js Script: deluge-torrent-grid.js
Contains the Deluge torrent grid. Contains the Deluge torrent grid.
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
Class: Deluge.Widgets.TorrentGrid Class: Deluge.Widgets.TorrentGrid
@ -21,7 +35,7 @@ Copyright:
*/ */
Deluge.Widgets.TorrentGrid = new Class({ Deluge.Widgets.TorrentGrid = new Class({
Extends: Widgets.DataGrid, Extends: Widgets.DataGrid,
options: { options: {
columns: [ columns: [
{name: 'number',text: '#',type:'number',width: 20}, {name: 'number',text: '#',type:'number',width: 20},
@ -37,7 +51,7 @@ Deluge.Widgets.TorrentGrid = new Class({
{name: 'avail',text: 'Avail.',type:'number',width: 60} {name: 'avail',text: 'Avail.',type:'number',width: 60}
] ]
}, },
icons: { icons: {
'Downloading': '/pixmaps/downloading16.png', 'Downloading': '/pixmaps/downloading16.png',
'Seeding': '/pixmaps/seeding16.png', 'Seeding': '/pixmaps/seeding16.png',
@ -46,19 +60,19 @@ Deluge.Widgets.TorrentGrid = new Class({
'Error': '/pixmaps/alert16.png', 'Error': '/pixmaps/alert16.png',
'Checking': '/pixmaps/checking16.png' 'Checking': '/pixmaps/checking16.png'
}, },
/* /*
Property: getSelectedTorrentIds Property: getSelectedTorrentIds
Helper function to quickly return the torrent ids of the currently Helper function to quickly return the torrent ids of the currently
selected torrents in the grid. selected torrents in the grid.
Example: Example:
var ids = ''; var ids = '';
grid.getSelectedTorrentIds.each(function(id) { grid.getSelectedTorrentIds.each(function(id) {
ids += id + '\n'; ids += id + '\n';
}); });
alert(ids); alert(ids);
Returns: Returns:
A list containing the currently selected torrent ids. A list containing the currently selected torrent ids.
*/ */
@ -69,14 +83,14 @@ Deluge.Widgets.TorrentGrid = new Class({
}); });
return torrentIds; return torrentIds;
}, },
/* /*
Property: updateTorrents Property: updateTorrents
Event handler for when a list item is clicked Event handler for when a list item is clicked
Arguments: Arguments:
e - The event args e - The event args
Example: Example:
listItem.addEvent('click', this.clicked.bindWithEvent(this)); listItem.addEvent('click', this.clicked.bindWithEvent(this));
*/ */
@ -107,7 +121,7 @@ Deluge.Widgets.TorrentGrid = new Class({
this.addRow(row, true); this.addRow(row, true);
}; };
}, this); }, this);
// remove any torrents no longer in the grid. // remove any torrents no longer in the grid.
this.rows.each(function(row) { this.rows.each(function(row) {
if (!torrents.has(row.id)) { if (!torrents.has(row.id)) {

View file

@ -2,11 +2,25 @@
Script: deluge-ui.js Script: deluge-ui.js
Ties all the other scripts together to build up the Deluge AJAX UI. Ties all the other scripts together to build up the Deluge AJAX UI.
License: *
General Public License v3 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
Copyright: * This program is free software; you can redistribute it and/or modify
Damien Churchill (c) 2008 <damoxc@gmail.com> * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
Object: Deluge.UI Object: Deluge.UI

View file

@ -2,8 +2,24 @@
* Script: deluge.js * Script: deluge.js
* The core script for the deluge ajax ui * The core script for the deluge ajax ui
* *
* Copyright: * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
* Damien Churchill (c) 2008 <damoxc@gmail.com> *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
*/ */
var Deluge = $empty; var Deluge = $empty;
@ -14,13 +30,13 @@ Deluge.Keys = {
'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate', 'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate',
'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', 'upload_payload_rate', 'eta', 'ratio', 'distributed_copies',
'is_auto_managed' 'is_auto_managed'
], ],
Statistics: [ Statistics: [
'total_done', 'total_payload_download', 'total_uploaded', 'total_done', 'total_payload_download', 'total_uploaded',
'total_payload_upload', 'next_announce', 'tracker_status', 'num_pieces', 'total_payload_upload', 'next_announce', 'tracker_status', 'num_pieces',
'piece_length', 'is_auto_managed', 'active_time', 'seeding_time', 'piece_length', 'is_auto_managed', 'active_time', 'seeding_time',
'seed_rank' 'seed_rank'
], ],
Files: [ Files: [
'files', 'file_progress', 'file_priorities' 'files', 'file_progress', 'file_priorities'
], ],

View file

@ -3,8 +3,25 @@
* A script file that is run through the template renderer in order for * A script file that is run through the template renderer in order for
* translated strings to be retrieved. * translated strings to be retrieved.
* *
* Copyright: *
* Damien Churchill (c) 2008 * Copyright (C) Damien Churchill 2008 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*
*/ */
GetText = { GetText = {

View file

@ -383,7 +383,6 @@ setup(
"i18n/*.pot", "i18n/*.pot",
"i18n/*/LC_MESSAGES/*.mo", "i18n/*/LC_MESSAGES/*.mo",
"ui/webui/scripts/*", "ui/webui/scripts/*",
"ui/webui/ssl/*",
"ui/webui/static/*.css", "ui/webui/static/*.css",
"ui/webui/static/*.js", "ui/webui/static/*.js",
"ui/webui/static/images/*.png", "ui/webui/static/images/*.png",