Author: hoang_to
Date: 2010-01-29 03:08:18 -0500 (Fri, 29 Jan 2010)
New Revision: 1465
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
Log:
GTNPORTAL-540: Fix errors in SiteMap portlet
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java 2010-01-29
03:50:59 UTC (rev 1464)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/PageNavigationUtils.java 2010-01-29
08:08:18 UTC (rev 1465)
@@ -199,4 +199,16 @@
resolveLabel(res, childNode);
}
}
+
+ public static PageNavigation findNavigationByID(List<PageNavigation>
all_Navigations, int id)
+ {
+ for(PageNavigation nav : all_Navigations)
+ {
+ if(nav.getId() == id)
+ {
+ return nav;
+ }
+ }
+ return null;
+ }
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2010-01-29
03:50:59 UTC (rev 1464)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2010-01-29
08:08:18 UTC (rev 1465)
@@ -111,7 +111,7 @@
}
else
{
- for (PageNavigation nav : Util.getUIPortal().getNavigations())
+ for (PageNavigation nav : Util.getUIPortalApplication().getNavigations())
{
if (!showUserNavigation &&
nav.getOwnerType().equals("user"))
continue;
@@ -260,11 +260,10 @@
UIPortalNavigation uiNavigation = event.getSource();
TreeNode treeNode = uiNavigation.getTreeNodes();
- UIPortal uiPortal = Util.getUIPortal();
-
+ List<PageNavigation> all_Navigations =
Util.getUIPortalApplication().getNavigations();
+
// get URI
String uri = event.getRequestContext().getRequestParameter(OBJECTID);
-
int index = uri.lastIndexOf("::");
String id = uri.substring(index + 2);
@@ -272,11 +271,12 @@
PageNavigation selectNav = null;
String navId = uri.substring(0, index);
+ selectNav = PageNavigationUtils.findNavigationByID(all_Navigations,
Integer.parseInt(navId));
+ if(selectNav == null)
+ {
+ return;
+ }
- //TODO: Minh Hoang TO
- //selectNav = uiPortal.getPageNavigation(Integer.parseInt(navId));
- selectNav = uiPortal.getSelectedNavigation();
-
// get PageNode by uri
PageNode expandNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-01-29
03:50:59 UTC (rev 1464)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-01-29
08:08:18 UTC (rev 1465)
@@ -98,8 +98,6 @@
private Properties properties;
- //private List<PageNavigation> navigations;
-
private PageNavigation navigation;
private List<PageNode> selectedPath;
@@ -108,7 +106,6 @@
private UIPage showedUIPage;
- //private Map<UIPageKey, UIPage> all_UIPages;
private Map<String, UIPage> all_UIPages;
private Map<String, String[]> publicParameters_ = new HashMap<String,
String[]>();
@@ -221,63 +218,7 @@
}
this.all_UIPages.put(pageReference, uiPage);
}
-
- /*
- public List<PageNavigation> getNavigations() throws Exception
- {
- UserPortalConfigService serv =
getApplicationComponent(UserPortalConfigService.class);
- for (int i = 0; i < navigations.size(); i++)
- {
- PageNavigation ele = navigations.get(i);
- if (serv.getPageNavigation(ele.getOwnerType(), ele.getOwnerId()) == null)
- {
- navigations.remove(i);
- --i;
- }
- }
-
- return navigations;
- }
- */
- /*
- public void setNavigation(List<PageNavigation> navs) throws Exception
- {
- navigations = navs;
- selectedPaths_ = new ArrayList<PageNode>();
- if (navigations == null || navigations.size() < 1)
- return;
- // PageNavigation pNav = navigations.get(0);
- // if(pNav.getNodes() == null || pNav.getNodes().size() < 1) return;
-
- // TODO dang.tung: get suitable navigation
- // ----------------------------------------------------------
- PageNavigation pNav = null;
- for (PageNavigation nav : navs)
- {
- if (nav.getNodes() != null && nav.getNodes().size() > 0)
- {
- pNav = nav;
- break;
- }
- }
- if (pNav == null)
- return;
- // ----------------------------------------------------------
- if(selectedNode_ == null){
- selectedNode_ = pNav.getNodes().get(0);
- selectedPaths_.add(selectedNode_);
- }
- UIPageBody uiPageBody = findFirstComponentOfType(UIPageBody.class);
- if (uiPageBody == null)
- return;
- uiPageBody.setPageBody(selectedNode_, this);
- UIPortalApplication uiApp = Util.getUIPortalApplication();
- refreshNavigation(uiApp.getLocale());
- }
-
- */
-
public void setNavigation(PageNavigation _navigation)
{
this.navigation = _navigation;