Author: tan_pham_dinh
Date: 2009-11-03 21:31:52 -0500 (Tue, 03 Nov 2009)
New Revision: 486
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/i18n/webui/component/UII18nPortlet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
Log:
GTNPORTAL-121, GTNPORTAL-104: Problem when delete current page
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/i18n/webui/component/UII18nPortlet.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/i18n/webui/component/UII18nPortlet.java 2009-11-03
23:55:04 UTC (rev 485)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/i18n/webui/component/UII18nPortlet.java 2009-11-04
02:31:52 UTC (rev 486)
@@ -136,8 +136,8 @@
serv.removeResourceBundleData(event.getRequestContext().getRequestParameter(OBJECTID));
Query lastQuery = uiI18n.getLastQuery();
uiI18n.update(lastQuery.getName(), lastQuery.getLanguage());
- while (currentPage > datasource.getAvailablePage())
- currentPage--;
+ if (currentPage > datasource.getAvailablePage())
+ currentPage = datasource.getAvailablePage();
datasource.getPage(currentPage);
}
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2009-11-03
23:55:04 UTC (rev 485)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2009-11-04
02:31:52 UTC (rev 486)
@@ -30,6 +30,8 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.webui.application.UIPortlet;
+import org.exoplatform.portal.webui.portal.PageNodeEvent;
+import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
@@ -231,8 +233,8 @@
LazyPageList datasource = (LazyPageList)repeater.getDataSource();
int currentPage = datasource.getCurrentPage();
defaultValue(null);
- while (currentPage > datasource.getAvailablePage())
- currentPage--;
+ if (currentPage > datasource.getAvailablePage())
+ currentPage = datasource.getAvailablePage();
if (currentPage > 0)
datasource.getPage(currentPage);
}
@@ -267,10 +269,22 @@
int currentPage = datasource.getCurrentPage();
service.remove(page);
uiPageBrowser.defaultValue(uiPageBrowser.getLastQuery());
- while (currentPage > datasource.getAvailablePage())
- currentPage--;
+ if (currentPage > datasource.getAvailablePage())
+ currentPage = datasource.getAvailablePage();
+ datasource.getPage(currentPage);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiPageBrowser);
+ UIPortal uiPortal = Util.getUIPortal();
+ if (uiPortal.getSelectedNode().getPageReference().equals(page.getPageId()))
+ {
+ PageNodeEvent<UIPortal> pnevent =
+ new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, uiPortal.getSelectedNode()
+ .getUri());
+ uiPortal.broadcast(pnevent, Phase.PROCESS);
+ }
+ else
+ {
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiPageBrowser);
+ }
}
}
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 2009-11-03
23:55:04 UTC (rev 485)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2009-11-04
02:31:52 UTC (rev 486)
@@ -52,8 +52,24 @@
public void execute(Event<UIWorkingWorkspace> event) throws Exception
{
UIPortalApplication uiApp = Util.getUIPortalApplication();
- uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
UIWorkingWorkspace uiWorkingWS =
uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+
+ // check edit permission for page
+ UIPageBody pageBody = uiWorkingWS.findFirstComponentOfType(UIPageBody.class);
+ UIPage uiPage = (UIPage)pageBody.getUIComponent();
+ if (uiPage == null) {
+ uiApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.PageNotExist", null));
+ return;
+ }
+ Page page = PortalDataMapper.toPageModel(uiPage);
+
+ UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
+ if (!userACL.hasEditPermission(page))
+ {
+ uiApp.addMessage(new
ApplicationMessage("UIPortalManagement.msg.Invalid-editPermission", null));
+ return;
+ }
+
uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
UIPortalComposer portalComposer =
@@ -64,22 +80,10 @@
portalComposer.setEditted(false);
portalComposer.setCollapse(false);
- //uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor", null);
UIPortalToolPanel uiToolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
uiToolPanel.setShowMaskLayer(false);
- UIPageBody pageBody = uiWorkingWS.findFirstComponentOfType(UIPageBody.class);
-
- // check edit permission for page
- UIPage uiPage = (UIPage) pageBody.getUIComponent();
- Page page = PortalDataMapper.toPageModel(uiPage);
-
- UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
- if (!userACL.hasEditPermission(page))
- {
- uiApp.addMessage(new
ApplicationMessage("UIPortalManagement.msg.Invalid-editPermission", null));
- return;
- }
-
+ uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
+
uiToolPanel.setWorkingComponent(pageBody.getUIComponent());
event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
Util.getPortalRequestContext().setFullRender(true);
Show replies by date