Author: conkan Date: 2006-05-18 00:03:39 -0400 (Thu, 18 May 2006) New Revision: 4310 Added: labs/portletswap/imagegalleryportlet/portal_2.0/.classpath labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore labs/portletswap/imagegalleryportlet/portal_2.0/.project labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt labs/portletswap/imagegalleryportlet/portal_2.0/README.txt labs/portletswap/imagegalleryportlet/portal_2.0/build.bat labs/portletswap/imagegalleryportlet/portal_2.0/build.log labs/portletswap/imagegalleryportlet/portal_2.0/build.sh labs/portletswap/imagegalleryportlet/portal_2.0/build.xml labs/portletswap/imagegalleryportlet/portal_2.0/gallery/ labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/ labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/bufo.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/desert.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/fan.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/rana.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/xen.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/ labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/bufo.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/desert.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/fan.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/rana.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/xen.jpg labs/portletswap/imagegalleryportlet/portal_2.0/src/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/Thumbs.db labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/add.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/back.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/delete.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/edit.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/next.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/previous.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/view.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/ labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf labs/portletswap/imagegalleryportlet/portal_2.0/src/main/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ImageCollectionImpl.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ImageDetailImpl.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ImageGalleryModuleImpl.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/model/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/model/ImageCollection.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/model/ImageDetail.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/test/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/test/imagegallery/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/test/imagegallery/ImageGalleryPortletTestCase.java labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/META-INF/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/META-INF/application.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/META-INF/jboss-app.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/META-INF/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/META-INF/jboss-service.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/hibernate/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/hibernate/hibernate.cfg.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/hibernate/setup.txt labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/classes/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/classes/Resource.properties labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/classes/Resource_en.properties labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/imagegallery-pages.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jboss-app.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jboss-portlet.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jboss-web.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionAdd.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionDelete.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionEdit.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionView.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collections.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailAdd.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailDelete.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailEdit.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailView.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/details.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/imagedetail.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/portal-lib.tld labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/portlet-instances.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/portlet.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/web.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/setup/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/setup/setup.sql labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/test/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/test/hibernate.properties labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/test/log4j.properties Log: Added: labs/portletswap/imagegalleryportlet/portal_2.0/.classpath =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/.classpath 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/.classpath 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-server/lib/jboss.jar"/> + <classpathentry kind="src" path="/portal-core"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-system/lib/jboss-system.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-system/lib/jboss-jmx.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-system/lib/jboss-common.jar"/> + <classpathentry kind="src" path="/portal-api"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-j2ee/lib/jboss-j2ee.jar"/> + <classpathentry kind="src" path="/portal-portlet"/> + <classpathentry kind="lib" path="/portal-thirdparty/sun-servlet/lib/jsp-api.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/sun-servlet/lib/servlet-api.jar"/> + <classpathentry kind="src" path="/portal-server"/> + <classpathentry kind="src" path="/portal-common"/> + <classpathentry kind="lib" path="/portal-thirdparty/jakarta-log4j/lib/log4j.jar"/> + <classpathentry kind="src" path="/portal-format"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-hibernate/lib/hibernate2.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jakarta-lucene/lib/lucene.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/oswego-concurrent/lib/concurrent.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-hibernate/lib/jboss-hibernate.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,2 @@ +output +build.log Added: labs/portletswap/imagegalleryportlet/portal_2.0/.project =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/.project 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/.project 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>portal-ron</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,8 @@ +/***************************************** + * * + * The Image Gallery Portlet * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ \ No newline at end of file Added: labs/portletswap/imagegalleryportlet/portal_2.0/README.txt =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/README.txt 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/README.txt 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,6 @@ +The Image Gallery Portlet is great for showing images on the web. +It uses the JBoss Portal CMS. +The images can be loaded to the CMS using the JBoss CMS or Windows "My Network Places" useing webdav. +The sample gallery images must be loaded to the JBoss CMS under the "default" directory. +If My Network Places is used, the whole gallery directory structure can be moved under default with one directory move, +All that is needed after that is a build and a build deploy to get up and running. \ No newline at end of file Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.bat =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.bat 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.bat 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,54 @@ +@echo off +rem +rem Invokes a script of the same name in the 'tools' module. +rem +rem The 'tools' module is expected to be a peer directory of the directory +rem in which this script lives. +rem +rem @author Jason Dillon <ja...@pl...> +rem + +rem $Id: build.bat,v 1.1.1.1 2005/01/14 23:12:37 vietj Exp $ + +setlocal + +set PROGNAME=%~nx0 +set DIRNAME=%~dp0 + +rem Legacy shell support +if x%PROGNAME%==x set PROGNAME=build.bat +if x%DIRNAME%==x set DIRNAME=.\ + +set MODULE_ROOT=%DIRNAME% +if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools +set TARGET=%TOOLS_ROOT%\bin\build.bat +set ARGS=%* + +rem Start'er up yo +goto main + +:debug +if not x%DEBUG%==x echo %PROGNAME%: %* +goto :EOF + +:main +call :debug PROGNAME=%PROGNAME% +call :debug DIRNAME=%DIRNAME% +call :debug TOOLS_ROOT=%TOOLS_ROOT% +call :debug TARGET=%TARGET% + +if exist %TARGET% call :call-script & goto :EOF +rem else fail, we can not go on + +echo %PROGNAME%: *ERROR* The target executable does not exist: +echo %PROGNAME%: +echo %PROGNAME%: %TARGET% +echo %PROGNAME%: +echo %PROGNAME%: Please make sure you have checked out the 'tools' module +echo %PROGNAME%: and make sure it is up to date. +goto :EOF + +:call-script +call :debug Executing %TARGET% %ARGS% +call %TARGET% %ARGS% +goto :EOF Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.log =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.log 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.log 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,61 @@ + +configure: + +configure-libraries: + +configure-modules: + +configure-defaults: + +configure-tools: + +_configure:explode:task: + +_configure:jflex:task: + +_configure:xdoclet:task: + +_configure:xdoclet:ejbdoclet: + +_configure:xdoclet:jmxdoclet: + +_configure:xdoclet:hibernatedoclet: + +_configure:xdoclet:webdoclet: + +_configure:cactus:cactus: + [echo] D:\portal-2.0/thirdparty/junit-junit/lib + +init: + +generate-classes: + +_default:compile-classes: + [depend] Deleted 0 out of date files in 0 seconds + +_default:check-exists-etc: + +_default:compile-etc: + +_default:check-exists-resources: + +_default:compile-resources: + +compile: +[jmxdoclet] Oct 24, 2005 10:51:06 PM xdoclet.XDocletMain start +[jmxdoclet] INFO: Running <jbossxmbean/> +[jmxdoclet] WARNING: Some classes refer to other classes that were not found among the sources or on the classpath. +[jmxdoclet] (Perhaps the referred class doesn't exist? Hasn't been generated yet?) +[jmxdoclet] The referring classes do not import any fully qualified classes matching these classes. +[jmxdoclet] Since at least one package is imported, it is impossible for xjavadoc to figure out +[jmxdoclet] what package the referred classes belong to. The classes are: +[jmxdoclet] D:\portal-2.0\imagegallery\src\main\org\jboss\portlet\imagegallery\ImageGalleryPortlet.java --> JBossPortlet qualified to org.jboss.portlet.imagegallery.JBossPortlet +[hibernatedoclet] Oct 24, 2005 10:51:07 PM xdoclet.XDocletMain start +[hibernatedoclet] INFO: Running <hibernate/> + +output: + +deploy: + [copy] Copying 1 file to D:\jboss\jboss-4.0.2\server\default\deploy + +BUILD SUCCESSFUL Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.sh =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.sh 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.sh 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,49 @@ +#!/bin/sh +## +## Invokes a script of the same name in the 'tools' module. +## +## The 'tools' module is expected to be a peer directory of the directory +## in which this script lives. +## +## @author Jason Dillon <ja...@pl...> +## + +# $Id: build.sh,v 1.1.1.1 2005/01/14 23:12:37 vietj Exp $ + +PROGNAME=`basename $0` +DIRNAME=`dirname $0` + +# Buss it yo +main() { + if [ "x$TOOLS_ROOT" = "x" ]; then + TOOLS_ROOT=`cd $DIRNAME/../tools && pwd` + fi + + MODULE_ROOT=`cd $DIRNAME; pwd` + export TOOLS_ROOT MODULE_ROOT DEBUG TRACE + + # Where is the target script? + target="$TOOLS_ROOT/bin/$PROGNAME" + if [ ! -f "$target" ]; then + echo "${PROGNAME}: *ERROR* The target executable does not exist:" + echo "${PROGNAME}:" + echo "${PROGNAME}: $target" + echo "${PROGNAME}:" + echo "${PROGNAME}: Please make sure you have checked out the 'tools' module" + echo "${PROGNAME}: and make sure it is up to date." + exit 2 + fi + + # Get busy yo! + if [ "x$DEBUG" != "x" ]; then + echo "${PROGNAME}: Executing: /bin/sh $target $@" + fi + if [ "x$TRACE" = "x" ]; then + exec /bin/sh $target "$@" + else + exec /bin/sh -x $target "$@" + fi +} + +# Lets get ready to rumble! +main "$@" Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.xml =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.xml 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.xml 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,300 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE project [ + <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent"> +<!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent"> +<!ENTITY libraries SYSTEM "../tools/etc/buildfragments/libraries.ent"> +<!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent"> +<!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent"> +<!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent"> +]> + +<!-- $Id: build.xml,v 1.9 2005/05/16 22:45:17 julien Exp $ --> + +<!--+======================================================================+--> +<!--| JBoss Portal (The OpenSource Portal) Build File |--> +<!--| |--> +<!--| Distributable under LGPL license. |--> +<!--| See terms of license at http://www.gnu.org. |--> +<!--| |--> +<!--| This file has been designed to work with the 'tools' module and |--> +<!--| Buildmagic extentions. |--> +<!--+======================================================================+--> + +<project default="main" name="JBoss Portal imagegallery"> + + <!--+====================================================================+--> + <!--| Setup |--> + <!--| |--> + <!--| Include the common build elements. |--> + <!--| |--> + <!--| This defines several different targets, properties and paths. |--> + <!--| It also sets up the basic extention tasks amoung other things. |--> + <!--+====================================================================+--> + + &buildmagic; + &libraries; + &modules; + &defaults; + &tools; + &targets; + + <!-- ================================================================== --> + <!-- Initialization --> + <!-- ================================================================== --> + + <!-- + | Initialize the build system. Must depend on '_buildmagic:init'. + | Other targets should depend on 'init' or things will mysteriously fail. + --> + + <target name="init" unless="init.disable" depends="_buildmagic:init"> + </target> + + <!--+====================================================================+--> + <!--| Configuration |--> + <!--| |--> + <!--| This target is invoked by the Buildmagic initialization logic |--> + <!--| and should contain module specific configuration elements. |--> + <!--+====================================================================+--> + + <target name="configure" unless="configure.disable"> + + <!-- Configure some properties --> + <property name="jndi-root" value="portal" /> + + <!-- Configure thirdparty libraries --> + <call target="configure-libraries" /> + <path id="library.classpath"> + <path refid="oswego.concurrent.classpath" /> + <path refid="jboss.system.classpath" /> + <path refid="jboss.j2ee.classpath" /> + <path refid="jboss.server.classpath" /> + <path refid="jakarta.log4j.classpath" /> + <path refid="junit.junit.classpath" /> + <path refid="sun.servlet.classpath" /> + <path refid="jakarta.cactus.classpath" /> + <path refid="jakarta.lucene.classpath" /> + <path refid="jakarta.fileupload.classpath"/> + <path refid="jakarta.slide.classpath"/> + <path refid="jwebunit.jwebunit.classpath" /> + <path refid="dbunit.dbunit.classpath" /> + </path> + + <!-- Configure modules --> + <call target="configure-modules" /> + <path id="dependentmodule.classpath"> + <path refid="jboss.portal-core.classpath" /> + <path refid="jboss.portal-format.classpath" /> + <path refid="jboss.portal-common.classpath" /> + <path refid="jboss.portal-portlet.classpath" /> + <path refid="jboss.portal-server.classpath" /> + <path refid="jboss.portlet-api.classpath" /> + <path refid="jboss.hibernate.classpath" /> + </path> + + <!--+=======================================+--> + <!--| Override any default properties here. |--> + <!--+=======================================+--> + + <!-- Configure defaults & build tools --> + <call target="configure-defaults" /> + <call target="configure-tools" /> + + <!--+=======================================+--> + <!--| Define module specific elements here. |--> + <!--+=======================================+--> + <property name="javadoc.private" value="true" /> + <property name="javadoc.protected" value="false" /> + + </target> + + + + <!--+====================================================================+--> + <!--| Compile |--> + <!--| |--> + <!--| This target should depend on other compile-* targets for each |--> + <!--| different type of compile that needs to be performed, short of |--> + <!--| documentation compiles. |--> + <!--+====================================================================+--> + + <target name="compile" description="Compile all source files." depends="generate-classes, + _default:compile-classes, + _default:compile-etc, + _default:compile-resources"> + <!-- Add module specific elements here. --> + <jmxdoclet + destDir="${build.classes}"> + <fileset dir="${jboss.portal-server.root}/../src/main"> + <include name="org/jboss/portal/server/util/Service.java" /> + <include name="org/jboss/portal/server/deployment/AbstractWebAppListener.java" /> + </fileset> + <fileset dir="${source.classes}" includes="**/*.java" /> + <jbossxmbean /> + </jmxdoclet> + <hibernatedoclet + destDir="${build.resources}/portal-imagegallery-sar"> + <fileset dir="${source.java}"> + <include name="**/impl/*Impl.java" /> + </fileset> + <hibernate + version="3.0" + destDir="${build.resources}/portal-imagegallery-sar"/> + </hibernatedoclet> + </target> + + <!-- Generate all class files --> + <target name="generate-classes" depends="init"> + </target> + + <!-- Remove or change the delimiter in hibernate-export if your database has a different deliniter --> + <target name="ddl" depends="output"> + <taskdef classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" name="hibernate-export"> + <classpath> + <path refid="javac.classpath" /> + <pathelement location="${build.resources}/test" /> + <fileset dir="${build.lib}" includes="portal-imagegallery-lib.jar" /> + <fileset dir="${jboss.home}/lib" includes="dom4j.jar,commons-logging.jar" /> + <fileset dir="${jboss.hibernate.lib}" includes="commons-collections.jar,odmg.jar" /> + </classpath> + </taskdef> + <mkdir dir="${build.resources}/setup/" /> + <hibernate-export properties="${hibernate.properties}" text="true" quiet="true" delimiter=";" output="${build.resources}/setup/setup.ddl"> + <fileset dir="${build.resources}/portal-imagegallery-sar" includes="**/*.hbm.xml" /> + </hibernate-export> + </target> + + <!--+====================================================================+--> + <!--| Generate Output |--> + <!--| |--> + <!--| Generates the target output for this module. Target output is |--> + <!--| the output which is ment to be released or used by external |--> + <!--| modules. |--> + <!--+====================================================================+--> + + <target name="output" description="Generate all target output." depends="compile"> + + <mkdir dir="${build.lib}" /> + + <!-- portal-imagegallery-lib.jar --> + <jar jarfile="${build.lib}/portal-imagegallery-lib.jar"> + <fileset dir="${build.classes}" /> + </jar> + + <!-- portal-imagegallery.war --> + <jar jarfile="${build.lib}/portal-imagegallery.war" manifest="${build.etc}/portal-imagegallery-war.mf"> + <fileset dir="${build.resources}/portal-imagegallery-war" /> + <fileset dir="${source.bin}/portal-imagegallery-war" /> + </jar> + + <!-- portal-imagegallery.sar --> + <jar jarfile="${build.lib}/portal-imagegallery.sar"> + <fileset dir="${build.resources}/portal-imagegallery-sar" includes="**/*" /> + </jar> + + <!-- portal-imagegallery.ear --> + <copy todir="${build.resources}/portal-imagegallery-ear"> + <fileset dir="${jakarta.lucene.root}/lib" includes="lucene-1.4-final.jar" /> + <fileset dir="${build.lib}" includes="portal-imagegallery.war,portal-imagegallery-lib.jar,portal-imagegallery.sar" /> + </copy> + <jar jarfile="${build.lib}/portal-imagegallery.ear"> + <fileset dir="${build.resources}/portal-imagegallery-ear" includes="**/*" /> + </jar> + </target> + + <target name="explode" depends="init"> + <explode file="${build.lib}/portal-imagegallery.ear" todir="${build.lib}" name="portal-imagegallery-exploded.ear" /> + </target> + + <!-- ================================================================== --> + <!-- Cleaning --> + <!-- ================================================================== --> + + <!-- Clean up all build output --> + <target name="clean" depends="_default:clean"> + <!-- Add module specific elements here. --> + </target> + + <!--+====================================================================+--> + <!--| Documents |--> + <!--| |--> + <!--| Generate all documentation for this module. |--> + <!--+====================================================================+--> + + <target name="docs" depends="_default:docs"> + <!-- Add module specific elements here. --> + </target> + + <!-- ================================================================== --> + <!-- Misc. --> + <!-- ================================================================== --> + + <target name="main" depends="most" /> + <target name="all" depends="_default:all" /> + <target name="most" depends="_default:most" /> + <target name="help" depends="_default:help" /> + + <!-- ================================================================== --> + <!-- Deployment --> + <!-- ================================================================== --> + + <!-- + | Deploy the application + --> + <target name="deploy" description="Deploy." depends="output"> + <require file="${jboss.home}/server/${portal.deploy.dir}/deploy" /> + <copy file="${build.lib}/portal-imagegallery.ear" todir="${jboss.home}/server/${portal.deploy.dir}/deploy" /> + </target> + + <!-- + | Undeploy the application + --> + <target name="undeploy" description="Undeploy." depends="init"> + <require file="${jboss.home}/server/${portal.deploy.dir}/deploy" /> + <delete file="${jboss.home}/server/${portal.deploy.dir}/deploy/portal-imagegallery.ear" /> + </target> + + <target name="test" depends="init"> + + <property name="build.testlog" value="${module.output}/log" /> + + <echo> + <![CDATA[ + ${build.reports} + ${build.testlog} + ${module.output} + ${junit.printsummary} + ${junit.batchtest.haltonerror} + ${junit.batchtest.haltonfailure} + ${junit.batchtest.fork} + ${junit.timeout} + ${junit.jvm} + ]]> + </echo> + + <mkdir dir="${build.reports}" /> + <mkdir dir="${build.testlog}" /> + + <junit dir="${module.output}" printsummary="${junit.printsummary}" haltonerror="${junit.haltonerror}" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" timeout="${junit.timeout}" jvm="${junit.jvm}"> + <formatter type="plain" usefile="false" /> + <sysproperty key="build.testlog" value="${build.testlog}" /> + <sysproperty key="build.resources" value="${build.resources}" /> + <test name="org.jboss.portlet.test.imagegallery.imagegalleryPortletTestCase" /> + <classpath> + <pathelement location="${build.classes}" /> + <pathelement location="${build.resources}/portal-core-sar" /> + <pathelement location="${jboss.home}/lib/dom4j.jar" /> + <pathelement location="${jboss.config}/lib/hsqldb.jar" /> + <pathelement location="${jboss.config}/lib/jgroups.jar" /> + <pathelement location="${jboss.config}/lib/cglib-full-2.0.1.jar" /> + <path refid="jboss.hibernate.classpath" /> + <path refid="library.classpath" /> + <path refid="dependentmodule.classpath" /> + <pathelement location="${jwebunit.jwebunit.lib}/nekohtml.jar" /> + <pathelement location="${dbunit.dbunit.lib}/dbunit.jar" /> + <pathelement location="${jdbc.connectors.lib}/mysql-connector-java.jar" /> + </classpath> + </junit> + + </target> +</project> Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/bufo.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/bufo.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/desert.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/desert.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/fan.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/fan.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/rana.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/rana.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/xen.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/xen.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/bufo.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/bufo.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/desert.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/desert.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/fan.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/fan.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/rana.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/rana.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/xen.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/xen.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/Thumbs.db =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/Thumbs.db ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/add.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/add.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/back.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/back.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/delete.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/delete.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/edit.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/edit.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/next.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/next.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/previous.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/previous.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/view.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/view.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Created-By: @java.vm.version@ (@java.vm.vendor@) +Specification-Title: @specification.title@ +Specification-Version: @specification.version@ +Specification-Vendor: @specification.vendor@ +Implementation-Title: @implementation.title@ +Implementation-URL: @implementation.url@ +Implementation-Version: @implementation.version@ +Implementation-Vendor: @implementation.vendor@ +Implementation-Vendor-Id: @implementation.vendor.id@ +Class-Path: ./portal-imagegallery-lib.jar Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,107 @@ +/***************************************** + * * + * The Image Gallery Portlet * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.portlet.imagegallery; + +import org.jboss.portlet.imagegallery.model.*; +import org.jboss.portal.core.modules.ModuleException; + +import java.util.List; + +/** + * @author <a href="mailto:im...@ho...">Ron & Conrad Kanengieter</a> + * @version $Revision: 1.0 $ + */ +public interface ImageGalleryModule +{ + /** + * Retrieves a imagecollection by its numerical id. + * + * @param id the imagecollection id + * @return the imagecollection + */ + ImageCollection findImageCollectionByID(Integer id) throws IllegalArgumentException, ModuleException; + + + /** + * Create a new imagecollection with the specified name. + * + * @param name the imagecollection name + * @param description the imagecollection description + * @param thumbnailPath the imagecollection thumbnailPath + * @param featuredFlag the imagecollection featuredFlag + * @return the imagecollection + */ + ImageCollection createImageCollection(String name, String description, String thumbnailPath, Boolean featuredFlag) throws ModuleException; + + + /** + * Remove a imagecollection. + * + * @param id the imagecollection id + */ + void removeImageCollection(Integer id) throws IllegalArgumentException, ModuleException; + + /** + * Returns the number of imagecollections. + * + * @return the number of imagecollections + */ + int getImageCollectionsCount() throws ModuleException; + + /** + * Get all the imagecollections + * + * @return the imagecollections + */ + List findImageCollections() throws ModuleException; + +//****************************************************************************************** + + /** + * Remove a imagedetail. + * + * @param id the imagedetail id + */ + void removeImageDetail(Integer id) throws IllegalArgumentException, ModuleException; + + + /** + * Get all the imagedetails + * + * @return the imagedetails + */ + List findImageDetails() throws ModuleException; + + + List findDetailsByCollectionID(Integer collectionID) + throws ModuleException; + + ImageDetail findImageDetailByID(Integer id) throws IllegalArgumentException, ModuleException; + + /** + * Create a new imagecollection with the specified name. + * + * @param imagecollection the parent imagecollection + * @param name the imagedetail name + * @param description the imagedetail description + * @param thumbnailPath the imagedetail thumbnailPath + * @param imagePath the imagedetail imagePath + * @param photographer the imagedetail photographer + * @return the imagedetail + */ + ImageDetail createImageDetail( + ImageCollection imagecollection, + String name, + String description, + String thumbnailPath, + String imagePath, + String photographer) + throws ModuleException; + +} \ No newline at end of file Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,601 @@ +/***************************************** + * * + * The Image Gallery Portlet * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.portlet.imagegallery; + +import org.jboss.logging.Logger; +import org.jboss.portal.common.context.DelegateContext; +import org.jboss.portal.common.value.BooleanValue; +import org.jboss.portlet.imagegallery.model.*; +import org.jboss.portlet.imagegallery.impl.ImageGalleryModuleImpl; +import org.jboss.portal.core.modules.ModuleException; +import org.jboss.portal.core.portlet.PortletHelper; +import org.jboss.portal.core.servlet.jsp.PortalJsp; +import org.jboss.portlet.*; + +import org.apache.webdav.lib.WebdavResource; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.portlet.PortletFileUpload; +import org.apache.commons.httpclient.HttpURL; +import java.io.File; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.portlet.*; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.List; + +/** + * This portlet aims at managing imagegallerys. + * + * @author <a href="mailto:im...@ho...">Ron & Conrad Kanengieter</a> + * @version $Revision: 1.0 $ + */ +public class ImageGalleryPortlet + extends JBossPortlet +{ + /** + * the class logger + */ + public static final Logger log = Logger.getLogger(JBossPortlet.class); + + public static final String IMAGEGALLERYMODULE_JNDINAME = "java:portal/ImageGalleryModule"; + + private PortletHelper portletHelper; + + // Render op + + private ImageGalleryModule imagegalleryModule; + + public static final String OP_COLLECTIONVIEW = "collectionView"; + public static final String OP_COLLECTIONEDIT = "collectionEdit"; + public static final String OP_COLLECTIONDELETE = "collectionDelete"; + public static final String OP_COLLECTIONADD = "collectionAdd"; + public static final String OP_COLLECTIONS = "collections"; + + public static final String OP_DETAILVIEW = "detailView"; + public static final String OP_DETAILEDIT = "detailEdit"; + public static final String OP_DETAILDELETE = "detailDelete"; + public static final String OP_DETAILADD = "detailAdd"; + public static final String OP_DETAILS = "details"; + public static final String OP_IMAGEDETAIL = "imagedetail"; + + public void init() throws PortletException + { + super.init(); + imagegalleryModule = new ImageGalleryModuleImpl(); + getPortletContext().setAttribute("imagegalleryModule", imagegalleryModule); + portletHelper = new PortletHelper(this); + } + + public String getDefaultOperation() + { + return OP_COLLECTIONS; + } + + protected void doView(JBossRenderRequest req, JBossRenderResponse resp) + throws PortletException, PortletSecurityException, IOException + { + + resp.setContentType("text/html"); + PrintWriter writer = resp.getWriter(); + + String op; + if(req.getWindowState() != WindowState.MAXIMIZED) + op = getDefaultOperation(); + else + op = req.getParameters().get(getOperationName(), getDefaultOperation()); + + Locale locale = req.getLocale(); + ResourceBundle bundle = getResourceBundle(locale); + +// Collections + if(OP_COLLECTIONS.equals(op)) + { + if(req.hasPermission("Admin")) + req.setAttribute("user", "admin"); + else + req.setAttribute("user", "public"); + + try + { + List imagecollections = imagegalleryModule.findImageCollections(); + DelegateContext ctx = new DelegateContext(); + DelegateContext rowCtx = null; + Iterator i = imagecollections.iterator(); + while(i.hasNext()) + { + ImageCollection imagecollection = (ImageCollection) i.next(); + rowCtx = ctx.next("imagecollections"); + rowCtx.put("ID", imagecollection.getID().toString()); + rowCtx.put("Name", imagecollection.getName()); + rowCtx.put("ThumbnailPath", imagecollection.getThumbnailPath()); + } + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collections.jsp"); + rd.include(req, resp); + } +// Details + else if(OP_DETAILS.equals(op)) + { + if(req.hasPermission("Admin")) + req.setAttribute("user", "admin"); + else + req.setAttribute("user", "public"); + + try + { + Integer id = req.getParameters().getIntObject("collectionID"); + List imagedetails = imagegalleryModule.findDetailsByCollectionID(id); + DelegateContext ctx = new DelegateContext(); + DelegateContext rowCtx = null; + ctx.put("CollectionID", (id.toString())); + StringBuffer idString = new StringBuffer(";"); + Iterator i = imagedetails.iterator(); + while(i.hasNext()) + { + ImageDetail imagedetail = (ImageDetail) i.next(); + rowCtx = ctx.next("imagedetails"); + String ic_Id = imagedetail.getID().toString(); + idString.append(";" + ic_Id + ";"); + rowCtx.put("ID", ic_Id); + rowCtx.put("Name", imagedetail.getName()); + rowCtx.put("ThumbnailPath", imagedetail.getThumbnailPath()); + } + idString.append(";"); + req.getPortletSession().setAttribute("idString", (idString.toString())); + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/details.jsp"); + rd.include(req, resp); + } +// ImageDetail + else if(OP_IMAGEDETAIL.equals(op)) + { + if(req.hasPermission("Admin")) + req.setAttribute("user", "admin"); + else + req.setAttribute("user", "public"); + + try + { + Integer collectionID = req.getParameters().getIntObject("collectionID"); + Integer detailID = req.getParameters().getIntObject("detailID"); + String idString = (String)req.getPortletSession().getAttribute("idString"); + + + int result, pStart, pEnd, nStart, nEnd; + int index = 0; + int saveIndex = 0; + int imageCount = 0; + int saveCount = 0; + + Integer nextID = new Integer(0); + Integer previousID = new Integer(0); + + if (idString != null) + { + result = idString.indexOf(";" + detailID + ";"); + + pEnd = result - 1; + pStart = idString.lastIndexOf(";;", (pEnd - 1)) + 2; + + nStart = idString.indexOf(";;", result) + 2; + nEnd = idString.indexOf(";;", nStart); + + if (pEnd > 0) + previousID = new Integer(idString.substring(pStart,pEnd)); + + if (nEnd > 0) + nextID = new Integer(idString.substring(nStart,nEnd)); + + result = result + 2; + while (index >= 0) + { + index = idString.indexOf(";;", saveIndex); + if (index == result) + saveCount = imageCount; + imageCount++; + saveIndex = index + 2; + } + + imageCount = imageCount - 2; + } + else + imageCount = saveCount = 1; + + Integer IDindex = new Integer(saveCount); + Integer IDcount = new Integer(imageCount); + + + ImageDetail imagedetail = imagegalleryModule.findImageDetailByID(detailID); + + DelegateContext ctx = new DelegateContext(); + + ctx.put("CollectionID", (collectionID.toString())); + ctx.put("DetailID", (detailID.toString())); + ctx.put("Name", imagedetail.getName()); + ctx.put("Description", imagedetail.getDescription()); + ctx.put("ImagePath", imagedetail.getImagePath()); + ctx.put("Photographer", imagedetail.getPhotographer()); + + ctx.put("CollectionID", (collectionID.toString())); + + if (previousID.intValue() > 0) + { + DelegateContext previousCtx = ctx.next("PreviousID"); + previousCtx.put("ID", (previousID.toString())); + } + if (nextID.intValue() > 0) + { + DelegateContext nextCtx = ctx.next("NextID"); + nextCtx.put("ID", (nextID.toString())); + } + + ctx.put("IDindex", (IDindex.toString())); + ctx.put("IDcount", (IDcount.toString())); + + + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/imagedetail.jsp"); + rd.include(req, resp); + } +// CollectionAdd + else if (OP_COLLECTIONADD.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionAdd.jsp"); + rd.include(req, resp); + } +// CollectionView +// CollectionDelete +// CollectionEdit + else if ((OP_COLLECTIONVIEW.equals(op)) + || (OP_COLLECTIONDELETE.equals(op)) + || (OP_COLLECTIONEDIT.equals(op))) + { + + Integer id = req.getParameters().getIntObject("ID"); + ImageCollection imagecollection = null; + DelegateContext ctx = new DelegateContext(); + + try + { + imagecollection = imagegalleryModule.findImageCollectionByID(id); + + ctx.put("ID", imagecollection.getID().toString()); + ctx.put("Name", imagecollection.getName()); + ctx.put("Description", imagecollection.getDescription()); + ctx.put("ThumbnailPath", imagecollection.getThumbnailPath()); + if (imagecollection.getFeaturedFlag().booleanValue() == true) + ctx.put("FeaturedFlag", "checked"); + else + ctx.put("FeaturedFlag", ""); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + + if (OP_COLLECTIONVIEW.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionView.jsp"); + rd.include(req, resp); + } + else if (OP_COLLECTIONDELETE.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionDelete.jsp"); + rd.include(req, resp); + } + else if (OP_COLLECTIONEDIT.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionEdit.jsp"); + rd.include(req, resp); + } + + } +// DetailAdd + else if (OP_DETAILADD.equals(op)) + { + Integer collectionID = req.getParameters().getIntObject("collectionID"); + + DelegateContext ctx = new DelegateContext(); + ctx.put("CollectionID", (collectionID.toString())); + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailAdd.jsp"); + rd.include(req, resp); + } +// DetailView +// DetailDelete +// DetailEdit + else if ((OP_DETAILVIEW.equals(op)) + || (OP_DETAILDELETE.equals(op)) + || (OP_DETAILEDIT.equals(op))) + { + + Integer collectionID = req.getParameters().getIntObject("collectionID"); + Integer detailID = req.getParameters().getIntObject("detailID"); + String redirect = req.getParameter("redirect"); + ImageDetail imagedetail = null; + DelegateContext ctx = new DelegateContext(); + + try + { + imagedetail = imagegalleryModule.findImageDetailByID(detailID); + + ctx.put("CollectionID", (collectionID.toString())); + ctx.put("DetailID", (detailID.toString())); + ctx.put("Redirect", redirect); + ctx.put("Name", imagedetail.getName()); + ctx.put("Description", imagedetail.getDescription()); + ctx.put("ThumbnailPath", imagedetail.getThumbnailPath()); + ctx.put("ImagePath", imagedetail.getImagePath()); + ctx.put("Photographer", imagedetail.getPhotographer()); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + + if (OP_DETAILVIEW.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailView.jsp"); + rd.include(req, resp); + } + else if (OP_DETAILDELETE.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailDelete.jsp"); + rd.include(req, resp); + } + else if (OP_DETAILEDIT.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailEdit.jsp"); + rd.include(req, resp); + } + } + else + log.error("This operation does not exist: " + op); + + writer.close(); + } + + + /** + * Action to add a imagecollection + * + * @param req + * @param resp + */ + public void addCollection(JBossActionRequest req, JBossActionResponse resp) + { + + String name = req.getParameter("Name"); + String description = req.getParameter("Description"); + String thumbnailPath = req.getParameter("ThumbnailPath"); + String SfeaturedFlag = req.getParameter("FeaturedFlag"); + String submit = req.getParameter("submit"); + + boolean checked = false; + if (SfeaturedFlag != null) + if (SfeaturedFlag.equals("true")) + checked = true; + Boolean featuredFlag = new Boolean(checked); + + if(submit.equals("ADD") && req.hasPermission("Admin")) + { + try + { + imagegalleryModule.createImageCollection(name, description, thumbnailPath, featuredFlag); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + } + resp.setRenderParameter("op", OP_COLLECTIONS); + } + + ... [truncated message content] |