Wooh, preference editor! \o/

This commit is contained in:
halex
2007-08-26 00:54:28 +00:00
parent 35526da57b
commit 51a8b612db
3 changed files with 44 additions and 55 deletions
+2 -22
View File
@@ -81,24 +81,6 @@ Dragonfly.AddressBook.saveContact = function (contact)
});
};
Dragonfly.AddressBook.saveContactBlocking = function (contact)
{
var d = Dragonfly, loc, request;
if (contact.bongoId) {
loc = new d.Location ({ tab: 'addressbook', contact: contact.bongoId });
request = d.request ('PUT', loc.getServerUrl(), contact);
} else {
loc = new d.Location ({ tab: 'addressbook'});
request = d.requestJSONRPC ('createContact', loc, contact);
}
var result = request.result;
contact.bongoId = result.bongoId;
Dragonfly.AddressBook.contactMap[result.bongoId] = contact;
return result;
};
Dragonfly.AddressBook.delContact = function (bongoId)
{
var d = Dragonfly;
@@ -724,10 +706,8 @@ Dragonfly.AddressBook.UserProfile.prototype.save = function ()
this.serializeContact();
this.fname = this.contact.fn;
var r = Dragonfly.AddressBook.saveContactBlocking (this.contact);
this.bongoId = r.bongoId;
return r;
var AB = Dragonfly.AddressBook;
return AB.saveContact (this.contact);
};
Dragonfly.AddressBook.UserProfile.prototype.serializeContact = function ()
+40 -32
View File
@@ -337,41 +337,49 @@ Dragonfly.Preferences.Editor.save = function ()
// User profile
Dragonfly.notify (_('Saving changes...'), true);
var result = this.profileEditor.save();
// User prefs
p.prefs.addressbook.me = this.profileEditor.bongoId || this.oldId || 0;
var result = this.profileEditor.save().addCallbacks(bind(
function (result) {
// User prefs
p.prefs.addressbook.me = result.bongoId || this.oldId || 0;
// Mail prefs
p.prefs.mail.from = $('from').value;
p.prefs.mail.sender = this.profileEditor.fname || 'BUG!';
p.prefs.mail.autoBcc = $('autobcc').value;
p.prefs.mail.pageSize = $('mailpagesize').value;
p.prefs.mail.signature = $('signature').value;
p.prefs.mail.usesig = $('usesig').checked;
p.prefs.mail.colorQuotes = $('colorquotes').checked;
// Calendar prefs
p.prefs.calendar.defaultView = $('defaultcalview').value;
p.prefs.calendar.dayStart = 7; // Yes, hardwire this one (for now)!
p.prefs.calendar.sharePublicDefault = $('calshareyes').checked;
// Composer prefs
p.prefs.composer = {};
p.prefs.composer.messageType = $('defaultcompose').value;
p.prefs.composer.lineWidth = $('linewidth').value;
// Finish up
p.save();
// Timezone
d.setCurrentTzid (d.tzselector.getTzid());
Dragonfly.notify (_('Changes saved.'));
this.dispose();
// Mail prefs
p.prefs.mail.from = $('from').value;
p.prefs.mail.sender = this.profileEditor.fname || 'BUG!';
p.prefs.mail.autoBcc = $('autobcc').value;
p.prefs.mail.pageSize = $('mailpagesize').value;
p.prefs.mail.signature = $('signature').value;
p.prefs.mail.usesig = $('usesig').checked;
p.prefs.mail.colorQuotes = $('colorquotes').checked;
// Calendar prefs
p.prefs.calendar.defaultView = $('defaultcalview').value;
p.prefs.calendar.dayStart = 7; // Yes, hardwire this one (for now)!
p.prefs.calendar.sharePublicDefault = $('calshareyes').checked;
// Composer prefs
p.prefs.composer = {};
p.prefs.composer.messageType = $('defaultcompose').value;
p.prefs.composer.lineWidth = $('linewidth').value;
// Finish up
p.save();
// Timezone
d.setCurrentTzid (d.tzselector.getTzid());
Dragonfly.notify (_('Changes saved.'));
this.dispose();
}, this), bind('showError', this));
};
Dragonfly.Preferences.Editor.showError = function (req)
{
var d = Dragonfly;
d.notifyError("We had a woopsie when we tried to save your prefs.", null, false);
this.dispose();
}
Dragonfly.Preferences.Editor.dispose = function ()
{
var d = Dragonfly;
+2 -1
View File
@@ -1,6 +1,7 @@
/*
eArea - a simple web-based text editor
Copyright (C) 2006 Oliver Moran
Copyright (C) 2006 Oliver Moran
Major modifications by Alexander Hixon <hixon.alexander@mediati.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public