* Fix logged out message.
* Dragonfly version is now 'M3' in SVN, not SVN r2483+. * Added popup-hide handler (isn't hooked up yet). * Removed FakeFriendPopup - wasn't used. * Removed 'This is Me'. * We now have a user profile in preferences. * Cleaned up a bit of the Prefs builder, including translated and clickable labels.
This commit is contained in:
+158
-86
@@ -280,83 +280,6 @@ Dragonfly.AddressBook.ContactPicker.prototype.newContactHandler = function (evt)
|
||||
this.popup.edit (evt, contact, this.newContactId);
|
||||
};
|
||||
|
||||
// The FakeFriendPopup manages the interaction for unknown contacts.
|
||||
Dragonfly.AddressBook.FakeFriendPopup = function (elem)
|
||||
{
|
||||
Dragonfly.PopupBuble.apply (this, arguments);
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.FakeFriendPopup.prototype = clone (Dragonfly.PopupBuble.prototype)
|
||||
Dragonfly.AddressBook.FakeFriendPopup.prototype.dispose =
|
||||
Dragonfly.AddressBook.FakeFriendPopup.prototype.disposeZone = function ()
|
||||
{
|
||||
this.hide();
|
||||
delete this.contact;
|
||||
delete this.formNames;
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.FakeFriendPopup.prototype.summarize = function (contact, elem)
|
||||
{
|
||||
var d = Dragonfly;
|
||||
|
||||
this.hide ();
|
||||
this.setClosable (true);
|
||||
this.contact = contact = (contact) ? contact : this.contact;
|
||||
|
||||
var editId = d.nextId ('person-add');
|
||||
|
||||
var html = new d.HtmlBuilder();
|
||||
html.push ('<p><b>' + contact.fn + '</b>');
|
||||
html.push ('<table><tr>');
|
||||
html.push ('<td><ul>');
|
||||
var i;
|
||||
if (contact.email) {
|
||||
html.push ('<li><a href="mailto:', contact.email, '">');
|
||||
html.push (contact.email.value, '</a>');
|
||||
}
|
||||
html.push ('</ul></td></tr></table>');
|
||||
|
||||
var loc = new d.Location ({ tab: 'mail', set:'all', handler:'contacts',
|
||||
contact: contact.bongoId });
|
||||
html.push ('<div class="actions">',
|
||||
'<a href="#', loc.getClientUrl(), '">', _('Show Conversations'), '</a>',
|
||||
'<a id="', editId, '">', _('Add'), '</a></div>');
|
||||
html.set (this.contentId);
|
||||
|
||||
Event.observe (editId, 'click', this.add.bindAsEventListener (this));
|
||||
this.showVertical (elem);
|
||||
}
|
||||
|
||||
Dragonfly.AddressBook.FakeFriendPopup.prototype.add = function ()
|
||||
{
|
||||
var AB = Dragonfly.AddressBook;
|
||||
this.serializeContact();
|
||||
this.elem.innerHTML = this.contact.fn;
|
||||
|
||||
Dragonfly.notify (_('Saving changes...'), true);
|
||||
AB.saveContact (this.contact).addCallbacks (bind (
|
||||
function (result) {
|
||||
// update preferences with contact ID
|
||||
if (this.setMyContact) {
|
||||
var id = (this.myId == '') ? result.bongoId : this.myId;
|
||||
AB.Preferences.setMyContactId (id);
|
||||
}
|
||||
|
||||
// Create sidebox element if this is a new contact
|
||||
if (result.bongoId) {
|
||||
this.contact.bongoId = result.bongoId;
|
||||
this.setElem (AB.sideboxPicker.addItem (this.contact.fn, result.bongoId));
|
||||
$(this.elem).scrollIntoView();
|
||||
}
|
||||
|
||||
Dragonfly.notify (_('Changes saved.'));
|
||||
this.summarize ();
|
||||
this.shouldAutohide = true;
|
||||
callLater (2, bind ('autohide', this));
|
||||
return result;
|
||||
}, this), bind ('showError', this));
|
||||
};
|
||||
|
||||
// The ContactPopup manages the interaction for creating and editing contacts
|
||||
Dragonfly.AddressBook.ContactPopup = function (elem)
|
||||
{
|
||||
@@ -482,14 +405,14 @@ Dragonfly.AddressBook.ContactPopup.prototype.loadContact = function ()
|
||||
|
||||
var form = $(this.formId);
|
||||
form.fn.value = this.contact.fn;
|
||||
var myId = AB.Preferences.getMyContactId();
|
||||
//var myId = AB.Preferences.getMyContactId();
|
||||
|
||||
logDebug('myID: ' + myId);
|
||||
//logDebug('myID: ' + myId);
|
||||
logDebug('form id: ' + form);
|
||||
logDebug('this.contact: ' + this.contact);
|
||||
logDebug('this.contact.fn: ' + this.contact.fn);
|
||||
|
||||
form.isMyContact.checked = myId && (myId == this.contact.bongoId);
|
||||
//form.isMyContact.checked = myId && (myId == this.contact.bongoId);
|
||||
|
||||
for (var i = 0; i < Fields.props.length; i++) {
|
||||
var prop = Fields.props[i];
|
||||
@@ -515,13 +438,13 @@ Dragonfly.AddressBook.ContactPopup.prototype.serializeContact = function ()
|
||||
var form = $(this.formId);
|
||||
contact.fn = form.fn.value;
|
||||
|
||||
if (form.isMyContact.checked) {
|
||||
/*if (form.isMyContact.checked) {
|
||||
this.setMyContact = true;
|
||||
this.myId = this.contact.bongoId || '';
|
||||
} else if (this.contact.bongoId == AB.Preferences.getMyContactId()) {
|
||||
this.setMyContact = true;
|
||||
this.myId = null;
|
||||
}
|
||||
}*/
|
||||
|
||||
// clear out existing properties
|
||||
forEach (props, function (prop) { delete contact[prop]; });
|
||||
@@ -602,8 +525,7 @@ Dragonfly.AddressBook.ContactPopup.prototype.edit = function (evt, contact, elem
|
||||
|
||||
var form = [
|
||||
'<form id="', this.formId, '"><img style="float:left; margin-right:5px;" align="middle" ',
|
||||
'src="img/contact-unknown.png"><div><p><input style="width:75%;" name="fn"><p><label>',
|
||||
'<input type="checkbox" name="isMyContact">', _('This is Me'), '</label></div>', notebook, '</form>'];
|
||||
'src="img/contact-unknown.png"><div><p><input style="width:75%;" name="fn"></div>', notebook, '</form>'];
|
||||
|
||||
var actions = [{ value: _('Cancel'), onclick: 'dispose'}, { value: _('Save'), onclick: 'save'}];
|
||||
if (this.contact.bongoId) { // only add delete for pre-existing contacts
|
||||
@@ -642,10 +564,10 @@ Dragonfly.AddressBook.ContactPopup.prototype.save = function ()
|
||||
AB.saveContact (this.contact).addCallbacks (bind (
|
||||
function (result) {
|
||||
// update preferences with contact ID
|
||||
if (this.setMyContact) {
|
||||
/*if (this.setMyContact) {
|
||||
var id = (this.myId == '') ? result.bongoId : this.myId;
|
||||
AB.Preferences.setMyContactId (id);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Create sidebox element if this is a new contact
|
||||
if (result.bongoId) {
|
||||
@@ -678,3 +600,153 @@ Dragonfly.AddressBook.ContactPopup.prototype.delConfirm = function ()
|
||||
this.show();
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile = function (elem)
|
||||
{
|
||||
this.formId = elem;
|
||||
this.bongoId = null;
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype = {};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype.build = function (contact)
|
||||
{
|
||||
var d = Dragonfly;
|
||||
|
||||
this.contact = contact;
|
||||
|
||||
this.formNames = { };
|
||||
|
||||
var notebook = new d.Notebook();
|
||||
for (var i = 0; i < Dragonfly.AddressBook.ContactPopup.prototype.Form.length; i++) {
|
||||
var tab = d.AddressBook.ContactPopup.prototype.Form[i];
|
||||
var page = notebook.appendPage (tab.category);
|
||||
this.buildTab (new d.HtmlBuilder(), tab).set(page);
|
||||
}
|
||||
|
||||
var html = new d.HtmlBuilder ();
|
||||
html.push ('<img style="float:left; margin-right:5px;" align="middle" ',
|
||||
'src="img/contact-unknown.png"><div><p><input style="width:75%;" name="fn"></div>');
|
||||
d.HtmlBuilder.buildChild(html, notebook);
|
||||
|
||||
html.set(this.formId);
|
||||
|
||||
//var actions = [{ value: _('Save'), onclick: 'save'}];
|
||||
//Dragonfly.Preferences.Editor.buildInterface (form, actions, this.belement);
|
||||
|
||||
if (this.contact != null)
|
||||
{
|
||||
this.loadContact();
|
||||
}
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype.loadContact = function ()
|
||||
{
|
||||
var AB = Dragonfly.AddressBook;
|
||||
var Fields = AB.ContactPopup.prototype.FieldTypes;
|
||||
|
||||
var form = $(this.formId);
|
||||
form.fn.value = this.contact.fn;
|
||||
|
||||
//logDebug('myID: ' + myId);
|
||||
|
||||
//form.isMyContact.checked = myId && (myId == this.contact.bongoId);
|
||||
|
||||
for (var i = 0; i < Fields.props.length; i++) {
|
||||
var prop = Fields.props[i];
|
||||
var values = this.contact[prop];
|
||||
if (!values) {
|
||||
continue;
|
||||
}
|
||||
for (var j = 0; j < values.length; j++) {
|
||||
var value = values[j];
|
||||
var input = this.getFreeField (AB.ContactPopup.prototype.getName (prop, value.type), false);
|
||||
if (input) {
|
||||
input.value = $V(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype.getFreeField = function (name, asString)
|
||||
{
|
||||
if (asString) {
|
||||
var n = this.formNames[name];
|
||||
n = (n == undefined) ? 0 : n + 1;
|
||||
this.formNames[name] = n;
|
||||
return name + String (n);
|
||||
}
|
||||
return $(this.formId)[name+'0'];
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype.buildTab = function (html, tab)
|
||||
{
|
||||
var fields = tab.fields;
|
||||
var formFields = this.formFields;
|
||||
|
||||
html.push ('<ul class="form-list">');
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
var field = fields[i];
|
||||
|
||||
var name = Dragonfly.AddressBook.ContactPopup.prototype.getName (field.prop, [tab.type, field.type]);
|
||||
name = this.getFreeField (name, true);
|
||||
html.push ('<li><label>', _(field.label), '</label>');
|
||||
if (field.longtext) {
|
||||
html.push ('<textarea name="', name, '"></textarea>');
|
||||
} else {
|
||||
html.push ('<input name="', name, '">');
|
||||
}
|
||||
html.push ('</li>');
|
||||
}
|
||||
html.push ('</ul>');
|
||||
return html;
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype.save = function ()
|
||||
{
|
||||
var AB = Dragonfly.AddressBook;
|
||||
this.serializeContact();
|
||||
//this.elem.innerHTML = this.contact.fn;
|
||||
|
||||
AB.saveContact (this.contact).addCallbacks (bind (
|
||||
function (result) {
|
||||
// update preferences with contact ID
|
||||
if (result.bongoId)
|
||||
{
|
||||
this.bongoId = result.bongoId;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bongoId = AB.Preferences.getMyContactId();
|
||||
}
|
||||
|
||||
return result;
|
||||
}, this));
|
||||
};
|
||||
|
||||
Dragonfly.AddressBook.UserProfile.prototype.serializeContact = function ()
|
||||
{
|
||||
var AB = Dragonfly.AddressBook;
|
||||
var props = AB.ContactPopup.prototype.FieldTypes.props;
|
||||
var contact = this.contact;
|
||||
var form = $(this.formId);
|
||||
contact.fn = form.fn.value;
|
||||
|
||||
// clear out existing properties
|
||||
forEach (props, function (prop) { delete contact[prop]; });
|
||||
|
||||
for (var name in this.formNames) { // for each type of field
|
||||
var count = this.formNames[name];
|
||||
var components = name.split ('-');
|
||||
var prop = components[0];
|
||||
var types = components.slice(1);
|
||||
|
||||
for (var i = 0; i <= count; i++) { // for each field
|
||||
var value = form[name+String(i)].value;
|
||||
if (value && value != '') {
|
||||
var proparray = contact[prop] || [ ];
|
||||
proparray.push ({value:value, type:types});
|
||||
contact[prop] = proparray;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,17 +65,11 @@ Dragonfly.Calendar.BongoCalendar.prototype.parseJSON = function (jsob)
|
||||
{
|
||||
var d = Dragonfly;
|
||||
|
||||
// TODO: This is really nasty.
|
||||
function calColor (calname)
|
||||
{
|
||||
return {
|
||||
'Personal': 'blue',
|
||||
'Red Sox': 'red',
|
||||
'US Holidays': 'orange',
|
||||
'Holidays': 'orange',
|
||||
'The Moon': 'gray',
|
||||
'Novell': 'red',
|
||||
'openSUSE': 'green',
|
||||
'Meetings': 'brown'
|
||||
}[calname] || d.getRandomColor();
|
||||
}
|
||||
@@ -95,7 +89,6 @@ Dragonfly.Calendar.BongoCalendar.prototype.parseJSON = function (jsob)
|
||||
|
||||
this.subscriptionUrl = "/user/" + d.userName + "/calendar/" + d.escapeHTML(this.cal.name) + "/events";
|
||||
|
||||
/*
|
||||
// this should probably trust the server...
|
||||
switch (this.type) {
|
||||
case 'personal':
|
||||
@@ -112,7 +105,6 @@ Dragonfly.Calendar.BongoCalendar.prototype.parseJSON = function (jsob)
|
||||
this.cal.username = jsob.username;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
Dragonfly.Calendar.BongoCalendar.prototype.refresh = function ()
|
||||
|
||||
+23
-8
@@ -1,6 +1,6 @@
|
||||
Dragonfly = {
|
||||
title: 'Bongo',
|
||||
version: 'SVN r2483+',
|
||||
version: 'M3',
|
||||
userName: '',
|
||||
tabs: { },
|
||||
NAME: 'Dragonfly'
|
||||
@@ -937,16 +937,13 @@ Dragonfly.start = function ()
|
||||
d.translateElements();
|
||||
|
||||
d.setLoginMessage (_('Logged in: loading contacts and calendars...'));
|
||||
|
||||
// setup the preferences dialog tabs
|
||||
//d.setupPrefs();
|
||||
|
||||
|
||||
// set current timezone to default and build timezone selector
|
||||
d.curTzid = c.Preferences.getDefaultTimezone();
|
||||
//d.tzselector = new d.TzSelector (d.curTzid, 'tzselect', true);
|
||||
//d.tzselector.setChangeListener (function () { d.setCurrentTzid (d.tzselector.getTzid()); });
|
||||
|
||||
var def = new d.MultiDeferred ([ c.loadCalendars(),
|
||||
/*var def = new d.MultiDeferred ([ c.loadCalendars(),
|
||||
d.AddressBook.sideboxPicker.load() ]);*/
|
||||
var def = new DeferredList ([ c.loadCalendars(),
|
||||
d.AddressBook.sideboxPicker.load() ]);
|
||||
return def.addCallbacks (
|
||||
function (res) {
|
||||
@@ -965,8 +962,12 @@ Dragonfly.start = function ()
|
||||
$('login-password').value = '';
|
||||
Element.setText ('user-name', d.userName);
|
||||
Element.setHTML ('logout-text', d.format(_('Log out {0}...'), d.userName));
|
||||
Dragonfly.logoutMessage = _('You have logged out successfully.');
|
||||
showElement ('content');
|
||||
|
||||
// Listen for clicks to main content thing, so we can hide popups.
|
||||
Event.observe ('content', 'click', Dragonfly.hidePopups.bindAsEventListener(this));
|
||||
|
||||
// Add administration link if we're admin
|
||||
if (d.userName == 'admin')
|
||||
{
|
||||
@@ -1030,6 +1031,20 @@ Dragonfly.initHtmlZones = function ()
|
||||
Event.observe (window, 'unload', bind ('disposeZone', d.contentZone));
|
||||
};
|
||||
|
||||
Dragonfly.hidePopups = function ()
|
||||
{
|
||||
if (Dragonfly.lastPopup)
|
||||
{
|
||||
Dragonfly.lastPopup.dispose();
|
||||
logDebug('Attempted popup dispose complete.');
|
||||
Dragonfly.lastPopup = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
logDebug('Nothing to dispose');
|
||||
}
|
||||
}
|
||||
|
||||
Dragonfly.main = function ()
|
||||
{
|
||||
Dragonfly.browserDetect();
|
||||
|
||||
+1
-2
@@ -110,7 +110,6 @@ Dragonfly.translateLogin = function ()
|
||||
Element.setHTML ('login-language-label', _('Language'));
|
||||
Element.setHTML ('login-default-label', _('Remember me'));
|
||||
$('login-button').value = _('Login');
|
||||
Dragonfly.logoutMessage = _('You have logged out successfully.');
|
||||
};
|
||||
|
||||
Dragonfly.languageSuccess = function ()
|
||||
@@ -193,7 +192,7 @@ Dragonfly.showLoginPane = function ()
|
||||
|
||||
if (location.hash == '#LoggedOut') {
|
||||
Dragonfly.setLoginMessage (Dragonfly.logoutMessage);
|
||||
d.langFaliure = true; // Stops us from removing the 'You have logged out' message when we load the lang.
|
||||
Dragonfly.langFaliure = true; // Stops us from removing the 'You have logged out' message when we load the lang.
|
||||
location.hash = (Dragonfly.isWebkit) ? '' : '#';
|
||||
$('login-user').focus();
|
||||
} else {
|
||||
|
||||
+117
-85
@@ -241,90 +241,90 @@ Dragonfly.Preferences.Editor.parsePath = function (loc, path)
|
||||
Dragonfly.Preferences.Editor.build = function (loc)
|
||||
{
|
||||
var d = Dragonfly;
|
||||
var showmethemoney = true;
|
||||
|
||||
Element.setHTML ('toolbar', '');
|
||||
Element.hide ('toolbar');
|
||||
|
||||
var html = new d.HtmlBuilder ();
|
||||
// First, build the container.
|
||||
html.push ('<div id="preferences-container">', '</div>');
|
||||
html.set ('content-iframe');
|
||||
|
||||
if (!showmethemoney)
|
||||
{
|
||||
// Push the following HTML if we haven't completed our handler!
|
||||
html.push ('<div id="search-no-results" class="scrollv">', '<table style="margin: auto;"><tr>',
|
||||
'<td><img src="img/big-info.png" style="float: left;" /></td>',
|
||||
'<td style="vertical-align:middle;"><h3>The Preferences editor goes here! <code>:)</code></h3></td>',
|
||||
'</tr></table></div>');
|
||||
|
||||
html.set ('content-iframe');
|
||||
}
|
||||
else
|
||||
{
|
||||
// First, build the container.
|
||||
html.push ('<div id="preferences-container">', '</div>');
|
||||
html.set ('content-iframe');
|
||||
|
||||
// Come up with some magic tabs!
|
||||
var notebook = new d.Notebook();
|
||||
var userpage = notebook.appendPage('About Me');
|
||||
var composerpage = notebook.appendPage('Mail');
|
||||
var calendarpage = notebook.appendPage('Calendar');
|
||||
|
||||
var userhtml = new d.HtmlBuilder ();
|
||||
userhtml.push ('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label>Name:</label></td>',
|
||||
'<td><input type="text"></td></tr>',
|
||||
'<tr><td><label>Timezone:</label></td>',
|
||||
'<td><span id="tzpicker"></span></td></tr>',
|
||||
'</table>');
|
||||
userhtml.set (userpage);
|
||||
|
||||
var composerhtml = new d.HtmlBuilder ();
|
||||
composerhtml.push ('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label>', _('From address:'), '</label></td>',
|
||||
'<td><input type="text" id="from" /></td></tr>',
|
||||
'<tr><td colspan="2"><span style="font-size: 80%;">Please don\'t abuse the above feature for now.</span></td></tr>',
|
||||
'<tr><td><label>', _('Auto BCC:'), '</label></td>',
|
||||
'<td><input type="text" id="autobcc" /></td></tr>',
|
||||
'<tr><td><label>', _('Signature:'), '</label></td>',
|
||||
'<td><textarea rows="3" cols="30" id="signature"></textarea><br />',
|
||||
'<input type="checkbox" id="usesig" name="usesig" /><label for="usesig">', _('Apply signature to outgoing mail'), '</label>',
|
||||
'</td></tr>',
|
||||
'<tr><td><label>', _('Show HTML messages:'), '</label></td>',
|
||||
'<td><select id="htmlmsg"><option value="show">', _('Yes'), '</option><option value="ptext">', _('Prefer plain-text'), '</option><option value="hide">', _('No'), '</option></select></td></tr>',
|
||||
'<tr><td><label>', _('Page size:'), '</label></td>',
|
||||
'<td><input type="text" style="width: 20px;" id="mailpagesize"> ', _('items'), '</td></tr>',
|
||||
'<tr><td colspan="2"><input type="checkbox" id="colorquotes" name="colorquotes" checked /><label for="colorquotes">', _('Colorize quotes in plaintext messages.'), '</label></td>',
|
||||
'</table>');
|
||||
composerhtml.set (composerpage);
|
||||
|
||||
var calendarhtml = new d.HtmlBuilder ();
|
||||
calendarhtml.push ('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label>', _('Default view:'), '</label></td>',
|
||||
'<td><select id="defaultcalview">',
|
||||
'<option value="month">', _('Month'), '</option>',
|
||||
'<option value="week">', _('Week'), '</option>',
|
||||
'<option value="upcoming">', _('Upcoming'), '</option>',
|
||||
'<option value="day">', _('Day'), '</option>',
|
||||
'</select></td></tr>',
|
||||
// Come up with some magic tabs!
|
||||
var notebook = new d.Notebook();
|
||||
var userpage = notebook.appendPage('General');
|
||||
var mailpage = notebook.appendPage('Mail');
|
||||
var calendarpage = notebook.appendPage('Calendar');
|
||||
var composerpage = notebook.appendPage('Composer');
|
||||
|
||||
var userhtml = new d.HtmlBuilder ();
|
||||
userhtml.push ('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label>', _('Profile:'), '</td><td><form id="userprofile">', '</form></td></tr>',
|
||||
'<tr><td><label>', _('Timezone:'), '</label></td>',
|
||||
'<td><span id="tzpicker"></span></td></tr>',
|
||||
'</table>');
|
||||
userhtml.set (userpage);
|
||||
|
||||
var mailhtml = new d.HtmlBuilder ();
|
||||
mailhtml.push ('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label for="from">', _('From address:'), '</label></td>',
|
||||
'<td><input type="text" id="from" name="from" /></td></tr>',
|
||||
'<tr><td colspan="2"><span style="font-size: 80%;">Please don\'t abuse the above feature for now.</span></td></tr>',
|
||||
'<tr><td><label for="autobcc">', _('Auto BCC:'), '</label></td>',
|
||||
'<td><input type="text" name="autobcc" id="autobcc" /></td></tr>',
|
||||
'<tr><td><label for="signature">', _('Signature:'), '</label></td>',
|
||||
'<td><textarea rows="3" cols="30" name="signature" id="signature"></textarea><br />',
|
||||
'<input type="checkbox" id="usesig" name="usesig" /><label for="usesig">', _('Apply signature to outgoing mail'), '</label>',
|
||||
'</td></tr>',
|
||||
'<tr><td><label for="htmlmsg">', _('Show HTML messages:'), '</label></td>',
|
||||
'<td><select id="htmlmsg" name="htmlmsg"><option value="show">', _('Yes'), '</option><option value="ptext">', _('Prefer plain-text'), '</option><option value="hide">', _('No'), '</option></select></td></tr>',
|
||||
'<tr><td><label for="mailpagesize">', _('Page size:'), '</label></td>',
|
||||
'<td><input type="text" style="width: 20px;" name="mailpagesize" id="mailpagesize"> ', _('items'), '</td></tr>',
|
||||
'<tr><td colspan="2"><input type="checkbox" id="colorquotes" name="colorquotes" checked /><label for="colorquotes">', _('Colorize quotes in plain-text messages.'), '</label></td>',
|
||||
'</table>');
|
||||
mailhtml.set (mailpage);
|
||||
|
||||
var calendarhtml = new d.HtmlBuilder ();
|
||||
calendarhtml.push ('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label for="defaultcalview">', _('Default view:'), '</label></td>',
|
||||
'<td><select name="defaultcalview" id="defaultcalview">',
|
||||
'<option value="month">', _('Month'), '</option>',
|
||||
'<option value="week">', _('Week'), '</option>',
|
||||
'<option value="upcoming">', _('Upcoming'), '</option>',
|
||||
'<option value="day">', _('Day'), '</option>',
|
||||
'</select></td></tr>',
|
||||
'<tr><td><label>', _('Share with others by default?'), '</label></td>',
|
||||
'<input type="radio" name="calshare" value="public" id="calshareyes"><label for="calshareyes">Yes</label> ',
|
||||
'<input type="radio" name="calshare" value="private" id="calshareno"><label for="calshareno">No</label>',
|
||||
'</td></tr>',
|
||||
// '<tr><td><label>Day start:</label></td>',
|
||||
// '<td><input type="text" style="width: 20px;" id="daystart" value="7"></td></tr>',
|
||||
'</table>');
|
||||
calendarhtml.set (calendarpage);
|
||||
|
||||
var form = [
|
||||
'<form id="someid">', notebook, '</form>'];
|
||||
|
||||
var actions = [{ value: _('Cancel'), onclick: 'dispose'}, { value: _('Save'), onclick: 'save'}];
|
||||
|
||||
// Now, fill in the content with tabs & buttons.
|
||||
this.contentId = 'preferences-container';
|
||||
this.buildInterface (form, actions);
|
||||
logDebug('Created UI OK - setting up TzSelector widget...');
|
||||
|
||||
// Setup timezone widget
|
||||
d.tzselector = new d.TzSelector (d.curTzid, 'tzpicker', true);
|
||||
}
|
||||
'</table>');
|
||||
calendarhtml.set (calendarpage);
|
||||
|
||||
var composerhtml = new d.HtmlBuilder();
|
||||
composerhtml.push('<table border="0" cellspacing="0">',
|
||||
'<tr><td><label for="defaultcompose">', _('Default message format:'), '</label></td>',
|
||||
'<td><select name="defaultcompose" id="defaultcompose">',
|
||||
'<option value="html">', _('HTML'), '</option>',
|
||||
'<option value="text">', _('Plain-text'), '</option>',
|
||||
'</select></td></tr>',
|
||||
'<tr><td><label for="linewidth">', _('Line width:'), '</label></td>',
|
||||
'<td><input type="text" id="linewidth" name="linewidth" style="width: 20px;"></td></tr>',
|
||||
'</table>');
|
||||
composerhtml.set(composerpage);
|
||||
|
||||
var form = [
|
||||
'<form id="someid">', notebook, '</form>'];
|
||||
|
||||
var actions = [{ value: _('Cancel'), onclick: 'dispose'}, { value: _('Save'), onclick: 'save'}];
|
||||
|
||||
// Now, fill in the content with tabs & buttons.
|
||||
this.buildInterface (form, actions, 'preferences-container');
|
||||
logDebug('Created UI OK - setting up TzSelector widget...');
|
||||
|
||||
// Setup timezone widget
|
||||
d.tzselector = new d.TzSelector (d.curTzid, 'tzpicker', true);
|
||||
|
||||
logDebug('We just got built.');
|
||||
};
|
||||
@@ -335,6 +335,11 @@ Dragonfly.Preferences.Editor.save = function ()
|
||||
var d = Dragonfly;
|
||||
var p = d.Preferences;
|
||||
|
||||
// User profile
|
||||
Dragonfly.notify (_('Saving changes...'), true);
|
||||
var result = this.profileEditor.save();
|
||||
p.prefs.addressbook.me = this.profileEditor.bongoId;
|
||||
|
||||
// Timezone
|
||||
d.setCurrentTzid (d.tzselector.getTzid());
|
||||
|
||||
@@ -349,9 +354,16 @@ Dragonfly.Preferences.Editor.save = function ()
|
||||
// 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');
|
||||
p.prefs.composer.lineWidth = $('linewidth');
|
||||
|
||||
// Finish up
|
||||
p.save();
|
||||
Dragonfly.notify (_('Changes saved.'));
|
||||
this.dispose();
|
||||
};
|
||||
|
||||
@@ -379,20 +391,40 @@ Dragonfly.Preferences.Editor.load = function (loc, jsob)
|
||||
logWarning('You have no prefs. I should probably warn you, or.. something.');
|
||||
}
|
||||
|
||||
if (jsob.mail.autoBcc) { $('autobcc').value = jsob.mail.autoBcc; }
|
||||
if (jsob.mail.pageSize) { $('mailpagesize').value = jsob.mail.pageSize; }
|
||||
if (jsob.mail.signature) { $('signature').value = jsob.mail.signature; }
|
||||
if (jsob.mail.usesig) { $('usesig').checked = jsob.mail.usesig; }
|
||||
if (jsob.mail.colorQuotes) { $('colorquotes').checked = jsob.mail.colorQuotes; }
|
||||
if (jsob.mail && jsob.mail.autoBcc) { $('autobcc').value = jsob.mail.autoBcc; }
|
||||
if (jsob.mail && jsob.mail.pageSize) { $('mailpagesize').value = jsob.mail.pageSize; }
|
||||
if (jsob.mail && jsob.mail.signature) { $('signature').value = jsob.mail.signature; }
|
||||
if (jsob.mail && jsob.mail.usesig) { $('usesig').checked = jsob.mail.usesig; }
|
||||
if (jsob.mail && jsob.mail.colorQuotes) { $('colorquotes').checked = jsob.mail.colorQuotes; }
|
||||
|
||||
// Calendar prefs
|
||||
if (jsob.calendar.defaultView) { $('defaultcalview').value = jsob.calendar.defaultView; }
|
||||
if (jsob.calendar && jsob.calendar.defaultView) { $('defaultcalview').value = jsob.calendar.defaultView; }
|
||||
if (jsob.calendar && jsob.calendar.sharePublicDefault) { $('calshareyes').checked = jsob.calendar.sharePublicDefault; $('calshareno').checked = !jsob.calendar.sharePublicDefault } else { $('calshareno').checked = true; }
|
||||
//if (jsob.calendar.dayStart) { $('daystart').value = jsob.calendar.dayStart; }
|
||||
|
||||
// Composer prefs
|
||||
if (jsob.composer && jsob.composer.messageType) { $('defaultcompose').value = jsob.composer.messageType; }
|
||||
if (jsob.composer && jsob.composer.lineWidth) { $('linewidth').value = jsob.composer.lineWidth ; } else { $('linewidth').value = '80'; }
|
||||
|
||||
// Now, load up the profile editor!
|
||||
var pe = new d.AddressBook.UserProfile('userprofile');
|
||||
if (jsob.addressbook.me && jsob.addressbook.me != null)
|
||||
{
|
||||
// We've already setup our profile - load it!
|
||||
d.AddressBook.loadContact(jsob.addressbook.me).addCallback(bind ('build', pe));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Build empty profile editor UI.
|
||||
pe.build(Dragonfly.AddressBook.buildNewContact());
|
||||
}
|
||||
|
||||
this.profileEditor = pe;
|
||||
|
||||
logDebug('We just loaded.');
|
||||
};
|
||||
|
||||
Dragonfly.Preferences.Editor.buildInterface = function (children, actions, observer)
|
||||
Dragonfly.Preferences.Editor.buildInterface = function (children, actions, element)
|
||||
{
|
||||
var d = Dragonfly;
|
||||
|
||||
@@ -407,11 +439,11 @@ Dragonfly.Preferences.Editor.buildInterface = function (children, actions, obser
|
||||
}
|
||||
html.push ('</div>');
|
||||
|
||||
html.set (this.contentId);
|
||||
html.set (element);
|
||||
for (var i = 0; i < actions.length; i++){
|
||||
logDebug('Setting up actions for ' + actions[i].value);
|
||||
var clickHandler = actions[i].onclick;
|
||||
Event.observe (ids[i], 'click', bind (clickHandler, observer || this));
|
||||
Event.observe (ids[i], 'click', bind (clickHandler, this));
|
||||
logDebug('Done!');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -361,6 +361,7 @@ Dragonfly.PopupBuble.prototype.connectHtml = function (elem)
|
||||
this.dispose();
|
||||
}
|
||||
}.bindAsEventListener(this));
|
||||
|
||||
return elem;
|
||||
};
|
||||
|
||||
@@ -378,6 +379,7 @@ Dragonfly.PopupBuble.prototype.addPoppedOut = function ()
|
||||
{
|
||||
if (this.elem) {
|
||||
addElementClass (this.elem, 'popped-out');
|
||||
//Dragonfly.lastPopup = this;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -560,7 +562,7 @@ Dragonfly.PopupBuble.prototype.show = function (elem, position)
|
||||
}
|
||||
if (!this.elem) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.addPoppedOut ();
|
||||
|
||||
@@ -621,7 +623,7 @@ Dragonfly.PopupBuble.prototype.show = function (elem, position)
|
||||
}
|
||||
|
||||
$(this.id).style.visibility = 'visible';
|
||||
|
||||
|
||||
return;
|
||||
logDebug ('positioning summary:');
|
||||
logDebug (' elemMetrics:', repr (elemMetrics));
|
||||
|
||||
Reference in New Issue
Block a user