[jboss-svn-commits] JBoss Portal SVN: r5346 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/controller/command core/src/main/org/jboss/portal/core/portlet/catalog core/src/resources/portal-core-sar/META-INF core/src/resources/portal-core-sar/conf core/src/resources/portal-core-sar/conf/bundles core/src/resources/portal-core-sar/conf/data core/src/resources/portal-core-war/WEB-INF core/src/resources/portal-core-war/WEB-INF/classes core/src/resources/portal-samples-war/WEB-INF theme/src/main/org/jboss/portal/theme
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 6 18:57:22 EDT 2006
Author: julien at jboss.com
Date: 2006-10-06 18:57:10 -0400 (Fri, 06 Oct 2006)
New Revision: 5346
Added:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java
trunk/core/src/resources/portal-core-sar/conf/bundles/
trunk/core/src/resources/portal-core-sar/conf/bundles/Resource.properties
trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_en.properties
trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_es.properties
trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_fr.properties
Removed:
trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java
trunk/core/src/main/org/jboss/portal/core/portlet/catalog/NavigationPortlet.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties
trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
trunk/core/src/resources/portal-samples-war/WEB-INF/default-object.xml
trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java
Log:
better handling on portlet on every page
Added: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-10-06 22:57:10 UTC (rev 5346)
@@ -0,0 +1,242 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.portal.core.aspects.controller;
+
+import org.jboss.portal.core.controller.ControllerInterceptor;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.command.RenderPageCommand;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
+import org.jboss.portal.core.api.Navigation;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
+import org.jboss.portal.theme.PageRendition;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.page.WindowResult;
+import org.jboss.portal.theme.page.ModifiableWindowResult;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
+
+import javax.portlet.PortletURL;
+import java.util.Collections;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PageCustomizerInterceptor extends ControllerInterceptor
+{
+
+ /** . */
+ private static final String RESOURCE_PREFIX = "PAGENAME_";
+
+ private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
+
+ public PortalAuthorizationManagerFactory getPortalAuthorizationManagerFactory()
+ {
+ return portalAuthorizationManagerFactory;
+ }
+
+ public void setPortalAuthorizationManagerFactory(PortalAuthorizationManagerFactory portalAuthorizationManagerFactory)
+ {
+ this.portalAuthorizationManagerFactory = portalAuthorizationManagerFactory;
+ }
+
+ public void invoke(ControllerCommand cmd) throws Exception
+ {
+ cmd.invokeNext();
+
+ // Insert navigation portlet in the page
+ if (cmd instanceof RenderPageCommand)
+ {
+ RenderPageCommand rpc = (RenderPageCommand)cmd;
+ PageRendition rendition = rpc.getResult();
+ if (rendition != null)
+ {
+ StringBuffer tabbedNav = injectTabbedNav(rpc);
+ if (tabbedNav != null)
+ {
+ Map windowProps = new HashMap();
+ windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
+ WindowResult res = new ModifiableWindowResult("", tabbedNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowContext blah = new WindowContext("BLAH", "BLAH", "navigation", 0);
+ rendition.getPageResult().addWindowContext(blah);
+ rendition.getPageResult().addWindowResult("BLAH", res);
+ }
+
+ StringBuffer dashboardNav = injectDashboardNav(rpc);
+ if (dashboardNav != null)
+ {
+ Map windowProps = new HashMap();
+ windowProps.put(ThemeConstants.PORTAL_PROP_WINDOW_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_DECORATION_RENDERER, "emptyRenderer");
+ windowProps.put(ThemeConstants.PORTAL_PROP_PORTLET_RENDERER, "emptyRenderer");
+ WindowResult res = new ModifiableWindowResult("", dashboardNav.toString(), Collections.EMPTY_MAP, windowProps, null, null, WindowState.NORMAL, Mode.VIEW);
+ WindowContext bluh = new WindowContext("BLUH", "BLUH", "dashboardnav", 0);
+ rendition.getPageResult().addWindowContext(bluh);
+ rendition.getPageResult().addWindowResult("BLUH", res);
+ }
+ }
+ }
+ }
+
+ public StringBuffer injectDashboardNav(RenderPageCommand rpc)
+ {
+ StringBuffer sb = new StringBuffer();
+ if(rpc.getControllerContext().getServerInvocation().getServerContext().getClientRequest().getRemoteUser() == null)
+ {
+ Page page = rpc.getPage();
+ URLContext ctx = rpc.getControllerContext().getServerInvocation().getServerContext().getURLContext();
+ ctx = URLContext.newInstance(ctx.getSecure(), true);
+ String loginURL = rpc.getControllerContext().encodeURL(rpc, ctx, null);
+ sb.append("<a href=\"").append(loginURL).append("\">Login</a>");
+ }
+ else
+ {
+ // TODO: add checks for shared/private pages
+ String logoutURL = "BLAH";
+
+ //sb.append("<a href=\"#\" class=\"addcontent\">Add Content</a>");
+
+ User user = (User)rpc.getControllerContext().getServerInvocation().getRequest().getUser();
+ if (user != null)
+ {
+ sb.append("Logged in as: ").append(user.getUserName());
+ }
+ else
+ {
+ sb.append("Logged in");
+ }
+ sb.append("<br/><br/>");
+
+ sb.append("<a href=\"#\">Add Content</a>");
+ sb.append(" | ");
+ sb.append("<a href=\"#\">Edit Page</a>");
+ sb.append(" | ");
+ sb.append("<a href=\"#\">Add Page</a>");
+ sb.append(" | ");
+ sb.append("<a href=\"").append(logoutURL).append("\">Logout</a>");
+
+ }
+ return sb;
+ }
+
+ public StringBuffer injectTabbedNav(RenderPageCommand rpc)
+ {
+ try
+ {
+ Page page = rpc.getPage();
+
+ // Now build the list
+ List navElements = new ArrayList();
+ for(Iterator iterator = page.getPortal().getChildren().iterator();iterator.hasNext();)
+ {
+ PortalObject child = (PortalObject) iterator.next();
+ if(child.getType() == PortalNode.TYPE_PAGE)
+ {
+ PortalObjectImpl portalObject = (PortalObjectImpl) child;
+ navElements.add(portalObject);
+ }
+ }
+
+ // order tabs as per preference setting
+// String sOrdering = req.getPreferences().getValue("ordering", "default");
+// if(sOrdering.equalsIgnoreCase("explicit"))
+// {
+// String sOrderList = req.getPreferences().getValue("explicitlist", "");
+// if(!sOrderList.equals(""))
+// {
+// sortTabsExplicit(navElements, sOrderList.split(","));
+// }
+// else
+// {
+// sortTabs(navElements);
+// }
+// }
+// else
+// {
+// sortTabs(navElements);
+// }
+
+ StringBuffer html = new StringBuffer();
+ html.append("<ul id=\"tabsHeader\">");
+ for(Iterator i = navElements.iterator(); i.hasNext();)
+ {
+ PortalObjectImpl navElement = (PortalObjectImpl) i.next();
+
+ // build up Marks markup for the navigation , based on these nodes
+ String name = navElement.getName();
+
+ try
+ {
+ // localize node name
+ Locale requestLocale = rpc.getControllerContext().getServerInvocation().getRequest().getLocale();
+ ResourceBundle rb = ResourceBundle.getBundle("conf.bundles.Resource", requestLocale, Thread.currentThread().getContextClassLoader());
+ name = rb.getString(RESOURCE_PREFIX + name);
+ }
+ catch (MissingResourceException e)
+ {
+ e.printStackTrace();
+ }
+
+ String id = navElement.getId();
+ PortalObjectPermission perm = new PortalObjectPermission(id, PortalObjectPermission.VIEW_MASK);
+ if(portalAuthorizationManagerFactory.getManager().checkPermission(perm))
+ {
+ RenderPageCommand cmd = new RenderPageCommand(navElement.getId());
+ String childURL = rpc.getControllerContext().encodeURL(cmd, null, null);
+ html.append("<li");
+ // if we were able to detect the selected node in the hierarchie level of the nav elements,
+ // then flag the node so the css can style it as the selected one
+ if(page == navElement)
+ {
+ html.append(" id=\"current\"");
+ }
+ html.append(" onmouseover=\"this.className='hoverOn'\" onmouseout=\"this.className='hoverOff'\"><a href='").append(childURL).append("'>").append(name).append("</a></li>");
+ }
+ }
+ html.append("</ul>");
+ return html;
+ }
+ catch(Exception e)
+ {
+ log.error("", e);
+ return null;
+ }
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/PageCommand.java 2006-10-06 22:57:10 UTC (rev 5346)
@@ -0,0 +1,101 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.portal.core.controller.command;
+
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.controller.ResourceNotFoundException;
+import org.jboss.portal.core.controller.ControllerException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class PageCommand extends PortalObjectCommand
+{
+
+ /** . */
+ protected final String pageRef;
+
+ /** . */
+ protected Portal portal;
+
+ /** . */
+ protected Page page;
+
+ public PageCommand(String pageRef)
+ {
+ if (pageRef == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.pageRef = pageRef;
+ }
+
+ /**
+ * Get the identifier of the requeste page
+ *
+ * @return the identifier of the requeste page
+ */
+ public String getPageRef()
+ {
+ return pageRef;
+ }
+
+ /**
+ * Get the requeste page
+ *
+ * @return the requested page
+ */
+ public Page getPage()
+ {
+ return page;
+ }
+
+ public PortalObject getTarget()
+ {
+ return page;
+ }
+
+ /**
+ * Initialize the command
+ *
+ * @throws org.jboss.portal.common.invocation.InvocationException
+ */
+ public void create() throws ControllerException
+ {
+ // Get page
+ page = (Page)context.getController().getPortalObjectContainer().getObject(pageRef);
+ if (page == null)
+ {
+ throw new ResourceNotFoundException(pageRef);
+ }
+
+ // Get nearest portal ancestor
+ portal = page.getPortal();
+ if (portal == null)
+ {
+ throw new ResourceNotFoundException("Portal for " + pageRef);
+ }
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-10-06 22:57:10 UTC (rev 5346)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.util.Exceptions;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.instance.Instance;
@@ -90,7 +89,7 @@
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public final class RenderPageCommand extends PortalObjectCommand
+public final class RenderPageCommand extends PageCommand
{
/** . */
@@ -117,16 +116,10 @@
/** . */
private static final CommandInfo info = new ViewCommandInfo(false, "view");
- /** . */
- private final String pageRef;
+ /** The windows to render. */
+ private Collection windows;
/** . */
- private Portal portal;
-
- /** . */
- private Page page;
-
- /** . */
private PortalLayout layout;
/** . */
@@ -137,67 +130,10 @@
public RenderPageCommand(String pageRef)
{
- if (pageRef == null)
- {
- throw new IllegalArgumentException();
- }
- this.pageRef = pageRef;
+ super(pageRef);
}
/**
- * Call the component invocation(s) to create the markup fragment(s) for this request
- * Call the component / portlet invocation for each window on the page, and create a markup result with the resulting markup fragments in it
- *
- * @param cfg the server configuration to get access to customizable error behaviour
- * @param navCtx the navigational state context to access page and window navigational state
- * @return a modifiable page result containing the markup fragments from the individual portlets on this page
- * @throws InvocationException
- */
- public MarkupResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws ControllerException
- {
- PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
- ModifiablePageResult pageResult = new ModifiablePageResult(getPage().getName(), getPage().getDeclaredProperties(), getPage().getPortal().getDeclaredProperties());
-
- // all windows on the page
- Collection windows = getPage().getChildren();
-
- // Render
- for (Iterator i = windows.iterator(); i.hasNext();)
- {
- PortalObject o = (PortalObject)i.next();
-
- // Render only window children
- if (o instanceof Window)
- {
- Window window = (Window)o;
-
- // That are visible ?
- if (pageNavState.isWindowVisible(window.getId()))
- {
- MarkupResult result = renderPortletWindow(cfg, window);
- if (result != null)
- {
- pageResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
- pageResult.addWindowResult(window.getId(), (WindowResult)result);
- }
- }
- }
- }
-
- return pageResult;
- }
-
- /**
- * for security checks and navigational state, return the page of the requested MarkupContainer
- *
- * @return the requested page (or the page of the requested region or window)
- */
- public PortalObject getTarget()
- {
- return page;
- }
-
- /**
* Get the command info (runtime info about the command)
*
* @return info about the command
@@ -208,40 +144,35 @@
}
/**
- * Get the identifier of the requeste page
+ * Get the layout that was determined for this request (based on portal and page properties)
*
- * @return the identifier of the requeste page
+ * @return the layout to use for this request
*/
- public String getPageRef()
+ public PortalLayout getLayout()
{
- return pageRef;
+ return layout;
}
/**
- * Get the requeste page
+ * Returns the result.
*
- * @return the requested page
+ * @return the result
*/
- public Page getPage()
+ public PageRendition getResult()
{
- return page;
+ return result;
}
/**
- * Get the layout that was determined for this request (based on portal and page properties)
+ * Returns the modifiable list of windows.
*
- * @return the layout to use for this request
+ * @return the windows on the page
*/
- public PortalLayout getLayout()
+ public Collection getWindows()
{
- return layout;
+ return windows;
}
- public PageRendition getResult()
- {
- return result;
- }
-
/**
* initialize the command
*
@@ -249,19 +180,10 @@
*/
public void create() throws ControllerException
{
- // Get page
- page = (Page)context.getController().getPortalObjectContainer().getObject(pageRef);
- if (page == null)
- {
- throw new ResourceNotFoundException(pageRef);
- }
+ super.create();
- // Get nearest portal ancestor
- portal = page.getPortal();
- if (portal == null)
- {
- throw new ResourceNotFoundException("Portal for " + pageRef);
- }
+ // All windows on the page
+ windows = new ArrayList(getPage().getChildren());
//
LayoutService layoutService = context.getController().getPageService().getLayoutService();
@@ -326,15 +248,13 @@
// Call the portlet container to create the markup fragment(s) for each portlet that needs to render itself
ServerConfig cfg = sinv.getRequest().getServer().getConfig();
- MarkupResult renderResult = renderFragments(cfg, navCtx);
+ ModifiablePageResult renderResult = renderFragments(cfg, navCtx);
// Make the theme available as servlet request attribute (needed for CM)
if(theme != null)
{
// render the theme markup and place it into the request so that the markup assembler (theme tag) can pick it up there
ThemeResult themeResult = theme.assembleResponse(sinv.getRequest(), sinv.getResponse());
-// request.setAttribute(ThemeConstants.ATTR_THEMERESULT, themeResult);
-// request.setAttribute(ThemeConstants.ATTR_THEME, theme);
renderResult.setTheme(theme);
renderResult.setThemeResult(themeResult);
@@ -354,6 +274,47 @@
}
}
+ /**
+ * Call the component invocation(s) to create the markup fragment(s) for this request
+ * Call the component / portlet invocation for each window on the page, and create a markup result with the resulting markup fragments in it
+ *
+ * @param cfg the server configuration to get access to customizable error behaviour
+ * @param navCtx the navigational state context to access page and window navigational state
+ * @return a modifiable page result containing the markup fragments from the individual portlets on this page
+ * @throws InvocationException
+ */
+ private ModifiablePageResult renderFragments(ServerConfig cfg, AttributeResolver navCtx) throws ControllerException
+ {
+ PageNavigationalState pageNavState = (PageNavigationalState)navCtx.getAttribute(getPage().getId());
+ ModifiablePageResult pageResult = new ModifiablePageResult(getPage().getName(), getPage().getDeclaredProperties(), getPage().getPortal().getDeclaredProperties());
+
+ // Render
+ for (Iterator i = windows.iterator(); i.hasNext();)
+ {
+ PortalObject o = (PortalObject)i.next();
+
+ // Render only window children
+ if (o instanceof Window)
+ {
+ Window window = (Window)o;
+
+ // That are visible ?
+ if (pageNavState.isWindowVisible(window.getId()))
+ {
+ MarkupResult result = renderPortletWindow(cfg, window);
+ if (result != null)
+ {
+ pageResult.addWindowContext(pageNavState.getWindowContext(window.getId()));
+ pageResult.addWindowResult(window.getId(), (WindowResult)result);
+ }
+ }
+ }
+ }
+
+ return pageResult;
+ }
+
+
private PortalTheme getTheme(String themeIdString)
{
//
@@ -392,7 +353,7 @@
}
//
- PortalLayout layout = null;
+ PortalLayout layout;
if (layoutIDString.lastIndexOf(".") > 0)
{
// if the id is provided in the form of context.name then look up the layout via a registration id
Deleted: trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/catalog/DashboardNavPortlet.java 2006-10-06 22:57:10 UTC (rev 5346)
@@ -1,107 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* 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.jboss.portal.core.portlet.catalog;
-
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.core.api.Navigation;
-import org.jboss.portlet.JBossActionRequest;
-import org.jboss.portlet.JBossActionResponse;
-import org.jboss.portlet.JBossPortlet;
-import org.jboss.portlet.JBossRenderRequest;
-import org.jboss.portlet.JBossRenderResponse;
-
-import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:roy at jboss.org">Roy Russo</a>
- */
-
-public class DashboardNavPortlet extends JBossPortlet
-{
- public void init() throws PortletException
- {
- }
-
- /**
- * Renders dashboard-related links
- *
- * @param renderRequest
- * @param renderResponse
- * @throws IOException
- * @throws PortletException
- */
- public void doView(JBossRenderRequest renderRequest, JBossRenderResponse renderResponse) throws IOException, PortletException
- {
- renderResponse.setContentType("text/html");
- StringBuffer sb = new StringBuffer();
- PrintWriter writer = renderResponse.getWriter();
- if(renderRequest.getUser() == null)
- {
- PortalNode currentNode = Navigation.getCurrentNode();
- PortalNodeURL loginURL = renderResponse.createRenderURL(currentNode);
- loginURL.setAuthenticated(Boolean.TRUE);
- sb.append("<a href=\"").append(loginURL).append("\">Login</a>");
- }
- else
- {
- // TODO: add checks for shared/private pages
- PortletURL logoutURL = renderResponse.createActionURL();
- logoutURL.setParameter("op", "userLogout");
-
- //sb.append("<a href=\"#\" class=\"addcontent\">Add Content</a>");
- sb.append("Logged in as: ").append(renderRequest.getUser().getUserName());
- sb.append("<br/><br/>");
- sb.append("<a href=\"#\">Add Content</a>");
- sb.append(" | ");
- sb.append("<a href=\"#\">Edit Page</a>");
- sb.append(" | ");
- sb.append("<a href=\"#\">Add Page</a>");
- sb.append(" | ");
- sb.append("<a href=\"").append(logoutURL).append("\">Logout</a>");
-
- }
- writer.write(sb.toString());
- }
-
- /**
- * @param req
- * @param resp
- * @throws IOException
- */
- public void userLogout(JBossActionRequest req, JBossActionResponse resp) throws IOException
- {
- String locationURL = req.getParameter("locationURL");
- if(locationURL != null)
- {
- resp.signOut(locationURL);
- }
- else
- {
- resp.signOut();
- }
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/portlet/catalog/NavigationPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/catalog/NavigationPortlet.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/catalog/NavigationPortlet.java 2006-10-06 22:57:10 UTC (rev 5346)
@@ -1,360 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* 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.jboss.portal.core.portlet.catalog;
-
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.core.api.JBossPortalNode;
-import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
-import org.jboss.portal.core.model.portal.Context;
-import org.jboss.portal.core.model.portal.Page;
-import org.jboss.portal.core.model.portal.Portal;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalObjectPermission;
-import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
-import org.jboss.portlet.JBossPortlet;
-import org.jboss.portlet.JBossRenderRequest;
-import org.jboss.portlet.JBossRenderResponse;
-
-import javax.portlet.PortletException;
-import javax.portlet.PortletPreferences;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
- * @version $Revision$
- */
-public class NavigationPortlet extends JBossPortlet
-{
-
- private PortalObjectContainer container;
- private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
-
- /**
- * Prepender to resource bundle lookup for page names.
- */
- private static final String RESOURCE_PREFIX = "PAGENAME_";
-
- public void init() throws PortletException
- {
- container = (PortalObjectContainer) getPortletContext().getAttribute("PortalObjectContainer");
- portalAuthorizationManagerFactory = (PortalAuthorizationManagerFactory) getPortletContext().getAttribute("PortalAuthorizationManagerFactory");
- if(container == null)
- {
- throw new PortletException("No portal object container");
- }
- }
-
- public void destroy()
- {
- super.destroy();
- container = null;
- portalAuthorizationManagerFactory = null;
- }
-
- public void render(JBossRenderRequest req, JBossRenderResponse resp) throws IOException, PortletException
- {
- resp.setContentType("text/html");
- resp.setTitle("Portals");
- try
- {
- PortletPreferences prefs = req.getPreferences();
- String rootLevel = prefs.getValue("navigation-root-level", "page");
- Context context = container.getContext();
- List navElements = new ArrayList();
-
- // get the list of portal nodes to display (portals or pages, based on preference)
- Iterator portalObjectIterator;
- if("page".equalsIgnoreCase(rootLevel))
- {
- // if the pages of the current portal are requested, then read up the hierarchie to the current portal, to
- // get the children from there (which are the pages to display)
- PortalNode current = req.getPortalNode();
- while(current != null && current.getType() != PortalNode.TYPE_PORTAL)
- {
- current = current.getParent();
- }
- if(current != null && current.getType() == PortalNode.TYPE_PORTAL)
- {
- PortalObject root = context.getChild(current.getName());
- portalObjectIterator = root.getChildren().iterator();
- }
- else
- {
- throw new PortletException("the current node has no parent of type 'portal'");
- }
- }
- else
- {
- // ok, we are to display portals then; they are the children of the container root
- portalObjectIterator = context.getChildren().iterator();
- }
- // now build the list
- while(portalObjectIterator.hasNext())
- {
- PortalObject child = (PortalObject) portalObjectIterator.next();
- if(child.getType() == PortalNode.TYPE_PAGE ||
- child.getType() == PortalNode.TYPE_PORTAL)
- {
- PortalObjectImpl portalObject = (PortalObjectImpl) child;
- if(allowed(portalObject.getPortalNode(), child.getType()))
- {
- navElements.add(portalObject);
- }
- }
- }
-
- // order tabs as per preference setting
- String sOrdering = req.getPreferences().getValue("ordering", "default");
- if(sOrdering.equalsIgnoreCase("explicit"))
- {
- String sOrderList = req.getPreferences().getValue("explicitlist", "");
- if(!sOrderList.equals(""))
- {
- sortTabsExplicit(navElements, sOrderList.split(","));
- }
- else
- {
- sortTabs(navElements);
- }
- }
- else
- {
- sortTabs(navElements);
- }
-
- // find the selected item in the level that was selected to be the root
- // from the current portal node walk up the hierarchie until the node type matches
- // that of the nav elements; if there is a match, hold on to it to mark the selected item later on
- PortalNode selectedNode = null;
- if(navElements.size() > 0)
- {
- PortalObject first = (PortalObject) navElements.get(0);
- int navElementType = first.getType();
- PortalNode current = req.getPortalNode();
- while(current != null && current.getType() != navElementType)
- {
- current = current.getParent();
- }
-
- // now read up the hierarchie within the same node type until the type changes, to find the top level node of that type
- if(current.getParent() != null)
- {
- PortalNode sameTypeLevelUp = current;
- while(sameTypeLevelUp != null && sameTypeLevelUp.getType() == current.getType())
- {
- current = sameTypeLevelUp;
- sameTypeLevelUp = current.getParent();
- }
- }
-
- if(current != null && current.getType() == navElementType)
- {
- selectedNode = current;
- }
- }
-
- StringBuffer html = new StringBuffer();
- html.append("<ul id=\"tabsHeader\">");
-
- for(Iterator i = navElements.iterator(); i.hasNext();)
- {
- PortalObjectImpl navElement = (PortalObjectImpl) i.next();
-
- // build up Marks markup for the navigation , based on these nodes
- String name = navElement.getName();
-
- // localize node name
- Locale requestLocale = req.getLocale();
- ResourceBundle bundle = getResourceBundle(requestLocale);
- name = bundle.getString(RESOURCE_PREFIX + name);
-
- JBossPortalNode urlNode = null;
- if(navElement instanceof Portal)
- {
- // get the default page node for this portal to get a valid URL from it
- Page defaultPage = ((Portal) navElement).getDefaultPage();
- if(defaultPage != null)
- {
- PortalObject node = navElement.getChild(defaultPage.getName());
- if(node instanceof PortalObjectImpl)
- {
- urlNode = ((PortalObjectImpl) node).getPortalNode();
- }
- }
- }
- else if(navElement instanceof Page)
- {
- urlNode = navElement.getPortalNode();
- }
-
- if(urlNode != null)
- {
- PortalNodeURL childURL = resp.createRenderURL(urlNode);
- html.append("<li");
- // if we were able to detect the selected node in the hierarchie level of the nav elements,
- // then flag the node so the css can style it as the selected one
- if(selectedNode != null && selectedNode.equals(navElement.getPortalNode()))
- {
- html.append(" id=\"current\"");
- }
- html.append(" onmouseover=\"this.className='hoverOn'\" onmouseout=\"this.className='hoverOff'\"><a href='").append(childURL).append("'>").append(name).append("</a></li>");
- }
- }
- html.append("</ul>");
- ///write it out
- resp.getWriter().write(html.toString());
- }
- catch(Exception e)
- {
- // todo: handle error case : write it out
- e.printStackTrace();
- }
-
- }
-
- private boolean allowed(JBossPortalNode node, int type) throws Exception
- {
- PortalObjectPermission perm = new PortalObjectPermission(node.getRef(), PortalObjectPermission.VIEW_MASK);
- return portalAuthorizationManagerFactory.getManager().checkPermission(perm);
- }
-
- private static int getOrder(Object o)
- {
- if(o instanceof Context)
- {
- return 0;
- }
- if(o instanceof Portal)
- {
- return 1;
- }
- if(o instanceof Page)
- {
- return 2;
- }
- if(o instanceof Window)
- {
- return 3;
- }
- return 4;
- }
-
- private void sortTabs(List navElements)
- {
- Collections.sort(navElements, new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- int high1 = getOrder(o1);
- int high2 = getOrder(o2);
- if(high1 == high2)
- {
- return ((PortalObject) o1).getName().compareTo(((PortalObject) o2).getName());
- }
- else
- {
- return high1 - high2;
- }
- }
- });
- }
-
- /**
- * For explicit ordering of tabs set in the portlet preferences.
- *
- * @param navElements
- * @param explicitOrder
- */
- private void sortTabsExplicit(List navElements, final String[] explicitOrder)
- {
- Collections.sort(navElements, new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- Float high1 = new Float(getExplicitOrder(o1));
- Float high2 = new Float(getExplicitOrder(o2));
- if(high1.equals(high2))
- {
- return ((PortalObject) o1).getName()
- .compareTo(((PortalObject) o2).getName());
- }
- else
- {
- return high1.compareTo(high2);
- }
- }
-
- private float getExplicitOrder(Object o)
- {
- if(o instanceof Context)
- {
- return 0;
- }
- if(o instanceof Portal)
- {
- return 1;
- }
- if(o instanceof Page)
- {
- String pagename = ((Page) o).getName();
- int order = 0;
- for(int i = 0; i < explicitOrder.length; i++)
- {
- if(pagename.equalsIgnoreCase(explicitOrder[i]))
- {
- order = i + 1;
- }
- }
-
- // get pagenum and ordernumber from explicitlist
- if(order == 0)
- {
- return 2.999f;
- }
- try
- {
- return Float.parseFloat("2." + order);
- }
- catch(NumberFormatException e)
- {
- return 2.999f;
- }
- }
- if(o instanceof Window)
- {
- return 3;
- }
- return 4;
- }
- });
- }
-}
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-10-06 22:57:10 UTC (rev 5346)
@@ -115,6 +115,16 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.aspects.controller.PageCustomizerInterceptor"
+ name="portal:service=Interceptor,type=Command,name=PageCustomizer"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="PortalAuthorizationManagerFactory"
+ proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
+ </mbean>
+ <mbean
code="org.jboss.portal.core.aspects.controller.PortalNodeInterceptor"
name="portal:service=Interceptor,type=Command,name=PortalNode"
xmbean-dd=""
@@ -127,7 +137,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="PortalAuthorizationManagerFactory" proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
+ <depends
+ optional-attribute-name="PortalAuthorizationManagerFactory"
+ proxy-type="attribute">portal:service=PortalAuthorizationManagerFactory</depends>
</mbean>
<mbean
code="org.jboss.portal.core.aspects.controller.EventBroadcasterInterceptor"
@@ -153,6 +165,7 @@
<depends-list-element>portal:service=Interceptor,type=Command,name=PortalNode</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Command,name=PolicyEnforcement</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Command,name=PageNavigation</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Command,name=PageCustomizer</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Command,name=EventBroadcaster</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Command,name=WindowCache</depends-list-element>
</depends-list>
Added: trunk/core/src/resources/portal-core-sar/conf/bundles/Resource.properties
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/bundles/Resource.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-sar/conf/bundles/Resource.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -0,0 +1,5 @@
+# Navigation Portlet
+PAGENAME_default=Home
+PAGENAME_Admin=Admin
+PAGENAME_Test=Test
+PAGENAME_News=News
\ No newline at end of file
Added: trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_en.properties
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_en.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_en.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -0,0 +1,5 @@
+# Navigation Portlet
+PAGENAME_default=Home
+PAGENAME_Admin=Admin
+PAGENAME_Test=Test
+PAGENAME_News=News
\ No newline at end of file
Added: trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_es.properties
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_es.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_es.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -0,0 +1,5 @@
+# Navigation Portlet
+PAGENAME_default=Home
+PAGENAME_Admin=Administración
+PAGENAME_Test=Ejemplos
+PAGENAME_News=Noticias
\ No newline at end of file
Added: trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_fr.properties
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_fr.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-sar/conf/bundles/Resource_fr.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -0,0 +1,5 @@
+# Navigation Portlet
+PAGENAME_default=Accueil
+PAGENAME_Admin=Admin
+PAGENAME_Test=Test
+PAGENAME_News=Actualités
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2006-10-06 22:57:10 UTC (rev 5346)
@@ -55,50 +55,6 @@
<page>
<page-name>default</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
- <window-name>DashboardNavPortletWindow</window-name>
- <instance-ref>DashboardNavPortletInstance</instance-ref>
- <region>dashboardnav</region>
- <height>0</height>
- <properties>
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>JSPPortletWindow</window-name>
<instance-ref>JSPPortletInstance</instance-ref>
<region>left</region>
@@ -155,30 +111,6 @@
<page>
<page-name>News</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>WeatherPortletWindow</window-name>
<instance-ref>WeatherPortletInstance</instance-ref>
<region>left</region>
@@ -210,30 +142,6 @@
<page>
<page-name>Admin</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>UserPortletWindow</window-name>
<instance-ref>UserPortletInstance</instance-ref>
<region>left</region>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -341,9 +341,4 @@
PERMISSION_DOMAIN_MOD=Modify Domain
PERMISSION_DEFINEDROLES=Defined roles
PERMISSION_IMPLIEDROLES=Implied roles
-
-# Navigation Portlet
-PAGENAME_default=Home
-PAGENAME_Admin=Admin
-PAGENAME_Test=Test
-PAGENAME_News=News
\ No newline at end of file
+
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -339,9 +339,4 @@
PERMISSION_MODIFYINGROLES=Modifying roles for
PERMISSION_DOMAIN=Domain
PERMISSION_DOMAIN_MOD=Modify Domain
-
-# Navigation Portlet
-PAGENAME_default=Home
-PAGENAME_Admin=Admin
-PAGENAME_Test=Test
-PAGENAME_News=News
\ No newline at end of file
+
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -295,9 +295,3 @@
PERMISSION_MODIFYINGROLES=Modificar roles para
PERMISSION_DOMAIN=Dominio
PERMISSION_DOMAIN_MOD=Modificar el dominio
-
-# Navigation Portlet
-PAGENAME_default=Home
-PAGENAME_Admin=Administración
-PAGENAME_Test=Ejemplos
-PAGENAME_News=Noticias
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties 2006-10-06 22:57:10 UTC (rev 5346)
@@ -255,9 +255,3 @@
VALIDATIONEMAIL_3=Votre compte est desactive pour le moment. Vous en pouvez pas l'utiliser tant que vous n'aurez pas clique sur le lien suivant
VALIDATIONEMAIL_4=Si vous n'avez pas demande a etre membre, ne faite rien.
VALIDATIONEMAIL_5=Cordialement.
-
-# Navigation Portlet
-PAGENAME_default=Accueil
-PAGENAME_Admin=Admin
-PAGENAME_Test=Test
-PAGENAME_News=Actualités
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2006-10-06 22:57:10 UTC (rev 5346)
@@ -48,12 +48,6 @@
</security-constraint>
</portlet>
<portlet>
- <portlet-name>NavigationPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- </portlet>
- <portlet>
<portlet-name>ThemeSelectorPortlet</portlet-name>
<transaction>
<trans-attribute>Required</trans-attribute>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2006-10-06 22:57:10 UTC (rev 5346)
@@ -2,18 +2,6 @@
<deployments>
<deployment>
<instance>
- <instance-id>NavigationPortletInstance</instance-id>
- <portlet-ref>NavigationPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
- <instance-id>DashboardNavPortletInstance</instance-id>
- <portlet-ref>DashboardNavPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
<instance-id>UserPortletInstance</instance-id>
<portlet-ref>UserPortlet</portlet-ref>
</instance>
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2006-10-06 22:57:10 UTC (rev 5346)
@@ -144,56 +144,6 @@
<title>Management Portlet</title>
</portlet-info>
</portlet>
- <portlet>
- <description>Portlet providing navigable tabs with portal pages</description>
- <portlet-name>NavigationPortlet</portlet-name>
- <display-name>Navigation Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.catalog.NavigationPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <supported-locale>en</supported-locale>
- <supported-locale>fr</supported-locale>
- <supported-locale>es</supported-locale>
- <resource-bundle>Resource</resource-bundle>
- <portlet-info>
- <title>Portal Navigation</title>
- </portlet-info>
- <portlet-preferences>
- <preference>
- <!-- ordering type: default|explicit -->
- <name>ordering</name>
- <value>explicit</value>
- </preference>
- <preference>
- <!-- if explicit ordering, page names are presented in this order. Enter a comma-separated list of Page names-->
- <name>explicitlist</name>
- <value>default,News,Test,Admin</value>
- </preference>
- <preference>
- <name>navigation-root-level</name>
- <value>page</value>
- </preference>
- </portlet-preferences>
- </portlet>
- <portlet>
- <description>Portlet providing dashboard navigation</description>
- <portlet-name>DashboardNavPortlet</portlet-name>
- <display-name>Dashboard Navigation Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.catalog.DashboardNavPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <supported-locale>en</supported-locale>
- <supported-locale>fr</supported-locale>
- <supported-locale>es</supported-locale>
- <resource-bundle>Resource</resource-bundle>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
<user-attribute>
<name>user.name.nickName</name>
Modified: trunk/core/src/resources/portal-samples-war/WEB-INF/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-samples-war/WEB-INF/default-object.xml 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/core/src/resources/portal-samples-war/WEB-INF/default-object.xml 2006-10-06 22:57:10 UTC (rev 5346)
@@ -7,30 +7,6 @@
<page-name>Test</page-name>
<listener>test_listener</listener>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>TestPortletWindow</window-name>
<instance-ref>TestPortletInstance</instance-ref>
<region>center</region>
@@ -45,30 +21,6 @@
<page>
<page-name>event test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -90,30 +42,6 @@
<page>
<page-name>secure test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -129,30 +57,6 @@
<page>
<page-name>exception test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -168,30 +72,6 @@
<page>
<page-name>cache test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -213,30 +93,6 @@
<page>
<page-name>session test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -252,30 +108,6 @@
<page>
<page-name>missing portlet</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -291,30 +123,6 @@
<page>
<page-name>URL portlet</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -330,30 +138,6 @@
<page>
<page-name>missing instance</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -369,30 +153,6 @@
<page>
<page-name>charset test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -408,30 +168,6 @@
<page>
<page-name>encoding test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
@@ -447,30 +183,6 @@
<page>
<page-name>header test</page-name>
<window>
- <window-name>NavigationPortletWindow</window-name>
- <instance-ref>NavigationPortletInstance</instance-ref>
- <region>navigation</region>
- <height>0</height>
- <!-- keep portal and page properties for this window -->
- <properties>
- <!-- use the window renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.windowRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the decoration renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.decorationRendererId</name>
- <value>emptyRenderer</value>
- </property>
- <!-- use the portlet renderer from the emptyRenderer renderSet -->
- <property>
- <name>theme.portletRendererId</name>
- <value>emptyRenderer</value>
- </property>
- </properties>
- </window>
- <window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
<region>left</region>
Modified: trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java 2006-10-06 21:25:10 UTC (rev 5345)
+++ trunk/theme/src/main/org/jboss/portal/theme/PageRendition.java 2006-10-06 22:57:10 UTC (rev 5346)
@@ -21,13 +21,12 @@
*/
package org.jboss.portal.theme;
-import org.jboss.portal.theme.render.MarkupResult;
import org.jboss.portal.theme.render.ModifiableMarkupResult;
import org.jboss.portal.theme.page.PageService;
+import org.jboss.portal.theme.page.ModifiablePageResult;
import org.jboss.portal.theme.navigation.PageNavigationalState;
import org.jboss.portal.server.ServerInvocation;
-import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -46,16 +45,16 @@
private PageNavigationalState pageNavState;
/** . */
- private MarkupResult markupResult;
+ private ModifiablePageResult pageResult;
/** . */
private PageService pageService;
- public PageRendition(PortalLayout layout, PageNavigationalState pageNavState, MarkupResult markupResult, PageService pageService)
+ public PageRendition(PortalLayout layout, PageNavigationalState pageNavState, ModifiablePageResult markupResult, PageService pageService)
{
this.layout = layout;
this.pageNavState = pageNavState;
- this.markupResult = markupResult;
+ this.pageResult = markupResult;
this.pageService = pageService;
}
@@ -65,12 +64,9 @@
public void render(ServerInvocation invocation) throws IOException, ServletException
{
// If possible and needed, propagate the navigational state of the page into the result
- if (markupResult instanceof ModifiableMarkupResult)
- {
- ModifiableMarkupResult modResult = (ModifiableMarkupResult)markupResult;
- modResult.setLayoutURI(pageNavState.getLayoutURI());
- modResult.setLayoutState(pageNavState.getLayoutState());
- }
+ ModifiableMarkupResult modResult = pageResult;
+ modResult.setLayoutURI(pageNavState.getLayoutURI());
+ modResult.setLayoutState(pageNavState.getLayoutState());
//
HttpServletRequest clientRequest = invocation.getServerContext().getClientRequest();
@@ -81,14 +77,19 @@
// Place a reference to the theme service into the request so that the theme tag can get to a theme via a theme
// name (specified as tag attribute); this is useful if no theme was defined for the portal or the page
clientRequest.setAttribute(ThemeConstants.ATTR_THEMESERVER, pageService.getThemeService());
- clientRequest.setAttribute(ThemeConstants.ATTR_THEME, markupResult.getTheme());
- clientRequest.setAttribute(ThemeConstants.ATTR_THEMERESULT, markupResult.getThemeResult());
+ clientRequest.setAttribute(ThemeConstants.ATTR_THEME, pageResult.getTheme());
+ clientRequest.setAttribute(ThemeConstants.ATTR_THEMERESULT, pageResult.getThemeResult());
// now delegate to the layout to do the rest (assemble the markup fragments into a response)
- layout.assembleResponse(invocation, markupResult);
+ layout.assembleResponse(invocation, pageResult);
}
finally
{
clientRequest.removeAttribute(ThemeConstants.ATTR_THEMESERVER);
}
}
+
+ public ModifiablePageResult getPageResult()
+ {
+ return pageResult;
+ }
}
More information about the jboss-svn-commits
mailing list