Author: mpodolin
Date: 2010-04-06 04:27:23 -0400 (Tue, 06 Apr 2010)
New Revision: 2482
Added:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java
Modified:
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
Log:
JBEPP-205: GTNPORTAL-421 ported to the branch
Modified:
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
---
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2010-04-06
08:27:23 UTC (rev 2482)
@@ -52,17 +52,17 @@
var properties = ["top", eXo.core.I18n.isLT() ? "left" :
"right", "zIndex", "opacity", "filter",
"position"] ;
this.origDragObjectStyle.copyProperties(properties, dragObject.style) ;
- var isComponent = !!DOMUtil.findFirstDescendantByClass(dragObject, "div",
"UIComponentBlock");
+ var isAddingNewly = !DOMUtil.findFirstDescendantByClass(dragObject, "div",
"UIComponentBlock");
var uiWorkingWS = document.getElementById("UIWorkingWorkspace");
- PortalDragDrop.positionRootObj = isComponent ? uiWorkingWS :
+ PortalDragDrop.positionRootObj = !isAddingNewly ? uiWorkingWS :
DOMUtil.findFirstDescendantByClass(uiWorkingWS, "div",
"UIPortalComposer");
var originalDragObjectTop = Browser.findPosYInContainer(dragObject,
PortalDragDrop.positionRootObj);
var originalDragObjectLeft = Browser.findPosXInContainer(dragObject,
PortalDragDrop.positionRootObj);
PortalDragDrop.deltaYDragObjectAndMouse = Browser.findMouseRelativeY(dragObject, e);
PortalDragDrop.deltaXDragObjectAndMouse = Browser.findMouseRelativeX(dragObject, e);
- if(!isComponent) {
+ if(isAddingNewly) {
var contentContainer = DOMUtil.findAncestorByClass(dragObject,
"PopupContent");
originalDragObjectTop -= contentContainer.scrollTop;
PortalDragDrop.deltaYDragObjectAndMouse += contentContainer.scrollTop;
@@ -72,13 +72,15 @@
PortalDragDrop.backupDragObjectWidth = dragObject.offsetWidth ;
/*Case: dragObject out of UIPortal*/
- if(!isComponent) {
+
+ if(isAddingNewly) {
var cloneObject = dragObject.cloneNode(true) ;
dragObject.parentNode.insertBefore(cloneObject, dragObject) ;
cloneObject.style.opacity = 0.5 ;
cloneObject.style.filter = "alpha(opacity=50)" ;
cloneObject.style.width = PortalDragDrop.backupDragObjectWidth + "px" ;
dndEvent.dragObject = cloneObject ;
+ dndEvent.dragObject.isAddingNewly = isAddingNewly;
} else {
previewBlock = PortalDragDrop.createPreview();
dragObject.parentNode.insertBefore(previewBlock, dragObject);
@@ -90,8 +92,7 @@
if(newLayer) newLayer.style.width = "300px";
}
}
- dragObject.isComponent = isComponent;
-
+ dragObject.isAddingNewly = isAddingNewly;
dragObject = dndEvent.dragObject;
dragObject.style.position = "absolute" ;
if(eXo.core.I18n.isLT()) dragObject.style.left = originalDragObjectLeft +
"px" ;
@@ -110,11 +111,11 @@
if(dndEvent.foundTargetObject.className == "UIPage") {
uiComponentLayout = DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject,
"div", "VIEW-PAGE");
} else if(dndEvent.foundTargetObject.className == "UIPortal") {
- if(eXo.portal.portalMode%2) uiComponentLayout =
DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div",
"LAYOUT-PORTAL") ;
+ if(eXo.portal.portalMode % 2) uiComponentLayout =
DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div",
"LAYOUT-PORTAL") ;
else uiComponentLayout =
DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div",
"VIEW-PORTAL");
} else {
var foundUIComponent = new eXo.portal.UIPortalComponent(dndEvent.foundTargetObject)
;
- if(eXo.portal.portalMode%2) uiComponentLayout = foundUIComponent.getLayoutBlock()
;
+ if(eXo.portal.portalMode % 2) uiComponentLayout = foundUIComponent.getLayoutBlock()
;
else uiComponentLayout = foundUIComponent.getViewBlock();
uiComponentLayout.style.height = "auto";
}
@@ -178,10 +179,9 @@
dndEvent.foundTargetObject.foundIndex = insertPosition ;
/* Insert preview block */
- var tdBlock = document.createElement("td");
- tdBlock.id = tdBlock.className = "PreviewTDBlock";
- tdBlock.appendChild(previewBlock);
- previewTD = tdBlock;
+ previewTD = document.createElement("td");
+ previewTD.id = previewTD.className = "PreviewTDBlock";
+ previewTD.appendChild(previewBlock);
if(insertPosition >= 0) {
trContainer.insertBefore(previewTD, listComponent[insertPosition]) ;
} else {
@@ -199,12 +199,12 @@
if(dndEvent.dragObject.parentNode.nodeName.toLowerCase() == "td") {
dndEvent.dragObject.parentNode.style.width = "auto";
}
- if(!dndEvent.dragObject.isComponent) {
+ if(dndEvent.dragObject.isAddingNewly) {
dndEvent.dragObject.parentNode.removeChild(dndEvent.dragObject) ;
}
}
- if(dndEvent.dragObject.isComponent) {
+ if(!dndEvent.dragObject.isAddingNewly) {
var componentBlock = eXo.core.DOMUtil.findFirstDescendantByClass(dndEvent.dragObject,
"div", "UIComponentBlock") ;
var editBlock = eXo.core.DOMUtil.findFirstChildByClass(componentBlock,
"div", "EDITION-BLOCK");
if(editBlock) editBlock.style.display = "none";
@@ -229,12 +229,15 @@
var clickObject = this;
var componentBlock = DOMUtil.findAncestorByClass(clickObject,
"UIComponentBlock") ;
+ //Check if it is dragging the object existing in the current layout or from the popup
composer to add newly
if(componentBlock != null) {
var dragBlock = eXo.portal.UIPortal.findUIComponentOf(componentBlock) ;
DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject,
dragBlock, e) ;
} else {
var dragBlock = DOMUtil.findAncestorByClass(clickObject,
"DragObjectPortlet") ;
+ //TODO: Seems the dragBlock is always null
if(dragBlock) {
+ eXo.debug("The dragBlock is not null");
DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject,
dragBlock, e) ;
} else {
DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject,
clickObject, e) ;
@@ -242,20 +245,25 @@
}
};
+/**
+ * Perform following works after dropping :
+ *
+ * 1. Remove the dragging object if any
+ * 2. Send an request to server side to update the changes
+ */
PortalDragDrop.prototype.doDropCallback = function(dndEvent) {
var srcElement = dndEvent.dragObject ;
var targetElement = dndEvent.foundTargetObject;
if(!targetElement) {
- if(!dndEvent.dragObject.isComponent) {
+ if(dndEvent.dragObject.isAddingNewly) {
dndEvent.dragObject.parentNode.removeChild(dndEvent.dragObject) ;
}
dndEvent.dragObject.style.width = "auto";
return;
}
- var newComponent = false;
- if(srcElement.isComponent && (targetElement.foundIndex != null)) {
+ if(!srcElement.isAddingNewly && (targetElement.foundIndex != null)) {
if(eXo.portal.PortalDragDrop.layoutTypeElementNode != null) {
eXo.portal.PortalDragDrop.divRowContainerAddChild(srcElement, targetElement,
targetElement.foundIndex) ;
} else {
@@ -263,17 +271,16 @@
eXo.portal.PortalDragDrop.tableColumnContainerAddChild(srcElement, targetElement,
targetElement.foundIndex) ;
}
}
-
- if(!dndEvent.dragObject.isComponent) {
- dndEvent.dragObject.parentNode.removeChild(dndEvent.dragObject) ;
- newComponent = true;
+
+ if(srcElement.isAddingNewly) {
+ eXo.core.DOMUtil.removeElement(srcElement) ;
}
var params = [
- {name: "srcID", value: (srcElement.id.replace(/^UIPortlet-/,
"")).replace(/^UIContainer-/,"")},
+ {name: "srcID", value: (srcElement.id.replace(/^UIPortlet-/,
""))},
{name: "targetID", value: targetElement.id.replace(/^.*-/, "")},
{name: "insertPosition", value: targetElement.foundIndex},
- {name: "newComponent", value: newComponent}
+ {name: "isAddingNewly", value: srcElement.isAddingNewly}
] ;
try {
@@ -285,23 +292,28 @@
ajaxGet(eXo.env.server.createPortalURL("UIPortal", "MoveChild",
true, params)) ;
};
-/* Find components in dropable target */
+/**
+ * Return an array of droppable target objects
+ *
+ * @param the dragging object
+ */
PortalDragDrop.prototype.findDropableTargets = function(dragBlock) {
var DOMUtil = eXo.core.DOMUtil;
var dropableTargets = new Array() ;
var uiWorkingWorkspace = document.getElementById("UIWorkingWorkspace") ;
- var uiPortal = DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace, "div",
"UIPortal") ;
var pagebody = document.getElementById("UIPageBody");
- var uiContainers = DOMUtil.findDescendantsByClass(uiWorkingWorkspace, "div",
"UIContainer") ;
if(eXo.portal.portalMode && pagebody) {
+ var uiPortal = DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace, "div",
"UIPortal") ;
dropableTargets.push(uiPortal) ;
} else {
var uiPage = DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace, "div",
"UIPage") ;
if(uiPage) dropableTargets.push(uiPage) ;
}
+
+ var uiContainers = DOMUtil.findDescendantsByClass(uiWorkingWorkspace, "div",
"UIContainer") ;
for(var i = 0; i < uiContainers.length; i++) {
- if (DOMUtil.hasAncestor(uiContainers[i], dragBlock)) continue;
+ if(DOMUtil.hasAncestor(uiContainers[i], dragBlock)) continue;
if(DOMUtil.hasClass(uiContainers[i], "ProtectedContainer")) continue;
dropableTargets.push(uiContainers[i]) ;
}
@@ -324,6 +336,12 @@
}
};
+/**
+ * Return a most suiable position among the <code>components</code> objects
+ * that the dragging object should be at
+ *
+ * @param layout {string} the layout type which is "row" or "column"
+ */
PortalDragDrop.prototype.findInsertPosition = function(components, dragObject, layout) {
if(layout == "row") {
for(var i = 0; i < components.length; i++) {
@@ -349,6 +367,9 @@
}
};
+/**
+ * Create a div block which show the preview block
+ */
PortalDragDrop.prototype.createPreview = function(layoutType) {
var previewBlock = document.createElement("div") ;
previewBlock.className = "DragAndDropPreview" ;
@@ -356,25 +377,38 @@
return previewBlock;
};
-PortalDragDrop.prototype.divRowContainerAddChild = function(insertBlock, targetElement,
insertPosition) {
+/**
+ * Add the <code>srcElement</code> dragging object to a container.
+ * If the dragging object is a column then let remove it from the table column container
+ */
+PortalDragDrop.prototype.divRowContainerAddChild = function(srcElement, targetElement,
insertPosition) {
var listComponent = eXo.core.DragDrop.dndEvent.foundTargetObject.listComponentInTarget
;
var uiRowContainer = eXo.core.DOMUtil.findFirstDescendantByClass(targetElement,
"div", "UIRowContainer") ;
- insertBlock.style.width = "auto" ;
+ srcElement.style.width = "auto" ;
+ var parentNode = srcElement.parentNode;
if(insertPosition >= 0) {
- uiRowContainer.insertBefore(insertBlock, listComponent[insertPosition]) ;
+ uiRowContainer.insertBefore(srcElement, listComponent[insertPosition]) ;
} else {
- uiRowContainer.appendChild(insertBlock) ;
+ uiRowContainer.appendChild(srcElement) ;
}
+
+ if(parentNode.nodeName.toLowerCase() == "td") {
+ eXo.core.DOMUtil.removeElement(parentNode) ;
+ }
};
-PortalDragDrop.prototype.tableColumnContainerAddChild = function(insertBlock,
targetElement, insertPosition) {
+/**
+ * Add the <code>srcElement</code> to be a column of the
<code>targetElement</code> table column container
+ * at the position <code>insertPosition</code>
+ */
+PortalDragDrop.prototype.tableColumnContainerAddChild = function(srcElement,
targetElement, insertPosition) {
var listComponent = eXo.core.DragDrop.dndEvent.foundTargetObject.listComponentInTarget
;
var DOMUtil = eXo.core.DOMUtil ;
var trContainer = DOMUtil.findFirstDescendantByClass(targetElement, "tr",
"TRContainer") ;
var tdInserted = document.createElement('td') ;
- tdInserted.appendChild(insertBlock) ;
+ tdInserted.appendChild(srcElement) ;
if(insertPosition >= 0) {
trContainer.insertBefore(tdInserted, listComponent[insertPosition]) ;
@@ -382,7 +416,7 @@
trContainer.appendChild(tdInserted) ;
}
- insertBlock.style.width = "auto" ;
+ srcElement.style.width = "auto" ;
if(eXo.portal.PortalDragDrop.parentDragObject.nodeName.toLowerCase() == "td")
{
DOMUtil.removeElement(eXo.portal.PortalDragDrop.parentDragObject) ;
Modified:
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
===================================================================
---
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2010-04-06
08:27:23 UTC (rev 2482)
@@ -421,6 +421,10 @@
}
} ;
+/**
+ * Return the closest container of the element.
+ * It might be one of these : UIPortlet, UIContainer, UIPageBody, UIPortal
+ */
UIPortal.prototype.findUIComponentOf = function(element) {
var DOMUtil = eXo.core.DOMUtil;
var parent = element.parentNode ;
@@ -503,7 +507,11 @@
UIPortal.prototype.removeComponent = function(componentId) {
var comp = document.getElementById(componentId);
var viewPage = eXo.core.DOMUtil.findAncestorByClass(comp, "VIEW-PAGE");
- eXo.core.DOMUtil.removeElement(comp);
+
+ //Check if the removing component is a column
+ if (comp.parentNode.nodeName.toUpperCase() == "TD")
eXo.core.DOMUtil.removeElement(comp.parentNode);
+ else eXo.core.DOMUtil.removeElement(comp);
+
if(viewPage && eXo.portal.UIPortal.getUIContainers().length == 0
&& eXo.portal.UIPortal.getUIPortlets().length == 0) {
viewPage.style.paddingTop = "50px" ;
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy 2010-04-06
08:27:23 UTC (rev 2482)
@@ -45,17 +45,20 @@
SelectItemCategory column = new SelectItemCategory("column") ;
column.addSelectItemOption(new SelectItemOption("oneColumns",""
+
"<container
template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
"</container>",
"OneRowContainerLayout")) ;
column.addSelectItemOption(new SelectItemOption("twoColumns",
"<container
template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
"</container>",
"TwoColumnContainerLayout")) ;
column.addSelectItemOption(new SelectItemOption("threeColumns",
"<container
template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
@@ -63,6 +66,7 @@
"ThreeColumnContainerLayout")) ;
column.addSelectItemOption(new SelectItemOption("threeToolbarColumns",
"<container
template=\"system:/groovy/portal/webui/container/UIToolbarContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container id=\"StarToolBarPortelt\"
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container id=\"UserToolBarPortelt\"
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container id=\"AdminToolBarPortelt\"
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
@@ -73,17 +77,20 @@
SelectItemCategory autofitColumn = new SelectItemCategory("autofitColumn") ;
autofitColumn.addSelectItemOption(new
SelectItemOption("autofitOneColumns","" +
"<container
template=\"system:/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
"</container>",
"OneRowContainerLayout")) ;
autofitColumn.addSelectItemOption(new
SelectItemOption("autofitTwoColumns",
"<container
template=\"system:/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
"</container>",
"TwoColumnContainerLayout")) ;
autofitColumn.addSelectItemOption(new
SelectItemOption("autofitThreeColumns",
"<container
template=\"system:/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
@@ -127,6 +134,7 @@
"<container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\">"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" </container>" +
@@ -136,6 +144,7 @@
"<container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\">"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">"
+
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" <container
template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>"
+
" </container>" +
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2010-04-06
08:27:23 UTC (rev 2482)
@@ -26,7 +26,7 @@
%>
<div class="UIContainer
<%=uiPortalApp.isEditing()?"EdittingContainer":""%>
<%=hasPermission?"": "ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}" ${cssStyle}
+ id="${uicomponent.id}" ${cssStyle}
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -41,13 +41,13 @@
<%} else {%>
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
- <%if(hasPermission) {%>
+ <%if(hasPermission) {%>
<div class="UIRowContainer">
+ <div>
<%uicomponent.renderChildren();%>
+ </div>
</div>
<%} else out.print("<div
class='ProtectedContent'>"+_ctx.appRes("UIPortlet.label.protectedContent")+"</div>");%>
- </div>
</div>
<%if(portalMode != UIPortalApplication.NORMAL_MODE){%>
@@ -72,8 +72,8 @@
%>
<div class="ContainerIcon"><%=hasPermission ? strTitle :
_ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a
href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>"
class="DeleteContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
- <a
href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a
href="<%=uicomponent.event("DeleteComponent")%>"
class="DeleteContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
+ <a
href="<%=uicomponent.event("EditContainer")%>;eXo.portal.UIPortal.changeComposerSaveButton()"
class="EditContainerIcon"
title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
<%}%>
<div
class="ClearBoth"><span></span></div>
</div>
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl 2010-04-06
08:27:23 UTC (rev 2482)
@@ -36,7 +36,7 @@
String id = uicomponent.getId();
%>
<% if(children != null && children.size() > 0) { %>
-<div class="UITabContainer">
+<div class="UITabContainer" id="$id">
<div class="UIHorizontalTabs">
<div class="LeftHorizontalTabs">
<div class="RightHorizontalTabs">
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2010-04-06
08:27:23 UTC (rev 2482)
@@ -17,7 +17,7 @@
%>
<div class="UIContainer
<%=uiPortalApp.isEditing()?"EdittingContainer":""%>
<%=hasPermission?"":"ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}"
+ id="${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -37,7 +37,7 @@
<%} else {%>
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
+ <div>
<%if(hasPermission) {%>
<table class="UITableColumnContainer" style="margin: 0px auto;
$style">
<tr class="TRContainer">
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2010-04-06
08:27:23 UTC (rev 2482)
@@ -17,7 +17,7 @@
%>
<div class="UIContainer
<%=uiPortalApp.isEditing()?"EdittingContainer":""%>
<%=hasPermission?"":"ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}"
+ id="${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -37,7 +37,7 @@
<%} else {%>
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
+ <div>
<%if(hasPermission) {%>
<table class="UITableColumnContainer" style="table-layout: fixed;
margin: 0px auto; $style">
<tr class="TRContainer">
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl 2010-04-06
08:27:23 UTC (rev 2482)
@@ -13,7 +13,7 @@
%>
<div class="UIContainer UIToolbarContainer
<%=uiPortalApp.isEditing()?"EdittingContainer":""%>
<%=hasPermission?"": "ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}"
+ id="${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -33,7 +33,7 @@
<%} else {%>
<div class="VIEW-CONTAINER ToolbarContainer VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
+ <div>
<%if(hasPermission) {%>
<div class="UITableColumnContainer" style="margin: 0px auto;
$style">
<div class="TRContainer" style="zoom: 100%;">
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java 2010-04-06
08:27:23 UTC (rev 2482)
@@ -19,30 +19,19 @@
package org.exoplatform.portal.webui.container;
-import
org.exoplatform.portal.webui.container.UIContainerActionListener.EditContainerActionListener;
import org.exoplatform.portal.webui.portal.UIPortalComponent;
import
org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.DeleteComponentActionListener;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import java.util.List;
-
/**
* May 19, 2006
*/
-@ComponentConfigs({
- @ComponentConfig(events = {@EventConfig(listeners =
UIContainerActionListener.EditContainerActionListener.class),
- @EventConfig(listeners = DeleteComponentActionListener.class, confirm =
"UIContainer.deleteContainer")}),
- @ComponentConfig(id = "TabContainer", template =
"system:/groovy/portal/webui/container/UITabContainer.gtmpl", events = {
- @EventConfig(listeners = EditContainerActionListener.class),
- @EventConfig(listeners = DeleteComponentActionListener.class, confirm =
"UIContainer.deleteContainer"),
- @EventConfig(listeners = UIContainer.SelectTabActionListener.class)})})
+@ComponentConfig(events = {@EventConfig(listeners =
UIContainerActionListener.EditContainerActionListener.class),
+ @EventConfig(listeners = DeleteComponentActionListener.class, confirm =
"UIContainer.deleteContainer")})
public class UIContainer extends UIPortalComponent
{
+ public static final String TABLE_COLUMN_CONTAINER = "TableColumnContainer";
/** Storage id. */
private String storageId;
@@ -84,29 +73,4 @@
{
this.description = desc;
}
-
- static public class SelectTabActionListener extends EventListener<UIContainer>
- {
- public void execute(Event<UIContainer> event) throws Exception
- {
- String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
- UIContainer container = event.getSource();
- UIComponent goal = container.findComponentById(objectId);
- if (goal == null)
- {
- return;
- }
- UIContainer parent = goal.getParent();
- List<UIComponent> children = parent.getChildren();
- for (UIComponent child : children)
- {
- if (child.getId().equals(objectId))
- {
- child.setRendered(true);
- continue;
- }
- child.setRendered(false);
- }
- }
- }
}
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java 2010-04-06
08:27:23 UTC (rev 2482)
@@ -23,7 +23,6 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -40,29 +39,14 @@
{
UIContainer uiContainer = event.getSource();
- String id =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
-
UIPortal uiPortal = Util.getUIPortal();
UIPortalApplication uiApp =
uiPortal.getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS =
uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
UIContainerForm containerForm =
uiMaskWS.createUIComponent(UIContainerForm.class, null, null);
- if (uiContainer.getId().equals(id))
- {
- containerForm.setValues(uiContainer);
- }
- else
- {
- if (uiContainer.getChildById(id) != null)
- {
- containerForm.setValues((UIContainer)uiContainer.getChildById(id));
- }
- else
- return;
- }
+ containerForm.setValues(uiContainer);
uiMaskWS.setUIComponent(containerForm);
uiMaskWS.setShow(true);
event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
- // Util.updateUIApplication(event);
}
}
}
Added:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java
(rev 0)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java 2010-04-06
08:27:23 UTC (rev 2482)
@@ -0,0 +1,72 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.webui.container;
+
+import
org.exoplatform.portal.webui.container.UIContainerActionListener.EditContainerActionListener;
+import
org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.DeleteComponentActionListener;
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+
+import java.util.List;
+
+/**
+ * May 19, 2006
+ */
+@ComponentConfig(template =
"system:/groovy/portal/webui/container/UITabContainer.gtmpl", events = {
+ @EventConfig(listeners = EditContainerActionListener.class),
+ @EventConfig(listeners = DeleteComponentActionListener.class, confirm =
"UIContainer.deleteContainer"),
+ @EventConfig(listeners = UITabContainer.SelectTabActionListener.class)})
+public class UITabContainer extends UIContainer
+{
+ public static final String TAB_CONTAINER = "TabContainer";
+
+ public UITabContainer()
+ {
+ super();
+ }
+
+ static public class SelectTabActionListener extends
EventListener<UITabContainer>
+ {
+ public void execute(Event<UITabContainer> event) throws Exception
+ {
+ String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
+ UITabContainer container = event.getSource();
+ UIComponent goal = container.findComponentById(objectId);
+ if (goal == null)
+ {
+ return;
+ }
+ UITabContainer parent = goal.getParent();
+ List<UIComponent> children = parent.getChildren();
+ for (UIComponent child : children)
+ {
+ if (child.getId().equals(objectId))
+ {
+ child.setRendered(true);
+ continue;
+ }
+ child.setRendered(false);
+ }
+ }
+ }
+}
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-04-06
08:27:23 UTC (rev 2482)
@@ -21,7 +21,6 @@
import org.exoplatform.portal.account.UIAccountSetting;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2010-04-06
08:27:23 UTC (rev 2482)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.webui.portal;
-import java.util.List;
-
import org.exoplatform.application.registry.Application;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserACL;
@@ -34,6 +32,7 @@
import org.exoplatform.portal.webui.application.UIApplicationList;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainerList;
+import org.exoplatform.portal.webui.container.UITabContainer;
import org.exoplatform.portal.webui.login.UILogin;
import org.exoplatform.portal.webui.login.UIResetPassword;
import org.exoplatform.portal.webui.page.UIPage;
@@ -58,10 +57,13 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import java.util.List;
+
/** Author : Nhu Dinh Thuan nhudinhthuan(a)yahoo.com Jun 14, 2006 */
public class UIPortalComponentActionListener
{
-
+ private final static String UI_PORTLET_PREFIX = "UIPortlet-";
+
static public class ViewChildActionListener extends EventListener<UIContainer>
{
public void execute(Event<UIContainer> event) throws Exception
@@ -88,29 +90,22 @@
static public class DeleteComponentActionListener extends
EventListener<UIComponent>
{
- private final static String UI_CONTAINER_PREFIX = "UIContainer-";
-
- private final static String UI_PORTLET_PREFIX = "UIPortlet-";
-
public void execute(Event<UIComponent> event) throws Exception
{
- String id =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIComponent uiComponent = event.getSource();
- UIPortalComponent uiParent = (UIPortalComponent)uiComponent.getParent();
- UIComponent uiRemoveComponent = uiParent.findComponentById(id);
+ UIComponent uiComponentTobeRemoved = event.getSource();
+ String id = uiComponentTobeRemoved.getId();
UIPortalApplication uiApp = Util.getUIPortalApplication();
- if (uiRemoveComponent.findFirstComponentOfType(UIPageBody.class) != null)
+ if (uiComponentTobeRemoved.findFirstComponentOfType(UIPageBody.class) != null)
{
uiApp.addMessage(new
ApplicationMessage("UIPortalApplication.msg.deletePageBody", new Object[]{},
ApplicationMessage.WARNING));
return;
}
- uiParent.removeChildById(id);
UIPortalComposer portalComposer =
uiApp.findFirstComponentOfType(UIPortalComposer.class);
portalComposer.setEditted(true);
- UIPage uiPage = uiParent.getAncestorOfType(UIPage.class);
+ UIPage uiPage = uiComponentTobeRemoved.getAncestorOfType(UIPage.class);
if (uiPage != null && uiPage.getMaximizedUIPortlet() != null)
{
if (id.equals(uiPage.getMaximizedUIPortlet().getId()))
@@ -140,128 +135,66 @@
}
}
}
- Util.showComponentLayoutMode(uiRemoveComponent.getClass());
+ Util.showComponentLayoutMode(uiComponentTobeRemoved.getClass());
PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
- // Case1: current component is a portlet
- if (uiComponent instanceof UIPortlet)
+ org.exoplatform.portal.webui.container.UIContainer uiParent =
uiComponentTobeRemoved.getParent();
+ if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId()))
{
- removeComponent(id, UI_PORTLET_PREFIX, pcontext);
- return;
- }
-
- // Case 2: current component is a container
- if (uiComponent instanceof org.exoplatform.portal.webui.container.UIContainer)
- {
- org.exoplatform.portal.webui.container.UIContainer topAncestor =
-
getTopBlockContainer((org.exoplatform.portal.webui.container.UIContainer)uiParent);
-
- /**
- * topAncestor is null if the uiParent is either UIPortal or UIPage,
- * that happens when our container is a simple container
+ /*
+ * Check if it is removing the last tab then we will remove the TabContainer
as well
+ *
+ * Indeed, a TabContainer is nested into a normal container so
+ * we should remove the its parent instead of itself when we delete the last
tab
*/
- if (topAncestor == null)
+ if (uiParent.getChildren().size() == 1)
{
- removeComponent(id, UI_CONTAINER_PREFIX, pcontext);
- return;
+ uiComponentTobeRemoved = uiParent.getParent();
}
- /** Case of nested container like tab container, mixed container */
else
{
- String topAncestorId = topAncestor.getId();
-
- /** If the topAncestor has no child, then it is removed */
- if (topAncestor.getChildren().size() == 0)
- {
- /** Update server-side */
- UIContainer parentOfTopAncestor = topAncestor.getParent();
- parentOfTopAncestor.removeChildById(topAncestorId);
-
- /** Update client side */
- if (topAncestorId.startsWith(UI_CONTAINER_PREFIX))
- {
- topAncestorId =
topAncestorId.substring(UI_CONTAINER_PREFIX.length());
- topAncestor.setId(topAncestorId);
- }
- removeComponent(topAncestorId, UI_CONTAINER_PREFIX, pcontext);
- return;
- }
-
- /**
- * If the uiParent is not the topAncestor and having no child,
- * then it is removed
- */
- if (uiParent.getChildren().size() == 0)
- {
- /** Update server-side */
- UIContainer itsParent = uiParent.getParent();
- itsParent.removeChildById(uiParent.getId());
- }
-
- /**
- * Update the topAncestor by Ajax
- */
- if (!topAncestorId.startsWith(UI_CONTAINER_PREFIX))
- {
- topAncestor.setId(UI_CONTAINER_PREFIX + topAncestorId);
- }
- pcontext.addUIComponentToUpdateByAjax(topAncestor);
+ removeUIComponent(uiComponentTobeRemoved, pcontext, true);
return;
}
}
-
+ else if
(org.exoplatform.portal.webui.container.UIContainer.TABLE_COLUMN_CONTAINER.equals(uiParent.getFactoryId()))
+ {
+ if (uiParent.getChildren().size() == 1)
+ {
+ uiComponentTobeRemoved = uiParent;
+ }
+ }
+
+ removeUIComponent(uiComponentTobeRemoved, pcontext, false);
}
- /** Add Javascript script to remove component */
- private void removeComponent(String componentId, String componentType,
PortalRequestContext pcontext)
- {
- String scriptRemovingComponent = scriptRemovingComponent(componentId,
componentType);
- JavascriptManager jsManager = pcontext.getJavascriptManager();
- jsManager.addJavascript(scriptRemovingComponent);
-
jsManager.addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
- }
-
- private String scriptRemovingComponent(String componentId, String prefix)
- {
+ }
+
+ /**
+ * Remove an UIComponent from server side and
+ * adding removing behaviors in javascript to clients if necessary
+ */
+ private static void removeUIComponent(UIComponent uiComponent, PortalRequestContext
pcontext, boolean isUpdate)
+ {
+ UIContainer uiParent = uiComponent.getParent();
+ uiParent.getChildren().remove(uiComponent);
+
+ JavascriptManager jsManager = pcontext.getJavascriptManager();
+ if(isUpdate) {
+ pcontext.addUIComponentToUpdateByAjax(uiParent);
+ } else {
StringBuffer buffer = new StringBuffer();
buffer.append("eXo.portal.UIPortal.removeComponent('");
- buffer.append(prefix);
- buffer.append(componentId);
- buffer.append("');");
- return buffer.toString();
- }
-
- /**
- * Returns the top ancestor( of type
- * org.exoplatform.portal.webui.container.UIContainer but not of type
- * UIPortal or UIPage) of a given container
- */
- private static org.exoplatform.portal.webui.container.UIContainer
getTopBlockContainer(
- org.exoplatform.portal.webui.container.UIContainer container)
- {
- if (container instanceof UIPortal || container instanceof UIPage)
+ if (uiComponent instanceof UIPortlet)
{
- return null;
+ buffer.append(UI_PORTLET_PREFIX);
}
- org.exoplatform.portal.webui.container.UIContainer topAncestor = container;
- org.exoplatform.portal.webui.container.UIContainer intermediateCont;
- try
- {
- intermediateCont = topAncestor.getParent();
- while (intermediateCont != null && !(intermediateCont instanceof
UIPortal)
- && !(intermediateCont instanceof UIPage))
- {
- topAncestor = intermediateCont;
- intermediateCont = topAncestor.getParent();
- }
- }
- catch (ClassCastException ex)
- {
-
- }
- return topAncestor;
+ buffer.append(uiComponent.getId());
+ buffer.append("');");
+ jsManager.addJavascript(buffer.toString());
}
+
jsManager.addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
}
static public class MoveChildActionListener extends EventListener<UIContainer>
@@ -281,7 +214,7 @@
}
boolean newComponent = false;
- String paramNewComponent =
pcontext.getRequestParameter("newComponent");
+ String paramNewComponent =
pcontext.getRequestParameter("isAddingNewly");
if (paramNewComponent != null)
newComponent = Boolean.valueOf(paramNewComponent).booleanValue();
@@ -401,7 +334,7 @@
return;
}
- UIContainer uiParent = uiSource.getParent();
+ org.exoplatform.portal.webui.container.UIContainer uiParent =
uiSource.getParent();
if (uiParent == uiTarget)
{
int currentIdx = uiTarget.getChildren().indexOf(uiSource);
@@ -420,9 +353,31 @@
uiTarget.getChildren().add(position, uiSource);
return;
}
- uiParent.getChildren().remove(uiSource);
+
uiTarget.getChildren().add(position, uiSource);
uiSource.setParent(uiTarget);
+
+ if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId()))
+ {
+ if (uiParent.getChildren().size() == 1)
+ {
+ removeUIComponent(uiParent.getParent(), pcontext, false);
+ }
+ else
+ {
+ uiParent.getChildren().remove(uiSource);
+ pcontext.addUIComponentToUpdateByAjax(uiParent);
+ }
+ }
+ else if
(org.exoplatform.portal.webui.container.UIContainer.TABLE_COLUMN_CONTAINER.equals(uiParent
+ .getFactoryId()) && uiParent.getChildren().size() == 1)
+ {
+ removeUIComponent(uiParent, pcontext, false);
+ }
+ else
+ {
+ uiParent.getChildren().remove(uiSource);
+ }
}
}
@@ -454,12 +409,12 @@
if (token == null)
{
WebuiRequestContext requestContext = event.getRequestContext();
- requestContext.getUIApplication().addMessage(
- new ApplicationMessage("UIForgetPassword.msg.expration",
null));
+ requestContext.getUIApplication()
+ .addMessage(new
ApplicationMessage("UIForgetPassword.msg.expration", null));
requestContext.addUIComponentToUpdateByAjax(uiPortal.getParent());
return;
}
-
+
UIPortalApplication uiApp =
uiPortal.getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS =
uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2010-04-06
08:25:18 UTC (rev 2481)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2010-04-06
08:27:23 UTC (rev 2482)
@@ -34,6 +34,7 @@
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
+import org.exoplatform.portal.webui.container.UITabContainer;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.page.UISiteBody;
@@ -406,8 +407,16 @@
else if (model instanceof Container)
{
Container container = (Container)model;
- UIContainer uiTempContainer =
- uiContainer.createUIComponent(context, UIContainer.class,
container.getFactoryId(), null);
+ UIContainer uiTempContainer ;
+ if(UITabContainer.TAB_CONTAINER.equals(container.getFactoryId()))
+ {
+ uiTempContainer = uiContainer.createUIComponent(context,
UITabContainer.class, null, null);
+ }
+ else
+ {
+ uiTempContainer = uiContainer.createUIComponent(context, UIContainer.class,
null, null);
+ }
+
toUIContainer(uiTempContainer, (Container)model, dashboard);
uiComponent = uiTempContainer;
}