Author: hoang_to
Date: 2011-09-07 05:23:51 -0400 (Wed, 07 Sep 2011)
New Revision: 7326
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
Log:
GTNPORTAL-2070: Edit Layout on Dashboard removes the dashboard layout
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-09-07
09:03:45 UTC (rev 7325)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-09-07
09:23:51 UTC (rev 7326)
@@ -20,10 +20,10 @@
package org.exoplatform.portal.webui.workspace;
import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
+import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.mop.navigation.Scope;
import org.exoplatform.portal.mop.user.UserNavigation;
@@ -47,7 +47,6 @@
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-
import java.lang.reflect.Method;
/**
@@ -193,44 +192,32 @@
{
public void execute(Event<UIWorkingWorkspace> event) throws Exception
{
- UIPortalApplication uiApp = Util.getUIPortalApplication();
+ PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
+ UIPortalApplication portalApp =
(UIPortalApplication)pcontext.getUIApplication();
+ UIPortal currentPortal = portalApp.getCurrentSite();
+ UIWorkingWorkspace uiWorkingWS = event.getSource();
- UIPortal uiPortal = uiApp.getCurrentSite();
-
- UserPortalConfigService service =
uiApp.getApplicationComponent(UserPortalConfigService.class);
- UserPortalConfig userConfig =
- service.getUserPortalConfig(uiPortal.getName(),
event.getRequestContext().getRemoteUser());
- if (userConfig == null)
- userConfig = uiApp.getUserPortalConfig();
-
- //Todo nguyenanhkien2a(a)gmail.com
- //Check editing permission
- UIPortalApplication portalApp = Util.getUIPortalApplication();
- UIPortal currentUIPortal =
event.getSource().findFirstComponentOfType(UIPortal.class);
UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
- if(!userACL.hasEditPermissionOnPortal(currentUIPortal.getSiteType().getName(),
currentUIPortal.getName(),
- currentUIPortal.getEditPermission()))
+ if (!userACL.hasEditPermissionOnPortal(currentPortal.getSiteType().getName(),
currentPortal.getName(),
+ currentPortal.getEditPermission()))
{
- uiApp.addMessage(new
ApplicationMessage("UIPortalManagement.msg.Invalid-EditLayout-Permission",
- new String[]{uiPortal.getName()}));
+ portalApp.addMessage(new
ApplicationMessage("UIPortalManagement.msg.Invalid-EditLayout-Permission",
+ new String[]{currentPortal.getName()}));
return;
}
-
- PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
- UIWorkingWorkspace uiWorkingWS = event.getSource();
- uiWorkingWS.setBackupUIPortal(uiPortal);
- uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
- UIPortal newPortal = uiWorkingWS.createUIComponent(UIPortal.class, null, null);
- PortalDataMapper.toUIPortal(newPortal, userConfig.getPortalConfig());
-// newPortal.setSelectedNode(uiPortal.getSelectedNode());
-// newPortal.setNavigation(uiPortal.getNavigation());
-// newPortal.setSelectedPath(uiPortal.getSelectedPath());
- newPortal.setNavPath(uiPortal.getNavPath());
- newPortal.refreshUIPage();
+ DataStorage dataStorage = portalApp.getApplicationComponent(DataStorage.class);
+ PortalConfig portalConfig =
dataStorage.getPortalConfig(pcontext.getSiteType().getName(), pcontext.getSiteName());
+ UIPortal transientPortal = uiWorkingWS.createUIComponent(UIPortal.class, null,
null);
+ PortalDataMapper.toUIPortal(transientPortal, portalConfig);
+ transientPortal.setNavPath(currentPortal.getNavPath());
+ transientPortal.refreshUIPage();
+ uiWorkingWS.setBackupUIPortal(currentPortal);
+ portalApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
+
UIEditInlineWorkspace uiEditWS =
uiWorkingWS.getChild(UIEditInlineWorkspace.class);
- uiEditWS.setUIComponent(newPortal);
+ uiEditWS.setUIComponent(transientPortal);
UISiteBody siteBody = uiWorkingWS.findFirstComponentOfType(UISiteBody.class);
siteBody.setUIComponent(null);