2008-08-28 16:48:45 +02:00
|
|
|
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
|
|
|
|
2007-06-19 19:59:59 +02:00
|
|
|
function savePreferences(sender) {
|
2009-07-01 16:07:46 +02:00
|
|
|
var sigList = $("signaturePlacementList");
|
|
|
|
if (sigList)
|
|
|
|
sigList.disabled=false;
|
2009-07-02 17:40:45 +02:00
|
|
|
|
2008-08-28 16:48:45 +02:00
|
|
|
$("mainForm").submit();
|
2007-06-19 19:59:59 +02:00
|
|
|
|
2008-08-28 16:48:45 +02:00
|
|
|
return false;
|
2007-06-19 19:59:59 +02:00
|
|
|
}
|
2008-07-25 20:44:31 +02:00
|
|
|
|
|
|
|
function _setupEvents(enable) {
|
|
|
|
var widgets = [ "timezone", "shortDateFormat", "longDateFormat",
|
2008-08-28 16:48:45 +02:00
|
|
|
"timeFormat", "weekStartDay", "dayStartTime", "dayEndTime",
|
2009-05-15 22:26:25 +02:00
|
|
|
"firstWeek", "messageCheck", "subscribedFoldersOnly" ];
|
2008-07-25 20:44:31 +02:00
|
|
|
for (var i = 0; i < widgets.length; i++) {
|
|
|
|
var widget = $(widgets[i]);
|
2008-08-25 19:53:27 +02:00
|
|
|
if (widget) {
|
|
|
|
if (enable)
|
|
|
|
widget.observe("change", onChoiceChanged);
|
|
|
|
else
|
|
|
|
widget.stopObserving("change", onChoiceChanged);
|
|
|
|
}
|
2008-07-25 20:44:31 +02:00
|
|
|
}
|
2009-07-02 17:40:45 +02:00
|
|
|
|
|
|
|
$("replyPlacementList").observe ("change", onReplyPlacementListChange);
|
|
|
|
$("composeMessagesType").observe ("change", onComposeMessagesTypeChange);
|
2008-07-25 20:44:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onChoiceChanged(event) {
|
|
|
|
var hasChanged = $("hasChanged");
|
|
|
|
hasChanged.value = "1";
|
|
|
|
|
|
|
|
_setupEvents(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function initPreferences() {
|
2009-07-01 16:25:29 +02:00
|
|
|
_setupEvents(true);
|
|
|
|
if (typeof (initAdditionalPreferences) != "undefined")
|
|
|
|
initAdditionalPreferences();
|
|
|
|
|
|
|
|
if ($("signature")) {
|
|
|
|
onComposeMessagesTypeChange ();
|
|
|
|
}
|
2008-09-28 21:49:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onReplyPlacementListChange() {
|
|
|
|
// above = 0
|
|
|
|
if ($("replyPlacementList").value == 0) {
|
|
|
|
$("signaturePlacementList").disabled=false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("signaturePlacementList").value=1;
|
|
|
|
$("signaturePlacementList").disabled=true;
|
|
|
|
}
|
2008-07-25 20:44:31 +02:00
|
|
|
}
|
|
|
|
|
2009-06-23 19:53:18 +02:00
|
|
|
function onComposeMessagesTypeChange () {
|
2009-06-25 21:50:59 +02:00
|
|
|
var textArea = $('signature');
|
2009-06-25 21:18:02 +02:00
|
|
|
var editor = $('cke_signature');
|
2009-06-26 15:17:21 +02:00
|
|
|
|
2009-07-02 17:40:45 +02:00
|
|
|
// Textmode
|
2009-06-23 19:53:18 +02:00
|
|
|
if ($("composeMessagesType").value == 0) {
|
2009-07-02 17:40:45 +02:00
|
|
|
if (editor) {
|
|
|
|
CKEDITOR.instances.signature.removeListener ()
|
|
|
|
CKEDITOR.instances.signature.destroy (false);
|
|
|
|
CKEDITOR.instances.signature = null;
|
|
|
|
delete (CKEDITOR.instances.signature);
|
|
|
|
}
|
2009-06-23 19:53:18 +02:00
|
|
|
}
|
|
|
|
else {
|
2009-07-02 17:40:45 +02:00
|
|
|
CKEDITOR.replace('signature',
|
|
|
|
{
|
|
|
|
skin: "v2",
|
|
|
|
height: "90px",
|
|
|
|
toolbar :
|
|
|
|
[['Bold', 'Italic', '-', 'Link',
|
|
|
|
'Font','FontSize','-','TextColor',
|
|
|
|
'BGColor']
|
|
|
|
]
|
|
|
|
}
|
|
|
|
);
|
2009-06-25 21:50:59 +02:00
|
|
|
}
|
2009-06-23 19:53:18 +02:00
|
|
|
}
|
|
|
|
|
2009-03-12 22:09:14 +01:00
|
|
|
document.observe("dom:loaded", initPreferences);
|