Author: trong.tran
Date: 2010-09-09 07:32:15 -0400 (Thu, 09 Sep 2010)
New Revision: 4123
Modified:
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/group/template/group/group.xml
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/pages.xml
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UIBreadcumbs.gtmpl
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponent.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PageNodeEvent.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
Add ajax/parameters support to PortalURL
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-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2010-09-09
11:32:15 UTC (rev 4123)
@@ -1,198 +1,211 @@
-<%
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.webui.util.Util;
- import org.gatein.common.text.EntityEncoder;
-
- def rcontext = _ctx.getRequestContext();
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
- jsmanager.importJavascript('eXo.webui.UIHorizontalTabs');
- jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
- jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.onLoad');
-
- jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.loadScroll');
- //jsmanager.addOnResizeJavascript('eXo.portal.UIPortalNavigation.initScroll');
-
- navigations = uicomponent.getNavigations();
-
- public void renderChildrenContainer(PageNavigation nav, PageNode node) {
- print """
- <div class="MenuItemContainer" style="display: none;">
- <div class="MenuItemDecorator">
- <div class="LeftTopMenuDecorator">
- <div class="RightTopMenuDecorator">
- <div
class="CenterTopMenuDecorator"><span></span></div>
- </div>
- </div>
- <div class="LeftMiddleMenuDecorator">
- <div class="RightMiddleMenuDecorator">
- <div class="CenterMiddleMenuDecorator">
- """;
- for(child in node.getChildren()) {
- renderChildNode(nav, child);
- }
- print """
- </div>
- </div>
- </div>
- <div class="LeftBottomMenuDecorator">
- <div class="RightBottomMenuDecorator">
- <div
class="CenterBottomMenuDecorator"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- """;
- }
- public void renderChildNode(PageNavigation nav, PageNode node) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
- String tabStyleNavigation = "NormalItem"; // OverItem
- if(selectedNode != null && selectedNav != null &&
- selectedNav.getId () == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedItem";
- }
-
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() > 0) arrowIcon =
"ArrowIcon";
-
- String label = node.resolvedLabel;
- String title = "";
- if(label.length() > 40) {
- title = label;
- label = label.substring(0,37) + "...";
- }
- EntityEncoder entityEncoder = EntityEncoder.FULL;
- label = entityEncoder.encode(label);
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- if(node.pageReference != null) {
- if(uicomponent.isUseAjax()) {
- String onclickEvt = uicomponent.event("SelectNode", nav.getId() +
"::" + node.getUri()) + ";return false;" ;
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$arrowIcon" title="$title">
- <div class="ItemIcon $icon">
- <a href="$pageURI"
onclick="$onclickEvt">$label</a>
- </div>
- </div>
- """;
- } else {
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$arrowIcon" title="$title">
- <div class="ItemIcon $icon">
- <a href="$pageURI">$label</a>
- </div>
- </div>
- """;
- }
- } else {
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$arrowIcon" title="$title">
- <div class="ItemIcon $icon">
- <a href="$pageURI">$label</a>
- </div>
- </div>
- """;
- }
-
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- renderChildrenContainer(nav, node);
- }
- print "</div>";
- }
-%>
-
-<div class="UINavigationBar <%=uicomponent.getCssClassName()%>">
- <div class="LeftNavigationBar">
- <div class="RightNavigationBar">
- <div class="MiddleNavigationBar">
- <div class="UIHorizontalTabs">
- <div class="TabsContainer">
- <%
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- if(navigations != null) {
- for(nav in navigations) {
-
- def pageNodes = nav.getNodes();
- for(PageNode node in pageNodes) {
- String tabStyleNavigation = "NormalNavigationTab";
- if(selectedNode != null && selectedNav != null &&
- selectedNav.getId() == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedNavigationTab";
- }
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- %>
-
- <div class="UITab">
- <div class="$tabStyleNavigation">
- <div class="LeftTab">
- <div class="RightTab">
- <div class="MiddleTab">
- <div class="TabIcon">
- <%
- String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() >
0) {
- arrowIcon = "DropDownArrowIcon";
- }
- String iconType = node.getIcon();
- if(iconType == null) iconType = "DefaultPageIcon";
- %>
- <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) {
- if(uicomponent.isUseAjax()) {
- String onclickEvt =
uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri()) +
";return false;";
- %>
- <a class="TabLabel ${iconType}"
onclick="$onclickEvt" href="$pageURI">$label</a>
- <%
- } else {
- %>
- <a class="TabLabel ${iconType}"
href="$pageURI">$label</a>
- <% }
- } else {%>
- <a class="TabLabel ${iconType}">$label</a>
- <%}%>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <%
- /*Render Popup Menu*/
- if (node.getChildren() != null && node.getChildren().size() > 0)
{
- renderChildrenContainer(nav, node);
- }
- %>
- </div>
- <%
- }
- }
- }
- %>
- <div class="ScrollButtons">
- <div class="ScrollLeftButton" title="<%=
_ctx.appRes("UIPortalNavigation.Label.Previous") %>">
- <div class="ScrollRightButton" title="<%=
_ctx.appRes("UIPortalNavigation.Label.Next")
%>"><span></span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-
+<%
+ import org.exoplatform.portal.config.model.PageNode;
+ import org.exoplatform.portal.config.model.PageNavigation;
+ import org.exoplatform.web.application.JavascriptManager;
+ import org.exoplatform.portal.webui.util.Util;
+ import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.application.PortalRequestContext;
+ import org.exoplatform.web.url.ResourceURL;
+ import org.exoplatform.web.application.Parameter;
+
+ def rcontext = _ctx.getRequestContext();
+
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+
+ JavascriptManager jsmanager = rcontext.getJavascriptManager();
+ jsmanager.importJavascript('eXo.webui.UIHorizontalTabs');
+ jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
+ jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.onLoad');
+
+ jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.loadScroll');
+ //jsmanager.addOnResizeJavascript('eXo.portal.UIPortalNavigation.initScroll');
+
+ navigations = uicomponent.getNavigations();
+
+ ResourceURL nodeURL =
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
+
+ public void renderChildrenContainer(PageNavigation nav, PageNode node, ResourceURL
nodeURL) {
+ print """
+ <div class="MenuItemContainer" style="display: none;">
+ <div class="MenuItemDecorator">
+ <div class="LeftTopMenuDecorator">
+ <div class="RightTopMenuDecorator">
+ <div
class="CenterTopMenuDecorator"><span></span></div>
+ </div>
+ </div>
+ <div class="LeftMiddleMenuDecorator">
+ <div class="RightMiddleMenuDecorator">
+ <div class="CenterMiddleMenuDecorator">
+ """;
+ for(child in node.getChildren()) {
+ renderChildNode(nav, child, nodeURL);
+ }
+ print """
+ </div>
+ </div>
+ </div>
+ <div class="LeftBottomMenuDecorator">
+ <div class="RightBottomMenuDecorator">
+ <div
class="CenterBottomMenuDecorator"><span></span></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ """;
+ }
+
+ public void renderChildNode(PageNavigation nav, PageNode node, ResourceURL nodeURL) {
+ PageNode selectedNode = uicomponent.getSelectedPageNode();
+ PageNavigation selectedNav = uicomponent.getSelectedNavigation();
+ String tabStyleNavigation = "NormalItem"; // OverItem
+ if(selectedNode != null && selectedNav != null &&
+ selectedNav.getId () == nav.getId() &&
+ node.getUri() == selectedNode.getUri()) {
+ tabStyleNavigation = "SelectedItem";
+ }
+
+ String icon = node.getIcon();
+ if(icon == null) icon = "DefaultPageIcon";
+ String arrowIcon = "";
+ if (node.getChildren() != null && node.getChildren().size() > 0) arrowIcon
= "ArrowIcon";
+
+ String label = node.resolvedLabel;
+ String title = "";
+ if(label.length() > 40) {
+ title = label;
+ label = label.substring(0,37) + "...";
+ }
+ EntityEncoder entityEncoder = EntityEncoder.FULL;
+ label = entityEncoder.encode(label);
+
+ nodeURL.setResource(node);
+ String nonAjaxURL = nodeURL.setParameters(null).setAjax(false).toString();
+ if(uicomponent.isUseAjax()){
+ nodeURL.setParameters(new Parameter(PortalRequestContext.TARGET_NODE,
node.getUri()));
+ }
+
+ String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
+ if(node.pageReference != null) {
+
+ print """
+ <div class="MenuItem $tabStyleNavigation">
+ <div class="$arrowIcon" title="$title">
+ <div class="ItemIcon $icon">
+ """;
+ if(uicomponent.isUseAjax()) {
+ print "<a href=\"" + nonAjaxURL + "\"
onclick=\"" + nodeURL.setAjax(true).toString() + "; return
false;\">$label</a>";
+ } else {
+ print "<a href=\"" + nonAjaxURL +
"\">$label</a>"
+ }
+ print """
+ </div>
+ </div>
+ """;
+ } else {
+ print """
+ <div class="MenuItem $tabStyleNavigation">
+ <div class="$arrowIcon" title="$title">
+ <div class="ItemIcon $icon">
+ <a href="#">$label</a>
+ </div>
+ </div>
+ """;
+ }
+
+ if (node.getChildren() != null && node.getChildren().size() > 0) {
+ renderChildrenContainer(nav, node, nodeURL);
+ }
+ print "</div>";
+ }
+%>
+
+<div class="UINavigationBar <%=uicomponent.getCssClassName()%>">
+ <div class="LeftNavigationBar">
+ <div class="RightNavigationBar">
+ <div class="MiddleNavigationBar">
+ <div class="UIHorizontalTabs">
+ <div class="TabsContainer">
+ <%
+ PageNavigation selectedNav = uicomponent.getSelectedNavigation();
+ PageNode selectedNode = uicomponent.getSelectedPageNode();
+ if(navigations != null) {
+ for(nav in navigations) {
+
+ def pageNodes = nav.getNodes();
+ for(PageNode node in pageNodes) {
+ String tabStyleNavigation = "NormalNavigationTab";
+ if(selectedNode != null && selectedNav != null &&
+ selectedNav.getId() == nav.getId() &&
+ node.getUri() == selectedNode.getUri()) {
+ tabStyleNavigation = "SelectedNavigationTab";
+ }
+ String icon = node.getIcon();
+ if(icon == null) icon = "DefaultPageIcon";
+ %>
+
+ <div class="UITab">
+ <div class="$tabStyleNavigation">
+ <div class="LeftTab">
+ <div class="RightTab">
+ <div class="MiddleTab">
+ <div class="TabIcon">
+ <%
+ String arrowIcon = "";
+ if (node.getChildren() != null &&
node.getChildren().size() > 0) {
+ arrowIcon = "DropDownArrowIcon";
+ }
+ String iconType = node.getIcon();
+ if(iconType == null) iconType =
"DefaultPageIcon";
+ %>
+ <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);
+ String nonAjaxURL =
nodeURL.setParameters(null).setAjax(false).toString();
+
+ if(uicomponent.isUseAjax()) {
+ nodeURL.setParameters(new
Parameter(PortalRequestContext.TARGET_NODE, node.getUri()));
+ %>
+ <a class="TabLabel ${iconType}"
onclick="<%=nodeURL.setAjax(true).toString()%>; return false;"
href="$nonAjaxURL">$label</a>
+ <%
+ } else {
+ %>
+ <a class="TabLabel ${iconType}"
href="$nonAjaxURL">$label</a>
+ <% }
+ } else {%>
+ <a class="TabLabel
${iconType}">$label</a>
+ <%}%>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <%
+ /*Render Popup Menu*/
+ if (node.getChildren() != null &&
node.getChildren().size() > 0) {
+ renderChildrenContainer(nav, node, nodeURL);
+ }
+ %>
+ </div>
+ <%
+ }
+ }
+ }
+ %>
+ <div class="ScrollButtons">
+ <div class="ScrollLeftButton" title="<%=
_ctx.appRes("UIPortalNavigation.Label.Previous") %>">
+ <div class="ScrollRightButton" title="<%=
_ctx.appRes("UIPortalNavigation.Label.Next")
%>"><span></span></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml 2010-09-09
11:32:15 UTC (rev 4123)
@@ -60,6 +60,11 @@
<value>GroupNavigation</value>
<read-only>true</read-only>
</preference>
+ <preference>
+ <name>useAJAX</name>
+ <value>false</value>
+ <read-only>false</read-only>
+ </preference>
</preferences>
</portlet>
<access-permissions>Everyone</access-permissions>
Modified:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/pages.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/pages.xml 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/pages.xml 2010-09-09
11:32:15 UTC (rev 4123)
@@ -106,6 +106,13 @@
<portlet>
<application-ref>web</application-ref>
<portlet-ref>SiteMapPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>useAJAX</name>
+ <value>false</value>
+ <read-only>false</read-only>
+ </preference>
+ </preferences>
</portlet>
<title>SiteMap</title>
<access-permissions>Everyone</access-permissions>
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-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml 2010-09-09
11:32:15 UTC (rev 4123)
@@ -53,6 +53,13 @@
<portlet>
<application-ref>web</application-ref>
<portlet-ref>NavigationPortlet</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>
@@ -62,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/groovy/webui/core/UIBreadcumbs.gtmpl
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UIBreadcumbs.gtmpl 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UIBreadcumbs.gtmpl 2010-09-09
11:32:15 UTC (rev 4123)
@@ -3,6 +3,8 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.application.PortalRequestContext;
import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.web.url.ResourceURL;
+ import org.exoplatform.web.application.Parameter;
List list = uicomponent.getPath();
def styleBread = uicomponent.getBreadcumbsStyle();
@@ -11,6 +13,8 @@
def String portalURI = pcontext.getPortalURI();
def useAJAX = uicomponent.isUseAjax();
+
+ ResourceURL nodeURL =
pcontext.createURL(org.exoplatform.portal.url.navigation.NavigationLocator.TYPE);
%>
<div class="UIBreadcumbs">
@@ -24,9 +28,12 @@
localPath = list.get(i);
String actionLink
if(useAJAX)
- actionLink = uicomponent.event("SelectPath", localPath.getId());
- else
- actionLink = portalURI + localPath.getId();
+ {
+ nodeURL.setParameters(new Parameter(PortalRequestContext.TARGET_NODE,
localPath.getId()));
+ actionLink = nodeURL.setAjax(true).toString();
+ } else {
+ actionLink = portalURI + localPath.getId();
+ }
EntityEncoder entityEncoder = EntityEncoder.FULL;
String label = entityEncoder.encode(localPath.label)
if(i == list.size()-1) note = "Selected";
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-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2010-09-09
11:32:15 UTC (rev 4123)
@@ -5,6 +5,7 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.navigation.TreeNode;
import org.exoplatform.web.url.ResourceURL;
+ import org.exoplatform.web.application.Parameter;
%>
<%
def navigations = uicomponent.getNavigations();
@@ -34,12 +35,14 @@
String label = node.encodedResolvedLabel;
actionExpand = uicomponent.event("ExpandNode", nav.getId() + "::"
+ node.getUri());
def actionCollapse = "ajaxAsyncGetRequest('" +
uicomponent.url("CollapseNode",nav.getId() + "::" + node.getUri()) +
"', true)";
-
+
if(useAjax){
- actionLink = uicomponent.event("SelectNode", nav.getId() + "::" +
node.getUri());
- }else{
- actionLink = nodeURL.setResource(node).toString();
- }
+ nodeURL.setAjax(true);
+ nodeURL.setParameters(new Parameter(PortalRequestContext.TARGET_NODE,
node.getUri()));
+ } else {
+ nodeURL.setResource(node);
+ }
+ actionLink = nodeURL.toString();
lastNode = '';
Modified:
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java
===================================================================
---
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -120,9 +120,8 @@
}
catch (Throwable t)
{
- Object[] args = {t.getMessage()};
ApplicationMessage msg =
- new ApplicationMessage("UIApplication.msg.unknown-error", args,
ApplicationMessage.ERROR);
+ new ApplicationMessage("UIApplication.msg.unknown-error", null,
ApplicationMessage.ERROR);
uiPopupMessages_.addMessage(msg);
log.error("Error during the processAction phase", t);
}
Modified:
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponent.java
===================================================================
---
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -19,6 +19,7 @@
package org.exoplatform.webui.core;
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.resolver.ResourceResolver;
import org.exoplatform.services.log.ExoLogger;
@@ -27,7 +28,6 @@
import org.exoplatform.web.application.URLBuilder;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.webui.config.Component;
import org.exoplatform.webui.core.lifecycle.Lifecycle;
import org.exoplatform.webui.event.Event;
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -86,6 +86,8 @@
final static public String UI_COMPONENT_ACTION = "portal:action";
final static public String UI_COMPONENT_ID = "portal:componentId";
+
+ final static public String TARGET_NODE = "portal:targetNode";
final static public String CACHE_LEVEL = "portal:cacheLevel";
@@ -142,7 +144,7 @@
* then keep it in following properties of PortalRequestContext :<br/>
* 1. <code>requestURI</code> : The decoded URI of this request
<br/>
* 2. <code>portalOwner</code> : The portal name ( "classic" for
instance )<br/>
- * 3. <code>portalURI</code> : The URI to current portal (
"/portal/classic/ for instance )<br/>
+ * 3. <code>portalURI</code> : The URI to current portal (
"/portal/public/classic/ for instance )<br/>
* 4. <code>nodePath</code> : The path that is used to reflect to a
navigation node
*
* @param app an instance of {@link PortalApplication}
@@ -281,29 +283,38 @@
}
/**
+ *
+ *
* Process current Portal Request URI. if current require uri is not equal to last one
then
* an event of type UIPortalApplication.CHANGE_NODE will be retuned, otherwise it
returns <code>null</code>
*
* @return
* @throws Exception
*/
- public Event<UIComponent> processPortalURI() throws Exception
+ public Event<UIComponent> lookChangeNodeEvent() throws Exception
{
UIPortalApplication uiPortalApp = (UIPortalApplication)uiApplication_;
List<PageNavigation> navigations = uiPortalApp.getNavigations();
String lastNodePath = uiPortalApp.getLastNodePath();
-
+ String nodePath;
// Do not need to process if the request uri is not changed from last one
+ // Or look if this is a change node event in Ajax
if(nodePath_.equals(lastNodePath))
{
- // Should set the last navi & node to this instance of PortalRequestContext
to be used subsequently
- return null;
+ nodePath = request_.getParameter(PortalRequestContext.TARGET_NODE);
+ if (nodePath == null)
+ {
+ return null;
+ }
}
+ else
+ {
+ uiPortalApp.setLastNodePath(nodePath_);
+ nodePath = nodePath_;
+ }
- uiPortalApp.setLastNodePath(nodePath_);
-
- Object[] targets = Util.findBestMatchNavigationAndNode(navigations, nodePath_);
+ Object[] targets = Util.findBestMatchNavigationAndNode(navigations, nodePath);
if(targets == null)
{
targetNav = navigations.get(0);
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -109,11 +109,10 @@
{
uiApp.processDecode(context);
- Event<UIComponent> changeNodeEvent = context.processPortalURI();
+ Event<UIComponent> changeNodeEvent = context.lookChangeNodeEvent();
if(changeNodeEvent != null)
{
changeNodeEvent.broadcast();
- System.out.println("\nLoading node : " + context.getTargetNav()
+ "==>" + context.getTargetNode().getUri() + "\n");
}
}
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -19,11 +19,16 @@
package org.exoplatform.portal.url;
+import org.exoplatform.Constants;
import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.web.application.Parameter;
import org.exoplatform.web.url.ResourceLocator;
import org.exoplatform.web.url.ResourceURL;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -32,6 +37,8 @@
public class PortalURL<R, L extends ResourceLocator<R>> extends
ResourceURL<R, L>
{
+ private List<Parameter> params;
+
/** . */
private final PortalRequestContext requestContext;
@@ -49,32 +56,91 @@
this.requestContext = requestContext;
}
- public String toString()
+ public PortalURL<R, L> addParameters(Parameter... param)
{
- if (locator.getResource() == null)
+ if (params == null)
{
- throw new IllegalStateException("No resource set of the portal URL");
+ params = new ArrayList<Parameter>();
}
+ params.addAll(Arrays.asList(param));
+ return this;
+ }
- //
- StringBuilder sb = new StringBuilder();
+ public PortalURL<R, L> setParameters(Parameter... param)
+ {
+ params = (param != null) ? Arrays.asList(param) : null;
+ return this;
+ }
+ public Parameter[] getParameters()
+ {
+ return (Parameter[])params.toArray();
+ }
+
+ public String toString()
+ {
//
- sb.append(requestContext.getPortalURI());
+ StringBuilder url = new StringBuilder();
- //
- try
+ if (ajax)
{
- locator.append(sb);
+ url.append(requestContext.getRequestURI());
}
- catch (IOException e)
+ else
{
- AssertionError ae = new AssertionError();
- ae.initCause(e);
- throw ae;
+ if (locator.getResource() == null)
+ {
+ throw new IllegalStateException("No resource set of the portal
URL");
+ }
+
+ //
+ url.append(requestContext.getPortalURI());
+
+ //
+ try
+ {
+ locator.append(url);
+ }
+ catch (IOException e)
+ {
+ AssertionError ae = new AssertionError();
+ ae.initCause(e);
+ throw ae;
+ }
}
- //
- return sb.toString();
+ if (ajax || params != null)
+ {
+ url.append("?");
+ boolean addedAmpersand = false;
+
+ if (params != null)
+ {
+ for (Parameter param : params)
+ {
+ if (addedAmpersand)
+ {
+ url.append(Constants.AMPERSAND);
+ }
+
url.append(param.getName()).append("=").append(param.getValue());
+ addedAmpersand = true;
+ }
+ }
+
+ if (ajax)
+ {
+ if (addedAmpersand)
+ {
+ url.append(Constants.AMPERSAND);
+ }
+ url.append("ajaxRequest=true");
+
+ //adding the ajaxGet javascript function to handle the response
+ url.insert(0, "javascript:ajaxGet('");
+ url.append("')");
+ }
+ }
+
+ return url.toString();
}
}
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -129,6 +129,8 @@
}
}
uiPortal.refreshUIPage();
+ pcontext.setFullRender(true);
+
pcontext.addUIComponentToUpdateByAjax(uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID));
}
}
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PageNodeEvent.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PageNodeEvent.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PageNodeEvent.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.webui.portal;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
@@ -35,36 +33,14 @@
private String targetNodeUri;
- private PageNavigation navi;
-
- private PageNode pageNode;
-
public PageNodeEvent(T source, String name, String targetNodeUri)
{
super(source, name, null);
this.targetNodeUri = targetNodeUri;
}
-
- public PageNodeEvent(T source, String name, PageNavigation targetNavi, PageNode
_pageNode)
- {
- super(source, name, null);
- this.navi = targetNavi;
- this.pageNode = _pageNode;
- this.targetNodeUri = _pageNode.getUri();
- }
public String getTargetNodeUri()
{
return targetNodeUri;
}
-
- public PageNavigation getNavigation()
- {
- return navi;
- }
-
- public PageNode getPageNode()
- {
- return pageNode;
- }
}
\ No newline at end of file
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
---
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -53,6 +53,7 @@
import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.core.UIPopupMessages;
import org.exoplatform.webui.core.UITabPane;
import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.event.Event;
@@ -678,7 +679,7 @@
PortalRequestContext pContext = Util.getPortalRequestContext();
if (page.getStorageId() != null && portalConfigService.getPage(pageId)
== null)
{
- uiPortalApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{pageId}, 1));
+ uiPortalApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[]{pageId},
ApplicationMessage.WARNING));
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
pContext.setFullRender(true);
@@ -739,10 +740,7 @@
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
pContext.setFullRender(true);
- PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
(uiPortal.getSelectedNode() != null
- ? uiPortal.getSelectedNode().getUri() : null));
- uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
+ pContext.addUIComponentToUpdateByAjax(uiWorkingWS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
}
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-09-09
11:17:22 UTC (rev 4122)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-09-09
11:32:15 UTC (rev 4123)
@@ -38,6 +38,7 @@
import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import org.exoplatform.portal.webui.page.UIPageActionListener.ChangeNodeActionListener;
import org.exoplatform.portal.webui.page.UISiteBody;
+import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
@@ -57,6 +58,8 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIComponentDecorator;
import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
import java.io.Writer;
import java.util.ArrayList;