Author: trong.tran
Date: 2010-10-01 04:42:51 -0400 (Fri, 01 Oct 2010)
New Revision: 4454
Added:
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationResource.java
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
portal/branches/navcontroller/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
portal/branches/navcontroller/portlet/web/src/main/webapp/WEB-INF/portlet.xml
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
Use controller framework for remaining menu toolbar portlets
Remove generation hardcoding of URL
Fix some bugs to be compatible with new controller framework
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -77,12 +77,12 @@
expectedParameters.put(new QualifiedName("gtn", "controller"),
"site");
expectedParameters.put(new QualifiedName("gtn", "sitename"),
"classic");
expectedParameters.put(new QualifiedName("gtn", "sitetype"),
"portal");
- expectedParameters.put(new QualifiedName("gtn", "path"),
"");
+ expectedParameters.put(new QualifiedName("gtn", "path"),
"/");
expectedParameters.put(new QualifiedName("gtn", "componentid"),
"foo");
//
- assertEquals(expectedParameters, router.route("/private/classic",
Collections.singletonMap("portal:componentId", new
String[]{"foo"})));
- assertEquals("/private/classic", router.render(expectedParameters));
+ assertEquals(expectedParameters, router.route("/private/classic/",
Collections.singletonMap("portal:componentId", new
String[]{"foo"})));
+ assertEquals("/private/classic/", router.render(expectedParameters));
}
public void testPrivateClassic() throws Exception
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -48,7 +48,6 @@
public List<PageNavigation> getGroupNavigations() throws Exception
{
String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getNavigations();
List<PageNavigation> navigations = new ArrayList<PageNavigation>();
for (PageNavigation navigation : allNavigations)
@@ -61,6 +60,19 @@
return navigations;
}
+ public PageNavigation getCurrentPortalNavigation() throws Exception
+ {
+ List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getNavigations();
+ for (PageNavigation navigation : allNavigations)
+ {
+ if (navigation.getOwnerType().equals(PortalConfig.PORTAL_TYPE))
+ {
+ return navigation;
+ }
+ }
+ return null;
+ }
+
public PageNode getSelectedPageNode() throws Exception
{
return Util.getUIPortal().getSelectedNode();
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -19,6 +19,7 @@
package org.exoplatform.toolbar.webui.component;
+import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
@@ -53,31 +54,25 @@
return dataStorage.getAllPortalNames();
}
- public String getCurrentPortal()
+ public PageNavigation getCurrentPortalNavigation(boolean isFiltered) throws Exception
{
- return Util.getPortalRequestContext().getPortalOwner();
- }
-
- public String getPortalURI(String portalName)
- {
- return Util.getPortalRequestContext().getPortalURI().replace(getCurrentPortal(),
portalName);
- }
-
- public PageNavigation getCurrentPortalNavigation() throws Exception
- {
- PageNavigation navi = getPageNavigation(PortalConfig.PORTAL_TYPE + "::" +
getCurrentPortal());
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- return PageNavigationUtils.filter(navi, remoteUser);
- }
-
- private PageNavigation getPageNavigation(String owner) throws Exception
- {
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getUserPortalConfig().getNavigations();
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+ String remoteUser = pcontext.getRemoteUser();
+ List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getNavigations();
for (PageNavigation nav : allNavigations)
{
- if (nav.getOwner().equals(owner))
- return nav;
+ if (nav.getOwnerType().equals(PortalConfig.PORTAL_TYPE))
+ {
+ if (isFiltered)
+ {
+ return PageNavigationUtils.filter(nav, remoteUser);
+ }
+ else
+ {
+ return nav;
+ }
+
+ }
}
return null;
}
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl 2010-10-01
08:42:51 UTC (rev 4454)
@@ -7,6 +7,7 @@
import org.gatein.common.text.EntityEncoder;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.web.url.ControllerURL;
+ import org.exoplatform.portal.url.navigation.NavigationResource;
def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
@@ -15,7 +16,6 @@
jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' +
uicomponent.id + '");');
def groupNavigations = uicomponent.getGroupNavigations();
- def portalURI = Util.getPortalRequestContext().getPortalURI();
PortalRequestContext pcontext = Util.getPortalRequestContext();
ControllerURL nodeURL =
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
@@ -47,7 +47,7 @@
boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String actionLink = nodeURL.setResource(node).toString();
+ String actionLink = nodeURL.setResource(new NavigationResource(node)).toString();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -86,14 +86,17 @@
print """
</div>
""" ;
- }
+ }
+
+ def portalNavigation = uicomponent.getCurrentPortalNavigation();
+ def groupNaviNode = portalNavigation.getNode("groupnavigation");
%>
<div class="UIUserToolBarGroupPortlet" id="$uicomponent.id" >
<div class="UIHorizontalTabs">
<div class="TabsContainer">
<div class="UITab NormalToolbarTab">
<div class="">
- <a class="GroupIcon TBIcon" href="<%= portalURI +
"groupnavigation" %>">Group</a>
+ <a class="GroupIcon TBIcon"
href="<%=nodeURL.setResource(new NavigationResource(groupNaviNode)).toString()
%>">Group</a>
</div>
<% if (!groupNavigations.isEmpty()) { %>
<div style="display:none" class="MenuItemContainer">
Modified:
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
===================================================================
---
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2010-10-01
08:42:51 UTC (rev 4454)
@@ -5,6 +5,9 @@
import org.exoplatform.portal.webui.util.Util ;
import org.exoplatform.webui.organization.OrganizationUtils;
import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.application.PortalRequestContext;
+ import org.exoplatform.web.url.ControllerURL;
+ import org.exoplatform.portal.url.navigation.NavigationResource;
def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
@@ -12,8 +15,10 @@
jsmanager.importJavascript('eXo.portal.UIAdminToolbar') ;
jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' +
uicomponent.id + '");');
- def portalURI = Util.getPortalRequestContext().getPortalURI();
- void renderPortalNavigations() {
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+ ControllerURL nodeURL =
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
+
+ void renderPortalNavigations(ControllerURL nodeURL, PortalRequestContext pcontext) {
print """
<div style="position: absolute; display:none"
class="MenuItemContainer">
@@ -24,12 +29,15 @@
String href = "#";
for(int i = 0; i < uicomponent.getAllPortalNames().size(); i++) {
String portal = uicomponent.getAllPortalNames().get(i);
- if(portal.equals(uicomponent.getCurrentPortal())) {
+ if(portal.equals(pcontext.getPortalOwner())) {
isCurrent = true;
} else isCurrent = false;
+
+ nodeURL.setResource(new NavigationResource(portal, null));
+
if(isCurrent) clazz = "class='ArrowIcon'";
else clazz = "";
- href = uicomponent.getPortalURI(portal);
+ href = nodeURL.toString();
EntityEncoder entityEncoder = EntityEncoder.FULL;
portal = entityEncoder.encode(portal);
print """
@@ -39,7 +47,7 @@
</div>
""";
if(isCurrent) {
- renderCurrentPortal();
+ renderCurrentPortal(nodeURL);
}
print """
</div>
@@ -51,15 +59,15 @@
""";
}
- void renderCurrentPortal() {
- navigation = uicomponent.getCurrentPortalNavigation();
+ void renderCurrentPortal(ControllerURL nodeURL) {
+ navigation = uicomponent.getCurrentPortalNavigation(true);
nodes = navigation.getNodes();
print """
<div style="position: absolute; display:none"
class="MenuItemContainer">
<div class="SubBlock">
""";
for(int i = 0; i < nodes.size(); i++) {
- renderPageNode(nodes.get(i), i%2 == 0);
+ renderPageNode(nodeURL, nodes.get(i), i%2 == 0);
}
print """
</div>
@@ -67,7 +75,7 @@
""";
}
- void renderPageNode(PageNode node, boolean flag) {
+ void renderPageNode(ControllerURL nodeURL, PageNode node, boolean flag) {
PageNode selectedNode = uicomponent.getSelectedPageNode();
String tabStyleNavigation = "";
if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
@@ -77,7 +85,7 @@
boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
+ String href = nodeURL.setResource(new NavigationResource(null, node)).toString();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -105,7 +113,7 @@
<div class="SubBlock">
""" ;
for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
+ renderPageNode(nodeURL, node.getChildren().get(j), j%2 == 0);
}
print """
</div>
@@ -115,20 +123,22 @@
}
print """
</div>
- """ ;
- }
+ """ ;
+ }
+
+ def navigation = uicomponent.getCurrentPortalNavigation(false);
+ def portalNavigationNode = navigation.getNode("portalnavigation");
%>
-
<div class="UIUserToolBarSitePortlet" id="$uicomponent.id" >
<div class="UIHorizontalTabs">
<div class="TabsContainer">
<div class="UITab NormalToolbarTab">
<div class="">
- <a class="SitesIcon TBIcon" href="<%= portalURI +
"portalnavigation" %>">
+ <a class="SitesIcon TBIcon" href="<%=
nodeURL.setResource(new NavigationResource(portalNavigationNode)).toString()
%>">
Site
</a>
</div>
- <% renderPortalNavigations() %>
+ <% renderPortalNavigations(nodeURL, pcontext) %>
</div>
</div>
</div>
Modified:
portal/branches/navcontroller/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
===================================================================
---
portal/branches/navcontroller/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -20,21 +20,13 @@
package org.exoplatform.portal.webui.component;
import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.portal.PageNodeEvent;
-import org.exoplatform.portal.webui.portal.UIPortal;
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.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIBreadcumbs;
import org.exoplatform.webui.core.UIPortletApplication;
-import org.exoplatform.webui.core.UIBreadcumbs.LocalPath;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import java.util.ArrayList;
import java.util.List;
import javax.portlet.PortletPreferences;
@@ -46,59 +38,57 @@
* May 30, 2006
* @version:: $Id$
*/
-@ComponentConfig(lifecycle = UIApplicationLifecycle.class, events =
@EventConfig(listeners = UIBreadcumbsPortlet.SelectPathActionListener.class))
+@ComponentConfig(
+ lifecycle = UIApplicationLifecycle.class
+)
public class UIBreadcumbsPortlet extends UIPortletApplication
{
+ private final String template;
+
public UIBreadcumbsPortlet() throws Exception
{
PortletRequestContext context =
(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
PortletRequest prequest = context.getRequest();
PortletPreferences prefers = prequest.getPreferences();
- String template = prefers.getValue("template",
"system:/groovy/webui/core/UIBreadcumbs.gtmpl");
-
- UIBreadcumbs uiBreadCumbs = addChild(UIBreadcumbs.class, null, null);
- uiBreadCumbs.setTemplate(template);
+ template = prefers.getValue("template",
"app:/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl");
}
-
- public void loadSelectedPath()
+
+ public String getTemplate()
{
- List<PageNode> nodes = Util.getUIPortal().getSelectedPath();
- List<LocalPath> paths = new ArrayList<LocalPath>();
- for (PageNode node : nodes)
- {
- if (node == null)
- continue;
- if (node.getPageReference() == null)
- {
- paths.add(new LocalPath(null, node.getResolvedLabel()));
- }
- else
- {
- paths.add(new LocalPath(node.getUri(), node.getResolvedLabel()));
- }
- }
- UIBreadcumbs uiBreadCumbs = getChild(UIBreadcumbs.class);
- uiBreadCumbs.setPath(paths);
- }
-
- @Override
- public void renderChildren() throws Exception
- {
- loadSelectedPath();
- super.renderChildren();
+ return template != null ? template : super.getTemplate();
}
-
- static public class SelectPathActionListener extends
EventListener<UIBreadcumbs>
+
+ public boolean isUseAjax() throws Exception
{
- @Override
- public void execute(Event<UIBreadcumbs> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIPortal uiPortal = Util.getUIPortal();
- PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
- uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
- }
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ PortletRequest prequest = context.getRequest();
+ PortletPreferences prefers = prequest.getPreferences();
+ return Boolean.valueOf(prefers.getValue("useAJAX", "true"));
}
+
+ public List<PageNode> getSelectedPath()
+ {
+ return Util.getUIPortal().getSelectedPath();
+ }
+//
+// @Override
+// public void renderChildren() throws Exception
+// {
+// getSelectedPath();
+// super.renderChildren();
+// }
+//
+// static public class SelectPathActionListener extends
EventListener<UIBreadcumbs>
+// {
+// @Override
+// public void execute(Event<UIBreadcumbs> event) throws Exception
+// {
+// String uri = event.getRequestContext().getRequestParameter(OBJECTID);
+// UIPortal uiPortal = Util.getUIPortal();
+// PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
+// uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
+// }
+// }
}
Modified: portal/branches/navcontroller/portlet/web/src/main/webapp/WEB-INF/portlet.xml
===================================================================
---
portal/branches/navcontroller/portlet/web/src/main/webapp/WEB-INF/portlet.xml 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/web/src/main/webapp/WEB-INF/portlet.xml 2010-10-01
08:42:51 UTC (rev 4454)
@@ -157,7 +157,7 @@
</preference>
<preference>
<name>template</name>
- <value>system:/groovy/webui/core/UIBreadcumbs.gtmpl</value>
+
<value>app:/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl</value>
<read-only>false</read-only>
</preference>
</portlet-preferences>
Added:
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl
===================================================================
---
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl
(rev 0)
+++
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIBreadcumbsPortlet.gtmpl 2010-10-01
08:42:51 UTC (rev 4454)
@@ -0,0 +1,43 @@
+<%
+ import java.util.List;
+ import org.exoplatform.portal.webui.util.Util;
+ import org.exoplatform.portal.application.PortalRequestContext;
+ import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.web.url.ControllerURL;
+ import org.exoplatform.portal.url.navigation.NavigationResource;
+
+ List list = uicomponent.getSelectedPath();
+
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+ ControllerURL nodeURL =
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
+ nodeURL.setAjax(uicomponent.isUseAjax());
+%>
+<div class="UIBreadcumbsPortlet" id="$uicomponent.id">
+ <div class="UIBreadcumbs">
+ <div class="LeftBreadcumbsBar">
+ <div class="RightBreadcumbsBar">
+ <div class="BreadcumbsInfoBar">
+ <div class="HomeIcon LeftBlock
BCHome16x16Icon"><span></span></div>
+ <%if(list.size() > 0) {
+ String note = "LeftBlock";
+ for(i in 0 .. list.size()-1) {
+ def node = list.get(i);
+ String actionLink = nodeURL.setResource(new NavigationResource(node));
+ if(i == list.size()-1) note = "Selected";
+ %>
+ <a href="<%=(node.getPageReference() == null) ? "#" :
actionLink%>" class="$note"><%=node.getResolvedLabel();%></a>
+ <%
+ if(i != list.size()-1) {
+ %>
+ <div class="RightBlackGridArrowIcon LeftBlock
RightBlackGridArrow16x16Icon"><span></span></div>
+ <%
+ }
+ }
+ }
+ %>
+ <div class="ClearLeft"><span></span></div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
Modified:
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
===================================================================
---
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2010-10-01
08:42:51 UTC (rev 4454)
@@ -6,7 +6,7 @@
import org.gatein.common.text.EntityEncoder;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.web.url.ControllerURL;
- import org.exoplatform.web.application.Parameter;
+ import org.exoplatform.portal.url.navigation.NavigationResource;
def rcontext = _ctx.getRequestContext();
@@ -78,11 +78,10 @@
EntityEncoder entityEncoder = EntityEncoder.FULL;
label = entityEncoder.encode(label);
- nodeURL.setResource(node);
+ nodeURL.setResource(new NavigationResource(node));
String nonAjaxURL = nodeURL.setAjax(false).toString();
String ajaxURL = nodeURL.setAjax(true).toString();
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
if(node.pageReference != null) {
print """
@@ -157,13 +156,12 @@
%>
<div class="$arrowIcon">
<%
- String pageURI =
Util.getPortalRequestContext().getPortalURI() + node.getUri();
String label = node.resolvedLabel;
if(label.length() > 30) label =
label.substring(0,29) + "...";
EntityEncoder entityEncoder = EntityEncoder.FULL;
label=entityEncoder.encode(label);
if(node.pageReference != null) {
- nodeURL.setResource(node);
+ nodeURL.setResource(new NavigationResource(node));
String nonAjaxURL =
nodeURL.setAjax(false).toString();
String ajaxURL = nodeURL.setAjax(true).toString();
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml 2010-10-01
08:42:51 UTC (rev 4454)
@@ -69,6 +69,13 @@
<portlet>
<application-ref>web</application-ref>
<portlet-ref>BreadcumbsPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>useAJAX</name>
+ <value>false</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
</portlet>
<access-permissions>Everyone</access-permissions>
<show-info-bar>false</show-info-bar>
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml 2010-10-01
08:42:51 UTC (rev 4454)
@@ -62,6 +62,13 @@
<portlet>
<application-ref>web</application-ref>
<portlet-ref>BreadcumbsPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>useAJAX</name>
+ <value>false</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
</portlet>
<access-permissions>Everyone</access-permissions>
<show-info-bar>false</show-info-bar>
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2010-10-01
08:42:51 UTC (rev 4454)
@@ -5,7 +5,7 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.navigation.TreeNode;
import org.exoplatform.web.url.ControllerURL;
- import org.exoplatform.web.application.Parameter;
+ import org.exoplatform.portal.url.navigation.NavigationResource;
%>
<%
def navigations = uicomponent.getNavigations();
@@ -37,7 +37,7 @@
actionExpand = uicomponent.event("ExpandNode", nav.getId() + "::"
+ node.getUri());
def actionCollapse = "ajaxAsyncGetRequest('" +
uicomponent.url("CollapseNode",nav.getId() + "::" + node.getUri()) +
"', true)";
- String actionLink = nodeURL.setController(node).toString();
+ String actionLink = nodeURL.setResource(new NavigationResource(node)).toString();
lastNode = '';
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocator.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -19,12 +19,11 @@
package org.exoplatform.portal.url.navigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.web.controller.QualifiedName;
import org.exoplatform.web.url.ResourceLocator;
import org.exoplatform.web.url.ResourceType;
-import java.util.Collections;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -33,31 +32,30 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class NavigationLocator implements ResourceLocator<PageNode>
+public class NavigationLocator implements ResourceLocator<NavigationResource>
{
/** . */
public static final QualifiedName PATH = new QualifiedName("gtn",
"path");
-
+
/** . */
- public static final ResourceType<PageNode, NavigationLocator> TYPE = new
ResourceType<PageNode, NavigationLocator>(){};
+ public static final QualifiedName REQUEST_SITE_NAME = new
QualifiedName("gtn", "sitename");
/** . */
- private static final Set<QualifiedName> PARAMETER_NAMES =
Collections.singleton(PATH);
+ public static final ResourceType<NavigationResource, NavigationLocator> TYPE =
new ResourceType<NavigationResource, NavigationLocator>(){};
/** . */
- private PageNode resource;
-
- public PageNode getResource()
+ private static final Set<QualifiedName> PARAMETER_NAMES = new
HashSet<QualifiedName>();
+
+ static
{
- return resource;
+ PARAMETER_NAMES.add(PATH);
+ PARAMETER_NAMES.add(REQUEST_SITE_NAME);
}
- public void setResource(PageNode resource)
- {
- this.resource = resource;
- }
-
+ /** . */
+ private NavigationResource resource;
+
public Set<QualifiedName> getParameterNames()
{
return PARAMETER_NAMES;
@@ -67,8 +65,31 @@
{
if (PATH.equals(parameterName))
{
- return "/" + resource.getUri();
+ if (resource.getPageNode() == null)
+ {
+ return "";
+ }
+ else
+ {
+ return "/" + resource.getPageNode().getUri();
+ }
}
+ else if (REQUEST_SITE_NAME.equals(parameterName))
+ {
+ return resource.getSiteName();
+ }
return null;
}
+
+ @Override
+ public NavigationResource getResource()
+ {
+ return resource;
+ }
+
+ @Override
+ public void setResource(NavigationResource resource)
+ {
+ this.resource = resource;
+ }
}
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationLocatorPlugin.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.url.navigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.url.ResourceLocatorPlugin;
import org.exoplatform.web.url.ResourceType;
@@ -27,11 +26,11 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-public class NavigationLocatorPlugin extends ResourceLocatorPlugin<PageNode,
NavigationLocator>
+public class NavigationLocatorPlugin extends ResourceLocatorPlugin<NavigationResource,
NavigationLocator>
{
@Override
- protected ResourceType<PageNode, NavigationLocator> getResourceType()
+ protected ResourceType<NavigationResource, NavigationLocator> getResourceType()
{
return NavigationLocator.TYPE;
}
Added:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationResource.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationResource.java
(rev 0)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/navigation/NavigationResource.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -0,0 +1,63 @@
+/**
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.portal.url.navigation;
+
+import org.exoplatform.portal.config.model.PageNode;
+
+/**
+ * A class that contains combination of a portal name and a page node
+ * to determine the target URL
+ *
+ * @author <a href="trongtt(a)gmail.com">Trong Tran</a>
+ * @version $Revision$
+ */
+public class NavigationResource
+{
+ /** . */
+ private final String siteName;
+
+ /** . */
+ private final PageNode pageNode;
+
+ public NavigationResource(String portalName)
+ {
+ this(portalName, null);
+ }
+
+ public NavigationResource(PageNode node)
+ {
+ this(null, node);
+ }
+
+ public NavigationResource(String portalName, PageNode node)
+ {
+ siteName = portalName;
+ pageNode = node;
+ }
+
+ public String getSiteName()
+ {
+ return siteName;
+ }
+
+ public PageNode getPageNode()
+ {
+ return pageNode;
+ }
+}
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -26,6 +26,8 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.url.navigation.NavigationLocator;
+import org.exoplatform.portal.url.navigation.NavigationResource;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -36,6 +38,7 @@
import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.web.url.ControllerURL;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
@@ -391,8 +394,10 @@
PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
PortalRequestContext pcontext = Util.getPortalRequestContext();
- String uri = pcontext.getPortalURI() + selectedNode.getUri();
- pcontext.getResponse().sendRedirect(uri);
+ ControllerURL<NavigationResource, NavigationLocator> nodeURL =
+
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
+ nodeURL.setResource(new NavigationResource(null, selectedNode));
+ pcontext.sendRedirect(nodeURL.toString());
}
}
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-10-01
06:43:24 UTC (rev 4453)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-10-01
08:42:51 UTC (rev 4454)
@@ -31,6 +31,7 @@
import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.resource.SkinURL;
import org.exoplatform.portal.url.navigation.NavigationLocator;
+import org.exoplatform.portal.url.navigation.NavigationResource;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import org.exoplatform.portal.webui.page.UIPageActionListener.ChangeNodeActionListener;
@@ -544,9 +545,9 @@
isAjaxInLastRequest = false;
if (nodePath.equals(lastNonAjaxUri) &&
!nodePath.equals(lastNodePath))
{
- ControllerURL<PageNode, NavigationLocator> nodeURL =
+ ControllerURL<NavigationResource, NavigationLocator> nodeURL =
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
- nodeURL.setResource(getShowedUIPortal().getSelectedNode());
+ nodeURL.setResource(new NavigationResource(null,
getShowedUIPortal().getSelectedNode()));
pcontext.sendRedirect(nodeURL.toString());
return;
}