allow changing of global core options

This commit is contained in:
Damien Churchill 2008-08-05 21:30:17 +00:00
parent c902bca4cd
commit 7ade350a3a
1 changed files with 26 additions and 9 deletions

View File

@ -737,20 +737,34 @@ Deluge.Widgets.GenericPreferences = new Class({
});
} else if (input.type == 'text') {
input.value = config[input.name];
this.original[input.name] = input.value;
} else if (input.type == 'checkbox') {
input.checked = config[input.name];
this.original[input.name] = input.checked;
} else if (input.type == 'radio') {
var value = config[input.name].toString()
if (input.value == value) input.checked = true;
}
if (input.value == value) {
input.checked = true;
this.original[input.name] = input.value;
}
}
input.addEvent('change', function(el) {
if (input.type == 'checkbox') {
if (this.original[input.name] == input.checked) {
if (this.changed[input.name])
delete this.changed[input.name];
} else {
this.changed[input.name] = input.checked
}
} else {
if (this.original[input.name] == input.value) {
if (this.changed[input.name])
delete this.changed[input.name];
} else {
this.changed[input.name] = input.value;
}
}
}.bindWithEvent(this))
}, this);
this.fireEvent('update');
@ -897,11 +911,14 @@ Deluge.Widgets.PreferencesWindow = new Class({
applied: function(event) {
var config = {}
/*this.categories.each(function(category) {
alert(JSON.encode(category.changed));
this.categories.each(function(category) {
config = $merge(config, category.changed)
});
alert(JSON.encode(config));*/
Deluge.Client.set_config(config, {
onSuccess: function(e) {
this.hide();
}.bindWithEvent(this)
});
this.webui.apply();
},