merge of '98e35c999db27e9159edf91d2c17f8b5bc742330'

and 'c8a13e58e7ce73cd9924b4567998c6246b793672'

Monotone-Parent: 98e35c999db27e9159edf91d2c17f8b5bc742330
Monotone-Parent: c8a13e58e7ce73cd9924b4567998c6246b793672
Monotone-Revision: 5253a478333e1c7fb21c61abd4592b1f92a0c899

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-08-13T06:46:49
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle 2009-08-13 06:46:49 +00:00
commit 87b0e27193
2 changed files with 192 additions and 198 deletions

View file

@ -187,13 +187,7 @@ DIV#folderTreeContent
.titlediv .titlediv
{ {
height: 2em; height: 2em;
vertical-align: bottom; line-height: 18px;
padding-top: 6px;
padding-left: 6px;
}
.titlediv
{ line-height: 18px;
vertical-align: middle; vertical-align: middle;
padding-top: 0px; padding-top: 0px;
padding-left: 6px; } padding-left: 6px; }

View file

@ -1,205 +1,205 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var SOGoDragHandlesInterface = { var SOGoDragHandlesInterface = {
leftMargin: 180, leftMargin: 180,
topMargin: 140, topMargin: 140,
dhType: null, dhType: null,
dhLimit: -1, dhLimit: -1,
origX: -1, origX: -1,
origLeft: -1, origLeft: -1,
origRight: -1, origRight: -1,
origY: -1, origY: -1,
origUpper: -1, origUpper: -1,
origLower: -1, origLower: -1,
delta: -1, delta: -1,
btn: null, btn: null,
leftBlock: null, leftBlock: null,
rightBlock: null, rightBlock: null,
upperBlock: null, upperBlock: null,
lowerBlock: null, lowerBlock: null,
startHandleDraggingBound: null, startHandleDraggingBound: null,
stopHandleDraggingBound: null, stopHandleDraggingBound: null,
moveBound: null, moveBound: null,
delayedSave: null, delayedSave: null,
bind: function () { bind: function () {
this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this); this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this);
this.observe("mousedown", this.startHandleDraggingBound, false); this.observe("mousedown", this.startHandleDraggingBound, false);
}, },
adjust: function () { adjust: function () {
if (!this.dhType) if (!this.dhType)
this._determineType(); this._determineType();
if (this.dhType == 'horizontal') { if (this.dhType == 'horizontal') {
this.dhLimit = window.width() - 20; this.dhLimit = window.width() - 20;
if (parseInt(this.getStyle("left")) > this.dhLimit) { if (parseInt(this.getStyle("left")) > this.dhLimit) {
this.setStyle({ left: this.dhLimit + "px" }); this.setStyle({ left: this.dhLimit + "px" });
this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' }); this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' });
this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' }); this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' });
if (this.delayedSave) window.clearTimeout(this.delayedSave); if (this.delayedSave) window.clearTimeout(this.delayedSave);
this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback); this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback);
} }
} }
else if (this.dhType == 'vertical') { else if (this.dhType == 'vertical') {
this.dhLimit = window.height() - 20 - this.upperBlock.cumulativeOffset()[1] + this.upperBlock.offsetTop; this.dhLimit = window.height() - 20 - this.upperBlock.cumulativeOffset()[1] + this.upperBlock.offsetTop;
if (parseInt(this.getStyle("top")) > this.dhLimit) { if (parseInt(this.getStyle("top")) > this.dhLimit) {
this.setStyle({ top: this.dhLimit + 'px' }); this.setStyle({ top: this.dhLimit + 'px' });
this.lowerBlock.setStyle({ top: this.dhLimit + 'px' }); this.lowerBlock.setStyle({ top: this.dhLimit + 'px' });
this.upperBlock.setStyle({ height: (this.dhLimit - this.upperBlock.offsetTop) + 'px' }); this.upperBlock.setStyle({ height: (this.dhLimit - this.upperBlock.offsetTop) + 'px' });
if (this.delayedSave) window.clearTimeout(this.delayedSave); if (this.delayedSave) window.clearTimeout(this.delayedSave);
this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback); this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback);
} }
} }
}, },
_determineType: function () { _determineType: function () {
if (this.leftBlock && this.rightBlock) if (this.leftBlock && this.rightBlock)
this.dhType = 'horizontal'; this.dhType = 'horizontal';
else if (this.upperBlock && this.lowerBlock) else if (this.upperBlock && this.lowerBlock)
this.dhType = 'vertical'; this.dhType = 'vertical';
}, },
startHandleDragging: function (event) { startHandleDragging: function (event) {
this.btn = event.button; this.btn = event.button;
if (!this.dhType) if (!this.dhType)
this._determineType(); this._determineType();
var targ = getTarget(event); var targ = getTarget(event);
if (targ.nodeType == 1) { if (targ.nodeType == 1) {
if (this.dhType == 'horizontal') { if (this.dhType == 'horizontal') {
this.dhLimit = window.width() - 20; this.dhLimit = window.width() - 20;
this.origX = this.offsetLeft; this.origX = this.offsetLeft;
this.origLeft = this.leftBlock.offsetWidth; this.origLeft = this.leftBlock.offsetWidth;
this.delta = 0; this.delta = 0;
this.origRight = this.rightBlock.offsetLeft - 5; this.origRight = this.rightBlock.offsetLeft - 5;
document.body.setStyle({ cursor: "e-resize" }); document.body.setStyle({ cursor: "e-resize" });
} else if (this.dhType == 'vertical') { } else if (this.dhType == 'vertical') {
this.dhLimit = window.height() - 20; this.dhLimit = window.height() - 20;
this.origY = this.offsetTop; this.origY = this.offsetTop;
this.origUpper = this.upperBlock.offsetHeight; this.origUpper = this.upperBlock.offsetHeight;
var pointY = Event.pointerY(event); var pointY = Event.pointerY(event);
this.delta = pointY - this.offsetTop - 5; this.delta = pointY - this.offsetTop - 5;
this.origLower = this.lowerBlock.offsetTop - 5; this.origLower = this.lowerBlock.offsetTop - 5;
document.body.setStyle({ cursor: "n-resize" }); document.body.setStyle({ cursor: "n-resize" });
} }
this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this); this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this);
if (Prototype.Browser.IE) if (Prototype.Browser.IE)
Event.observe(document.body, "mouseup", this.stopHandleDraggingBound); Event.observe(document.body, "mouseup", this.stopHandleDraggingBound);
else else
Event.observe(window, "mouseup", this.stopHandleDraggingBound); Event.observe(window, "mouseup", this.stopHandleDraggingBound);
this.moveBound = this.move.bindAsEventListener(this); this.moveBound = this.move.bindAsEventListener(this);
Event.observe(document.body, "mousemove", this.moveBound); Event.observe(document.body, "mousemove", this.moveBound);
this.move(event); this.move(event);
} }
return false; return false;
}, },
stopHandleDragging: function (event) { stopHandleDragging: function (event) {
if (!this.dhType) if (!this.dhType)
this._determineType(); this._determineType();
if (this.dhType == 'horizontal') { if (this.dhType == 'horizontal') {
var pointerX = Event.pointerX(event); var pointerX = Event.pointerX(event);
if (pointerX <= this.leftMargin) { if (pointerX <= this.leftMargin) {
this.rightBlock.setStyle({ left: (this.leftMargin) + 'px' }); this.rightBlock.setStyle({ left: (this.leftMargin) + 'px' });
this.leftBlock.setStyle({ width: (this.leftMargin) + 'px' }); this.leftBlock.setStyle({ width: (this.leftMargin) + 'px' });
} }
else if (pointerX >= this.dhLimit) { else if (pointerX >= this.dhLimit) {
this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' }); this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' });
this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' }); this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' });
} }
else { else {
var deltaX = Math.floor(pointerX - this.origX - (this.offsetWidth / 2)); var deltaX = Math.floor(pointerX - this.origX - (this.offsetWidth / 2));
this.rightBlock.setStyle({ left: (this.origRight + deltaX) + 'px' }); this.rightBlock.setStyle({ left: (this.origRight + deltaX) + 'px' });
this.leftBlock.setStyle({ width: (this.origLeft + deltaX) + 'px' }); this.leftBlock.setStyle({ width: (this.origLeft + deltaX) + 'px' });
} }
this.saveDragHandleState(this.dhType, parseInt(this.leftBlock.getStyle("width"))); this.saveDragHandleState(this.dhType, parseInt(this.leftBlock.getStyle("width")));
} }
else if (this.dhType == 'vertical') { else if (this.dhType == 'vertical') {
var pointerY = Event.pointerY(event); var pointerY = Event.pointerY(event);
var deltaY; var deltaY;
if (pointerY <= this.topMargin) if (pointerY <= this.topMargin)
deltaY = Math.floor(this.topMargin - this.origY - (this.offsetHeight / 2)); deltaY = Math.floor(this.topMargin - this.origY - (this.offsetHeight / 2));
else if (pointerY >= this.dhLimit) else if (pointerY >= this.dhLimit)
deltaY = Math.floor(this.dhLimit - this.origY - (this.offsetHeight / 2)); deltaY = Math.floor(this.dhLimit - this.origY - (this.offsetHeight / 2));
else else
deltaY = Math.floor(pointerY - this.origY - (this.offsetHeight / 2)); deltaY = Math.floor(pointerY - this.origY - (this.offsetHeight / 2));
this.lowerBlock.setStyle({ top: (this.origLower + deltaY - this.delta) + 'px' }); this.lowerBlock.setStyle({ top: (this.origLower + deltaY - this.delta) + 'px' });
this.upperBlock.setStyle({ height: (this.origUpper + deltaY - this.delta) + 'px' }); this.upperBlock.setStyle({ height: (this.origUpper + deltaY - this.delta) + 'px' });
this.saveDragHandleState(this.dhType, parseInt(this.lowerBlock.getStyle("top"))); this.saveDragHandleState(this.dhType, parseInt(this.lowerBlock.getStyle("top")));
} }
if (Prototype.Browser.IE) if (Prototype.Browser.IE)
Event.stopObserving(document.body, "mouseup", this.stopHandleDraggingBound); Event.stopObserving(document.body, "mouseup", this.stopHandleDraggingBound);
else else
Event.stopObserving(window, "mouseup", this.stopHandleDraggingBound); Event.stopObserving(window, "mouseup", this.stopHandleDraggingBound);
Event.stopObserving(document.body, "mousemove", this.moveBound); Event.stopObserving(document.body, "mousemove", this.moveBound);
document.body.setAttribute('style', ''); document.body.setAttribute('style', '');
document.body.setStyle({ cursor: "default" }); document.body.setStyle({ cursor: "default" });
Event.stop(event); Event.stop(event);
}, },
move: function (event) { move: function (event) {
if (!this.dhType) if (!this.dhType)
this._determineType(); this._determineType();
if (this.dhType == 'horizontal') { if (this.dhType == 'horizontal') {
var hX = Event.pointerX(event); var hX = Event.pointerX(event);
var width = this.offsetWidth; var width = this.offsetWidth;
if (hX < this.leftMargin) if (hX < this.leftMargin)
hX = this.leftMargin + Math.floor(width / 2); hX = this.leftMargin + Math.floor(width / 2);
else if (hX > this.dhLimit) else if (hX > this.dhLimit)
hX = this.dhLimit + Math.floor(width / 2); hX = this.dhLimit + Math.floor(width / 2);
var newLeft = Math.floor(hX - (width / 2)); var newLeft = Math.floor(hX - (width / 2));
this.setStyle({ left: newLeft + 'px' }); this.setStyle({ left: newLeft + 'px' });
} else if (this.dhType == 'vertical') { } else if (this.dhType == 'vertical') {
var hY = Event.pointerY(event); var hY = Event.pointerY(event);
var height = this.offsetHeight; var height = this.offsetHeight;
if (hY < this.topMargin) if (hY < this.topMargin)
hY = this.topMargin; hY = this.topMargin;
else if (hY > this.dhLimit) else if (hY > this.dhLimit)
hY = this.dhLimit; hY = this.dhLimit;
var newTop = Math.floor(hY - (height / 2)) - this.delta; var newTop = Math.floor(hY - (height / 2)) - this.delta;
this.setStyle({ top: newTop + 'px' }); this.setStyle({ top: newTop + 'px' });
} }
Event.stop(event); Event.stop(event);
if (Prototype.Browser.IE && event.button != this.btn) if (Prototype.Browser.IE && event.button != this.btn)
this.stopHandleDragging(event); this.stopHandleDragging(event);
}, },
doubleClick: function (event) { doubleClick: function (event) {
if (!this.dhType) if (!this.dhType)
this._determineType(); this._determineType();
if (this.dhType == 'horizontal') { if (this.dhType == 'horizontal') {
var lLeft = this.leftBlock.offsetLeft; var lLeft = this.leftBlock.offsetLeft;
if (this.offsetLeft > lLeft) { if (this.offsetLeft > lLeft) {
var leftdelta = this.rightBlock.offsetLeft - this.offsetLeft; var leftdelta = this.rightBlock.offsetLeft - this.offsetLeft;
this.setStyle({ left: lLeft + 'px' }); this.setStyle({ left: lLeft + 'px' });
this.leftBlock.setStyle({ width: '0px' }); this.leftBlock.setStyle({ width: '0px' });
this.rightBlock.setStyle({ left: (lLeft + leftdelta) + 'px' }); this.rightBlock.setStyle({ left: (lLeft + leftdelta) + 'px' });
} }
} else if (this.dhType == 'vertical') { } else if (this.dhType == 'vertical') {
var uTop = this.upperBlock.offsetTop; var uTop = this.upperBlock.offsetTop;
if (this.offsetTop > uTop) { if (this.offsetTop > uTop) {
var topdelta = this.lowerBlock.offsetTop - this.offsetTop; var topdelta = this.lowerBlock.offsetTop - this.offsetTop;
this.setStyle({ top: uTop + 'px' }); this.setStyle({ top: uTop + 'px' });
this.upperBlock.setStyle({ width: '0px' }); this.upperBlock.setStyle({ width: '0px' });
this.lowerBlock.setStyle({ top: (uTop + topdelta) + 'px' }); this.lowerBlock.setStyle({ top: (uTop + topdelta) + 'px' });
} }
}
},
saveDragHandleState: function (type, position, fcn) {
if (!$(document.body).hasClassName("popup")) {
var urlstr = ApplicationBaseURL + "saveDragHandleState"
+ "?" + type + "=" + position;
var callbackFunction = fcn || this.saveDragHandleStateCallback;
triggerAjaxRequest(urlstr, callbackFunction);
}
},
saveDragHandleStateCallback: function (http) {
if (isHttpStatus204(http.status)) {
log ("drag handle state saved");
}
else if (http.readyState == 4) {
log ("can't save handle state");
}
} }
},
saveDragHandleState: function (type, position, fcn) {
if (!$(document.body).hasClassName("popup")) {
var urlstr = ApplicationBaseURL + "saveDragHandleState"
+ "?" + type + "=" + position;
var callbackFunction = fcn || this.saveDragHandleStateCallback;
triggerAjaxRequest(urlstr, callbackFunction);
}
},
saveDragHandleStateCallback: function (http) {
if (isHttpStatus204(http.status)) {
log ("drag handle state saved");
}
else if (http.readyState == 4) {
log ("can't save handle state");
}
}
}; };