JBoss Portal SVN: r12400 - in branches/JBoss_Portal_Branch_2_6: core-admin/src/resources/portal-admin-war/WEB-INF/jsf and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-12-17 18:27:39 -0500 (Wed, 17 Dec 2008)
New Revision: 12400
Added:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
Log:
- JBPORTAL-2264, JBPORTAL-2259: Added id sanitization before using them as HTML ids, users can still use names
with . or spaces... Display performance of instance list seems to suffer from it so should investigate
optimization.
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2008-12-17 20:38:08 UTC (rev 12399)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2008-12-17 23:27:39 UTC (rev 12400)
@@ -25,6 +25,7 @@
import org.apache.commons.lang.StringEscapeUtils;
import org.jboss.portal.Mode;
+import org.jboss.portal.faces.util.JSFFunctor;
import org.jboss.portal.common.value.Value;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
@@ -109,6 +110,20 @@
/** . */
private AuthorizationBean auth = new InstanceAuthorizationBean();
+ /** Removes white spaces from identifiers so that we can assign them to HTML id attributes. */
+ private JSFFunctor idSanitizer = new JSFFunctor()
+ {
+ public Object get(Object parameter)
+ {
+ if (parameter instanceof String)
+ {
+ String id = (String)parameter;
+ return id.replaceAll("\\W|\\.", "_");
+ }
+ return null;
+ }
+ };
+
// Services accessors
public RoleModule getRoleModule()
@@ -141,6 +156,16 @@
this.domainConfigurator = domainConfigurator;
}
+ /**
+ * Functor acccess to sanitize identifiers.
+ *
+ * @return
+ */
+ public JSFFunctor getIdSanitizer()
+ {
+ return idSanitizer;
+ }
+
// Navigational state accessor
public int getPaginationSize()
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2008-12-17 20:38:08 UTC (rev 12399)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/instances.xhtml 2008-12-17 23:27:39 UTC (rev 12400)
@@ -26,8 +26,8 @@
<tr
class="#{instance.id == instancemgr.selectedId ? 'portlet-section-selected' : (status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate')}">
<td>
- <img src="#{instance.portlet.smallIconLocation}" align="middle" style="margin:0 4px 0 0"/>
- <h:commandLink id="#{instance.id}" action="#{instancemgr.selectInstance}">
+ <img src="#{instance.portlet.smallIconLocation}" alt="icon" align="middle" style="margin:0 4px 0 0"/>
+ <h:commandLink id="#{instancemgr.idSanitizer[instance.id]}" action="#{instancemgr.selectInstance}">
<h:outputText value="#{instance.id}"/>
<f:param name="id" value="#{instance.id}"/>
<f:param name="plugin" value="info"/>
@@ -36,18 +36,18 @@
<td>
<h:outputText value="#{instance.displayName}"/>
</td>
- <td><h:commandLink id="security-#{instance.id}" action="#{instancemgr.selectInstance}" styleClass="actionSecurity">
+ <td><h:commandLink id="security-#{instancemgr.idSanitizer[instance.id]}" action="#{instancemgr.selectInstance}" styleClass="actionSecurity">
<f:param name="id" value="#{instance.id}"/>
<f:param name="plugin" value="security"/>
#{bundle.SECURITY}
</h:commandLink> | <h:panelGroup
rendered="#{! empty(instancemgr.selectedInstancesPrefs[instance.id])}">
- <h:commandLink id="preference-#{instance.id}"
+ <h:commandLink id="preference-#{instancemgr.idSanitizer[instance.id]}"
action="#{instancemgr.selectInstance}" styleClass="actionPreferences">
<f:param name="id" value="#{instance.id}"/>
<f:param name="plugin" value="preferences"/>
#{bundle.PREFERENCES}
- </h:commandLink> | </h:panelGroup><h:commandLink id="delete-#{instance.id}" action="confirmDeleteInstance"
+ </h:commandLink> | </h:panelGroup><h:commandLink id="delete-#{instancemgr.idSanitizer[instance.id]}" action="confirmDeleteInstance"
styleClass="actionDelete"
actionListener="#{instancemgr.selectInstance}">
<f:param name="id" value="#{instance.id}"/>
Added: branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java 2008-12-17 23:27:39 UTC (rev 12400)
@@ -0,0 +1,100 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.faces.util;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Collection;
+
+/**
+ * Allows to call a parameterized function in JSF EL expressions. See <a href="http://wiki.apache.org/myfaces/Parameters_In_EL_Functions">http://wiki.apache.org/myfaces/Parameters_In_EL_Functions</a>
+ * for more details. A better alternative would be to use JBoss-EL if it was available from the standard JBoss
+ * repository...
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public abstract class JSFFunctor implements Map
+{
+ public int size()
+ {
+ return 0;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return false;
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return false;
+ }
+
+ /**
+ * This is where the functor works. Subclasses need to implement the function logic here, the parameter being the
+ * specified parameter.
+ *
+ * @param parameter the value that will be used to compute the result of the function we want to implement
+ * @return the result of the funtion for the specified value
+ */
+ public abstract Object get(Object parameter);
+
+ public Object put(Object key, Object value)
+ {
+ return null;
+ }
+
+ public Object remove(Object key)
+ {
+ return null;
+ }
+
+ public void putAll(Map m)
+ {
+ }
+
+ public void clear()
+ {
+ }
+
+ public Set keySet()
+ {
+ return null;
+ }
+
+ public Collection values()
+ {
+ return null;
+ }
+
+ public Set entrySet()
+ {
+ return null;
+ }
+}
17 years, 5 months
JBoss Portal SVN: r12399 - in branches/JBoss_Portal_Branch_2_7: core-admin/src/main/org/jboss/portal/core/admin/ui and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-12-17 15:38:08 -0500 (Wed, 17 Dec 2008)
New Revision: 12399
Added:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/build.xml
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/instances.xhtml
Log:
- JBPORTAL-2264, JBPORTAL-2259: Added id sanitization before using them as HTML ids, users can still use names
with . or spaces... Display performance of instance list seems to suffer from it so should investigate
optimization.
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/build.xml 2008-12-17 19:44:06 UTC (rev 12398)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/build.xml 2008-12-17 20:38:08 UTC (rev 12399)
@@ -149,10 +149,10 @@
<pathelement location="${project.tools}/lib/explode.jar"/>
<path refid="apache.ant.classpath"/>
</path>
- <taskdef
- name="explode"
- classname="org.jboss.portal.common.ant.Explode"
- classpathref="explode.task.classpath"/>
+ <taskdef
+ name="explode"
+ classname="org.jboss.portal.common.ant.Explode"
+ classpathref="explode.task.classpath"/>
</target>
<!--+====================================================================+-->
@@ -189,7 +189,7 @@
<!-- portal-admin.war -->
<copy todir="${build.resources}/portal-admin-war/WEB-INF/lib">
- <fileset dir="${glassfish.jstl.lib}" includes="jstl.jar"/>
+ <fileset dir="${glassfish.jstl.lib}" includes="jstl.jar"/>
<fileset dir="${facelets.facelets.lib}" includes="jsf-facelets.jar"/>
<fileset dir="${jboss/portlet.bridge.lib}" includes="portletbridge-api.jar"/>
<fileset dir="${jboss/portlet.bridge.lib}" includes="portletbridge-impl.jar"/>
@@ -197,20 +197,20 @@
<fileset dir="${richfaces.richfaces.lib}" includes="richfaces-impl.jar"/>
<fileset dir="${richfaces.richfaces.lib}" includes="richfaces-ui.jar"/>
<fileset dir="${build.lib}" includes="portal-core-admin-lib.jar"/>
- <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-lib.jar"/>
+ <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-lib.jar"/>
<fileset dir="${apache.beanutils.lib}" includes="commons-beanutils.jar"/>
<fileset dir="${apache.digester.lib}" includes="commons-digester.jar"/>
<fileset dir="${apache.lang.lib}" includes="commons-lang.jar"/>
- </copy>
- <copy todir="${build.resources}/portal-admin-war">
- <fileset dir="${source.bin}/portal-admin-war"/>
- </copy>
+ </copy>
+ <copy todir="${build.resources}/portal-admin-war">
+ <fileset dir="${source.bin}/portal-admin-war"/>
+ </copy>
<!-- portal-admin.sar -->
<copy todir="${build.resources}/portal-admin.sar">
<fileset dir="${build.resources}/portal-admin-sar"/>
</copy>
<copy todir="${build.resources}/portal-admin.sar/lib">
- <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-loader-lib.jar"/>
+ <fileset dir="${jboss.portal-faces.root}/lib" includes="portal-faces-loader-lib.jar"/>
</copy>
<copy todir="${build.resources}/portal-admin.sar/portal-admin.war">
@@ -285,8 +285,8 @@
<target name="deploy-ha"
description="Deploy."
depends="output">
- <require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
- <copy file="${build.lib}/portal-admin.sar" todir="${jboss.home}/server/${portal-ha.deploy.dir}"
- overwrite="true"/>
- </target>
+ <require file="${jboss.home}/server/${portal-ha.deploy.dir}"/>
+ <copy file="${build.lib}/portal-admin.sar" todir="${jboss.home}/server/${portal-ha.deploy.dir}"
+ overwrite="true"/>
+ </target>
</project>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2008-12-17 19:44:06 UTC (rev 12398)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2008-12-17 20:38:08 UTC (rev 12399)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.admin.ui;
import org.jboss.portal.Mode;
+import org.jboss.portal.faces.util.JSFFunctor;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.instance.InstanceDefinition;
@@ -105,6 +106,20 @@
/** . */
private AuthorizationBean auth = new InstanceAuthorizationBean();
+ /** Removes white spaces from identifiers so that we can assign them to HTML id attributes. */
+ private JSFFunctor idSanitizer = new JSFFunctor()
+ {
+ public Object get(Object parameter)
+ {
+ if (parameter instanceof String)
+ {
+ String id = (String)parameter;
+ return id.replaceAll("\\W|\\.", "_");
+ }
+ return null;
+ }
+ };
+
// Services accessors
public RoleModule getRoleModule()
@@ -137,6 +152,16 @@
this.domainConfigurator = domainConfigurator;
}
+ /**
+ * Functor acccess to sanitize identifiers.
+ *
+ * @return
+ */
+ public JSFFunctor getIdSanitizer()
+ {
+ return idSanitizer;
+ }
+
// Navigational state accessor
public int getPaginationSize()
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/instances.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/instances.xhtml 2008-12-17 19:44:06 UTC (rev 12398)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/instances.xhtml 2008-12-17 20:38:08 UTC (rev 12399)
@@ -41,7 +41,8 @@
<td>
<img src="#{instance.portlet.smallIconLocation}" alt="icon" align="middle"
style="margin:0 4px 0 0"/>
- <h:commandLink id="#{instance.id}" action="#{instancemgr.selectInstance}">
+ <h:commandLink id="#{instancemgr.idSanitizer[instance.id]}"
+ action="#{instancemgr.selectInstance}">
<h:outputText value="#{instance.id}"/>
<f:param name="id" value="#{instance.id}"/>
<f:param name="plugin" value="info"/>
@@ -53,19 +54,21 @@
<td>
<h:panelGrid columns="7" cellpadding="0" cellspacing="0" border="0">
<h:commandLink action="#{instancemgr.selectInstance}" styleClass="actionSecurity"
- id="security-#{instance.id}">
+ id="security-#{instancemgr.idSanitizer[instance.id]}">
<f:param name="id" value="#{instance.id}"/>
<f:param name="plugin" value="security"/>
#{bundle.SECURITY}
</h:commandLink>
<h:commandLink rendered="#{! empty(instancemgr.selectedInstancesPrefs[instance.id])}"
- id="preference-#{instance.id}" action="#{instancemgr.selectInstance}"
+ id="preference-#{instancemgr.idSanitizer[instance.id]}"
+ action="#{instancemgr.selectInstance}"
styleClass="actionPreferences">
<f:param name="id" value="#{instance.id}"/>
<f:param name="plugin" value="preferences"/>
#{bundle.PREFERENCES}
</h:commandLink>
- <h:commandLink action="confirmDeleteInstance" id="delete-#{instance.id}"
+ <h:commandLink action="confirmDeleteInstance"
+ id="delete-#{instancemgr.idSanitizer[instance.id]}"
styleClass="actionDeleteInstance"
actionListener="#{instancemgr.selectInstance}">
<f:param name="id" value="#{instance.id}"/>
Added: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/util/JSFFunctor.java 2008-12-17 20:38:08 UTC (rev 12399)
@@ -0,0 +1,100 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.faces.util;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Collection;
+
+/**
+ * Allows to call a parameterized function in JSF EL expressions. See <a href="http://wiki.apache.org/myfaces/Parameters_In_EL_Functions">http://wiki.apache.org/myfaces/Parameters_In_EL_Functions</a>
+ * for more details. A better alternative would be to use JBoss-EL if it was available from the standard JBoss
+ * repository...
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public abstract class JSFFunctor implements Map
+{
+ public int size()
+ {
+ return 0;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return false;
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return false;
+ }
+
+ /**
+ * This is where the functor works. Subclasses need to implement the function logic here, the parameter being the
+ * specified parameter.
+ *
+ * @param parameter the value that will be used to compute the result of the function we want to implement
+ * @return the result of the funtion for the specified value
+ */
+ public abstract Object get(Object parameter);
+
+ public Object put(Object key, Object value)
+ {
+ return null;
+ }
+
+ public Object remove(Object key)
+ {
+ return null;
+ }
+
+ public void putAll(Map m)
+ {
+ }
+
+ public void clear()
+ {
+ }
+
+ public Set keySet()
+ {
+ return null;
+ }
+
+ public Collection values()
+ {
+ return null;
+ }
+
+ public Set entrySet()
+ {
+ return null;
+ }
+}
17 years, 5 months
JBoss Portal SVN: r12398 - branches/JBoss_Portal_Branch_2_7/build.
by portal-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2008-12-17 14:44:06 -0500 (Wed, 17 Dec 2008)
New Revision: 12398
Modified:
branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
Log:
fix cacuts dependency on apache logging
Modified: branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-12-17 16:06:16 UTC (rev 12397)
+++ branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2008-12-17 19:44:06 UTC (rev 12398)
@@ -77,7 +77,7 @@
<componentref name="httpunit" version="1.6"/>
<componentref name="hsqldb" version="1.8.0.8.patch01-brew"/>
<componentref name="ibm-wsdl4j" version="1.6.2"/>
- <componentref name="jakarta-cactus" version="1.7.2"/>
+ <componentref name="jakarta-cactus" version="1.7.2-portal"/>
<componentref name="jakarta-io" version="1.0"/>
<componentref name="jbossas/core-libs" version="4.0.4.GA"/>
<componentref name="jboss/aop" version="1.5.2.GA"/>
@@ -98,7 +98,7 @@
<componentref name="jsunit" version="2.1"/>
<componentref name="junit" version="3.8.2-brew"/>
<componentref name="odmg" version="3.0-brew"/>
- <componentref name="oswego-concurrent" version="1.3.4"/>
+ <!--<componentref name="oswego-concurrent" version="1.3.4"/>-->
<componentref name="qdox" version="1.6.1-brew"/>
<componentref name="trove" version="1.0.2-brew"/>
<componentref name="sleepycat" version="3.0.12"/>
17 years, 5 months