Author: mwringe
Date: 2010-03-31 15:42:57 -0400 (Wed, 31 Mar 2010)
New Revision: 2423
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
Log:
GTNPORTAL-758: show the first accessible page to the user as the default page instead of
trying to show the first available page.
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-03-31
18:57:21 UTC (rev 2422)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-03-31
19:42:57 UTC (rev 2423)
@@ -19,9 +19,11 @@
package org.exoplatform.portal.webui.page;
+import org.exoplatform.container.ExoContainer;
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.Container;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
@@ -40,7 +42,6 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.event.Event.Phase;
import java.util.ArrayList;
import java.util.List;
@@ -296,13 +297,33 @@
*/
private PageNode getDefaultNode(PageNavigation nav)
{
- PageNode defaultNode;
+ PageNode defaultNode = null;
try
{
- defaultNode = nav.getNodes().get(0);
+ if (nav != null && nav.getNodes().size() > 0)
+ {
+ WebuiRequestContext context = Util.getPortalRequestContext();
+ ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
+ UserPortalConfigService userPortalConfigService =
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
+
+ for (PageNode pageNode : nav.getNodes())
+ {
+ Page page =
userPortalConfigService.getPage(pageNode.getPageReference(), context.getRemoteUser());
+ if (page != null)
+ {
+ defaultNode = pageNode;
+ break;
+ }
+ }
+ }
+ else
+ {
+ return null;
+ }
}
- catch (IndexOutOfBoundsException ex)
+ catch (Exception e)
{
+ e.printStackTrace();
return null;
}
if (defaultNode != null &&
!("notfound".equals(defaultNode.getName())))
Show replies by date