JBoss Portal SVN: r7551 - in trunk/core-samples: src/bin and 22 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 11:22:59 -0400 (Tue, 26 Jun 2007)
New Revision: 7551
Added:
trunk/core-samples/src/bin/portal-jsp-samples-war/
trunk/core-samples/src/bin/portal-jsp-samples-war/images/
trunk/core-samples/src/bin/portal-jsp-samples-war/images/accessorize.gif
trunk/core-samples/src/bin/portal-jsp-samples-war/images/dodemo.gif
trunk/core-samples/src/bin/portal-jsp-samples-war/images/getcode.gif
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/EventPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/
trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/
trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/news/
trunk/core-samples/src/main/org/jboss/portal/core/samples/news/NewsPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/samples/weather/
trunk/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java
trunk/core-samples/src/resources/portal-jsp-samples-war/
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml
trunk/core-samples/src/resources/portal-news-samples-war/
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/jsp/
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/jsp/news/
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/jsp/news/edit.jsp
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml
trunk/core-samples/src/resources/portal-weather-samples-war/
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/jsp/
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/jsp/weather/
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/jsp/weather/edit.jsp
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml
Removed:
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/news/edit.jsp
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/weather/edit.jsp
Modified:
trunk/core-samples/build.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
make the samples more consistent
Modified: trunk/core-samples/build.xml
===================================================================
--- trunk/core-samples/build.xml 2007-06-26 13:42:32 UTC (rev 7550)
+++ trunk/core-samples/build.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -191,31 +191,21 @@
<mkdir dir="${build.lib}"/>
- <!-- portal-core-samples-lib.jar -->
+ <!-- portal-basic-samples-lib.jar -->
<jar jarfile="${build.lib}/portal-basic-samples-lib.jar">
- <fileset dir="${build.classes}">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/core/portlet/basic/**">
</fileset>
</jar>
-
- <!-- portal-samples.sar -->
<copy todir="${build.resources}/portal-basic-samples">
<fileset dir="${build.resources}/portal-basic-samples-sar"/>
</copy>
-
- <!-- portal-samples.war -->
<copy todir="${build.resources}/portal-samples/portal-basic-samples.war">
<fileset dir="${source.bin}/portal-basic-samples-war"/>
<fileset dir="${build.resources}/portal-basic-samples-war"/>
</copy>
-
- <!-- -->
<copy todir="${build.resources}/portal-basic-samples/lib">
<fileset dir="${build.lib}" includes="portal-basic-samples-lib.jar"/>
</copy>
- </target>
-
- <!-- Build the portal-basic-samples.sar -->
- <target name="output" depends="artifacts">
<copy todir="${build.resources}/portal-basic-samples.sar">
<fileset dir="${build.resources}/portal-basic-samples" excludes="**/*.xml"/>
</copy>
@@ -225,9 +215,51 @@
</filterset>
<fileset dir="${build.resources}/portal-basic-samples" includes="**/*.xml"/>
</copy>
- <implode
- dir="${build.resources}/portal-basic-samples.sar"
- tofile="${build.lib}/portal-basic-samples.sar"/>
+
+ <!-- portal-jsp-samples.war -->
+ <copy todir="${build.resources}/portal-jsp-samples.war">
+ <fileset dir="${source.bin}/portal-jsp-samples-war"/>
+ <fileset dir="${build.resources}/portal-jsp-samples-war"/>
+ </copy>
+ <mkdir dir="${build.resources}/portal-jsp-samples.war/WEB-INF/lib/"/>
+ <jar jarfile="${build.resources}/portal-jsp-samples.war/WEB-INF/lib/portal-jsp-samples-lib.jar">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/jsp/**"/>
+ </jar>
+
+ <!-- portal-news-samples.war -->
+ <copy todir="${build.resources}/portal-news-samples.war">
+ <fileset dir="${build.resources}/portal-news-samples-war"/>
+ </copy>
+ <mkdir dir="${build.resources}/portal-news-samples.war/WEB-INF/lib/"/>
+ <jar jarfile="${build.resources}/portal-news-samples.war/WEB-INF/lib/portal-news-samples-lib.jar">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/news/**"/>
+ </jar>
+
+ <!-- portal-weather-samples.war -->
+ <copy todir="${build.resources}/portal-weather-samples.war">
+ <fileset dir="${build.resources}/portal-weather-samples-war"/>
+ </copy>
+ <mkdir dir="${build.resources}/portal-weather-samples.war/WEB-INF/lib/"/>
+ <jar jarfile="${build.resources}/portal-weather-samples.war/WEB-INF/lib/portal-weather-samples-lib.jar">
+ <fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/weather/**"/>
+ </jar>
+
+ </target>
+
+ <!-- Build the portal-basic-samples.sar -->
+ <target name="output" depends="artifacts">
+ <implode
+ dir="${build.resources}/portal-basic-samples.sar"
+ tofile="${build.lib}/portal-basic-samples.sar"/>
+ <implode
+ dir="${build.resources}/portal-jsp-samples.war"
+ tofile="${build.lib}/portal-jsp-samples.war"/>
+ <implode
+ dir="${build.resources}/portal-news-samples.war"
+ tofile="${build.lib}/portal-news-samples.war"/>
+ <implode
+ dir="${build.resources}/portal-weather-samples.war"
+ tofile="${build.lib}/portal-weather-samples.war"/>
</target>
<!-- create artifacts for running the portlet tests (except TCK) target output should have already been executed -->
Added: trunk/core-samples/src/bin/portal-jsp-samples-war/images/accessorize.gif
===================================================================
--- trunk/core-samples/src/bin/portal-jsp-samples-war/images/accessorize.gif (rev 0)
+++ trunk/core-samples/src/bin/portal-jsp-samples-war/images/accessorize.gif 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,23 @@
+GIF89aP
+
+L��������)1o��;�|��j�����w7���҈��6em�خ��:u�h�����V��&v�^M$8��TT~��Պ-���S��0g�$�B�ګ��������tDaS[�J3)y .��S\���T��
+ �S�����������XX�//}��_�"�i!0�=e��3A}��������.a���A��������� 2���ȋ��w����=b�������i'n~®���pp��D�Xc���lɱ$�^ ���B1�X��ahu[1/o_����_b�<wMMN���$?�MOy�����������p�������z��)m������ ����������\d��
+u�Xϣ=+�aQ�Pu�Դ*��Q���u��U�:��4f�(Rd�V}Z�B(\�j�Ņ,g�
+,@@3��&�@BuL(���)��?�RNju�� is�
+T�IdsG��J���bH&�d��`1� ���"W*�4q�1)dॗD~)���(
+��@0����2�B^���Js"�)��2L{d�qjl�� O@H"��a�*�k��Y�$M*��ӎ
+��`��7�����3RpB�8C��1-�/>���PG
+�P+bh���YK"G$���Y��̼!��X0��X�6,/�,\o-�'V`����
+D7���?ar�"���$/����\�
+,8��7���8[�
+����=��C���BE3��$v� �/���K!����8₡��T
+\�Q�a'?�l~� 4���h�3�nhC�A"n�@���0���e8�
+�Uf��E�A�c` q�(�p�%p@B|@�<�ЋG@� $.h�1�X
+o�A�R�$� ��ʹ"���I��^0����+�b�BP�[����F6�
+KL"{�<`@@>�A
+y@� ���mT�;,|B"�xp�@k��K\G#
+ң��^D�Rq�b� F
+��$F1
+���@�@-�IZx��X�5����@��� �H@���b+��� q((�����1%AqF�
+� y����kX�ߐ0��[�*o"�w��ċA��X;Z�*$"P���0TИ��<.� 6q�#��u;|8�\
+da.p�F}
\ No newline at end of file
Added: trunk/core-samples/src/bin/portal-jsp-samples-war/images/dodemo.gif
===================================================================
--- trunk/core-samples/src/bin/portal-jsp-samples-war/images/dodemo.gif (rev 0)
+++ trunk/core-samples/src/bin/portal-jsp-samples-war/images/dodemo.gif 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,22 @@
+GIF89aP
+�S
+�Cddo�y��om�������܅�����K�����/f�l1W�f��0M����������e��������p�����@P�������E��h�iii������/K�����,���������tttsU��&�����T�������ꬬ�Ut����<BY�����'��Ꞷ������EE�����������Fz�Q�����q�����3C����>>>p����� 2����^���z�$3����NYn�����X��������|�Ј��������7���p��E�ڞ��hI{+����F�����m�؏�����,=�Cb�-c�v�����������������
+�\O������M`�~}�2^ܧ�1"�ɞ��7�zʵ���Q�EzP�5V���-�`�o� �.Z$��s*$8߂`���,�B�%A���y�m�އ!�7�e��AXԷb�@I�H&�eX#.*�^�"�h�?f
+��&��\qE*o���HdщMs��E(d6�$������S�yI���h�"a�UR/��}�����W�Ih��*˨�jd�4�`L:<���m4��@ ��a姸n������+L^��G�G �F�l���G>�R{E��^���������4l�L�AtrA)�`��R��D��#ں��!g����1�)� ��1+�$'�p�<|m��2q�$1"A!>�L�d��:5�Nd���)�|s� ������b2@����*
+{L@K)("��8��(��!�H�K�0B�u̇���.��@�P�C~�(��2A.���(T�)}��
+�ų��*����>�CF��3�����1�h�͢�����@Р�x�.�7�!Hov��!`0�HD#��B�A��`Q���T��c ����*A�1��UB�������?r�KL�
+�$��0�' ��������8��
+Af0�%�h�@�p�?��(H�V�(_�G�Ѯ����PH+�B�HP':q @��?
+�#��@C'c�GQ����c
+e�JɕB�p�b)NYIq�������Q��PLQ���4e�i��;E!�M�P?`����qx�>�4�i�c>�w(�����4��U!h�DUP�]�
+���@�jT�ޤ*�����<hB��N�@��)f*��6 8�i����0��(���R�� ��ĥ�F�0<X��X���:%x[����
+# ���0<�é#�D9�p"�c
+A"� ܈�:�'
+�M�z������D
+h!(�^P,�%B���������
+���@C��@
+è�&L�
+[����
+�
+��~
+��iD�c ��t���HS�Ҝ�t�EMjGWԑ���3=�S��~v5� "�U�։a5�-}�[�מ���M�b;
\ No newline at end of file
Added: trunk/core-samples/src/bin/portal-jsp-samples-war/images/getcode.gif
===================================================================
--- trunk/core-samples/src/bin/portal-jsp-samples-war/images/getcode.gif (rev 0)
+++ trunk/core-samples/src/bin/portal-jsp-samples-war/images/getcode.gif 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,28 @@
+GIF89aP
+�
+������v����������h}{������(()yz�������&8&��듛����P^����p|� 2����NOY��ݼӼ����uz�������W�_���DXM�����蘘�mpZ���[�[�����매����!�!tw����9 //4�����������ӽ��Zc�����������7�>oo}!����
+ȗE<�ß͛8c�H��χPp
+�MϟH��fiےJ-��)S#�Z���W�|�.��/���4�N� �$�;���9fZ"V�M Ϡ�QCJ4�"� ��*NF�&@���3 ��0! ϩSxZ��BD��
+��ú�k:�a�Zb�rAs���C�ȗ &�{F��2e����s\`,[@�v� D�|�3� ���U��d:�2��SYO�����@���
+���Q0���``��2���!F��,��)m
+�(0�܀�!'Ti�Xb *{`S�<ı&*�4C��t�N�P�!m�Y�\tm O�t�(&X@D���9�ix@!���"���� TZ���E!�̂J}8�$�Y�B
+h
+��/�X��\ �2��VXqŭW8��#l��.!��G�PDw���F�8���8�@`���`E(-d;ƶc��b`C�
+��)�%� �M�,��6�
+�M7v{��&B�#D��@�)�!�9�C��$l��⤛��]4��&�䰆 ����7㎓��"G3^�㨟�E�4��&����|�y���dDY q=���z�Q��L�tK-��C$ԇ�m��lL��~��,�A~��G���OM��9�
++)�@���&��H�$�I�`
+q�@%6�~���@>� ��x��p,Ԣ�
+�����9:Q�N"٘��2��<����1J@���ȅX�\\��p�,�)�\`��p�
+`����'}
+p)��L���B���
+>��5oZ'X3�@5�W�SM(�9φ�b��+m`�$�͟���3� Pg�@��-j QXƲ�
+eFz���68�2�I?��6��36z� �p$C��o`*8�"*0�]��3�/@Qya9թ`�i�!���Xc�^���8�$�A��3�@�N��A�"?��L@Ѿj
+��eN�?���M�r�k��:��{��t��|��a���;TB�
+�x���W���z^l�>8≌�
+I(`��o~G����������<`�q�E:�.��� �$��i��R� �S�p*Ha��� v���#p� �0�`P���f�,���@ �Q�pLa� �<.�YOxBkH2t93=A����Q
+�8r��'89�C��/R!�,C�H�&��
+9D�u8�'��((أ(�1�X�B �\Yd(v��%F}�s�@
+�+91 �o�z�ߘ%
+��
+\�`�g v�^�!����-
+��"�$�����v����n��1������$���~���
\ No newline at end of file
Added: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/EventPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/EventPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/EventPortlet.java 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.core.portlet.basic.event;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.UnavailableException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ */
+public class EventPortlet extends GenericPortlet
+{
+ private static final String JSP_PATH = "/WEB-INF/jsp/event";
+
+ protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
+ {
+ rResponse.setContentType("text/html");
+ javax.portlet.PortletRequestDispatcher pRD = this.getPortletContext().getRequestDispatcher(JSP_PATH + "/view.jsp");
+ pRD.include(rRequest, rResponse);
+ }
+}
Added: trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.core.samples.jsp;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.UnavailableException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ */
+public class JSPPortlet extends GenericPortlet
+{
+ private static final String JSP_PATH = "/WEB-INF/jsp/info";
+
+ protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
+ {
+ rResponse.setContentType("text/html");
+ javax.portlet.PortletRequestDispatcher pRD = this.getPortletContext().getRequestDispatcher(JSP_PATH + "/view.jsp");
+ pRD.include(rRequest, rResponse);
+ }
+}
\ No newline at end of file
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/samples/jsp/JSPPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core-samples/src/main/org/jboss/portal/core/samples/news/NewsPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/news/NewsPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/samples/news/NewsPortlet.java 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,250 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+
+package org.jboss.portal.core.samples.news;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+
+/**
+ * Adapted from JBoss Weather Portlet to deal with RSS News Feeds using RSS 1.0 or RSS 2.0 format.
+ *
+ * @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ */
+public class NewsPortlet extends GenericPortlet
+{
+ /**
+ * Logger
+ */
+ public static Logger log = Logger.getLogger(NewsPortlet.class);
+
+ /**
+ * Edit page
+ */
+ private static final String JSP_EDIT = "/WEB-INF/jsp/news/edit.jsp";
+
+ /**
+ * RSS 2.0 XSL page for output
+ */
+ private static final String RSS2_XSL = "/WEB-INF/xsl/news/Rss2.xsl";
+
+ /**
+ * RSS 1.0 XSL page for output
+ */
+ private static final String RSS1_XSL = "/WEB-INF/xsl/news/Rss1.xsl";
+
+ /**
+ * Compiled Template for output RSS 2.0
+ */
+ private Templates template_2_0;
+
+ /**
+ * Compiled Template for output RSS 1.0
+ */
+ private Templates template_1_0;
+
+ /**
+ * Base URL of News RSS
+ */
+ private String RSS_URL;
+
+ private static final String E_XSL_UNREADABLE = "Unable to prepare XSL files.";
+ private static final String E_UNREADABLE = "Unable to read XML Source.";
+ private static final String E_UNPARSEABLE = "Unable to parse XML Source.";
+
+ /**
+ * Compile the XSL File.
+ */
+ public void init()
+ {
+ try
+ {
+ InputStream inputstream_2 = getPortletContext().getResourceAsStream(NewsPortlet.RSS2_XSL);
+ StreamSource xslSource_2 = new StreamSource(inputstream_2);
+ TransformerFactory tFactory_2 = TransformerFactory.newInstance();
+ this.template_2_0 = tFactory_2.newTemplates(xslSource_2);
+
+ InputStream inputstream_1 = getPortletContext().getResourceAsStream(NewsPortlet.RSS1_XSL);
+ StreamSource xslSource_1 = new StreamSource(inputstream_1);
+ TransformerFactory tFactory_1 = TransformerFactory.newInstance();
+ this.template_1_0 = tFactory_1.newTemplates(xslSource_1);
+
+ this.RSS_URL = getInitParameter("base_url");
+ }
+ catch(TransformerConfigurationException tce)
+ {
+ log.error(E_XSL_UNREADABLE, tce);
+ }
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ response.setProperty("expiration-cache", request.getPreferences().getValue("expires", "180"));
+
+ InputStream xmlInputStream = null;
+ InputStream xslInputStream = null;
+
+ String newURL = null;
+ try
+ {
+ newURL = request.getParameter("newurl");
+ response.setContentType("text/html");
+
+ if(null == newURL)
+ {
+ newURL = request.getPreferences().getValue("RssXml", RSS_URL);
+ }
+
+ xmlInputStream = new URL(newURL).openStream();
+ if(xmlInputStream == null)
+ {
+ log.error(E_UNREADABLE);
+ throw new PortletException(E_UNREADABLE);
+ }
+
+ // Ready the parsers
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+ Transformer transformer = this.template_2_0.newTransformer();
+
+ Source xmlSource = null;
+ try
+ {
+ Document document = docBuilder.parse(xmlInputStream);
+ transformer = this.template_2_0.newTransformer();
+ xmlSource = new DOMSource(document);
+
+ // added 1.0 check
+ Element element = document.getDocumentElement();
+ if(element.hasAttribute("version") && element.getAttribute("version").equals("1.0"))
+ {
+ transformer = this.template_1_0.newTransformer();
+ }
+ }
+ catch(TransformerConfigurationException tce)
+ {
+ log.error(E_UNPARSEABLE, tce);
+ throw new PortletException(E_UNPARSEABLE, tce);
+ }
+
+ // Transform document
+ PrintWriter writer = response.getWriter();
+ StreamResult outStream = new StreamResult(writer);
+ transformer.transform(xmlSource, outStream);
+ }
+ catch(Exception e)
+ {
+ log.error("Fatal Error reading/parsing XML Source.",e);
+ PrintWriter writer = response.getWriter();
+ writer.write("Failed to retrieve News Feed!");
+ writer.close();
+ }
+ finally // close all streams
+ {
+ if(xmlInputStream != null)
+ {
+ xmlInputStream.close();
+ }
+
+ if(xslInputStream != null)
+ {
+ xslInputStream.close();
+ }
+ }
+ }
+
+ /**
+ * Allow edit of RSS Feed.
+ *
+ * @param request
+ * @param response
+ * @throws java.io.IOException
+ * @throws javax.portlet.PortletException
+ */
+ protected void doEdit(RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(JSP_EDIT);
+ dispatcher.include(request, response);
+ }
+
+ /**
+ * Process RSS Feed edit.
+ *
+ * @param request
+ * @param response
+ * @throws javax.portlet.PortletException
+ */
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException
+ {
+ String newURL = request.getParameter("newurl");
+
+ if(null != newURL)
+ {
+ PortletPreferences prefs = request.getPreferences();
+ try
+ {
+ if(!prefs.isReadOnly("RssXml"))
+ {
+ prefs.setValue("RssXml", newURL);
+ prefs.store();
+ }
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ //store as the selected xml so that it shows up selected as displays
+ response.setRenderParameter("newurl", newURL);
+
+ //set the portlet mode back to view
+ response.setPortletMode(PortletMode.VIEW);
+ }
+}
\ No newline at end of file
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/samples/news/NewsPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,231 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.core.samples.weather;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+
+/**
+ * Simple weather portlet that redads Yahoo RSS Weather feeds and uses XSLT for presentation.
+ *
+ * @author <a href="mailto:roy@jboss.org">Roy Russo</a>
+ */
+public class WeatherPortlet extends GenericPortlet
+{
+ /**
+ * Logger
+ */
+ public static Logger log = Logger.getLogger(WeatherPortlet.class);
+
+ /**
+ * Edit page
+ */
+ private static final String JSP_EDIT = "/WEB-INF/jsp/weather/edit.jsp";
+
+ /**
+ * Default zip set in init param.
+ */
+ private String DEFAULT_ZIP;
+
+ /**
+ * RSS 2.0 XSL page for output
+ */
+ private static final String RSS_XSL = "/WEB-INF/xsl/weather/Rss.xsl";
+
+ /**
+ * Compiled Template for output
+ */
+ private Templates template_2_0;
+
+ /**
+ * Base URL of Weather RSS
+ */
+ private String RSS_URL_PREFIX;
+
+ private static final String E_XSL_UNREADABLE = "Unable to prepare XSL files.";
+ private static final String E_UNREADABLE = "Unable to read XML Source.";
+ private static final String E_UNPARSEABLE = "Unable to parse XML Source.";
+
+ /**
+ * Compile the XSL File.
+ */
+ public void init()
+ {
+ try
+ {
+ InputStream inputstream = getPortletContext().getResourceAsStream(WeatherPortlet.RSS_XSL);
+ StreamSource xslSource = new StreamSource(inputstream);
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ this.template_2_0 = tFactory.newTemplates(xslSource);
+
+ this.DEFAULT_ZIP = getInitParameter("default_zipcode");
+ this.RSS_URL_PREFIX = getInitParameter("base_url");
+ }
+ catch(TransformerConfigurationException tce)
+ {
+ log.error(E_XSL_UNREADABLE, tce);
+ }
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ response.setProperty("expiration-cache", request.getPreferences().getValue("expires", "180"));
+
+ InputStream xmlInputStream = null;
+ InputStream xslInputStream = null;
+
+ String newZip = null;
+ try
+ {
+ newZip = request.getParameter("newzip");
+ response.setContentType("text/html");
+
+ if(null == newZip)
+ {
+ newZip = request.getPreferences().getValue("RssXml", RSS_URL_PREFIX + DEFAULT_ZIP);
+ }
+
+ xmlInputStream = new URL(newZip).openStream();
+ if(xmlInputStream == null)
+ {
+ log.error(E_UNREADABLE);
+ throw new PortletException(E_UNREADABLE);
+ }
+
+ // Ready the parsers
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+ Transformer transformer = this.template_2_0.newTransformer();
+
+ Source xmlSource = null;
+ try
+ {
+ Document document = docBuilder.parse(xmlInputStream);
+ transformer = this.template_2_0.newTransformer();
+ xmlSource = new DOMSource(document);
+ }
+ catch(TransformerConfigurationException tce)
+ {
+ log.error(E_UNPARSEABLE, tce);
+ throw new PortletException(E_UNPARSEABLE, tce);
+ }
+
+ // Transform document
+ PrintWriter writer = response.getWriter();
+ StreamResult outStream = new StreamResult(writer);
+ transformer.transform(xmlSource, outStream);
+ }
+ catch(Exception e)
+ {
+ log.error("Fatal Error reading/parsing XML Source.",e);
+ PrintWriter writer = response.getWriter();
+ writer.write("Failed to retrieve Weather Feed!");
+ writer.close();
+ }
+ finally // close all streams
+ {
+ if(xmlInputStream != null)
+ {
+ xmlInputStream.close();
+ }
+
+ if(xslInputStream != null)
+ {
+ xslInputStream.close();
+ }
+ }
+ }
+
+ /**
+ * Allow edit of weather location.
+ *
+ * @param request
+ * @param response
+ * @throws IOException
+ * @throws PortletException
+ */
+ protected void doEdit(RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(JSP_EDIT);
+ dispatcher.include(request, response);
+ }
+
+ /**
+ * Process weather location edit and store in user preferences.
+ *
+ * @param request
+ * @param response
+ * @throws PortletException
+ */
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException
+ {
+ String newZip = request.getParameter("newzip");
+
+ if(null != newZip)
+ {
+ PortletPreferences prefs = request.getPreferences();
+ try
+ {
+ prefs.setValue("RssXml", RSS_URL_PREFIX + newZip);
+ prefs.store();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ // TODO: error checking for URL + NewZIP
+
+ //store as the selected xml so that it shows up selected as displays
+ response.setRenderParameter("newzip", RSS_URL_PREFIX + newZip);
+
+ //set the portlet mode back to view
+ response.setPortletMode(PortletMode.VIEW);
+ }
+}
\ No newline at end of file
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/samples/weather/WeatherPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2007-06-26 13:42:32 UTC (rev 7550)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -66,15 +66,6 @@
<portlet-name>SecuredTestPortlet</portlet-name>
</portlet>
<portlet>
- <portlet-name>WeatherPortlet</portlet-name>
- </portlet>
- <portlet>
- <portlet-name>NewsPortlet</portlet-name>
- </portlet>
- <portlet>
- <portlet-name>JSPPortlet</portlet-name>
- </portlet>
- <portlet>
<portlet-name>TestPortlet</portlet-name>
</portlet>
<portlet>
Deleted: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/news/edit.jsp
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/news/edit.jsp 2007-06-26 13:42:32 UTC (rev 7550)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/news/edit.jsp 2007-06-26 15:22:59 UTC (rev 7551)
@@ -1,37 +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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-
-<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-<%@ page isELIgnored="false" %>
-
-<portlet:defineObjects/>
-
-<div align="center">
- <br/>
- <font class="portlet-font">Change News Feed URL:</font>
- <form method="post" action="
-<portlet:actionURL></portlet:actionURL>">
- <input class="portlet-form-input-field" type="text" value="<%= renderRequest.getPreferences().getValue("RssXml", "") %>" size="25" name="newurl">
- <input class="portlet-form-button" type="submit" name="submit" value="submit">
- </form>
-</div>
\ No newline at end of file
Deleted: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/weather/edit.jsp
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/weather/edit.jsp 2007-06-26 13:42:32 UTC (rev 7550)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/weather/edit.jsp 2007-06-26 15:22:59 UTC (rev 7551)
@@ -1,40 +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. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-
-<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-<%@ page isELIgnored="false" %>
-
-<portlet:defineObjects/>
-
-<div align="center">
- <br/>
- <font class="portlet-font">Change Weather Location:</font>
-
- <form method="post" action="
-<portlet:actionURL></portlet:actionURL>">
- <font class="portlet-font">Zip Code:</font><br/>
- <input class="portlet-form-input-field" type="text" value="" size="12" name="newzip">
- <br/>
- <input class="portlet-form-input-field" type="submit" name="submit" value="submit">
- </form>
-</div>
\ No newline at end of file
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 13:42:32 UTC (rev 7550)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -27,52 +27,14 @@
"http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
-<!--
<deployment>
<instance>
- <instance-id>JSPPortletInstance</instance-id>
- <portlet-ref>JSPPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <instance>
<instance-id>EventPortletInstance</instance-id>
<portlet-ref>EventPortlet</portlet-ref>
</instance>
</deployment>
<deployment>
<instance>
- <instance-id>NewsPortletInstance</instance-id>
- <portlet-ref>NewsPortlet</portlet-ref>
- </instance>
- </deployment>
- <deployment>
- <if-exists>overwrite</if-exists>
- <instance>
- <instance-id>NewsPortletInstance2</instance-id>
- <portlet-ref>NewsPortlet</portlet-ref>
- <preferences>
- <preference>
- <name>expires</name>
- <value>180</value>
- </preference>
- <preference>
- <name>RssXml</name>
- <value>http://finance.yahoo.com/rss/headline?s=rhat</value>
- </preference>
- </preferences>
- </instance>
- </deployment>
- <deployment>
- <instance>
- <instance-id>WeatherPortletInstance</instance-id>
- <portlet-ref>WeatherPortlet</portlet-ref>
- </instance>
- </deployment>
--->
-
- <deployment>
- <instance>
<instance-id>HeaderContentPortletInstance</instance-id>
<portlet-ref>HeaderContentPortlet</portlet-ref>
</instance>
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-06-26 13:42:32 UTC (rev 7550)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -27,25 +27,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0">
-<!--
<portlet>
- <description>Simple JSP portlet</description>
- <portlet-name>JSPPortlet</portlet-name>
- <display-name>JSP Portlet</display-name>
- <portlet-class>org.jboss.samples.portlet.jsp.JSPPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- </supports>
- <portlet-info>
- <title>Greetings!</title>
- <keywords>sample,test</keywords>
- </portlet-info>
- </portlet>
--->
-
-<!--
- <portlet>
<description>Event Portlet</description>
<portlet-name>EventPortlet</portlet-name>
<display-name>Event Portlet</display-name>
@@ -59,8 +41,6 @@
<keywords>event, sample,test</keywords>
</portlet-info>
</portlet>
--->
-
<portlet>
<description>Portlet to test modification of head content</description>
<portlet-name>HeaderContentPortlet</portlet-name>
@@ -246,92 +226,7 @@
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
-<!--
<portlet>
- <description>Portlet providing weather forecast</description>
- <portlet-name>WeatherPortlet</portlet-name>
- <display-name>Weather Portlet</display-name>
- <portlet-class>org.jboss.samples.portlet.weather.WeatherPortlet</portlet-class>
- <init-param>
- <name>default_zipcode</name>
- <value>33145</value>
- </init-param>
- <init-param>
- <name>RSS_XSL</name>
- <value>/WEB-INF/xsl/weather/Rss.xsl</value>
- </init-param>
- <init-param>
- <name>base_url</name>
- <value>http://xml.weather.yahoo.com/forecastrss?p=</value>
- </init-param>
- <expiration-cache>180</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- <portlet-mode>EDIT</portlet-mode>
- </supports>
- <portlet-info>
- <title>Weather Portlet</title>
- <keywords>sample,news</keywords>
- </portlet-info>
- <portlet-preferences>
- <preference>
- <name>expires</name>
- <value>180</value>
- </preference>
- <preference>
- <name>RssXml</name>
- <value>http://xml.weather.yahoo.com/forecastrss?p=33145</value>
- <read-only>false</read-only>
- </preference>
- </portlet-preferences>
- </portlet>
--->
-<!--
- <portlet>
- <description>Portlet aggregating news from different feeds</description>
- <portlet-name>NewsPortlet</portlet-name>
- <display-name>News Portlet</display-name>
- <portlet-class>org.jboss.samples.portlet.news.NewsPortlet</portlet-class>
- <init-param>
- <name>RSS1_XSL</name>
- <value>/WEB-INF/Rss1.xsl</value>
- </init-param>
- <init-param>
- <name>RSS2_XSL</name>
- <value>/WEB-INF/Rss2.xsl</value>
- </init-param>
- <init-param>
- <name>base_url</name>
- <value>http://feeds.feedburner.com/JBossPortal</value>
- </init-param>
- <expiration-cache>180</expiration-cache>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>VIEW</portlet-mode>
- <portlet-mode>EDIT</portlet-mode>
- </supports>
- <supported-locale>en</supported-locale>
- <supported-locale>fr</supported-locale>
- <resource-bundle>NewsResource</resource-bundle>
- <portlet-info>
- <title>News Feeds</title>
- <keywords>sample,news</keywords>
- </portlet-info>
- <portlet-preferences>
- <preference>
- <name>expires</name>
- <value>180</value>
- </preference>
- <preference>
- <name>RssXml</name>
- <value>http://feeds.feedburner.com/JBossPortal</value>
- <read-only>false</read-only>
- </preference>
- </portlet-preferences>
- </portlet>
--->
- <portlet>
<description>URL Portlet</description>
<portlet-name>URLPortlet</portlet-name>
<display-name>URL Portlet</display-name>
Added: trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet-instances.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,36 @@
+<?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>
+ <instance-id>JSPPortletInstance</instance-id>
+ <portlet-ref>JSPPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/portlet.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,44 @@
+<?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_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+ <portlet>
+ <description>Simple JSP portlet</description>
+ <portlet-name>JSPPortlet</portlet-name>
+ <display-name>JSP Portlet</display-name>
+ <portlet-class>org.jboss.samples.portlet.jsp.JSPPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Greetings!</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ </portlet>
+</portlet-app>
Added: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/jsp/news/edit.jsp
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/jsp/news/edit.jsp (rev 0)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/jsp/news/edit.jsp 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,37 @@
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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 uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<div align="center">
+ <br/>
+ <font class="portlet-font">Change News Feed URL:</font>
+ <form method="post" action="
+<portlet:actionURL></portlet:actionURL>">
+ <input class="portlet-form-input-field" type="text" value="<%= renderRequest.getPreferences().getValue("RssXml", "") %>" size="25" name="newurl">
+ <input class="portlet-form-button" type="submit" name="submit" value="submit">
+ </form>
+</div>
\ No newline at end of file
Added: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet-instances.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,53 @@
+<?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>
+ <instance-id>NewsPortletInstance</instance-id>
+ <portlet-ref>NewsPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>NewsPortletInstance2</instance-id>
+ <portlet-ref>NewsPortlet</portlet-ref>
+ <preferences>
+ <preference>
+ <name>expires</name>
+ <value>180</value>
+ </preference>
+ <preference>
+ <name>RssXml</name>
+ <value>http://finance.yahoo.com/rss/headline?s=rhat</value>
+ </preference>
+ </preferences>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-news-samples-war/WEB-INF/portlet.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,72 @@
+<?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_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+ <portlet>
+ <description>Portlet aggregating news from different feeds</description>
+ <portlet-name>NewsPortlet</portlet-name>
+ <display-name>News Portlet</display-name>
+ <portlet-class>org.jboss.samples.portlet.news.NewsPortlet</portlet-class>
+ <init-param>
+ <name>RSS1_XSL</name>
+ <value>/WEB-INF/Rss1.xsl</value>
+ </init-param>
+ <init-param>
+ <name>RSS2_XSL</name>
+ <value>/WEB-INF/Rss2.xsl</value>
+ </init-param>
+ <init-param>
+ <name>base_url</name>
+ <value>http://feeds.feedburner.com/JBossPortal</value>
+ </init-param>
+ <expiration-cache>180</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>NewsResource</resource-bundle>
+ <portlet-info>
+ <title>News Feeds</title>
+ <keywords>sample,news</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>expires</name>
+ <value>180</value>
+ </preference>
+ <preference>
+ <name>RssXml</name>
+ <value>http://feeds.feedburner.com/JBossPortal</value>
+ <read-only>false</read-only>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+</portlet-app>
Added: trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/jsp/weather/edit.jsp
===================================================================
--- trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/jsp/weather/edit.jsp (rev 0)
+++ trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/jsp/weather/edit.jsp 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,40 @@
+<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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 uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<div align="center">
+ <br/>
+ <font class="portlet-font">Change Weather Location:</font>
+
+ <form method="post" action="
+<portlet:actionURL></portlet:actionURL>">
+ <font class="portlet-font">Zip Code:</font><br/>
+ <input class="portlet-form-input-field" type="text" value="" size="12" name="newzip">
+ <br/>
+ <input class="portlet-form-input-field" type="submit" name="submit" value="submit">
+ </form>
+</div>
\ No newline at end of file
Added: trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet-instances.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,36 @@
+<?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>
+ <instance-id>WeatherPortletInstance</instance-id>
+ <portlet-ref>WeatherPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml (rev 0)
+++ trunk/core-samples/src/resources/portal-weather-samples-war/WEB-INF/portlet.xml 2007-06-26 15:22:59 UTC (rev 7551)
@@ -0,0 +1,69 @@
+<?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_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+ <portlet>
+ <description>Portlet providing weather forecast</description>
+ <portlet-name>WeatherPortlet</portlet-name>
+ <display-name>Weather Portlet</display-name>
+ <portlet-class>org.jboss.samples.portlet.weather.WeatherPortlet</portlet-class>
+ <init-param>
+ <name>default_zipcode</name>
+ <value>33145</value>
+ </init-param>
+ <init-param>
+ <name>RSS_XSL</name>
+ <value>/WEB-INF/xsl/weather/Rss.xsl</value>
+ </init-param>
+ <init-param>
+ <name>base_url</name>
+ <value>http://xml.weather.yahoo.com/forecastrss?p=</value>
+ </init-param>
+ <expiration-cache>180</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Weather Portlet</title>
+ <keywords>sample,news</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>expires</name>
+ <value>180</value>
+ </preference>
+ <preference>
+ <name>RssXml</name>
+ <value>http://xml.weather.yahoo.com/forecastrss?p=33145</value>
+ <read-only>false</read-only>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+</portlet-app>
18 years, 10 months
JBoss Portal SVN: r7549 - in trunk/core-samples: src/bin and 12 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 09:40:06 -0400 (Tue, 26 Jun 2007)
New Revision: 7549
Added:
trunk/core-samples/src/bin/portal-basic-samples-war/
trunk/core-samples/src/bin/portal-basic-samples-war/images/
trunk/core-samples/src/bin/portal-basic-samples-war/portlet-styles/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java
trunk/core-samples/src/resources/portal-basic-samples-sar/
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/dir1/
trunk/core-samples/src/resources/portal-basic-samples-war/dir2/
Removed:
trunk/core-samples/src/bin/portal-basic-samples-war/images/
trunk/core-samples/src/bin/portal-basic-samples-war/portlet-styles/
trunk/core-samples/src/bin/portal-samples-war/
trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/
trunk/core-samples/src/resources/portal-basic-samples-war/dir1/
trunk/core-samples/src/resources/portal-basic-samples-war/dir2/
trunk/core-samples/src/resources/portal-samples-sar/
trunk/core-samples/src/resources/portal-samples-war/
Modified:
trunk/core-samples/build.xml
trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
renamed samples to basic-samples (need to remove the non basic sample in a separate package after that)
Modified: trunk/core-samples/build.xml
===================================================================
--- trunk/core-samples/build.xml 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/build.xml 2007-06-26 13:40:06 UTC (rev 7549)
@@ -192,42 +192,42 @@
<mkdir dir="${build.lib}"/>
<!-- portal-core-samples-lib.jar -->
- <jar jarfile="${build.lib}/portal-core-samples-lib.jar">
+ <jar jarfile="${build.lib}/portal-basic-samples-lib.jar">
<fileset dir="${build.classes}">
</fileset>
</jar>
<!-- portal-samples.sar -->
- <copy todir="${build.resources}/portal-samples">
- <fileset dir="${build.resources}/portal-samples-sar"/>
+ <copy todir="${build.resources}/portal-basic-samples">
+ <fileset dir="${build.resources}/portal-basic-samples-sar"/>
</copy>
<!-- portal-samples.war -->
- <copy todir="${build.resources}/portal-samples/portal-samples.war">
- <fileset dir="${source.bin}/portal-samples-war"/>
- <fileset dir="${build.resources}/portal-samples-war"/>
+ <copy todir="${build.resources}/portal-samples/portal-basic-samples.war">
+ <fileset dir="${source.bin}/portal-basic-samples-war"/>
+ <fileset dir="${build.resources}/portal-basic-samples-war"/>
</copy>
- <!-- hibernate configuration for identity -->
- <copy todir="${build.resources}/portal-samples/lib">
- <fileset dir="${build.lib}" includes="portal-core-samples-lib.jar"/>
+ <!-- -->
+ <copy todir="${build.resources}/portal-basic-samples/lib">
+ <fileset dir="${build.lib}" includes="portal-basic-samples-lib.jar"/>
</copy>
</target>
- <!-- Build the portal-samples.sar -->
+ <!-- Build the portal-basic-samples.sar -->
<target name="output" depends="artifacts">
- <copy todir="${build.resources}/portal-samples.sar">
- <fileset dir="${build.resources}/portal-samples" excludes="**/*.xml"/>
+ <copy todir="${build.resources}/portal-basic-samples.sar">
+ <fileset dir="${build.resources}/portal-basic-samples" excludes="**/*.xml"/>
</copy>
- <copy todir="${build.resources}/portal-samples.sar">
+ <copy todir="${build.resources}/portal-basic-samples.sar">
<filterset>
<filtersfile file="../build/etc/single.properties"/>
</filterset>
- <fileset dir="${build.resources}/portal-samples" includes="**/*.xml"/>
+ <fileset dir="${build.resources}/portal-basic-samples" includes="**/*.xml"/>
</copy>
<implode
- dir="${build.resources}/portal-samples.sar"
- tofile="${build.lib}/portal-samples.sar"/>
+ dir="${build.resources}/portal-basic-samples.sar"
+ tofile="${build.lib}/portal-basic-samples.sar"/>
</target>
<!-- create artifacts for running the portlet tests (except TCK) target output should have already been executed -->
Copied: trunk/core-samples/src/bin/portal-basic-samples-war (from rev 7535, trunk/core-samples/src/bin/portal-samples-war)
Copied: trunk/core-samples/src/bin/portal-basic-samples-war/images (from rev 7548, trunk/core-samples/src/bin/portal-samples-war/images)
Copied: trunk/core-samples/src/bin/portal-basic-samples-war/portlet-styles (from rev 7548, trunk/core-samples/src/bin/portal-samples-war/portlet-styles)
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class BasicPortlet implements Portlet
+{
+
+ private PortletConfig config;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ this.config = config;
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ response.setRenderParameter(name + " from action", values);
+ }
+ response.setWindowState(request.getWindowState());
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+
+ //
+ writer.write("window state : " + request.getWindowState());
+ writer.write("<table><th><td>name</td><td>value</td></th>");
+ for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ writer.write("<tr><td>" + name + "</td><td>" + values[0] + "</td></tr>");
+ }
+ writer.write("</table>");
+
+ //
+ PortletURL renderURL = response.createRenderURL();
+ writeLink(writer, renderURL, "empty");
+
+ //
+ renderURL.setParameter("foo", "bar");
+ writeLink(writer, renderURL, "foo=bar");
+
+ //
+ renderURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, renderURL, "maximized,foo=bar");
+
+ //
+ renderURL = response.createRenderURL();
+ renderURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, renderURL, "maximized");
+
+ //
+ renderURL = response.createRenderURL();
+ renderURL.setWindowState(WindowState.NORMAL);
+ writeLink(writer, renderURL, "normal");
+
+ //
+ renderURL.setWindowState(WindowState.NORMAL);
+ renderURL.setParameter("foo", "bar");
+ writeLink(writer, renderURL, "normal,foo=bar");
+
+ PortletURL actionURL = response.createActionURL();
+ writeLink(writer, actionURL, "empty");
+
+ //
+ actionURL.setParameter("foo", "bar");
+ writeLink(writer, actionURL, "foo=bar");
+
+ //
+ actionURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, actionURL, "maximized,foo=bar");
+
+ //
+ actionURL = response.createRenderURL();
+ actionURL.setWindowState(WindowState.MAXIMIZED);
+ writeLink(writer, actionURL, "maximized");
+
+ //
+ actionURL = response.createRenderURL();
+ actionURL.setWindowState(WindowState.NORMAL);
+ writeLink(writer, actionURL, "normal");
+
+ //
+ actionURL.setWindowState(WindowState.NORMAL);
+ actionURL.setParameter("foo", "bar");
+ writeLink(writer, actionURL, "normal,foo=bar");
+
+ //
+ writer.close();
+ }
+
+ private void writeLink(PrintWriter writer, PortletURL url, String label)
+ {
+ writer.print("<div><a href=\"" + url + "\">" + label + "</a></div>");
+ }
+
+ public void destroy()
+ {
+ this.config = null;
+ }
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/BasicPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,281 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.format.util.EntityTable;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * This portlet is used to display a form that helps to test the charset handling by the portal and the client. When a
+ * fault occurs it may be the client fault (for instance the char with unicode value 160 fail the test in firefox but
+ * succeds in IE6).
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CharsetPortlet extends GenericPortlet
+{
+
+ private static final Logger log = Logger.getLogger(CharsetPortlet.class);
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ String fromString = req.getParameter("from");
+ String toString = req.getParameter("to");
+ int from;
+ int to;
+ try
+ {
+ from = Integer.parseInt(fromString);
+ to = Integer.parseInt(toString);
+ }
+ catch (NumberFormatException ignore)
+ {
+ from = 65;
+ to = 256;
+ }
+ resp.setRenderParameter("from", "" + from);
+ resp.setRenderParameter("to", "" + to);
+
+ //
+ String text = req.getParameter("text");
+ if (text != null)
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = from; i < to; i++)
+ {
+ char c = (char)i;
+ if (useChar(c))
+ {
+ buffer.append(c);
+ }
+ }
+ String expectedText = buffer.toString();
+ boolean same = expectedText.equals(text);
+ if (!same)
+ {
+ log.error("The input does not match the expected string");
+ log.error("Expected string " + expectedText);
+ log.error("Received string " + text);
+ }
+ resp.setRenderParameter("same", "" + same);
+ }
+ }
+
+
+ protected void doHelp(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("This portlet shows different ways to properly display and submit unicode text");
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ String sameString = req.getParameter("same");
+ Boolean same = null;
+ if ("true".equalsIgnoreCase(sameString))
+ {
+ same = Boolean.TRUE;
+ }
+ else if ("false".equalsIgnoreCase(sameString))
+ {
+ same = Boolean.FALSE;
+ }
+
+ //
+ String fromString = req.getParameter("from");
+ String toString = req.getParameter("to");
+ int from = 65;
+ int to = 256;
+ try
+ {
+ from = Integer.parseInt(fromString);
+ to = from + 16;
+ to = Integer.parseInt(toString);
+ }
+ catch (NumberFormatException ignore)
+ {
+ //
+ }
+
+ //
+ if (to <= from)
+ {
+ to = from + 16;
+ }
+
+ //
+ StringBuffer escapedText = new StringBuffer();
+ StringBuffer text = new StringBuffer();
+ for (int i = from; i < to; i++)
+ {
+ char c = (char)i;
+ if (useChar(c))
+ {
+ text.append(c);
+ String s = EntityTable.FULL.lookup(c);
+ if (s == null)
+ {
+ escapedText.append(c);
+ }
+ else
+ {
+ escapedText.append("&").append(s).append(";");
+ }
+ }
+ }
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.println("<div style=\"border-top:solid 1px\">Testing range:</div>");
+ writer.print(
+ "<div>" +
+ "<form action=\"" + resp.createActionURL() + "\" method=\"post\"\">" +
+ "<input type=\"text\" name=\"from\" value=\"" + from + "\"/>" +
+ "<input type=\"text\" name=\"to\" value=\"" + to + "\"/>" +
+ "<input type=\"submit\" value=\"change\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ writer.println("<div style=\"border-top:solid 1px\">Test processAction() with a textarea field:</div>");
+ writer.println(
+ "<div>" +
+ "<form action=\"" + resp.createActionURL() + "\" accept-charset=\"" + resp.getCharacterEncoding() + "\" method=\"post\">" +
+ "<input type=\"hidden\" name=\"from\" value=\"" + from + "\"/>" +
+ "<input type=\"hidden\" name=\"to\" value=\"" + to + "\"/>" +
+ "<textarea name=\"text\" cols=\"20\" rows=\"10\" wrap=\"virtual\">" + escapedText + "</textarea>" +
+ "<input type=\"submit\" value=\"check\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ writer.println("<div style=\"border-top:solid 1px\">Test processAction() with a text field:</div>");
+ writer.println(
+ "<div>" +
+ "<form action=\"" + resp.createActionURL() + "\" accept-charset=\"" + resp.getCharacterEncoding() + "\" method=\"post\">" +
+ "<input type=\"hidden\" name=\"from\" value=\"" + from + "\"/>" +
+ "<input type=\"hidden\" name=\"to\" value=\"" + to + "\"/>" +
+ "<input type=\"text\" name=\"text\" value=\"" + escapedText + "\"/>" +
+ "<input type=\"submit\" value=\"check\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ PortletURL url = resp.createActionURL();
+ url.setParameter("text", text.toString());
+ writer.println("<div style=\"border-top:solid 1px\">Test processAction() with a portlet parameter:</div>");
+ writer.println(
+ "<div>" +
+ "<form action=\"" + url + "\" accept-charset=\"" + resp.getCharacterEncoding() + "\" method=\"post\">" +
+ "<input type=\"hidden\" name=\"from\" value=\"" + from + "\"/>" +
+ "<input type=\"hidden\" name=\"to\" value=\"" + to + "\"/>" +
+ "<input type=\"submit\" value=\"check\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ PortletURL url2 = resp.createActionURL();
+ url2.setParameter("text", text.toString());
+ url2.setParameter("from", "" + from);
+ url2.setParameter("to", "" + to);
+ writer.println("<div style=\"border-top:solid 1px\"><a href=\"" + url2 + "\">Test</a> processAction() with a portlet parameter:</div>");
+
+ //
+ if (same != null)
+ {
+ writer.print("<div style=\"color:red;margin-top:2em;margin-bottom:2em\">Test result: ");
+ if (same == Boolean.TRUE)
+ {
+ writer.print("The input matched the expected result");
+ }
+ else if (same == Boolean.FALSE)
+ {
+ writer.print("The input did not matched the expected result");
+ }
+ writer.print("</div>");
+ }
+
+ //
+ writer.close();
+ }
+
+ public static boolean useChar(char c)
+ {
+ switch (Character.getType(c))
+ {
+ case Character.LOWERCASE_LETTER: // Ll
+ case Character.UPPERCASE_LETTER: // Lu
+ case Character.TITLECASE_LETTER: // Lt
+ case Character.MODIFIER_LETTER: // Lm
+ case Character.OTHER_LETTER: // Lo
+ case Character.NON_SPACING_MARK: // Mn
+ case Character.ENCLOSING_MARK: // Me
+ case Character.COMBINING_SPACING_MARK: // Mc
+ case Character.DECIMAL_DIGIT_NUMBER: // Nd
+ case Character.LETTER_NUMBER: // Nl
+ case Character.OTHER_NUMBER: // No
+ case Character.SPACE_SEPARATOR: // Zs
+ case Character.LINE_SEPARATOR: // Zl
+ case Character.PARAGRAPH_SEPARATOR: // Zp
+ case Character.DASH_PUNCTUATION: // Pd
+ case Character.START_PUNCTUATION: // Ps
+ case Character.END_PUNCTUATION: // Pe
+ case Character.CONNECTOR_PUNCTUATION: // Pc
+ case Character.OTHER_PUNCTUATION: // Po
+ case Character.INITIAL_QUOTE_PUNCTUATION: // Pi
+ case Character.FINAL_QUOTE_PUNCTUATION: // Pf
+ case Character.MATH_SYMBOL: // Sm
+ case Character.CURRENCY_SYMBOL: // Sc
+ case Character.MODIFIER_SYMBOL: // Sk
+ case Character.OTHER_SYMBOL: // So
+ return true;
+ default:
+ case Character.UNASSIGNED: // Cn
+ case Character.CONTROL: // Cc
+ case Character.FORMAT: // Cf
+ case Character.PRIVATE_USE: // Co
+ case Character.SURROGATE: // Cs
+ return false;
+ }
+ }
+
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CharsetPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CounterPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ PortletSession session = req.getPortletSession();
+ int count = 0;
+ if (session.getAttribute("count") != null)
+ {
+ count = ((Integer)session.getAttribute("count")).intValue() + 1;
+ }
+ session.setAttribute("count", new Integer(count));
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Render call count</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>" + count + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ writer.write("<div class=\"portlet-section-header\">Render call count</div>");
+ writer.write("<div><a href=\"" + resp.createActionURL() + "\">action</a></div");
+ writer.write("<div><a href=\"" + resp.createRenderURL() + "\">render</a></div");
+
+ //
+ writer.close();
+ }
+
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/CounterPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5448 $
+ */
+public class EncodingPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setRenderParameter("text", req.getParameter("text"));
+ req.getPortletSession().setAttribute("text", req.getParameter("text"));
+
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ String param = req.getParameter("text");
+ String attr = (String)req.getPortletSession().getAttribute("text");
+
+ //
+ writer.print(
+ "<div> Text to pass : " +
+ "<form action=\"" + resp.createRenderURL() + "\" method=\"post\"\">" +
+ "<input type=\"text\" name=\"text\" value=\"\"/>" +
+ "<input type=\"submit\" value=\"Submit to render phase\"/>" +
+ "</form>" +
+ "<form action=\"" + resp.createActionURL() + "\" method=\"post\"\">" +
+ "<input type=\"text\" name=\"text\" value=\"\"/>" +
+ "<input type=\"submit\" value=\"Submit to action phase\"/>" +
+ "</form>" +
+ "</div>");
+
+ //
+ writer.println(
+ "<div>" + "Text retrieved from request parameter: " +
+ "</div>" +
+ "<div>" +
+ "<textarea name=\"text\" cols=\"20\" rows=\"4\" wrap=\"virtual\">");
+
+ if (param != null)
+ {
+ writer.println(param);
+ }
+
+ writer.println(
+ "</textarea>" +
+ "</div>");
+
+ writer.println(
+ "<div>" + "Text retrieved from portlet session (value set during Action Phase): " +
+ "</div>" +
+ "<div>" +
+ "<textarea name=\"text\" cols=\"20\" rows=\"4\" wrap=\"virtual\">");
+
+ if (attr != null)
+ {
+ writer.println(attr);
+ }
+
+ writer.println(
+ "</textarea>" +
+ "</div>");
+
+ //
+ writer.close();
+ }
+
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/EncodingPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class ExceptionPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ PortletURL renderURL = resp.createRenderURL();
+ PortletURL actionURL = resp.createActionURL();
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Throw :</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ renderURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render PortletException</a></div>");
+ renderURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render PortletSecurityException</a></div>");
+ renderURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render IOException</a></div>");
+ renderURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + renderURL + "\">render Error</a></div>");
+ actionURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action PortletException</a></div>");
+ actionURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action PortletSecurityException</a></div>");
+ actionURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action IOException</a></div>");
+ actionURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + actionURL + "\">action Error</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+ }
+
+ private void throwException(PortletRequest req) throws PortletException, IOException
+ {
+ String op = req.getParameter("op");
+
+ // Throw any required exception
+ if ("portletexception".equals(op))
+ {
+ throw new PortletException();
+ }
+ if ("portletsecurityexception".equals(op))
+ {
+ throw new PortletSecurityException("");
+ }
+ if ("ioexception".equals(op))
+ {
+ throw new IOException();
+ }
+ if ("runtimeexception".equals(op))
+ {
+ throw new RuntimeException();
+ }
+ if ("error".equals(op))
+ {
+ throw new Error();
+ }
+ }
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/ExceptionPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java (from rev 7543, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FSContentDrivenPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,274 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.nio.channels.FileChannel;
+import java.nio.ByteBuffer;
+
+/**
+ * <p>An example of content driven portlet that display the files located in the war file. The portlet does not implement
+ * any code to improve performance like caching in order to keep the code easier to understand. It should not be
+ * used in production for a large scale portal.</p>
+ *
+ * <p>Content URI is defined as the canonical path of the file relative to the war file context root.</p>
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FSContentDrivenPortlet extends GenericPortlet
+{
+
+ /** The edit_content mode. */
+ public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
+
+ /**
+ * Additional dispatch that will call the <code>doEditContent(RenderRequest,RenderResponse)</code> method.
+ */
+ protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ {
+ doEditContent(req, resp);
+ }
+ else
+ {
+ super.doDispatch(req, resp);
+ }
+ }
+
+ /**
+ * Implements the edit content functionnality.
+ */
+ protected void doEditContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ // Get the uri value optionally provided by the portal
+ String uri = req.getParameter("content.uri");
+
+ // Get the working directory directory
+ File workingDir;
+ if (uri != null)
+ {
+ workingDir = getFile(uri).getParentFile();
+ }
+ else
+ {
+ // Otherwise try to get the current directory we are browsing, if no current dir exist we use the root
+ String currentDir = req.getParameter("current_dir");
+ if (currentDir == null)
+ {
+ currentDir = "/";
+ }
+ workingDir = getFile(currentDir);
+ }
+
+ // Get the parent path
+ String parentPath = getContentURI(workingDir.getParentFile());
+
+ // Get the children of the selected file, we use a filter to retain only text files and avoid WEB-INF dir
+ File[] children = workingDir.listFiles(filter);
+
+ // Configure the response
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("Directories:<br/>");
+ writer.print("<ul>");
+ PortletURL choseDirURL = resp.createRenderURL();
+ if (parentPath != null)
+ {
+ choseDirURL.setParameter("current_dir", parentPath);
+ writer.print("<li><a href=\"" + choseDirURL + "\">..</a></li>");
+ }
+ for (int i = 0;i < children.length;i++)
+ {
+ File child = children[i];
+ if (child.isDirectory())
+ {
+ choseDirURL.setParameter("current_dir", getContentURI(child));
+ writer.print("<li><a href=\"" + choseDirURL + "\">" + child.getName() + "</a></li>");
+ }
+ }
+ writer.print("</ul><br/>");
+
+ //
+ writer.print("Files:<br/>");
+ writer.print("<ul>");
+ PortletURL selectFileURL = resp.createActionURL();
+ selectFileURL.setParameter("content.action.select", "select");
+ for (int i = 0;i < children.length;i++)
+ {
+ File child = children[i];
+ if (child.isFile())
+ {
+ selectFileURL.setParameter("content.uri", getContentURI(child));
+ writer.print("<li><a href=\"" + selectFileURL + "\">" + child.getName() + "</a></li>");
+ }
+ }
+ writer.print("</ul><br/>");
+
+ //
+ writer.close();
+ }
+
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ // Get the URI provided by the portal
+ String uri = req.getParameter("uri");
+
+ // Configure the response
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ if (uri == null)
+ {
+ writer.print("No selected file");
+ }
+ else
+ {
+ File file = getFile(uri);
+ FileInputStream in = null;
+ try
+ {
+ in = new FileInputStream(file);
+ FileChannel channel = in.getChannel();
+ byte[] bytes = new byte[(int)channel.size()];
+ ByteBuffer buffer = ByteBuffer.wrap(bytes);
+ channel.read(buffer);
+ writer.write(new String(bytes, 0, bytes.length, "UTF8"));
+ }
+ catch (FileNotFoundException e)
+ {
+ writer.print("No such file " + uri);
+ getPortletContext().log("Cannot find file " + uri, e);
+ }
+ finally
+ {
+ if (in != null)
+ {
+ in.close();
+ }
+ }
+ }
+
+ //
+ writer.close();
+ }
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
+ {
+ String contentURI = req.getParameter("content.uri");
+
+ // We just propagate the content URI as a render parameter for the doEditContent method
+ if (contentURI != null)
+ {
+ resp.setRenderParameter("content.uri", contentURI);
+ }
+ }
+ }
+
+ /**
+ * Return a file from the specified path or null if the file cannot be determined.
+ *
+ * @param contentURI the file path
+ * @return the file or null
+ */
+ protected File getFile(String contentURI) throws IOException
+ {
+ String realPath = getPortletContext().getRealPath(contentURI);
+ if (realPath == null)
+ {
+ throw new IOException("Cannot access war file content");
+ }
+ File file = new File(realPath);
+ if (!file.exists())
+ {
+ throw new IOException("File " + contentURI + " does not exist");
+ }
+ return file;
+ }
+
+ /**
+ * Return the content uri of the file or null if it cannot be determined.
+ *
+ * @param file the file to get the URI from
+ * @return the URI or null
+ */
+ protected String getContentURI(File file) throws IOException
+ {
+ String rootPath = getPortletContext().getRealPath("/");
+ if (rootPath == null)
+ {
+ throw new IOException("Cannot access war file content");
+ }
+
+ // Make it canonical
+ rootPath = new File(rootPath).getCanonicalPath();
+
+ // Get the portion of the path that is significant for us
+ String filePath = file.getCanonicalPath();
+ return filePath.length() >= rootPath.length() ? filePath.substring(rootPath.length()) : null;
+ }
+
+ /**
+ * Avoid the WEB-INF directory and list only text files.
+ */
+ private final FileFilter filter = new FileFilter()
+ {
+ public boolean accept(File file)
+ {
+ String name = file.getName();
+ if (file.isDirectory())
+ {
+ return !"WEB-INF".equals(name);
+ }
+ else if (file.isFile())
+ {
+ return name.endsWith(".txt");
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+}
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FileUploadPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import org.apache.commons.fileupload.portlet.PortletFileUpload;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FileUploadPortlet extends GenericPortlet
+{
+
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+
+ //
+ List fileNames = new ArrayList();
+ List fileSizes = new ArrayList();
+
+ //
+ try
+ {
+ DiskFileItemFactory factory = new DiskFileItemFactory();
+ PortletFileUpload upload = new PortletFileUpload(factory);
+ List fileItems = upload.parseRequest(req);
+ for (Iterator iterator = fileItems.iterator();iterator.hasNext();)
+ {
+ FileItem item = (FileItem)iterator.next();
+ if (!item.isFormField())
+ {
+ fileNames.add("" + item.getName());
+ fileSizes.add("" + item.getSize());
+ }
+ }
+ }
+ catch (FileUploadException e)
+ {
+ throw new PortletException(e);
+ }
+
+ //
+ resp.setRenderParameter("fileNames", (String[])fileNames.toArray(new String[fileNames.size()]));
+ resp.setRenderParameter("fileSizes", (String[])fileSizes.toArray(new String[fileSizes.size()]));
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ //
+ resp.setContentType("text/html");
+
+ //
+ PrintWriter writer = resp.getWriter();
+
+ String[] fileNames = req.getParameterValues("fileNames");
+ String[] fileSizes = req.getParameterValues("fileSizes");
+ if (fileNames != null && fileSizes != null && fileNames.length == fileSizes.length)
+ {
+ for (int i = 0;i < fileNames.length;i++)
+ {
+ writer.println("Received file " + fileNames[i] + " with size " + fileSizes[i] + "<br/>");
+ }
+ }
+
+ //
+ writer.println("<form action=\"" + resp.createActionURL() + "\" method=\"post\" enctype=\"multipart/form-data\">");
+ writer.println("<input type=\"file\" name=\"File\">");
+ writer.println("<input type=\"submit\" name=\"Upload\">");
+ writer.println("</form>");
+ }
+}
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/FormAutoSubmitPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class FormAutoSubmitPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+
+ //
+ PrintWriter writer = resp.getWriter();
+ PortletURL actionURL = resp.createActionURL();
+ String formId = resp.getNamespace() + "_the_form";
+
+ //
+ writer.write("<form id=\"" + formId + "\" action=\"" + actionURL + "\">");
+ writer.write("<select onclick=\"document.getElementById('" + formId + "').submit()\" multiple=\"multiple\">");
+ writer.write("<option>A</option>");
+ writer.write("<option>B</option>");
+ writer.write("<option>C</option>");
+ writer.write("</select>");
+ writer.write("</form>");
+ writer.write("<a href=\"javascript:document.getElementById('" + formId + "').submit()\">submit</a>");
+ }
+}
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/*
+ * Portlet to demonstrate the declarative header content feature.
+ * <p>This portlet injects css into the html HEAD tag via jboss-portlet.xml</p>
+ *
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
+ * @version $Revision: 5448 $
+*/
+
+public class HeaderContentPortlet extends GenericPortlet
+{
+ public void doView(RenderRequest req, RenderResponse res) throws PortletException, IOException
+ {
+ res.setProperty("HEADER_CONTENT", "<script type=\"text/javascript\">/* Just to check it is inserted in the headers */</script>");
+
+ res.setContentType("text/html");
+ Writer writer = res.getWriter();
+ writer.write("<div id='Introducing-HeaderContent'/>");
+ writer.write("<div class=\"portlet-section-body\"><p id='rewrite-js'><button id=\"Introducing-HeaderContentInput\" class=\"portlet-form-button\" type='button' onClick='injectJS()'>Call injected javascript</button></p></div>");
+ writer.flush();
+ writer.close();
+ }
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/HeaderContentPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletSessionPortlet extends GenericPortlet
+{
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, IOException
+ {
+ String name = req.getParameter("name");
+ String value = req.getParameter("value");
+ boolean portletScope = req.getParameter("portlet") != null;
+ if (name != null && value != null)
+ {
+ req.getPortletSession().setAttribute(name, value, portletScope ? PortletSession.PORTLET_SCOPE : PortletSession.APPLICATION_SCOPE);
+ }
+ if (req.getParameter("invalidate") != null)
+ {
+ req.getPortletSession().invalidate();
+ }
+ }
+
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ PortletSession session = req.getPortletSession(false);
+ PortletURL purl = resp.createActionURL();
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ if (session == null)
+ {
+ writer.println("No session");
+ }
+ else
+ {
+ writer.println("Session id = " + session.getId());
+ writer.println("<br/>");
+
+ //
+ print(session, PortletSession.PORTLET_SCOPE, writer);
+ writer.println("<br/>");
+
+ //
+ print(session, PortletSession.APPLICATION_SCOPE, writer);
+ writer.println("<br/>");
+
+ }
+
+ //
+ writer.println("<form action=\"" + purl.toString() + "\" method=\"post\">");
+ writer.println("<input type=\"text\" name=\"name\"/>");
+ writer.println("<input type=\"text\" name=\"value\"/>");
+ writer.println("<input type=\"submit\" name=\"portlet\" value=\"Add to portlet scope\"/>");
+ writer.println("<input type=\"submit\" name=\"application\" value=\"Add to application scope\"/>");
+ writer.println("</form><br/>");
+
+ //
+ purl.setParameter("invalidate", "true");
+ writer.println("<a href=\"" + purl.toString() + "\">invalidate</a><br/>");
+ }
+
+ private void print(PortletSession session, int scope, PrintWriter writer)
+ {
+ writer.println("<table>");
+ writer.println("<tr><td>name</td><td>value</td>");
+ for (Enumeration e = session.getAttributeNames(scope); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ Object value = session.getAttribute(name, scope);
+ writer.println("<tr><td>" + name + "</td><td>" + value + "</td>");
+ }
+ writer.println("</table>");
+ }
+
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/PortletSessionPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,237 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import org.jboss.portal.common.transaction.TransactionManagerProvider;
+import org.jboss.portal.core.CoreConstants;
+import org.jboss.portal.identity.User;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.transaction.Transaction;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5883 $
+ */
+public class TestPortlet extends JBossPortlet
+{
+
+ public void main(JBossActionRequest req, JBossActionResponse resp)
+ {
+ }
+
+ public void addrole(JBossActionRequest req, JBossActionResponse resp)
+ {
+ String role = req.getParameter("role");
+ Set roles = (Set)req.getPortletSession().getAttribute("roles");
+ if (roles == null)
+ {
+ roles = new HashSet();
+ req.getPortletSession().setAttribute("roles", roles);
+ }
+ roles.add(role);
+ }
+
+ public void testaction(JBossActionRequest req, JBossActionResponse resp)
+ {
+ resp.setRenderParameter("name", "value");
+ }
+
+ protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ User user = req.getUser();
+ if (user != null)
+ {
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">User infos</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+
+ //TODO: update this with new Identity API
+ //writer.write("<div>Last visit date : " + user.getLastVisitDate() + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+ }
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portlet security infos</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>RemoteUser : " + req.getRemoteUser() + "</div>");
+ writer.write("<div>Principal : " + req.getUserPrincipal() + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portlet security role test</div>");
+ Set roles = (Set)req.getPortletSession().getAttribute("roles");
+ if (roles != null)
+ {
+ writer.write("<div class=\"portlet-section-body\">");
+ for (Iterator i = roles.iterator(); i.hasNext();)
+ {
+ String role = (String)i.next();
+ writer.write("<div>" + role + " " + req.isUserInRole(role) + "</div>");
+ }
+ writer.write("</div>");
+ }
+ PortletURL roleURL = resp.createActionURL();
+ roleURL.setParameter("op", "addrole");
+ writer.write("<div>" +
+ "<form action=\"" + roleURL + "\" method=\"post\">" +
+ "<input class=\"portlet-form-input-field\" type=\"text\" name=\"role\" value=\"\"/>" +
+ "<input class=\"portlet-form-button\" type=\"submit\" value=\"add role\"/>" +
+ "</form>" +
+ "</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Capabilities</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>Content type " + req.getResponseContentType() + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ PortletURL url = resp.createRenderURL();
+ url.setSecure(false);
+ String httpURL = url.toString();
+ url.setSecure(true);
+ String httpsURL = url.toString();
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Secure</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + httpURL + "\">http</a></div>");
+ writer.write("<div><a href=\"" + httpsURL + "\">https</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Path</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>portal path info = " + req.getAttribute("PATH") + "</div>");
+ writer.write("<div>portal path info = " + req.getParameter("PATH") + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portal infos</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ PortalContext portalCtx = req.getPortalContext();
+ writer.write("<div>version : " + portalCtx.getPortalInfo() + "</div>");
+ for (Enumeration e = portalCtx.getPropertyNames(); e.hasMoreElements();)
+ {
+ String propertyName = (String)e.nextElement();
+ String propertyValue = portalCtx.getProperty(propertyName);
+ writer.write("<div>" + propertyName + " : " + propertyValue + "</div>");
+ }
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Request attributes</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ for (Enumeration e = req.getAttributeNames(); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ Object value = req.getAttribute(name);
+ writer.write("<div>" + name + " : " + value + "</div>");
+ }
+ writer.write("</div>");
+ writer.write("</p>");
+
+ // User properties
+ Map userInfoMap = (Map)req.getAttribute(PortletRequest.USER_INFO);
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">User properties</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ if (userInfoMap != null)
+ {
+ for (Iterator i = userInfoMap.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String key = (String)entry.getKey();
+ String value = (String)entry.getValue();
+ writer.write("<div>" + key + " : " + value + "</div>");
+ }
+ }
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ PortletURL actionURL = resp.createActionURL();
+ actionURL.setParameter("op", "testaction");
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Test action</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + actionURL + "\">action</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Test current transaction</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div>" + getCurrentTransaction() + "</div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ //
+ writer.close();
+ }
+
+ private Transaction getCurrentTransaction()
+ {
+ try
+ {
+ return TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager().getTransaction();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/TestPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class URLPortlet extends GenericPortlet
+{
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, IOException
+ {
+ for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ String value = req.getParameter(name);
+ if (!"name".equals(name) && !"value".equals(name))
+ {
+ resp.setRenderParameter(name, value);
+ }
+ }
+ String name = req.getParameter("name");
+ String value = req.getParameter("value");
+ if (name != null && value != null)
+ {
+ resp.setRenderParameter(name, value);
+ }
+ }
+
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ String color = req.getParameter("color");
+ if (color == null)
+ {
+ color = "white";
+ }
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ PortletURL renderURL = resp.createRenderURL();
+
+ //
+ renderURL.setParameter("color", "blue");
+ String blueURL = renderURL.toString();
+
+ //
+ renderURL.setParameter("color", "red");
+ String redURL = renderURL.toString();
+
+ //
+ renderURL.setParameter("color", "white");
+ String whiteURL = renderURL.toString();
+
+ //
+ writer.print("<a href=\"" + blueURL + "\">blue</a> -");
+ writer.print("<a href=\"" + redURL + "\">red</a> -");
+ writer.print("<a href=\"" + whiteURL + "\">white</a><br/>");
+
+ //
+ writer.print("Parameters :<br/>");
+ writer.print("<table bgcolor=\"" + color + "\">");
+ writer.print("<tr><td>Name</td><td>value</td></tr>");
+ for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ String value = req.getParameter(name);
+ writer.print("<tr><td>" + name + "</td><td>" + value + "</td></tr>");
+ }
+ writer.print("</table>");
+
+ //
+ PortletURL actionURL = resp.createActionURL();
+ writer.print("<form action=\"" + actionURL.toString() + "\" method=\"post\">");
+ writer.print("<input type=\"text\" name=\"name\"/>");
+ writer.print("<input type=\"text\" name=\"value\"/>");
+ writer.print("<input type=\"submit\" value=\"add\"/>");
+ writer.print("</form>");
+
+ //
+ writer.print("<a href=\"" + req.getContextPath() + "/test.txt\">test</a>");
+
+ //
+ writer.close();
+ }
+}
\ No newline at end of file
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/URLPortlet.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortalEventListenerLogger.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.api.event.PortalEventListener;
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.api.event.PortalEventContext;
+import org.jboss.portal.api.session.event.PortalSessionEvent;
+import org.jboss.portal.api.user.event.UserAuthenticationEvent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalEventListenerLogger implements PortalEventListener
+{
+ public void onEvent(PortalEventContext eventContext, PortalEvent event)
+ {
+ if (event instanceof PortalSessionEvent)
+ {
+ PortalSessionEvent use = (PortalSessionEvent)event;
+ System.out.println(use.getType() == PortalSessionEvent.SESSION_CREATED ? "session created" : "session destroyed");
+ }
+ else if (event instanceof UserAuthenticationEvent)
+ {
+ UserAuthenticationEvent uae = (UserAuthenticationEvent)event;
+ System.out.println(uae.getType() == UserAuthenticationEvent.SIGN_IN ? "user login" : "user logout");
+ }
+ else
+ {
+ System.out.println("event = " + event);
+ }
+ }
+}
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletA extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.println("<form action=\"" + response.createActionURL() + "\" method=\"post\">");
+ writer.println("<select name=\"color\">");
+ writer.println("<option>blue</option>");
+ writer.println("<option>red</option>");
+ writer.println("<option>black</option>");
+ writer.println("</select>");
+ writer.println("<input type=\"submit\"/>");
+ writer.println("</form>");
+ writer.close();
+ }
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletA.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.api.node.event.PortalNodeEventContext;
+import org.jboss.portal.api.node.event.PortalNodeEventListener;
+import org.jboss.portal.api.node.event.WindowActionEvent;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class PortletB extends GenericPortlet
+{
+
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ String color = request.getParameter("color");
+ if (color != null)
+ {
+ response.setRenderParameter("color", color);
+ }
+ }
+
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ String color = request.getParameter("color");
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.println("<div" +
+ (color == null ? "" : " style=\"color:" + color + ";\"") +
+ ">some text in color</div>");
+ writer.close();
+ }
+
+ public static class Listener implements PortalNodeEventListener
+ {
+ public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event)
+ {
+ PortalNode node = event.getNode();
+
+ // Get node name
+ String nodeName = node.getName();
+
+ // See if we need to create a new event or not
+ WindowActionEvent newEvent = null;
+ if (nodeName.equals("PortletAWindow") && event instanceof WindowActionEvent)
+ {
+ // Find window B
+ WindowActionEvent wae = (WindowActionEvent)event;
+ PortalNode windowB = node.resolve("../PortletBWindow");
+ if (windowB != null)
+ {
+ // We can redirect
+ newEvent = new WindowActionEvent(windowB);
+ newEvent.setMode(wae.getMode());
+ newEvent.setWindowState(WindowState.MAXIMIZED);
+ newEvent.setParameters(wae.getParameters());
+ }
+ }
+
+ //
+ if (newEvent != null)
+ {
+ // If we have a new event redirect to it
+ return newEvent;
+ }
+ else
+ {
+ // Otherwise bubble up
+ return context.dispatch();
+ }
+ }
+ }
+}
Property changes on: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/PortletB.java
___________________________________________________________________
Name: svn:executable
+ *
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/UserCounterListener.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.api.event.PortalEvent;
+import org.jboss.portal.api.event.PortalEventContext;
+import org.jboss.portal.api.event.PortalEventListener;
+import org.jboss.portal.api.user.event.UserAuthenticationEvent;
+import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserCounterListener implements PortalEventListener
+{
+
+ /** . */
+ private final SynchronizedLong counter = new SynchronizedLong(0);
+
+ /** . */
+ private final SynchronizedLong counterEver = new SynchronizedLong(0);
+
+ public void onEvent(PortalEventContext eventContext, PortalEvent event)
+ {
+ if (event instanceof UserAuthenticationEvent)
+ {
+ UserAuthenticationEvent userEvent = (UserAuthenticationEvent)event;
+ if (userEvent.getType() == UserAuthenticationEvent.SIGN_IN)
+ {
+ counter.increment();
+ counterEver.increment();
+ }
+ else if (userEvent.getType() == UserAuthenticationEvent.SIGN_OUT)
+ {
+ counter.decrement();
+ }
+ System.out.println("Counter : " + counter.get());
+ System.out.println("Counter ever: " + counterEver.get());
+ }
+ }
+}
Copied: trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java (from rev 7535, trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java)
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java (rev 0)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/basic/event/WindowConstraintEventListener.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -0,0 +1,254 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.portlet.basic.event;
+
+import org.jboss.portal.api.node.event.PortalNodeEventListener;
+import org.jboss.portal.api.node.event.PortalNodeEvent;
+import org.jboss.portal.api.node.event.PortalNodeEventContext;
+import org.jboss.portal.api.node.event.PageRenderEvent;
+import org.jboss.portal.api.node.event.WindowNavigationEvent;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.navstate.NavigationalStateContext;
+import org.jboss.portal.theme.ThemeConstants;
+import org.jboss.portal.WindowState;
+
+import java.util.Map;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowConstraintEventListener implements PortalNodeEventListener
+{
+
+ public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event)
+ {
+ if (event instanceof PageRenderEvent)
+ {
+ PortalNode targetPage = event.getNode();
+ WindowManipulator manipulator = new WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(), targetPage);
+
+ // Filter window state for normal and minimized
+ for (Iterator i = manipulator.getRegionNames().iterator();i.hasNext();)
+ {
+ boolean foundNormal = false;
+ PortalNode firstWindow = null;
+ String regionName = (String)i.next();
+ for (Iterator j = manipulator.getWindows(regionName).iterator();j.hasNext();)
+ {
+ PortalNode window = (PortalNode)j.next();
+
+ // Keep a ref on first window which can be used later
+ if (firstWindow == null)
+ {
+ firstWindow = window;
+ }
+
+ //
+ WindowState ws = manipulator.getWindowState(window);
+ if (WindowState.NORMAL.equals(ws))
+ {
+ if (foundNormal)
+ {
+ manipulator.setWindowState(window, WindowState.MINIMIZED);
+ }
+ else
+ {
+ foundNormal = true;
+ }
+ }
+ else if (WindowState.MINIMIZED.equals(ws))
+ {
+ //
+ }
+ else
+ {
+ manipulator.setWindowState(window, WindowState.MINIMIZED);
+ }
+ }
+
+ //
+ if (foundNormal == false && firstWindow != null)
+ {
+ manipulator.setWindowState(firstWindow, WindowState.NORMAL);
+ }
+ }
+ }
+ else if (event instanceof WindowNavigationEvent)
+ {
+ WindowNavigationEvent wne = (WindowNavigationEvent)event;
+ PortalNode targetWindow = event.getNode();
+ WindowManipulator manipulator = new WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(), targetWindow.getParent());
+
+ //
+ WindowState ws = wne.getWindowState();
+
+ //
+ if (WindowState.NORMAL.equals(ws))
+ {
+ String regionName = manipulator.getRegionName(targetWindow);
+ if (regionName != null)
+ {
+ for (Iterator i = manipulator.getWindows(regionName).iterator();i.hasNext();)
+ {
+ PortalNode currentWindow = (PortalNode)i.next();
+ if (currentWindow.equals(targetWindow))
+ {
+ // Do nothing
+ }
+ else
+ {
+ manipulator.setWindowState(currentWindow, WindowState.MINIMIZED);
+ }
+ }
+ }
+ }
+ else if (WindowState.MINIMIZED.equals(ws))
+ {
+ String regionName = manipulator.getRegionName(targetWindow);
+ if (regionName != null)
+ {
+ // Find the window following the minimized one
+ PortalNode nextWindow = null;
+ for (Iterator i = manipulator.getWindows(regionName).iterator();i.hasNext();)
+ {
+ PortalNode currentWindow = (PortalNode)i.next();
+
+ // Keep a ref on the first window for later use
+ if (nextWindow == null)
+ {
+ nextWindow = currentWindow;
+ }
+
+ //
+ if (currentWindow.equals(targetWindow))
+ {
+ // Try to get the next window otherwise it means it's the last window
+ // and we'll use the window we saved at the first iteration
+ if (i.hasNext())
+ {
+ nextWindow = (PortalNode)i.next();
+ }
+
+ //
+ break;
+ }
+ }
+
+ // Normalize the next window
+ if (nextWindow != null)
+ {
+ manipulator.setWindowState(nextWindow, WindowState.NORMAL);
+ }
+ }
+ }
+ }
+ return context.dispatch();
+ }
+
+ public class WindowManipulator
+ {
+
+ /** . */
+ private Map regionMap;
+
+ /** . */
+ private NavigationalStateContext nsContext;
+
+ public WindowManipulator(NavigationalStateContext nsContext, PortalNode parent)
+ {
+ this.nsContext = nsContext;
+
+ // Build appropriate structure
+ regionMap = new HashMap();
+ for (Iterator i = parent.getChildren().iterator();i.hasNext();)
+ {
+ try
+ {
+ PortalNode object = (PortalNode)i.next();
+ if (object.getType() == PortalNode.TYPE_WINDOW)
+ {
+ String region = (String)object.getProperties().get(ThemeConstants.PORTAL_PROP_REGION);
+ Integer order = new Integer((String)object.getProperties().get(ThemeConstants.PORTAL_PROP_ORDER));
+
+ //
+ SortedMap windowMap = (SortedMap)regionMap.get(region);
+ if (windowMap == null)
+ {
+ windowMap = new TreeMap();
+ regionMap.put(region, windowMap);
+ }
+ windowMap.put(order, object);
+ }
+ }
+ catch (NumberFormatException ignore)
+ {
+ }
+ }
+ }
+
+ public String getRegionName(PortalNode window)
+ {
+ for (Iterator i = regionMap.entrySet().iterator();i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ SortedMap windows = (SortedMap)entry.getValue();
+ for (Iterator j = windows.values().iterator();j.hasNext();)
+ {
+ PortalNode window2 = (PortalNode)j.next();
+ if (window.equals(window2))
+ {
+ return (String)entry.getKey();
+ }
+ }
+ }
+ return null;
+ }
+
+ public Set getRegionNames()
+ {
+ return regionMap.keySet();
+ }
+
+ public Collection getWindows(String regionName)
+ {
+ return ((Map)regionMap.get(regionName)).values();
+ }
+
+ public WindowState getWindowState(PortalNode window)
+ {
+ return nsContext.getWindowState(window);
+ }
+
+ public void setWindowState(PortalNode window, WindowState windowState)
+ {
+ nsContext.setWindowState(window, windowState);
+ }
+ }
+}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/plugins/HeaderContentPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.plugins;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.Writer;
-
-/*
- * Portlet to demonstrate the declarative header content feature.
- * <p>This portlet injects css into the html HEAD tag via jboss-portlet.xml</p>
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $Revision: 5448 $
-*/
-
-public class HeaderContentPortlet extends GenericPortlet
-{
- public void doView(RenderRequest req, RenderResponse res) throws PortletException, IOException
- {
- res.setProperty("HEADER_CONTENT", "<script type=\"text/javascript\">/* Just to check it is inserted in the headers */</script>");
-
- res.setContentType("text/html");
- Writer writer = res.getWriter();
- writer.write("<div id='Introducing-HeaderContent'/>");
- writer.write("<div class=\"portlet-section-body\"><p id='rewrite-js'><button id=\"Introducing-HeaderContentInput\" class=\"portlet-form-button\" type='button' onClick='injectJS()'>Call injected javascript</button></p></div>");
- writer.flush();
- writer.close();
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/BasicPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,149 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.Portlet;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class BasicPortlet implements Portlet
-{
-
- private PortletConfig config;
-
- public void init(PortletConfig config) throws PortletException
- {
- this.config = config;
- }
-
- public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
- {
- for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
- response.setRenderParameter(name + " from action", values);
- }
- response.setWindowState(request.getWindowState());
- }
-
- public void render(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
- {
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
-
- //
- writer.write("window state : " + request.getWindowState());
- writer.write("<table><th><td>name</td><td>value</td></th>");
- for (Iterator i = request.getParameterMap().entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
- writer.write("<tr><td>" + name + "</td><td>" + values[0] + "</td></tr>");
- }
- writer.write("</table>");
-
- //
- PortletURL renderURL = response.createRenderURL();
- writeLink(writer, renderURL, "empty");
-
- //
- renderURL.setParameter("foo", "bar");
- writeLink(writer, renderURL, "foo=bar");
-
- //
- renderURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, renderURL, "maximized,foo=bar");
-
- //
- renderURL = response.createRenderURL();
- renderURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, renderURL, "maximized");
-
- //
- renderURL = response.createRenderURL();
- renderURL.setWindowState(WindowState.NORMAL);
- writeLink(writer, renderURL, "normal");
-
- //
- renderURL.setWindowState(WindowState.NORMAL);
- renderURL.setParameter("foo", "bar");
- writeLink(writer, renderURL, "normal,foo=bar");
-
- PortletURL actionURL = response.createActionURL();
- writeLink(writer, actionURL, "empty");
-
- //
- actionURL.setParameter("foo", "bar");
- writeLink(writer, actionURL, "foo=bar");
-
- //
- actionURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, actionURL, "maximized,foo=bar");
-
- //
- actionURL = response.createRenderURL();
- actionURL.setWindowState(WindowState.MAXIMIZED);
- writeLink(writer, actionURL, "maximized");
-
- //
- actionURL = response.createRenderURL();
- actionURL.setWindowState(WindowState.NORMAL);
- writeLink(writer, actionURL, "normal");
-
- //
- actionURL.setWindowState(WindowState.NORMAL);
- actionURL.setParameter("foo", "bar");
- writeLink(writer, actionURL, "normal,foo=bar");
-
- //
- writer.close();
- }
-
- private void writeLink(PrintWriter writer, PortletURL url, String label)
- {
- writer.print("<div><a href=\"" + url + "\">" + label + "</a></div>");
- }
-
- public void destroy()
- {
- this.config = null;
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CharsetPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,281 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.format.util.EntityTable;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * This portlet is used to display a form that helps to test the charset handling by the portal and the client. When a
- * fault occurs it may be the client fault (for instance the char with unicode value 160 fail the test in firefox but
- * succeds in IE6).
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class CharsetPortlet extends GenericPortlet
-{
-
- private static final Logger log = Logger.getLogger(CharsetPortlet.class);
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- String fromString = req.getParameter("from");
- String toString = req.getParameter("to");
- int from;
- int to;
- try
- {
- from = Integer.parseInt(fromString);
- to = Integer.parseInt(toString);
- }
- catch (NumberFormatException ignore)
- {
- from = 65;
- to = 256;
- }
- resp.setRenderParameter("from", "" + from);
- resp.setRenderParameter("to", "" + to);
-
- //
- String text = req.getParameter("text");
- if (text != null)
- {
- StringBuffer buffer = new StringBuffer();
- for (int i = from; i < to; i++)
- {
- char c = (char)i;
- if (useChar(c))
- {
- buffer.append(c);
- }
- }
- String expectedText = buffer.toString();
- boolean same = expectedText.equals(text);
- if (!same)
- {
- log.error("The input does not match the expected string");
- log.error("Expected string " + expectedText);
- log.error("Received string " + text);
- }
- resp.setRenderParameter("same", "" + same);
- }
- }
-
-
- protected void doHelp(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.print("This portlet shows different ways to properly display and submit unicode text");
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- String sameString = req.getParameter("same");
- Boolean same = null;
- if ("true".equalsIgnoreCase(sameString))
- {
- same = Boolean.TRUE;
- }
- else if ("false".equalsIgnoreCase(sameString))
- {
- same = Boolean.FALSE;
- }
-
- //
- String fromString = req.getParameter("from");
- String toString = req.getParameter("to");
- int from = 65;
- int to = 256;
- try
- {
- from = Integer.parseInt(fromString);
- to = from + 16;
- to = Integer.parseInt(toString);
- }
- catch (NumberFormatException ignore)
- {
- //
- }
-
- //
- if (to <= from)
- {
- to = from + 16;
- }
-
- //
- StringBuffer escapedText = new StringBuffer();
- StringBuffer text = new StringBuffer();
- for (int i = from; i < to; i++)
- {
- char c = (char)i;
- if (useChar(c))
- {
- text.append(c);
- String s = EntityTable.FULL.lookup(c);
- if (s == null)
- {
- escapedText.append(c);
- }
- else
- {
- escapedText.append("&").append(s).append(";");
- }
- }
- }
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.println("<div style=\"border-top:solid 1px\">Testing range:</div>");
- writer.print(
- "<div>" +
- "<form action=\"" + resp.createActionURL() + "\" method=\"post\"\">" +
- "<input type=\"text\" name=\"from\" value=\"" + from + "\"/>" +
- "<input type=\"text\" name=\"to\" value=\"" + to + "\"/>" +
- "<input type=\"submit\" value=\"change\"/>" +
- "</form>" +
- "</div>");
-
- //
- writer.println("<div style=\"border-top:solid 1px\">Test processAction() with a textarea field:</div>");
- writer.println(
- "<div>" +
- "<form action=\"" + resp.createActionURL() + "\" accept-charset=\"" + resp.getCharacterEncoding() + "\" method=\"post\">" +
- "<input type=\"hidden\" name=\"from\" value=\"" + from + "\"/>" +
- "<input type=\"hidden\" name=\"to\" value=\"" + to + "\"/>" +
- "<textarea name=\"text\" cols=\"20\" rows=\"10\" wrap=\"virtual\">" + escapedText + "</textarea>" +
- "<input type=\"submit\" value=\"check\"/>" +
- "</form>" +
- "</div>");
-
- //
- writer.println("<div style=\"border-top:solid 1px\">Test processAction() with a text field:</div>");
- writer.println(
- "<div>" +
- "<form action=\"" + resp.createActionURL() + "\" accept-charset=\"" + resp.getCharacterEncoding() + "\" method=\"post\">" +
- "<input type=\"hidden\" name=\"from\" value=\"" + from + "\"/>" +
- "<input type=\"hidden\" name=\"to\" value=\"" + to + "\"/>" +
- "<input type=\"text\" name=\"text\" value=\"" + escapedText + "\"/>" +
- "<input type=\"submit\" value=\"check\"/>" +
- "</form>" +
- "</div>");
-
- //
- PortletURL url = resp.createActionURL();
- url.setParameter("text", text.toString());
- writer.println("<div style=\"border-top:solid 1px\">Test processAction() with a portlet parameter:</div>");
- writer.println(
- "<div>" +
- "<form action=\"" + url + "\" accept-charset=\"" + resp.getCharacterEncoding() + "\" method=\"post\">" +
- "<input type=\"hidden\" name=\"from\" value=\"" + from + "\"/>" +
- "<input type=\"hidden\" name=\"to\" value=\"" + to + "\"/>" +
- "<input type=\"submit\" value=\"check\"/>" +
- "</form>" +
- "</div>");
-
- //
- PortletURL url2 = resp.createActionURL();
- url2.setParameter("text", text.toString());
- url2.setParameter("from", "" + from);
- url2.setParameter("to", "" + to);
- writer.println("<div style=\"border-top:solid 1px\"><a href=\"" + url2 + "\">Test</a> processAction() with a portlet parameter:</div>");
-
- //
- if (same != null)
- {
- writer.print("<div style=\"color:red;margin-top:2em;margin-bottom:2em\">Test result: ");
- if (same == Boolean.TRUE)
- {
- writer.print("The input matched the expected result");
- }
- else if (same == Boolean.FALSE)
- {
- writer.print("The input did not matched the expected result");
- }
- writer.print("</div>");
- }
-
- //
- writer.close();
- }
-
- public static boolean useChar(char c)
- {
- switch (Character.getType(c))
- {
- case Character.LOWERCASE_LETTER: // Ll
- case Character.UPPERCASE_LETTER: // Lu
- case Character.TITLECASE_LETTER: // Lt
- case Character.MODIFIER_LETTER: // Lm
- case Character.OTHER_LETTER: // Lo
- case Character.NON_SPACING_MARK: // Mn
- case Character.ENCLOSING_MARK: // Me
- case Character.COMBINING_SPACING_MARK: // Mc
- case Character.DECIMAL_DIGIT_NUMBER: // Nd
- case Character.LETTER_NUMBER: // Nl
- case Character.OTHER_NUMBER: // No
- case Character.SPACE_SEPARATOR: // Zs
- case Character.LINE_SEPARATOR: // Zl
- case Character.PARAGRAPH_SEPARATOR: // Zp
- case Character.DASH_PUNCTUATION: // Pd
- case Character.START_PUNCTUATION: // Ps
- case Character.END_PUNCTUATION: // Pe
- case Character.CONNECTOR_PUNCTUATION: // Pc
- case Character.OTHER_PUNCTUATION: // Po
- case Character.INITIAL_QUOTE_PUNCTUATION: // Pi
- case Character.FINAL_QUOTE_PUNCTUATION: // Pf
- case Character.MATH_SYMBOL: // Sm
- case Character.CURRENCY_SYMBOL: // Sc
- case Character.MODIFIER_SYMBOL: // Sk
- case Character.OTHER_SYMBOL: // So
- return true;
- default:
- case Character.UNASSIGNED: // Cn
- case Character.CONTROL: // Cc
- case Character.FORMAT: // Cf
- case Character.PRIVATE_USE: // Co
- case Character.SURROGATE: // Cs
- return false;
- }
- }
-
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/CounterPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,75 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletSession;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class CounterPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- PortletSession session = req.getPortletSession();
- int count = 0;
- if (session.getAttribute("count") != null)
- {
- count = ((Integer)session.getAttribute("count")).intValue() + 1;
- }
- session.setAttribute("count", new Integer(count));
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Render call count</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>" + count + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- writer.write("<div class=\"portlet-section-header\">Render call count</div>");
- writer.write("<div><a href=\"" + resp.createActionURL() + "\">action</a></div");
- writer.write("<div><a href=\"" + resp.createRenderURL() + "\">render</a></div");
-
- //
- writer.close();
- }
-
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/EncodingPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,105 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 5448 $
- */
-public class EncodingPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- resp.setRenderParameter("text", req.getParameter("text"));
- req.getPortletSession().setAttribute("text", req.getParameter("text"));
-
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- String param = req.getParameter("text");
- String attr = (String)req.getPortletSession().getAttribute("text");
-
- //
- writer.print(
- "<div> Text to pass : " +
- "<form action=\"" + resp.createRenderURL() + "\" method=\"post\"\">" +
- "<input type=\"text\" name=\"text\" value=\"\"/>" +
- "<input type=\"submit\" value=\"Submit to render phase\"/>" +
- "</form>" +
- "<form action=\"" + resp.createActionURL() + "\" method=\"post\"\">" +
- "<input type=\"text\" name=\"text\" value=\"\"/>" +
- "<input type=\"submit\" value=\"Submit to action phase\"/>" +
- "</form>" +
- "</div>");
-
- //
- writer.println(
- "<div>" + "Text retrieved from request parameter: " +
- "</div>" +
- "<div>" +
- "<textarea name=\"text\" cols=\"20\" rows=\"4\" wrap=\"virtual\">");
-
- if (param != null)
- {
- writer.println(param);
- }
-
- writer.println(
- "</textarea>" +
- "</div>");
-
- writer.println(
- "<div>" + "Text retrieved from portlet session (value set during Action Phase): " +
- "</div>" +
- "<div>" +
- "<textarea name=\"text\" cols=\"20\" rows=\"4\" wrap=\"virtual\">");
-
- if (attr != null)
- {
- writer.println(attr);
- }
-
- writer.println(
- "</textarea>" +
- "</div>");
-
- //
- writer.close();
- }
-
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/ExceptionPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,113 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.portlet.GenericPortlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletRequest;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class ExceptionPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- throwException(req);
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- throwException(req);
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
- PortletURL renderURL = resp.createRenderURL();
- PortletURL actionURL = resp.createActionURL();
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Throw :</div>");
- writer.write("<div class=\"portlet-section-body\">");
- renderURL.setParameter("op", "portletexception");
- writer.write("<div><a href=\"" + renderURL + "\">render PortletException</a></div>");
- renderURL.setParameter("op", "portletsecurityexception");
- writer.write("<div><a href=\"" + renderURL + "\">render PortletSecurityException</a></div>");
- renderURL.setParameter("op", "ioexception");
- writer.write("<div><a href=\"" + renderURL + "\">render IOException</a></div>");
- renderURL.setParameter("op", "runtimeexception");
- writer.write("<div><a href=\"" + renderURL + "\">render RuntimeException</a></div>");
- actionURL.setParameter("op", "error");
- writer.write("<div><a href=\"" + renderURL + "\">render Error</a></div>");
- actionURL.setParameter("op", "portletexception");
- writer.write("<div><a href=\"" + actionURL + "\">action PortletException</a></div>");
- actionURL.setParameter("op", "portletsecurityexception");
- writer.write("<div><a href=\"" + actionURL + "\">action PortletSecurityException</a></div>");
- actionURL.setParameter("op", "ioexception");
- writer.write("<div><a href=\"" + actionURL + "\">action IOException</a></div>");
- actionURL.setParameter("op", "runtimeexception");
- writer.write("<div><a href=\"" + actionURL + "\">action RuntimeException</a></div>");
- actionURL.setParameter("op", "error");
- writer.write("<div><a href=\"" + actionURL + "\">action Error</a></div>");
- writer.write("</div>");
- writer.write("</p>");
- }
-
- private void throwException(PortletRequest req) throws PortletException, IOException
- {
- String op = req.getParameter("op");
-
- // Throw any required exception
- if ("portletexception".equals(op))
- {
- throw new PortletException();
- }
- if ("portletsecurityexception".equals(op))
- {
- throw new PortletSecurityException("");
- }
- if ("ioexception".equals(op))
- {
- throw new IOException();
- }
- if ("runtimeexception".equals(op))
- {
- throw new RuntimeException();
- }
- if ("error".equals(op))
- {
- throw new Error();
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,274 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderResponse;
-import javax.portlet.RenderRequest;
-import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import java.io.IOException;
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.nio.channels.FileChannel;
-import java.nio.ByteBuffer;
-
-/**
- * <p>An example of content driven portlet that display the files located in the war file. The portlet does not implement
- * any code to improve performance like caching in order to keep the code easier to understand. It should not be
- * used in production for a large scale portal.</p>
- *
- * <p>Content URI is defined as the canonical path of the file relative to the war file context root.</p>
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FSContentDrivenPortlet extends GenericPortlet
-{
-
- /** The edit_content mode. */
- public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
-
- /**
- * Additional dispatch that will call the <code>doEditContent(RenderRequest,RenderResponse)</code> method.
- */
- protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
- {
- doEditContent(req, resp);
- }
- else
- {
- super.doDispatch(req, resp);
- }
- }
-
- /**
- * Implements the edit content functionnality.
- */
- protected void doEditContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- // Get the uri value optionally provided by the portal
- String uri = req.getParameter("content.uri");
-
- // Get the working directory directory
- File workingDir;
- if (uri != null)
- {
- workingDir = getFile(uri).getParentFile();
- }
- else
- {
- // Otherwise try to get the current directory we are browsing, if no current dir exist we use the root
- String currentDir = req.getParameter("current_dir");
- if (currentDir == null)
- {
- currentDir = "/";
- }
- workingDir = getFile(currentDir);
- }
-
- // Get the parent path
- String parentPath = getContentURI(workingDir.getParentFile());
-
- // Get the children of the selected file, we use a filter to retain only text files and avoid WEB-INF dir
- File[] children = workingDir.listFiles(filter);
-
- // Configure the response
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.print("Directories:<br/>");
- writer.print("<ul>");
- PortletURL choseDirURL = resp.createRenderURL();
- if (parentPath != null)
- {
- choseDirURL.setParameter("current_dir", parentPath);
- writer.print("<li><a href=\"" + choseDirURL + "\">..</a></li>");
- }
- for (int i = 0;i < children.length;i++)
- {
- File child = children[i];
- if (child.isDirectory())
- {
- choseDirURL.setParameter("current_dir", getContentURI(child));
- writer.print("<li><a href=\"" + choseDirURL + "\">" + child.getName() + "</a></li>");
- }
- }
- writer.print("</ul><br/>");
-
- //
- writer.print("Files:<br/>");
- writer.print("<ul>");
- PortletURL selectFileURL = resp.createActionURL();
- selectFileURL.setParameter("content.action.select", "select");
- for (int i = 0;i < children.length;i++)
- {
- File child = children[i];
- if (child.isFile())
- {
- selectFileURL.setParameter("content.uri", getContentURI(child));
- writer.print("<li><a href=\"" + selectFileURL + "\">" + child.getName() + "</a></li>");
- }
- }
- writer.print("</ul><br/>");
-
- //
- writer.close();
- }
-
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- // Get the URI provided by the portal
- String uri = req.getParameter("uri");
-
- // Configure the response
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- if (uri == null)
- {
- writer.print("No selected file");
- }
- else
- {
- File file = getFile(uri);
- FileInputStream in = null;
- try
- {
- in = new FileInputStream(file);
- FileChannel channel = in.getChannel();
- byte[] bytes = new byte[(int)channel.size()];
- ByteBuffer buffer = ByteBuffer.wrap(bytes);
- channel.read(buffer);
- writer.write(new String(bytes, 0, bytes.length, "UTF8"));
- }
- catch (FileNotFoundException e)
- {
- writer.print("No such file " + uri);
- getPortletContext().log("Cannot find file " + uri, e);
- }
- finally
- {
- if (in != null)
- {
- in.close();
- }
- }
- }
-
- //
- writer.close();
- }
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
- {
- String contentURI = req.getParameter("content.uri");
-
- // We just propagate the content URI as a render parameter for the doEditContent method
- if (contentURI != null)
- {
- resp.setRenderParameter("content.uri", contentURI);
- }
- }
- }
-
- /**
- * Return a file from the specified path or null if the file cannot be determined.
- *
- * @param contentURI the file path
- * @return the file or null
- */
- protected File getFile(String contentURI) throws IOException
- {
- String realPath = getPortletContext().getRealPath(contentURI);
- if (realPath == null)
- {
- throw new IOException("Cannot access war file content");
- }
- File file = new File(realPath);
- if (!file.exists())
- {
- throw new IOException("File " + contentURI + " does not exist");
- }
- return file;
- }
-
- /**
- * Return the content uri of the file or null if it cannot be determined.
- *
- * @param file the file to get the URI from
- * @return the URI or null
- */
- protected String getContentURI(File file) throws IOException
- {
- String rootPath = getPortletContext().getRealPath("/");
- if (rootPath == null)
- {
- throw new IOException("Cannot access war file content");
- }
-
- // Make it canonical
- rootPath = new File(rootPath).getCanonicalPath();
-
- // Get the portion of the path that is significant for us
- String filePath = file.getCanonicalPath();
- return filePath.length() >= rootPath.length() ? filePath.substring(rootPath.length()) : null;
- }
-
- /**
- * Avoid the WEB-INF directory and list only text files.
- */
- private final FileFilter filter = new FileFilter()
- {
- public boolean accept(File file)
- {
- String name = file.getName();
- if (file.isDirectory())
- {
- return !"WEB-INF".equals(name);
- }
- else if (file.isFile())
- {
- return name.endsWith(".txt");
- }
- else
- {
- return false;
- }
- }
- };
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FileUploadPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,108 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import org.apache.commons.fileupload.portlet.PortletFileUpload;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileUploadException;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FileUploadPortlet extends GenericPortlet
-{
-
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
-
- //
- List fileNames = new ArrayList();
- List fileSizes = new ArrayList();
-
- //
- try
- {
- DiskFileItemFactory factory = new DiskFileItemFactory();
- PortletFileUpload upload = new PortletFileUpload(factory);
- List fileItems = upload.parseRequest(req);
- for (Iterator iterator = fileItems.iterator();iterator.hasNext();)
- {
- FileItem item = (FileItem)iterator.next();
- if (!item.isFormField())
- {
- fileNames.add("" + item.getName());
- fileSizes.add("" + item.getSize());
- }
- }
- }
- catch (FileUploadException e)
- {
- throw new PortletException(e);
- }
-
- //
- resp.setRenderParameter("fileNames", (String[])fileNames.toArray(new String[fileNames.size()]));
- resp.setRenderParameter("fileSizes", (String[])fileSizes.toArray(new String[fileSizes.size()]));
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- //
- resp.setContentType("text/html");
-
- //
- PrintWriter writer = resp.getWriter();
-
- String[] fileNames = req.getParameterValues("fileNames");
- String[] fileSizes = req.getParameterValues("fileSizes");
- if (fileNames != null && fileSizes != null && fileNames.length == fileSizes.length)
- {
- for (int i = 0;i < fileNames.length;i++)
- {
- writer.println("Received file " + fileNames[i] + " with size " + fileSizes[i] + "<br/>");
- }
- }
-
- //
- writer.println("<form action=\"" + resp.createActionURL() + "\" method=\"post\" enctype=\"multipart/form-data\">");
- writer.println("<input type=\"file\" name=\"File\">");
- writer.println("<input type=\"submit\" name=\"Upload\">");
- writer.println("</form>");
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FormAutoSubmitPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,66 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class FormAutoSubmitPortlet extends GenericPortlet
-{
-
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- }
-
- protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
-
- //
- PrintWriter writer = resp.getWriter();
- PortletURL actionURL = resp.createActionURL();
- String formId = resp.getNamespace() + "_the_form";
-
- //
- writer.write("<form id=\"" + formId + "\" action=\"" + actionURL + "\">");
- writer.write("<select onclick=\"document.getElementById('" + formId + "').submit()\" multiple=\"multiple\">");
- writer.write("<option>A</option>");
- writer.write("<option>B</option>");
- writer.write("<option>C</option>");
- writer.write("</select>");
- writer.write("</form>");
- writer.write("<a href=\"javascript:document.getElementById('" + formId + "').submit()\">submit</a>");
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/PortletSessionPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,113 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSession;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PortletSessionPortlet extends GenericPortlet
-{
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, IOException
- {
- String name = req.getParameter("name");
- String value = req.getParameter("value");
- boolean portletScope = req.getParameter("portlet") != null;
- if (name != null && value != null)
- {
- req.getPortletSession().setAttribute(name, value, portletScope ? PortletSession.PORTLET_SCOPE : PortletSession.APPLICATION_SCOPE);
- }
- if (req.getParameter("invalidate") != null)
- {
- req.getPortletSession().invalidate();
- }
- }
-
- public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
- {
- PortletSession session = req.getPortletSession(false);
- PortletURL purl = resp.createActionURL();
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- if (session == null)
- {
- writer.println("No session");
- }
- else
- {
- writer.println("Session id = " + session.getId());
- writer.println("<br/>");
-
- //
- print(session, PortletSession.PORTLET_SCOPE, writer);
- writer.println("<br/>");
-
- //
- print(session, PortletSession.APPLICATION_SCOPE, writer);
- writer.println("<br/>");
-
- }
-
- //
- writer.println("<form action=\"" + purl.toString() + "\" method=\"post\">");
- writer.println("<input type=\"text\" name=\"name\"/>");
- writer.println("<input type=\"text\" name=\"value\"/>");
- writer.println("<input type=\"submit\" name=\"portlet\" value=\"Add to portlet scope\"/>");
- writer.println("<input type=\"submit\" name=\"application\" value=\"Add to application scope\"/>");
- writer.println("</form><br/>");
-
- //
- purl.setParameter("invalidate", "true");
- writer.println("<a href=\"" + purl.toString() + "\">invalidate</a><br/>");
- }
-
- private void print(PortletSession session, int scope, PrintWriter writer)
- {
- writer.println("<table>");
- writer.println("<tr><td>name</td><td>value</td>");
- for (Enumeration e = session.getAttributeNames(scope); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- Object value = session.getAttribute(name, scope);
- writer.println("<tr><td>" + name + "</td><td>" + value + "</td>");
- }
- writer.println("</table>");
- }
-
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/TestPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,237 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import org.jboss.portal.common.transaction.TransactionManagerProvider;
-import org.jboss.portal.core.CoreConstants;
-import org.jboss.portal.identity.User;
-import org.jboss.portlet.JBossActionRequest;
-import org.jboss.portlet.JBossActionResponse;
-import org.jboss.portlet.JBossPortlet;
-import org.jboss.portlet.JBossRenderRequest;
-import org.jboss.portlet.JBossRenderResponse;
-
-import javax.portlet.PortalContext;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.transaction.Transaction;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5883 $
- */
-public class TestPortlet extends JBossPortlet
-{
-
- public void main(JBossActionRequest req, JBossActionResponse resp)
- {
- }
-
- public void addrole(JBossActionRequest req, JBossActionResponse resp)
- {
- String role = req.getParameter("role");
- Set roles = (Set)req.getPortletSession().getAttribute("roles");
- if (roles == null)
- {
- roles = new HashSet();
- req.getPortletSession().setAttribute("roles", roles);
- }
- roles.add(role);
- }
-
- public void testaction(JBossActionRequest req, JBossActionResponse resp)
- {
- resp.setRenderParameter("name", "value");
- }
-
- protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- User user = req.getUser();
- if (user != null)
- {
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">User infos</div>");
- writer.write("<div class=\"portlet-section-body\">");
-
- //TODO: update this with new Identity API
- //writer.write("<div>Last visit date : " + user.getLastVisitDate() + "</div>");
- writer.write("</div>");
- writer.write("</p>");
- }
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Portlet security infos</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>RemoteUser : " + req.getRemoteUser() + "</div>");
- writer.write("<div>Principal : " + req.getUserPrincipal() + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Portlet security role test</div>");
- Set roles = (Set)req.getPortletSession().getAttribute("roles");
- if (roles != null)
- {
- writer.write("<div class=\"portlet-section-body\">");
- for (Iterator i = roles.iterator(); i.hasNext();)
- {
- String role = (String)i.next();
- writer.write("<div>" + role + " " + req.isUserInRole(role) + "</div>");
- }
- writer.write("</div>");
- }
- PortletURL roleURL = resp.createActionURL();
- roleURL.setParameter("op", "addrole");
- writer.write("<div>" +
- "<form action=\"" + roleURL + "\" method=\"post\">" +
- "<input class=\"portlet-form-input-field\" type=\"text\" name=\"role\" value=\"\"/>" +
- "<input class=\"portlet-form-button\" type=\"submit\" value=\"add role\"/>" +
- "</form>" +
- "</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Capabilities</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>Content type " + req.getResponseContentType() + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- PortletURL url = resp.createRenderURL();
- url.setSecure(false);
- String httpURL = url.toString();
- url.setSecure(true);
- String httpsURL = url.toString();
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Secure</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div><a href=\"" + httpURL + "\">http</a></div>");
- writer.write("<div><a href=\"" + httpsURL + "\">https</a></div>");
- writer.write("</div>");
- writer.write("</p>");
-
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Path</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>portal path info = " + req.getAttribute("PATH") + "</div>");
- writer.write("<div>portal path info = " + req.getParameter("PATH") + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Portal infos</div>");
- writer.write("<div class=\"portlet-section-body\">");
- PortalContext portalCtx = req.getPortalContext();
- writer.write("<div>version : " + portalCtx.getPortalInfo() + "</div>");
- for (Enumeration e = portalCtx.getPropertyNames(); e.hasMoreElements();)
- {
- String propertyName = (String)e.nextElement();
- String propertyValue = portalCtx.getProperty(propertyName);
- writer.write("<div>" + propertyName + " : " + propertyValue + "</div>");
- }
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Request attributes</div>");
- writer.write("<div class=\"portlet-section-body\">");
- for (Enumeration e = req.getAttributeNames(); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- Object value = req.getAttribute(name);
- writer.write("<div>" + name + " : " + value + "</div>");
- }
- writer.write("</div>");
- writer.write("</p>");
-
- // User properties
- Map userInfoMap = (Map)req.getAttribute(PortletRequest.USER_INFO);
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">User properties</div>");
- writer.write("<div class=\"portlet-section-body\">");
- if (userInfoMap != null)
- {
- for (Iterator i = userInfoMap.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
- writer.write("<div>" + key + " : " + value + "</div>");
- }
- }
- writer.write("</div>");
- writer.write("</p>");
-
- //
- PortletURL actionURL = resp.createActionURL();
- actionURL.setParameter("op", "testaction");
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Test action</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div><a href=\"" + actionURL + "\">action</a></div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.write("<p>");
- writer.write("<div class=\"portlet-section-header\">Test current transaction</div>");
- writer.write("<div class=\"portlet-section-body\">");
- writer.write("<div>" + getCurrentTransaction() + "</div>");
- writer.write("</div>");
- writer.write("</p>");
-
- //
- writer.close();
- }
-
- private Transaction getCurrentTransaction()
- {
- try
- {
- return TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager().getTransaction();
- }
- catch (Exception e)
- {
- return null;
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/URLPortlet.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,118 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class URLPortlet extends GenericPortlet
-{
- public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, IOException
- {
- for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- String value = req.getParameter(name);
- if (!"name".equals(name) && !"value".equals(name))
- {
- resp.setRenderParameter(name, value);
- }
- }
- String name = req.getParameter("name");
- String value = req.getParameter("value");
- if (name != null && value != null)
- {
- resp.setRenderParameter(name, value);
- }
- }
-
- public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
- {
- String color = req.getParameter("color");
- if (color == null)
- {
- color = "white";
- }
-
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- PortletURL renderURL = resp.createRenderURL();
-
- //
- renderURL.setParameter("color", "blue");
- String blueURL = renderURL.toString();
-
- //
- renderURL.setParameter("color", "red");
- String redURL = renderURL.toString();
-
- //
- renderURL.setParameter("color", "white");
- String whiteURL = renderURL.toString();
-
- //
- writer.print("<a href=\"" + blueURL + "\">blue</a> -");
- writer.print("<a href=\"" + redURL + "\">red</a> -");
- writer.print("<a href=\"" + whiteURL + "\">white</a><br/>");
-
- //
- writer.print("Parameters :<br/>");
- writer.print("<table bgcolor=\"" + color + "\">");
- writer.print("<tr><td>Name</td><td>value</td></tr>");
- for (Enumeration e = req.getParameterNames(); e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- String value = req.getParameter(name);
- writer.print("<tr><td>" + name + "</td><td>" + value + "</td></tr>");
- }
- writer.print("</table>");
-
- //
- PortletURL actionURL = resp.createActionURL();
- writer.print("<form action=\"" + actionURL.toString() + "\" method=\"post\">");
- writer.print("<input type=\"text\" name=\"name\"/>");
- writer.print("<input type=\"text\" name=\"value\"/>");
- writer.print("<input type=\"submit\" value=\"add\"/>");
- writer.print("</form>");
-
- //
- writer.print("<a href=\"" + req.getContextPath() + "/test.txt\">test</a>");
-
- //
- writer.close();
- }
-}
\ No newline at end of file
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortalEventListenerLogger.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,54 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.api.event.PortalEventListener;
-import org.jboss.portal.api.event.PortalEvent;
-import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.session.event.PortalSessionEvent;
-import org.jboss.portal.api.user.event.UserAuthenticationEvent;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortalEventListenerLogger implements PortalEventListener
-{
- public void onEvent(PortalEventContext eventContext, PortalEvent event)
- {
- if (event instanceof PortalSessionEvent)
- {
- PortalSessionEvent use = (PortalSessionEvent)event;
- System.out.println(use.getType() == PortalSessionEvent.SESSION_CREATED ? "session created" : "session destroyed");
- }
- else if (event instanceof UserAuthenticationEvent)
- {
- UserAuthenticationEvent uae = (UserAuthenticationEvent)event;
- System.out.println(uae.getType() == UserAuthenticationEvent.SIGN_IN ? "user login" : "user logout");
- }
- else
- {
- System.out.println("event = " + event);
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletA.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PortletA extends GenericPortlet
-{
- protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
- {
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- writer.println("<form action=\"" + response.createActionURL() + "\" method=\"post\">");
- writer.println("<select name=\"color\">");
- writer.println("<option>blue</option>");
- writer.println("<option>red</option>");
- writer.println("<option>black</option>");
- writer.println("</select>");
- writer.println("<input type=\"submit\"/>");
- writer.println("</form>");
- writer.close();
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/PortletB.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,108 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.WindowState;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.node.event.PortalNodeEvent;
-import org.jboss.portal.api.node.event.PortalNodeEventContext;
-import org.jboss.portal.api.node.event.PortalNodeEventListener;
-import org.jboss.portal.api.node.event.WindowActionEvent;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class PortletB extends GenericPortlet
-{
-
- public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
- {
- String color = request.getParameter("color");
- if (color != null)
- {
- response.setRenderParameter("color", color);
- }
- }
-
- protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
- {
- String color = request.getParameter("color");
- response.setContentType("text/html");
- PrintWriter writer = response.getWriter();
- writer.println("<div" +
- (color == null ? "" : " style=\"color:" + color + ";\"") +
- ">some text in color</div>");
- writer.close();
- }
-
- public static class Listener implements PortalNodeEventListener
- {
- public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event)
- {
- PortalNode node = event.getNode();
-
- // Get node name
- String nodeName = node.getName();
-
- // See if we need to create a new event or not
- WindowActionEvent newEvent = null;
- if (nodeName.equals("PortletAWindow") && event instanceof WindowActionEvent)
- {
- // Find window B
- WindowActionEvent wae = (WindowActionEvent)event;
- PortalNode windowB = node.resolve("../PortletBWindow");
- if (windowB != null)
- {
- // We can redirect
- newEvent = new WindowActionEvent(windowB);
- newEvent.setMode(wae.getMode());
- newEvent.setWindowState(WindowState.MAXIMIZED);
- newEvent.setParameters(wae.getParameters());
- }
- }
-
- //
- if (newEvent != null)
- {
- // If we have a new event redirect to it
- return newEvent;
- }
- else
- {
- // Otherwise bubble up
- return context.dispatch();
- }
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/UserCounterListener.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.api.event.PortalEvent;
-import org.jboss.portal.api.event.PortalEventContext;
-import org.jboss.portal.api.event.PortalEventListener;
-import org.jboss.portal.api.user.event.UserAuthenticationEvent;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedLong;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision: 1.1 $
- */
-public class UserCounterListener implements PortalEventListener
-{
-
- /** . */
- private final SynchronizedLong counter = new SynchronizedLong(0);
-
- /** . */
- private final SynchronizedLong counterEver = new SynchronizedLong(0);
-
- public void onEvent(PortalEventContext eventContext, PortalEvent event)
- {
- if (event instanceof UserAuthenticationEvent)
- {
- UserAuthenticationEvent userEvent = (UserAuthenticationEvent)event;
- if (userEvent.getType() == UserAuthenticationEvent.SIGN_IN)
- {
- counter.increment();
- counterEver.increment();
- }
- else if (userEvent.getType() == UserAuthenticationEvent.SIGN_OUT)
- {
- counter.decrement();
- }
- System.out.println("Counter : " + counter.get());
- System.out.println("Counter ever: " + counterEver.get());
- }
- }
-}
Deleted: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/event/WindowConstraintEventListener.java 2007-06-26 13:40:06 UTC (rev 7549)
@@ -1,254 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.portlet.test.event;
-
-import org.jboss.portal.api.node.event.PortalNodeEventListener;
-import org.jboss.portal.api.node.event.PortalNodeEvent;
-import org.jboss.portal.api.node.event.PortalNodeEventContext;
-import org.jboss.portal.api.node.event.PageRenderEvent;
-import org.jboss.portal.api.node.event.WindowNavigationEvent;
-import org.jboss.portal.api.node.PortalNode;
-import org.jboss.portal.api.navstate.NavigationalStateContext;
-import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.WindowState;
-
-import java.util.Map;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WindowConstraintEventListener implements PortalNodeEventListener
-{
-
- public PortalNodeEvent onEvent(PortalNodeEventContext context, PortalNodeEvent event)
- {
- if (event instanceof PageRenderEvent)
- {
- PortalNode targetPage = event.getNode();
- WindowManipulator manipulator = new WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(), targetPage);
-
- // Filter window state for normal and minimized
- for (Iterator i = manipulator.getRegionNames().iterator();i.hasNext();)
- {
- boolean foundNormal = false;
- PortalNode firstWindow = null;
- String regionName = (String)i.next();
- for (Iterator j = manipulator.getWindows(regionName).iterator();j.hasNext();)
- {
- PortalNode window = (PortalNode)j.next();
-
- // Keep a ref on first window which can be used later
- if (firstWindow == null)
- {
- firstWindow = window;
- }
-
- //
- WindowState ws = manipulator.getWindowState(window);
- if (WindowState.NORMAL.equals(ws))
- {
- if (foundNormal)
- {
- manipulator.setWindowState(window, WindowState.MINIMIZED);
- }
- else
- {
- foundNormal = true;
- }
- }
- else if (WindowState.MINIMIZED.equals(ws))
- {
- //
- }
- else
- {
- manipulator.setWindowState(window, WindowState.MINIMIZED);
- }
- }
-
- //
- if (foundNormal == false && firstWindow != null)
- {
- manipulator.setWindowState(firstWindow, WindowState.NORMAL);
- }
- }
- }
- else if (event instanceof WindowNavigationEvent)
- {
- WindowNavigationEvent wne = (WindowNavigationEvent)event;
- PortalNode targetWindow = event.getNode();
- WindowManipulator manipulator = new WindowManipulator(context.getPortalRuntimeContext().getNavigationalStateContext(), targetWindow.getParent());
-
- //
- WindowState ws = wne.getWindowState();
-
- //
- if (WindowState.NORMAL.equals(ws))
- {
- String regionName = manipulator.getRegionName(targetWindow);
- if (regionName != null)
- {
- for (Iterator i = manipulator.getWindows(regionName).iterator();i.hasNext();)
- {
- PortalNode currentWindow = (PortalNode)i.next();
- if (currentWindow.equals(targetWindow))
- {
- // Do nothing
- }
- else
- {
- manipulator.setWindowState(currentWindow, WindowState.MINIMIZED);
- }
- }
- }
- }
- else if (WindowState.MINIMIZED.equals(ws))
- {
- String regionName = manipulator.getRegionName(targetWindow);
- if (regionName != null)
- {
- // Find the window following the minimized one
- PortalNode nextWindow = null;
- for (Iterator i = manipulator.getWindows(regionName).iterator();i.hasNext();)
- {
- PortalNode currentWindow = (PortalNode)i.next();
-
- // Keep a ref on the first window for later use
- if (nextWindow == null)
- {
- nextWindow = currentWindow;
- }
-
- //
- if (currentWindow.equals(targetWindow))
- {
- // Try to get the next window otherwise it means it's the last window
- // and we'll use the window we saved at the first iteration
- if (i.hasNext())
- {
- nextWindow = (PortalNode)i.next();
- }
-
- //
- break;
- }
- }
-
- // Normalize the next window
- if (nextWindow != null)
- {
- manipulator.setWindowState(nextWindow, WindowState.NORMAL);
- }
- }
- }
- }
- return context.dispatch();
- }
-
- public class WindowManipulator
- {
-
- /** . */
- private Map regionMap;
-
- /** . */
- private NavigationalStateContext nsContext;
-
- public WindowManipulator(NavigationalStateContext nsContext, PortalNode parent)
- {
- this.nsContext = nsContext;
-
- // Build appropriate structure
- regionMap = new HashMap();
- for (Iterator i = parent.getChildren().iterator();i.hasNext();)
- {
- try
- {
- PortalNode object = (PortalNode)i.next();
- if (object.getType() == PortalNode.TYPE_WINDOW)
- {
- String region = (String)object.getProperties().get(ThemeConstants.PORTAL_PROP_REGION);
- Integer order = new Integer((String)object.getProperties().get(ThemeConstants.PORTAL_PROP_ORDER));
-
- //
- SortedMap windowMap = (SortedMap)regionMap.get(region);
- if (windowMap == null)
- {
- windowMap = new TreeMap();
- regionMap.put(region, windowMap);
- }
- windowMap.put(order, object);
- }
- }
- catch (NumberFormatException ignore)
- {
- }
- }
- }
-
- public String getRegionName(PortalNode window)
- {
- for (Iterator i = regionMap.entrySet().iterator();i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- SortedMap windows = (SortedMap)entry.getValue();
- for (Iterator j = windows.values().iterator();j.hasNext();)
- {
- PortalNode window2 = (PortalNode)j.next();
- if (window.equals(window2))
- {
- return (String)entry.getKey();
- }
- }
- }
- return null;
- }
-
- public Set getRegionNames()
- {
- return regionMap.keySet();
- }
-
- public Collection getWindows(String regionName)
- {
- return ((Map)regionMap.get(regionName)).values();
- }
-
- public WindowState getWindowState(PortalNode window)
- {
- return nsContext.getWindowState(window);
- }
-
- public void setWindowState(PortalNode window, WindowState windowState)
- {
- nsContext.setWindowState(window, windowState);
- }
- }
-}
Copied: trunk/core-samples/src/resources/portal-basic-samples-sar (from rev 7535, trunk/core-samples/src/resources/portal-samples-sar)
Copied: trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF (from rev 7548, trunk/core-samples/src/resources/portal-samples-sar/META-INF)
Modified: trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-sar/META-INF/jboss-service.xml 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/resources/portal-basic-samples-sar/META-INF/jboss-service.xml 2007-06-26 13:40:06 UTC (rev 7549)
@@ -35,7 +35,7 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
<attribute name="RegistryId">test_listener</attribute>
- <attribute name="ListenerClassName">org.jboss.portal.core.portlet.test.event.PortletB$Listener</attribute>
+ <attribute name="ListenerClassName">org.jboss.portal.core.portlet.basic.event.PortletB$Listener</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
@@ -47,7 +47,7 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
<attribute name="RegistryId">window_event_listener</attribute>
- <attribute name="ListenerClassName">org.jboss.portal.core.portlet.test.event.WindowConstraintEventListener</attribute>
+ <attribute name="ListenerClassName">org.jboss.portal.core.portlet.basic.event.WindowConstraintEventListener</attribute>
</mbean>
<mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
@@ -59,7 +59,7 @@
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
<attribute name="RegistryId">user_listener</attribute>
- <attribute name="ListenerClassName">org.jboss.portal.core.portlet.test.event.PortalEventListenerLogger</attribute>
+ <attribute name="ListenerClassName">org.jboss.portal.core.portlet.basic.event.PortalEventListenerLogger</attribute>
</mbean>
<!-- mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
Copied: trunk/core-samples/src/resources/portal-basic-samples-war (from rev 7535, trunk/core-samples/src/resources/portal-samples-war)
Copied: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF (from rev 7548, trunk/core-samples/src/resources/portal-samples-war/WEB-INF)
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2007-06-26 13:40:06 UTC (rev 7549)
@@ -27,6 +27,7 @@
"http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
+<!--
<deployment>
<instance>
<instance-id>JSPPortletInstance</instance-id>
@@ -68,6 +69,8 @@
<portlet-ref>WeatherPortlet</portlet-ref>
</instance>
</deployment>
+-->
+
<deployment>
<instance>
<instance-id>HeaderContentPortletInstance</instance-id>
Modified: trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml 2007-06-26 13:25:00 UTC (rev 7548)
+++ trunk/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-06-26 13:40:06 UTC (rev 7549)
@@ -27,6 +27,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0">
+<!--
<portlet>
<description>Simple JSP portlet</description>
<portlet-name>JSPPortlet</portlet-name>
@@ -41,6 +42,9 @@
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
+-->
+
+<!--
<portlet>
<description>Event Portlet</description>
<portlet-name>EventPortlet</portlet-name>
@@ -55,12 +59,14 @@
<keywords>event, sample,test</keywords>
</portlet-info>
</portlet>
+-->
+
<portlet>
<description>Portlet to test modification of head content</description>
<portlet-name>HeaderContentPortlet</portlet-name>
<display-name>Header Content Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.plugins.HeaderContentPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.HeaderContentPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -75,7 +81,7 @@
<portlet-name>TestPortlet</portlet-name>
<display-name>Test Portlet</display-name>
<display-name xml:lang="fr">Portlet Test</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.TestPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.TestPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -119,7 +125,7 @@
<description>Portlet displaying the number of it's action/render calls</description>
<portlet-name>CounterPortlet</portlet-name>
<display-name>Counter Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.CounterPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.CounterPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -132,7 +138,7 @@
<description>Counter Portlet with cache support</description>
<portlet-name>CachedCounterPortlet</portlet-name>
<display-name>Cached Counter Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.CounterPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.CounterPortlet</portlet-class>
<expiration-cache>60</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
@@ -145,7 +151,7 @@
<description>Portlet for testing behaviour on exceptions</description>
<portlet-name>ExceptionPortlet</portlet-name>
<display-name>Exception Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.ExceptionPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.ExceptionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -158,7 +164,7 @@
<description>Portlet using portlet session</description>
<portlet-name>PortletSessionPortlet</portlet-name>
<display-name>Portlet Session Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.PortletSessionPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.PortletSessionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -171,7 +177,7 @@
<description>Portlet for demonstrating IPC</description>
<portlet-name>PortletA</portlet-name>
<display-name>Portlet A</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.event.PortletA</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.event.PortletA</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -185,7 +191,7 @@
<description>Portlet for demonstrating IPC</description>
<portlet-name>PortletB</portlet-name>
<display-name>Portlet B</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.event.PortletB</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.event.PortletB</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -199,7 +205,7 @@
<description>Portlet showing different ways to properly display and submit unicode text</description>
<portlet-name>CharsetPortlet</portlet-name>
<display-name>Charset Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.CharsetPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.CharsetPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -214,7 +220,7 @@
<description>Portlet for testing encoding</description>
<portlet-name>EncodingPortlet</portlet-name>
<display-name>Encoding Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.EncodingPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.EncodingPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -228,7 +234,7 @@
<description>Secured Test Portlet</description>
<portlet-name>SecuredTestPortlet</portlet-name>
<display-name>Secured Test Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.TestPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.TestPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -240,6 +246,7 @@
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
+<!--
<portlet>
<description>Portlet providing weather forecast</description>
<portlet-name>WeatherPortlet</portlet-name>
@@ -279,6 +286,8 @@
</preference>
</portlet-preferences>
</portlet>
+-->
+<!--
<portlet>
<description>Portlet aggregating news from different feeds</description>
<portlet-name>NewsPortlet</portlet-name>
@@ -321,11 +330,12 @@
</preference>
</portlet-preferences>
</portlet>
+-->
<portlet>
<description>URL Portlet</description>
<portlet-name>URLPortlet</portlet-name>
<display-name>URL Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.URLPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.URLPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -339,7 +349,7 @@
<description>Async URL Portlet</description>
<portlet-name>AsyncURLPortlet</portlet-name>
<display-name>Async URL Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.URLPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.URLPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -351,7 +361,7 @@
</portlet>
<portlet>
<portlet-name>BasicPortlet</portlet-name>
- <portlet-class>org.jboss.portal.core.portlet.test.BasicPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.BasicPortlet</portlet-class>
<display-name>Basic Portlet</display-name>
<supports>
<mime-type>text/html</mime-type>
@@ -366,7 +376,7 @@
<description>File System Content Driven Portlet</description>
<portlet-name>FSContentDrivenPortlet</portlet-name>
<display-name>File System Content Driven Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.FSContentDrivenPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.FSContentDrivenPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
@@ -381,7 +391,7 @@
<description>File Upload Portlet</description>
<portlet-name>FileUploadPortlet</portlet-name>
<display-name>File Upload Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.FileUploadPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.FileUploadPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
@@ -394,7 +404,7 @@
<description>Portlet which performs a programmatic submit of a form</description>
<portlet-name>FormAutoSubmitPortlet</portlet-name>
<display-name>Form auto submit Portlet</display-name>
- <portlet-class>org.jboss.portal.core.portlet.test.FormAutoSubmitPortlet</portlet-class>
+ <portlet-class>org.jboss.portal.core.portlet.basic.FormAutoSubmitPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Copied: trunk/core-samples/src/resources/portal-basic-samples-war/dir1 (from rev 7548, trunk/core-samples/src/resources/portal-samples-war/dir1)
Copied: trunk/core-samples/src/resources/portal-basic-samples-war/dir2 (from rev 7548, trunk/core-samples/src/resources/portal-samples-war/dir2)
18 years, 10 months
JBoss Portal SVN: r7548 - in trunk: core/src/main/org/jboss/portal/core/impl/model/instance and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-26 09:25:00 -0400 (Tue, 26 Jun 2007)
New Revision: 7548
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContainerImpl.java
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/persistent-jboss-beans.xml
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/transient-jboss-beans.xml
trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java
trunk/security/src/main/org/jboss/portal/security/spi/auth/PortalAuthorizationManager.java
Log:
- improve implementation of security checks in instance container
- no jacc policy context id was leading to NPE wrapped in PortalSecurityException, now we do an explicit check about the existence of the policycontextid and throw an exception ahead in the call stack
- clarified contract of checkPermission(Permission p, ...) to add an IAE if no permission is provided
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/core/build.xml 2007-06-26 13:25:00 UTC (rev 7548)
@@ -561,21 +561,25 @@
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="persistent-jboss-beans.xml"/>
</zest>
+<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalNodeTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="transient-jboss-beans.xml"/>
</zest>
+-->
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="persistent-jboss-beans.xml"/>
</zest>
+<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="transient-jboss-beans.xml"/>
</zest>
+-->
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
outfile="TEST-PersistedLocally-ClonedOnCreate-InstanceContainerTestCase">
<parameter name="PersistLocally" value="true"/>
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContainerImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContainerImpl.java 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContainerImpl.java 2007-06-26 13:25:00 UTC (rev 7548)
@@ -45,6 +45,7 @@
import org.jboss.portal.security.PortalPermissionCollection;
import org.jboss.portal.security.impl.JBossAuthorizationDomainRegistry;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
+import org.jboss.portal.security.spi.auth.PortalAuthorizationManager;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
import org.jboss.portal.security.spi.provider.PermissionFactory;
@@ -103,12 +104,21 @@
}
};
+ /** Used to bypass security checks for testing. */
+ protected boolean performSecurityChecks;
+
/** If true clone the portlet on an instance creation. */
protected boolean cloneOnCreate;
/** The container context. */
protected JBossInstanceContainerContext containerContext;
+ public InstanceContainerImpl()
+ {
+ performSecurityChecks = true;
+ cloneOnCreate = false;
+ }
+
public InterceptorStackFactory getStackFactory()
{
return stackFactory;
@@ -203,6 +213,16 @@
this.cloneOnCreate = cloneOnCreate;
}
+ public boolean getPerformSecurityChecks()
+ {
+ return performSecurityChecks;
+ }
+
+ public void setPerformSecurityChecks(boolean performSecurityChecks)
+ {
+ this.performSecurityChecks = performSecurityChecks;
+ }
+
public JBossInstanceContainerContext getContainerContext()
{
return containerContext;
@@ -361,21 +381,23 @@
public Collection getDefinitions()
{
- //
-// PortalAuthorizationManager mgr = portalAuthorizationManagerFactory.getManager();
-
- //
Collection list = containerContext.getInstanceDefinitions();
// Filter the list
- for (Iterator i = list.iterator();i.hasNext();)
+ if (performSecurityChecks)
{
- Instance instance = (Instance)i.next();
- InstancePermission perm = new InstancePermission(instance.getId(), InstancePermission.VIEW_ACTION);
-// if (mgr.checkPermission(perm) == false)
-// {
-// i.remove();
-// }
+ PortalAuthorizationManager mgr = portalAuthorizationManagerFactory.getManager();
+
+ //
+ for (Iterator i = list.iterator();i.hasNext();)
+ {
+ Instance instance = (Instance)i.next();
+ InstancePermission perm = new InstancePermission(instance.getId(), InstancePermission.VIEW_ACTION);
+ if (!mgr.checkPermission(perm))
+ {
+ i.remove();
+ }
+ }
}
//
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2007-06-26 13:25:00 UTC (rev 7548)
@@ -298,6 +298,16 @@
return "org/jboss/portal/test/core/model/instance/";
}
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
public void testConfigureInstance() throws Exception
{
PortletInvokerSupport.InternalPortlet internalPortlet = portletContainer.addInternalPortlet("MyPortlet", new PortletSupport());
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/persistent-jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/persistent-jboss-beans.xml 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/persistent-jboss-beans.xml 2007-06-26 13:25:00 UTC (rev 7548)
@@ -111,6 +111,7 @@
<property name="portletInvoker"><inject bean="Producer"/></property>
<property name="containerContext"><inject bean="ContainerContext"/></property>
<property name="stackFactory"><inject bean="StackFactory"/></property>
+ <property name="performSecurityChecks">false</property>
</bean>
<bean name="TestBean" class="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase">
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/transient-jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/transient-jboss-beans.xml 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/transient-jboss-beans.xml 2007-06-26 13:25:00 UTC (rev 7548)
@@ -109,6 +109,7 @@
<property name="portletInvoker"><inject bean="Producer"/></property>
<property name="containerContext"><inject bean="ContainerContext"/></property>
<property name="stackFactory"><inject bean="StackFactory"/></property>
+ <property name="performSecurityChecks">false</property>
</bean>
<bean name="TestBean" class="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase">
Modified: trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java
===================================================================
--- trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/security/src/main/org/jboss/portal/security/impl/jacc/JACCPortalAuthorizationManager.java 2007-06-26 13:25:00 UTC (rev 7548)
@@ -82,7 +82,7 @@
}
}
- public void checkRoleConfig(String contextID, String roleName) throws Exception
+ public void checkRoleConfig(String contextID, String roleName) throws PortalSecurityException
{
Map configuredRoles = factory.configuredRoles;
synchronized (configuredRoles)
@@ -91,57 +91,83 @@
PolicyConfiguration pc = null;
try
{
- if (!configuredRoles.containsKey(roleName))
+ try
{
- // Iterate over all domains to add their container
- Collection domains = factory.getAuthorizationDomainRegistry().getDomains();
- for (Iterator j = domains.iterator(); j.hasNext();)
+ if (!configuredRoles.containsKey(roleName))
{
- AuthorizationDomain domain = (AuthorizationDomain)j.next();
- JACCPortalPermissionCollection collection = new JACCPortalPermissionCollection(roleName, domain);
- PermissionFactory permissionFactory = domain.getPermissionFactory();
- PortalPermission container = permissionFactory.createPermissionContainer(collection);
+ // Iterate over all domains to add their container
+ Collection domains = factory.getAuthorizationDomainRegistry().getDomains();
+ for (Iterator j = domains.iterator(); j.hasNext();)
+ {
+ AuthorizationDomain domain = (AuthorizationDomain)j.next();
+ JACCPortalPermissionCollection collection = new JACCPortalPermissionCollection(roleName, domain);
+ PermissionFactory permissionFactory = domain.getPermissionFactory();
+ PortalPermission container = permissionFactory.createPermissionContainer(collection);
- if (pc == null)
- {
- pc = pcf.getPolicyConfiguration(contextID, false);
+ if (pc == null)
+ {
+ pc = pcf.getPolicyConfiguration(contextID, false);
+ }
+
+ if (SecurityConstants.UNCHECKED_ROLE_NAME.equals(roleName))
+ {
+ pc.addToUncheckedPolicy(container);
+ }
+ else
+ {
+ pc.addToRole(roleName, container);
+ }
}
- if (SecurityConstants.UNCHECKED_ROLE_NAME.equals(roleName))
- {
- pc.addToUncheckedPolicy(container);
- }
- else
- {
- pc.addToRole(roleName, container);
- }
+ //
+ configuredRoles.put(roleName, roleName);
}
-
- //
- configuredRoles.put(roleName, roleName);
}
+ catch (PolicyContextException e)
+ {
+ throw new PortalSecurityException(e);
+ }
}
finally
{
// JBossSX implies check does not happen until the PC has committed
// and the policy has been refreshed
- if (pc != null && !pc.inService())
+ try
{
- pc.commit();
- Policy.getPolicy().refresh();
+ if (pc != null && !pc.inService())
+ {
+ pc.commit();
+ Policy.getPolicy().refresh();
+ }
}
+ catch (PolicyContextException e)
+ {
+ log.error("Error when commiting policy config", e);
+ }
}
}
}
/**
- *
+ * @throws IllegalArgumentException if the permission is null
+ * @throws PortalSecurityException
*/
- private boolean internalCheckPermission(PortalPermission permission) throws Exception
+ private boolean internalCheckPermission(PortalPermission permission) throws IllegalArgumentException, PortalSecurityException
{
+ if (permission == null)
+ {
+ throw new IllegalArgumentException("No null permission can be checked");
+ }
+
// Get the current context id.
String contextID = PolicyContext.getContextID();
+ //
+ if (contextID == null)
+ {
+ throw new PortalSecurityException("No policy context id");
+ }
+
// Get the current authenticated subject through the JACC contract
Subject currentSubject = (Subject)checkedSubjectLocal.get();
@@ -190,13 +216,14 @@
}
- public boolean checkPermission(Subject checkedSubject, PortalPermission permission) throws PortalSecurityException
+ public boolean checkPermission(Subject checkedSubject, PortalPermission permission) throws IllegalArgumentException, PortalSecurityException
{
try
{
-
// Set the subject for later use in that layer
checkedSubjectLocal.set(checkedSubject);
+
+ //
if (trace)
{
log.trace("hasPermission:uri=" + permission.getURI() + "::action=" + permission.getType() + "::type=" + permission.getType());
@@ -204,6 +231,8 @@
//
boolean result = internalCheckPermission(permission);
+
+ //
if (trace)
{
log.trace("hasPermission:result=" + result);
@@ -212,20 +241,13 @@
//
return result;
}
- catch (Exception e)
- {
- log.trace("hasPermission:error", e);
-
- //
- throw new PortalSecurityException(e);
- }
finally
{
checkedSubjectLocal.set(null);
}
}
- public boolean checkPermission(PortalPermission permission) throws PortalSecurityException
+ public boolean checkPermission(PortalPermission permission) throws IllegalArgumentException, PortalSecurityException
{
try
{
Modified: trunk/security/src/main/org/jboss/portal/security/spi/auth/PortalAuthorizationManager.java
===================================================================
--- trunk/security/src/main/org/jboss/portal/security/spi/auth/PortalAuthorizationManager.java 2007-06-26 09:57:20 UTC (rev 7547)
+++ trunk/security/src/main/org/jboss/portal/security/spi/auth/PortalAuthorizationManager.java 2007-06-26 13:25:00 UTC (rev 7548)
@@ -39,14 +39,16 @@
* @param permission
* @return
* @throws PortalSecurityException
+ * @throws IllegalArgumentException if the permission is null
*/
- public boolean checkPermission(PortalPermission permission) throws PortalSecurityException;
+ public boolean checkPermission(PortalPermission permission) throws IllegalArgumentException, PortalSecurityException;
/**
* @param checkedSubject
* @param permission
* @return
* @throws PortalSecurityException
+ * @throws IllegalArgumentException if the permission is null
*/
- public boolean checkPermission(Subject checkedSubject, PortalPermission permission) throws PortalSecurityException;
+ public boolean checkPermission(Subject checkedSubject, PortalPermission permission) throws IllegalArgumentException, PortalSecurityException;
}
18 years, 10 months
JBoss Portal SVN: r7546 - trunk/core-admin/src/bin/portal-admin-war.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-25 21:57:12 -0400 (Mon, 25 Jun 2007)
New Revision: 7546
Modified:
trunk/core-admin/src/bin/portal-admin-war/style.css
Log:
- Removed 3rd level border (thanks, Meriah!).
Modified: trunk/core-admin/src/bin/portal-admin-war/style.css
===================================================================
--- trunk/core-admin/src/bin/portal-admin-war/style.css 2007-06-26 01:00:48 UTC (rev 7545)
+++ trunk/core-admin/src/bin/portal-admin-war/style.css 2007-06-26 01:57:12 UTC (rev 7546)
@@ -177,11 +177,6 @@
margin: 0;
}
-.admin-ui .portlet-section-body {
- border: 1px solid #999;
- border-top: 0;
-}
-
.admin-ui .portlet-table-header {
background-color: #eef;
}
18 years, 10 months
JBoss Portal SVN: r7545 - trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-25 21:00:48 -0400 (Mon, 25 Jun 2007)
New Revision: 7545
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml
Log:
- Only show property list if there are properties.
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml 2007-06-26 00:46:19 UTC (rev 7544)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml 2007-06-26 01:00:48 UTC (rev 7545)
@@ -71,63 +71,66 @@
<!-- defines property list section -->
- <table cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <th class="portlet-section-title">Manage currently defined properties.</th>
- </tr>
- <tr>
- <td class="portlet-section-body" valign="top">
+ <c:if test="#{!empty properties.entries}">
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <th class="portlet-section-title">Manage currently defined properties.</th>
+ </tr>
+ <tr>
+ <td class="portlet-section-body" valign="top">
- <h:form>
- <!-- defines layout of property table -->
- <table width="100%">
- <thead class="portlet-section-header">
- <tr>
- <th>Name</th>
- <th>Description</th>
- <th>Inherited</th>
- <th>Value</th>
- <th>Delete</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{properties.entries}" var="prop" varStatus="status">
- <tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
- <td>
- <h:outputText title="#{prop.name}" value="#{prop.displayName}"/>
- </td>
- <td>
- <h:outputText>#{prop.description}</h:outputText>
- </td>
- <td>#{prop.inherited ? 'Yes' : 'No'}</td>
- <td>
- <c:choose>
- <c:when test="#{prop.type == 'java.lang.Boolean'}">
- <h:selectBooleanCheckbox styleClass="portlet-form-button" value="#{prop.value}"
- readonly="#{prop.readOnly}"/>
- </c:when>
- <c:otherwise>
- <h:inputText styleClass="portlet-form-input-field" value="#{prop.value}"
- readonly="#{prop.readOnly}"/>
- </c:otherwise>
- </c:choose>
- </td>
- <td>
- <h:commandLink action="#{properties.action.removeProperty}" rendered="#{!prop.inherited}">
- <h:outputText value="Delete"/>
- <f:param name="name" value="#{prop.name}"/>
- </h:commandLink>
- </td>
+ <h:form>
+ <!-- defines layout of property table -->
+ <table width="100%">
+ <thead class="portlet-section-header">
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ <th>Inherited</th>
+ <th>Value</th>
+ <th>Delete</th>
</tr>
- </c:forEach>
- </tbody>
- </table>
- <!-- ends property list -->
- <h:commandButton value="Update" styleClass="portlet-form-button portlet-section-buttonrow"/></h:form>
+ </thead>
+ <tbody>
+ <c:forEach items="#{properties.entries}" var="prop" varStatus="status">
+ <tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
+ <td>
+ <h:outputText title="#{prop.name}" value="#{prop.displayName}"/>
+ </td>
+ <td>
+ <h:outputText>#{prop.description}</h:outputText>
+ </td>
+ <td>#{prop.inherited ? 'Yes' : 'No'}</td>
+ <td>
+ <c:choose>
+ <c:when test="#{prop.type == 'java.lang.Boolean'}">
+ <h:selectBooleanCheckbox styleClass="portlet-form-button" value="#{prop.value}"
+ readonly="#{prop.readOnly}"/>
+ </c:when>
+ <c:otherwise>
+ <h:inputText styleClass="portlet-form-input-field" value="#{prop.value}"
+ readonly="#{prop.readOnly}"/>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ <td>
+ <h:commandLink action="#{properties.action.removeProperty}"
+ rendered="#{!prop.inherited}">
+ <h:outputText value="Delete"/>
+ <f:param name="name" value="#{prop.name}"/>
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <!-- ends property list -->
+ <h:commandButton value="Update" styleClass="portlet-form-button portlet-section-buttonrow"/></h:form>
- </td>
- </tr>
- </table>
+ </td>
+ </tr>
+ </table>
+ </c:if>
<!-- ends property list section -->
</td>
18 years, 10 months
JBoss Portal SVN: r7544 - in trunk: core/src/resources/portal-core-war/WEB-INF/jsp/content and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-25 20:46:19 -0400 (Mon, 25 Jun 2007)
New Revision: 7544
Modified:
trunk/core-admin/src/bin/portal-admin-war/style.css
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageErrorHandling.xhtml
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/editPortalErrorHandling.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml
trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp
Log:
- Fixed issues with styles.
- Improved markup.
Modified: trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-06-26 00:46:19 UTC (rev 7544)
@@ -221,7 +221,7 @@
* Primary Navigation (Tabbed Nav) *
*****************************/
-UL#tabsHeader {
+ul#tabsHeader {
margin: 0;
padding-left: 0px;
margin-top: 39px;
@@ -230,7 +230,7 @@
/*position: relative; added for submenu hover */
}
-UL#tabsHeader li {
+ul#tabsHeader li {
display: inline;
list-style: none;
float: left;
@@ -245,7 +245,7 @@
white-space: nowrap;
}
-UL#tabsHeader li:hover {
+ul#tabsHeader li:hover {
background-image: url( images/tab_right_hover2.gif );
background-repeat: no-repeat;
background-position: right top;
@@ -253,21 +253,21 @@
}
/* hover selectors for main header tabs */
-UL#tabsHeader li.hoverOn {
+ul#tabsHeader li.hoverOn {
background-image: url( images/tab_right_hover2.gif );
background-repeat: no-repeat;
background-position: right top;
white-space: nowrap;
}
-UL#tabsHeader li.hoverOff {
+ul#tabsHeader li.hoverOff {
background-image: url( images/tab_right.gif );
background-repeat: no-repeat;
background-position: top right;
white-space: nowrap;
}
-UL#tabsHeader a {
+ul#tabsHeader a {
display: inline;
float: left;
text-decoration: none;
@@ -282,7 +282,7 @@
white-space: nowrap;
}
-UL#tabsHeader a:hover {
+ul#tabsHeader a:hover {
text-decoration: underline;
color: #000000; /*background-image: url(../images/tab_left_hover2.gif);*/
background-repeat: no-repeat;
@@ -290,7 +290,7 @@
white-space: nowrap;
}
-UL#tabsHeader #current {
+ul#tabsHeader #current {
line-height: 22px;
background-color: #fff;
background-image: url( images/tab_right_current.gif );
@@ -299,7 +299,7 @@
padding-top: -3px; /*border-bottom: 2px solid #fff;*/
}
-UL#tabsHeader #current a, #current a:hover {
+ul#tabsHeader #current a, #current a:hover {
font: 11px / normal Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: bold;
color: #000; /* background-image: url(../images/tab_left_current.gif); */
@@ -308,7 +308,7 @@
}
/* Begin Submenu selectors */
-UL#tabsHeader ul {
+ul#tabsHeader ul {
visibility: hidden;
position: absolute;
height: 0;
@@ -321,7 +321,7 @@
margin-top: 22px;
}
-UL#tabsHeader ul a {
+ul#tabsHeader ul a {
font: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
@@ -329,26 +329,26 @@
}
-UL#tabsHeader ul a:hover {
+ul#tabsHeader ul a:hover {
font: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
color: #5078aa;
}
-UL#tabsHeader #current ul a {
+ul#tabsHeader #current ul a {
font: 11px;
font-family: Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: normal;
color: #5078aa;
}
-UL#tabsHeader li:hover ul,
- UL#tabsHeader a:hover ul {
+ul#tabsHeader li:hover ul,
+ ul#tabsHeader a:hover ul {
visibility: visible;
}
-UL#tabsHeader ul li {
+ul#tabsHeader ul li {
background: #DFE8ED;
color: #5078aa;
padding: 3px;
@@ -362,7 +362,7 @@
margin-right: 0px;
}
-UL#tabsHeader ul li:hover {
+ul#tabsHeader ul li:hover {
background: #C0D3DC;
}
@@ -370,7 +370,7 @@
/* -------- These are new selectors for the admin and add page styles ------- */
-UL#tabsHeader #admin {
+ul#tabsHeader #admin {
display: inline;
background-image: url( images/tab_right_admin.gif );
background-repeat: no-repeat;
@@ -379,7 +379,7 @@
line-height: 22px;
}
-UL#tabsHeader #admin a {
+ul#tabsHeader #admin a {
text-decoration: none;
color: #4386b5; /* background-image: url(../images/tab_left_admin.gif);*/
background-repeat: no-repeat;
@@ -389,11 +389,11 @@
line-height: 22px;
}
-UL#tabsHeader #admin a:hover {
+ul#tabsHeader #admin a:hover {
text-decoration: underline;
}
-UL#tabsHeader #addpage {
+ul#tabsHeader #addpage {
display: inline;
background-color: none;
background-image: none;
@@ -401,7 +401,7 @@
padding-top: 1px;
}
-UL#tabsHeader #addpage a, #addpage a:hover {
+ul#tabsHeader #addpage a, #addpage a:hover {
font: 11px / normal Verdana, Arial, Helvetica, Sans-Serif, sans-serif;
font-weight: bold;
color: white;
@@ -410,7 +410,7 @@
white-space: nowrap;
}
-UL#tabsHeader #addpage a:hover {
+ul#tabsHeader #addpage a:hover {
text-decoration: underline;
}
@@ -420,12 +420,12 @@
}
/* backslash hack for IE5-Mac \*/
-UL#tabsHeader a {
+ul#tabsHeader a {
float: none;
}
/* End Mac Hack */
-html>body UL#tabsHeader a {
+html>body ul#tabsHeader a {
width: auto;
}
@@ -439,12 +439,12 @@
float: right;
font-size: 10px;
padding: 6px 12px 0px 0px;
- color: #FFFFFF;
+ color: #fff;
z-index: 20;
}
#dashboardnav a {
- color: #FFFFFF;
+ color: #fff;
}
#dashboardnav .addcontent {
@@ -527,10 +527,14 @@
.portlet-content-center {
vertical-align: top;
+ padding: 0;
+ margin: 0;
}
.portlet-body {
- background-color: #ffffff;
+ background-color: #FFFFFF;
+ padding: 0;
+ margin: 0;
}
.portlet-content-right {
@@ -540,6 +544,8 @@
background-position: left;
width: 5px;
min-width: 5px;
+ padding: 0;
+ margin: 0;
/*
width:5px;
background-color:#FFFFFF;
@@ -554,7 +560,8 @@
background-repeat: no-repeat;
background-position: top right;
min-width: 9px;
-
+ padding: 0;
+ margin: 0;
/*
background-color:#FFFFFF;
border-bottom: 1px solid #98b7c6;
@@ -970,7 +977,7 @@
}
.portlet-section-alternate {
- background-color: #E6E8E5;
+ background-color: #F2F2F2;
}
.portlet-section-selected {
@@ -979,7 +986,7 @@
.portlet-section-subheader {
font-weight: bold;
- font-size: 12px;
+ font-size: 10px;
}
.portlet-section-footer {
@@ -998,7 +1005,8 @@
********************/
/* Table header */
.portlet-table-header {
- padding: 0px 5px 5px 5px;
+ background-color: #eef;
+ padding: 0 5px 5px 5px;
font-weight: bold;
color: #656565;
font-size: 12px;
@@ -1007,7 +1015,7 @@
/* Table footer */
.portlet-table-footer {
- padding: 5px 5px 0px 5px;
+ padding: 5px 5px 0 5px;
font-weight: bold;
color: #656565;
font-size: 12px;
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/content/portlet_editor.jsp 2007-06-26 00:46:19 UTC (rev 7544)
@@ -28,7 +28,7 @@
}
%>
-<div style="height:300px; width:300px; overflow: scroll; border: 1px solid #333333;">
+<div style="height:300px; width:300px; overflow: auto; overflow-x: hidden; border: 1px solid #333;">
<table style="width:100%;" cellspacing="0" cellpadding="0">
<%
for (IteratorStatus i = new IteratorStatus(instances); i.hasNext();)
@@ -59,6 +59,9 @@
</div>
<%
+
+
+
Portlet portlet = null;
try
{
@@ -72,6 +75,9 @@
{
MetaInfo metaInfo = portlet.getInfo().getMeta();
+
+
+
%>
<div><span
class="portlet-form-field-label">Portlet name:</span><%= metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME).getDefaultString() %>
@@ -87,7 +93,13 @@
</div>
<%
+
+
+
}
}
+
+
+
%>
Modified: trunk/core-admin/src/bin/portal-admin-war/style.css
===================================================================
--- trunk/core-admin/src/bin/portal-admin-war/style.css 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core-admin/src/bin/portal-admin-war/style.css 2007-06-26 00:46:19 UTC (rev 7544)
@@ -1,18 +1,19 @@
/* Redefine spacing for tables. */
.admin-ui table {
- border: 0px;
- border-collapse: separate;
+ border: 0;
}
.admin-ui th {
text-align: left;
- border: 0px;
+ border: 0;
border-bottom: 1px solid;
+ padding-bottom: 2px;
+ padding-top: 2px;
+ font-size: 11px;
}
.admin-ui td {
- border: 0px;
padding-bottom: 2px;
padding-top: 2px;
}
@@ -48,7 +49,7 @@
.admin-ui ul.topnav {
margin-left: 0;
padding: 4px 0px 3px;
- border-bottom: 1px solid;
+ border-bottom: 1px solid #dfe8ed;
}
.admin-ui ul.topnav li {
@@ -57,13 +58,13 @@
margin: 0;
padding: 3px 0.5em;
margin-left: 5px;
- border: 1px solid #777;
+ border: 1px solid #dfe8ed;
border-bottom: none;
- background-color: #eef;
+ background-color: #f2f4f5;
}
.admin-ui ul.topnav li:hover {
- background-color: #ccf;
+ background-color: #fff;
}
.admin-ui ul.topnav li#currentTab {
@@ -91,7 +92,10 @@
font-weight: bold;
}
-/* */
+/* Resize combo lists */
+.admin-ui select {
+ padding: 2px 4px;
+}
.admin-ui select.contentType {
width: 8em;
@@ -102,10 +106,11 @@
}
.admin-ui select.windowList {
- width: 11em;
+ width: 95%;
+ overflow: auto;
}
-/* Style a table for form layout. */
+/* Style a table for form layout */
.admin-ui table.form {
}
@@ -125,51 +130,68 @@
.admin-ui .portlet-area-header {
border: 1px solid #54708c;
font-weight: bold;
- color: #FFFFFF;
+ color: #fff;
font-size: 11px;
background-color: #5986b3;
- padding:2px;
+ padding: 2px;
padding-left: 4px;
+ margin: 0;
}
.admin-ui .portlet-area-body {
border: 1px solid #d5d5d5;
- border-top: 0px;
- background-color: #FFFFFF;
- padding:4px;
+ border-top: 0;
+ background-color: #fff;
+ padding: 4px;
+ margin: 0;
}
/* Styles updated and enhanced from the main portal css */
+.admin-ui th.portlet-section-title {
+ font-weight: bold;
+ color: #656565;
+ font-size: 11px;
+ border: 1px solid #999;
+ background-color: #ebf2f5;
+ padding-left: 6px;
+}
+
.admin-ui .portlet-content-center {
- padding: 0px;
- margin: 0px
+ padding: 0;
+ margin: 0;
}
.admin-ui .portlet-body {
- padding: 0px;
- margin: 0px
+ padding: 0;
+ margin: 0;
}
.admin-ui .portlet-content-right {
- padding: 0px;
- margin: 0px
+ padding: 0;
+ margin: 0;
}
.admin-ui .portlet-footer-left {
- padding: 0px;
- margin: 0px
+ padding: 0;
+ margin: 0;
}
.admin-ui .portlet-section-body {
- border: 1px solid #999999;
- border-top: 0px;
+ border: 1px solid #999;
+ border-top: 0;
}
.admin-ui .portlet-table-header {
- background-color: #EEEEFF;
+ background-color: #eef;
}
+.admin-ui .portlet-section-buttonrow {
+ margin-top: 6px;
+ margin-bottom: 6px;
+ float: right;
+}
+
/* Change dashed line to solid. */
.admin-ui hr {
@@ -204,9 +226,15 @@
font-size: 2em;
text-align: center;
margin-top: 5px;
- margin-bottom: 0px;
+ margin-bottom: 0;
}
.admin-ui .stepText {
text-align: center;
}
+
+.admin-ui .layout-button {
+ width: 50px;
+ margin: 2px;
+ padding: 2px;
+}
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageErrorHandling.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageErrorHandling.xhtml 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageErrorHandling.xhtml 2007-06-26 00:46:19 UTC (rev 7544)
@@ -1,118 +1,147 @@
<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:c="http://java.sun.com/jstl/core">
+ 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:c="http://java.sun.com/jstl/core">
-<div class="portlet-area-header">Page Error Handling</div>
+<p class="portlet-area-header">Page Error Handling</p>
+
<div class="portlet-area-body">
<!-- defines error handeling section -->
<table cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td class="portlet-section-title">Configure how the system handles errors on page level.</td>
- </tr>
- <tr>
- <td valign="top" class="portlet-section-body">
+<tr>
+ <th class="portlet-section-title">Configure how the system handles errors on page level.</th>
+</tr>
+<tr>
+<td valign="top" class="portlet-section-body">
- <h:form>
- <table width="100%">
- <thead class="portlet-section-header" style="text-align:left;">
- <tr>
- <th>Case</th>
- <th>Inheritance</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.pageControlAccessDenied.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.pageControlAccessDenied.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.pageControlAccessDenied.inherit}" value="#{properties.pageControlAccessDenied.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.pageControlAccessDenied.value}" disabled="#{properties.pageControlAccessDenied.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.pageSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.pageControlUnavailable.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.pageControlUnavailable.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.pageControlUnavailable.inherit}" value="#{properties.pageControlUnavailable.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.pageControlUnavailable.value}" disabled="#{properties.pageControlUnavailable.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.pageSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.pageControlError.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.pageControlError.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.pageControlError.inherit}" value="#{properties.pageControlError.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.pageControlError.value}" disabled="#{properties.pageControlError.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.pageSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.pageControlInternalError.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.pageControlInternalError.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.pageControlInternalError.inherit}" value="#{properties.pageControlInternalError.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.pageControlInternalError.value}" disabled="#{properties.pageControlInternalError.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.pageSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.pageControlNotFound.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.pageControlNotFound.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.pageControlNotFound.inherit}" value="#{properties.pageControlNotFound.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.pageControlNotFound.value}" disabled="#{properties.pageControlNotFound.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.pageSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.pageControlResourceURI.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.pageControlResourceURI.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.pageControlResourceURI.inherit}" value="#{properties.pageControlResourceURI.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:inputText value="#{properties.pageControlResourceURI.value}" disabled="#{properties.pageControlResourceURI.inherited}"/>
- </td>
- </tr>
- </tbody>
- </table>
- <div style="padding-top:6px;padding-bottom: 6px;float: right;">
- <h:commandButton value="Update" styleClass="portlet-form-button"/>
- </div>
- </h:form>
+<h:form>
+<table width="100%">
+<thead class="portlet-section-header" style="text-align:left;">
+ <tr>
+ <th>Case</th>
+ <th>Inheritance</th>
+ <th>Action</th>
+ </tr>
+</thead>
+<tbody>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.pageControlAccessDenied.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.pageControlAccessDenied.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.pageControlAccessDenied.inherit}"
+ value="#{properties.pageControlAccessDenied.inherited}"/>inherit action
+ from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.pageControlAccessDenied.value}"
+ disabled="#{properties.pageControlAccessDenied.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.pageSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.pageControlUnavailable.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.pageControlUnavailable.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.pageControlUnavailable.inherit}"
+ value="#{properties.pageControlUnavailable.inherited}"/>inherit action
+ from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.pageControlUnavailable.value}"
+ disabled="#{properties.pageControlUnavailable.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.pageSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.pageControlError.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.pageControlError.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.pageControlError.inherit}"
+ value="#{properties.pageControlError.inherited}"/>inherit action from
+ parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.pageControlError.value}"
+ disabled="#{properties.pageControlError.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.pageSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.pageControlInternalError.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.pageControlInternalError.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.pageControlInternalError.inherit}"
+ value="#{properties.pageControlInternalError.inherited}"/>inherit action
+ from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.pageControlInternalError.value}"
+ disabled="#{properties.pageControlInternalError.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.pageSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.pageControlNotFound.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.pageControlNotFound.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.pageControlNotFound.inherit}"
+ value="#{properties.pageControlNotFound.inherited}"/>inherit action from
+ parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.pageControlNotFound.value}"
+ disabled="#{properties.pageControlNotFound.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.pageSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.pageControlResourceURI.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.pageControlResourceURI.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.pageControlResourceURI.inherit}"
+ value="#{properties.pageControlResourceURI.inherited}"/>inherit action
+ from parent
+ </td>
+ <td>
+ <h:inputText value="#{properties.pageControlResourceURI.value}" size="60"
+ disabled="#{properties.pageControlResourceURI.inherited}"/>
+ </td>
+</tr>
+</tbody>
+</table>
+<h:commandButton value="Update" styleClass="portlet-form-button portlet-section-buttonrow"/>
+</h:form>
- </td>
- </tr>
- </table>
+</td>
+</tr>
+</table>
</div>
Modified: 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 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-06-26 00:46:19 UTC (rev 7544)
@@ -7,168 +7,165 @@
xmlns:c="http://java.sun.com/jstl/core">
<table width="100%">
- <tr>
- <td valign="top" width="50%">
+<tr>
+<td valign="top" width="50%">
- <div class="portlet-area-header">Content Definition</div>
- <div class="portlet-area-body">
+ <p class="portlet-area-header">Content Definition</p>
- <table>
- <tr>
- <td colspan="2">Define a name for the window of content (optional):
- </td>
- </tr>
- <tr>
- <td>
- <span class="portlet-form-field-label">Window Name:</span>
- </td>
- <td width="100%">
- <h:form id="windowForm">
- <h:inputText id="windowName" value="#{pageManager.windowName}" styleClass="portlet-form-input-field"/>
- <h:message for="windowName" errorClass="portlet-msg-error"/>
- </h:form>
- </td>
- </tr>
- <tr>
- <td colspan="2"><hr/>Select the type of content that will be added to the page:
- </td>
- </tr>
- <tr>
- <td>
- <span class="portlet-form-field-label">Content Type:</span>
- </td>
- <td>
- <h:form id="abc">
- <h:selectOneMenu
- id="instanceId"
- value="#{pageManager.selectedContentType}"
- styleClass="portlet-form-field contentType"
- onchange="document.getElementById('abc').submit()">
- <f:selectItems value="#{pageManager.contentTypeItems}"/>
- </h:selectOneMenu>
- <h:message for="instanceId" errorClass="portlet-msg-error"/>
- </h:form>
- </td>
- </tr>
- <tr>
- <td colspan="2"><hr/>Select content that will be added to the page:
- </td>
- </tr>
- <tr>
- <td colspan="2" valign="top">
- <div>
- <jbp:portlet
- portletId="#{pageManager.selectedEditorPortletId}"
- portletInvoker="#{pageManager.portletInvoker}"
- actionListener="#{pageManager.assignWindow}"
- supportedModes="edit_content"
- supportedWindowStates="normal"
- initialMode="edit_content"
- initialWindowState="normal"
- renderParameters="#{pageManager.selectedRenderParameters}"
- onClick="url.setParameter('windowName', document.getElementById('windowForm:windowName').value);"/>
- </div>
- </td>
- </tr>
- </table>
+ <div class="portlet-area-body">
- </div>
+ <table>
+ <tr>
+ <td colspan="2">Define a name for the window of content (optional):
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="portlet-form-field-label">Window Name:</span>
+ </td>
+ <td width="100%">
+ <h:form id="windowForm">
+ <h:inputText id="windowName" value="#{pageManager.windowName}" styleClass="portlet-form-input-field"/>
+ <h:message for="windowName" errorClass="portlet-msg-error"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr/>
+ Select the type of content that will be added to the page:
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class="portlet-form-field-label">Content Type:</span>
+ </td>
+ <td>
+ <h:form id="abc">
+ <h:selectOneMenu
+ id="instanceId"
+ value="#{pageManager.selectedContentType}"
+ styleClass="portlet-form-field contentType"
+ onchange="document.getElementById('abc').submit()">
+ <f:selectItems value="#{pageManager.contentTypeItems}"/>
+ </h:selectOneMenu>
+ <h:message for="instanceId" errorClass="portlet-msg-error"/>
+ </h:form>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <hr/>
+ Select content that will be added to the page:
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top">
+ <div>
+ <jbp:portlet
+ portletId="#{pageManager.selectedEditorPortletId}"
+ portletInvoker="#{pageManager.portletInvoker}"
+ actionListener="#{pageManager.assignWindow}"
+ supportedModes="edit_content"
+ supportedWindowStates="normal"
+ initialMode="edit_content"
+ initialWindowState="normal"
+ renderParameters="#{pageManager.selectedRenderParameters}"
+ onClick="url.setParameter('windowName', document.getElementById('windowForm:windowName').value);"/>
+ </div>
+ </td>
+ </tr>
+ </table>
- </td>
- <td valign="top" width="50%">
+ </div>
- <div class="portlet-area-header">Page Layout</div>
- <div class="portlet-area-body">
+</td>
+<td valign="top" width="50%">
- <h:form id="layoutForm">
- <h:message for="layoutForm" errorClass="portlet-msg-error"/>
- <input id="blah" type="hidden" name="blah" value=""/>
- <table width="100%">
- <c:forEach items="#{pageManager.regionNames}" var="regionName" varStatus="status">
- <tbody>
- <tr>
- <td colspan="3" class="portlet-form-field-label"><hr/> #{regionName} Region </td>
- </tr>
- <tr>
- <td valign="top">
- <div style="padding-top:4px;">
- <h:commandButton
- onclick="document.getElementById('blah').value=document.getElementById('windowForm:windowName').value"
- value="Add" id="a_#{regionName}"
- actionListener="#{pageManager.assignWindows}"
- styleClass="portlet-form-button"
- style="width:40px;"/>
- </div>
- </td>
- <td width="100%">
- <h:selectManyListbox
- value="#{pageManager.assignedWindows[regionName]}"
- size="7" styleClass="windowList portlet-form-field" style="width:100%;">
- <f:selectItems
- value="#{pageManager.windowItemsMap[regionName]}"/>
- </h:selectManyListbox>
- </td>
- <td valign="top">
- <div style="padding-top:4px;">
- <h:commandButton
- value="Up" id="u_#{regionName}"
- actionListener="#{pageManager.assignWindows}"
- styleClass="portlet-form-button"
- style="width:50px;"/>
- </div>
- <div style="padding-top:4px;">
- <h:commandButton
- value="Down" id="d_#{regionName}"
- actionListener="#{pageManager.assignWindows}"
- styleClass="portlet-form-button"
- style="width:50px;"/>
- </div>
- <hr/>
- <div style="padding-top:4px;">
- <h:commandButton
- value="Delete" id="l_#{regionName}"
- actionListener="#{pageManager.assignWindows}"
- styleClass="portlet-form-button"
- style="width:50px;"/>
- </div>
- </td>
- </tr>
- </tbody>
- </c:forEach>
- <c:if test="#{!(empty pageManager.assignedWindows['unknown'])}">
- <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="#{pageManager.assignWindows}"
- styleClass="portlet-form-button"/>
- </div>
- </td>
- <td>
- <h:selectManyListbox
- value="#{pageManager.assignedWindows['unknown']}"
- size="7" styleClass="windowList portlet-form-field">
- <f:selectItems
- value="#{pageManager.windowItemsMap['unknown']}"/>
- </h:selectManyListbox>
- </td>
- </tr>
- </tbody>
- </c:if>
- </table>
- </h:form>
+ <p class="portlet-area-header">Page Layout</p>
- </div>
+ <div class="portlet-area-body">
- </td>
- </tr>
+ <h:form id="layoutForm">
+ <h:message for="layoutForm" errorClass="portlet-msg-error"/>
+ <input id="blah" type="hidden" name="blah" value=""/>
+ <table width="100%">
+ <c:forEach items="#{pageManager.regionNames}" var="regionName" varStatus="status">
+ <tbody>
+ <tr>
+ <td colspan="3" class="portlet-form-field-label">
+ <hr/>
+ #{regionName} Region
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <h:commandButton
+ onclick="document.getElementById('blah').value=document.getElementById('windowForm:windowName').value"
+ value="Add" id="a_#{regionName}"
+ actionListener="#{pageManager.assignWindows}"
+ styleClass="portlet-form-button layout-button"/>
+ </td>
+ <td width="100%">
+ <h:selectManyListbox
+ value="#{pageManager.assignedWindows[regionName]}"
+ size="7" styleClass="windowList portlet-form-field">
+ <f:selectItems
+ value="#{pageManager.windowItemsMap[regionName]}"/>
+ </h:selectManyListbox>
+ </td>
+ <td valign="top">
+ <h:commandButton
+ value="Up" id="u_#{regionName}"
+ actionListener="#{pageManager.assignWindows}"
+ styleClass="portlet-form-button layout-button"/>
+ <h:commandButton
+ value="Down" id="d_#{regionName}"
+ actionListener="#{pageManager.assignWindows}"
+ styleClass="portlet-form-button layout-button"/>
+ <hr/>
+ <h:commandButton
+ value="Delete" id="l_#{regionName}"
+ actionListener="#{pageManager.assignWindows}"
+ styleClass="portlet-form-button layout-button"/>
+ </td>
+ </tr>
+ </tbody>
+ </c:forEach>
+ <c:if test="#{!(empty pageManager.assignedWindows['unknown'])}">
+ <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="#{pageManager.assignWindows}"
+ styleClass="portlet-form-button"/>
+ </div>
+ </td>
+ <td>
+ <h:selectManyListbox
+ value="#{pageManager.assignedWindows['unknown']}"
+ size="7" styleClass="windowList portlet-form-field">
+ <f:selectItems
+ value="#{pageManager.windowItemsMap['unknown']}"/>
+ </h:selectManyListbox>
+ </td>
+ </tr>
+ </tbody>
+ </c:if>
+ </table>
+ </h:form>
+
+ </div>
+
+</td>
+</tr>
</table>
</div>
\ No newline at end of file
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPortalErrorHandling.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPortalErrorHandling.xhtml 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPortalErrorHandling.xhtml 2007-06-26 00:46:19 UTC (rev 7544)
@@ -1,116 +1,148 @@
<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:c="http://java.sun.com/jstl/core">
+ 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:c="http://java.sun.com/jstl/core">
-<div class="portlet-area-header">Portal Error Handling</div>
+<p class="portlet-area-header">Portal Error Handling</p>
+
<div class="portlet-area-body">
<!-- defines error handeling section -->
<table cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td class="portlet-section-title">Configure how the system handles errors on portal level.</td>
- </tr>
- <tr>
- <td valign="top" class="portlet-section-body">
+<tr>
+ <th class="portlet-section-title">Configure how the system handles errors on portal level.</th>
+</tr>
+<tr>
+<td valign="top" class="portlet-section-body">
- <h:form>
- <table width="100%">
- <thead class="portlet-section-header" style="text-align:left;">
- <tr>
- <th>Case</th>
- <th>Inheritance</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.portalControlAccessDenied.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.portalControlAccessDenied.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.portalControlAccessDenied.inherit}" value="#{properties.portalControlAccessDenied.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.portalControlAccessDenied.value}" disabled="#{properties.portalControlAccessDenied.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.portalSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.portalControlUnavailable.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.portalControlUnavailable.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.portalControlUnavailable.inherit}" value="#{properties.portalControlUnavailable.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.portalControlUnavailable.value}" disabled="#{properties.portalControlUnavailable.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.portalSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.portalControlError.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.portalControlError.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.portalControlError.inherit}" value="#{properties.portalControlError.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.portalControlError.value}" disabled="#{properties.portalControlError.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.portalSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.portalControlInternalError.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.portalControlInternalError.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.portalControlInternalError.inherit}" value="#{properties.portalControlInternalError.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.portalControlInternalError.value}" disabled="#{properties.portalControlInternalError.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.portalSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.portalControlNotFound.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.portalControlNotFound.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.portalControlNotFound.inherit}" value="#{properties.portalControlNotFound.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:selectOneMenu value="#{properties.portalControlNotFound.value}" disabled="#{properties.portalControlNotFound.inherited}" onchange="submit();">
- <f:selectItems value="#{properties.portalSelectItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr class="portlet-section-body">
- <td>
- <h:outputText value="#{properties.portalControlResourceURI.displayName}"/>
- </td>
- <td>
- <h:selectBooleanCheckbox disabled="#{!properties.portalControlResourceURI.inheritable}" styleClass="portlet-form-button" onchange="submit();" valueChangeListener="#{properties.portalControlResourceURI.inherit}" value="#{properties.portalControlResourceURI.inherited}"/>inherit action from parent
- </td>
- <td>
- <h:inputText value="#{properties.portalControlResourceURI.value}" disabled="#{properties.portalControlResourceURI.inherited}"/>
- </td>
- </tr>
- </tbody>
- </table>
- <div style="padding-top:6px;padding-bottom: 6px;float: right;">
- <h:commandButton value="Update" styleClass="portlet-form-button"/>
- </div>
- </h:form>
+<h:form>
+<table width="100%">
+<thead class="portlet-section-header" style="text-align:left;">
+ <tr>
+ <th>Case</th>
+ <th>Inheritance</th>
+ <th>Action</th>
+ </tr>
+</thead>
+<tbody>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.portalControlAccessDenied.displayName}"/>
</td>
- </tr>
- </table>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.portalControlAccessDenied.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.portalControlAccessDenied.inherit}"
+ value="#{properties.portalControlAccessDenied.inherited}"/>inherit
+ action from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.portalControlAccessDenied.value}"
+ disabled="#{properties.portalControlAccessDenied.inherited}"
+ onchange="submit();">
+ <f:selectItems value="#{properties.portalSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.portalControlUnavailable.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.portalControlUnavailable.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.portalControlUnavailable.inherit}"
+ value="#{properties.portalControlUnavailable.inherited}"/>inherit
+ action from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.portalControlUnavailable.value}"
+ disabled="#{properties.portalControlUnavailable.inherited}"
+ onchange="submit();">
+ <f:selectItems value="#{properties.portalSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.portalControlError.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.portalControlError.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.portalControlError.inherit}"
+ value="#{properties.portalControlError.inherited}"/>inherit action from
+ parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.portalControlError.value}"
+ disabled="#{properties.portalControlError.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.portalSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.portalControlInternalError.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.portalControlInternalError.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.portalControlInternalError.inherit}"
+ value="#{properties.portalControlInternalError.inherited}"/>inherit
+ action from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.portalControlInternalError.value}"
+ disabled="#{properties.portalControlInternalError.inherited}"
+ onchange="submit();">
+ <f:selectItems value="#{properties.portalSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.portalControlNotFound.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.portalControlNotFound.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.portalControlNotFound.inherit}"
+ value="#{properties.portalControlNotFound.inherited}"/>inherit action
+ from parent
+ </td>
+ <td>
+ <h:selectOneMenu value="#{properties.portalControlNotFound.value}"
+ disabled="#{properties.portalControlNotFound.inherited}" onchange="submit();">
+ <f:selectItems value="#{properties.portalSelectItems}"/>
+ </h:selectOneMenu>
+ </td>
+</tr>
+<tr class="portlet-section-body">
+ <td>
+ <h:outputText value="#{properties.portalControlResourceURI.displayName}"/>
+ </td>
+ <td>
+ <h:selectBooleanCheckbox disabled="#{!properties.portalControlResourceURI.inheritable}"
+ styleClass="portlet-form-button" onchange="submit();"
+ valueChangeListener="#{properties.portalControlResourceURI.inherit}"
+ value="#{properties.portalControlResourceURI.inherited}"/>inherit
+ action from parent
+ </td>
+ <td>
+ <h:inputText value="#{properties.portalControlResourceURI.value}" size="60"
+ disabled="#{properties.portalControlResourceURI.inherited}"/>
+ </td>
+</tr>
+</tbody>
+</table>
+<h:commandButton value="Update" styleClass="portlet-form-button portlet-section-buttonrow"/>
+</h:form>
+</td>
+</tr>
+</table>
</div>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml 2007-06-26 00:20:41 UTC (rev 7543)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editProperties.xhtml 2007-06-26 00:46:19 UTC (rev 7544)
@@ -1,131 +1,137 @@
-
<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:c="http://java.sun.com/jstl/core">
+ 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:c="http://java.sun.com/jstl/core">
<div class="portlet-area-header">Properties</div>
<div class="portlet-area-body">
<!-- divide the area body into two panes -->
<table cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td>
+<tr>
+<td>
-<!-- defines property creation section -->
-<table cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td class="portlet-section-title">Add a property.</td>
- </tr>
- <tr>
- <td valign="top" class="portlet-section-body">
+ <!-- defines property creation section -->
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <th class="portlet-section-title">Add a property.</th>
+ </tr>
+ <tr>
+ <td valign="top" class="portlet-section-body">
- <h:form>
+ <h:form>
- <!-- defines layout of property form -->
- <table>
- <tbody>
- <tr>
- <td class="portlet-form-field-label">
- <h:outputLabel for="predefinedProperty" styleClass="portlet-form-field-label">Select predefined property:</h:outputLabel>
- </td>
- </tr>
- <tr>
- <td>
- <h:selectOneMenu id="predefinedProperty" styleClass="portlet-form-field" value="#{properties.action.selectedProperty}">
- <f:selectItems value="#{properties.propertyItems}"/>
- </h:selectOneMenu>
- </td>
- </tr>
- <tr>
- <td align="center">or</td>
- </tr>
- <tr>
- <td class="portlet-form-field-label">
- <h:outputLabel for="property" styleClass="portlet-form-field-label">Enter property name:</h:outputLabel>
- </td>
- </tr>
- <tr>
- <td>
- <h:inputText id="property" styleClass="portlet-form-input-field" value="#{properties.action.otherPropertyName}" />
- </td>
- </tr>
- </tbody>
- </table>
- <!-- ends layout of property form -->
- <div class="padding-top:6px;padding-bottom: 6px;float: right;"><h:commandButton value="Add Property" styleClass="portlet-form-button" action="#{properties.action.updateProperty}"/></div></h:form>
+ <!-- defines layout of property form -->
+ <table>
+ <tbody>
+ <tr>
+ <td class="portlet-form-field-label">
+ <h:outputLabel for="predefinedProperty" styleClass="portlet-form-field-label">Select
+ predefined property:</h:outputLabel>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h:selectOneMenu id="predefinedProperty" styleClass="portlet-form-field"
+ value="#{properties.action.selectedProperty}">
+ <f:selectItems value="#{properties.propertyItems}"/>
+ </h:selectOneMenu>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">or</td>
+ </tr>
+ <tr>
+ <td class="portlet-form-field-label">
+ <h:outputLabel for="property" styleClass="portlet-form-field-label">Enter property
+ name:</h:outputLabel>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h:inputText id="property" styleClass="portlet-form-input-field"
+ value="#{properties.action.otherPropertyName}"/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <!-- ends layout of property form -->
+ <h:commandButton value="Add Property" styleClass="portlet-form-button portlet-section-buttonrow"
+ action="#{properties.action.updateProperty}"/></h:form>
- </td>
- </tr>
- </table>
- <!-- ends property creation section -->
+ </td>
+ </tr>
+ </table>
+ <!-- ends property creation section -->
- </td>
- <td valign="top" width="100%" style="padding-left:5px;"><!-- creates division of 2 pane area -->
+</td>
+<td valign="top" width="100%" style="padding-left:5px;"><!-- creates division of 2 pane area -->
- <!-- defines property list section -->
- <table cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td class="portlet-section-title">Manage currently defined properties.</td>
- </tr>
- <tr>
- <td class="portlet-section-body" valign="top">
+ <!-- defines property list section -->
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <th class="portlet-section-title">Manage currently defined properties.</th>
+ </tr>
+ <tr>
+ <td class="portlet-section-body" valign="top">
- <h:form>
- <!-- defines layout of property table -->
- <table width="100%">
- <thead class="portlet-section-header">
- <tr>
- <th>Name</th>
- <th>Description</th>
- <th>Inherited</th>
- <th>Value</th>
- <th>Delete</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="#{properties.entries}" var="prop" varStatus="status">
- <tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
- <td>
- <h:outputText title="#{prop.name}" value="#{prop.displayName}"/>
- </td>
- <td>
- <h:outputText>#{prop.description}</h:outputText>
- </td>
- <td>#{prop.inherited ? 'Yes' : 'No'}</td>
- <td>
- <c:choose>
- <c:when test="#{prop.type == 'java.lang.Boolean'}">
- <h:selectBooleanCheckbox styleClass="portlet-form-button" value="#{prop.value}" readonly="#{prop.readOnly}"/>
- </c:when>
- <c:otherwise>
- <h:inputText styleClass="portlet-form-input-field" value="#{prop.value}" readonly="#{prop.readOnly}"/>
- </c:otherwise>
- </c:choose>
- </td>
- <td>
- <h:commandLink action="#{properties.action.removeProperty}" rendered="#{!prop.inherited}">
- <h:outputText value="Delete"/>
- <f:param name="name" value="#{prop.name}"/>
- </h:commandLink>
- </td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <!-- ends property list -->
- <div class="padding-top:6px;padding-bottom: 6px;float: right;"><h:commandButton value="Update" styleClass="portlet-form-button"/></div></h:form>
+ <h:form>
+ <!-- defines layout of property table -->
+ <table width="100%">
+ <thead class="portlet-section-header">
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ <th>Inherited</th>
+ <th>Value</th>
+ <th>Delete</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="#{properties.entries}" var="prop" varStatus="status">
+ <tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
+ <td>
+ <h:outputText title="#{prop.name}" value="#{prop.displayName}"/>
+ </td>
+ <td>
+ <h:outputText>#{prop.description}</h:outputText>
+ </td>
+ <td>#{prop.inherited ? 'Yes' : 'No'}</td>
+ <td>
+ <c:choose>
+ <c:when test="#{prop.type == 'java.lang.Boolean'}">
+ <h:selectBooleanCheckbox styleClass="portlet-form-button" value="#{prop.value}"
+ readonly="#{prop.readOnly}"/>
+ </c:when>
+ <c:otherwise>
+ <h:inputText styleClass="portlet-form-input-field" value="#{prop.value}"
+ readonly="#{prop.readOnly}"/>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ <td>
+ <h:commandLink action="#{properties.action.removeProperty}" rendered="#{!prop.inherited}">
+ <h:outputText value="Delete"/>
+ <f:param name="name" value="#{prop.name}"/>
+ </h:commandLink>
+ </td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+ <!-- ends property list -->
+ <h:commandButton value="Update" styleClass="portlet-form-button portlet-section-buttonrow"/></h:form>
- </td>
- </tr>
-</table>
-<!-- ends property list section -->
+ </td>
+ </tr>
+ </table>
+ <!-- ends property list section -->
- </td>
- </tr>
+</td>
+</tr>
</table>
<!-- ends area body -->
18 years, 10 months
JBoss Portal SVN: r7543 - in trunk: core/src/resources/portal-core-war/WEB-INF and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-25 20:20:41 -0400 (Mon, 25 Jun 2007)
New Revision: 7543
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml
trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java
trunk/widget/src/resources/widget-war/WEB-INF/portlet.xml
Log:
filter instances in portlet content editor portlet to not show portlet which are them selves content editors based on their portlet mode declarations
Modified: trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core/src/main/org/jboss/portal/core/ui/content/portlet/PortletContentEditorPortlet.java 2007-06-26 00:20:41 UTC (rev 7543)
@@ -26,7 +26,9 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.ModeInfo;
+import org.jboss.portal.Mode;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletMode;
@@ -43,6 +45,8 @@
import java.util.List;
import java.util.Comparator;
import java.util.Collections;
+import java.util.Iterator;
+import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -54,7 +58,8 @@
/** . */
private final PortletMode EDIT_CONTENT = new PortletMode("edit_content");
- private final PortletMode SELECT_CONTENT = new PortletMode("select_content");
+ /** . */
+ private final Mode INTERNAL_EDIT_CONTENT = Mode.create("edit_content");
/** . */
private InstanceContainer instanceContainer;
@@ -66,7 +71,7 @@
public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if ((req.getPortletMode().equals(EDIT_CONTENT)) || (req.getPortletMode().equals(SELECT_CONTENT)))
+ if ((req.getPortletMode().equals(EDIT_CONTENT)))
{
String uri = req.getParameter("content.uri");
if (uri != null)
@@ -82,27 +87,17 @@
{
doEditContent(req, resp);
}
- else if (SELECT_CONTENT.equals(req.getPortletMode()))
- {
- doCreateContent(req, resp);
- }
else
{
super.doDispatch(req, resp);
}
}
- protected void doCreateContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
- {
- getContent(req, resp, true);
- }
-
-
protected void doEditContent(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
getContent(req, resp, false);
}
-
+
protected void getContent(RenderRequest req, RenderResponse resp, boolean newContent) throws PortletException, PortletSecurityException, IOException
{
String selectedURI = req.getParameter("content.uri");
@@ -114,9 +109,38 @@
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
- // load insances this user has access to.
- List available_instances = (List)instanceContainer.getDefinitions();
+ // load instances this user has access to.
+ // Remove content editors
+ List available_instances = new ArrayList();
+ nextInstance:
+ for (Iterator i = instanceContainer.getDefinitions().iterator();i.hasNext();)
+ {
+ Instance instance = (Instance)i.next();
+
+ //
+ try
+ {
+ // Filter portlets that are editors
+ Portlet portlet = instance.getPortlet();
+ PortletInfo info = portlet.getInfo();
+ for (Iterator j = info.getCapabilities().getAllModes().iterator();j.hasNext();)
+ {
+ ModeInfo modeInfo = (ModeInfo)j.next();
+ if (modeInfo.getMode().equals(INTERNAL_EDIT_CONTENT))
+ {
+ continue nextInstance;
+ }
+ }
+
+ //
+ available_instances.add(instance);
+ }
+ catch (PortletInvokerException ignore)
+ {
+ }
+ }
+
// Sort alphabetically
Comparator simpleComparator = new Comparator()
{
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/portlet.xml 2007-06-26 00:20:41 UTC (rev 7543)
@@ -118,6 +118,7 @@
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT_CONTENT</portlet-mode>
</supports>
<portlet-info>
<title>Portlet Content Portlet</title>
Modified: 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 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/editPageLayout.xhtml 2007-06-26 00:20:41 UTC (rev 7543)
@@ -61,9 +61,9 @@
portletId="#{pageManager.selectedEditorPortletId}"
portletInvoker="#{pageManager.portletInvoker}"
actionListener="#{pageManager.assignWindow}"
- supportedModes="select_content"
+ supportedModes="edit_content"
supportedWindowStates="normal"
- initialMode="select_content"
+ initialMode="edit_content"
initialWindowState="normal"
renderParameters="#{pageManager.selectedRenderParameters}"
onClick="url.setParameter('windowName', document.getElementById('windowForm:windowName').value);"/>
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-06-26 00:20:41 UTC (rev 7543)
@@ -135,9 +135,6 @@
private static final PortletMode EDIT_CONTENT = new PortletMode("edit_content");
/** . */
- private static final PortletMode SELECT_CONTENT = new PortletMode("select_content");
-
- /** . */
private CMS CMSService;
/** . */
@@ -307,7 +304,7 @@
protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
+ if (EDIT_CONTENT.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2007-06-26 00:20:41 UTC (rev 7543)
@@ -36,6 +36,7 @@
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT_CONTENT</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
Modified: trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java
===================================================================
--- trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core-samples/src/main/org/jboss/portal/core/portlet/test/FSContentDrivenPortlet.java 2007-06-26 00:20:41 UTC (rev 7543)
@@ -56,15 +56,12 @@
/** The edit_content mode. */
public static final PortletMode EDIT_CONTENT_MODE = new PortletMode("edit_content");
- private final PortletMode SELECT_CONTENT = new PortletMode("select_content");
-
-
/**
* Additional dispatch that will call the <code>doEditContent(RenderRequest,RenderResponse)</code> method.
*/
protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
@@ -197,7 +194,7 @@
public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT_MODE.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
+ if (EDIT_CONTENT_MODE.equals(req.getPortletMode()))
{
String contentURI = req.getParameter("content.uri");
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/portlet.xml 2007-06-26 00:20:41 UTC (rev 7543)
@@ -369,6 +369,8 @@
<portlet-class>org.jboss.portal.core.portlet.test.FSContentDrivenPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT_CONTENT</portlet-mode>
</supports>
<portlet-info>
<title>File Portlet</title>
Modified: trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java
===================================================================
--- trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/widget/src/main/org/jboss/portal/widget/WidgetPortlet.java 2007-06-26 00:20:41 UTC (rev 7543)
@@ -52,8 +52,6 @@
/** . */
private final PortletMode EDIT_CONTENT = new PortletMode("edit_content");
- private final PortletMode SELECT_CONTENT = new PortletMode("select_content");
-
/** . */
private GGProvider provider = new GGProvider();
@@ -128,7 +126,7 @@
protected void doDispatch(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
{
- if (EDIT_CONTENT.equals(req.getPortletMode()) || SELECT_CONTENT.equals(req.getPortletMode()))
+ if (EDIT_CONTENT.equals(req.getPortletMode()))
{
doEditContent(req, resp);
}
Modified: trunk/widget/src/resources/widget-war/WEB-INF/portlet.xml
===================================================================
--- trunk/widget/src/resources/widget-war/WEB-INF/portlet.xml 2007-06-25 23:46:58 UTC (rev 7542)
+++ trunk/widget/src/resources/widget-war/WEB-INF/portlet.xml 2007-06-26 00:20:41 UTC (rev 7543)
@@ -35,6 +35,7 @@
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT_CONTENT</portlet-mode>
</supports>
<portlet-info>
<title>Google Widget</title>
18 years, 10 months
JBoss Portal SVN: r7542 - trunk/core-admin/src/main/org/jboss/portal/core/admin/ui.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-25 19:46:58 -0400 (Mon, 25 Jun 2007)
New Revision: 7542
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java
Log:
- Added '.' for consistency.
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java 2007-06-25 23:40:29 UTC (rev 7541)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java 2007-06-25 23:46:58 UTC (rev 7542)
@@ -22,12 +22,12 @@
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.control.ControlConstants;
-import org.jboss.portal.core.model.portal.PortalObject;
import javax.faces.model.SelectItem;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -69,7 +69,7 @@
pageSelectItems = new ArrayList();
pageSelectItems.add(new SelectItem(ControlConstants.IGNORE_CONTROL_VALUE, "display the default error message."));
pageSelectItems.add(new SelectItem(ControlConstants.HIDE_CONTROL_VALUE, "remove the resource from page."));
- pageSelectItems.add(new SelectItem(ControlConstants.JSP_CONTROL_VALUE, "redirect to the specified resource"));
+ pageSelectItems.add(new SelectItem(ControlConstants.JSP_CONTROL_VALUE, "redirect to the specified resource."));
}
return pageSelectItems;
}
@@ -83,7 +83,7 @@
if (!PropertiesInfo.isControlProperty(name))
{
- throw new IllegalStateException("trying to process non control property: " + name );
+ throw new IllegalStateException("trying to process non control property: " + name);
}
PortalObject object = pomgr.getSelectedObject();
18 years, 10 months