Author: thomas.heute(a)jboss.com
Date: 2008-05-21 04:46:06 -0400 (Wed, 21 May 2008)
New Revision: 10790
Added:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/catalog/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/role/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/user/
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/catalog/
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java
branches/JBoss_Portal_Branch_2_7/core-samples/.classpath
branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml
Log:
- Removed obsolete User and Role portlets
- Move Catalog portlet in core-samples
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2008-05-21
07:02:16 UTC (rev 10789)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -27,50 +27,6 @@
<portlet-app>
<portlet>
- <portlet-name>UserPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- <portlet-info>
- <icon>
- <small-icon>/images/portletIcon_Users.gif</small-icon>
- <large-icon>/images/portletIcon_Users.gif</large-icon>
- </icon>
- </portlet-info>
- </portlet>
- <portlet>
- <portlet-name>RolePortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- <header-content>
- <script type="text/javascript" language="javascript">
- function hideShow(id)
- {
- var navpoint = document.getElementById(id);
- if (navpoint.className == 'hidden') {
- navpoint.className = 'shown';
- } else {
- navpoint.className = 'hidden';
- }
- }
- </script>
- </header-content>
- <portlet-info>
- <icon>
- <small-icon>/images/portletIcon_Users.gif</small-icon>
- <large-icon>/images/portletIcon_Users.gif</large-icon>
- </icon>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>CatalogPortlet</portlet-name>
- <transaction>
- <trans-attribute>Required</trans-attribute>
- </transaction>
- </portlet>
- <portlet>
<portlet-name>PortletContentEditorPortlet</portlet-name>
<transaction>
<trans-attribute>RequiresNew</trans-attribute>
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2008-05-21
07:02:16 UTC (rev 10789)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet-instances.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -29,30 +29,6 @@
<deployments>
<deployment>
<instance>
- <display-name xml:lang="en">User portlet</display-name>
- <display-name xml:lang="fr">Portlet
utilisateur</display-name>
- <instance-id>UserPortletInstance</instance-id>
- <portlet-ref>UserPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
- <display-name xml:lang="en">Role portlet</display-name>
- <display-name xml:lang="fr">Portlet role</display-name>
- <instance-id>RolePortletInstance</instance-id>
- <portlet-ref>RolePortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
- <display-name xml:lang="en">Catalog
portlet</display-name>
- <display-name xml:lang="fr">Portlet
catalogue</display-name>
- <instance-id>CatalogPortletInstance</instance-id>
- <portlet-ref>CatalogPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
<instance-id>PortletContentEditorInstance</instance-id>
<portlet-ref>PortletContentEditorPortlet</portlet-ref>
<security-constraint>
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2008-05-21
07:02:16 UTC (rev 10789)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -28,89 +28,6 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
- <description>Portlet providing user login/logout and profile
management</description>
- <portlet-name>UserPortlet</portlet-name>
- <display-name>User Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.ui.portlet.user.UserPortlet</portlet-class>
- <init-param>
- <description>Whether we should use ssl on login and throughout the Portal.
1=yes;0=no</description>
- <name>useSSL</name>
- <value>0</value>
- </init-param>
- <init-param>
- <description>Subscription mode</description>
- <name>subscriptionMode</name>
- <value>automatic</value>
- <!--
- <value>emailVerification</value>
- -->
- </init-param>
- <init-param>
- <description>Domain of your website for email
verification.</description>
- <name>emailDomain</name>
- <value>JBoss.com</value>
- </init-param>
- <init-param>
- <description>Email displayed in the TO field</description>
- <name>emailFrom</name>
- <value>jbossportal(a)example.com</value>
- </init-param>
- <init-param>
- <description>Default role of registered users</description>
- <name>defaultRole</name>
- <value>User</value>
- </init-param>
- <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>User portlet</title>
- <keywords>management,admin</keywords>
- </portlet-info>
- <security-role-ref>
- <role-name>Admin</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <description>Portlet for managing user roles</description>
- <portlet-name>RolePortlet</portlet-name>
- <display-name>User Roles Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.ui.portlet.role.RolePortlet</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>Role management</title>
- <keywords>management,admin</keywords>
- </portlet-info>
- <security-role-ref>
- <role-name>Admin</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <description>Portlet providing navigable list of portal
pages</description>
- <portlet-name>CatalogPortlet</portlet-name>
- <display-name>Portal Pages Catalog Portlet</display-name>
-
<portlet-class>org.jboss.portal.core.ui.portlet.catalog.CatalogPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>Catalog</title>
- </portlet-info>
- </portlet>
- <portlet>
<description>Portlet Content Editor</description>
<portlet-name>PortletContentEditorPortlet</portlet-name>
<display-name>Portlet Content Editor</display-name>
Copied:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java
(from rev 10789,
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/user/UserPortletConstants.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/UserPortletConstants.java 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * 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.identity;
+
+/** @author <a href="theute(a)jboss.org">Thomas Heute</a> $Revision$
*/
+public class UserPortletConstants
+{
+
+ public static final String SALT = "14m1r0nm4n";
+
+ public static final String INFOMESSAGE = "infomessage";
+ public static final String ERRORMESSAGE = "errormessage";
+
+ // Cookie names
+ public static String CK_USERNAME = "username";
+ public static String CK_PASS = "password";
+
+ // Default values
+ public static int DEFAULT_USERSPERPAGE = 10;
+
+ // Status return codes for the login.
+ public static final int LOGIN_STATUS_OK = 0;
+ public static final int LOGIN_STATUS_BAD_PASSWORD = 1;
+ public static final int LOGIN_STATUS_NO_SUCH_USER = 2;
+ public static final int LOGIN_STATUS_USER_DISABLED = 3;
+ public static final int LOGIN_STATUS_INVALID_NAME = 4;
+ public static final int LOGIN_STATUS_UNEXPECTED_ERROR = 5;
+
+ public static final int PERMANENT_USER_MAX_INACTIVE = 60 * 60 * 24 * 5 * 1000; // 5
days in ms
+ public static final int TRANSIENT_USER_MAX_INACTIVE = 60 * 60; // 1 hours in seconds
+
+ public static final String HASH = "hash";
+ public static final String USERID = "userid";
+
+ // Portlet configuration
+
+ public static final String EMAILFROM = "emailFrom";
+ public static final String SUBSCRIPTIONMODE = "subscriptionMode";
+ public static final String SUBSCRIPTIONMODE_AUTOMATIC = "automatic";
+ public static final String SUBSCRIPTIONMODE_EMAILVERIFICATION =
"emailVerification";
+ public static final String DEFAULT_ROLE = "defaultRole";
+
+ /** Timezone information : ((value + 1) * 2) - 1 = 2 * value + 1 */
+ public static final String[] TIME_ZONE_OFFSETS =
+ {
+ "(GMT -12:00 hours) Eniwetok, Kwajalein",
+ null,
+ "(GMT -11:00 hours) Midway Island, Samoa",
+ null,
+ "(GMT -10:00 hours) Hawaii",
+ null,
+ "(GMT -9:00 hours) Alaska",
+ null,
+ "(GMT -8:00 hours) Pacific Time (US & Canada)",
+ null,
+ "(GMT -7:00 hours) Mountain Time (US & Canada)",
+ null,
+ "(GMT -6:00 hours) Central Time (US & Canada), Mexico City",
+ null,
+ "(GMT -5:00 hours) Eastern Time (US & Canada), Bogota, Lima,
Quito",
+ null,
+ "(GMT -4:00 hours) Atlantic Time (Canada), Caracas, La Paz",
+ "(GMT -3:30 hours) Newfoundland",
+ "(GMT -3:00 hours) Brazil, Buenos Aires, Georgetown",
+ null,
+ "(GMT -2:00 hours) Mid-Atlantic",
+ null,
+ "(GMT -1:00 hours) Azores, Cape Verde Islands",
+ null,
+ "(GMT) Western Europe Time, London, Lisbon, Casablanca, Monrovia",
+ null,
+ "(GMT +1:00 hours) CET(Central Europe Time), Brussels, Copenhagen, Madrid,
Paris",
+ null,
+ "(GMT +2:00 hours) EET(Eastern Europe Time), Kaliningrad, South
Africa",
+ null,
+ "(GMT +3:00 hours) Baghdad, Kuwait, Riyadh, Moscow, St. Petersburg",
+ "(GMT +3:30 hours) Tehran",
+ "(GMT +4:00 hours) Abu Dhabi, Muscat, Baku, Tbilisi",
+ "(GMT +4:30 hours) Kabul",
+ "(GMT +5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent",
+ "(GMT +5:30 hours) Bombay, Calcutta, Madras, New Delhi",
+ "(GMT +6:00 hours) Almaty, Dhaka, Colombo",
+ null,
+ "(GMT +7:00 hours) Bangkok, Hanoi, Jakarta",
+ null,
+ "(GMT +8:00 hours) Beijing, Perth, Singapore, Hong Kong, Chongqing, Urumqi,
Taipei",
+ null,
+ "(GMT +9:00 hours) Tokyo, Seoul, Osaka, Sapporo, Yakutsk",
+ "(GMT +9:30 hours) Adelaide, Darwin",
+ "(GMT +10:00 hours) EAST(East Australian Standard)",
+ null,
+ "(GMT +11:00 hours) Magadan, Solomon Islands, New Caledonia",
+ null,
+ "(GMT +12:00 hours) Auckland, Wellington, Fiji, Kamchatka, Marshall
Island",
+ null
+ };
+
+ public static final String DEFAULT_IMAGES_PATH = "images/user";
+}
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java 2008-05-21
07:02:16 UTC (rev 10789)
+++
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/components/StaticValues.java 2008-05-21
08:46:06 UTC (rev 10790)
@@ -34,7 +34,7 @@
import javax.portlet.PortletContext;
import org.jboss.portal.common.i18n.LocaleManager;
-import org.jboss.portal.core.ui.portlet.user.UserPortletConstants;
+import org.jboss.portal.core.identity.UserPortletConstants;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ThemeInfo;
import org.jboss.portal.theme.ThemeService;
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/.classpath
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/.classpath 2008-05-21 07:02:16 UTC (rev
10789)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/.classpath 2008-05-21 08:46:06 UTC (rev
10790)
@@ -16,5 +16,6 @@
<classpathentry kind="lib"
path="/thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-lib.jar"/>
<classpathentry kind="lib"
path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib"
path="/thirdparty/portlet/lib/portlet-api.jar"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/security"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-05-21 07:02:16 UTC (rev
10789)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-05-21 08:46:06 UTC (rev
10790)
@@ -126,6 +126,7 @@
<path refid="jboss.portal-core.classpath"/>
<path refid="jboss.portal-format.classpath"/>
<path refid="jboss.portal-api.classpath"/>
+ <path refid="jboss.portal-security.classpath"/>
</path>
<!--+=======================================+-->
@@ -219,6 +220,15 @@
<fileset dir="${build.classes}"
includes="org/jboss/portal/core/samples/jsp/**"/>
</jar>
+ <!-- portal-catalog-samples.war -->
+ <copy todir="${build.resources}/portal-catalog-samples.war">
+ <fileset dir="${build.resources}/portal-catalog-samples-war"/>
+ </copy>
+ <mkdir
dir="${build.resources}/portal-catalog-samples.war/WEB-INF/lib/"/>
+ <jar
jarfile="${build.resources}/portal-catalog-samples.war/WEB-INF/lib/portal-catalog-samples-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/core/samples/catalog/**"/>
+ </jar>
+
<!-- portal-news-samples.war -->
<copy todir="${build.resources}/portal-news-samples.war">
<fileset dir="${source.bin}/portal-news-samples-war"/>
@@ -272,6 +282,9 @@
dir="${build.resources}/portal-jsp-samples.war"
tofile="${build.lib}/portal-jsp-samples.war"/>
<implode
+ dir="${build.resources}/portal-catalog-samples.war"
+ tofile="${build.lib}/portal-catalog-samples.war"/>
+ <implode
dir="${build.resources}/portal-news-samples.war"
tofile="${build.lib}/portal-news-samples.war"/>
<implode
@@ -333,6 +346,8 @@
overwrite="true"/>
<copy file="${build.lib}/portal-jsp-samples.war"
todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
+ <copy file="${build.lib}/portal-catalog-samples.war"
todir="${jboss.home}/server/${portal.deploy.dir}"
+ overwrite="true"/>
<copy file="${build.lib}/portal-news-samples.war"
todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
<copy file="${build.lib}/portal-weather-samples.war"
todir="${jboss.home}/server/${portal.deploy.dir}"
@@ -349,9 +364,10 @@
<target name="undeploy"
description="Undeploy."
depends="init">
- <require file="${jboss.home}/server/${portal.deploy.dir}"/>
- <delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-basic-samples.sar"/>
+ <require file="${jboss.home}/server/${portal.deploy.dir}"/>
+ <delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-basic-samples.sar"/>
<delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-jsp-samples.war"/>
+ <delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-catalog-samples.war"/>
<delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-news-samples.war"/>
<delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-weather-samples.war"/>
<delete
file="${jboss.home}/server/${portal.deploy.dir}/portal-users-samples.sar"/>
Copied:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java
(from rev 10779,
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/ui/portlet/catalog/CatalogPortlet.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/catalog/CatalogPortlet.java 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,201 @@
+/******************************************************************************
+ * 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.samples.catalog;
+
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
+import org.jboss.portal.core.model.portal.PortalObjectPermission;
+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.PortletRequestDispatcher;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CatalogPortlet
+ extends JBossPortlet
+{
+ /** . */
+ private static final String RESOURCE_PREFIX = "PAGENAME_";
+
+ private PortalAuthorizationManagerFactory portalAuthorizationManagerFactory;
+
+ public void init() throws PortletException
+ {
+ portalAuthorizationManagerFactory =
(PortalAuthorizationManagerFactory)getPortletContext().getAttribute("PortalAuthorizationManagerFactory");
+
+ if (portalAuthorizationManagerFactory == null)
+ {
+ throw new PortletException("No portal authorization manager
factory");
+ }
+ }
+
+ public void destroy()
+ {
+ super.destroy();
+
+ portalAuthorizationManagerFactory = null;
+ }
+
+ public void render(JBossRenderRequest req, JBossRenderResponse resp) throws
IOException
+ {
+ resp.setContentType("text/html");
+
+ PortalNode current = req.getPortalNode();
+// WindowState ws = req.getWindowState();
+// if(WindowState.MAXIMIZED.equals(ws))
+// {
+// resp.setTitle("Sitemap");
+// PortalNode parent = current.getParent();
+// req.setAttribute("parentNode", parent);
+// try
+// {
+// PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/catalog/sitemap.jsp");
+// prd.include(req, resp);
+// }
+// catch(Exception e)
+// {
+// e.printStackTrace();
+// }
+// }
+// else
+// {
+ resp.setTitle("Pages");
+ PortalNode parent = current.getParent();
+
+ HashMap parentsMap = new HashMap();
+ PortalNode node = parent.getParent();
+ while (node.getType() != PortalNode.TYPE_PORTAL)
+ {
+ parentsMap.put(localize(req.getLocale(), node.getName()),
resp.createRenderURL(node));
+ node = node.getParent();
+ }
+ req.setAttribute("parents", parentsMap);
+
+ try
+ {
+ req.setAttribute("parentNode", localize(req.getLocale(),
parent.getName()));
+
+ HashMap parentChildMap = new HashMap();
+ HashMap parentSiblingMap = new HashMap();
+ for (Iterator i = parent.getParent().getChildren().iterator(); i.hasNext();)
+ {
+ PortalNode parentSibling = (PortalNode)i.next();
+
+ // Display only sibling pages
+ if (parentSibling.getType() == PortalNode.TYPE_PAGE)
+ {
+ if (parentSibling.equals(parent))
+ {
+ for (Iterator j = parent.getChildren().iterator(); j.hasNext();)
+ {
+ PortalNode child = (PortalNode)j.next();
+ if (child.getType() == PortalNode.TYPE_PAGE)
+ {
+ boolean allowed = false;
+ // check if the current user is allowed to access this page
+ if (child instanceof PortalNodeImpl)
+ {
+ PortalNodeImpl pn = (PortalNodeImpl)child;
+ PortalObjectPermission perm = new
PortalObjectPermission(pn.getObjectId(), PortalObjectPermission.VIEW_MASK);
+ if
(portalAuthorizationManagerFactory.getManager().checkPermission(perm))
+ {
+ allowed = true;
+ }
+ else
+ {
+ allowed = false;
+ }
+ }
+ if (allowed)
+ {
+ PortalNodeURL childURL = resp.createRenderURL(child);
+ parentChildMap.put(localize(req.getLocale(), child.getName()),
childURL);
+ }
+ }
+ }
+ }
+ else
+ {
+ boolean allowed = false;
+ // check if the current user is allowed to access this page
+ if (parentSibling instanceof PortalNodeImpl)
+ {
+ PortalNodeImpl pn = (PortalNodeImpl)parentSibling;
+ PortalObjectPermission perm = new
PortalObjectPermission(pn.getObjectId(), PortalObjectPermission.VIEW_MASK);
+ if
(portalAuthorizationManagerFactory.getManager().checkPermission(perm))
+ {
+ allowed = true;
+ }
+ else
+ {
+ allowed = false;
+ }
+ }
+ if (allowed)
+ {
+ PortalNodeURL parentSiblingURL =
resp.createRenderURL(parentSibling);
+ parentSiblingMap.put(localize(req.getLocale(),
parentSibling.getName()), parentSiblingURL);
+ }
+ }
+ }
+ }
+ req.setAttribute("pchild", parentChildMap);
+ req.setAttribute("psib", parentSiblingMap);
+
+ PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/catalog/index.jsp");
+ prd.include(req, resp);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+// }
+ }
+
+ private String localize(Locale locale, String name)
+ {
+ try
+ {
+ ResourceBundle rb = ResourceBundle.getBundle("conf.bundles.Resource",
locale, Thread.currentThread().getContextClassLoader());
+ name = rb.getString(RESOURCE_PREFIX + name);
+ }
+ catch (MissingResourceException e)
+ {
+ }
+ return name;
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-05-21
07:02:16 UTC (rev 10789)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -26,6 +26,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
+
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+
<filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>TestPortlet</portlet-name>
+ <portlet-name>ModePortlet</portlet-name>
+ </filter-mapping>
+
<portlet>
<description>Mode Portlet</description>
<portlet-name>ModePortlet</portlet-name>
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jboss-portlet.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,42 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <portlet>
+ <portlet-name>CatalogPortlet</portlet-name>
+ <transaction>
+ <trans-attribute>Required</trans-attribute>
+ </transaction>
+ </portlet>
+
+ <service>
+ <service-name>PortalAuthorizationManagerFactory</service-name>
+
<service-class>org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory</service-class>
+ <service-ref>:service=PortalAuthorizationManagerFactory</service-ref>
+ </service>
+
+</portlet-app>
\ No newline at end of file
Copied:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/jsp/catalog
(from rev 10779,
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-war/WEB-INF/jsp/catalog)
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portal-lib.tld 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,104 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<taglib
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+ <tlib-version>1.1</tlib-version>
+ <short-name>JBoss-Portal-tags</short-name>
+
+ <tag>
+ <name>if</name>
+ <tag-class>org.jboss.portal.core.servlet.jsp.taglib.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>ctx</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>iterate</name>
+
<tag-class>org.jboss.portal.core.servlet.jsp.taglib.IterateTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>ctx</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>include</name>
+
<tag-class>org.jboss.portal.core.servlet.jsp.taglib.IncludeTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>page</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>error</name>
+
<tag-class>org.jboss.portal.core.servlet.jsp.taglib.ErrorTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <name>key</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>errors</name>
+
<tag-class>org.jboss.portal.core.servlet.jsp.taglib.ErrorsTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <name>success</name>
+
<tag-class>org.jboss.portal.core.servlet.jsp.taglib.SuccessTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+ <function>
+ <name>i18n</name>
+
<function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+ <function-signature>java.lang.String
getMessage(java.lang.String)</function-signature>
+ </function>
+
+ <function>
+ <name>out</name>
+
<function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+ <function-signature>java.lang.String
out(java.lang.String)</function-signature>
+ </function>
+
+ <function>
+ <name>i18nout</name>
+
<function-class>org.jboss.portal.core.servlet.jsp.taglib.PortalLib</function-class>
+ <function-signature>java.lang.String
i18nOut(java.lang.String)</function-signature>
+ </function>
+
+</taglib>
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet-instances.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,38 @@
+<?xml version="1.0" standalone="yes"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+
+<deployments>
+ <deployment>
+ <instance>
+ <display-name xml:lang="en">Catalog
portlet</display-name>
+ <display-name xml:lang="fr">Portlet
catalogue</display-name>
+ <instance-id>CatalogPortletInstance</instance-id>
+ <portlet-ref>CatalogPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/portlet.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app
+
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <filter>
+ <filter-name>JBoss Portlet Filter</filter-name>
+
<filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBoss Portlet Filter</filter-name>
+ <portlet-name>CatalogPortlet</portlet-name>
+ </filter-mapping>
+
+ <portlet>
+ <description>Portlet providing navigable list of portal
pages</description>
+ <portlet-name>CatalogPortlet</portlet-name>
+ <display-name>Portal Pages Catalog Portlet</display-name>
+
<portlet-class>org.jboss.portal.core.samples.catalog.CatalogPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Catalog</title>
+ </portlet-info>
+ </portlet>
+ </portlet-app>
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml 2008-05-21
08:46:06 UTC (rev 10790)
@@ -0,0 +1,28 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+</web-app>
Property changes on:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-catalog-samples-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *