Author: hfnukal
Date: 2012-02-01 06:15:11 -0500 (Wed, 01 Feb 2012)
New Revision: 8340
Modified:
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl
Log:
JBEPP-1395 Breadcrumb Portlet doesn't update when a language change occurs
Modified:
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2012-02-01
11:08:24 UTC (rev 8339)
+++
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2012-02-01
11:15:11 UTC (rev 8340)
@@ -19,18 +19,17 @@
package org.exoplatform.portal.webui.component;
+import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-
-import java.util.ArrayList;
-import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
-
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequest;
@@ -72,16 +71,19 @@
public List<UserNode> getSelectedPath() throws Exception
{
UserNode node = Util.getUIPortal().getSelectedUserNode();
- List<UserNode> paths = new ArrayList<UserNode>();
+ UserPortal userPortal =
Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
+ UserNavigation nav = userPortal.getNavigation(node.getNavigation().getKey());
+ UserNode targetNode = userPortal.resolvePath(nav, null, node.getURI());
+ LinkedList<UserNode> paths = new LinkedList<UserNode>();
+
do
{
- paths.add(node);
- node = node.getParent();
+ paths.addFirst(targetNode);
+ targetNode = targetNode.getParent();
}
- while (node != null && node.getParent() != null);
- Collections.reverse(paths);
-
+ while (targetNode != null && targetNode.getParent() != null);
+
return paths;
}
Modified:
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl 2012-02-01
11:08:24 UTC (rev 8339)
+++
epp/portal/branches/EPP_5_2_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl 2012-02-01
11:15:11 UTC (rev 8340)
@@ -1,5 +1,6 @@
<%
import java.util.List;
+ import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.application.PortalRequestContext;
import org.gatein.common.text.EntityEncoder;
@@ -7,7 +8,8 @@
import org.exoplatform.web.url.PortalURL;
import org.exoplatform.web.url.navigation.NavigationResource;
- List list = uicomponent.getSelectedPath();
+ List<UserNode> list = uicomponent.getSelectedPath();
+ int size = list.size();
PortalRequestContext pcontext = Util.getPortalRequestContext();
PortalURL nodeURL = nodeurl();
@@ -19,16 +21,17 @@
<div class="RightBreadcumbsBar">
<div class="BreadcumbsInfoBar">
<div class="HomeIcon LeftBlock
BCHome16x16Icon"><span></span></div>
- <%if(list.size() > 0) {
+ <%if(size > 0) {
String note = "LeftBlock";
- for(i in 0 .. list.size()-1) {
- def node = list.get(i);
+ int counter = 0;
+ for(UserNode node : list) {
+ counter++;
String actionLink = nodeURL.setNode(node);
- if(i == list.size()-1) note = "Selected";
+ if(counter == size) note = "Selected";
%>
<a href="<%=(node.getPageRef() == null) ? "#" :
actionLink%>" class="$note"><%=node.getEncodedResolvedLabel();%></a>
<%
- if(i != list.size()-1) {
+ if(counter < size) {
%>
<div class="RightBlackGridArrowIcon LeftBlock
RightBlackGridArrow16x16Icon"><span></span></div>
<%
Show replies by date