diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index a8c01a0bc..1eb40bc79 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -187,6 +187,11 @@ static NSString *mailETag = nil; return NO; } +- (BOOL) mailIsDraft +{ + return [[self clientObject] isInDraftsFolder]; +} + - (id) redirectToParentFolder { id url; diff --git a/UI/Templates/MailerUI/UIxMailView.wox b/UI/Templates/MailerUI/UIxMailView.wox index fb45e7137..8ae114005 100644 --- a/UI/Templates/MailerUI/UIxMailView.wox +++ b/UI/Templates/MailerUI/UIxMailView.wox @@ -5,6 +5,10 @@ xmlns:uix="OGo:uix" xmlns:rsrc="OGo:url" xmlns:label="OGo:label"> + diff --git a/UI/WebServerResources/MailerUI.css b/UI/WebServerResources/MailerUI.css index f96edc182..54535ed1c 100644 --- a/UI/WebServerResources/MailerUI.css +++ b/UI/WebServerResources/MailerUI.css @@ -301,6 +301,12 @@ DIV.mailer_unreadicon a } /* fields (key/value UI), eg used in mail viewer */ +INPUT#editDraftButton +{ + position: absolute; + top: 2.5em; + right: 1em; +} TABLE.mailer_fieldtable { diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index cf0d2fa8e..9e0fc93cd 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -6,6 +6,7 @@ var currentMessages = new Array(); var maxCachedMessages = 20; var cachedMessages = new Array(); var currentMailbox = null; +var currentMailboxType = ""; var usersRightsWindowHeight = 320; var usersRightsWindowWidth = 400; @@ -31,12 +32,14 @@ function openMessageWindow(msguid, url) { } function onMessageDoubleClick(event) { - //resetSelection(window); - var msguid = this.parentNode.id.substr(4); - - return openMessageWindow(msguid, - ApplicationBaseURL + currentMailbox + "/" - + msguid + "/popupview"); + var action; + + if (currentMailboxType == "draft") + action = "edit"; + else + action = "popupview"; + + return openMessageWindowsForSelection(action, true); } function toggleMailSelect(sender) { @@ -140,19 +143,26 @@ function reopenToRemoveLocationBar() { /* mail list reply */ -function openMessageWindowsForSelection(action) { +function openMessageWindowsForSelection(action, firstOnly) { if (document.body.hasClassName("popup")) win = openMessageWindow(window.messageId, - window.messageURL + "/" + action /* url */); + window.messageURL + "/" + action); else { var messageList = $("messageList"); var rows = messageList.getSelectedRowsId(); - var idset = ""; - for (var i = 0; i < rows.length; i++) - win = openMessageWindow(rows[i].substr(4) /* msguid */, - ApplicationBaseURL + currentMailbox - + "/" + rows[i].substr(4) - + "/" + action /* url */); + if (rows.length > 0) { + if (firstOnly) + openMessageWindow(rows[0].substr(4), + ApplicationBaseURL + currentMailbox + + "/" + rows[0].substr(4) + + "/" + action); + else + for (var i = 0; i < rows.length; i++) + openMessageWindow(rows[i].substr(4), + ApplicationBaseURL + currentMailbox + + "/" + rows[i].substr(4) + + "/" + action); + } } return false; @@ -342,13 +352,13 @@ function onMailboxTreeItemClick(event) { $("searchValue").value = ""; initCriteria(); - var datatype = this.parentNode.getAttribute("datatype"); - if (datatype == "account" || datatype == "additional") { + currentMailboxType = this.parentNode.getAttribute("datatype"); + if (currentMailboxType == "account" || currentMailboxType == "additional") { currentMailbox = mailbox; $("messageContent").innerHTML = ""; var body = $("messageList").tBodies[0]; - for (var i = body.rows.length - 1; i > 0; i--) - body.deleteRow(i); + for (var i = body.rows.length; i > 0; i--) + body.deleteRow(i-1); } else openMailbox(mailbox); @@ -372,6 +382,22 @@ function refreshMailbox() { return false; } +function onComposeMessage() { + var topWindow = getTopWindow(); + if (topWindow) + topWindow.composeNewMessage(); + + return false; +} + +function composeNewMessage() { + var account = currentMailbox.split("/")[1]; + var url = ApplicationBaseURL + "/" + account + "/compose"; + window.open(url, null, + "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," + + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); +} + function openMailbox(mailbox, reload, idx) { if (mailbox != currentMailbox || reload) { currentMailbox = mailbox; @@ -669,12 +695,20 @@ function configureLinksInMessage() { else Event.observe(anchors[i], "click", onMessageAnchorClick); + + var editDraftButton = $("editDraftButton"); + if (editDraftButton) + Event.observe(editDraftButton, "click", onMessageEditDraft); } function onMessageContentMenu(event) { popupMenu(event, 'messageContentMenu', this); } +function onMessageEditDraft(event) { + return openMessageWindowsForSelection("edit", true); +} + function onEmailAddressClick(event) { popupMenu(event, 'addressMenu', this); }
: