Monotone-Parent: 7f76103f70f06e2d9d23dda324c36f84d85eae1c
Monotone-Revision: 2b96d00aec89e2290a01e1ee04bdc8cee5487139 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-08-23T20:58:41 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
aa9312f278
commit
a2b5a5b4bb
15
ChangeLog
15
ChangeLog
|
@ -1,5 +1,20 @@
|
||||||
2010-08-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2010-08-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* UI/WebServerResources/UIxMailEditor.js: (clickEditorSend): make
|
||||||
|
use of the iframe hack for receiving the POST's response and
|
||||||
|
interpret it as JSON, with error handling.
|
||||||
|
|
||||||
|
* UI/WebServerResources/HTMLElement.js: (Element.allTextContent):
|
||||||
|
fetch the concatenated text content of the all the child nodes of
|
||||||
|
the element, recursively.
|
||||||
|
|
||||||
|
* UI/WebServerResources/MailerUI.js: (initMailer): use
|
||||||
|
"UserSettings" only if we are the main window.
|
||||||
|
|
||||||
|
* UI/MailerUI/UIxMailEditor.m (-sendAction): return a json
|
||||||
|
representation of the success of the operation, with a message if
|
||||||
|
an exception was returned.
|
||||||
|
|
||||||
* UI/WebServerResources/MailerUI.js: (mailListToggleMessagesRead):
|
* UI/WebServerResources/MailerUI.js: (mailListToggleMessagesRead):
|
||||||
new method, spun from "mailListMarkMessage", which is basically
|
new method, spun from "mailListMarkMessage", which is basically
|
||||||
replaces in a more generic way by acting on all selected messages
|
replaces in a more generic way by acting on all selected messages
|
||||||
|
|
|
@ -587,33 +587,38 @@ static NSArray *infoKeys = nil;
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id <WOActionResults>) sendAction
|
- (WOResponse *) sendAction
|
||||||
{
|
{
|
||||||
id <WOActionResults> result;
|
|
||||||
SOGoDraftObject *co;
|
SOGoDraftObject *co;
|
||||||
|
NSDictionary *jsonResponse;
|
||||||
|
NSException *error;
|
||||||
|
|
||||||
|
co = [self clientObject];
|
||||||
|
|
||||||
// TODO: need to validate whether we have a To etc
|
|
||||||
|
|
||||||
/* first, save form data */
|
/* first, save form data */
|
||||||
result = (id <WOActionResults>) [self validateForSend];
|
error = [self validateForSend];
|
||||||
if (!result)
|
if (!error)
|
||||||
{
|
{
|
||||||
if ([self _saveFormInfo])
|
if ([self _saveFormInfo])
|
||||||
{
|
error = [co sendMail];
|
||||||
result = (id <WOActionResults>) [[self clientObject] sendMail];
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
co = [self clientObject];
|
|
||||||
result = [self jsCloseWithRefreshMethod: [NSString stringWithFormat: @"refreshMessage(\"%@\", %i)",
|
|
||||||
[co sourceFolder],
|
|
||||||
[co IMAP4ID]]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
result = [self failedToSaveFormResponse];
|
error = [self failedToSaveFormResponse];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
if (error)
|
||||||
|
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
@"failure", @"status",
|
||||||
|
[error reason], @"message",
|
||||||
|
nil];
|
||||||
|
else
|
||||||
|
jsonResponse = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
@"success", @"status",
|
||||||
|
[co sourceFolder], @"sourceFolder",
|
||||||
|
[co IMAP4ID], @"messageID",
|
||||||
|
nil];
|
||||||
|
|
||||||
|
return [self responseWithStatus: 200
|
||||||
|
andString: [jsonResponse jsonRepresentation]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end /* UIxMailEditor */
|
@end /* UIxMailEditor */
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
class="textField"
|
class="textField"
|
||||||
var:value="subject"
|
var:value="subject"
|
||||||
/></div>
|
/></div>
|
||||||
<!-- separator line --><hr/>
|
<!-- separator line --><hr class="fieldSeparator"/>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="text" name="text" rows="30" var:value="text"></textarea>
|
<textarea id="text" name="text" rows="30" var:value="text"></textarea>
|
||||||
<!-- img rsrc:src="tbird_073_compose.png" alt="screenshot" / -->
|
<!-- img rsrc:src="tbird_073_compose.png" alt="screenshot" / -->
|
||||||
|
|
|
@ -8,7 +8,22 @@ Element.addMethods({
|
||||||
if (element.bind)
|
if (element.bind)
|
||||||
element.bind();
|
element.bind();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
allTextContent: function(element) {
|
||||||
|
var content = "";
|
||||||
|
for (var i = 0; i < element.childNodes.length; i++) {
|
||||||
|
var node = $(element.childNodes[i]);
|
||||||
|
if (node.nodeType == Node.TEXT_NODE) {
|
||||||
|
content += node.nodeValue;
|
||||||
|
}
|
||||||
|
else if (node.nodeType == Node.ELEMENT_NODE) {
|
||||||
|
content += Element.allTextContent(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
|
},
|
||||||
|
|
||||||
childNodesWithTag: function(element, tagName) {
|
childNodesWithTag: function(element, tagName) {
|
||||||
element = $(element);
|
element = $(element);
|
||||||
|
|
||||||
|
|
|
@ -1679,18 +1679,18 @@ function openInbox(node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initMailer(event) {
|
function initMailer(event) {
|
||||||
// Restore sorting from user settings
|
|
||||||
if (UserSettings["Mail"] && UserSettings["Mail"]["SortingState"]) {
|
|
||||||
sorting["attribute"] = UserSettings["Mail"]["SortingState"][0];
|
|
||||||
sorting["ascending"] = parseInt(UserSettings["Mail"]["SortingState"][1]) > 0;
|
|
||||||
if (sorting["attribute"] == 'to') sorting["attribute"] = 'from'; // initial mailbox is always the inbox
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sorting["attribute"] = "date";
|
|
||||||
sorting["ascending"] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$(document.body).hasClassName("popup")) {
|
if (!$(document.body).hasClassName("popup")) {
|
||||||
|
// Restore sorting from user settings
|
||||||
|
if (UserSettings && UserSettings["Mail"] && UserSettings["Mail"]["SortingState"]) {
|
||||||
|
sorting["attribute"] = UserSettings["Mail"]["SortingState"][0];
|
||||||
|
sorting["ascending"] = parseInt(UserSettings["Mail"]["SortingState"][1]) > 0;
|
||||||
|
if (sorting["attribute"] == 'to') sorting["attribute"] = 'from'; // initial mailbox is always the inbox
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sorting["attribute"] = "date";
|
||||||
|
sorting["ascending"] = false;
|
||||||
|
}
|
||||||
|
|
||||||
Mailer.dataTable = $("mailboxList");
|
Mailer.dataTable = $("mailboxList");
|
||||||
Mailer.dataTable.addInterface(SOGoDataTableInterface);
|
Mailer.dataTable.addInterface(SOGoDataTableInterface);
|
||||||
Mailer.dataTable.setRowRenderCallback(messageListCallback);
|
Mailer.dataTable.setRowRenderCallback(messageListCallback);
|
||||||
|
|
|
@ -98,7 +98,7 @@ div#attachmentsArea
|
||||||
margin: auto;
|
margin: auto;
|
||||||
border-left: 1px solid #888; }
|
border-left: 1px solid #888; }
|
||||||
|
|
||||||
hr
|
hr.fieldSeparator
|
||||||
{ background-color: #848284;
|
{ background-color: #848284;
|
||||||
border: 0;
|
border: 0;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
|
|
@ -106,7 +106,7 @@ function insertContact(inputNode, contactName, contactEmail) {
|
||||||
|
|
||||||
/* mail editor */
|
/* mail editor */
|
||||||
|
|
||||||
function validateEditorInput(sender) {
|
function validateEditorInput() {
|
||||||
var errortext = "";
|
var errortext = "";
|
||||||
var field;
|
var field;
|
||||||
|
|
||||||
|
@ -125,26 +125,63 @@ function validateEditorInput(sender) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickedEditorSend(sender) {
|
function onValidate(event) {
|
||||||
if (document.pageform.action == "send" || !validateEditorInput(sender))
|
var rc = false;
|
||||||
return false;
|
|
||||||
|
|
||||||
var input = currentAttachmentInput();
|
if (document.pageform.action != "send"
|
||||||
if (input)
|
&& validateEditorInput()) {
|
||||||
input.parentNode.removeChild(input);
|
var input = currentAttachmentInput();
|
||||||
|
if (input)
|
||||||
|
input.parentNode.removeChild(input);
|
||||||
|
|
||||||
var toolbar = document.getElementById("toolbar");
|
var toolbar = document.getElementById("toolbar");
|
||||||
if (!document.busyAnim)
|
if (!document.busyAnim)
|
||||||
document.busyAnim = startAnimation(toolbar);
|
document.busyAnim = startAnimation(toolbar);
|
||||||
|
|
||||||
var lastRow = $("lastRow");
|
var lastRow = $("lastRow");
|
||||||
lastRow.down("select").name = "popup_last";
|
lastRow.down("select").name = "popup_last";
|
||||||
|
|
||||||
window.shouldPreserve = true;
|
window.shouldPreserve = true;
|
||||||
document.pageform.action = "send";
|
|
||||||
document.pageform.submit();
|
document.pageform.action = "send";
|
||||||
|
|
||||||
return false;
|
AIM.submit(document.pageform, {'onComplete' : onPostComplete});
|
||||||
|
|
||||||
|
rc = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPostComplete(response) {
|
||||||
|
if (response && response.length > 0) {
|
||||||
|
var jsonResponse = response.evalJSON();
|
||||||
|
if (jsonResponse["status"] == "success") {
|
||||||
|
if (window.opener && window.opener.refreshMessage) {
|
||||||
|
window.opener.refreshMessage(jsonResponse["sourceFolder"],
|
||||||
|
jsonResponse["messageID"]);
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var message = jsonResponse["message"];
|
||||||
|
document.pageform.action = "";
|
||||||
|
var progressImage = $("progressIndicator");
|
||||||
|
if (progressImage) {
|
||||||
|
progressImage.parentNode.removeChild(progressImage);
|
||||||
|
}
|
||||||
|
showAlertDialog(jsonResponse["message"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickedEditorSend() {
|
||||||
|
if (onValidate()) {
|
||||||
|
document.pageform.submit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentAttachmentInput() {
|
function currentAttachmentInput() {
|
||||||
|
@ -161,7 +198,7 @@ function currentAttachmentInput() {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickedEditorAttach(sender) {
|
function clickedEditorAttach() {
|
||||||
var input = currentAttachmentInput();
|
var input = currentAttachmentInput();
|
||||||
if (!input) {
|
if (!input) {
|
||||||
var area = $("attachmentsArea");
|
var area = $("attachmentsArea");
|
||||||
|
@ -214,7 +251,7 @@ function createAttachment(node, list) {
|
||||||
attachment.appendChild(attachmentName);
|
attachment.appendChild(attachmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickedEditorSave(sender) {
|
function clickedEditorSave() {
|
||||||
var input = currentAttachmentInput();
|
var input = currentAttachmentInput();
|
||||||
if (input)
|
if (input)
|
||||||
input.parentNode.removeChild(input);
|
input.parentNode.removeChild(input);
|
||||||
|
|
|
@ -1718,8 +1718,9 @@ AIM = {
|
||||||
if (d.location.href == "about:blank")
|
if (d.location.href == "about:blank")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (typeof(i.onComplete) == 'function')
|
if (typeof(i.onComplete) == 'function') {
|
||||||
i.onComplete(d.body.innerHTML);
|
i.onComplete(Element.allTextContent(d.body));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue