Author: liem_nguyen
Date: 2010-01-28 21:53:23 -0500 (Thu, 28 Jan 2010)
New Revision: 1462
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
Log:
GTNPORTAL-398 Unknown error when change position of portlet in Edit layout of Dashboard
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-01-28
21:54:36 UTC (rev 1461)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-01-29
02:53:23 UTC (rev 1462)
@@ -688,14 +688,6 @@
// We manufacture one name
name = UUID.randomUUID().toString();
}
-
- // Remove to prevent DuplicateNameException (GTNPORTAL-398)
- UIComponent uiComponent = dst.get(name);
- if (uiComponent != null) {
- dst.remove(uiComponent);
- }
-
-
if (srcChild instanceof ContainerData)
{
dstChild = dst.add(ObjectType.CONTAINER, name);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-01-28
21:54:36 UTC (rev 1461)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-01-29
02:53:23 UTC (rev 1462)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.webui.portal;
import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
@@ -216,7 +217,7 @@
SkinService skinService = getApplicationComponent(SkinService.class);
skinService.invalidatePortalSkinCache(editPortal.getName(), editPortal.getSkin());
}
-
+
public boolean isPortalExist(UIPortal editPortal) throws Exception
{
String remoteUser = Util.getPortalRequestContext().getRemoteUser();
@@ -232,7 +233,7 @@
}
UserPortalConfigService configService =
getApplicationComponent(UserPortalConfigService.class);
-
+
return configService.getUserPortalConfig(portalOwner, remoteUser) != null;
}
@@ -415,18 +416,31 @@
{
uri = uiPortal.getSelectedNode() != null ?
uiPortal.getSelectedNode().getUri() : null;
}
-
- if(uiComposer.isPortalExist(editPortal))
+
+ if (uiComposer.isPortalExist(editPortal))
{
- PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
+ // Update portalconfig from db
+ DataStorage storage =
uiPortalApp.getApplicationComponent(DataStorage.class);
+ PortalConfig pConfig =
+ storage.getPortalConfig(uiPortal.getSelectedNavigation().getOwnerType(),
uiPortal
+ .getSelectedNavigation().getOwnerId());
+ if (pConfig != null)
+ {
+ uiPortalApp.getUserPortalConfig().setPortal(pConfig);
+ }
+ uiPortal.getChildren().clear();
+ PortalDataMapper.toUIPortal(uiPortal, uiPortalApp.getUserPortalConfig());
+
+ PageNodeEvent<UIPortal> pnevent =
+ new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, uri);
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
JavascriptManager jsManager = prContext.getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
}
else
- {
- if(editPortal.getOwner().equals(prContext.getPortalOwner()))
+ {
+ if (editPortal.getOwner().equals(prContext.getPortalOwner()))
{
HttpServletRequest request = prContext.getRequest();
request.getSession().invalidate();
@@ -496,19 +510,19 @@
switch (portalMode)
{
- case UIPortalApplication.APP_BLOCK_EDIT_MODE:
+ case UIPortalApplication.APP_BLOCK_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.APP_VIEW_EDIT_MODE);
break;
- case UIPortalApplication.APP_VIEW_EDIT_MODE:
+ case UIPortalApplication.APP_VIEW_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
break;
- case UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE:
+ case UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.CONTAINER_VIEW_EDIT_MODE);
break;
- case UIPortalApplication.CONTAINER_VIEW_EDIT_MODE:
+ case UIPortalApplication.CONTAINER_VIEW_EDIT_MODE :
uiPortalApp.setModeState(UIPortalApplication.CONTAINER_BLOCK_EDIT_MODE);
break;
- default:
+ default :
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
return;
}
@@ -592,11 +606,11 @@
UIEditInlineWorkspace editInlineWS = event.getSource().getParent();
UIWorkingWorkspace uiWorkingWS = editInlineWS.getParent();
UIPortalToolPanel uiToolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
-
+
UIPage uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
String pageId = page.getPageId();
-
+
UserPortalConfigService portalConfigService =
uiWorkingWS.getApplicationComponent(UserPortalConfigService.class);
if (page.getStorageId() != null && portalConfigService.getPage(pageId)
== null)
@@ -627,10 +641,10 @@
// Perform mop update
portalConfigService.update(page);
uiToolPanel.setUIComponent(null);
-
+
// Update UIPage cache on UIPortal
uiPortal.setUIPage(pageId, uiPage);
-
+
if (PortalProperties.SESSION_ALWAYS.equals(uiPortal.getSessionAlive()))
{
uiPortalApp.setSessionOpen(true);