Monotone-Parent: 027321e56420de11bdfda4ed6b6c00478c2c22c7

Monotone-Revision: 09b0a5cd67d25ff0d88a9e37ad1b0a7e9ee8e274

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-05-25T18:17:00
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-05-25 18:17:00 +00:00
parent 417f555238
commit e26102d5ec
3 changed files with 74 additions and 12 deletions

View File

@@ -377,6 +377,22 @@ var SOGoDragGhostInterface = {
this.title = title;
}
},
setLocation: function SDGI_setLocation(location) {
if (this.location != location) {
var spans = this.inside.select("SPAN.location");
if (spans && spans.length > 0) {
this.inside.removeChild(spans[0]);
}
if (location) {
this.inside.appendChild(createElement("br"));
var span = createElement("span", null, "location");
span.appendChild(document.createTextNode(location));
this.inside.appendChild(span);
}
this.location = location;
}
},
setFolderClass: function SDGI_setFolderClass(folderClass) {
if (this.folderClass != folderClass) {
this.removeClassName(this.folderClass);
@@ -455,6 +471,10 @@ SOGoEventDragGhostController.prototype = {
this.eventTitle = title;
},
setLocation: function SEDGC_setLocation(location) {
this.eventLocation = location;
},
setFolderClass: function SEDGC_setFolderClass(folderClass) {
this.folderClass = folderClass;
},
@@ -621,6 +641,7 @@ SOGoEventDragGhostController.prototype = {
ghost.setStartGhost();
ghost.unsetEndGhost();
ghost.setTitle(this.eventTitle);
ghost.setLocation(this.eventLocation);
ghost.setFolderClass(this.folderClass);
ghost.setStart(this.currentCoordinates.start);
ghost.setDuration(duration);
@@ -936,6 +957,7 @@ SOGoEventDragController.prototype = {
this._prepareEventType();
this._determineTitleAndFolderClass();
this.ghostController.setTitle(this.title);
this.ghostController.setLocation(this.location);
this.ghostController.setFolderClass(this.folderClass);
this.onDragStartBound = this.onDragStart.bindAsEventListener(this);
@@ -1184,36 +1206,67 @@ SOGoEventDragController.prototype = {
_determineTitleAndFolderClass: function SEDC__dTAFC() {
var title = "";
var folderClass = "";
var location = null;
if (this.eventCells) {
var firstCell = this.eventCells[0];
var divs = firstCell.childNodesWithTag("div");
for (var i = 0; i < divs.length; i++) {
var div = divs[i];
if (div.hasClassName("eventInside")) {
title = this._determineTitleFromDIV(div);
var titleDIV = this._determineTitleDIV(div);
if (titleDIV) {
title = this._determineTitleFromDIV(titleDIV);
location = this._determineLocationFromDIV(titleDIV);
}
folderClass = this._determineFolderClassFromDIV(div);
}
}
}
this.title = title;
this.location = location;
this.folderClass = folderClass;
},
_determineTitleFromDIV: function SEDC__determineTitleFromDIV(div) {
var title = "";
_determineTitleDIV: function SEDC__determineTitleDIV(div) {
var titleDIV = null;
var insideDivs = div.childNodesWithTag("div");
for (var i = 0; i < insideDivs.length; i++) {
for (var i = 0; titleDIV == null && i < insideDivs.length; i++) {
var insideDiv = insideDivs[i];
if (insideDiv.hasClassName("text")) {
var currentNode = insideDiv.firstChild;
while (currentNode) {
title += currentNode.nodeValue;
currentNode = currentNode.nextSibling;
}
title = title.trim();
titleDIV = insideDiv;
}
}
return title;
return titleDIV;
},
_determineTitleFromDIV: function SEDC__determineTitleFromDIV(titleDIV) {
var title = "";
var currentNode = titleDIV.firstChild;
while (currentNode) {
if (currentNode.nodeType == Node.TEXT_NODE) {
title += currentNode.nodeValue;
}
currentNode = currentNode.nextSibling;
}
return title.trim();
},
_determineLocationFromDIV: function SEDC__determineLocationFromDIV(titleDIV) {
var location = "";
var spans = titleDIV.select("span.location");
if (spans && spans.length > 0) {
var locationSPAN = spans[0];
var currentNode = locationSPAN.firstChild;
while (currentNode) {
if (currentNode.nodeType == Node.TEXT_NODE) {
location += currentNode.nodeValue;
}
currentNode = currentNode.nextSibling;
}
}
return location.trim();
},
_determineFolderClassFromDIV: function SEDC__detFolderClassFromDIV(div) {
var folderClass = null;