Monotone-Parent: fe41830eaa82e69f64379323ab62164ca28f558d

Monotone-Revision: cb7329802a0fcbc3602f6725512da279d8c4f67f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-12-22T22:13:53
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2006-12-22 22:13:53 +00:00
parent ef275a7674
commit 0089cb7214
3 changed files with 93 additions and 75 deletions
+84 -62
View File
@@ -40,16 +40,19 @@ var currentMailbox = '';
/* mail list */
function openMessageWindow(msguid, url) {
log ("message window at url: " + url);
var wId = '';
if (msguid)
if (msguid) {
wId += "SOGo_msg_" + msguid;
markMailReadInWindow(window, msguid);
}
var msgWin = window.open(url, wId,
"width=680,height=520,resizable=1,scrollbars=1,toolbar=0,"
+ "location=0,directories=0,status=0,menubar=0,copyhistory=0");
if (msguid) {
msgWin.messageId = msguid;
msgWin.messageURL = ApplicationBaseURL + currentMailbox + "/" + msguid;
}
msgWin.focus();
markMailReadInWindow(window, msguid);
return false;
}
@@ -220,15 +223,19 @@ function reopenToRemoveLocationBar() {
function openMessageWindowsForSelection(action)
{
if (document.body.hasClassName("popup"))
win = openMessageWindow(window.messageId,
window.messageURL + "/" + action /* url */);
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 */);
}
return false;
}
@@ -415,7 +422,7 @@ function openMailbox(mailbox, reload)
currentMailbox = mailbox;
var url = ApplicationBaseURL + mailbox + "/view?noframe=1&desc=1";
var mailboxContent = $("mailboxContent");
var mailboxDragHandle = $("mailboxDragHandle");
var rightDragHandle = $("rightDragHandle");
var messageContent = $("messageContent");
messageContent.innerHTML = '';
if (mailbox.lastIndexOf("/") == 0) {
@@ -429,7 +436,7 @@ function openMailbox(mailbox, reload)
= triggerAjaxRequest(url, messageCallback);
mailboxContent.innerHTML = '';
mailboxContent.style.visibility = "hidden;";
mailboxDragHandle.style.visibility = "hidden;";
rightDragHandle.style.visibility = "hidden;";
messageContent.style.top = "0px;";
} else {
if (document.messageListAjaxRequest) {
@@ -445,9 +452,9 @@ function openMailbox(mailbox, reload)
currentMessages[mailbox]);
if (mailboxContent.style.visibility == "hidden") {
mailboxContent.style.visibility = "visible;";
mailboxDragHandle.style.visibility = "visible;";
messageContent.style.top = (mailboxDragHandle.offsetTop
+ mailboxDragHandle.offsetHeight
rightDragHandle.style.visibility = "visible;";
messageContent.style.top = (rightDragHandle.offsetTop
+ rightDragHandle.offsetHeight
+ 'px;');
}
}
@@ -520,16 +527,23 @@ function onMessageContextMenuHide(event)
}
}
function onFolderMenuClick(event, menutype)
function onFolderMenuClick(event)
{
var onhide, menuName;
if (menutype == "inbox") {
menuName = "inboxIconMenu";
} else if (menutype == "account") {
menuName = "accountIconMenu";
} else if (menutype == "trash") {
menuName = "trashIconMenu";
var menutype = this.parentNode.getAttribute("datatype");
log("parentNode: " + this.parentNode.tagName);
log("menutype: " + menutype);
if (menutype) {
if (menutype == "inbox") {
menuName = "inboxIconMenu";
} else if (menutype == "account") {
menuName = "accountIconMenu";
} else if (menutype == "trash") {
menuName = "trashIconMenu";
} else {
menuName = "mailboxIconMenu";
}
} else {
menuName = "mailboxIconMenu";
}
@@ -925,48 +939,34 @@ function configureMessageListEvents() {
onMessageSelectionChange, false);
var rows = messageList.tBodies[0].rows;
var start = 0;
while (rows[start].cells[0].hasClassName("tbtv_headercell")
|| rows[start].cells[0].hasClassName("tbtv_navcell"))
start++;
for (var i = start; i < rows.length; i++) {
rows[i].addEventListener("mousedown", onRowClick, false);
rows[i].addEventListener("contextmenu", onMessageContextMenu, false);
rows[i].dndTypes = function() { return new Array("mailRow"); };
rows[i].dndGhost = messageListGhost;
rows[i].dndDataForType = messageListData;
document.DNDManager.registerSource(rows[i]);
for (var j = 0; j < rows[i].cells.length; j++) {
var cell = rows[i].cells[j];
cell.addEventListener("mousedown", listRowMouseDownHandler, false);
if (j == 2 || j == 3 || j == 5)
cell.addEventListener("dblclick", onMessageDoubleClick, false);
else if (j == 4) {
var img = cell.childNodesWithTag("img")[0];
img.addEventListener("click", mailListMarkMessage, false);
if (rows.length > 1) {
while (rows[start].cells[0].hasClassName("tbtv_headercell")
|| rows[start].cells[0].hasClassName("tbtv_navcell"))
start++;
for (var i = start; i < rows.length; i++) {
rows[i].addEventListener("mousedown", onRowClick, false);
rows[i].addEventListener("contextmenu", onMessageContextMenu, false);
rows[i].dndTypes = function() { return new Array("mailRow"); };
rows[i].dndGhost = messageListGhost;
rows[i].dndDataForType = messageListData;
document.DNDManager.registerSource(rows[i]);
for (var j = 0; j < rows[i].cells.length; j++) {
var cell = rows[i].cells[j];
cell.addEventListener("mousedown", listRowMouseDownHandler, false);
if (j == 2 || j == 3 || j == 5)
cell.addEventListener("dblclick", onMessageDoubleClick, false);
else if (j == 4) {
var img = cell.childNodesWithTag("img")[0];
img.addEventListener("click", mailListMarkMessage, false);
}
}
}
}
}
}
function configureDragHandles() {
var handle = $("dragHandle");
if (handle) {
handle.addInterface(SOGoDragHandlesInterface);
handle.leftBlock=$("mailerFolderTree");
handle.rightBlock=$("mailerPageContent");
}
handle = $("mailboxDragHandle");
if (handle) {
handle.addInterface(SOGoDragHandlesInterface);
handle.upperBlock=$("mailboxContent");
handle.lowerBlock=$("messageContent");
}
}
function configureDragHandles() {
var handle = $("verticalDragHandle");
if (handle) {
@@ -1014,16 +1014,38 @@ function initDnd() {
function refreshContacts() {
}
function openInbox(node) {
var done = false;
openMailbox(node.parentNode.getAttribute("dataname"));
node.select();
var currentNode = node.parentNode.parentNode;
while (!done) {
var number = currentNode.getAttribute("id").substr(2);
d.o(number);
if (number == "1")
done = true;
else
currentNode = currentNode.parentNode;
}
}
var initMailer = {
handleEvent: function (event) {
configureMessageListEvents();
initDnd();
var tree = $("d");
var nodes = document.getElementsByClassName("node", tree);
nodes = nodes.concat(document.getElementsByClassName("nodeSel", tree));
for (i = 0; i < nodes.length; i++) {
nodes[i].addEventListener("click", onMailboxTreeItemClick, false);
nodes[i].addEventListener("contextmenu", onFolderMenuClick, false);
if (!document.body.hasClassName("popup")) {
var inboxFound = false;
configureMessageListEvents();
initDnd();
var tree = $("d");
var nodes = document.getElementsByClassName("node", tree);
for (i = 0; i < nodes.length; i++) {
nodes[i].addEventListener("click", onMailboxTreeItemClick, false);
nodes[i].addEventListener("contextmenu", onFolderMenuClick, false);
if (!inboxFound
&& nodes[i].parentNode.getAttribute("datatype") == "inbox") {
openInbox(nodes[i]);
inboxFound = true;
}
}
}
/*
+2 -8
View File
@@ -25,23 +25,17 @@
text-decoration: none;
}
.dtree a.node, .dtree a.nodeSel
.dtree a.node
{
white-space: nowrap;
padding: 1px 2px;
}
.dtree a.node:hover, .dtree a.nodeSel:hover
.dtree a.node:hover
{
text-decoration: none;
}
.dtree a.nodeSel
{
color: #fff;
background-color: #4b6983;
}
.dtree .clip
{
overflow: hidden;
+7 -5
View File
@@ -38,7 +38,7 @@ function dTree(objName) {
hideRoot : false,
folderLinks : true,
useSelection : true,
useCookies : true,
useCookies : false,
useLines : true,
useIcons : true,
useStatusText : false,
@@ -136,7 +136,7 @@ dTree.prototype.node = function(node, nodeId) {
if (node.dataname) str += ' dataname="' + node.dataname + '"';
str += '>' + this.indent(node, nodeId);
if (node.url) {
str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
str += '<a id="s' + this.obj + nodeId + '" class="node" href="' + node.url + '"';
if (node.title) str += ' title="' + node.title + '"';
if (node.target) str += ' target="' + node.target + '"';
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
@@ -181,7 +181,7 @@ dTree.prototype.indent = function(node, nodeId) {
(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
if (node._hc)
{
str += '<a href="#" onclick="' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
str += '<a href="#" onclick="return ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
str += '" alt="" /></a>';
@@ -216,10 +216,10 @@ dTree.prototype.s = function(id) {
if (this.selectedNode != id) {
if (this.selectedNode || this.selectedNode==0) {
eOld = document.getElementById("s" + this.obj + this.selectedNode);
eOld.className = "node";
eOld.deselect();
}
eNew = document.getElementById("s" + this.obj + id);
eNew.className = "nodeSel";
eNew.select();
this.selectedNode = id;
if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
}
@@ -232,6 +232,8 @@ dTree.prototype.o = function(id) {
cn._io = !cn._io;
if (this.config.closeSameLevel) this.closeLevel(cn);
if (this.config.useCookies) this.updateCookie();
return false;
};
// Open or close all nodes