Author: mpodolin
Date: 2010-04-07 09:29:49 -0400 (Wed, 07 Apr 2010)
New Revision: 2525
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
Log:
JBEPP-286: GTNPORTAL-1020 ported to the branch
Modified:
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl
===================================================================
---
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2010-04-07
12:16:12 UTC (rev 2524)
+++
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortalComposer.gtmpl 2010-04-07
13:29:49 UTC (rev 2525)
@@ -15,13 +15,15 @@
<div class="<%=uicomponent.isCollapsed ? "CollapseIcon" :
"ExpandIcon"%>"
onclick="eXo.portal.UIPortal.toggleComposer(this)"><span></span></div>
<% if(uicomponent.isShowControl) { %>
<a class="CloseButton"
title="<%=_ctx.appRes("word.abort")%>"
href="<%=uicomponent.event("Abort")%>"><span></span></a>
- <a class="<%= isEditted ? "EdittedSaveButton" :
"SaveButton" %>"
title="<%=_ctx.appRes("word.finish")%>"
href="<%=uicomponent.event("Finish")%>"><span></span></a>
<% if (uicomponent.isUsedInWizard()) { %>
+ <a class="<%= isEditted ? "EdittedSaveButton" :
"SaveButton" %>"
title="<%=_ctx.appRes("word.finish")%>"
href="<%=uicomponent.url("Finish")%>"><span></span></a>
<a class="BackButton""
title="<%=_ctx.appRes("word.back")%>"
href="<%=uicomponent.event("Back")%>">
<span></span>
</a>
- <% } %>
- <% } %>
+ <% } else {%>
+ <a class="<%= isEditted ? "EdittedSaveButton" :
"SaveButton" %>"
title="<%=_ctx.appRes("word.finish")%>"
href="<%=uicomponent.event("Finish")%>"><span></span></a>
+ <% }
+ } %>
<div class="PopupTitle"><%=_ctx.appRes(popupId +
".title."+ popupId)%></div>
</div>
</div>
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2010-04-07
12:16:12 UTC (rev 2524)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2010-04-07
13:29:49 UTC (rev 2525)
@@ -76,40 +76,12 @@
public void setPageBody(PageNode pageNode, UIPortal uiPortal) throws Exception
{
WebuiRequestContext context = Util.getPortalRequestContext();
- ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService userPortalConfigService =
-
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
- Page page = null;
- UIPage uiPage;
-
- String pageReference = null;
-
- if (pageNode != null)
- {
- pageReference = pageNode.getPageReference();
- try
- {
- if (pageReference != null)
- {
- page = userPortalConfigService.getPage(pageReference,
context.getRemoteUser());
- }
- }
- catch (Exception e)
- {
- UIPortalApplication uiApp = getAncestorOfType(UIPortalApplication.class);
- uiApp.addMessage(new ApplicationMessage(e.getMessage(), new Object[]{}));
- }
- }
-
uiPortal.setMaximizedUIComponent(null);
- try
+ UIPage uiPage;
+ uiPage = getUIPage(pageNode, uiPortal, context);
+ if (uiPage == null)
{
- uiPage = getUIPage(pageReference, page, uiPortal, context);
- }
- catch (Exception ex)
- {
- // TODO: Print evokable message
setUIComponent(null);
return;
}
@@ -142,15 +114,30 @@
* @param uiPortal
* @return
*/
- private UIPage getUIPage(String pageReference, Page page, UIPortal uiPortal,
WebuiRequestContext context)
+ private UIPage getUIPage(PageNode pageNode, UIPortal uiPortal, WebuiRequestContext
context)
throws Exception
{
+ Page page = null;
+ String pageReference = null;
+
+ if (pageNode != null)
+ {
+ pageReference = pageNode.getPageReference();
+ if (pageReference != null)
+ {
+ ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
+ UserPortalConfigService userPortalConfigService =
+
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
+ page = userPortalConfigService.getPage(pageReference,
context.getRemoteUser());
+ }
+ }
+
//The page has been deleted
if(page == null)
{
//Clear the UIPage from cache in UIPortal
uiPortal.clearUIPage(pageReference);
- throw new Exception("The page with id " + pageReference + " has
been removed");
+ return null;
}
UIPage uiPage = uiPortal.getUIPage(pageReference);
@@ -173,11 +160,6 @@
return uiPage;
}
- public void renderChildren() throws Exception
- {
-
uicomponent_.processRender((WebuiRequestContext)WebuiRequestContext.getCurrentInstance());
- }
-
public void processRender(WebuiRequestContext context) throws Exception
{
if (maximizedUIComponent != null &&
Util.getUIPortalApplication().getModeState() % 2 == 0)
@@ -186,11 +168,6 @@
return;
}
- //TODO: Remove beneath block
- if (uicomponent_ == null)
- {
- setPageBody(Util.getUIPortal().getSelectedNode(), Util.getUIPortal());
- }
super.processRender(context);
}
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2010-04-07
12:16:12 UTC (rev 2524)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2010-04-07
13:29:49 UTC (rev 2525)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.webui.page;
+import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
@@ -85,7 +86,7 @@
{
UIPagePreview uiPagePreview = getChild(UIPagePreview.class);
UIPage uiPage = (UIPage)uiPagePreview.getUIComponent();
- UIPortal uiPortal = Util.getUIPortal();
+
UIWizardPageSetInfo uiPageInfo = getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
@@ -116,9 +117,8 @@
DataStorage dataService = getApplicationComponent(DataStorage.class);
dataService.create(page);
dataService.save(pageNav);
+ UIPortal uiPortal = Util.getUIPortal();
setNavigation(uiPortal.getNavigations(), uiNodeSelector.getSelectedNavigation());
- PageNodeEvent<UIPortal> pnevent = new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, pageNode.getUri());
- uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
}
private void setNavigation(List<PageNavigation> navs, PageNavigation nav)
@@ -342,7 +342,11 @@
if (isDesktopPage)
{
uiWizard.saveData();
- uiWizard.updateUIPortal(uiPortalApp, event);
+ PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
+ UIPortal uiPortal = Util.getUIPortal();
+ PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
selectedNode.getUri());
+ uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
+ uiWizard.updateUIPortal(event);
return;
}
@@ -372,17 +376,14 @@
uiWizard.saveData();
UIPortalToolPanel toolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
toolPanel.setUIComponent(null);
- uiWizard.updateUIPortal(uiPortalApp, event);
- JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
- jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
-
+ uiWizard.updateUIPortal(event);
UIWizardPageSetInfo uiPageInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector =
uiPageInfo.getChild(UIPageNodeSelector.class);
PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
-
- String uri = Util.getPortalRequestContext().getPortalURI() +
selectedNode.getUri();
- //Util.getPortalRequestContext().sendRedirect(uri);
- jsManager.addJavascript("window.location = '" + uri +
"';");
+
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
+ String uri = pcontext.getPortalURI() + selectedNode.getUri();
+ pcontext.getResponse().sendRedirect(uri);
}
}
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2010-04-07
12:16:12 UTC (rev 2524)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2010-04-07
13:29:49 UTC (rev 2525)
@@ -94,7 +94,7 @@
return uiHelpWindow;
}
- void updateUIPortal(UIPortalApplication uiPortalApp, Event<? extends
UIPageWizard> event) throws Exception
+ protected void updateUIPortal(Event<? extends UIPageWizard> event) throws
Exception
{
PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
---
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-04-07
12:16:12 UTC (rev 2524)
+++
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-04-07
13:29:49 UTC (rev 2525)
@@ -199,6 +199,12 @@
return listNavs;
}
+ /**
+ * Return cached UIPage associated to the specified pageReference
+ *
+ * @param pageReference key whose associated UIPage is to be returned
+ * @return the UIPage associated to the specified pageReference or null if not any
+ */
public UIPage getUIPage(String pageReference)
{
if(all_UIPages == null)