#import <Foundation/NSRange.h>
#import <Foundation/NSString.h>
+#import <NGExtensions/NGBase64Coding.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NGQuotedPrintableCoding.h>
+
#import "NSArray+NGCards.h"
#import "NSDictionary+NGCards.h"
#import "CardVersitRenderer.h"
- (NSString *) value: (unsigned int) anInt
{
- NSString *value;
+ NSString *realValue, *value, *encoding;
if ([values count] <= anInt)
value = @"";
else
- value = [values objectAtIndex: anInt];
+ {
+ realValue = [values objectAtIndex: anInt];
+ encoding = [[self value: 0 ofAttribute: @"encoding"] lowercaseString];
+ if ([encoding length])
+ {
+ if ([encoding isEqualToString: @"quoted-printable"])
+ value = [realValue stringByDecodingQuotedPrintable];
+ else if ([encoding isEqualToString: @"base64"])
+ value = [realValue stringByDecodingBase64];
+ else
+ {
+ value = realValue;
+ if (![encoding isEqualToString: @"8bit"])
+ [self logWithFormat: @"unknown encoding '%@'", encoding];
+ }
+ }
+ else
+ value = realValue;
+ }
return value;
}
var messageList = $("messageList");
var rows = messageList.getSelectedRowsId();
if (rows.length > 0) {
- if (firstOnly)
- openMessageWindow(rows[0].substr(4),
+ for (var i = 0; i < rows.length; i++) {
+ openMessageWindow(rows[i].substr(4),
ApplicationBaseURL + currentMailbox
- + "/" + rows[0].substr(4)
+ + "/" + rows[i].substr(4)
+ "/" + action);
- else
- for (var i = 0; i < rows.length; i++)
- openMessageWindow(rows[i].substr(4),
- ApplicationBaseURL + currentMailbox
- + "/" + rows[i].substr(4)
- + "/" + action);
+ if (firstOnly)
+ break;
+ }
} else {
window.alert(labels["Please select a message."]);
}
var row = $("row_" + data["id"]);
row.parentNode.removeChild(row);
+// row.addClassName("deleted"); // when we'll offer "mark as deleted"
deleteMessageRequestCount--;
}
+ "&asc=" + sorting["ascending"]);
if (idx)
url += "&idx=" + idx;
+
if (document.messageListAjaxRequest) {
document.messageListAjaxRequest.aborted = true;
document.messageListAjaxRequest.abort();
var messageDiv = $('messageContent');
var mailContentDiv = document.getElementsByClassName('mailer_mailcontent',
messageDiv)[0];
- Event.observe(mailContentDiv, "contextmenu",
- onMessageContentMenu.bindAsEventListener(mailContentDiv));
+ if (!document.body.hasClassName("popup"))
+ Event.observe(mailContentDiv, "contextmenu",
+ onMessageContentMenu.bindAsEventListener(mailContentDiv));
var anchors = messageDiv.getElementsByTagName('a');
for (var i = 0; i < anchors.length; i++)
if (anchors[i].href.substring(0,7) == "mailto:") {
alert("MoveTo: " + uri);
}
-function deleteSelectedMails() {
-}
-
/* message menu entries */
function onMenuOpenMessage(event) {
return openMessageWindowsForSelection('popupview');
return account;
}
-function onMenuCreateFolder(event) { log ("onMenuCreateFolder " + document.menuTarget);
+function onMenuCreateFolder(event) {
var name = window.prompt(labels["Name :"], "");
if (name && name.length > 0) {
var folderID = document.menuTarget.getAttribute("dataname");
function onLabelMenuPrepareVisibility() {
var messageList = $("messageList");
- var rows = messageList.getSelectedRows();
-
var flags = {};
- for (var i = 1; i < 6; i++)
- flags["label" + i] = true;
- for (var i = 0; i < rows.length; i++) {
- var rowFlags = rows[i].getAttribute("labels").split(" ");
- for (var flag in flags)
- if (flags[flag] && rowFlags.indexOf(flag) == -1)
- flags[flag] = false;
+
+ if (messageList) {
+ var rows = messageList.getSelectedRows();
+ for (var i = 0; i < rows.length; i++) {
+ $w(rows[i].getAttribute("labels")).each(function(flag) {
+ flags[flag] = true;
+ });
+ }
}
var lis = this.childNodesWithTag("ul")[0].childNodesWithTag("li")