Author: hoang_to
Date: 2009-11-18 06:03:59 -0500 (Wed, 18 Nov 2009)
New Revision: 641
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
Log:
GTNPORTAL-202: Fix the problem with tab container
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2009-11-18
11:03:24 UTC (rev 640)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2009-11-18
11:03:59 UTC (rev 641)
@@ -17,6 +17,11 @@
if(uiComponentHeight != null) cssStyle += "height:
"+uiComponentHeight+";"
if(cssStyle.length() > 0) cssStyle += "\"";
+ /** Trim the prefix UIContainer- if any, this hardcoded part is needed to update nested
container via Ajax */
+ String componentId = uicomponent.getId();
+ if(componentId.startsWith("UIContainer-")){
+ uicomponent.setId(componentId.substring("UIContainer-".length()));
+ }
%>
<div class="UIContainer
<%=uiPortalApp.isEditting()?"EdittingContainer":""%>"
id="UIContainer-${uicomponent.id}" ${cssStyle}
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl 2009-11-18
11:03:24 UTC (rev 640)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl 2009-11-18
11:03:59 UTC (rev 641)
@@ -5,6 +5,13 @@
def rcontext = _ctx.getRequestContext();
ResourceBundle res = rcontext.getApplicationResourceBundle();
JavascriptManager jsmanager = rcontext.getJavascriptManager();
+
+ /** Trim the prefix UIContainer- if any, this hardcoded part is needed to update nested
container via Ajax */
+ String componentId = uicomponent.getId();
+ if(componentId.startsWith("UIContainer-")){
+ uicomponent.setId(componentId.substring("UIContainer-".length()));
+ }
+
ArrayList children = uicomponent.getChildren();
if(children != null && children.size > 0){
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2009-11-18
11:03:24 UTC (rev 640)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2009-11-18
11:03:59 UTC (rev 641)
@@ -8,6 +8,12 @@
UIPortalApplication uiPortalApp = rcontext.getUIApplication();
if(!uiPortalApp.isEditting() && !uicomponent.hasPermission()) return;
+ /** Trim the prefix UIContainer- if any, this hardcoded part is needed to update nested
container via Ajax */
+ String componentId = uicomponent.getId();
+ if(componentId.startsWith("UIContainer-")){
+ uicomponent.setId(componentId.substring("UIContainer-".length()));
+ }
+
%>
<div class="UIContainer
<%=uiPortalApp.isEditting()?"EdittingContainer":""%>"
id="UIContainer-${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-18
11:03:24 UTC (rev 640)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-18
11:03:59 UTC (rev 641)
@@ -151,19 +151,31 @@
}
Util.showComponentLayoutMode(uiRemoveComponent.getClass());
+ PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
String componentType = null;
if (uiComponent instanceof UIPortlet)
{
componentType = UI_PORTLET;
}
- else if (uiComponent instanceof UIContainer)
+ else if (uiComponent instanceof
org.exoplatform.portal.webui.container.UIContainer)
{
componentType = UI_CONTAINER;
+ org.exoplatform.portal.webui.container.UIContainer topAncestor =
getTopBlockContainer((org.exoplatform.portal.webui.container.UIContainer)uiParent);
+
+ //Case of nested container like tab container, mixed container
+ if(topAncestor != null){
+ String topAncestorId = topAncestor.getId();
+ //Add UIContainer- prefix to the id as it is required to be updated by
Ajax
+ if(!topAncestorId.startsWith("UIContainer-")){
+ topAncestor.setId("UIContainer-" + topAncestorId);
+ }
+ pcontext.addUIComponentToUpdateByAjax(topAncestor);
+ return;
+ }
}
if (componentType != null)
{
- PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
JavascriptManager jsManager = pcontext.getJavascriptManager();
jsManager.addJavascript(scriptRemovingComponent(id, componentType));
jsManager.addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
@@ -180,6 +192,35 @@
buffer.append("');");
return buffer.toString();
}
+
+ /**
+ * Returns the top ancestor( of type
+ * org.exoplatform.portal.webui.container.UIContainer but not of type
+ * UIPortal) of a given container
+ */
+ private static org.exoplatform.portal.webui.container.UIContainer
getTopBlockContainer(
+ org.exoplatform.portal.webui.container.UIContainer container)
+ {
+ if(container instanceof UIPortal){
+ return null;
+ }
+ 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))
+ {
+ topAncestor = intermediateCont;
+ intermediateCont = topAncestor.getParent();
+ }
+ }
+ catch (ClassCastException ex)
+ {
+
+ }
+ return topAncestor;
+ }
}
static public class MoveChildActionListener extends EventListener<UIContainer>
Show replies by date