mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-31 11:02:44 +00:00
(feat) UI for previously commited new feature (junk/not junk)
This commit is contained in:
@@ -49,12 +49,12 @@
|
||||
cssClass = "tbicon_delete";
|
||||
label = "Delete";
|
||||
tooltip = "Delete selected message or folder"; },
|
||||
// { link = "#";
|
||||
// isSafe = NO;
|
||||
// image = "tb-mail-junk-flat-24x24.png";
|
||||
// cssClass = "tbicon_junk";
|
||||
// label = "Junk";
|
||||
// tooltip = "Mark the selected messages as junk"; },
|
||||
{ link = "#";
|
||||
isSafe = NO;
|
||||
image = "tb-mail-junk-flat-24x24.png";
|
||||
cssClass = "tbicon_junk";
|
||||
label = "Junk";
|
||||
tooltip = "Mark the selected messages as junk"; },
|
||||
),
|
||||
(
|
||||
{ link = "#";
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
cssClass = "tbicon_delete";
|
||||
label = "Delete";
|
||||
tooltip = "Delete selected message or folder"; },
|
||||
// { link = "#";
|
||||
// isSafe = NO;
|
||||
// image = "tb-mail-junk-flat-24x24.png";
|
||||
// cssClass = "tbicon_junk";
|
||||
// label = "Junk";
|
||||
// tooltip = "Mark the selected messages as junk"; },
|
||||
{ link = "#";
|
||||
isSafe = NO;
|
||||
image = "tb-mail-junk-flat-24x24.png";
|
||||
cssClass = "tbicon_junk";
|
||||
label = "Junk";
|
||||
tooltip = "Mark the selected messages as junk"; },
|
||||
),
|
||||
(
|
||||
{ link = "#";
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
<li><var:string label:value="Sent Messages" /></li>
|
||||
<li><var:string label:value="Drafts" /></li>
|
||||
<li><var:string label:value="Deleted Messages" /></li>
|
||||
<li><var:string label:value="Junk Messages" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<script type="text/javascript">
|
||||
var messageName = '<var:string value="clientObject.relativeImap4Name"/>';
|
||||
var mailboxName = '/<var:string value="clientObject.container.container.nameInContainer"/>/<var:string value="clientObject.container.nameInContainer"/>';
|
||||
var mailboxType = '<var:string value="clientObject.container.className"/>';
|
||||
</script>
|
||||
<var:component className="UIxMailView" />
|
||||
<div class="menu" id="addressMenu">
|
||||
|
||||
@@ -644,6 +644,45 @@ function onMenuDeleteMessage(event) {
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function onMarkOrUnmarkMessagesAsJunk(is_junk) {
|
||||
var targetMailbox;
|
||||
var messageList = $("messageListBody").down("TBODY");
|
||||
var rowIds = messageList.getSelectedNodesId();
|
||||
var uids = new Array(); // message IDs
|
||||
|
||||
for (var i = 0; i < rowIds.length; i++) {
|
||||
var uid = rowIds[i].substr(4);
|
||||
uids.push(uid);
|
||||
}
|
||||
|
||||
var url;
|
||||
|
||||
if (is_junk)
|
||||
url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/markMessagesAsNotJunk";
|
||||
else
|
||||
url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/markMessagesAsJunk";
|
||||
|
||||
var data = { "uids": uids };
|
||||
triggerAjaxRequest(url, onMarkOrUnmarkMessagesAsJunkCallback, data, Object.toJSON(data));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function onMarkOrUnmarkMessagesAsJunkCallback(http) {
|
||||
// If all went well, lets move the message
|
||||
if (isHttpStatus204(http.status) || http.status == 200) {
|
||||
var func, item;
|
||||
|
||||
if (Mailer.currentMailboxType == "junk") {
|
||||
item = $$("[datatype=inbox]").first();
|
||||
} else {
|
||||
item = $$("[datatype=junk]").first();
|
||||
}
|
||||
func = onMailboxMenuMove.bind(item);
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The following two functions are called from UIxMailPopupView
|
||||
* with window.opener.
|
||||
@@ -682,9 +721,26 @@ function onPrintCurrentMessage(event) {
|
||||
preventDefault(event);
|
||||
}
|
||||
|
||||
function toggleJunkAction(isJunk) {
|
||||
var button = $$(".tbicon_junk").first();
|
||||
button.stopObserving("click");
|
||||
|
||||
if (isJunk) {
|
||||
button.title = "Mark the selected messages as not junk";
|
||||
button.select('span').first().childNodes[3].nodeValue = "Not junk";
|
||||
}
|
||||
else {
|
||||
button.title = "Mark the selected messages as junk";
|
||||
button.select('span').first().childNodes[3].nodeValue = "Junk";
|
||||
}
|
||||
|
||||
button.on("click", onMarkOrUnmarkMessagesAsJunk.bind(button, isJunk));
|
||||
}
|
||||
|
||||
function onMailboxTreeItemClick(event) {
|
||||
var topNode = $("mailboxTree");
|
||||
var mailbox = this.parentNode.getAttribute("dataname");
|
||||
var is_junk = false;
|
||||
if (topNode.selectedEntry)
|
||||
topNode.selectedEntry.deselect();
|
||||
this.selectElement();
|
||||
@@ -707,6 +763,8 @@ function onMailboxTreeItemClick(event) {
|
||||
var datatype = this.parentNode.getAttribute("datatype");
|
||||
if (datatype == 'draft' || datatype == 'sent')
|
||||
toggleAddressColumn("from", "to");
|
||||
else if (datatype == 'junk')
|
||||
is_junk = true;
|
||||
else
|
||||
toggleAddressColumn("to", "from");
|
||||
|
||||
@@ -714,6 +772,8 @@ function onMailboxTreeItemClick(event) {
|
||||
openMailbox(mailbox);
|
||||
}
|
||||
|
||||
toggleJunkAction(is_junk);
|
||||
|
||||
Event.stop(event);
|
||||
}
|
||||
|
||||
@@ -2073,6 +2133,8 @@ function initMailer(event) {
|
||||
initMailboxTree();
|
||||
initRefreshViewCheckTimer();
|
||||
|
||||
toggleJunkAction(false);
|
||||
|
||||
Event.observe(document, "keydown", onDocumentKeydown);
|
||||
|
||||
/* Perform an expunge when leaving the webmail */
|
||||
@@ -2555,6 +2617,10 @@ function onMenuChangeToTrashFolder(event) {
|
||||
return _onMenuChangeToXXXFolder(event, "Trash");
|
||||
}
|
||||
|
||||
function onMenuChangeToJunkFolder(event) {
|
||||
return _onMenuChangeToXXXFolder(event, "Junk");
|
||||
}
|
||||
|
||||
function onMenuToggleMessageRead(event) {
|
||||
mailListToggleMessagesRead();
|
||||
}
|
||||
@@ -2956,7 +3022,8 @@ function getMenus() {
|
||||
onMenuDeleteMessage ],
|
||||
folderTypeMenu: [ onMenuChangeToSentFolder,
|
||||
onMenuChangeToDraftsFolder,
|
||||
onMenuChangeToTrashFolder ],
|
||||
onMenuChangeToTrashFolder,
|
||||
onMenuChangeToJunkFolder ],
|
||||
|
||||
"label-menu": [ onMenuLabelNone, "-" ],
|
||||
|
||||
|
||||
@@ -4,11 +4,13 @@ var MailerUIdTreeExtension = {
|
||||
inbox: "tbtv_inbox_17x17.png",
|
||||
sent: "tbtv_sent_17x17.png",
|
||||
draft: "tbtv_drafts_17x17.png",
|
||||
trash: "tbtv_trash_17x17.png" },
|
||||
trash: "tbtv_trash_17x17.png",
|
||||
junk: "tb-mail-junk-flat-17x17.png" },
|
||||
folderNames: { inbox: _("InboxFolderName"),
|
||||
sent: _("SentFolderName"),
|
||||
draft: _("DraftsFolderName"),
|
||||
trash: _("TrashFolderName") },
|
||||
trash: _("TrashFolderName"),
|
||||
junk: _("JunkFolderName") },
|
||||
_addFolderNode: function (parent, name, fullName, type, unseen) {
|
||||
var icon = this.folderIcons[type];
|
||||
if (icon)
|
||||
|
||||
@@ -23,6 +23,20 @@ function initPopupMailer(event) {
|
||||
var td = $("subject");
|
||||
if (td)
|
||||
document.title = td.allTextContent();
|
||||
|
||||
var button = $$(".tbicon_junk").first();
|
||||
button.stopObserving("click");
|
||||
|
||||
if (window.mailboxType == "SOGoJunkFolder") {
|
||||
button.title = "Mark the selected messages as not junk";
|
||||
button.select('span').first().childNodes[3].nodeValue = "Not junk";
|
||||
}
|
||||
else {
|
||||
button.title = "Mark the selected messages as junk";
|
||||
button.select('span').first().childNodes[3].nodeValue = "Junk";
|
||||
}
|
||||
|
||||
button.on("click", window.opener.onMarkOrUnmarkMessagesAsJunk.bind(button, (window.mailboxType == "SOGoJunkFolder")));
|
||||
}
|
||||
|
||||
function onICalendarButtonClick(event) {
|
||||
|
||||
Reference in New Issue
Block a user