Author: tan_pham_dinh
Date: 2009-12-20 22:58:40 -0500 (Sun, 20 Dec 2009)
New Revision: 1084
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DOMUtil.js
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
Log:
GTNPORTAL-376: NPE when DnD Container in IE
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DOMUtil.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DOMUtil.js 2009-12-21
01:53:29 UTC (rev 1083)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/core/DOMUtil.js 2009-12-21
03:58:40 UTC (rev 1084)
@@ -235,6 +235,17 @@
return null ;
} ;
/**
+ * Returns true if root has obj as a ancestor
+ */
+DOMUtil.prototype.hasAncestor= function(root, obj) {
+ var prtEle = root.parentNode ;
+ while (prtEle) {
+ if(prtEle == obj) return true;
+ prtEle = prtEle.parentNode;
+ }
+ return false ;
+} ;
+/**
* Returns true if root has obj as a descendant
*/
DOMUtil.prototype.hasDescendant= function(root, obj) {
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-12-21
01:53:29 UTC (rev 1083)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-12-21
03:58:40 UTC (rev 1084)
@@ -255,13 +255,13 @@
if(componentBlock != null) {
var dragBlock = eXo.portal.UIPortal.findUIComponentOf(componentBlock) ;
- DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(), clickObject,
dragBlock, e) ;
+ DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject,
dragBlock, e) ;
} else {
var dragBlock = DOMUtil.findAncestorByClass(clickObject,
"DragObjectPortlet") ;
if(dragBlock) {
- DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(), clickObject,
dragBlock, e) ;
+ DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject,
dragBlock, e) ;
} else {
- DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(), clickObject,
clickObject, e) ;
+ DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject,
clickObject, e) ;
}
}
};
@@ -310,7 +310,7 @@
};
/* Find components in dropable target */
-PortalDragDrop.prototype.findDropableTargets = function() {
+PortalDragDrop.prototype.findDropableTargets = function(dragBlock) {
var dropableTargets = new Array() ;
var uiWorkingWorkspace = document.getElementById("UIWorkingWorkspace") ;
var uiPortal = eXo.core.DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace,
"div", "UIPortal") ;
@@ -323,6 +323,7 @@
if(uiPage) dropableTargets.push(uiPage) ;
}
for(var i = 0; i < uiContainers.length; i++) {
+ if (eXo.core.DOMUtil.hasAncestor(uiContainers[i], dragBlock)) continue;
dropableTargets.push(uiContainers[i]) ;
}
return dropableTargets ;
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2009-12-21
01:53:29 UTC (rev 1083)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2009-12-21
03:58:40 UTC (rev 1084)
@@ -98,7 +98,7 @@
} else {
newLayer.parentNode.style.width = width + "px";
var normalBlock = DOMUtil.findFirstChildByClass(portlet, "div",
"NormalContainerBlock");
- DOMUtil.replaceClass(normalBlock, "NormalContainerBlock",
"OverContainerBlock");
+ if(normalBlock) DOMUtil.replaceClass(normalBlock, "NormalContainerBlock",
"OverContainerBlock");
}
newLayer.parentNode.style.top = -height + "px";
editBlock.style.display = "block";
@@ -106,15 +106,18 @@
editBlock.style.display = "none";
if(!DOMUtil.hasClass(portlet, "UIPortlet")) {
var normalBlock = DOMUtil.findFirstChildByClass(portlet, "div",
"OverContainerBlock");
- DOMUtil.replaceClass(normalBlock, "OverContainerBlock",
"NormalContainerBlock");
+ if(normalBlock) DOMUtil.replaceClass(normalBlock, "OverContainerBlock",
"NormalContainerBlock");
}
}
// Don't displat portlet control when View Container
var controlPortlet = DOMUtil.findFirstDescendantByClass(editBlock, "div",
"CONTROL-PORTLET");
- controlPortlet.style.display = "block";
- if (controlPortlet != null && eXo.portal.portalMode == 4) {
+ if (controlPortlet) {
+ if(eXo.portal.portalMode == 4) {
controlPortlet.style.display = "none";
+ } else {
+ controlPortlet.style.display = "block";
+ }
}
};