mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-11 22:45:26 +00:00
merge of '2d256ad5de45712bf664154e503ef162f9780ce7'
and '78e483b4fe68843e9833d79d7bde59ac5321291c' Monotone-Parent: 2d256ad5de45712bf664154e503ef162f9780ce7 Monotone-Parent: 78e483b4fe68843e9833d79d7bde59ac5321291c Monotone-Revision: dac2c88734449dfb2523709ee6ad66d821245e35 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-06-30T19:08:00 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2009-06-30 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/MailerUI.js: Added drag & drop support!
|
||||
* UI/MailPartViewers/UIxMailPartHTMLViewer.m: Removed an extra NSLog
|
||||
|
||||
2009-06-29 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/ContactsUI.js: Added drag & drop support
|
||||
|
||||
@@ -426,7 +426,7 @@ _xmlCharsetForCharset (NSString *charset)
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog (@"%@", _localName);
|
||||
//NSLog (@"%@", _localName);
|
||||
[result appendFormat: @"</%@>", _localName];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<html><head></head><body style="background-color: #dbdad5;"
|
||||
><script type="text/javascript"
|
||||
><var:if condition="hasRefreshMethod"
|
||||
>window.opener.setTimeout('<var:string value="refreshMethod"
|
||||
>if (window.opener) window.opener.setTimeout('<var:string value="refreshMethod"
|
||||
const:escapeHTML="NO" />;', 50);</var:if
|
||||
>window.close();</script
|
||||
></body></html
|
||||
|
||||
@@ -126,7 +126,6 @@
|
||||
<script type="text/javascript" rsrc:src="HTMLInputElement.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="HTMLTableElement.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="generic.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="SOGoDragAndDrop.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="SOGoDragHandles.js"><!-- space --></script>
|
||||
<script type="text/javascript" rsrc:src="scriptaculous/scriptaculous.js"><!-- space --></script>
|
||||
<var:if condition="hasProductSpecificJavaScript"><script type="text/javascript"
|
||||
|
||||
@@ -1068,7 +1068,6 @@ function initContacts(event) {
|
||||
function configureDragAndDrop () {
|
||||
var mainElement = new Element ("div", {id: "dragDropVisual"});
|
||||
document.body.appendChild(mainElement);
|
||||
log ("1");
|
||||
mainElement.absolutize ();
|
||||
mainElement.style.display = "none";
|
||||
|
||||
@@ -1079,11 +1078,9 @@ function configureDragAndDrop () {
|
||||
onEnd: stopDragging,
|
||||
onDrag: whileDragging
|
||||
});
|
||||
log ("2");
|
||||
|
||||
var drops = $$("ul#contactFolders li");
|
||||
drops.each (function (drop) {
|
||||
log ("3");
|
||||
if (!drop.hasClassName ("remote"))
|
||||
Droppables.add (drop.id,
|
||||
{
|
||||
|
||||
@@ -805,3 +805,20 @@ DIV#rightDragHandle
|
||||
{ position: static;
|
||||
overflow: visible; }
|
||||
}
|
||||
|
||||
DIV#dragDropVisual
|
||||
{
|
||||
background-image: url(/SOGo.woa/WebServerResources/message.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 4px 2px;
|
||||
width: 5px;
|
||||
height: 20px;
|
||||
padding-left: 24px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
DIV.copy
|
||||
{
|
||||
background-image: url(/SOGo.woa/WebServerResources/message-copy.gif) !important;
|
||||
background-position: 1px -2px !important;
|
||||
}
|
||||
|
||||
@@ -660,6 +660,7 @@ function messageListCallback(http) {
|
||||
table = $('messageList');
|
||||
configureMessageListEvents(table);
|
||||
TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
|
||||
setTimeout ('configureDragAndDrop ();', 500);
|
||||
}
|
||||
configureMessageListBodyEvents(table);
|
||||
|
||||
@@ -2221,3 +2222,90 @@ Mailbox.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function configureDragAndDrop () {
|
||||
var mainElement = new Element ("div", {id: "dragDropVisual"});
|
||||
document.body.appendChild(mainElement);
|
||||
mainElement.absolutize ();
|
||||
mainElement.style.display = "none";
|
||||
|
||||
new Draggable ("dragDropVisual",
|
||||
{
|
||||
handle: "messageList",
|
||||
onStart: startDragging,
|
||||
onEnd: stopDragging,
|
||||
onDrag: whileDragging
|
||||
});
|
||||
|
||||
var drops = $$("div#dmailboxTree1 div.dTreeNode a.node span.nodeName");
|
||||
drops.each (function (drop) {
|
||||
drop.identify ()
|
||||
Droppables.add (drop.id,
|
||||
{
|
||||
hoverclass: "genericHoverClass",
|
||||
onDrop: dropAction
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function startDragging (itm, e) {
|
||||
var handle = $("dragDropVisual");
|
||||
var count = $('messageList').getSelectedRowsId().length;
|
||||
|
||||
handle.style.display = "block";
|
||||
handle.update (count);
|
||||
if (e.shiftKey)
|
||||
handle.addClassName ("copy");
|
||||
}
|
||||
|
||||
function whileDragging (itm, e) {
|
||||
var handle = $("dragDropVisual");
|
||||
if (e.shiftKey)
|
||||
handle.addClassName ("copy");
|
||||
else if (handle.hasClassName ("copy"))
|
||||
handle.removeClassName ("copy");
|
||||
}
|
||||
|
||||
function stopDragging () {
|
||||
var handle = $("dragDropVisual");
|
||||
handle.style.display = "none";
|
||||
if (handle.hasClassName ("copy"))
|
||||
handle.removeClassName ("copy");
|
||||
}
|
||||
|
||||
function dropAction (dropped, zone, e) {
|
||||
var action = "move";
|
||||
var destination = zone.up ("div.dTreeNode").readAttribute ("dataname");
|
||||
|
||||
if ($("dragDropVisual").hasClassName ("copy"))
|
||||
action = "copy";
|
||||
|
||||
dropSelectedContacts (action, destination);
|
||||
}
|
||||
|
||||
function dropSelectedContacts (action, targetMailbox) {
|
||||
var messageList = $("messageList").down("TBODY");
|
||||
var rows = messageList.getSelectedNodes();
|
||||
var uids = new Array(); // message IDs
|
||||
var paths = new Array(); // row IDs
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var uid = rows[i].readAttribute("id").substr(4);
|
||||
var path = Mailer.currentMailbox + "/" + uid;
|
||||
rows[i].hide();
|
||||
uids.push(uid);
|
||||
paths.push(path);
|
||||
}
|
||||
|
||||
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/" + action + "Messages";
|
||||
var parameters = "uid=" + uids.join(",") + "&folder=" + targetMailbox;
|
||||
var data = { "id": uids, "mailbox": Mailer.currentMailbox, "path": paths, "folder": targetMailbox };
|
||||
triggerAjaxRequest(url, refreshCurrentFolder, data, parameters,
|
||||
{ "Content-type": "application/x-www-form-urlencoded" });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||
|
||||
/* drag and drop */
|
||||
|
||||
/* HTMLElement interface */
|
||||
var SOGODragAndDropSourceInterface = {
|
||||
_removeGestureHandlers: function () {
|
||||
window.removeEventListener("mousemove", this.dragGestureMouseMoveHandler, false);
|
||||
window.removeEventListener("mouseup", this.dragGestureMouseUpHandler, false);
|
||||
document._dragGestureStartPoint = null;
|
||||
document._currentMouseGestureObject = null;
|
||||
},
|
||||
bind: function() {
|
||||
this.addEventListener("mousedown", this.dragGestureMouseDownHandler, false);
|
||||
},
|
||||
dragGestureMouseDownHandler: function (event) {
|
||||
if (event.button == 0) {
|
||||
document._dragGestureStartPoint = new Array(event.clientX,
|
||||
event.clientY);
|
||||
document._currentMouseGestureObject = this;
|
||||
window.addEventListener("mousemove", this.dragGestureMouseMoveHandler,
|
||||
false);
|
||||
window.addEventListener("mouseup", this.dragGestureMouseUpHandler,
|
||||
false);
|
||||
}
|
||||
},
|
||||
dragGestureMouseUpHandler: function (event) {
|
||||
document._currentMouseGestureObject._removeGestureHandlers();
|
||||
},
|
||||
dragGestureMouseMoveHandler: function (event) {
|
||||
var deltaX = event.clientX - document._dragGestureStartPoint[0];
|
||||
var deltaY = event.clientY - document._dragGestureStartPoint[1];
|
||||
if (Math.sqrt((deltaX * deltaX) + (deltaY * deltaY)) > 10) {
|
||||
event.returnValue = true;
|
||||
event.cancelBubble = true;
|
||||
var object = document._currentMouseGestureObject;
|
||||
var point = document._dragGestureStartPoint;
|
||||
document.DNDManager.startDragging(object, point);
|
||||
document._currentMouseGestureObject._removeGestureHandlers();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* DNDManager */
|
||||
document.DNDManager = {
|
||||
lastSource: 0,
|
||||
lastDestination: 0,
|
||||
sources: new Array(),
|
||||
destinations: new Array(),
|
||||
registerSource: function (source) {
|
||||
var id = source.getAttribute("id");
|
||||
if (!id) {
|
||||
id = "_dndSource" + (this.lastSource + 1);
|
||||
source.setAttribute("id", id);
|
||||
}
|
||||
this.sources[id] = source;
|
||||
this.lastSource++;
|
||||
source.addInterface(SOGODragAndDropSourceInterface);
|
||||
},
|
||||
registerDestination: function (destination) {
|
||||
var id = destination.getAttribute("id");
|
||||
if (!id) {
|
||||
id = "_dndDestination" + (this.lastDestination + 1);
|
||||
destination.setAttribute("id", id);
|
||||
}
|
||||
this.destinations[id] = destination;
|
||||
this.lastDestination++;
|
||||
},
|
||||
_lookupSource: function (target) {
|
||||
var source = null;
|
||||
var id = target.getAttribute("id");
|
||||
if (id)
|
||||
source = document.DNDManager.sources[id];
|
||||
return source;
|
||||
},
|
||||
_lookupDestination: function (target) {
|
||||
var destination = null;
|
||||
var id = target.getAttribute("id");
|
||||
if (id)
|
||||
destination = document.DNDManager.destinations[id];
|
||||
return destination;
|
||||
},
|
||||
startDragging: function (object, point) {
|
||||
var source = document.DNDManager._lookupSource (object);
|
||||
if (source) {
|
||||
document.DNDManager.currentDndOperation = new document.DNDOperation(source, point);
|
||||
window.addEventListener("mouseup",
|
||||
document.DNDManager.destinationDrop, false);
|
||||
window.addEventListener("mouseover",
|
||||
document.DNDManager.destinationEnter, false);
|
||||
window.addEventListener("mousemove",
|
||||
document.DNDManager.destinationOver, false);
|
||||
window.addEventListener("mouseout",
|
||||
document.DNDManager.destinationExit, false);
|
||||
}
|
||||
},
|
||||
destinationEnter: function (event) {
|
||||
var operation = document.DNDManager.currentDndOperation;
|
||||
var destination = document.DNDManager._lookupDestination (event.target);
|
||||
if (operation && destination && destination.dndAcceptType) {
|
||||
operation.type = null;
|
||||
var i = 0;
|
||||
while (operation.type == null
|
||||
&& i < operation.types.length) {
|
||||
if (destination.dndAcceptType(operation.types[i])) {
|
||||
operation.type = operation.types[i];
|
||||
operation.setDestination(destination);
|
||||
if (destination.dndEnter)
|
||||
destination.dndEnter(event, operation.source, operation.type);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
},
|
||||
destinationExit: function (event) {
|
||||
var operation = document.DNDManager.currentDndOperation;
|
||||
if (operation
|
||||
&& operation.destination == event.target) {
|
||||
if (operation.destination.dndExit)
|
||||
event.target.dndExit();
|
||||
operation.setDestination(null);
|
||||
}
|
||||
},
|
||||
destinationOver: function (event) {
|
||||
},
|
||||
destinationDrop: function (event) {
|
||||
var operation = document.DNDManager.currentDndOperation;
|
||||
if (operation) {
|
||||
window.removeEventListener("mouseup",
|
||||
document.DNDManager.destinationDrop, false);
|
||||
window.removeEventListener("mouseover",
|
||||
document.DNDManager.destinationEnter, false);
|
||||
window.removeEventListener("mousemove",
|
||||
document.DNDManager.destinationOver, false);
|
||||
window.removeEventListener("mouseout",
|
||||
document.DNDManager.destinationExit, false);
|
||||
if (operation.destination == event.target) {
|
||||
if (operation.destination.dndExit) {
|
||||
operation.destination.dndExit();
|
||||
}
|
||||
if (operation.destination.dndDrop) {
|
||||
var data = null;
|
||||
if (operation.source.dndDataForType)
|
||||
data = operation.source.dndDataForType(operation.type);
|
||||
var result = operation.destination.dndDrop(data);
|
||||
if (operation.ghost) {
|
||||
if (result)
|
||||
operation.bustGhost();
|
||||
else
|
||||
operation.chaseGhost();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (operation.ghost)
|
||||
operation.chaseGhost();
|
||||
} else {
|
||||
if (operation.ghost)
|
||||
operation.chaseGhost();
|
||||
}
|
||||
document.DNDManager.currentDndOperation = null;
|
||||
}
|
||||
},
|
||||
currentDndOperation: null
|
||||
};
|
||||
|
||||
/* DNDOperation */
|
||||
document.DNDOperation = function (source, point) {
|
||||
this.startPoint = point;
|
||||
this.source = source;
|
||||
if (source.dndTypes) {
|
||||
this.types = source.dndTypes();
|
||||
}
|
||||
this.type = null;
|
||||
this.destination = null;
|
||||
if (source.dndGhost) {
|
||||
var ghost = source.dndGhost();
|
||||
ghost.style.position = "absolute;";
|
||||
ghost.style.zIndex = 10000;
|
||||
ghost.style.MozOpacity = 0.8;
|
||||
document.body.appendChild(ghost);
|
||||
this.ghost = ghost;
|
||||
|
||||
document.addEventListener("mousemove", this.moveGhost, false);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
document.DNDOperation.prototype.setDestination = function(destination) {
|
||||
this.destination = destination;
|
||||
};
|
||||
|
||||
document.DNDOperation.prototype.moveGhost = function(event) {
|
||||
var offsetX = event.clientX;
|
||||
var offsetY = event.clientY;
|
||||
if (document.DNDManager.currentDndOperation.ghost.ghostOffsetX)
|
||||
offsetX += document.DNDManager.currentDndOperation.ghost.ghostOffsetX;
|
||||
if (document.DNDManager.currentDndOperation.ghost.ghostOffsetY)
|
||||
offsetY += document.DNDManager.currentDndOperation.ghost.ghostOffsetY;
|
||||
|
||||
document.DNDManager.currentDndOperation.ghost.style.left = offsetX + "px;";
|
||||
document.DNDManager.currentDndOperation.ghost.style.top = offsetY + "px;";
|
||||
};
|
||||
|
||||
document.DNDOperation.prototype.bustGhost = function() {
|
||||
document._dyingOperation = this;
|
||||
document.removeEventListener("mousemove", this.moveGhost, false);
|
||||
this.ghost.bustStep = 10;
|
||||
setTimeout("document._dyingOperation._fadeGhost();", 50);
|
||||
};
|
||||
|
||||
document.DNDOperation.prototype.chaseGhost = function() {
|
||||
document._dyingOperation = this;
|
||||
document.removeEventListener("mousemove", this.moveGhost, false);
|
||||
this.ghost.bustStep = 25;
|
||||
this.ghost.chaseStep = 25;
|
||||
this.ghost.style.overflow = "hidden;"
|
||||
this.ghost.style.whiteSpace = "nowrap;";
|
||||
this.ghost.chaseDeltaX = ((this.ghost.cascadeLeftOffset() - this.startPoint[0])
|
||||
/ this.ghost.chaseStep);
|
||||
this.ghost.chaseDeltaY = ((this.ghost.cascadeTopOffset() - this.startPoint[1])
|
||||
/ this.ghost.chaseStep);
|
||||
setTimeout("document._dyingOperation._chaseGhost();", 20);
|
||||
};
|
||||
|
||||
document.DNDOperation.prototype._chaseGhost = function() {
|
||||
if (this.ghost.chaseStep) {
|
||||
var newLeft = this.ghost.cascadeLeftOffset() - this.ghost.chaseDeltaX;
|
||||
var newTop = this.ghost.cascadeTopOffset() - this.ghost.chaseDeltaY;
|
||||
this.ghost.style.MozOpacity = (0.04 * this.ghost.chaseStep);
|
||||
this.ghost.style.left = newLeft + "px;";
|
||||
this.ghost.style.top = newTop + "px;";
|
||||
this.ghost.chaseStep--;
|
||||
setTimeout("document._dyingOperation._chaseGhost();", 20);
|
||||
}
|
||||
else {
|
||||
document.body.removeChild(this.ghost);
|
||||
this.ghost = null;
|
||||
}
|
||||
};
|
||||
|
||||
document.DNDOperation.prototype._fadeGhost = function() {
|
||||
if (this.ghost.bustStep) {
|
||||
this.ghost.style.MozOpacity = (0.1 * this.ghost.bustStep);
|
||||
this.ghost.style.width = (this.ghost.offsetWidth * .7) + "px;";
|
||||
this.ghost.style.height = (this.ghost.offsetHeight * .7) + "px;";
|
||||
this.ghost.bustStep--;
|
||||
setTimeout("document._dyingOperation._fadeGhost();", 50);
|
||||
}
|
||||
else {
|
||||
document.body.removeChild(this.ghost);
|
||||
this.ghost = null;
|
||||
}
|
||||
};
|
||||
@@ -8,4 +8,10 @@ CKEDITOR.editorConfig = function( config )
|
||||
// Define changes to default configuration here. For example:
|
||||
// config.language = 'fr';
|
||||
config.skin = 'kama';
|
||||
//TODO: This should work to remove the bottom DOM information, but doesn't
|
||||
// This way is on an instance of the config object
|
||||
config.removePlugins = "elementspath,kplahj";
|
||||
};
|
||||
|
||||
// This way is global / static
|
||||
CKEDITOR.config.removePlugins = "elementspath,kplahj";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 586 B |
Reference in New Issue
Block a user