Author: julien(a)jboss.com
Date: 2007-03-14 20:29:31 -0400 (Wed, 14 Mar 2007)
New Revision: 6671
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
Removed:
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/
Modified:
trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java
trunk/core-admin/build.xml
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
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
Log:
redone the dashboard editor using facelet
Modified: trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -24,6 +24,7 @@
import java.util.Arrays;
import java.util.Map;
+import java.util.HashMap;
/**
* A decorator that enforce the map content to be <String,String[]>
@@ -40,6 +41,11 @@
/** If true returned values will be cloned when provided by the client. */
private boolean cloneExternalValue;
+ public ParameterMap(boolean cloneInternalValue, boolean cloneExternalValue)
+ {
+ this(new HashMap(), cloneInternalValue, cloneExternalValue);
+ }
+
public ParameterMap(MapAccessor accessor, boolean cloneInternalValue, boolean
cloneExternalValue)
{
super(accessor);
@@ -68,6 +74,11 @@
this(delegate, false, false);
}
+ public ParameterMap()
+ {
+ this(false, false);
+ }
+
/**
* Return true if values returned by the map are cloned.
*
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core/build.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -121,7 +121,6 @@
<path id="dependentmodule.classpath">
<path refid="jboss.portal-format.classpath"/>
<path refid="jboss.portal-common.classpath"/>
- <path refid="jboss.portal-faces.classpath"/>
<path refid="jboss.portal-server.classpath"/>
<path refid="jboss.portal-registration.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
@@ -317,7 +316,6 @@
<fileset dir="${build.lib}"
includes="jboss-portlet-api-lib.jar"/>
<fileset dir="${jboss.portal-format.root}/lib"
includes="portal-format-lib.jar"/>
<fileset dir="${jboss.portal-common.root}/lib"
includes="portal-common-lib.jar"/>
- <fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-lib.jar"/>
<fileset dir="${jboss.portal-bridge.root}/lib"
includes="portal-bridge-lib.jar"/>
<fileset dir="${jboss.portal-server.root}/lib"
includes="portal-server-lib.jar"/>
<fileset dir="${jboss.portal-portlet.root}/lib"
includes="portal-portlet-lib.jar"/>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ControllerContext.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -100,10 +100,27 @@
}
}
- public String renderURL(ControllerCommand cmd, URLContext urlContext, URLFormat
format)
+ /**
+ * Render the command as an URL or return null if it is not possible.
+ *
+ * @param cmd the command to render
+ * @param urlContext the url context
+ * @param urlFormat the url format
+ * @return the URL as a string or null
+ */
+ public String renderURL(ControllerCommand cmd, URLContext urlContext, URLFormat
urlFormat)
{
ServerURL serverURL = controller.getURLFactory().doMapping(serverInvocation, cmd);
- return serverInvocation.getResponse().renderURL(serverURL, urlContext, format);
+
+ //
+ if (serverURL == null)
+ {
+ return null;
+ }
+ else
+ {
+ return serverInvocation.getResponse().renderURL(serverURL, urlContext,
urlFormat);
+ }
}
public ServerInvocation getServerInvocation()
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-03-14
23:21:37 UTC (rev 6670)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -68,6 +68,7 @@
private Map childrenMap;
private Map properties;
+ private Map unmodifiableProperties;
private PortalObjectIdImpl id;
private DashboardContext dashboardContext;
@@ -360,17 +361,20 @@
ObjectNode parent = objectNode.getParent();
if (parent == null)
{
- properties = Collections.unmodifiableMap(declaredPropertyMap);
+ this.properties = declaredPropertyMap;
}
else
{
Map properties = new HashMap();
properties.putAll(parent.getObject().getProperties());
properties.putAll(declaredPropertyMap);
- this.properties = Collections.unmodifiableMap(properties);
+ this.properties = properties;
}
+
+ //
+ this.unmodifiableProperties = Collections.unmodifiableMap(properties);
}
- return properties;
+ return unmodifiableProperties;
}
public Map getDeclaredPropertyMap()
@@ -406,10 +410,22 @@
if (value == null)
{
declaredPropertyMap.remove(name);
+
+ // If aggregated properties is loaded then we udpate it
+ if (properties != null)
+ {
+ properties.remove(name);
+ }
}
else
{
declaredPropertyMap.put(name, value);
+
+ // If aggregated properties is loaded then we udpate it
+ if (properties != null)
+ {
+ properties.put(name, value);
+ }
}
}
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 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -712,50 +712,6 @@
optional-attribute-name="DelegateFactory"
proxy-type="attribute">portal:commandFactory=Dashboard</depends>
</mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
- name="portal:commandFactory=Configurator"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute
name="InstanceId">ConfiguratorPortletInstance</attribute>
- </mbean>
- <mbean
-
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
- name="portal:commandFactory=Delegate,path=configure"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="Path">/configure</attribute>
- <depends
- optional-attribute-name="DelegatingFactory"
-
proxy-type="attribute">portal:commandFactory=Delegating</depends>
- <depends
- optional-attribute-name="DelegateFactory"
-
proxy-type="attribute">portal:commandFactory=Configurator</depends>
- </mbean>
- <mbean
-
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
- name="portal:commandFactory=Delegate,path=test"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="Path">/test</attribute>
- <depends
- optional-attribute-name="DelegatingFactory"
-
proxy-type="attribute">portal:commandFactory=Delegating</depends>
- <depends
- optional-attribute-name="DelegateFactory"
- proxy-type="attribute">portal:commandFactory=Test</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
- name="portal:commandFactory=Test"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="InstanceId">TestPortletInstance</attribute>
- </mbean>
<!-- URL factories -->
<mbean
@@ -800,30 +756,6 @@
optional-attribute-name="Factory"
proxy-type="attribute">portal:urlFactory=Delegating</depends>
</mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceURLFactory"
- name="portal:urlFactory=Configurator"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute
name="InstanceId">ConfiguratorPortletInstance</attribute>
- <attribute name="Path">/configure</attribute>
- <depends
- optional-attribute-name="Factory"
-
proxy-type="attribute">portal:urlFactory=Delegating</depends>
- </mbean>
- <mbean
- code="org.jboss.portal.core.model.instance.InstanceURLFactory"
- name="portal:urlFactory=Test"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <attribute name="InstanceId">TestPortletInstance</attribute>
- <attribute name="Path">/test</attribute>
- <depends
- optional-attribute-name="Factory"
-
proxy-type="attribute">portal:urlFactory=Delegating</depends>
- </mbean>
<!-- The federating portlet invoker -->
<mbean
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 2007-03-14 23:21:37
UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2007-03-15 00:29:31
UTC (rev 6671)
@@ -57,12 +57,6 @@
<trans-attribute>Required</trans-attribute>
</transaction>
</portlet>
- <portlet>
- <portlet-name>ConfiguratorPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- </portlet>
<!-- Service injected in the portlet context. -->
<service>
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 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -45,18 +45,4 @@
<portlet-ref>CatalogPortlet</portlet-ref>
</instance>
</deployment>
- <deployment>
- <instance>
- <instance-id>ConfiguratorPortletInstance</instance-id>
- <portlet-ref>ConfiguratorPortlet</portlet-ref>
-<!--
- <security-constraint>
- <policy-permission>
- <role-name>User</role-name>
- <action-name>personalize</action-name>
- </policy-permission>
- </security-constraint>
--->
- </instance>
- </deployment>
</deployments>
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-03-14 23:21:37 UTC
(rev 6670)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-03-15 00:29:31 UTC
(rev 6671)
@@ -110,20 +110,6 @@
<title>Catalog</title>
</portlet-info>
</portlet>
- <portlet>
- <description>Configurator portlet for personal dashboard</description>
- <portlet-name>ConfiguratorPortlet</portlet-name>
- <display-name>Dashboard Configurator Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.portlet.dashboard.Configurator</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>Dashboard Portlet</title>
- <keywords>management,admin</keywords>
- </portlet-info>
- </portlet>
<user-attribute>
<name>user.name.nickName</name>
</user-attribute>
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-03-14 23:21:37 UTC (rev 6670)
+++ trunk/core-admin/build.xml 2007-03-15 00:29:31 UTC (rev 6671)
@@ -199,8 +199,8 @@
<!--<fileset dir="."
includes="jsf-portlet.jar"/>-->
<!-- For JSF -->
+ <fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-lib.jar"/>
<fileset dir="../core-admin/src/etc/sun-jsf"
includes="jsf-example.jar"/>
- <!--<fileset dir="${apache.lang.lib}"
includes="commons-lang-2.0.jar"/>-->
<fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
<fileset dir="${el.el.lib}"
includes="el-api.jar,el-ri.jar"/>
</copy>
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-14
23:21:37 UTC (rev 6670)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -30,6 +30,7 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.util.IteratorStatus;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
@@ -39,12 +40,21 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
+import org.jboss.portal.security.AuthorizationDomainRegistry;
+import org.jboss.portal.security.spi.provider.AuthorizationDomain;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.PortalTheme;
import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
import java.util.Set;
import java.util.Locale;
import java.util.ArrayList;
import java.util.List;
+import java.util.Collection;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -239,6 +249,65 @@
}
});
+ //
+ DelegatingPropertyResolver.registerDecorator(AuthorizationDomainRegistry.class, new
AbstractBeanDecorator()
+ {
+ protected PropertyDecorator getProperty(final Object propertyName)
+ {
+ return new AbstractPropertyDecorator(AuthorizationDomain.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ return
((AuthorizationDomainRegistry)bean).getDomain((String)propertyName);
+ }
+ };
+ }
+ });
+
+ //
+ SimpleBeanDecorator layoutServiceDecorator = new SimpleBeanDecorator();
+ layoutServiceDecorator.setProperty("layoutItems", new
AbstractPropertyDecorator(SelectItem[].class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ LayoutService layoutService = (LayoutService)bean;
+ Collection layouts = layoutService.getLayouts();
+ SelectItem[] items = new SelectItem[layouts.size()];
+ for (IteratorStatus i = new IteratorStatus(layouts.iterator());i.hasNext();)
+ {
+ PortalLayout layout = (PortalLayout)i.next();
+ SelectItem item = new SelectItem();
+ String layoutName = layout.getLayoutInfo().getName();
+ item.setValue(layoutName);
+ item.setLabel(layoutName);
+ items[i.getElementIndex()] = item;
+ }
+ return items;
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(LayoutService.class,
layoutServiceDecorator);
+
+ //
+ SimpleBeanDecorator themeServiceDecorator = new SimpleBeanDecorator();
+ themeServiceDecorator.setProperty("themeItems", new
AbstractPropertyDecorator(SelectItem[].class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ ThemeService layoutService = (ThemeService)bean;
+ Collection themes = layoutService.getThemes();
+ SelectItem[] items = new SelectItem[themes.size()];
+ for (IteratorStatus i = new IteratorStatus(themes.iterator());i.hasNext();)
+ {
+ PortalTheme name = (PortalTheme)i.next();
+ SelectItem item = new SelectItem();
+ String themeName = name.getThemeInfo().getName();
+ item.setValue(themeName);
+ item.setLabel(themeName);
+ items[i.getElementIndex()] = item;
+ }
+ return items;
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(ThemeService.class,
themeServiceDecorator);
}
-
}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.core.admin.ui.dashboard.DashboardBean;
+
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
@@ -45,8 +47,7 @@
public void beforePhase(PhaseEvent phaseEvent)
{
- if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW ||
- phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
+ if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW)
{
FacesContext ctx = phaseEvent.getFacesContext();
@@ -61,7 +62,31 @@
//
PortletManagerBean portletmgr =
(PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
portletmgr.refresh();
+
+ //
+ DashboardBean dashboard =
(DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
+ dashboard.actionRefresh();
}
+ else if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
+ {
+ FacesContext ctx = phaseEvent.getFacesContext();
+
+ //
+ PortalObjectManagerBean pomgr =
(PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
+ pomgr.refresh();
+
+ //
+ InstanceManagerBean instancemgr =
(InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
+ instancemgr.refresh();
+
+ //
+ PortletManagerBean portletmgr =
(PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
+ portletmgr.refresh();
+
+ //
+ DashboardBean dashboard =
(DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
+ dashboard.renderRefresh();
+ }
}
public PhaseId getPhaseId()
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction2.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * 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.admin.ui.actions;
+
+import org.jboss.portal.core.model.portal.PageContainer;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.security.spi.provider.DomainConfigurator;
+import org.jboss.portal.security.RoleSecurityBinding;
+import org.jboss.portal.security.SecurityConstants;
+
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5763 $
+ */
+public class AddPageAction2
+{
+
+ /** . */
+ public PageContainer pageContainer;
+
+ /** . */
+ public DomainConfigurator domainConfigurator;
+
+ /** . */
+ public String pageName;
+
+ /** . */
+ public Listener listener;
+
+ /** . */
+// private static final String ERROR_DUPE_NAME = "Duplicate Page name found on
this portal!";
+
+ /** . */
+// private static final String ERROR_EMPTY_NAME = "Page name cannot be
blank!";
+
+ /*
+ * Checks for duplicate page names on the portal instance. Blank page names are not
allowed and are controlled by the
+ * required attribute in the presentation page.
+ */
+// public void validatePageName(FacesContext context, UIComponent toValidate, Object
value)
+// {
+// String pageName = (String)value;
+//
+// // check for empty string
+// if (pageName.startsWith(" "))
+// {
+// FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
ERROR_EMPTY_NAME, ERROR_EMPTY_NAME);
+// throw new ValidatorException(message);
+// }
+//
+// // Check for duplicate child name
+// if (pageContainer.getChild(pageName) != null)
+// {
+// FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
ERROR_DUPE_NAME, ERROR_DUPE_NAME);
+// throw new ValidatorException(message);
+// }
+// }
+
+ public void execute()
+ {
+ try
+ {
+ Page page = pageContainer.createPage(pageName);
+
+ //
+ Set constraints = Collections.singleton(new
RoleSecurityBinding(PortalObjectPermission.VIEW_RECURSIVE_ACTION,
SecurityConstants.UNCHECKED_ROLE_NAME));
+
domainConfigurator.setSecurityBindings(page.getId().toString(PortalObjectId.CANONICAL_FORMAT),
constraints);
+
+ //
+ if (listener != null)
+ {
+ listener.pageCreated(page);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public interface Listener
+ {
+ void pageCreated(Page page);
+ }
+}
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -0,0 +1,325 @@
+/******************************************************************************
+ * 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.admin.ui.common;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.Content;
+import org.jboss.portal.core.admin.ui.actions.WindowComparator;
+import org.jboss.portal.core.impl.model.content.ContentEditorRegistry;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.faces.component.portlet.PortletActionEvent;
+import org.jboss.portal.portlet.PortletInvoker;
+
+import javax.faces.model.SelectItem;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Iterator;
+import java.util.TreeSet;
+import java.util.SortedSet;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PageManagerBean
+{
+
+ public PageManagerBean(Page page, LayoutService layoutService, PortletInvoker
portletInvoker)
+ {
+ this.page = page;
+ this.layoutService = layoutService;
+ this.portletInvoker = portletInvoker;
+ this.selectedContentType = ContentType.PORTLET;
+ }
+
+ /** . */
+ public final Page page;
+
+ /** . */
+ public final LayoutService layoutService;
+
+ /** . */
+ public final PortletInvoker portletInvoker;
+
+ /** . */
+ public ContentType selectedContentType;
+
+ public List getContentTypeItems()
+ {
+ LinkedList types = new LinkedList();
+ for (Iterator i =
ContentEditorRegistry.getInstance().getContentTypes().iterator();i.hasNext();)
+ {
+ ContentType contentType = (ContentType)i.next();
+ SelectItem item = new SelectItem();
+ item.setValue(contentType);
+ item.setLabel(contentType.toString());
+ if (contentType.equals(ContentType.PORTLET))
+ {
+ types.addFirst(item);
+ }
+ else
+ {
+ types.addLast(item);
+ }
+ }
+ return types;
+ }
+
+ public String getSelectedEditorPortletId()
+ {
+ if (selectedContentType != null)
+ {
+ return ContentEditorRegistry.getInstance().getEditor(selectedContentType);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected String createWindowName()
+ {
+ return "" + (int)(100 * Math.random());
+ }
+
+ public void assignWindow(ActionEvent event)
+ {
+ if (event instanceof PortletActionEvent)
+ {
+ PortletActionEvent actionEvent = (PortletActionEvent)event;
+ Map actionParams = actionEvent.getParameterMap();
+ if (actionParams.get("meta_action") != null)
+ {
+ String[] uris = (String[])actionParams.get("uri");
+ if (uris != null && uris.length > 0)
+ {
+ String uri = uris[0];
+
+ // Obtain a window name
+ String windowName =
((String[])actionParams.get("windowName"))[0];
+ if (windowName.trim().length() == 0)
+ {
+ windowName = createWindowName();
+ while (page.getWindow(windowName) != null)
+ {
+ windowName = "" + createWindowName();
+ }
+ }
+
+ // Check for duplicate window name
+ if (page.getWindow(windowName) != null)
+ {
+ FacesContext faces = FacesContext.getCurrentInstance();
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Duplicate window name found on this page!", null);
+ faces.addMessage("windowName", message);
+ throw new AbortProcessingException();
+ }
+
+ // Get the target region
+ String targetRegion =
((String[])actionParams.get("targetRegion"))[0];
+
+ //
+ Map params = new HashMap();
+ for (Iterator i = actionParams.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ if (name.startsWith("param."))
+ {
+ String paramName = name.substring(6);
+ String paramValue = ((String[])entry.getValue())[0];
+ params.put(paramName, paramValue);
+ }
+ }
+
+ try
+ {
+ Window window = page.createWindow(windowName, selectedContentType,
uri);
+ Content content = window.getContent();
+ for (Iterator i = params.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String paramName = (String)entry.getKey();
+ String paramValue = (String)entry.getValue();
+ content.setParameter(paramName, paramValue);
+ }
+
+ //
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION,
targetRegion);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER,
"" + Integer.MAX_VALUE);
+
+ // Get the windows belonging to the selected region sorted by order
+ List windows = new ArrayList();
+ for (Iterator i =
page.getChildren(PortalObject.WINDOW_MASK).iterator();i.hasNext();)
+ {
+ Window tmp = (Window)i.next();
+ if
(targetRegion.equals(tmp.getProperty(ThemeConstants.PORTAL_PROP_REGION)))
+ {
+ windows.add(tmp);
+ }
+ }
+
+ // Sort windows
+ Collections.sort(windows, new WindowComparator());
+
+ // Add the created one
+ windows.add(window);
+
+ // Update the order states
+ for (int i = 0;i < windows.size();i++)
+ {
+ Window tmp = (Window)windows.get(i);
+ tmp.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER,
"" + i);
+ }
+ }
+ catch (DuplicatePortalObjectException unexpected)
+ {
+ unexpected.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ /** Return the <Region>List on the selected object which must be a page. */
+ public List getRegionNames()
+ {
+ try
+ {
+ Map windows = getWindows(page);
+
+ //
+ List regions = new ArrayList(windows.keySet());
+ regions.remove("unknown");
+ Collections.sort(regions);
+
+ //
+ return regions;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ //
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public List getRegionItems()
+ {
+ try
+ {
+ Map windows = getWindows(page);
+
+ // We don't want the unknown region
+ windows.remove("unknown");
+
+ //
+ ArrayList regions = new ArrayList(windows.keySet());
+ Collections.sort(regions);
+ for (int i = 0; i < regions.size();i++)
+ {
+ String regionName = (String)regions.get(i);
+ SelectItem regionItem = new SelectItem(regionName, regionName);
+ regions.set(i, regionItem);
+ }
+
+ //
+ return regions;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ //
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public Map getWindowItemsMap() throws Exception
+ {
+ Map windowMap = getWindows(page);
+ for (Iterator i = windowMap.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ SortedSet windows = (SortedSet)entry.getValue();
+ ArrayList windowItems = new ArrayList(windows.size());
+ for (Iterator j = windows.iterator();j.hasNext();)
+ {
+ Window window = (Window)j.next();
+ SelectItem windowItem = new SelectItem();
+ windowItem.setValue(window.getName());
+ windowItem.setLabel(window.getName());
+ windowItems.add(windowItem);
+ }
+ entry.setValue(windowItems);
+ }
+ return windowMap;
+ }
+
+ /** Returns a <Region,<Window>SortedSet>Map. */
+ private Map getWindows(Page page) throws Exception
+ {
+ // Get the layout
+ String layoutId = page.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ PortalLayout layout = layoutService.getLayout(layoutId, false);
+
+ //
+ LinkedHashMap windows = new LinkedHashMap();
+ for (Iterator i = layout.getLayoutInfo().getRegionNames().iterator();
i.hasNext();)
+ {
+ String region = (String)i.next();
+ windows.put(region, new TreeSet(new WindowComparator()));
+ }
+ windows.put("unknown", new TreeSet(new WindowComparator()));
+
+ //
+ for (Iterator j = page.getChildren(PortalObject.WINDOW_MASK).iterator();
j.hasNext();)
+ {
+ PortalObject window = (PortalObject)j.next();
+ String region = window.getProperty(ThemeConstants.PORTAL_PROP_REGION);
+ if (!windows.containsKey(region))
+ {
+ region = "unknown";
+ }
+ SortedSet set = (SortedSet)windows.get(region);
+ set.add(window);
+ }
+ return windows;
+ }
+}
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
(rev 0)
+++
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -0,0 +1,190 @@
+/******************************************************************************
+ * 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.admin.ui.dashboard;
+
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+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.model.portal.NoSuchPortalObjectException;
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.core.admin.ui.common.PageManagerBean;
+import org.jboss.portal.core.admin.ui.portlet.PortletDefinitionInvoker;
+import org.jboss.portal.core.admin.ui.actions.AddPageAction2;
+import org.jboss.portal.theme.LayoutService;
+import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.common.util.IteratorStatus;
+
+import javax.faces.model.SelectItem;
+import javax.faces.context.FacesContext;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DashboardBean implements AddPageAction2.Listener
+{
+
+ /** . */
+ private static final PortalObjectId dashboardId =
PortalObjectId.parse("/dashboard", PortalObjectId.CANONICAL_FORMAT);
+
+ // Wired services
+
+ /** . */
+ public PortalObjectContainer portalObjectContainer;
+
+ /** . */
+ public LayoutService layoutService;
+
+ /** . */
+ public ThemeService themeService;
+
+ /** . */
+ public InstanceContainer instanceContainer;
+
+ // Navigational state
+
+ /** . */
+ public String selectedPageName;
+
+ // Runtime fields
+
+ /** . */
+ public Portal userPortal;
+
+ /** . */
+ public Page selectedPage;
+
+ /** . */
+ public String selectedPageTheme;
+
+ /** . */
+ public String selectedPageLayout;
+
+ /** . */
+ public PageManagerBean selectedPageManager;
+
+ /** . */
+ public SelectItem[] pageItems;
+
+ /** . */
+ public boolean selectePageIsDefault;
+
+ //
+
+ public void pageCreated(Page page)
+ {
+ selectedPageName = page.getName();
+ }
+
+ public void actionRefresh()
+ {
+ refresh();
+ }
+
+ private void refresh()
+ {
+ // Get user name
+ String userId =
FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
+
+ // Load portal
+ userPortal =
(Portal)portalObjectContainer.getObject(dashboardId).getChild(userId);
+
+ // Page for editting
+ if (selectedPageName != null)
+ {
+ selectedPage = userPortal.getPage(selectedPageName);
+ }
+ if (selectedPage == null)
+ {
+ selectedPage = userPortal.getDefaultPage();
+ }
+
+ //
+ selectedPageName = selectedPage.getName();
+ selectedPageManager = new PageManagerBean(selectedPage, layoutService, new
PortletDefinitionInvoker(instanceContainer));
+
+ //
+ String defaultPageName =
selectedPage.getProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME);
+ if (defaultPageName == null)
+ {
+ defaultPageName = PortalObject.DEFAULT_OBJECT_NAME;
+ }
+ selectePageIsDefault = selectedPageName.equals(defaultPageName);
+
+ //
+ Collection pages = userPortal.getChildren(PortalObject.PAGE_MASK);
+ pageItems = new SelectItem[pages.size()];
+ for (IteratorStatus i = new IteratorStatus(pages);i.hasNext();)
+ {
+ PortalObject object = (PortalObject)i.next();
+ SelectItem item = new SelectItem();
+ item.setValue(object.getName());
+ item.setLabel(object.getName());
+ pageItems[i.getElementIndex()] = item;
+ }
+ }
+
+ public void renderRefresh()
+ {
+ refresh();
+
+ //
+ selectedPageTheme = selectedPage.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ selectedPageLayout = selectedPage.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ }
+
+ public void updateTheme()
+ {
+ String previousTheme = userPortal.getProperty(ThemeConstants.PORTAL_PROP_THEME);
+ if (!selectedPageTheme.equals(previousTheme))
+ {
+ userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME,
selectedPageTheme);
+ }
+ }
+
+ public void updateLayout()
+ {
+ String previousLayout = userPortal.getProperty(ThemeConstants.PORTAL_PROP_LAYOUT);
+ if (!selectedPageLayout.equals(previousLayout))
+ {
+ userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT,
selectedPageLayout);
+ }
+ }
+
+ public void destroyPage()
+ {
+ try
+ {
+ userPortal.destroyChild(selectedPageName);
+ selectedPageName = null;
+ }
+ catch (NoSuchPortalObjectException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Modified: trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-sar/META-INF/jboss-service.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -22,4 +22,42 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<server>
+
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceCommandFactory"
+ name="portal:commandFactory=Configurator"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute
name="InstanceId">ConfiguratorPortletInstance</attribute>
+ </mbean>
+
+ <mbean
+
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
+ name="portal:commandFactory=Delegate,path=configure"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="Path">/configure</attribute>
+ <depends
+ optional-attribute-name="DelegatingFactory"
+
proxy-type="attribute">portal:commandFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="DelegateFactory"
+
proxy-type="attribute">portal:commandFactory=Configurator</depends>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.core.model.instance.InstanceURLFactory"
+ name="portal:urlFactory=Configurator"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute
name="InstanceId">ConfiguratorPortletInstance</attribute>
+ <attribute name="Path">/configure</attribute>
+ <depends
+ optional-attribute-name="Factory"
+
proxy-type="attribute">portal:urlFactory=Delegating</depends>
+ </mbean>
+
</server>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -217,6 +217,46 @@
</managed-property>
</managed-bean>
+ <!-- The dashboard bean -->
+ <managed-bean>
+ <managed-bean-name>dashboard</managed-bean-name>
+
<managed-bean-class>org.jboss.portal.core.admin.ui.dashboard.DashboardBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>portalObjectContainer</property-name>
+ <value>#{applicationScope.PortalObjectContainer}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>layoutService</property-name>
+ <value>#{applicationScope.LayoutService}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>themeService</property-name>
+ <value>#{applicationScope.ThemeService}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>instanceContainer</property-name>
+ <value>#{applicationScope.InstanceContainer}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>addPageAction2</managed-bean-name>
+
<managed-bean-class>org.jboss.portal.core.admin.ui.actions.AddPageAction2</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>pageContainer</property-name>
+ <value>#{sessionScope.dashboard.userPortal}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>domainConfigurator</property-name>
+
<value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>listener</property-name>
+ <value>#{sessionScope.dashboard}</value>
+ </managed-property>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>index</from-outcome>
@@ -290,6 +330,11 @@
<from-outcome>newWindowWizardConfirm</from-outcome>
<to-view-id>/WEB-INF/jsf/wizard/newWindowWizardConfirm.xhtml</to-view-id>
</navigation-case>
+
+ <navigation-case>
+ <from-outcome>dashboard</from-outcome>
+ <to-view-id>/WEB-INF/jsf/dashboard/dashboard.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
<lifecycle>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jboss-portlet.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -44,6 +44,12 @@
<link rel="stylesheet" type="text/css"
href="/style.css" title="" media="screen"/>
</header-content>
</portlet>
+ <portlet>
+ <portlet-name>DashboardConfigPortlet</portlet-name>
+ <transaction>
+ <trans-attribute>Required</trans-attribute>
+ </transaction>
+ </portlet>
<!-- Service injected in the portlet context. -->
<service>
Added:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
(rev 0)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -0,0 +1,150 @@
+<div
+
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:jbp="http://www.jboss.org/portal"
+
xmlns:c="http://java.sun.com/jstl/core">
+
+<div style="float:left; padding:0 2em 0 2em">
+ <h:form id="layoutForm">
+ <table>
+ <c:forEach items="#{pageManager.regionNames}"
var="regionName"
+ varStatus="status">
+ <tbody>
+ <c:choose>
+ <c:when test="#{status.index > 0}">
+ <tr>
+ <td colspan="2"
class="portlet-form-field-label"
+ style="border-width:0px;border-top:1px dashed
#d5d5d5">#{regionName}
+ Region
+ </td>
+ </tr>
+ </c:when>
+ <c:otherwise>
+ <tr>
+ <td colspan="2"
class="portlet-form-field-label">#{regionName}
+ Region
+ </td>
+ </tr>
+ </c:otherwise>
+ </c:choose>
+ <tr>
+ <td>
+ <div>
+ <h:commandButton value="Up"
id="u_#{regionName}"
+
actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ <div>
+ <h:commandButton value="Down"
id="d_#{regionName}"
+
actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ <div style="margin-top: 1em">
+ <h:commandButton
+ value="Delete" id="l_#{regionName}"
+ actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ <td>
+ <h:selectManyListbox
+
value="#{assignWindowsAction.assignedWindows[regionName]}"
+ size="7" styleClass="windowList
portlet-form-field">
+ <f:selectItems
+
value="#{pageManager.windowItemsMap[regionName]}"/>
+ </h:selectManyListbox>
+ </td>
+ </tr>
+ </tbody>
+ </c:forEach>
+ <tbody>
+ <tr>
+ <td colspan="2" class="portlet-form-field-label"
+ style="border-width:0px;border-top:1px dashed
#d5d5d5">Unassigned
+ windows
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div style="margin-top: 1em">
+ <h:commandButton value="Delete"
+ id="l_unknown"
actionListener="#{assignWindowsAction.execute}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ <td>
+ <h:selectManyListbox
+
value="#{assignWindowsAction.assignedWindows['unknown']}"
+ size="7" styleClass="windowList
portlet-form-field">
+ <f:selectItems
+
value="#{pageManager.windowItemsMap['unknown']}"/>
+ </h:selectManyListbox>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </h:form>
+</div>
+<div style="float:left">
+ <table class="form">
+ <tr>
+ <td class="label">
+ <span class="portlet-form-field-label">Content
type:</span>
+ </td>
+ <td class="widget">
+ <h:form id="abc">
+ <h:selectOneMenu
+ id="instanceId"
+ value="#{pageManager.selectedContentType}"
+ styleClass="portlet-form-field contentType">
+ <f:selectItems
value="#{pageManager.contentTypeItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Change"
styleClass="portlet-form-button"/>
+ <h:message for="instanceId"
errorClass="portlet-msg-error"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <span class="portlet-form-field-label">Window
Name:</span>
+ </td>
+ <td class="widget">
+ <h:inputText id="windowName"
value="#{assignWindowsAction.windowName}"
+ styleClass="portlet-form-input-field"/>
+ <h:message for="windowName"
errorClass="portlet-msg-error"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <span class="portlet-form-field-label">Target
Region:</span>
+ </td>
+ <td class="widget">
+ <h:selectOneMenu id="targetRegion"
styleClass="portlet-form-input-field">
+ <f:selectItems value="#{pageManager.regionItems}"/>
+ </h:selectOneMenu>
+ <h:message for="targetRegion"
errorClass="portlet-msg-error"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ </td>
+ <td class="widget">
+ <div style="margin-top:3em;">
+ <jbp:portlet
+ portletId="#{pageManager.selectedEditorPortletId}"
+ portletInvoker="#{pageManager.portletInvoker}"
+ actionListener="#{pageManager.assignWindow}"
+ supportedModes="edit_content"
+ supportedWindowStates="normal"
+ initialMode="edit_content"
+ initialWindowState="normal"
+ onClick="url.setParameter('windowName',
document.getElementById('windowName').value).setParameter('targetRegion',
document.getElementById('targetRegion').value);"/>
+ </div>
+ </td>
+ </tr>
+ </table>
+</div>
+
+</div>
\ No newline at end of file
Added:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml
(rev 0)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/dashboard/dashboard.xhtml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -0,0 +1,143 @@
+<div
+
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:c="http://java.sun.com/jstl/core">
+
+
+<div align="center">
+ <h:message id="error" for="error"
errorClass="portlet-msg-error"/>
+</div>
+
+<table width="100%">
+<tr>
+ <th colspan="2" class="portlet-section-header"
align="center">Personal Dashboard Editor</th>
+</tr>
+<tr>
+ <td class="portlet-section-body" align="center">
+ <table width="100%">
+ <tr>
+ <td width="250">
+ <table class="bottombuttonbar">
+ <tr>
+ <td align="left"
valign="top"><b>Create a New Page:</b><br/>Page
name: 
+ <h:form style="padding:0;margin:0">
+ <h:inputText id="pageName"
value="#{addPageAction2.pageName}"
+
styleClass="portlet-form-input-field"/>
+ <h:commandButton value="Save"
+ action="#{addPageAction2.execute}"
+
styleClass="portlet-form-button"/>
+ </h:form>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td align="left" valign="top">
+ Use this page to manage the content and appearance of your dashboard
pages. <br/>
+ You can control the page titles, column layouts, page themes,
+ and add,
+ order, or remove portlets.
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+<tr>
+ <th colspan="2" class="portlet-section-header"
align="center">Currently editing page
#{dashboard.selectedPage.name}</th>
+</tr>
+<tr>
+ <td class="portlet-section-body" align="center">
+ <h:form style="padding:0;margin:0">
+ Select: <h:selectOneMenu
+ id="pageNameSelector"
+ value="#{dashboard.selectedPageName}"
+ styleClass="portlet-form-field">
+ <f:selectItems value="#{dashboard.pageItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Go"
styleClass="portlet-form-button"/>
+ </h:form>
+ <br/>
+ </td>
+</tr>
+<tr>
+ <td>
+ <table width="100%">
+ <tr>
+ <td valign="top" width="250">
+ <table class="bottombuttonbar">
+ <tr>
+ <td valign="top">
+ <b>Theme and Layout</b>
+ <br/>
+ Apply a theme to your dashboard, or select the number of
columns for the layout.
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h:form>
+ Choose a layout:<br/>
+ <h:selectOneMenu
+ id="layoutSelector"
+ value="#{dashboard.selectedPageLayout}"
+ styleClass="portlet-form-field">
+ <f:selectItems
value="#{applicationScope.LayoutService.layoutItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Select"
styleClass="portlet-form-button"
action="#{dashboard.updateLayout}"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td height="20"></td>
+ </tr>
+ <tr>
+ <td>
+ <h:form>
+ Choose a theme:<br/>
+ <h:selectOneMenu
+ id="themeSelector"
+ value="#{dashboard.selectedPageTheme}"
+ styleClass="portlet-form-field">
+ <f:selectItems
value="#{applicationScope.ThemeService.themeItems}"/>
+ </h:selectOneMenu>
+ <h:commandButton value="Select"
styleClass="portlet-form-button"
action="#{dashboard.updateTheme}"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td height="20"></td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <ui:include
src="/WEB-INF/jsf/common/editPageLayout.xhtml">
+ <ui:param name="pageManager"
value="#{dashboard.selectedPageManager}"/>
+ </ui:include>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
+<hr/>
+<c:if test="#{dashboard.selectePageIsDefault == false}">
+ <table width="100%">
+ <tr>
+ <td align="left">
+ <h:form style="padding:0;margin:0">
+ <h:commandButton value="Delete this Page"
styleClass="portlet-form-button"
action="#{dashboard.destroyPage}"/>
+ <br/>
+ <font color="red">You cannot undo this
action!</font>
+ </h:form>
+ </td>
+ </tr>
+ </table>
+</c:if>
+</div>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml
===================================================================
---
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml 2007-03-14
23:21:37 UTC (rev 6670)
+++
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet-instances.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -41,6 +41,12 @@
</deployment>
<deployment>
<instance>
+ <instance-id>DashboardConfigPortletInstance</instance-id>
+ <portlet-ref>DashboardConfigPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
<instance-id>PortletContentEditorInstance</instance-id>
<portlet-ref>PortletContentEditorPortlet</portlet-ref>
<security-constraint>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -47,6 +47,25 @@
</portlet-info>
</portlet>
<portlet>
+ <description>Dashboard Configurator Portlet</description>
+ <portlet-name>DashboardConfigPortlet</portlet-name>
+ <display-name>Dashboard Configurator Portlet</display-name>
+
<portlet-class>org.jboss.portal.faces.portlet.JSFMetaBridgePortlet</portlet-class>
+ <init-param>
+ <name>VIEW</name>
+ <value>/WEB-INF/jsf/dashboard/dashboard.xhtml</value>
+ </init-param>
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Dashboard Configurator Portlet</title>
+ <keywords>management,admin</keywords>
+ </portlet-info>
+ </portlet>
+ <portlet>
<description>Portlet Content Editor</description>
<portlet-name>PortletContentEditorPortlet</portlet-name>
<display-name>Portlet Content Editor</display-name>
Deleted: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java 2007-03-14
23:21:37 UTC (rev 6670)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSContentEditor.java 2007-03-15
00:29:31 UTC (rev 6671)
@@ -1,94 +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.cms.content;
-
-import org.jboss.portal.core.portlet.dashboard.AddWindowContext;
-import org.jboss.portal.core.portlet.dashboard.AbstractContentEditor;
-import org.jboss.portal.core.cms.content.CMSContent;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.cms.CMS;
-import org.jboss.portal.cms.Command;
-import org.jboss.portal.cms.model.File;
-import org.jboss.portal.cms.model.Folder;
-
-import javax.portlet.RenderRequest;
-import javax.portlet.ActionRequest;
-import java.io.PrintWriter;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class CMSContentEditor extends AbstractContentEditor
-{
-
- /** . */
- private CMS cms;
-
- public CMS getCMS()
- {
- return cms;
- }
-
- public void setCMS(CMS cms)
- {
- this.cms = cms;
- }
-
- public void show(RenderRequest req, PrintWriter writer)
- {
- Command listCMD =
cms.getCommandFactory().createFolderGetListCommand("/default");
- Folder folder = (Folder)cms.execute(listCMD);
- List list = folder.getFiles();
- writer.println("<select name=\"available_instances\"
multiple=\"true\" size=\"20\">\n");
- for (int i = 0; i < list.size(); i++)
- {
- File file = (File)list.get(i);
- writer.print("<option value=\"");
- writer.print(file.getBasePath());
- writer.print("\">");
- writer.print(file.getName());
- writer.println("</option>\n");
- }
- writer.println("</select>");
- }
-
- public void add(ActionRequest req, AddWindowContext ctx)
- {
- String[] files = req.getParameterValues("available_instances");
- try
- {
- for (int i = 0; i < files.length; i++)
- {
- String file = files[i];
- CMSContent content = (CMSContent)ctx.createWindow(ContentType.CMS, file);
-
- }
- }
- catch (Exception e)
- {
- log.error("Error adding window to region", e);
- }
- }
-}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-14
23:21:37 UTC (rev 6670)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-03-15
00:29:31 UTC (rev 6671)
@@ -662,22 +662,6 @@
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Server</depends>
</mbean>
- <!-- Content editor integration -->
- <mbean
- code="org.jboss.portal.core.cms.content.CMSContentEditor"
- name="portal:service=ContentEditor,type=cms"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="Registry"
-
proxy-type="attribute">portal:service=ContentEditorRegistry</depends>
- <depends
- optional-attribute-name="CMS"
- proxy-type="attribute">portal:service=CMS</depends>
- <attribute name="ContentType">cms</attribute>
- </mbean>
-
<!-- Content renderer integration -->
<mbean
code="org.jboss.portal.core.cms.content.CMSContentRenderer"