You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jbo...@li...> - 2005-08-24 15:44:55
|
Author: aron.gombas Date: 2005-08-24 11:44:50 -0400 (Wed, 24 Aug 2005) New Revision: 942 Modified: trunk/labs/kosmos/build/build.xml Log: Path problems fixed Modified: trunk/labs/kosmos/build/build.xml =================================================================== --- trunk/labs/kosmos/build/build.xml 2005-08-24 13:29:52 UTC (rev 941) +++ trunk/labs/kosmos/build/build.xml 2005-08-24 15:44:50 UTC (rev 942) @@ -115,7 +115,7 @@ <target name="manual-html" depends="init" description="Creates the manual in HTML format"> <mkdir dir="${dist-bin.docs.reference.dir}/html"/> <java jar="${saxon.dir}/saxon8.jar" fork="true" output="${dist-bin.docs.reference.dir}/html/reference-manual.html"> - <arg line="${reference.dir}/*.xml"/> + <arg line="${reference.dir}/reference-manual.xml"/> <arg line="${docbook.dir}/html/docbook.xsl"/> </java> <copy todir="${dist-bin.docs.reference.dir}/html"> @@ -129,33 +129,33 @@ <classpath> <fileset dir="${fop.dir}" includes="**/*.jar"/> </classpath> - <arg line="-xml ${reference.dir}/*.xml"/> - <arg line="-xsl ${docbook.dir}//fo/docbook.xsl"/> + <arg line="-xml ${reference.dir}/reference-manual.xml"/> + <arg line="-xsl ${docbook.dir}/fo/docbook.xsl"/> <arg value="${dist-bin.docs.reference.dir}/pdf/reference-manual.pdf"/> </java> </target> <target name="dist-src" depends="init,clean,javadocs" description="Prepares all source distributables"> <mkdir dir="${dist-src.dir}"/> - <!-- copy other resources --> - <copy todir="${dist-src.dir}"> - <fileset dir="." includes="build-${module.name}.xml,deploy-${module.name}-*.xml"/> - </copy> - <copy todir="${dist-src.dir}/build"> + <!-- copy other resources --> + <copy todir="${dist-src.dir}"> + <fileset dir="." includes="build-${module.name}.xml,deploy-${module.name}-*.xml"/> + </copy> + <copy todir="${dist-src.dir}/build"> <fileset dir="${build.dir}"/> </copy> - <copy todir="${dist-src.dir}/conf-${module.name}"> + <copy todir="${dist-src.dir}/conf-${module.name}"> <fileset dir="${conf.dir}"/> </copy> - <copy todir="${dist-src.dir}/src"> - <fileset dir="${src.dir}"/> + <copy todir="${dist-src.dir}/src"> + <fileset dir="${src.dir}"/> </copy> - <copy todir="${dist-src.dir}/web-${module.name}"> - <fileset dir="${web.dir}"/> + <copy todir="${dist-src.dir}/web-${module.name}"> + <fileset dir="${web.dir}"/> </copy> - <copy todir="${dist-src.dir}/xdocs"> - <fileset dir="${xdocs.dir}"/> - </copy> + <copy todir="${dist-src.dir}/xdocs"> + <fileset dir="${xdocs.dir}"/> + </copy> </target> <target name="dist-bin" depends="init,all,manual-html,manual-pdf" description="Prepares all binary distributables"> |
From: <jbo...@li...> - 2005-08-24 13:30:24
|
Author: aron.gombas Date: 2005-08-24 09:29:52 -0400 (Wed, 24 Aug 2005) New Revision: 941 Added: trunk/labs/kosmos/build/build.properties Modified: trunk/labs/kosmos/build/build.xml trunk/labs/kosmos/build/kosmos-project.properties trunk/labs/kosmos/xdocs/reference/reference-manual.xml Log: KOSMOS-3 fixed Added: trunk/labs/kosmos/build/build.properties =================================================================== --- trunk/labs/kosmos/build/build.properties 2005-08-24 13:24:52 UTC (rev 940) +++ trunk/labs/kosmos/build/build.properties 2005-08-24 13:29:52 UTC (rev 941) @@ -0,0 +1,3 @@ +docbook.dir=/java/docbook-xsl-1.69.1 +fop.dir=/java/fop-0.20.5 +saxon.dir=/java/saxonb-8.5 Modified: trunk/labs/kosmos/build/build.xml =================================================================== --- trunk/labs/kosmos/build/build.xml 2005-08-24 13:24:52 UTC (rev 940) +++ trunk/labs/kosmos/build/build.xml 2005-08-24 13:29:52 UTC (rev 941) @@ -10,13 +10,9 @@ <project basedir="." default="redeploy" name="Kosmos"> <description>Kosmos build-script template used by the module-dependent build-scripts</description> - <!-- external paths --> - <property name="docbook.dir" location="/Java/docbook-xsl-1.69.1"/> - <property name="fop.dir" location="/Java/fop-0.20.5"/> - <property name="saxon.dir" location="/Java/saxonb-8.5"/> - <!-- read basic properties --> <property environment="env"/> + <property file="build/build.properties"/> <property file="build/kosmos-project.properties"/> <property file="build/${module.name}-module.properties"/> <property name="module.name.short" value="${project.name.short}-${module.name}"/> @@ -33,7 +29,7 @@ <property name="war.name" value="${module.name.short}.war"/> <property name="container.dir" location="${env.JBOSS_HOME}/server/default/deploy/${war.name}"/> - <property name="dist.dir" location=".dist-${module.name}"/> + <property name="dist.root.dir" location=".dist-${module.name}"/> <property name="dist-bin.root.dir" location=".dist-bin-${module.name}"/> <property name="dist-bin.dir" location="${dist-bin.root.dir}/${module.name.full}"/> @@ -88,12 +84,12 @@ <target name="all" depends="clean,compile" description="Recompiles all Java source files"/> - <target name="undeploy" depends="init" description="Undeploys the portlet from the container"> + <target name="undeploy" depends="init" description="Undeploys the module from the container"> <!-- it doesn't stop the container! --> <delete dir="${container.dir}"/> </target> - <target name="deploy" depends="compile" description="Deploys the portlet to the container"> + <target name="deploy" depends="compile" description="Deploys the module to the container"> <mkdir dir="${container.dir}"/> <!-- copy container-independent resources --> <copy todir="${container.dir}"> @@ -106,7 +102,7 @@ <!-- it doesn't restart the container! --> </target> - <target name="redeploy" depends="undeploy,deploy" description="Redeploys the portlet to the container"/> + <target name="redeploy" depends="undeploy,deploy" description="Redeploys the module to the container"/> <target name="javadocs" depends="init" description="Generates the javadocs"> <javadoc destdir="${dist-src.docs.api.dir}" author="true" version="true" use="true" windowtitle="${project.name} API"> @@ -182,12 +178,12 @@ </target> <target name="dist" depends="dist-src,dist-bin" description="Packs all distributables"> - <mkdir dir="${dist.dir}"/> - <!-- pack --> - <zip file="${dist.dir}/${module.name.full}-src.zip" basedir="${dist-src.root.dir}"/> - <tar destfile="${dist.dir}/${module.name.full}-src.tar.gz" basedir="${dist-src.root.dir}" compression="gzip" longfile="gnu"/> + <mkdir dir="${dist.root.dir}"/> <!-- pack --> - <zip file="${dist.dir}/${module.name.full}.zip" basedir="${dist-bin.root.dir}"/> - <tar destfile="${dist.dir}/${module.name.full}.tar.gz" basedir="${dist-bin.root.dir}" compression="gzip" longfile="gnu"/> + <zip file="${dist.root.dir}/${module.name.full}-src.zip" basedir="${dist-src.root.dir}"/> + <tar destfile="${dist.root.dir}/${module.name.full}-src.tar.gz" basedir="${dist-src.root.dir}" compression="gzip" longfile="gnu"/> + <!-- pack --> + <zip file="${dist.root.dir}/${module.name.full}.zip" basedir="${dist-bin.root.dir}"/> + <tar destfile="${dist.root.dir}/${module.name.full}.tar.gz" basedir="${dist-bin.root.dir}" compression="gzip" longfile="gnu"/> </target> </project> Modified: trunk/labs/kosmos/build/kosmos-project.properties =================================================================== --- trunk/labs/kosmos/build/kosmos-project.properties 2005-08-24 13:24:52 UTC (rev 940) +++ trunk/labs/kosmos/build/kosmos-project.properties 2005-08-24 13:29:52 UTC (rev 941) @@ -1,3 +1,3 @@ project.name=Kosmos project.name.short=kosmos -project.version=0.1.0RC2 +project.version=0.1.0RC3 Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml =================================================================== --- trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-08-24 13:24:52 UTC (rev 940) +++ trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-08-24 13:29:52 UTC (rev 941) @@ -4,6 +4,8 @@ <title>Kosmos Reference Manual</title> + <subtitle>Komposite Open Source Monitoring Suite</subtitle> + <subtitle>For the Kosmos 0.1.x branch</subtitle> <bookinfo> @@ -98,7 +100,7 @@ our primary information resource. Come and visit us regularly.</para> - <para>You reach me in email at the following address: <email>aron + <para>You can reach me in email at the following address: <email>aron dot gombas at midori dot hu</email>.</para> <para>Aron Gombas</para> @@ -245,12 +247,6 @@ <listitem> - <para>Axis: used to access remote SOAP services.</para> - - </listitem> - - <listitem> - <para>Displaytag: used for rendering the tables.</para> </listitem> @@ -451,7 +447,7 @@ <listitem> <para>It reports on the build labels, build results, - timestamps and unit test results. Also you can get detailed + timestamps and unit test results. Also, you can get detailed information about the unit tests.</para> </listitem> @@ -1435,8 +1431,27 @@ build</filename> directory.</para> <para>The variable names are self-explanatory and all the targets are - well-documented in the appropriate script. For instance, - creating the server component distribution package is simply: + well-documented in the appropriate script: + <programlisting>Buildfile: build-portlet.xml +Kosmos Portlet Module build-script +Main targets: + + all Recompiles all Java source files + clean Cleans up temporary files created during previous builds + compile Compiles Java source files + deploy Deploys the module to the container + dist Packs all distributables + dist-bin Prepares all binary distributables + dist-src Prepares all source distributables + javadocs Generates the javadocs + manual-html Creates the manual in HTML format + manual-pdf Creates the manual in PDF format + redeploy Redeploys the module to the container + undeploy Undeploys the module from the container +Default target: redeploy</programlisting> + </para> + + <para>For instance, creating the server component distribution package is simply: <programlisting>ant -f build-server.xml dist</programlisting> Please study the scripts themselves for further details. </para> @@ -1450,13 +1465,11 @@ <para>There are two Ant targets for this purpose: <literal>manual-html</literal> and <literal>manual-pdf</literal>. The only detail you have to care about is setting the correct local - paths in <filename>build.xml</filename> for the following dependencies + paths in <filename>build.properties</filename> for the following dependencies that are not included in the Kosmos distribution package: - <programlisting><!-- External paths --> -<property name="docbook.dir" location="/Java/docbook-xsl-1.69.0"/> -<property name="fop.dir" location="/Java/fop-0.20.5"/> -<property name="saxon.dir" location="/Java/saxonb-8.5"/> - </programlisting> + <programlisting>docbook.dir=/java/docbook-xsl-1.69.1 +fop.dir=/java/fop-0.20.5 +saxon.dir=/java/saxonb-8.5</programlisting> </para> </section> |
From: <jbo...@li...> - 2005-08-24 13:25:18
|
Author: aron.gombas Date: 2005-08-24 09:24:52 -0400 (Wed, 24 Aug 2005) New Revision: 940 Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml Log: Case problems fixed Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-08-24 13:22:40 UTC (rev 939) +++ trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-08-24 13:24:52 UTC (rev 940) @@ -239,7 +239,7 @@ <supported-locale>hu</supported-locale> <resource-bundle>hu.midori.kosmos.portlet.sf.sfmonitoringportlet</resource-bundle> <portlet-info> - <title>Sourceforge Monitoring</title> + <title>SourceForge Monitoring</title> </portlet-info> </portlet> @@ -270,7 +270,7 @@ <supported-locale>hu</supported-locale> <resource-bundle>hu.midori.kosmos.portlet.sf.sfmonitoringportlet</resource-bundle> <portlet-info> - <title>Sourceforge Monitoring</title> + <title>SourceForge Monitoring</title> </portlet-info> </portlet> |
From: <jbo...@li...> - 2005-08-24 13:22:48
|
Author: aron.gombas Date: 2005-08-24 09:22:40 -0400 (Wed, 24 Aug 2005) New Revision: 939 Modified: trunk/labs/kosmos/xdocs/others/welcome.txt Log: Project welcome text written Modified: trunk/labs/kosmos/xdocs/others/welcome.txt =================================================================== --- trunk/labs/kosmos/xdocs/others/welcome.txt 2005-08-24 13:22:15 UTC (rev 938) +++ trunk/labs/kosmos/xdocs/others/welcome.txt 2005-08-24 13:22:40 UTC (rev 939) @@ -1,3 +1,13 @@ -Kosmos +Kosmos - Komposite Open Source Monitoring Suite +=============================================== -Visit: http://labs.jboss.com/projects/kosmos \ No newline at end of file +This software is distributed under the terms of the FSF Lesser Gnu +Public License. + +Visit for latest info: http://labs.jboss.com/projects/kosmos + +Bug reports: see Kosmos JIRA + +Free technical support: see Kosmos Forums + +Commercial support: http://www.midori.hu \ No newline at end of file |
From: <jbo...@li...> - 2005-08-24 13:22:26
|
Author: aron.gombas Date: 2005-08-24 09:22:15 -0400 (Wed, 24 Aug 2005) New Revision: 938 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/util/PortletUtils.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java Log: Logging was not used Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/util/PortletUtils.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/util/PortletUtils.java 2005-08-24 13:21:52 UTC (rev 937) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/portlet/util/PortletUtils.java 2005-08-24 13:22:15 UTC (rev 938) @@ -10,9 +10,6 @@ import java.util.List; import java.util.StringTokenizer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - /** * Utility methods for portlets. * @@ -20,8 +17,6 @@ * @version $Id$ */ public class PortletUtils { - private static Log log = LogFactory.getLog(PortletUtils.class); - /** This class should never be instantiated. */ protected PortletUtils() { } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java 2005-08-24 13:21:52 UTC (rev 937) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ChartUtils.java 2005-08-24 13:22:15 UTC (rev 938) @@ -18,8 +18,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; @@ -38,8 +36,6 @@ * @version $Id$ */ public class ChartUtils { - private static Log log = LogFactory.getLog(ChartUtils.class); - /** * Max number of items in clamped datasets. * @see #listToPieDataset(List<Map.Entry>, int) |
From: <jbo...@li...> - 2005-08-24 13:22:00
|
Author: aron.gombas Date: 2005-08-24 09:21:52 -0400 (Wed, 24 Aug 2005) New Revision: 937 Removed: trunk/labs/kosmos/web-server/WEB-INF/lib/axis.jar trunk/labs/kosmos/web-server/WEB-INF/lib/jaxrpc.jar trunk/labs/kosmos/web-server/WEB-INF/lib/jira-soapclient-1.2.jar Log: Unnecessary dependencies removed Deleted: trunk/labs/kosmos/web-server/WEB-INF/lib/axis.jar =================================================================== (Binary files differ) Deleted: trunk/labs/kosmos/web-server/WEB-INF/lib/jaxrpc.jar =================================================================== (Binary files differ) Deleted: trunk/labs/kosmos/web-server/WEB-INF/lib/jira-soapclient-1.2.jar =================================================================== (Binary files differ) |
Author: szimano Date: 2005-08-24 08:40:41 -0400 (Wed, 24 Aug 2005) New Revision: 936 Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: http://domain/wiki/Page access + small chenges Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-23 20:18:53 UTC (rev 935) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-24 12:40:41 UTC (rev 936) @@ -4,3 +4,5 @@ #htmlTranslatorURL = http://localhost:8080/ #extensions for images to be inlined, coma-separated imagePatterns = .png , .jpeg , .gif , .bmp +#wikiHome part of url. Leave it you use default portlet conifguration +wikiHome = index.html?ctrl:id=window.default.WikiPortletWindow&ctrl:type=action Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 20:18:53 UTC (rev 935) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-24 12:40:41 UTC (rev 936) @@ -213,12 +213,16 @@ if (rReq.getParameter("version") != null) { // show previous version of page + System.out.println("Getting page " + wikiPage + " at version " + rReq.getParameter("version")); pageToShow = wikiEngine.getByName(wikiPage, null, Integer .valueOf(rReq.getParameter("version"))); - rReq.setAttribute("showedVersion", Integer.valueOf(rReq + + if (pageToShow.getLastVersion() != pageToShow.getVersion()) { + rReq.setAttribute("showedVersion", Integer.valueOf(rReq .getParameter("version"))); + } } else { pageToShow = wikiEngine.getByName(wikiPage, null); } @@ -286,8 +290,11 @@ + rReq.getParameter("version")); pageToShow = wikiEngine.getByName(wikiPage, wikiContext, Integer.valueOf(rReq.getParameter("version"))); - rReq.setAttribute("showedVersion", Integer.valueOf(rReq + + if (pageToShow.getLastVersion() != pageToShow.getVersion()) { + rReq.setAttribute("showedVersion", Integer.valueOf(rReq .getParameter("version"))); + } } else { pageToShow = wikiEngine.getByName(wikiPage, wikiContext); } @@ -312,7 +319,7 @@ rReq .setAttribute( "wikiName", - "<img src=\"/file-access/default/members/jbosswiki/images/JBossWikiLogoMedium.png\" width=\"100\" />"); + "<img src=\"/file-access/default/members/jbosswiki/images/JBossWikiLogoMedium.png\" width=\"100\" border=\"0\" />"); rReq.setAttribute("wikiContent", pageToShow.getContent()); @@ -324,6 +331,8 @@ rReq.setAttribute("logedIn", (rReq.getUser() != null) ? "true" : "false"); + + rReq.setAttribute("defaultPage", defaultPage); rRes.setTitle("Wiki"); if (javax.portlet.WindowState.NORMAL.equals(rReq.getWindowState()) Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 20:18:53 UTC (rev 935) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-24 12:40:41 UTC (rev 936) @@ -22,19 +22,21 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.jboss.wiki.FileDataSource; +import org.jboss.wiki.WikiPlugin; // import org.jboss.forge.common.content.ContentManager; // import org.jboss.forge.common.ForgeHelper; /** - * A filter that enables to download files form the jspwiki structure + * A filter that enables to download files form the jspwiki structure + + * redirects to pages by typing http://domain/wiki/Page * * @author tomek */ - public class WikiFileAccessFilter implements Filter { /** * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a @@ -44,6 +46,8 @@ private String attachementsPath; + private String host; + /* * private ForgeHelper forgeHelper; private ContentManager contentManager; */ @@ -62,13 +66,21 @@ try { props.load(FileDataSource.class .getResourceAsStream("filedatasource.properties")); + + // get the path to attachment property + attachementsPath = props.getProperty("pathToAttachements"); + + props.load(WikiPlugin.class + .getResourceAsStream("wikiPlugins.properties")); + + // get the host + host = props.getProperty("htmlTranslatorURL") + "portal/" + + props.getProperty("wikiHome"); + } catch (IOException e) { System.err.println(e); } - // get the apropriate property - attachementsPath = props.getProperty("pathToAttachements"); - System.out.println("[WikiFileAccess]Loaded attachements path: " + attachementsPath); } @@ -78,69 +90,81 @@ if (request instanceof HttpServletRequest) { HttpServletRequest httpRequest = (HttpServletRequest) request; + HttpServletResponse httpResponse = (HttpServletResponse) response; String requestURI = httpRequest.getRequestURI(); // Parse URI to get filename and page name String[] tokens = requestURI.split("[/]"); - // get fileName of attachement and page which is connected to - String fileName = tokens[tokens.length - 1]; - String pageName = tokens[tokens.length - 2]; + System.out.println("length " + tokens.length); - System.out.println("[WikiFileAccess]Getting file: " + fileName - + " of page: " + pageName); + if (tokens.length == 3) { + // show page + System.out.println("redirecting: " + host + "&page=" + + tokens[tokens.length - 1]); - Properties props = new Properties(); + httpResponse.sendRedirect(host + "&page=" + + tokens[tokens.length - 1]); + } else { + // get fileName of attachement and page which is connected to + String fileName = tokens[tokens.length - 1]; + String pageName = tokens[tokens.length - 2]; - try { - props.load(new FileInputStream(new File(attachementsPath + "/" - + pageName + "-att/" + fileName - + "-dir/attachment.properties"))); - } catch (IOException e) { - System.err.println(e); - } + System.out.println("[WikiFileAccess]Getting file: " + fileName + + " of page: " + pageName); - // looking for the newst version - int version = 1; + Properties props = new Properties(); - while (props.getProperty((version + 1) + ".author") != null) { - version++; - } + try { + props.load(new FileInputStream(new File(attachementsPath + + "/" + pageName + "-att/" + fileName + + "-dir/attachment.properties"))); + } catch (IOException e) { + System.err.println(e); + } - tokens = fileName.split("\\."); + // looking for the newst version + int version = 1; - File file = new File( - attachementsPath - + "/" - + pageName - + "-att/" - + fileName - + "-dir/" - + version - + "." - + ((fileName.indexOf(".") != -1) ? tokens[tokens.length - 1] - : "bin")); + while (props.getProperty((version + 1) + ".author") != null) { + version++; + } - FileInputStream fileIS = new FileInputStream(file); + tokens = fileName.split("\\."); - ServletOutputStream os = response.getOutputStream(); + File file = new File( + attachementsPath + + "/" + + pageName + + "-att/" + + fileName + + "-dir/" + + version + + "." + + ((fileName.indexOf(".") != -1) ? tokens[tokens.length - 1] + : "bin")); - response.setContentType(mimeTypes.getContentType(file)); - response.setContentLength((int) file.length()); + FileInputStream fileIS = new FileInputStream(file); - // Transferring the bytes - try { - byte[] buffer = new byte[BUF_SIZE]; - int read; - while ((read = fileIS.read(buffer)) != -1) - os.write(buffer, 0, read); - } catch (Exception e2) { - // Nothing that we can really do. Just send an incomplete - // file. - } finally { - os.close(); - fileIS.close(); + ServletOutputStream os = response.getOutputStream(); + + response.setContentType(mimeTypes.getContentType(file)); + response.setContentLength((int) file.length()); + + // Transferring the bytes + try { + byte[] buffer = new byte[BUF_SIZE]; + int read; + while ((read = fileIS.read(buffer)) != -1) + os.write(buffer, 0, read); + } catch (Exception e2) { + // Nothing that we can really do. Just send an incomplete + // file. + } finally { + os.close(); + fileIS.close(); + } } } else { Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-23 20:18:53 UTC (rev 935) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-24 12:40:41 UTC (rev 936) @@ -12,7 +12,7 @@ /** * @author <a href="mailto:ral...@jb...">Rali Genova </a> * - * + * */ import java.io.*; import java.util.regex.*; @@ -27,960 +27,933 @@ public class HTMLTranslator extends WikiPlugin { - /* URL components, later to be configurable */ - private String portalHome = ""; + /* URL components, later to be configurable */ + private String portalHome = ""; - private String wikiHome = "index.html?ctrl:id=window.default.WikiPortletWindow"; + private String wikiHome = ""; - private String actionType = "&ctrl:type="; + // private String actionType = "&ctrl:type="; - private String page = "&page="; + private String page = "&page="; - private String mediaPatterns; - private String imagePath; - - private String[] mediaFormats = { "*.png", "*.jpeg", "*.gif" }; - /* formatting variables */ + private String mediaPatterns; - private boolean m_allowHTML = false; + private String imagePath; - private boolean m_isbold = false; + private String[] mediaFormats = { "*.png", "*.jpeg", "*.gif" }; - private boolean m_isitalic = false; + /* formatting variables */ - private boolean m_isTypedText = false; + private boolean m_allowHTML = false; - private boolean m_istable = false; + private boolean m_isbold = false; - private boolean m_isPre = false; + private boolean m_isitalic = false; - private boolean m_isdefinition = false; + private boolean m_isTypedText = false; - private int m_listlevel = 0; + private boolean m_istable = false; - private int m_numlistlevel = 0; - - private boolean m_camelCaseLinks = true; //camelCase enabled + private boolean m_isPre = false; - /** Tag that gets closed at EOL. */ - private String m_closeTag = null; + private boolean m_isdefinition = false; - /** Allow this many characters to be pushed back in the stream. */ - private static final int PUSHBACK_BUFFER_SIZE = 8; - /** - * These characters constitute word separators when trying to find CamelCase - * links. - */ - private static final String WORD_SEPARATORS = ",.|:;+=&"; + private int m_listlevel = 0; - private PushbackReader m_in; - - //stores the name of the wiki page we are currently processing - private String pageName = ""; + private int m_numlistlevel = 0; - public HTMLTranslator() { + private boolean m_camelCaseLinks = true; // camelCase enabled - } + /** Tag that gets closed at EOL. */ + private String m_closeTag = null; - /** - * Push back any character to the current input. Does not push back a read - * EOF, though. - * - * @author Janne Jalkanen - */ - private void pushBack(int c) throws IOException { - if (c != -1) { - m_in.unread(c); - } - } + /** Allow this many characters to be pushed back in the stream. */ + private static final int PUSHBACK_BUFFER_SIZE = 8; - /** - * Wiki to HTML transformation method, plain URIs transformation not - * implemented - * - * @param page - * The String representation of a wiki page's content - * @return The final transformed into HTML string - * @author Janne Jalkanen - * @author Rali Genova - */ - public String parseLinks(String page) throws IOException { - m_in = new PushbackReader(new StringReader(page), PUSHBACK_BUFFER_SIZE); - StringBuffer buf = new StringBuffer(); - StringBuffer word = null; - int previousCh = -2; - int start = 0; - boolean quitReading = false; - boolean newLine = true; // FIXME: not true if reading starts in middle - // of buffer + /** + * These characters constitute word separators when trying to find CamelCase + * links. + */ + private static final String WORD_SEPARATORS = ",.|:;+=&"; - while (!quitReading) { - int ch = nextToken(); - String s = null; - - //begin of HTML transformation - if (m_isPre) { - if (ch == '}') { - buf.append(handleClosebrace()); - } else if (ch == '<') { - buf.append("<"); - } else if (ch == '>') { - buf.append(">"); - } else if (ch == -1) { - quitReading = true; - } else { - buf.append((char) ch); - } + private PushbackReader m_in; - continue; - } - // - // CamelCase detection, a non-trivial endeavour. - // We keep track of all white-space separated entities, which we - // hereby refer to as "words". We then check for an existence - // of a CamelCase format text string inside the "word", and - // if one exists, we replace it with a proper link. - // - - if( m_camelCaseLinks ) - { - // Quick parse of start of a word boundary. + // stores the name of the wiki page we are currently processing + private String pageName = ""; - if( word == null && - (Character.isWhitespace( (char)previousCh ) || - WORD_SEPARATORS.indexOf( (char)previousCh ) != -1 || - newLine ) && - !Character.isWhitespace( (char) ch ) ) - { - word = new StringBuffer(); - } + public HTMLTranslator() { - // Are we currently tracking a word? - if( word != null ) - { - // - // Check for the end of the word. - // + } - if( Character.isWhitespace( (char)ch ) || - ch == -1 || - WORD_SEPARATORS.indexOf( (char) ch ) != -1 ) - { - String potentialLink = word.toString(); + /** + * Push back any character to the current input. Does not push back a read + * EOF, though. + * + * @author Janne Jalkanen + */ + private void pushBack(int c) throws IOException { + if (c != -1) { + m_in.unread(c); + } + } - String camelCase = parseCamelCase(potentialLink); + /** + * Wiki to HTML transformation method, plain URIs transformation not + * implemented + * + * @param page + * The String representation of a wiki page's content + * @return The final transformed into HTML string + * @author Janne Jalkanen + * @author Rali Genova + */ + public String parseLinks(String page) throws IOException { + m_in = new PushbackReader(new StringReader(page), PUSHBACK_BUFFER_SIZE); + StringBuffer buf = new StringBuffer(); + StringBuffer word = null; + int previousCh = -2; + int start = 0; + boolean quitReading = false; + boolean newLine = true; // FIXME: not true if reading starts in middle + // of buffer - if( camelCase != null ) - { - start = buf.toString().lastIndexOf( camelCase ); - buf.replace(start, - start+camelCase.length(), - handleHyperlinks(camelCase) ); - } + while (!quitReading) { + int ch = nextToken(); + String s = null; - // We've ended a word boundary, so time to reset. - word = null; - } - else - { - // This should only be appending letters and digits. - word.append( (char)ch ); - } // if end of word - } // if word's not null + // begin of HTML transformation + if (m_isPre) { + if (ch == '}') { + buf.append(handleClosebrace()); + } else if (ch == '<') { + buf.append("<"); + } else if (ch == '>') { + buf.append(">"); + } else if (ch == -1) { + quitReading = true; + } else { + buf.append((char) ch); + } - // Always set the previous character to test for word starts. - previousCh = ch; - - } // if m_camelCaseLinks - // - // Check if any lists need closing down. - // + continue; + } + // + // CamelCase detection, a non-trivial endeavour. + // We keep track of all white-space separated entities, which we + // hereby refer to as "words". We then check for an existence + // of a CamelCase format text string inside the "word", and + // if one exists, we replace it with a proper link. + // - if (newLine && ch != '*' && ch != ' ' && m_listlevel > 0) { - buf.append("</LI>\n"); - for (; m_listlevel > 0; m_listlevel--) { - buf.append("</UL>\n"); - } - } + if (m_camelCaseLinks) { + // Quick parse of start of a word boundary. - if (newLine && ch != '#' && ch != ' ' && m_numlistlevel > 0) { - buf.append("</LI>\n"); - for (; m_numlistlevel > 0; m_numlistlevel--) { - buf.append("</OL>\n"); - } - } + if (word == null + && (Character.isWhitespace((char) previousCh) + || WORD_SEPARATORS.indexOf((char) previousCh) != -1 || newLine) + && !Character.isWhitespace((char) ch)) { + word = new StringBuffer(); + } - if (newLine && ch != '|' && m_istable) { - buf.append("</TABLE>\n"); - m_istable = false; - m_closeTag = null; - } + // Are we currently tracking a word? + if (word != null) { + // + // Check for the end of the word. + // - switch (ch) { - case '\r': - // DOS linefeeds we forget - s = null; - break; + if (Character.isWhitespace((char) ch) || ch == -1 + || WORD_SEPARATORS.indexOf((char) ch) != -1) { + String potentialLink = word.toString(); - case '\n': - // - // Close things like headings, etc. - // - if (m_closeTag != null) { - buf.append(m_closeTag); - m_closeTag = null; - } + String camelCase = parseCamelCase(potentialLink); - m_isdefinition = false; + if (camelCase != null) { + start = buf.toString().lastIndexOf(camelCase); + buf.replace(start, start + camelCase.length(), + handleHyperlinks(camelCase)); + } - if (newLine) { - // Paragraph change. + // We've ended a word boundary, so time to reset. + word = null; + } else { + // This should only be appending letters and digits. + word.append((char) ch); + } // if end of word + } // if word's not null - buf.append("<P>\n"); - } else { - buf.append("\n"); - newLine = true; - } - /* - * wiki syntax handling, later to be refactored so multiple wiki - * syntax is supported - */ + // Always set the previous character to test for word starts. + previousCh = ch; - break; - case '\\': - s = handleBackslash(); - break; + } // if m_camelCaseLinks + // + // Check if any lists need closing down. + // - case '_': - s = handleUnderscore(); - break; + if (newLine && ch != '*' && ch != ' ' && m_listlevel > 0) { + buf.append("</LI>\n"); + for (; m_listlevel > 0; m_listlevel--) { + buf.append("</UL>\n"); + } + } - case '\'': - s = handleApostrophe(); - break; + if (newLine && ch != '#' && ch != ' ' && m_numlistlevel > 0) { + buf.append("</LI>\n"); + for (; m_numlistlevel > 0; m_numlistlevel--) { + buf.append("</OL>\n"); + } + } - case '{': - s = handleOpenbrace(); - break; + if (newLine && ch != '|' && m_istable) { + buf.append("</TABLE>\n"); + m_istable = false; + m_closeTag = null; + } - case '}': - s = handleClosebrace(); - break; + switch (ch) { + case '\r': + // DOS linefeeds we forget + s = null; + break; - case '-': - s = handleDash(); - break; + case '\n': + // + // Close things like headings, etc. + // + if (m_closeTag != null) { + buf.append(m_closeTag); + m_closeTag = null; + } - case '!': - if (newLine) { - s = handleHeading(); - } else { - s = "!"; - } - break; + m_isdefinition = false; - case ';': - if (newLine) { - s = handleDefinitionList(); - } else { - s = ";"; - } - break; + if (newLine) { + // Paragraph change. - case ':': - if (m_isdefinition) { - s = "</DT><DD>"; - m_isdefinition = false; - } else { - s = ":"; - } - break; + buf.append("<P>\n"); + } else { + buf.append("\n"); + newLine = true; + } + /* + * wiki syntax handling, later to be refactored so multiple wiki + * syntax is supported + */ - case '[': - s = handleOpenbracket(); - break; + break; + case '\\': + s = handleBackslash(); + break; - case '*': - if (newLine) { - s = handleUnorderedList(); - } else { - s = "*"; - } - break; + case '_': + s = handleUnderscore(); + break; - case '#': - if (newLine) { - s = handleOrderedList(); - } else { - s = "#"; - } - break; + case '\'': + s = handleApostrophe(); + break; - case '|': - s = handleBar(newLine); - break; + case '{': + s = handleOpenbrace(); + break; - case '<': - s = m_allowHTML ? "<" : "<"; - break; + case '}': + s = handleClosebrace(); + break; - case '>': - s = m_allowHTML ? ">" : ">"; - break; + case '-': + s = handleDash(); + break; - case '\"': - s = m_allowHTML ? "\"" : """; - break; - - case '~': - s = handleTilde(); - break; - case -1: - quitReading = true; - break; + case '!': + if (newLine) { + s = handleHeading(); + } else { + s = "!"; + } + break; - default: - buf.append((char) ch); - newLine = false; - break; - } - if (s != null) { - buf.append(s); + case ';': + if (newLine) { + s = handleDefinitionList(); + } else { + s = ";"; + } + break; - newLine = false; - } + case ':': + if (m_isdefinition) { + s = "</DT><DD>"; + m_isdefinition = false; + } else { + s = ":"; + } + break; - } - - - return buf.toString(); - } - /** - * @param link - - * potential camel case link to be tested - * @return the string itself if not a camel case, and a proper link - * otherwise - * @author Rali Genova - * @author Janne Jalkanen - */ - public String parseCamelCase(String link) { - String camelCasepattern = "^([^\\p{Alnum}]*|\\~)([\\p{Upper}]+[\\p{Lower}]+[\\p{Upper}]+[\\p{Alnum}]*)[^\\p{Alnum}]*$"; - Pattern camelCase = Pattern.compile(camelCasepattern); - Matcher camelMatch = camelCase.matcher(link); - if (camelMatch.matches()) { - String result = camelMatch.group(2); //get the camel case words - if (camelMatch.group(1) != null) - { - if ((camelMatch.group(1).equals("~")) - || (camelMatch.group(1).indexOf('[') != -1)) - { - return null; //this is camelCase escape or [...] link - } - } - return result; + case '[': + s = handleOpenbracket(); + break; - }//if match - return null; - } + case '*': + if (newLine) { + s = handleUnorderedList(); + } else { + s = "*"; + } + break; - /* a collection of all media formats allowed on wiki */ - private Collection getImagePatterns() { - ArrayList patt = new ArrayList(); - String imagepattern = mediaPatterns; - String[] elem = imagepattern.split(","); - for (int i = 0; i < elem.length; i++) { - patt.add(elem[i].trim()); - } + case '#': + if (newLine) { + s = handleOrderedList(); + } else { + s = "#"; + } + break; - return patt; - } - - private boolean checkImageLink(String text) { - ArrayList ptrns = (ArrayList)getImagePatterns(); - for(int i = 0; i< ptrns.size(); i++) - { - if(text.endsWith((String)ptrns.get(i))) - {return true;} - } - - return false; - } + case '|': + s = handleBar(newLine); + break; + case '<': + s = m_allowHTML ? "<" : "<"; + break; - /** - * Generic escape of next character or entity. - */ - private String handleTilde() throws IOException { - int ch = nextToken(); + case '>': + s = m_allowHTML ? ">" : ">"; + break; - if (ch == '|') - return "|"; + case '\"': + s = m_allowHTML ? "\"" : """; + break; - if (Character.isUpperCase((char) ch)) { - return String.valueOf((char) ch); - } + case '~': + s = handleTilde(); + break; + case -1: + quitReading = true; + break; - // No escape. - pushBack(ch); + default: + buf.append((char) ch); + newLine = false; + break; + } + if (s != null) { + buf.append(s); - return "~"; - } + newLine = false; + } - private String handleUnderscore() throws IOException { - int ch = nextToken(); - String res = "_"; + } - if (ch == '_') { - res = m_isbold ? "</B>" : "<B>"; - m_isbold = !m_isbold; - } else { - pushBack(ch); - } + return buf.toString(); + } - return res; - } + /** + * @param link - + * potential camel case link to be tested + * @return the string itself if not a camel case, and a proper link + * otherwise + * @author Rali Genova + * @author Janne Jalkanen + */ + public String parseCamelCase(String link) { + String camelCasepattern = "^([^\\p{Alnum}]*|\\~)([\\p{Upper}]+[\\p{Lower}]+[\\p{Upper}]+[\\p{Alnum}]*)[^\\p{Alnum}]*$"; + Pattern camelCase = Pattern.compile(camelCasepattern); + Matcher camelMatch = camelCase.matcher(link); + if (camelMatch.matches()) { + String result = camelMatch.group(2); // get the camel case words + if (camelMatch.group(1) != null) { + if ((camelMatch.group(1).equals("~")) + || (camelMatch.group(1).indexOf('[') != -1)) { + return null; // this is camelCase escape or [...] link + } + } + return result; - /** - * For example: italics. - */ - private String handleApostrophe() throws IOException { - int ch = nextToken(); - String res = "'"; + }// if match + return null; + } - if (ch == '\'') { - res = m_isitalic ? "</I>" : "<I>"; - m_isitalic = !m_isitalic; - } else { - m_in.unread(ch); - } + /* a collection of all media formats allowed on wiki */ + private Collection getImagePatterns() { + ArrayList patt = new ArrayList(); + String imagepattern = mediaPatterns; + String[] elem = imagepattern.split(","); + for (int i = 0; i < elem.length; i++) { + patt.add(elem[i].trim()); + } - return res; - } + return patt; + } - private String handleDash() throws IOException { - int ch = nextToken(); + private boolean checkImageLink(String text) { + ArrayList ptrns = (ArrayList) getImagePatterns(); + for (int i = 0; i < ptrns.size(); i++) { + if (text.endsWith((String) ptrns.get(i))) { + return true; + } + } - if (ch == '-') { - int ch2 = nextToken(); + return false; + } - if (ch2 == '-') { - int ch3 = nextToken(); + /** + * Generic escape of next character or entity. + */ + private String handleTilde() throws IOException { + int ch = nextToken(); - if (ch3 == '-') { - // Empty away all the rest of the dashes. - // Do not forget to return the first non-match back. - while ((ch = nextToken()) == '-') - ; + if (ch == '|') + return "|"; - pushBack(ch); - return "<HR />"; - } + if (Character.isUpperCase((char) ch)) { + return String.valueOf((char) ch); + } - pushBack(ch3); - } - pushBack(ch2); - } + // No escape. + pushBack(ch); - pushBack(ch); + return "~"; + } - return "-"; - } + private String handleUnderscore() throws IOException { + int ch = nextToken(); + String res = "_"; - private String handleHeading() throws IOException { - StringBuffer buf = new StringBuffer(); + if (ch == '_') { + res = m_isbold ? "</B>" : "<B>"; + m_isbold = !m_isbold; + } else { + pushBack(ch); + } - int ch = nextToken(); + return res; + } - if (ch == '!') { - int ch2 = nextToken(); + /** + * For example: italics. + */ + private String handleApostrophe() throws IOException { + int ch = nextToken(); + String res = "'"; - if (ch2 == '!') { - buf.append("<H2>"); - m_closeTag = "</H2>"; - } else { - buf.append("<H3>"); - m_closeTag = "</H3>"; - pushBack(ch2); - } - } else { - buf.append("<H4>"); - m_closeTag = "</H4>"; - pushBack(ch); - } + if (ch == '\'') { + res = m_isitalic ? "</I>" : "<I>"; + m_isitalic = !m_isitalic; + } else { + m_in.unread(ch); + } - return buf.toString(); - } + return res; + } - private String handleUnorderedList() throws IOException { - StringBuffer buf = new StringBuffer(); + private String handleDash() throws IOException { + int ch = nextToken(); - if (m_listlevel > 0) { - buf.append("</LI>\n"); - } + if (ch == '-') { + int ch2 = nextToken(); - int numBullets = countChars(m_in, '*') + 1; + if (ch2 == '-') { + int ch3 = nextToken(); - if (numBullets > m_listlevel) { - for (; m_listlevel < numBullets; m_listlevel++) - buf.append("<UL>\n"); - } else if (numBullets < m_listlevel) { - for (; m_listlevel > numBullets; m_listlevel--) - buf.append("</UL>\n"); - } + if (ch3 == '-') { + // Empty away all the rest of the dashes. + // Do not forget to return the first non-match back. + while ((ch = nextToken()) == '-') + ; - buf.append("<LI>"); + pushBack(ch); + return "<HR />"; + } - return buf.toString(); - } + pushBack(ch3); + } + pushBack(ch2); + } - private String handleOrderedList() throws IOException { - StringBuffer buf = new StringBuffer(); + pushBack(ch); - if (m_numlistlevel > 0) { - buf.append("</LI>\n"); - } + return "-"; + } - int numBullets = countChars(m_in, '#') + 1; + private String handleHeading() throws IOException { + StringBuffer buf = new StringBuffer(); - if (numBullets > m_numlistlevel) { - for (; m_numlistlevel < numBullets; m_numlistlevel++) - buf.append("<OL>\n"); - } else if (numBullets < m_numlistlevel) { - for (; m_numlistlevel > numBullets; m_numlistlevel--) - buf.append("</OL>\n"); - } + int ch = nextToken(); - buf.append("<LI>"); + if (ch == '!') { + int ch2 = nextToken(); - return buf.toString(); + if (ch2 == '!') { + buf.append("<H2>"); + m_closeTag = "</H2>"; + } else { + buf.append("<H3>"); + m_closeTag = "</H3>"; + pushBack(ch2); + } + } else { + buf.append("<H4>"); + m_closeTag = "</H4>"; + pushBack(ch); + } - } + return buf.toString(); + } - private int countChars(PushbackReader in, char c) throws IOException { - int count = 0; - int ch; + private String handleUnorderedList() throws IOException { + StringBuffer buf = new StringBuffer(); - while ((ch = in.read()) != -1) { - if ((char) ch == c) { - count++; - } else { - in.unread(ch); - break; - } - } + if (m_listlevel > 0) { + buf.append("</LI>\n"); + } - return count; - } + int numBullets = countChars(m_in, '*') + 1; - private String handleBar(boolean newLine) throws IOException { - StringBuffer sb = new StringBuffer(); + if (numBullets > m_listlevel) { + for (; m_listlevel < numBullets; m_listlevel++) + buf.append("<UL>\n"); + } else if (numBullets < m_listlevel) { + for (; m_listlevel > numBullets; m_listlevel--) + buf.append("</UL>\n"); + } - if (!m_istable && !newLine) { - return "|"; - } + buf.append("<LI>"); - if (newLine) { - if (!m_istable) { - sb.append("<TABLE CLASS=\"wikitable\" BORDER=\"1\">\n"); - m_istable = true; - } + return buf.toString(); + } - sb.append("<TR>"); - m_closeTag = "</TD></TR>"; - } + private String handleOrderedList() throws IOException { + StringBuffer buf = new StringBuffer(); - int ch = nextToken(); + if (m_numlistlevel > 0) { + buf.append("</LI>\n"); + } - if (ch == '|') { - if (!newLine) { - sb.append("</TH>"); - } - sb.append("<TH>"); - m_closeTag = "</TH></TR>"; - } else { - if (!newLine) { - sb.append("</TD>"); - } - sb.append("<TD>"); - pushBack(ch); - } + int numBullets = countChars(m_in, '#') + 1; - return sb.toString(); - } + if (numBullets > m_numlistlevel) { + for (; m_numlistlevel < numBullets; m_numlistlevel++) + buf.append("<OL>\n"); + } else if (numBullets < m_numlistlevel) { + for (; m_numlistlevel > numBullets; m_numlistlevel--) + buf.append("</OL>\n"); + } - private String handleDefinitionList() throws IOException { - if (!m_isdefinition) { - m_isdefinition = true; + buf.append("<LI>"); - m_closeTag = "</DD>\n</DL>"; + return buf.toString(); - return "<DL>\n<DT>"; - } + } - return ";"; - } + private int countChars(PushbackReader in, char c) throws IOException { + int count = 0; + int ch; - private String handleBackslash() throws IOException { - int ch = nextToken(); + while ((ch = in.read()) != -1) { + if ((char) ch == c) { + count++; + } else { + in.unread(ch); + break; + } + } - if (ch == '\\') { - int ch2 = nextToken(); + return count; + } - if (ch2 == '\\') { - return "<BR clear=\"all\" />"; - } + private String handleBar(boolean newLine) throws IOException { + StringBuffer sb = new StringBuffer(); - pushBack(ch2); + if (!m_istable && !newLine) { + return "|"; + } - return "<BR />"; - } + if (newLine) { + if (!m_istable) { + sb.append("<TABLE CLASS=\"wikitable\" BORDER=\"1\">\n"); + m_istable = true; + } - pushBack(ch); + sb.append("<TR>"); + m_closeTag = "</TD></TR>"; + } - return "\\"; - } + int ch = nextToken(); - private String handleOpenbracket() throws IOException { - StringBuffer sb = new StringBuffer(); - int ch; - boolean isPlugin = false; + if (ch == '|') { + if (!newLine) { + sb.append("</TH>"); + } + sb.append("<TH>"); + m_closeTag = "</TH></TR>"; + } else { + if (!newLine) { + sb.append("</TD>"); + } + sb.append("<TD>"); + pushBack(ch); + } - while ((ch = nextToken()) == '[') { - sb.append((char) ch); - } + return sb.toString(); + } - if (sb.length() > 0) { - return sb.toString();//not a link - } + private String handleDefinitionList() throws IOException { + if (!m_isdefinition) { + m_isdefinition = true; - // - // Find end of hyperlink - // - pushBack(ch); - ch = nextToken(); + m_closeTag = "</DD>\n</DL>"; - while (ch != -1) { - if (ch == ']')//&& (!isPlugin || sb.charAt( sb.length()-1 ) == '}' - // ) ) - { - break; - } + return "<DL>\n<DT>"; + } - sb.append((char) ch); + return ";"; + } - ch = nextToken(); - } + private String handleBackslash() throws IOException { + int ch = nextToken(); - if (ch == -1) { + if (ch == '\\') { + int ch2 = nextToken(); - return sb.toString(); - } + if (ch2 == '\\') { + return "<BR clear=\"all\" />"; + } - return handleHyperlinks(sb.toString()); - } + pushBack(ch2); - private String handleOpenbrace() throws IOException { - int ch = nextToken(); - String res = "{"; + return "<BR />"; + } - if (ch == '{') { - int ch2 = nextToken(); + pushBack(ch); - if (ch2 == '{') { - res = "<PRE>"; - m_isPre = true; - } else { - pushBack(ch2); + return "\\"; + } - res = "<TT>"; - m_isTypedText = true; - } - } else { - pushBack(ch); - } + private String handleOpenbracket() throws IOException { + StringBuffer sb = new StringBuffer(); + int ch; + boolean isPlugin = false; - return res; - } + while ((ch = nextToken()) == '[') { + sb.append((char) ch); + } - /** - * Handles both }} and }}} - */ - private String handleClosebrace() throws IOException { - String res = "}"; + if (sb.length() > 0) { + return sb.toString();// not a link + } - int ch2 = nextToken(); + // + // Find end of hyperlink + // + pushBack(ch); + ch = nextToken(); - if (ch2 == '}') { - int ch3 = nextToken(); + while (ch != -1) { + if (ch == ']')// && (!isPlugin || sb.charAt( sb.length()-1 ) == + // '}' + // ) ) + { + break; + } - if (ch3 == '}') { - if (m_isPre) { - m_isPre = false; - res = "</PRE>"; - } else { - res = "}}}"; - } - } else { - pushBack(ch3); + sb.append((char) ch); - if (!m_isPre) { - res = "</TT>"; - m_isTypedText = false; - } else { - pushBack(ch2); - } - } - } else { - pushBack(ch2); - } + ch = nextToken(); + } - return res; - } - - /** - * Returns true if the link is really command to insert a plugin. - * <P> - * Currently we just check if the link starts with "{INSERT", or just plain - * "{" but not "{$". - * - * @author Janne Jalkanen - * - * @param link - * Link text, i.e. the contents of text between []. - * @return True, if this link seems to be a command to insert a plugin here. - */ - public static boolean isPluginLink( String link ) - { - return link.startsWith("{INSERT") || - (link.startsWith("{") && !link.startsWith("{$")); - } + if (ch == -1) { - /** - * method to create links for external pages of Wiki pages - * - * @param string - * @return the HTML link representation of the wiki page/external link - * @author Rali Genova - */ -private String handleHyperlinks(String link) { - String result = ""; - String text = ""; - String wikiPage = ""; - - if(isPluginLink(link)) - { - return null; //we do not include plugin links for now - } - int border = link.indexOf('|'); - if (border != -1) //[text|link] case - { - text = link.substring(0, border); - link = link.substring(border + 1); - - - } - else //[link] case - { - text = link; - - - } - - //external link - if (isExternalLink(link)) - { - if(checkImageLink(link)) - { - result = "<img src=\""+link +"\"alt=\"" + text+"\">";//external - // image - } - else result = "<a href=\"" + link + "\"target=\"_blank\">" - + text + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; - } - //internal link - else - { - //check if a footnote - if(link.startsWith("#"))//footnote reference - { - //http://labs.jboss.com/JSPWiki/Wiki.jsp?page=TextFormattingRules#ref-TextFormattingRules-1 - result = "<a name=\"ref-" + pageName+"-"+link.substring(1)+"\">["+text+"]</A>"; - - } - else if (isNumber(link))//defines footnote - { - result = "<a href=\""+portalHome + wikiHome + actionType - + "action" + page + pageName+"#ref-"+ - pageName+"-"+ - link+"\">["+text+"]</A>"; - } - - //check if not an image link as well - else if(checkImageLink(link)) - { - result = "<img src=\""+ imagePath+"/" + pageName+"/" + link +"\" alt=\""+ text +"\">"; - - } - //check for attachments later on - else - { - wikiPage = cleanLink(link); - if(wikiEngine.pageExists(wikiPage)) - { - result = "<a href=\"" + portalHome + wikiHome + actionType - + "action" + page - + wikiPage + "\">" - + text - + "</a>"; - } - else - result = "<u>"+text+"</u>"+"<a href=\"" - + portalHome + wikiHome + actionType - + "action" + page - + wikiPage + "\">" - + "?" + "</a>"; - } - } + return sb.toString(); + } - + return handleHyperlinks(sb.toString()); + } - return result; - } - /** - * Figures out if a link is an off-site link. This recognizes the most - * common protocols by checking how it starts. (clears all white space in - * case the link starts with '\n' or [space] - * - * @author Janne Jalkanen - */ - private boolean isExternalLink(String link) { - link = link.trim(); - return link.startsWith("http:") || link.startsWith("ftp:") - || link.startsWith("https:") || link.startsWith("mailto:") - || link.startsWith("news:") || link.startsWith("file:"); - } + private String handleOpenbrace() throws IOException { + int ch = nextToken(); + String res = "{"; - private int nextToken() throws IOException { - return m_in.read(); - } + if (ch == '{') { + int ch2 = nextToken(); - /** - * Push back any character to the current input. Does not push back a read - * EOF, though. - */ + if (ch2 == '{') { + res = "<PRE>"; + m_isPre = true; + } else { + pushBack(ch2); - /** - * Cleans a Wiki name. - * <P>[ This is a link ] -> ThisIsALink - * - * @param link - * Link to be cleared. Null is safe, and causes this to return - * null. - * @return A cleaned link. - * - * @since 2.0 - * @author Janne Jalkanen - */ - public String cleanLink(String link) { - StringBuffer clean = new StringBuffer(); + res = "<TT>"; + m_isTypedText = true; + } + } else { + pushBack(ch); + } - if (link == null) - return null; + return res; + } - // - // Compress away all whitespace and capitalize - // all words in between. - // + /** + * Handles both }} and }}} + */ + private String handleClosebrace() throws IOException { + String res = "}"; - StringTokenizer st = new StringTokenizer(link, " -"); + int ch2 = nextToken(); - while (st.hasMoreTokens()) { - StringBuffer component = new StringBuffer(st.nextToken()); + if (ch2 == '}') { + int ch3 = nextToken(); - component.setCharAt(0, Character.toUpperCase(component.charAt(0))); + if (ch3 == '}') { + if (m_isPre) { + m_isPre = false; + res = "</PRE>"; + } else { + res = "}}}"; + } + } else { + pushBack(ch3); - // - // We must do this, because otherwise compiling on JDK 1.4 causes - // a downwards incompatibility to JDK 1.3. - // - clean.append(component.toString()); - } + if (!m_isPre) { + res = "</TT>"; + m_isTypedText = false; + } else { + pushBack(ch2); + } + } + } else { + pushBack(ch2); + } - // - // Remove non-alphanumeric characters that should not - // be put inside WikiNames. Note that all valid - // Unicode letters are considered okay for WikiNames. - // It is the problem of the WikiPageProvider to take - // care of actually storing that information. - // + return res; + } - for (int i = 0; i < clean.length(); i++) { - if (!(Character.isLetterOrDigit(clean.charAt(i)) - || clean.charAt(i) == '_' || clean.charAt(i) == '.')) { - clean.deleteCharAt(i); - --i; // We just shortened this buffer. - } - } + /** + * Returns true if the link is really command to insert a plugin. + * <P> + * Currently we just check if the link starts with "{INSERT", or just plain + * "{" but not "{$". + * + * @author Janne Jalkanen + * + * @param link + * Link text, i.e. the contents of text between []. + * @return True, if this link seems to be a command to insert a plugin here. + */ + public static boolean isPluginLink(String link) { + return link.startsWith("{INSERT") + || (link.startsWith("{") && !link.startsWith("{$")); + } - return clean.toString(); - } - - /** - * Returns true, if the argument contains a number, otherwise false. In a - * quick test this is roughly the same speed as Integer.parseInt() if the - * argument is a number, and roughly ten times the speed, if the argument is - * NOT a number. - */ + /** + * method to create links for external pages of Wiki pages + * + * @param string + * @return the HTML link representation of the wiki page/external link + * @author Rali Genova + */ + private String handleHyperlinks(String link) { + String result = ""; + String text = ""; + String wikiPage = ""; - private boolean isNumber( String s ) - { - if( s == null ) return false; + if (isPluginLink(link)) { + return null; // we do not include plugin links for now + } + int border = link.indexOf('|'); + if (border != -1) // [text|link] case + { + text = link.substring(0, border); + link = link.substring(border + 1); - if( s.length() > 1 && s.charAt(0) == '-' ) - s = s.substring(1); + } else // [link] case + { + text = link; - for( int i = 0; i < s.length(); i++ ) - { - if( !Character.isDigit(s.charAt(i)) ) - return false; - } + } - return true; - } + // external link + if (isExternalLink(link)) { + if (checkImageLink(link)) { + result = "<img src=\"" + link + "\"alt=\"" + text + "\">";// external + // image + } else + result = "<a href=\"" + + link + + "\"target=\"_blank\">" + + text + + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; + } + // internal link + else { + // check if a footnote + if (link.startsWith("#"))// footnote reference + { + // http://labs.jboss.com/JSPWiki/Wiki.jsp?page=TextFormattingRules#ref-TextFormattingRules-1 + result = "<a name=\"ref-" + pageName + "-" + link.substring(1) + + "\">[" + text + "]</A>"; - - //not sure what it is supposed to do but neccessary to compile - public void next() - {} + } else if (isNumber(link))// defines footnote + { + result = "<a href=\"" + portalHome + wikiHome + page + pageName + + "#ref-" + pageName + "-" + link + "\">[" + text + + "]</A>"; + } - public WikiPage process(final WikiPage wikiPage, WikiSession wikiSession) { - WikiPage newPage = null; - try { - newPage = (WikiPage) wikiPage.clone(); - } catch (CloneNotSupportedException cnse) { - System.out.println("cannot clone the page: " + cnse); - } + // check if not an image link as well + else if (checkImageLink(link)) { + result = "<img src=\"" + imagePath + "/" + pageName + "/" + + link + "\" alt=\"" + text + "\">"; - try { - pageName = newPage.getName(); - String newContent = parseLinks(newPage.getContent()); + } + // check for attachments later on + else { + wikiPage = cleanLink(link); + if (wikiEngine.pageExists(wikiPage)) { + result = "<a href=\"" + portalHome + wikiHome + page + + wikiPage + "\">" + text + "</a>"; + } else + result = "<u>" + text + "</u>" + "<a href=\"" + portalHome + + wikiHome + page + wikiPage + "\">" + "?" + "</a>"; + } + } - newPage.setPageContent(newContent); + return result; + } - return newPage; - } catch (IOException e) { - System.out.println(e); - newPage.setPageContent("error on page"); - } - return newPage; - } + /** + * Figures out if a link is an off-site link. This recognizes the most + * common protocols by checking how it starts. (clears all white space in + * case the link starts with '\n' or [space] + * + * @author Janne Jalkanen + */ + private boolean isExternalLink(String link) { + link = link.trim(); + return link.startsWith("http:") || link.startsWith("ftp:") + || link.startsWith("https:") || link.startsWith("mailto:") + || link.startsWith("news:") || link.startsWith("file:"); + } + private int nextToken() throws IOException { + return m_in.read(); + } + + /** + * Push back any character to the current input. Does not push back a read + * EOF, though. + */ + + /** + * Cleans a Wiki name. + * <P>[ This is a link ] -> ThisIsALink + * + * @param link + * Link to be cleared. Null is safe, and causes this to return + * null. + * @return A cleaned link. + * + * @since 2.0 + * @author Janne Jalkanen + */ + public String cleanLink(String link) { + StringBuffer clean = new StringBuffer(); + + if (link == null) + return null; + + // + // Compress away all whitespace and capitalize + // all words in between. + // + + StringTokenizer st = new StringTokenizer(link, " -"); + + while (st.hasMoreTokens()) { + StringBuffer component = new StringBuffer(st.nextToken()); + + component.setCharAt(0, Character.toUpperCase(component.charAt(0))); + + // + // We must do this, because otherwise compiling on JDK 1.4 causes + // a downwards incompatibility to JDK 1.3. + // + clean.append(component.toString()); + } + + // + // Remove non-alphanumeric characters that should not + // be put inside WikiNames. Note that all valid + // Unicode letters are considered okay for WikiNames. + // It is the problem of the WikiPageProvider to take + // care of actually storing that information. + // + + for (int i = 0; i < clean.length(); i++) { + if (!(Character.isLetterOrDigit(clean.charAt(i)) + || clean.charAt(i) == '_' || clean.charAt(i) == '.')) { + clean.deleteCharAt(i); + --i; // We just shortened this buffer. + } + } + + return clean.toString(); + } + + /** + * Returns true, if the argument contains a number, otherwise false. In a + * quick test this is roughly the same speed as Integer.parseInt() if the + * argument is a number, and roughly ten times the speed, if the argument is + * NOT a number. + */ + + private boolean isNumber(String s) { + if (s == null) + return false; + + if (s.length() > 1 && s.charAt(0) == '-') + s = s.substring(1); + + for (int i = 0; i < s.length(); i++) { + if (!Character.isDigit(s.charAt(i))) + return false; + } + + return true; + } + + // not sure what it is supposed to do but neccessary to compile + public void next() { + } + + public WikiPage process(final WikiPage wikiPage, WikiSession wikiSession) { + WikiPage newPage = null; + try { + newPage = (WikiPage) wikiPage.clone(); + } catch (CloneNotSupportedException cnse) { + System.out.println("cannot clone the page: " + cnse); + } + + try { + pageName = newPage.getName(); + String newContent = parseLinks(newPage.getContent()); + + newPage.setPageContent(newContent); + + return newPage; + } catch (IOException e) { + System.out.println(e); + newPage.setPageContent("error on page"); + } + return newPage; + } + @Override public void init() { - portalHome = getProperty("htmlTranslatorURL")+"portal/"; - mediaPatterns = getProperty("imagePatterns"); - imagePath = getProperty("htmlTranslatorURL")+"wiki"; - + portalHome = getProperty("htmlTranslatorURL") + "portal/"; + mediaPatterns = getProperty("imagePatterns"); + imagePath = getProperty("htmlTranslatorURL") + "wiki"; + wikiHome = getProperty("wikiHome"); } } \ No newline at end of file Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp 2005-08-23 20:18:53 UTC (rev 935) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp 2005-08-24 12:40:41 UTC (rev 936) @@ -18,13 +18,17 @@ String wikiContent = (String)request.getAttribute("wikiContent"); String wikiPage = (String)request.getAttribute("wikiPage"); String lockMsg = (String)request.getAttribute("lockMsg"); + String defaultPage = (String)request.getAttribute("defaultPage"); if (lockMsg == null) lockMsg = ""; %> -<h2><%=wikiName%>: <%=wikiPage%></h2> +<h2><a href="<%=actionURL%>&page=<%=defaultPage%>"><%=wikiName%></a>/ <%=wikiPage%> </h2> +<!-- +<br /> +<a href="<%=actionURL%>&page=<%=defaultPage%>"><%=defaultPage%></a><br />--> <hr /> <div style="color:#FF0000"><%=lockMsg%></div> @@ -33,7 +37,7 @@ <input type="hidden" name="editedPage" value="<%=wikiPage%>" /> <input type="hidden" name="page" value="<%=wikiPage%>" /> <input type="submit" value="Save" name="editAction" /> -<input type="submit" value="Preview" name="editAction" /> +<!--<input type="submit" value="Preview" name="editAction" />--> <input type="submit" value="Cancel" name="editAction" /> </form> Here's a short reminder on what elements you have at your disposal: Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-08-23 20:18:53 UTC (rev 935) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-08-24 12:40:41 UTC (rev 936) @@ -17,17 +17,21 @@ String wikiName = (String)request.getAttribute("wikiName"); //String wikiContent = (String)request.getAttribute("wikiContent"); String wikiPage = (String)request.getAttribute("wikiPage"); + String defaultPage = (String)request.getAttribute("defaultPage"); //java.util.Date editDate = (java.util.Date)request.getAttribute("editDate"); //org.jboss.wiki.Credentials author = (org.jboss.wiki.Credentials)request.getAttribute("author"); %> -<h2><%=wikiName%>/ <%=wikiPage%></h2> +<h2><a href="<%=actionURL%>&page=<%=defaultPage%>"><%=wikiName%></a>/ <%=wikiPage%> </h2> -<hr /> +<!--<hr /> +<a href="<%=actionURL%>&page=<%=defaultPage%>"><%=defaultPage%></a> <div class="wikiTrail">Your trail: <i>TODO</i></div> - +--> <hr /> +<h3>History of page: <a href="<%=actionURL%>&page=<%=wikiPage%>"><%=wikiPage%></a></h3> +<hr /> <table> <tr> @@ -70,4 +74,4 @@ </tr> </table> -<a href="<%=actionURL%>&page=<%=wikiPage%>">Back to <%=wikiPage%></a> + Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-... [truncated message content] |
From: <jbo...@li...> - 2005-08-23 20:18:59
|
Author: adamw Date: 2005-08-23 16:18:53 -0400 (Tue, 23 Aug 2005) New Revision: 935 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadsDescriptor.java Log: Download buttons Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadsDescriptor.java 2005-08-23 20:10:20 UTC (rev 934) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadsDescriptor.java 2005-08-23 20:18:53 UTC (rev 935) @@ -19,8 +19,11 @@ import org.apache.xerces.parsers.DOMParser; import org.jboss.forge.common.ForgeHelper; import org.jboss.forge.common.projects.XmlInputFactory.XmlNotFoundException; +import org.jboss.forge.common.projects.elements.BindingsHandlerIterSingleKey; import org.jboss.forge.common.projects.elements.ElementDescriptor; import org.jboss.forge.common.projects.elements.ElementsDescriptor; +import org.jboss.forge.common.projects.elements.ExtendedPropertiesMap; +import org.jboss.forge.common.projects.elements.OutsidePropertiesMap; import org.jboss.forge.common.projects.elements.PropertiesHandler; import org.jboss.forge.common.projects.elements.PropertiesHandlerDefault; import org.jboss.forge.common.projects.elements.PropertiesHandlerStack; @@ -182,7 +185,9 @@ filesDesc = new ElementsDescriptor(n, xht, "file", getFilesPropertiesHandler(isf, projectId, downloadPrefix, pathCategoryContext, - separator,componentDir)); + separator,componentDir), + getFilesExtendedPropertiesMap(), + new OutsidePropertiesMap()); } } } @@ -254,6 +259,31 @@ return stack; } + private ExtendedPropertiesMap getFilesExtendedPropertiesMap() { + ExtendedPropertiesMap epm = new ExtendedPropertiesMap(); + epm.addPropertySupport("button", + getButtonPropertiesHandler(), + new BindingsHandlerIterSingleKey("button", "buttons")); + return epm; + } + + private PropertiesHandler getButtonPropertiesHandler() { + return new PropertiesHandler() { + public void fillContextShallow(PropertiesMap properties, DelegateContext context) { + context.put("link", properties.get("id").getFirstValue()); + context.put("name", properties.get("name").getFirstValue()); + } + + public void fillContext(PropertiesMap properties, DelegateContext context) { + + } + + public void processNode(ElementDescriptor thisElement, Node node) { + + } + }; + } + private PropertiesHandler getFilesPropertiesHandler( final XmlInputFactory isf, final String projectId, final String downloadPrefix, final String pathCategoryContext, |
From: <jbo...@li...> - 2005-08-23 20:10:28
|
Author: szimano Date: 2005-08-23 16:10:20 -0400 (Tue, 23 Aug 2005) New Revision: 934 Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java Removed: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: misspels Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-23 19:26:34 UTC (rev 933) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-23 20:10:20 UTC (rev 934) @@ -17,8 +17,8 @@ <class>org.jboss.wiki.plugins.HTMLTranslator</class> </plugin> <plugin> - <name>attachementList</name> - <class>org.jboss.wiki.plugins.AttachementListPlugin</class> + <name>attachmentList</name> + <class>org.jboss.wiki.plugins.AttachmentListPlugin</class> </plugin> </wikiType> <wikiType> Deleted: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 19:26:34 UTC (rev 933) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 20:10:20 UTC (rev 934) @@ -1,61 +0,0 @@ -/************************************************** - * * - * JBoss Labs: Creating Professional Open Source * - * * - * Distributable under LGPL license. * - * See terms of license at gnu.org. * - * * - *************************************************/ - -package org.jboss.wiki.plugins; - -import java.util.Set; - -import org.jboss.wiki.WikiPage; -import org.jboss.wiki.WikiPlugin; -import org.jboss.wiki.WikiSession; - -public class AttachementListPlugin extends WikiPlugin { - - private String host = ""; - - @Override - public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { - WikiPage newPage = null; - - try { - newPage = (WikiPage) wikiPage.clone(); - } catch (CloneNotSupportedException cl) { - System.err.println(cl); - } - - Set<String> attachements = newPage.getAttachementsSet(); - - if (attachements != null) { - String newContent = newPage.getPageContent(); - - newContent += "\n<hr />\n<h3>Attachements:</h3>\n"; - - for (String s : attachements) { - String href = host+newPage.getName() + "/" + s; - newContent += "<a href='"+href+"'>"+href + "</a><br>\n"; - } - - newPage.setPageContent(newContent); - } - - return newPage; - } - - @Override - public void next() { - // TODO Auto-generated method stub - - } - - @Override - public void init() { - host = getProperty("htmlTranslatorURL")+"wiki/"; - } - -} Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-08-23 19:26:34 UTC (rev 933) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachmentListPlugin.java 2005-08-23 20:10:20 UTC (rev 934) @@ -0,0 +1,61 @@ +/************************************************** + * * + * JBoss Labs: Creating Professional Open Source * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************/ + +package org.jboss.wiki.plugins; + +import java.util.Set; + +import org.jboss.wiki.WikiPage; +import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; + +public class AttachmentListPlugin extends WikiPlugin { + + private String host = ""; + + @Override + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { + WikiPage newPage = null; + + try { + newPage = (WikiPage) wikiPage.clone(); + } catch (CloneNotSupportedException cl) { + System.err.println(cl); + } + + Set<String> attachements = newPage.getAttachementsSet(); + + if (attachements != null) { + String newContent = newPage.getPageContent(); + + newContent += "\n<hr />\n<h3>Attachments:</h3>\n"; + + for (String s : attachements) { + String href = host+newPage.getName() + "/" + s; + newContent += "<a href='"+href+"'>"+href + "</a><br>\n"; + } + + newPage.setPageContent(newContent); + } + + return newPage; + } + + @Override + public void next() { + // TODO Auto-generated method stub + + } + + @Override + public void init() { + host = getProperty("htmlTranslatorURL")+"wiki/"; + } + +} Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-23 19:26:34 UTC (rev 933) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-23 20:10:20 UTC (rev 934) @@ -25,8 +25,8 @@ if (logedIn.equals("true")) { - out.print("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"'><img src=\"/file-access/default/members/jbosswiki/images/editButton.png\"</img></a>"+ - "<a href=\""+actionURL+"&action=Attach\">Attach file...</a>"); + out.print("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"'><img alt=\"EDIT\" src=\"/file-access/default/members/jbosswiki/images/editButton.png\"</img></a>\n"+ + "<a href=\""+actionURL+"&action=Attach\"><img alt=\"ATTACH\" src=\"/file-access/default/members/jbosswiki/images/attachButton.png\"</img></a>"); } else { @@ -35,7 +35,7 @@ %> - <a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>"><img src="/file-access/default/members/jbosswiki/images/historyButton.png"</img></a> + <a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>"><img alt="HISTORY" src="/file-access/default/members/jbosswiki/images/historyButton.png"</img></a> <form method="post" action="<%=actionURL%>"> <input type="text" name="page" /> <input type="submit" value="GO" /> |
From: <jbo...@li...> - 2005-08-23 19:26:47
|
Author: ral...@jb... Date: 2005-08-23 15:26:34 -0400 (Tue, 23 Aug 2005) New Revision: 933 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java Log: footnotes update Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-23 19:05:16 UTC (rev 932) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-23 19:26:34 UTC (rev 933) @@ -804,8 +804,7 @@ if(link.startsWith("#"))//footnote reference { //http://labs.jboss.com/JSPWiki/Wiki.jsp?page=TextFormattingRules#ref-TextFormattingRules-1 - result = "<a name=\"" + portalHome + wikiHome + actionType - + "action" + page + pageName+"ref-" + pageName+"-"+link.substring(1)+"\">["+text+"]</A>"; + result = "<a name=\"ref-" + pageName+"-"+link.substring(1)+"\">["+text+"]</A>"; } else if (isNumber(link))//defines footnote |
From: <jbo...@li...> - 2005-08-23 19:05:28
|
Author: adamw Date: 2005-08-23 15:05:16 -0400 (Tue, 23 Aug 2005) New Revision: 932 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld Log: Attr rename Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java 2005-08-23 19:05:16 UTC (rev 932) @@ -15,27 +15,28 @@ public class WikiURLTag extends URLTag { private final static String WIKI_URL = "window.default.WikiPortletWindow&ctrl:type=action"; - private String project; + private String page; - public String getProject() { - return project; + public String getPage() { + return page; } - public void setProject(String project) { - this.project = project; + public void setPage(String page) { + this.page = page; } private String capitilizeFirstLetter(String value) { - return value.substring(0,1).toUpperCase()+ value.substring(1,value.length()); + return value.substring(0,1).toUpperCase() + + value.substring(1,value.length()); } public int doStartTag() throws JspException { - String projectName = project.equals(SELECTED_PROJECT) ? + String pageName = page.equals(SELECTED_PROJECT) ? pageContext.getRequest().getAttribute( - ProjectsHelper.PROJECT_ID).toString() : project; + ProjectsHelper.PROJECT_ID).toString() : page; return writeURL("/portal/index.html", "ctrl:id", - WIKI_URL+"&page="+capitilizeFirstLetter(projectName)+"&project="+ - projectName); + WIKI_URL+"&page="+capitilizeFirstLetter(pageName)+"&project="+ + pageName); } } Modified: trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:05:16 UTC (rev 932) @@ -46,7 +46,7 @@ <name>wikiURL</name> <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>project</name> + <name>page</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> Modified: trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:05:16 UTC (rev 932) @@ -46,7 +46,7 @@ <name>wikiURL</name> <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>project</name> + <name>page</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> Modified: trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:05:16 UTC (rev 932) @@ -46,7 +46,7 @@ <name>wikiURL</name> <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>project</name> + <name>page</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> Modified: trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:05:16 UTC (rev 932) @@ -46,7 +46,7 @@ <name>wikiURL</name> <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>project</name> + <name>page</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:05:16 UTC (rev 932) @@ -46,7 +46,7 @@ <name>wikiURL</name> <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>project</name> + <name>page</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> Modified: trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:00:23 UTC (rev 931) +++ trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld 2005-08-23 19:05:16 UTC (rev 932) @@ -46,7 +46,7 @@ <name>wikiURL</name> <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>project</name> + <name>page</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> |
From: <jbo...@li...> - 2005-08-23 19:00:28
|
Author: szimano Date: 2005-08-23 15:00:23 -0400 (Tue, 23 Aug 2005) New Revision: 931 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java Log: another misspel... sory for that Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 18:41:55 UTC (rev 930) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 19:00:23 UTC (rev 931) @@ -55,7 +55,7 @@ @Override public void init() { - host = getProperty("htmlTranslatorURL")+"wiki"; + host = getProperty("htmlTranslatorURL")+"wiki/"; } } |
Author: adamw Date: 2005-08-23 14:41:55 -0400 (Tue, 23 Aug 2005) New Revision: 930 Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java trunk/forge/portal-extensions/forge-file-access/src/etc/ trunk/forge/portal-extensions/forge-file-access/src/etc/mime-types.txt trunk/forge/portal-extensions/forge-portal-attr/ trunk/forge/portal-extensions/forge-portal-attr/maven.xml trunk/forge/portal-extensions/forge-portal-attr/project.xml trunk/forge/portal-extensions/forge-portal-attr/src/ trunk/forge/portal-extensions/forge-portal-attr/src/java/ trunk/forge/portal-extensions/forge-portal-attr/src/java/org/ trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/ trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/ trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/ trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java trunk/forge/portal-extensions/forge-portal-attr/to-copy/ trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/ trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/portal-server.war/ trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/ trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml Removed: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiParam.java Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/AbstractBlog.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/PageURLTag.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/ProjectURLTag.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/URLTag.java trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-file-access/project.xml trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld Log: Wiki tag, portal attributes - setting the "project" to be in session, corrected mime types for file downloading Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java 2005-08-23 18:41:55 UTC (rev 930) @@ -195,29 +195,36 @@ // First trying to read it from the URL (this works, if it is not a // render/ action request). String URL = request.getURL(); + String paramValue; if (URL != null) { - int paramStart = request.getURL().indexOf(paramName + "="); + int paramStart = request.getURL().indexOf("&" + paramName + "="); + if (paramStart == -1) + paramStart = request.getURL().indexOf("?" + paramName + "="); + if (paramStart != -1) { - String prjName; - // Skipping the <paramName>= - paramStart += paramName.length() + 1; + paramStart += paramName.length() + 2; int paramEnd = request.getURL().substring(paramStart).indexOf('&'); if (paramEnd == -1) - prjName = URL.substring(paramStart); + paramValue = URL.substring(paramStart); else - prjName = URL.substring(paramStart, paramStart + paramEnd); + paramValue = URL.substring(paramStart, paramStart + paramEnd); - return prjName; + return paramValue; } return null; } // If the paramter wasn't in the URL, trying to read it from the - // parameters - the paramter will be there, if it is a render/ - // action request. - return request.getParameters().get(paramName, null); + // parameters and attributes - the paramter will be there, if + // it is a render/action request or if this has been set by an + // external filter. + paramValue = request.getParameters().get(paramName, null); + if (paramValue == null) + paramValue = (String) request.getAttribute(paramName); + + return paramValue; } /** Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/AbstractBlog.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/AbstractBlog.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/AbstractBlog.java 2005-08-23 18:41:55 UTC (rev 930) @@ -126,6 +126,7 @@ // A string denoting the number of the first displayed entry String fromEntryString = forgeHelper.getRequestParameter(request, "from"); + if (fromEntryString == null) fromEntryString = "1"; Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/PageURLTag.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/PageURLTag.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/PageURLTag.java 2005-08-23 18:41:55 UTC (rev 930) @@ -25,6 +25,7 @@ public int doStartTag() throws JspException { return writeURL("/portal/index.html", "ctrl:id", "page."+ - pageContext.getRequest().getAttribute(ForgeHelper.PORTAL_NAME)+"."+page); + pageContext.getRequest().getAttribute(ForgeHelper.PORTAL_NAME)+ + "."+page+"&noproject=true"); } } Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/ProjectURLTag.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/ProjectURLTag.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/ProjectURLTag.java 2005-08-23 18:41:55 UTC (rev 930) @@ -14,8 +14,6 @@ import org.jboss.forge.common.projects.ProjectsHelper; public class ProjectURLTag extends URLTag { - protected final static String SELECTED_PROJECT = "_selected"; - private String project; private String page; Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/URLTag.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/URLTag.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/URLTag.java 2005-08-23 18:41:55 UTC (rev 930) @@ -16,6 +16,8 @@ import javax.servlet.jsp.tagext.BodyTagSupport; public abstract class URLTag extends BodyTagSupport { + protected final static String SELECTED_PROJECT = "_selected"; + protected String form; public String getForm() { Deleted: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiParam.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiParam.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiParam.java 2005-08-23 18:41:55 UTC (rev 930) @@ -1,50 +0,0 @@ -/***************************************** - * * - * JBoss Portal: The OpenSource Portal * - * * - * Distributable under LGPL license. * - * See terms of license at gnu.org. * - * * - *****************************************/ -package org.jboss.forge.common.taglib; - -import java.io.IOException; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.TagSupport; - -public class WikiParam extends TagSupport { - private String name; - private String value; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int doStartTag() { - return SKIP_BODY; - } - - public int doEndTag() throws JspException { - try { - if (value.length() > 1) - pageContext.getOut().write("&"+name+"="+value.substring(0,1).toUpperCase()+ value.substring(1,value.length())); - } catch (IOException e) { - throw new JspException(); - } - - return EVAL_PAGE; - } -} Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/WikiURLTag.java 2005-08-23 18:41:55 UTC (rev 930) @@ -0,0 +1,41 @@ +/***************************************** + * * + * JBoss Portal: The OpenSource Portal * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.forge.common.taglib; + +import javax.servlet.jsp.JspException; + +import org.jboss.forge.common.projects.ProjectsHelper; + +public class WikiURLTag extends URLTag { + private final static String WIKI_URL = "window.default.WikiPortletWindow&ctrl:type=action"; + + private String project; + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + + private String capitilizeFirstLetter(String value) { + return value.substring(0,1).toUpperCase()+ value.substring(1,value.length()); + } + + public int doStartTag() throws JspException { + String projectName = project.equals(SELECTED_PROJECT) ? + pageContext.getRequest().getAttribute( + ProjectsHelper.PROJECT_ID).toString() : project; + + return writeURL("/portal/index.html", "ctrl:id", + WIKI_URL+"&page="+capitilizeFirstLetter(projectName)+"&project="+ + projectName); + } +} Modified: trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:41:55 UTC (rev 930) @@ -43,18 +43,13 @@ </tag> <tag> - <name>wikiparam</name> - <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>name</name> + <name>project</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> </tag> <tag> Modified: trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:41:55 UTC (rev 930) @@ -43,18 +43,13 @@ </tag> <tag> - <name>wikiparam</name> - <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>name</name> + <name>project</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> </tag> <tag> Modified: trunk/forge/portal-extensions/forge-file-access/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-file-access/project.xml 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-file-access/project.xml 2005-08-23 18:41:55 UTC (rev 930) @@ -51,4 +51,13 @@ <jar>activation.jar</jar> </dependency> </dependencies> + + <build> + <resources> + <resource> + <directory>src/etc/</directory> + <include>**/*</include> + </resource> + </resources> + </build> </project> Added: trunk/forge/portal-extensions/forge-file-access/src/etc/mime-types.txt =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/etc/mime-types.txt 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-file-access/src/etc/mime-types.txt 2005-08-23 18:41:55 UTC (rev 930) @@ -0,0 +1,714 @@ +############################################################################### +# +# MIME-TYPES and the extensions that represent them +# +# This file is part of the "mime-support" package. Please send email (not a +# bug report) to mim...@pa... if you would like new types +# and/or extensions to be added. +# +# Users can add their own types if they wish by creating a ".mime.types" +# file in their home directory. Definitions included there will take +# precedence over those listed here. +# +# Note: Compression schemes like "gzip", "bzip", and "compress" are not +# actually "mime-types". They are "encodings" and hence must _not_ have +# entries in this file to map their extensions. The "mime-type" of an +# encoded file refers to the type of data that has been encoded, not the +# type of the encoding. +# +############################################################################### + + +application/activemessage +application/andrew-inset ez +application/applefile +application/atomicmail +application/batch-SMTP +application/beep+xml +application/cals-1840 +application/commonground +application/cu-seeme cu +application/cybercash +application/dca-rft +application/dec-dx +application/docbook+xml +application/dsptype tsp +application/dvcs +application/edi-consent +application/edi-x12 +application/edifact +application/eshop +application/font-tdpfr +application/futuresplash spl +application/ghostview +application/hta hta +application/http +application/hyperstudio +application/iges +application/index +application/index.cmd +application/index.obj +application/index.response +application/index.vnd +application/iotp +application/ipp +application/isup +application/mac-binhex40 hqx +application/mac-compactpro cpt +application/macwriteii +application/marc +application/mathematica nb +application/mathematica-old +application/msaccess mdb +application/msword doc dot +application/news-message-id +application/news-transmission +application/ocsp-request +application/ocsp-response +application/octet-stream bin +application/oda oda +application/ogg ogg +application/parityfec +application/pdf pdf +application/pgp-encrypted +application/pgp-keys key +application/pgp-signature pgp +application/pics-rules prf +application/pkcs10 +application/pkcs7-mime +application/pkcs7-signature +application/pkix-cert +application/pkix-crl +application/pkixcmp +application/postscript ps ai eps +application/prs.alvestrand.titrax-sheet +application/prs.cww +application/prs.nprend +application/qsig +application/rar rar +application/rdf+xml rdf +application/remote-printing +application/riscos +application/rss+xml rss +application/rtf +application/sdp +application/set-payment +application/set-payment-initiation +application/set-registration +application/set-registration-initiation +application/sgml +application/sgml-open-catalog +application/sieve +application/slate +application/smil smi smil +application/timestamp-query +application/timestamp-reply +application/vemmi +application/whoispp-query +application/whoispp-response +application/wita +application/wordperfect5.1 wp5 +application/x400-bp +application/xhtml+xml xhtml xht +application/xml xml xsl +application/xml-dtd +application/xml-external-parsed-entity +application/zip zip +application/vnd.3M.Post-it-Notes +application/vnd.accpac.simply.aso +application/vnd.accpac.simply.imp +application/vnd.acucobol +application/vnd.aether.imp +application/vnd.anser-web-certificate-issue-initiation +application/vnd.anser-web-funds-transfer-initiation +application/vnd.audiograph +application/vnd.bmi +application/vnd.businessobjects +application/vnd.canon-cpdl +application/vnd.canon-lips +application/vnd.cinderella cdy +application/vnd.claymore +application/vnd.commerce-battelle +application/vnd.commonspace +application/vnd.comsocaller +application/vnd.contact.cmsg +application/vnd.cosmocaller +application/vnd.ctc-posml +application/vnd.cups-postscript +application/vnd.cups-raster +application/vnd.cups-raw +application/vnd.cybank +application/vnd.dna +application/vnd.dpgraph +application/vnd.dxr +application/vnd.ecdis-update +application/vnd.ecowin.chart +application/vnd.ecowin.filerequest +application/vnd.ecowin.fileupdate +application/vnd.ecowin.series +application/vnd.ecowin.seriesrequest +application/vnd.ecowin.seriesupdate +application/vnd.enliven +application/vnd.epson.esf +application/vnd.epson.msf +application/vnd.epson.quickanime +application/vnd.epson.salt +application/vnd.epson.ssf +application/vnd.ericsson.quickcall +application/vnd.eudora.data +application/vnd.fdf +application/vnd.ffsns +application/vnd.flographit +application/vnd.framemaker +application/vnd.fsc.weblaunch +application/vnd.fujitsu.oasys +application/vnd.fujitsu.oasys2 +application/vnd.fujitsu.oasys3 +application/vnd.fujitsu.oasysgp +application/vnd.fujitsu.oasysprs +application/vnd.fujixerox.ddd +application/vnd.fujixerox.docuworks +application/vnd.fujixerox.docuworks.binder +application/vnd.fut-misnet +application/vnd.grafeq +application/vnd.groove-account +application/vnd.groove-identity-message +application/vnd.groove-injector +application/vnd.groove-tool-message +application/vnd.groove-tool-template +application/vnd.groove-vcard +application/vnd.hhe.lesson-player +application/vnd.hp-HPGL +application/vnd.hp-PCL +application/vnd.hp-PCLXL +application/vnd.hp-hpid +application/vnd.hp-hps +application/vnd.httphone +application/vnd.hzn-3d-crossword +application/vnd.ibm.MiniPay +application/vnd.ibm.afplinedata +application/vnd.ibm.modcap +application/vnd.informix-visionary +application/vnd.intercon.formnet +application/vnd.intertrust.digibox +application/vnd.intertrust.nncp +application/vnd.intu.qbo +application/vnd.intu.qfx +application/vnd.irepository.package+xml +application/vnd.is-xpr +application/vnd.japannet-directory-service +application/vnd.japannet-jpnstore-wakeup +application/vnd.japannet-payment-wakeup +application/vnd.japannet-registration +application/vnd.japannet-registration-wakeup +application/vnd.japannet-setstore-wakeup +application/vnd.japannet-verification +application/vnd.japannet-verification-wakeup +application/vnd.koan +application/vnd.lotus-1-2-3 +application/vnd.lotus-approach +application/vnd.lotus-freelance +application/vnd.lotus-notes +application/vnd.lotus-organizer +application/vnd.lotus-screencam +application/vnd.lotus-wordpro +application/vnd.mcd +application/vnd.mediastation.cdkey +application/vnd.meridian-slingshot +application/vnd.mif +application/vnd.minisoft-hp3000-save +application/vnd.mitsubishi.misty-guard.trustweb +application/vnd.mobius.daf +application/vnd.mobius.dis +application/vnd.mobius.msl +application/vnd.mobius.plc +application/vnd.mobius.txf +application/vnd.motorola.flexsuite +application/vnd.motorola.flexsuite.adsi +application/vnd.motorola.flexsuite.fis +application/vnd.motorola.flexsuite.gotap +application/vnd.motorola.flexsuite.kmr +application/vnd.motorola.flexsuite.ttc +application/vnd.motorola.flexsuite.wem +application/vnd.mozilla.xul+xml xul +application/vnd.ms-artgalry +application/vnd.ms-asf +application/vnd.ms-excel xls xlb xlt +application/vnd.ms-lrm +application/vnd.ms-pki.seccat cat +application/vnd.ms-pki.stl stl +application/vnd.ms-powerpoint ppt pps +application/vnd.ms-project +application/vnd.ms-tnef +application/vnd.ms-works +application/vnd.mseq +application/vnd.msign +application/vnd.music-niff +application/vnd.musician +application/vnd.netfpx +application/vnd.noblenet-directory +application/vnd.noblenet-sealer +application/vnd.noblenet-web +application/vnd.novadigm.EDM +application/vnd.novadigm.EDX +application/vnd.novadigm.EXT +application/vnd.oasis.opendocument.chart odc +application/vnd.oasis.opendocument.database odb +application/vnd.oasis.opendocument.formula odf +application/vnd.oasis.opendocument.graphics odg +application/vnd.oasis.opendocument.graphics-template otg +application/vnd.oasis.opendocument.image odi +application/vnd.oasis.opendocument.presentation odp +application/vnd.oasis.opendocument.presentation-template otp +application/vnd.oasis.opendocument.spreadsheet ods +application/vnd.oasis.opendocument.spreadsheet-template ots +application/vnd.oasis.opendocument.text odt +application/vnd.oasis.opendocument.text-master odm +application/vnd.oasis.opendocument.text-template ott +application/vnd.oasis.opendocument.text-web oth +application/vnd.osa.netdeploy +application/vnd.palm +application/vnd.pg.format +application/vnd.pg.osasli +application/vnd.powerbuilder6 +application/vnd.powerbuilder6-s +application/vnd.powerbuilder7 +application/vnd.powerbuilder7-s +application/vnd.powerbuilder75 +application/vnd.powerbuilder75-s +application/vnd.previewsystems.box +application/vnd.publishare-delta-tree +application/vnd.pvi.ptid1 +application/vnd.pwg-xhtml-print+xml +application/vnd.rapid +application/vnd.rim.cod cod +application/vnd.s3sms +application/vnd.seemail +application/vnd.shana.informed.formdata +application/vnd.shana.informed.formtemplate +application/vnd.shana.informed.interchange +application/vnd.shana.informed.package +application/vnd.smaf mmf +application/vnd.sss-cod +application/vnd.sss-dtf +application/vnd.sss-ntf +application/vnd.stardivision.calc sdc +application/vnd.stardivision.draw sda +application/vnd.stardivision.impress sdd sdp +application/vnd.stardivision.math smf +application/vnd.stardivision.writer sdw vor +application/vnd.stardivision.writer-global sgl +application/vnd.street-stream +application/vnd.sun.xml.calc sxc +application/vnd.sun.xml.calc.template stc +application/vnd.sun.xml.draw sxd +application/vnd.sun.xml.draw.template std +application/vnd.sun.xml.impress sxi +application/vnd.sun.xml.impress.template sti +application/vnd.sun.xml.math sxm +application/vnd.sun.xml.writer sxw +application/vnd.sun.xml.writer.global sxg +application/vnd.sun.xml.writer.template stw +application/vnd.svd +application/vnd.swiftview-ics +application/vnd.symbian.install sis +application/vnd.triscape.mxs +application/vnd.trueapp +application/vnd.truedoc +application/vnd.tve-trigger +application/vnd.ufdl +application/vnd.uplanet.alert +application/vnd.uplanet.alert-wbxml +application/vnd.uplanet.bearer-choice +application/vnd.uplanet.bearer-choice-wbxml +application/vnd.uplanet.cacheop +application/vnd.uplanet.cacheop-wbxml +application/vnd.uplanet.channel +application/vnd.uplanet.channel-wbxml +application/vnd.uplanet.list +application/vnd.uplanet.list-wbxml +application/vnd.uplanet.listcmd +application/vnd.uplanet.listcmd-wbxml +application/vnd.uplanet.signal +application/vnd.vcx +application/vnd.vectorworks +application/vnd.vidsoft.vidconference +application/vnd.visio vsd +application/vnd.vividence.scriptfile +application/vnd.wap.sic +application/vnd.wap.slc +application/vnd.wap.wbxml wbxml +application/vnd.wap.wmlc wmlc +application/vnd.wap.wmlscriptc wmlsc +application/vnd.webturbo +application/vnd.wrq-hp3000-labelled +application/vnd.wt.stf +application/vnd.xara +application/vnd.xfdl +application/vnd.yellowriver-custom-menu +application/x-123 wk +application/x-apple-diskimage dmg +application/x-bcpio bcpio +application/x-bittorrent torrent +application/x-cdf cdf +application/x-cdlink vcd +application/x-chess-pgn pgn +application/x-core +application/x-cpio cpio +application/x-csh csh +application/x-debian-package deb +application/x-director dcr dir dxr +application/x-dms dms +application/x-doom wad +application/x-dvi dvi +application/x-executable +application/x-flac flac +application/x-font pfa pfb gsf pcf pcf.Z +application/x-futuresplash spl +application/x-gnumeric gnumeric +application/x-go-sgf sgf +application/x-graphing-calculator gcf +application/x-gtar gtar tgz taz +application/x-hdf hdf +application/x-httpd-php phtml pht php +application/x-httpd-php-source phps +application/x-httpd-php3 php3 +application/x-httpd-php3-preprocessed php3p +application/x-httpd-php4 php4 +application/x-ica ica +application/x-internet-signup ins isp +application/x-iphone iii +application/x-iso9660-image iso +application/x-java-applet +application/x-java-archive jar +application/x-java-bean +application/x-java-jnlp-file jnlp +application/x-java-serialized-object ser +application/x-java-vm class +application/x-javascript js +application/x-jmol jmz +application/x-kchart chrt +application/x-kdelnk +application/x-killustrator kil +application/x-koan skp skd skt skm +application/x-kpresenter kpr kpt +application/x-kspread ksp +application/x-kword kwd kwt +application/x-latex latex +application/x-lha lha +application/x-lzh lzh +application/x-lzx lzx +application/x-maker frm maker frame fm fb book fbdoc +application/x-mif mif +application/x-ms-wmd wmd +application/x-ms-wmz wmz +application/x-msdos-program com exe bat dll +application/x-msi msi +application/x-netcdf nc +application/x-ns-proxy-autoconfig pac +application/x-nwc nwc +application/x-object o +application/x-oz-application oza +application/x-pkcs7-certreqresp p7r +application/x-pkcs7-crl crl +application/x-python-code pyc pyo +application/x-quicktimeplayer qtl +application/x-redhat-package-manager rpm +application/x-rx +application/x-sh sh +application/x-shar shar +application/x-shellscript +application/x-shockwave-flash swf swfl +application/x-stuffit sit +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-tar tar +application/x-tcl tcl +application/x-tex-gf gf +application/x-tex-pk pk +application/x-texinfo texinfo texi +application/x-trash ~ % bak old sik +application/x-troff t tr roff +application/x-troff-man man +application/x-troff-me me +application/x-troff-ms ms +application/x-ustar ustar +application/x-videolan +application/x-wais-source src +application/x-wingz wz +application/x-x509-ca-cert crt +application/x-xcf xcf +application/x-xfig fig + +audio/32kadpcm +audio/basic au snd +audio/g.722.1 +audio/l16 +audio/midi mid midi kar +audio/mp4a-latm +audio/mpa-robust +audio/mpeg mpga mpega mp2 mp3 m4a +audio/mpegurl m3u +audio/parityfec +audio/prs.sid sid +audio/telephone-event +audio/tone +audio/vnd.cisco.nse +audio/vnd.cns.anp1 +audio/vnd.cns.inf1 +audio/vnd.digital-winds +audio/vnd.everad.plj +audio/vnd.lucent.voice +audio/vnd.nortel.vbk +audio/vnd.nuera.ecelp4800 +audio/vnd.nuera.ecelp7470 +audio/vnd.nuera.ecelp9600 +audio/vnd.octel.sbc +audio/vnd.qcelp +audio/vnd.rhetorex.32kadpcm +audio/vnd.vmx.cvsd +audio/x-aiff aif aiff aifc +audio/x-gsm gsm +audio/x-mpegurl m3u +audio/x-ms-wma wma +audio/x-ms-wax wax +audio/x-pn-realaudio-plugin +audio/x-pn-realaudio ra rm ram +audio/x-realaudio ra +audio/x-scpls pls +audio/x-sd2 sd2 +audio/x-wav wav + +chemical/x-alchemy alc +chemical/x-cache cac cache +chemical/x-cache-csf csf +chemical/x-cactvs-binary cbin cascii ctab +chemical/x-cdx cdx +chemical/x-cerius cer +chemical/x-chem3d c3d +chemical/x-chemdraw chm +chemical/x-cif cif +chemical/x-cmdf cmdf +chemical/x-cml cml +chemical/x-compass cpa +chemical/x-crossfire bsd +chemical/x-csml csml csm +chemical/x-ctx ctx +chemical/x-cxf cxf cef +#chemical/x-daylight-smiles smi +chemical/x-embl-dl-nucleotide emb embl +chemical/x-galactic-spc spc +chemical/x-gamess-input inp gam gamin +chemical/x-gaussian-checkpoint fch fchk +chemical/x-gaussian-cube cub +chemical/x-gaussian-input gau gjc gjf +chemical/x-gaussian-log gal +chemical/x-gcg8-sequence gcg +chemical/x-genbank gen +chemical/x-hin hin +chemical/x-isostar istr ist +chemical/x-jcamp-dx jdx dx +chemical/x-kinemage kin +chemical/x-macmolecule mcm +chemical/x-macromodel-input mmd mmod +chemical/x-mdl-molfile mol +chemical/x-mdl-rdfile rd +chemical/x-mdl-rxnfile rxn +chemical/x-mdl-sdfile sd sdf +chemical/x-mdl-tgf tgf +#chemical/x-mif mif +chemical/x-mmcif mcif +chemical/x-mol2 mol2 +chemical/x-molconn-Z b +chemical/x-mopac-graph gpt +chemical/x-mopac-input mop mopcrt mpc dat zmt +chemical/x-mopac-out moo +chemical/x-mopac-vib mvb +chemical/x-ncbi-asn1 asn +chemical/x-ncbi-asn1-ascii prt ent +chemical/x-ncbi-asn1-binary val aso +chemical/x-ncbi-asn1-spec asn +chemical/x-pdb pdb ent +chemical/x-rosdal ros +chemical/x-swissprot sw +chemical/x-vamas-iso14976 vms +chemical/x-vmd vmd +chemical/x-xtel xtel +chemical/x-xyz xyz + +image/cgm +image/g3fax +image/gif gif +image/ief ief +image/jpeg jpeg jpg jpe +image/naplps +image/pcx pcx +image/png png +image/prs.btif +image/prs.pti +image/svg+xml svg svgz +image/tiff tiff tif +image/vnd.cns.inf2 +image/vnd.djvu djvu djv +image/vnd.dwg +image/vnd.dxf +image/vnd.fastbidsheet +image/vnd.fpx +image/vnd.fst +image/vnd.fujixerox.edmics-mmr +image/vnd.fujixerox.edmics-rlc +image/vnd.mix +image/vnd.net-fpx +image/vnd.svf +image/vnd.wap.wbmp wbmp +image/vnd.xiff +image/x-cmu-raster ras +image/x-coreldraw cdr +image/x-coreldrawpattern pat +image/x-coreldrawtemplate cdt +image/x-corelphotopaint cpt +image/x-icon ico +image/x-jg art +image/x-jng jng +image/x-ms-bmp bmp +image/x-photoshop psd +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-rgb rgb +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd + +inode/chardevice +inode/blockdevice +inode/directory-locked +inode/directory +inode/fifo +inode/socket + +message/delivery-status +message/disposition-notification +message/external-body +message/http +message/s-http +message/news +message/partial +message/rfc822 + +model/iges igs iges +model/mesh msh mesh silo +model/vnd.dwf +model/vnd.flatland.3dml +model/vnd.gdl +model/vnd.gs-gdl +model/vnd.gtw +model/vnd.mts +model/vnd.vtu +model/vrml wrl vrml + +multipart/alternative +multipart/appledouble +multipart/byteranges +multipart/digest +multipart/encrypted +multipart/form-data +multipart/header-set +multipart/mixed +multipart/parallel +multipart/related +multipart/report +multipart/signed +multipart/voice-message + +text/calendar ics icz +text/comma-separated-values csv +text/css css +text/directory +text/english +text/enriched +text/h323 323 +text/html html htm shtml +text/iuls uls +text/mathml mml +text/parityfec +text/plain asc txt text diff pot +text/prs.lines.tag +text/rfc822-headers +text/richtext rtx +text/rtf rtf +text/scriptlet sct wsc +text/t140 +text/texmacs tm ts +text/tab-separated-values tsv +text/uri-list +text/vnd.abc +text/vnd.curl +text/vnd.DMClientScript +text/vnd.flatland.3dml +text/vnd.fly +text/vnd.fmi.flexstor +text/vnd.in3d.3dml +text/vnd.in3d.spot +text/vnd.IPTC.NewsML +text/vnd.IPTC.NITF +text/vnd.latex-z +text/vnd.motorola.reflex +text/vnd.ms-mediapackage +text/vnd.sun.j2me.app-descriptor jad +text/vnd.wap.si +text/vnd.wap.sl +text/vnd.wap.wml wml +text/vnd.wap.wmlscript wmls +text/x-c++hdr h++ hpp hxx hh +text/x-c++src c++ cpp cxx cc +text/x-chdr h +text/x-crontab +text/x-csh csh +text/x-csrc c +text/x-java java +text/x-makefile +text/x-moc moc +text/x-pascal p pas +text/x-pcs-gcd gcd +text/x-perl pl pm +text/x-python py +text/x-server-parsed-html +text/x-setext etx +text/x-sh sh +text/x-tcl tcl tk +text/x-tex tex ltx sty cls +text/x-vcalendar vcs +text/x-vcard vcf + +video/dl dl +video/fli fli +video/gl gl +video/mpeg mpeg mpg mpe +video/mp4 mp4 +video/quicktime qt mov +video/mp4v-es +video/parityfec +video/pointer +video/vnd.fvt +video/vnd.motorola.video +video/vnd.motorola.videop +video/vnd.mpegurl mxu +video/vnd.mts +video/vnd.nokia.interleaved-multimedia +video/vnd.vivo +video/x-dv dif dv +video/x-la-asf lsf lsx +video/x-mng mng +video/x-ms-asf asf asx +video/x-ms-wm wm +video/x-ms-wmv wmv +video/x-ms-wmx wmx +video/x-ms-wvx wvx +video/x-msvideo avi +video/x-sgi-movie movie + +x-conference/x-cooltalk ice + +x-world/x-vrml vrm vrml wrl Modified: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-08-23 18:41:55 UTC (rev 930) @@ -64,7 +64,8 @@ forgeHelper = new ForgeHelper(); contentManager = forgeHelper.getContentManager(""); - mimeTypes = new MimetypesFileTypeMap(); + mimeTypes = new MimetypesFileTypeMap( + FileAccessFilter.class.getResourceAsStream("/mime-types.txt")); } private void checkResource(String resource) throws Exception { Modified: trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:41:55 UTC (rev 930) @@ -43,18 +43,13 @@ </tag> <tag> - <name>wikiparam</name> - <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>name</name> + <name>project</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> </tag> <tag> Property changes on: trunk/forge/portal-extensions/forge-portal-attr ___________________________________________________________________ Name: svn:ignore + target .classpath .settings .project Added: trunk/forge/portal-extensions/forge-portal-attr/maven.xml =================================================================== --- trunk/forge/portal-extensions/forge-portal-attr/maven.xml 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-portal-attr/maven.xml 2005-08-23 18:41:55 UTC (rev 930) @@ -0,0 +1,22 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util"> + <goal name="all"> + </goal> + + <goal name="build"> + <attainGoal name="jar" /> + </goal> + + <goal name="deploy"> + <ant:copy todir="${local.deploy.dir}"> + <ant:fileset dir="to-copy" /> + </ant:copy> + <ant:copy + todir="${local.deploy.dir}/jboss-portal.sar/lib" + file="target/portal-attr-1.0.jar" /> + </goal> +</project> Added: trunk/forge/portal-extensions/forge-portal-attr/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-portal-attr/project.xml 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-portal-attr/project.xml 2005-08-23 18:41:55 UTC (rev 930) @@ -0,0 +1,37 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<project> + <pomVersion>3</pomVersion> + <id>portal-attr</id> + <name>Portal attributes</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Adam Warski</name> + <url>http://mamut.net.pl</url> + </organization> + <description></description> + + <dependencies> + <dependency> + <groupId>aslibs</groupId> + <artifactId>javax.servlet</artifactId> + <version>1.0</version> + <jar>javax.servlet.jar</jar> + </dependency> + + <dependency> + <groupId>jboss</groupId> + <artifactId>activation</artifactId> + <version>1.0</version> + <jar>activation.jar</jar> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/java</sourceDirectory> + </build> +</project> \ No newline at end of file Added: trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/AttributesFilter.java 2005-08-23 18:41:55 UTC (rev 930) @@ -0,0 +1,53 @@ +package org.jboss.forge.portal; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; + +public class AttributesFilter implements Filter { + public void init(FilterConfig config) throws ServletException { + + } + + public void doFilter(ServletRequest request, + ServletResponse response, FilterChain chain) + throws IOException, ServletException { + if (request instanceof HttpServletRequest) { + HttpServletRequest httpRequest = (HttpServletRequest) request; + + // Getting the request parameters. + String project = request.getParameter("project"); + String noproject = request.getParameter("noproject"); + + if ("true".equals(noproject)) { + // Removing project from session info. + httpRequest.getSession().removeAttribute("project"); + httpRequest.removeAttribute("project"); + } else { + // If there is no project selected in the url, trying to + // read it from the session. + if (project == null) + project = + (String) httpRequest.getSession().getAttribute("project"); + + if (project != null) { + // Setting request and session attributes. + httpRequest.getSession().setAttribute("project", project); + httpRequest.setAttribute("project", project); + } + } + } + + chain.doFilter(request, response); + } + + public void destroy() { + + } +} Added: trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml =================================================================== --- trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-portal-attr/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml 2005-08-23 18:41:55 UTC (rev 930) @@ -0,0 +1,157 @@ +<?xml version="1.0"?> +<!DOCTYPE web-app PUBLIC + "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + <description>JBoss Portal</description> + + + <!-- The server manager located by the main servlet. --> + <context-param> + <param-name>org.jboss.portal.server#SERVER_MANAGER</param-name> + <param-value>portal:service=ServerManager</param-value> + </context-param> + + <!-- Forge filter --> + <filter> + <filter-name>AttributesFilter</filter-name> + <filter-class>org.jboss.forge.portal.AttributesFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>AttributesFilter</filter-name> + <servlet-name>PortalServlet</servlet-name> + </filter-mapping> + + <!-- The transaction filter start and stop a JTA transaction around the request. --> + <filter> + <filter-name>TransactionFilter</filter-name> + <filter-class>org.jboss.portal.core.servlet.TransactionFilter</filter-class> + </filter> + + <!-- We wrap the portal request with a transaction --> + <filter-mapping> + <filter-name>TransactionFilter</filter-name> + <servlet-name>PortalServlet</servlet-name> + </filter-mapping> + + <!-- The portal servlet is the main entrance point --> + <servlet> + <servlet-name>PortalServlet</servlet-name> + <servlet-class>org.jboss.portal.core.servlet.CoreServlet</servlet-class> + <load-on-startup>0</load-on-startup> + <security-role-ref> + <role-name>Authenticated</role-name> + <role-link>Authenticated</role-link> + </security-role-ref> + </servlet> + + <!-- Provide access to unauthenticated users --> + <servlet-mapping> + <servlet-name>PortalServlet</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> + + <!-- Provide secure access to unauthenticated users --> + <servlet-mapping> + <servlet-name>PortalServlet</servlet-name> + <url-pattern>/sec/*</url-pattern> + </servlet-mapping> + + <!-- Provide access to authenticated users --> + <servlet-mapping> + <servlet-name>PortalServlet</servlet-name> + <url-pattern>/auth/*</url-pattern> + </servlet-mapping> + + <!-- Provide secure access to authenticated users --> + <servlet-mapping> + <servlet-name>PortalServlet</servlet-name> + <url-pattern>/authsec/*</url-pattern> + </servlet-mapping> + + <!-- Force the mapping of the index.jsp --> + <servlet-mapping> + <servlet-name>jsp</servlet-name> + <url-pattern>/login.jsp</url-pattern> + </servlet-mapping> + + <session-config> + <session-timeout>15</session-timeout> + </session-config> + + <!-- + | JDBC usage must be done with + | DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/PortalDS"; + --> + <resource-ref> + <res-ref-name>jdbc/PortalDS</res-ref-name> + <res-type>javax.sql.DataSource</res-type> + <res-auth>Container</res-auth> + <res-sharing-scope>Shareable</res-sharing-scope> + </resource-ref> + + <security-constraint> + <web-resource-collection> + <web-resource-name>Authenticated</web-resource-name> + <description></description> + <url-pattern>/auth/*</url-pattern> + </web-resource-collection> + <auth-constraint> + <role-name>Authenticated</role-name> + </auth-constraint> + </security-constraint> + + <security-constraint> + <web-resource-collection> + <web-resource-name>Secure</web-resource-name> + <url-pattern>/sec/*</url-pattern> + </web-resource-collection> + <user-data-constraint> + <transport-guarantee>CONFIDENTIAL</transport-guarantee> + </user-data-constraint> + </security-constraint> + + <security-constraint> + <web-resource-collection> + <web-resource-name>Secure+Authenticated</web-resource-name> + <url-pattern>/authsec/*</url-pattern> + </web-resource-collection> + <auth-constraint> + <role-name>Authenticated</role-name> + </auth-constraint> + <user-data-constraint> + <transport-guarantee>CONFIDENTIAL</transport-guarantee> + </user-data-constraint> + </security-constraint> + + <!-- + | Uncomment to use BASIC authentication scheme. Don't forget to comment other + | form authentication. + --> + <!-- + <login-config> + <auth-method>BASIC</auth-method> + <realm-name>JBoss Portal</realm-name> + </login-config> + --> + + <!-- + | Uncomment to use FORM authentication scheme. Don't forget to comment other + | form authentication. + --> + <!-- + --> + <login-config> + <auth-method>FORM</auth-method> + <realm-name>JBoss Portal</realm-name> + <form-login-config> + <form-login-page>/login.jsp</form-login-page> + <form-error-page>/errorpages/wronglogin.html</form-error-page> + </form-login-config> + </login-config> + + <security-role> + <role-name>Authenticated</role-name> + </security-role> +</web-app> Modified: trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:41:55 UTC (rev 930) @@ -43,18 +43,13 @@ </tag> <tag> - <name>wikiparam</name> - <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>name</name> + <name>project</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> </tag> <tag> Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:41:55 UTC (rev 930) @@ -43,18 +43,13 @@ </tag> <tag> - <name>wikiparam</name> - <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>name</name> + <name>project</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> </tag> <tag> Modified: trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:37:21 UTC (rev 929) +++ trunk/forge/portal-extensions/portal-federation/src/web/WEB-INF/tld/forge.tld 2005-08-23 18:41:55 UTC (rev 930) @@ -43,18 +43,13 @@ </tag> <tag> - <name>wikiparam</name> - <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> <attribute> - <name>name</name> + <name>project</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> </tag> <tag> |
From: <jbo...@li...> - 2005-08-23 18:37:32
|
Author: szimano Date: 2005-08-23 14:37:21 -0400 (Tue, 23 Aug 2005) New Revision: 929 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java Log: change after props change Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 18:21:14 UTC (rev 928) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 18:37:21 UTC (rev 929) @@ -55,7 +55,7 @@ @Override public void init() { - host = getProperty("htmlTranslatorURL").replaceAll("portal", "wiki"); + host = getProperty("htmlTranslatorURL")+"wiki"; } } |
From: <jbo...@li...> - 2005-08-23 18:21:22
|
Author: ral...@jb... Date: 2005-08-23 14:21:14 -0400 (Tue, 23 Aug 2005) New Revision: 928 Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java Log: images and footnotes updated in links parsing Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-23 17:18:42 UTC (rev 927) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-23 18:21:14 UTC (rev 928) @@ -1,6 +1,6 @@ # WikiPlugin properties. Use it wise. #specifies base URL for the portal -htmlTranslatorURL = http://forge.sicore.org:8080/portal/ -#htmlTranslatorURL = http://localhost:8080/portal/ +htmlTranslatorURL = http://forge.sicore.org:8080/ +#htmlTranslatorURL = http://localhost:8080/ #extensions for images to be inlined, coma-separated -imagePatterns = .png , .jpeg , .gif , .bmp \ No newline at end of file +imagePatterns = .png , .jpeg , .gif , .bmp Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-23 17:18:42 UTC (rev 927) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-23 18:21:14 UTC (rev 928) @@ -37,6 +37,7 @@ private String page = "&page="; private String mediaPatterns; + private String imagePath; private String[] mediaFormats = { "*.png", "*.jpeg", "*.gif" }; /* formatting variables */ @@ -73,6 +74,9 @@ private static final String WORD_SEPARATORS = ",.|:;+=&"; private PushbackReader m_in; + + //stores the name of the wiki page we are currently processing + private String pageName = ""; public HTMLTranslator() { @@ -760,61 +764,87 @@ */ private String handleHyperlinks(String link) { String result = ""; - String pageName = ""; + String text = ""; + String wikiPage = ""; + if(isPluginLink(link)) { - return null; //we do not include plugin links - } + return null; //we do not include plugin links for now + } int border = link.indexOf('|'); - if (border != -1) { - if (isExternalLink(link.substring(border + 1)))//case - // [...|externallink] - opens in new window + if (border != -1) //[text|link] case + { + text = link.substring(0, border); + link = link.substring(border + 1); + + + } + else //[link] case + { + text = link; + + + } + + //external link + if (isExternalLink(link)) { - //if(checkImageLink(link.substring(border + 1)) - //{result = "<img src=\""+link.substring(border + - // 1)+"\"alt=\"link.substring(0, border)\"";} - result = "<a href=\"" + link.substring(border + 1) + "\"target=\"_blank\">" - + link.substring(0, border) + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; - } //case [...|wikipagelink] + if(checkImageLink(link)) + { + result = "<img src=\""+link +"\"alt=\"" + text+"\">";//external + // image + } + else result = "<a href=\"" + link + "\"target=\"_blank\">" + + text + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; + } + //internal link else { - pageName = cleanLink(link.substring(border + 1)); - if(wikiEngine.pageExists(pageName)) + //check if a footnote + if(link.startsWith("#"))//footnote reference { - result = "<a href=\"" + portalHome + wikiHome + actionType + //http://labs.jboss.com/JSPWiki/Wiki.jsp?page=TextFormattingRules#ref-TextFormattingRules-1 + result = "<a name=\"" + portalHome + wikiHome + actionType + + "action" + page + pageName+"ref-" + pageName+"-"+link.substring(1)+"\">["+text+"]</A>"; + + } + else if (isNumber(link))//defines footnote + { + result = "<a href=\""+portalHome + wikiHome + actionType + + "action" + page + pageName+"#ref-"+ + pageName+"-"+ + link+"\">["+text+"]</A>"; + } + + //check if not an image link as well + else if(checkImageLink(link)) + { + result = "<img src=\""+ imagePath+"/" + pageName+"/" + link +"\" alt=\""+ text +"\">"; + + } + //check for attachments later on + else + { + wikiPage = cleanLink(link); + if(wikiEngine.pageExists(wikiPage)) + { + result = "<a href=\"" + portalHome + wikiHome + actionType + "action" + page - + pageName + "\">" - + link.substring(0, border) + + wikiPage + "\">" + + text + "</a>"; - } - else - result = "<u>"+link.substring(0, border)+"</u>"+"<a href=\"" + } + else + result = "<u>"+text+"</u>"+"<a href=\"" + portalHome + wikiHome + actionType + "action" + page - + pageName + "\">" + + wikiPage + "\">" + "?" + "</a>"; - } - - } else //[...] case - { - - if (isExternalLink(link)) { - result = "<a href=\"" + link + "\"target=\"_blank\">" + link - + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; - } else { - pageName = cleanLink(link); - if(wikiEngine.pageExists(pageName)) - { result = "<a href=\"" + portalHome + wikiHome + actionType - + "action" + page + cleanLink(link) + "\">" + link - + "</a>"; } - else - result = "<u>"+pageName+"</u>"+"<a href=\"" + portalHome + wikiHome + actionType - + "action" + page + pageName + "\">" + "?" - + "</a>"; } - } + + return result; } /** @@ -896,6 +926,30 @@ return clean.toString(); } + /** + * Returns true, if the argument contains a number, otherwise false. In a + * quick test this is roughly the same speed as Integer.parseInt() if the + * argument is a number, and roughly ten times the speed, if the argument is + * NOT a number. + */ + + private boolean isNumber( String s ) + { + if( s == null ) return false; + + if( s.length() > 1 && s.charAt(0) == '-' ) + s = s.substring(1); + + for( int i = 0; i < s.length(); i++ ) + { + if( !Character.isDigit(s.charAt(i)) ) + return false; + } + + return true; + } + + //not sure what it is supposed to do but neccessary to compile public void next() {} @@ -909,6 +963,7 @@ } try { + pageName = newPage.getName(); String newContent = parseLinks(newPage.getContent()); newPage.setPageContent(newContent); @@ -923,8 +978,9 @@ @Override public void init() { - portalHome = getProperty("htmlTranslatorURL"); + portalHome = getProperty("htmlTranslatorURL")+"portal/"; mediaPatterns = getProperty("imagePatterns"); + imagePath = getProperty("htmlTranslatorURL")+"wiki"; } |
From: <jbo...@li...> - 2005-08-23 17:18:51
|
Author: szimano Date: 2005-08-23 13:18:42 -0400 (Tue, 23 Aug 2005) New Revision: 927 Removed: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiTypeDescriptor.java Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java Log: some changes... Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java 2005-08-23 17:18:42 UTC (rev 927) @@ -14,10 +14,8 @@ * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> * @version $Id$ */ -import java.util.Date; - + import org.jboss.portal.core.model.User; -import org.jboss.wiki.plugins.HTMLTranslator; /** * <p></p> Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-23 17:18:42 UTC (rev 927) @@ -10,13 +10,9 @@ import java.util.Date; import java.util.HashMap; -import java.util.Map; - import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.jboss.wiki.plugins.DifferenceEngine; -import org.xml.sax.SAXException; /** * @@ -34,32 +30,15 @@ /** * <p> - * Represents ... * </p> * */ - private String urlBase; - - /** - * <p> - * Represents ... - * </p> - * - */ - private Map wikiTypePlugins; - - /** - * <p> - * </p> - * - */ private HashMap<String, WikiPage> pages; private HashMap<String, WikiType> wikiTypes; private MediaDataSource mediaDataSource; - private String wikiID = (new Date()).toString(); /** * <p> * Does ... Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java 2005-08-23 17:18:42 UTC (rev 927) @@ -8,7 +8,6 @@ *************************************************/ package org.jboss.wiki; -import java.io.IOException; import java.io.InputStream; import java.util.Properties; Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 17:18:42 UTC (rev 927) @@ -12,7 +12,6 @@ import java.util.Date; import java.util.Iterator; import java.util.List; -import java.util.Set; import javax.portlet.*; import org.jboss.portlet.*; @@ -71,8 +70,8 @@ // write the uploaded file to a new location String fieldName = item.getFieldName(); String fileName = item.getName(); - String contentType = item.getContentType(); - long size = item.getSize(); + //String contentType = item.getContentType(); + //long size = item.getSize(); /* * rResp .setRenderParameter("size", * Long.toString(size)); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java 2005-08-23 17:18:42 UTC (rev 927) @@ -8,8 +8,6 @@ *************************************************/ package org.jboss.wiki; -import java.util.List; -import java.util.Set; import java.util.Vector; /** @@ -31,55 +29,14 @@ /** * <p> - * Represents ... * </p> * */ - protected List pluginChain; - - /** - * <p> - * </p> - * - */ - protected WikiTypeDescriptor wikiTypeDescriptor; - - /** - * <p> - * </p> - * - */ protected WikiContext wikiContext; protected Vector<WikiPlugin> plugins = new Vector<WikiPlugin>(); - /** - * <p> - * Does ... - * </p> - * - * - * @return - */ - public void getPluginChain() { - // your code here - // return null; - } - /** - * <p> - * Does ... - * </p> - * - * - * @return - */ - - public void initPluginChain() { - // your code here - // return null; - } - public void addPlugin(String pluginName, String pluginClass) { WikiPlugin plugin = null; @@ -109,14 +66,17 @@ /** * <p> - * Does ... + * Processes given WikiPage with the apropriate plugins, connected to this WikiType * </p> * * - * @return - * @param content + * @return processed WikiPage (copy - not exact reference) + * @param wikiPage page to process + * @param wikiSession current session */ public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { + // process through all plugins + WikiPage newPage = null; try { Deleted: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiTypeDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiTypeDescriptor.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiTypeDescriptor.java 2005-08-23 17:18:42 UTC (rev 927) @@ -1,31 +0,0 @@ -/************************************************** - * * - * JBoss Labs: Creating Professional Open Source * - * * - * Distributable under LGPL license. * - * See terms of license at gnu.org. * - * * - *************************************************/ - package org.jboss.wiki; - -import java.util.List; - - /** - * - * @author <a href="mailto:ds...@jb...">Damon Sicore</a> - * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> - * @version $Id$ - */ -public class WikiTypeDescriptor { - -/** - * <p>Represents ...</p> - * - */ - private List pluginNameList; -/** - * <p></p> - * - */ - public WikiType wikiType; - } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 17:18:42 UTC (rev 927) @@ -29,11 +29,12 @@ // import org.jboss.forge.common.ForgeHelper; /** - * A filter that enables to download files which are stored in a working copy of - * a content repository. + * A filter that enables to download files form the jspwiki structure * - * @author adamw + * @author tomek */ + + public class WikiFileAccessFilter implements Filter { /** * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 15:52:54 UTC (rev 926) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 17:18:42 UTC (rev 927) @@ -1,3 +1,12 @@ +/************************************************** + * * + * JBoss Labs: Creating Professional Open Source * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************/ + package org.jboss.wiki.plugins; import java.util.Set; |
From: <jbo...@li...> - 2005-08-23 15:53:15
|
Author: szimano Date: 2005-08-23 11:52:54 -0400 (Tue, 23 Aug 2005) New Revision: 926 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java Log: error while reading newer versions of attachements Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 15:28:08 UTC (rev 925) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 15:52:54 UTC (rev 926) @@ -90,6 +90,23 @@ System.out.println("[WikiFileAccess]Getting file: " + fileName + " of page: " + pageName); + Properties props = new Properties(); + + try { + props.load(new FileInputStream(new File(attachementsPath + "/" + + pageName + "-att/" + fileName + + "-dir/attachment.properties"))); + } catch (IOException e) { + System.err.println(e); + } + + // looking for the newst version + int version = 1; + + while (props.getProperty((version + 1) + ".author") != null) { + version++; + } + tokens = fileName.split("\\."); File file = new File( @@ -98,7 +115,9 @@ + pageName + "-att/" + fileName - + "-dir/1." + + "-dir/" + + version + + "." + ((fileName.indexOf(".") != -1) ? tokens[tokens.length - 1] : "bin")); |
From: <jbo...@li...> - 2005-08-23 15:28:16
|
Author: szimano Date: 2005-08-23 11:28:08 -0400 (Tue, 23 Aug 2005) New Revision: 925 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java Log: misspel :) Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-23 15:10:45 UTC (rev 924) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-23 15:28:08 UTC (rev 925) @@ -35,7 +35,7 @@ private String pathToMedia; - private String pathToAttachements; + private String pathToAttachments; private Properties fileDSProps; @@ -62,9 +62,9 @@ if (fileDSProps.getProperty("pathToMedia") != null) { pathToMedia = fileDSProps.getProperty("pathToMedia"); System.out.println("Path to media is: " + pathToMedia); - pathToAttachements = fileDSProps.getProperty("pathToAttachements"); + pathToAttachments = fileDSProps.getProperty("pathToAttachements"); System.out - .println("Path to attachements is: " + pathToAttachements); + .println("Path to attachements is: " + pathToAttachments); } else { System.err .println("Your properties file lacks of pathToMedia property. It will not run properly ! Please update " @@ -215,7 +215,7 @@ public Properties getAttProps(String pageName, String attName) { Properties attProps = new Properties(); - File propFile = new File(pathToAttachements + "/" + pageName + "-att/" + File propFile = new File(pathToAttachments + "/" + pageName + "-att/" + attName + "-dir/"); if (!propFile.exists()) { @@ -223,19 +223,19 @@ propFile.mkdirs(); } - propFile = new File(pathToAttachements + "/" + pageName + "-att/" - + attName + "-dir/attachement.properties"); + propFile = new File(pathToAttachments + "/" + pageName + "-att/" + + attName + "-dir/attachment.properties"); try { attProps.load(new FileInputStream(propFile)); } catch (IOException ioe) { System.err - .println("Cannot read attachement.properties for attachement: " - + pathToAttachements + .println("Cannot read attachment.properties for attachement: " + + pathToAttachments + "/" + pageName + "-att/" - + attName + "-dir/attachement.properties\n" + ioe); + + attName + "-dir/attachment.properties\n" + ioe); } return attProps; @@ -243,18 +243,18 @@ public void saveAttProps(Properties props, String pageName, String attName) { try { - props.store(new FileOutputStream(new File(pathToAttachements + "/" + props.store(new FileOutputStream(new File(pathToAttachments + "/" + pageName + "-att/" + attName - + "-dir/attachement.properties")), + + "-dir/attachment.properties")), "Saved by FileDataSource of JBoss Wiki"); } catch (Exception ioe) { System.err - .println("Cannot store attachement.properties for attachement: " - + pathToAttachements + .println("Cannot store attchement.properties for attachement: " + + pathToAttachments + "/" + pageName + "-att/" - + attName + "-dir/attachements.properties\n" + ioe); + + attName + "-dir/attachments.properties\n" + ioe); } } @@ -453,7 +453,7 @@ } String[] extension = attName.split("\\."); - String fileName = pathToAttachements + String fileName = pathToAttachments + "/" + pageName + "-att/" @@ -503,7 +503,7 @@ public Set<String> getAttachementsSet(WikiPage page) { Set<String> attSet = new HashSet<String>(); - File attDir = new File(pathToAttachements+"/"+page.getName()+"-att"); + File attDir = new File(pathToAttachments+"/"+page.getName()+"-att"); if (attDir.exists()) { File[] attachements = attDir.listFiles(); |
From: <jbo...@li...> - 2005-08-23 15:10:53
|
Author: szimano Date: 2005-08-23 11:10:45 -0400 (Tue, 23 Aug 2005) New Revision: 924 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: attach only when logged in Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 15:02:05 UTC (rev 923) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 15:10:45 UTC (rev 924) @@ -201,6 +201,11 @@ } if ((rReq.getParameter("action") != null) + && (rReq.getParameter("action").equals("Attach"))) { + rReq.setAttribute("fileAttach", "true"); + } + + if ((rReq.getParameter("action") != null) && (rReq.getParameter("action").equals("Edit")) && (rReq.getUser() != null)) { page = "Edit.jsp"; Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-23 15:02:05 UTC (rev 923) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-23 15:10:45 UTC (rev 924) @@ -25,11 +25,12 @@ if (logedIn.equals("true")) { - out.print("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"'><img src=\"/file-access/default/members/jbosswiki/images/editButton.png\"</img></a>"); + out.print("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"'><img src=\"/file-access/default/members/jbosswiki/images/editButton.png\"</img></a>"+ + "<a href=\""+actionURL+"&action=Attach\">Attach file...</a>"); } else { - out.print("<i>Login to edit pages</i>"); + out.print("<i><div style='font-size: xx-small'>Login to edit pages and attach files</div></i>"); } %> @@ -44,6 +45,18 @@ <hr /> <% + String attachFile = (String)request.getAttribute("fileAttach"); + + if ((attachFile != null)&&(attachFile.equals("true"))) { + out.println("<h2><b>UPLOAD FILE:</b></h2>\n"+ + "<FORM ACTION=\""+actionURL+"&page="+wikiPage+"\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">"+ + "<INPUT TYPE=\"file\" NAME=\"file_up\" />"+ + "<INPUT TYPE=\"submit\" VALUE=\"Upload\" />"+ + "</FORM><hr />"); + } +%> + +<% Integer showedVersion = (Integer)request.getAttribute("showedVersion"); if (showedVersion != null) { @@ -72,14 +85,10 @@ -<a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>">More info...</a> <a href="<%=actionURL%>">Attach file...</a> +<!--<a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>">More info...</a> <a href="<%=actionURL%>&action=Attach">Attach file...</a>--> </td> </tr> </table> <br /> <div class="author">The page last changed on <%=editDate%> by <%=author%>. </div> -<FORM ACTION="<%=actionURL%>&page=<%=wikiPage%>" METHOD="POST" ENCTYPE="multipart/form-data"> -<INPUT TYPE="file" NAME="file_up" /> -<INPUT TYPE="submit" VALUE="Upload" /> -</FORM> |
From: <jbo...@li...> - 2005-08-23 15:02:19
|
Author: adamw Date: 2005-08-23 11:02:05 -0400 (Tue, 23 Aug 2005) New Revision: 923 Modified: trunk/forge/portal-extensions/forge-common/project.xml trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/elements/ElementDescriptor.java trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java Log: Svn repo cleanup after a svn exception Modified: trunk/forge/portal-extensions/forge-common/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-common/project.xml 2005-08-23 14:48:06 UTC (rev 922) +++ trunk/forge/portal-extensions/forge-common/project.xml 2005-08-23 15:02:05 UTC (rev 923) @@ -79,6 +79,13 @@ <version>1.0</version> <jar>mail.jar</jar> </dependency> + + <dependency> + <groupId>jboss</groupId> + <artifactId>portal-server</artifactId> + <version>1.0</version> + <jar>portal-server-lib.jar</jar> + </dependency> </dependencies> <build> Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java 2005-08-23 14:48:06 UTC (rev 922) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/ForgeHelper.java 2005-08-23 15:02:05 UTC (rev 923) @@ -192,21 +192,21 @@ */ public String getRequestParameter(JBossRenderRequest request, String paramName) { - // First trying to read it from the URL (this works, if it is not a + // First trying to read it from the URL (this works, if it is not a // render/ action request). String URL = request.getURL(); if (URL != null) { - int prjStart = request.getURL().indexOf(paramName + "="); - if (prjStart != -1) { + int paramStart = request.getURL().indexOf(paramName + "="); + if (paramStart != -1) { String prjName; // Skipping the <paramName>= - prjStart += paramName.length() + 1; - int prjEnd = request.getURL().substring(prjStart).indexOf('&'); - if (prjEnd == -1) - prjName = URL.substring(prjStart); + paramStart += paramName.length() + 1; + int paramEnd = request.getURL().substring(paramStart).indexOf('&'); + if (paramEnd == -1) + prjName = URL.substring(paramStart); else - prjName = URL.substring(prjStart, prjStart + prjEnd); + prjName = URL.substring(paramStart, paramStart + paramEnd); return prjName; } Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-23 14:48:06 UTC (rev 922) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-23 15:02:05 UTC (rev 923) @@ -57,6 +57,15 @@ this.localPath = localPath; } + /** + * Performs a cleanup on the repo. This can be called in case of an exception. + * @throws SVNException + */ + private void cleanup() throws SVNException { + ourClientManager.getWCClient().doCleanup( + new File(getSystemFilePath(""))); + } + /* (non-Javadoc) * @see org.jboss.forge.common.content.ContentManager#update() */ @@ -82,7 +91,7 @@ SVNRevision.HEAD, SVNRevision.HEAD, true); } } catch (SVNException e) { - e.printStackTrace(); + try { cleanup(); } catch (SVNException e1) { e1.printStackTrace(); } } } @@ -99,6 +108,8 @@ ourClientManager.getCommitClient().doCommit(files, false, "New content", true, true); } catch (SVNException e) { + try { cleanup(); } catch (SVNException e1) { e1.printStackTrace(); } + e.printStackTrace(); throw new IOException(e.getMessage()); } @@ -143,6 +154,7 @@ try { ourClientManager.getWCClient().doAdd(file, true, false, false, false); } catch (SVNException e) { + try { cleanup(); } catch (SVNException e1) { e1.printStackTrace(); } throw new IOException("SVN error while adding the new file"); } } @@ -194,6 +206,7 @@ try { ourClientManager.getWCClient().doDelete(file, true, false); } catch (SVNException e) { + try { cleanup(); } catch (SVNException e1) { e1.printStackTrace(); } throw new IOException("SVN error while deleting the given " + "resource/catalogue."); } Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/elements/ElementDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/elements/ElementDescriptor.java 2005-08-23 14:48:06 UTC (rev 922) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/elements/ElementDescriptor.java 2005-08-23 15:02:05 UTC (rev 923) @@ -142,9 +142,7 @@ // exist an element with an appropriate id. if (ed != null) { addBinding(nodeName, ed); - ed - .addBinding( - opm.getBindingKeyForBound(nodeName), + ed.addBinding(opm.getBindingKeyForBound(nodeName), this); } } Modified: trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java =================================================================== --- trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-23 14:48:06 UTC (rev 922) +++ trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-23 15:02:05 UTC (rev 923) @@ -1,5 +1,6 @@ package org.jboss.forge.service; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -34,6 +35,9 @@ private static final Logger log = Logger.getLogger(ForgeService.class); + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#putToCache(java.lang.String, java.lang.String, java.lang.Object) + */ public void putToCache(String portalName, String key, Object value) { putToCache(new CacheKey(portalName, key), value); } @@ -42,6 +46,9 @@ cache.put(ck, value); } + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#getFromCache(java.lang.String, java.lang.String) + */ public Object getFromCache(String portalName, String key) { return getFromCache(new CacheKey(portalName, key)); } @@ -50,6 +57,9 @@ return cache.get(ck); } + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#addNodeWatcher(java.lang.String, java.lang.String, org.jboss.forge.common.service.NodeWatcher) + */ public Object addNodeWatcher(String portalName, String key, NodeWatcher nw) { // Calculating the initial value & putting it into the cache. Object initialValue = nw.init(portalName); @@ -60,6 +70,9 @@ return initialValue; } + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#addToCommit(java.lang.String) + */ public void addToCommit(String name) { synchronized (toCommit) { toCommit.add(name); @@ -85,17 +98,57 @@ return newValue == null ? currentValue : newValue; } + /** + * Creates an array of only such strings from <code>array</code>, which + * don't contain any other string from this array as a prefix. + * @param array Array to compact. + * @return A modified array with "most general" strings from the given + * array. + */ + private String[] compactArray(String[] array) { + // First sorting the array to be able to check the strings only once. + Arrays.sort(array); + + // Index of the current "most general" string. + int lastPrefix = 0; + int numberOfElements = array.length; + for (int i=1; i<array.length; i++) + if ((lastPrefix != i) && (array[i].startsWith(array[lastPrefix]))) { + array[i] = null; + numberOfElements--; + } else + lastPrefix = i; + + // Construting an array containing only non-null elements of + // <code>array</code>. + String[] ret = new String[numberOfElements]; + int j = 0; + for (int i=0; i<array.length; i++) + if (array[i] != null) ret[j++] = array[i]; + + return ret; + } + + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#update() + */ public synchronized void update() { try { // Updating repo. cm.update(); - // Commiting. + // Commiting - first getting the files to commit - so we hold the + // sync lock for as short as possible. + String[] toCommitArray; synchronized (toCommit) { - cm.commit(toCommit.toArray(new String[0])); + toCommitArray = toCommit.toArray(new String[0]); toCommit.clear(); } + // "Compacting" the array, that is, retaining only the most general + // names, as the commiting is recursive. + cm.commit(compactArray(toCommitArray)); + synchronized (nodeWatchers) { // Updating nodes. for (CacheKey ck : nodeWatchers.keySet()) @@ -107,6 +160,9 @@ } } + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#forceNodeUpdate(java.lang.String, java.lang.String) + */ public Object forceNodeUpdate(String portalName, String key) { return updateNode(new CacheKey(portalName, key)); } @@ -118,10 +174,16 @@ private final static long DEFAULT_TIMER_INTERVAL = 1000*60; // 1 minute private long timerInterval; + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#setTimerInterval(long) + */ public void setTimerInterval(long timerInterval) { this.timerInterval = timerInterval; } + /* (non-Javadoc) + * @see org.jboss.forge.common.service.ForgeManagement#getTimerInterval() + */ public long getTimerInterval() { return timerInterval; } |
From: <jbo...@li...> - 2005-08-23 14:48:16
|
Author: szimano Date: 2005-08-23 10:48:06 -0400 (Tue, 23 Aug 2005) New Revision: 922 Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java Log: changes of attachements list plugin Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-23 13:29:37 UTC (rev 921) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-23 14:48:06 UTC (rev 922) @@ -13,13 +13,13 @@ <class>org.jboss.wiki.plugins.TrailPlugin</class> </plugin> <plugin> + <name>wikiToHtmlTranslator</name> + <class>org.jboss.wiki.plugins.HTMLTranslator</class> + </plugin> + <plugin> <name>attachementList</name> <class>org.jboss.wiki.plugins.AttachementListPlugin</class> </plugin> - <plugin> - <name>wikiToHtmlTranslator</name> - <class>org.jboss.wiki.plugins.HTMLTranslator</class> - </plugin> </wikiType> <wikiType> <name>DIFF</name> Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-23 13:29:37 UTC (rev 921) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-23 14:48:06 UTC (rev 922) @@ -235,7 +235,7 @@ + "/" + pageName + "-att/" - + attName + "-dir/attachements.properties\n" + ioe); + + attName + "-dir/attachement.properties\n" + ioe); } return attProps; Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 13:29:37 UTC (rev 921) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java 2005-08-23 14:48:06 UTC (rev 922) @@ -8,6 +8,8 @@ public class AttachementListPlugin extends WikiPlugin { + private String host = ""; + @Override public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { WikiPage newPage = null; @@ -23,10 +25,11 @@ if (attachements != null) { String newContent = newPage.getPageContent(); - newContent += "\n----\n!!Attachements:\\\\\n"; + newContent += "\n<hr />\n<h3>Attachements:</h3>\n"; for (String s : attachements) { - newContent += "[" + s + "]\\\\"; + String href = host+newPage.getName() + "/" + s; + newContent += "<a href='"+href+"'>"+href + "</a><br>\n"; } newPage.setPageContent(newContent); @@ -43,8 +46,7 @@ @Override public void init() { - // TODO Auto-generated method stub - + host = getProperty("htmlTranslatorURL").replaceAll("portal", "wiki"); } } |
From: <jbo...@li...> - 2005-08-23 13:29:49
|
Author: szimano Date: 2005-08-23 09:29:37 -0400 (Tue, 23 Aug 2005) New Revision: 921 Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/ trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/ trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/ trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/AttachementListPlugin.java Removed: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPluginChain.java Modified: trunk/forge/portal-extensions/forge-wiki/project.xml trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: attachements working so-so Modified: trunk/forge/portal-extensions/forge-wiki/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/project.xml 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/project.xml 2005-08-23 13:29:37 UTC (rev 921) @@ -60,6 +60,14 @@ <version>1.0</version> <jar>activation.jar</jar> </dependency> + + <dependency> + <groupId>commons-fileupload</groupId> + <artifactId>commons-fileupload.jar</artifactId> + <version>1.0</version> + <jar>commons-fileupload-1.0.jar</jar> + </dependency> + </dependencies> <build> Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-23 13:29:37 UTC (rev 921) @@ -13,6 +13,10 @@ <class>org.jboss.wiki.plugins.TrailPlugin</class> </plugin> <plugin> + <name>attachementList</name> + <class>org.jboss.wiki.plugins.AttachementListPlugin</class> + </plugin> + <plugin> <name>wikiToHtmlTranslator</name> <class>org.jboss.wiki.plugins.HTMLTranslator</class> </plugin> Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java 2005-08-23 13:29:37 UTC (rev 921) @@ -0,0 +1,249 @@ +/* + * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletDiskFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + * $Revision: 1.1 $ + * $Date: 2003/10/01 22:21:43 $ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + + +package org.apache.commons.fileupload; + + +import java.io.File; +import java.util.List; +import javax.portlet.ActionRequest; + + +/** + * <p>High level API for processing file uploads.</p> + * + * <p>This class handles multiple files per single HTML widget, sent using + * <code>multipart/mixed</code> encoding type, as specified by + * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link + * #parseRequest(HttpServletRequest)} to acquire a list of {@link + * org.apache.commons.fileupload.FileItem}s associated with a given HTML + * widget.</p> + * + * <p>Individual parts will be stored in temporary disk storage or in memory, + * depending on their size, and will be available as {@link + * org.apache.commons.fileupload.FileItem}s.</p> + * + * @author <a href="mailto:Raf...@e-...">Rafal Krzewski</a> + * @author <a href="mailto:dl...@co...">Daniel Rall</a> + * @author <a href="mailto:jv...@ap...">Jason van Zyl</a> + * @author <a href="mailto:jmc...@co...">John McNally</a> + * @author <a href="mailto:ma...@ap...">Martin Cooper</a> + * @author Sean C. Sullivan + * + * @version $Id: PortletDiskFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + */ +public class PortletDiskFileUpload + extends PortletFileUploadBase + { + + // ----------------------------------------------------------- Data members + + + /** + * The factory to use to create new form items. + */ + private DefaultFileItemFactory fileItemFactory; + + + // ----------------------------------------------------------- Constructors + + + /** + * Constructs an instance of this class which uses the default factory to + * create <code>FileItem</code> instances. + * + * @see #DiskFileUpload(DefaultFileItemFactory fileItemFactory) + */ + public PortletDiskFileUpload() + { + super(); + this.fileItemFactory = new DefaultFileItemFactory(); + } + + + /** + * Constructs an instance of this class which uses the supplied factory to + * create <code>FileItem</code> instances. + * + * @see #DiskFileUpload() + */ + public PortletDiskFileUpload(DefaultFileItemFactory fileItemFactory) + { + super(); + this.fileItemFactory = fileItemFactory; + } + + + // ----------------------------------------------------- Property accessors + + + /** + * Returns the factory class used when creating file items. + * + * @return The factory class for new file items. + */ + public FileItemFactory getFileItemFactory() + { + return fileItemFactory; + } + + + /** + * Sets the factory class to use when creating file items. The factory must + * be an instance of <code>DefaultFileItemFactory</code> or a subclass + * thereof, or else a <code>ClassCastException</code> will be thrown. + * + * @param factory The factory class for new file items. + */ + public void setFileItemFactory(FileItemFactory factory) + { + this.fileItemFactory = (DefaultFileItemFactory) factory; + } + + + /** + * Returns the size threshold beyond which files are written directly to + * disk. + * + * @return The size threshold, in bytes. + * + * @see #setSizeThreshold(int) + */ + public int getSizeThreshold() + { + return fileItemFactory.getSizeThreshold(); + } + + + /** + * Sets the size threshold beyond which files are written directly to disk. + * + * @param sizeThreshold The size threshold, in bytes. + * + * @see #getSizeThreshold() + */ + public void setSizeThreshold(int sizeThreshold) + { + fileItemFactory.setSizeThreshold(sizeThreshold); + } + + + /** + * Returns the location used to temporarily store files that are larger + * than the configured size threshold. + * + * @return The path to the temporary file location. + * + * @see #setRepositoryPath(String) + */ + public String getRepositoryPath() + { + return fileItemFactory.getRepository().getPath(); + } + + + /** + * Sets the location used to temporarily store files that are larger + * than the configured size threshold. + * + * @param repositoryPath The path to the temporary file location. + * + * @see #getRepositoryPath() + */ + public void setRepositoryPath(String repositoryPath) + { + fileItemFactory.setRepository(new File(repositoryPath)); + } + + + // --------------------------------------------------------- Public methods + + + /** + * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> + * compliant <code>multipart/form-data</code> stream. If files are stored + * on disk, the path is given by <code>getRepository()</code>. + * + * @param req The servlet request to be parsed. Must be non-null. + * @param sizeThreshold The max size in bytes to be stored in memory. + * @param sizeMax The maximum allowed upload size, in bytes. + * @param path The location where the files should be stored. + * + * @return A list of <code>FileItem</code> instances parsed from the + * request, in the order that they were transmitted. + * + * @exception FileUploadException if there are problems reading/parsing + * the request or storing files. + */ + public List /* FileItem */ parseRequest(ActionRequest req, + int sizeThreshold, + long sizeMax, String path) + throws FileUploadException + { + setSizeThreshold(sizeThreshold); + setSizeMax(sizeMax); + setRepositoryPath(path); + return parseRequest(req); + } + +} + Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java 2005-08-23 13:29:37 UTC (rev 921) @@ -0,0 +1,156 @@ +/* + * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + * $Revision: 1.1 $ + * $Date: 2003/10/01 22:21:43 $ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + + +package org.apache.commons.fileupload; + + +/** + * <p>High level API for processing file uploads.</p> + * + * <p>This class handles multiple files per single HTML widget, sent using + * <code>multipart/mixed</code> encoding type, as specified by + * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link + * #parseRequest(HttpServletRequest)} to acquire a list of {@link + * org.apache.commons.fileupload.FileItem}s associated with a given HTML + * widget.</p> + * + * <p>How the data for individual parts is stored is determined by the factory + * used to create them; a given part may be in memory, on disk, or somewhere + * else.</p> + * + * @author <a href="mailto:Raf...@e-...">Rafal Krzewski</a> + * @author <a href="mailto:dl...@co...">Daniel Rall</a> + * @author <a href="mailto:jv...@ap...">Jason van Zyl</a> + * @author <a href="mailto:jmc...@co...">John McNally</a> + * @author <a href="mailto:ma...@ap...">Martin Cooper</a> + * @author Sean C. Sullivan + * + * @version $Id: PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + */ +public class PortletFileUpload + extends PortletFileUploadBase + { + + // ----------------------------------------------------------- Data members + + + /** + * The factory to use to create new form items. + */ + private FileItemFactory fileItemFactory; + + + // ----------------------------------------------------------- Constructors + + + /** + * Constructs an instance of this class which uses the default factory to + * create <code>FileItem</code> instances. + * + * @see #FileUpload(FileItemFactory) + */ + public PortletFileUpload() + { + super(); + } + + + /** + * Constructs an instance of this class which uses the supplied factory to + * create <code>FileItem</code> instances. + * + * @see #FileUpload() + */ + public PortletFileUpload(FileItemFactory fileItemFactory) + { + super(); + this.fileItemFactory = fileItemFactory; + } + + + // ----------------------------------------------------- Property accessors + + + /** + * Returns the factory class used when creating file items. + * + * @return The factory class for new file items. + */ + public FileItemFactory getFileItemFactory() + { + return fileItemFactory; + } + + + /** + * Sets the factory class to use when creating file items. + * + * @param factory The factory class for new file items. + */ + public void setFileItemFactory(FileItemFactory factory) + { + this.fileItemFactory = factory; + } + + +} + Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java 2005-08-23 13:29:37 UTC (rev 921) @@ -0,0 +1,685 @@ +/* + * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUploadBase.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + * $Revision: 1.1 $ + * $Date: 2003/10/01 22:21:43 $ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact ap...@ap.... + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + + +package org.apache.commons.fileupload; + + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.portlet.ActionRequest; + + +/** + * <p>High level API for processing file uploads.</p> + * + * <p>This class handles multiple files per single HTML widget, sent using + * <code>multipart/mixed</code> encoding type, as specified by + * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link + * #parseRequest(HttpServletRequest)} to acquire a list of {@link + * org.apache.commons.fileupload.FileItem}s associated with a given HTML + * widget.</p> + * + * <p>How the data for individual parts is stored is determined by the factory + * used to create them; a given part may be in memory, on disk, or somewhere + * else.</p> + * + * @author <a href="mailto:Raf...@e-...">Rafal Krzewski</a> + * @author <a href="mailto:dl...@co...">Daniel Rall</a> + * @author <a href="mailto:jv...@ap...">Jason van Zyl</a> + * @author <a href="mailto:jmc...@co...">John McNally</a> + * @author <a href="mailto:ma...@ap...">Martin Cooper</a> + * @author Sean C. Sullivan + * + * @version $Id: PortletFileUploadBase.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $ + */ +public abstract class PortletFileUploadBase +{ + + // ---------------------------------------------------------- Class methods + + + /** + * Utility method that determines whether the request contains multipart + * content. + * + * @param req The servlet request to be evaluated. Must be non-null. + * + * @return <code>true</code> if the request is multipart; + * <code>false</code> otherwise. + */ + public static final boolean isMultipartContent(ActionRequest req) + { + String contentType = req.getContentType(); + if (contentType == null) + { + return false; + } + if (contentType.startsWith(MULTIPART)) + { + return true; + } + return false; + } + + + // ----------------------------------------------------- Manifest constants + + + /** + * HTTP content type header name. + */ + public static final String CONTENT_TYPE = "Content-type"; + + + /** + * HTTP content disposition header name. + */ + public static final String CONTENT_DISPOSITION = "Content-disposition"; + + + /** + * Content-disposition value for form data. + */ + public static final String FORM_DATA = "form-data"; + + + /** + * Content-disposition value for file attachment. + */ + public static final String ATTACHMENT = "attachment"; + + + /** + * Part of HTTP content type header. + */ + public static final String MULTIPART = "multipart/"; + + + /** + * HTTP content type header for multipart forms. + */ + public static final String MULTIPART_FORM_DATA = "multipart/form-data"; + + + /** + * HTTP content type header for multiple uploads. + */ + public static final String MULTIPART_MIXED = "multipart/mixed"; + + + /** + * The maximum length of a single header line that will be parsed + * (1024 bytes). + */ + public static final int MAX_HEADER_SIZE = 1024; + + + // ----------------------------------------------------------- Data members + + + /** + * The maximum size permitted for an uploaded file. A value of -1 indicates + * no maximum. + */ + private long sizeMax = -1; + + + /** + * The content encoding to use when reading part headers. + */ + private String headerEncoding; + + + // ----------------------------------------------------- Property accessors + + + /** + * Returns the factory class used when creating file items. + * + * @return The factory class for new file items. + */ + public abstract FileItemFactory getFileItemFactory(); + + + /** + * Sets the factory class to use when creating file items. + * + * @param factory The factory class for new file items. + */ + public abstract void setFileItemFactory(FileItemFactory factory); + + + /** + * Returns the maximum allowed upload size. + * + * @return The maximum allowed size, in bytes. + * + * @see #setSizeMax(long) + * + */ + public long getSizeMax() + { + return sizeMax; + } + + + /** + * Sets the maximum allowed upload size. If negative, there is no maximum. + * + * @param sizeMax The maximum allowed size, in bytes, or -1 for no maximum. + * + * @see #getSizeMax() + * + */ + public void setSizeMax(long sizeMax) + { + this.sizeMax = sizeMax; + } + + + /** + * Retrieves the character encoding used when reading the headers of an + * individual part. When not specified, or <code>null</code>, the platform + * default encoding is used. + * + * @return The encoding used to read part headers. + */ + public String getHeaderEncoding() + { + return headerEncoding; + } + + + /** + * Specifies the character encoding to be used when reading the headers of + * individual parts. When not specified, or <code>null</code>, the platform + * default encoding is used. + * + * @param encoding The encoding used to read part headers. + */ + public void setHeaderEncoding(String encoding) + { + headerEncoding = encoding; + } + + + // --------------------------------------------------------- Public methods + + + /** + * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> + * compliant <code>multipart/form-data</code> stream. If files are stored + * on disk, the path is given by <code>getRepository()</code>. + * + * @param req The servlet request to be parsed. + * + * @return A list of <code>FileItem</code> instances parsed from the + * request, in the order that they were transmitted. + * + * @exception FileUploadException if there are problems reading/parsing + * the request or storing files. + */ + public List /* FileItem */ parseRequest(ActionRequest req) + throws FileUploadException + { + if (null == req) + { + throw new NullPointerException("req parameter"); + } + + ArrayList items = new ArrayList(); + String contentType = req.getContentType(); + + if ((null == contentType) || (!contentType.startsWith(MULTIPART))) + { + throw new InvalidContentTypeException( + "the request doesn't contain a " + + MULTIPART_FORM_DATA + + " or " + + MULTIPART_MIXED + + " stream, content type header is " + + contentType); + } + int requestSize = req.getContentLength(); + + if (requestSize == -1) + { + throw new UnknownSizeException( + "the request was rejected because it's size is unknown"); + } + + if (sizeMax >= 0 && requestSize > sizeMax) + { + throw new SizeLimitExceededException( + "the request was rejected because " + + "it's size exceeds allowed range"); + } + + try + { + int boundaryIndex = contentType.indexOf("boundary="); + if (boundaryIndex < 0) + { + throw new FileUploadException( + "the request was rejected because " + + "no multipart boundary was found"); + } + byte[] boundary = contentType.substring( + boundaryIndex + 9).getBytes(); + + InputStream input = req.getPortletInputStream(); + + MultipartStream multi = new MultipartStream(input, boundary); + multi.setHeaderEncoding(headerEncoding); + + boolean nextPart = multi.skipPreamble(); + while (nextPart) + { + Map headers = parseHeaders(multi.readHeaders()); + String fieldName = getFieldName(headers); + if (fieldName != null) + { + String subContentType = getHeader(headers, CONTENT_TYPE); + if (subContentType != null && subContentType + .startsWith(MULTIPART_MIXED)) + { + // Multiple files. + byte[] subBoundary = + subContentType.substring( + subContentType + .indexOf("boundary=") + 9).getBytes(); + multi.setBoundary(subBoundary); + boolean nextSubPart = multi.skipPreamble(); + while (nextSubPart) + { + headers = parseHeaders(multi.readHeaders()); + if (getFileName(headers) != null) + { + FileItem item = + createItem(headers, false); + OutputStream os = item.getOutputStream(); + try + { + multi.readBodyData(os); + } + finally + { + os.close(); + } + items.add(item); + } + else + { + // Ignore anything but files inside + // multipart/mixed. + multi.discardBodyData(); + } + nextSubPart = multi.readBoundary(); + } + multi.setBoundary(boundary); + } + else + { + if (getFileName(headers) != null) + { + // A single file. + FileItem item = createItem(headers, false); + OutputStream os = item.getOutputStream(); + try + { + multi.readBodyData(os); + } + finally + { + os.close(); + } + items.add(item); + } + else + { + // A form field. + FileItem item = createItem(headers, true); + OutputStream os = item.getOutputStream(); + try + { + multi.readBodyData(os); + } + finally + { + os.close(); + } + items.add(item); + } + } + } + else + { + // Skip this part. + multi.discardBodyData(); + } + nextPart = multi.readBoundary(); + } + } + catch (IOException e) + { + throw new FileUploadException( + "Processing of " + MULTIPART_FORM_DATA + + " request failed. " + e.getMessage()); + } + + return items; + } + + + // ------------------------------------------------------ Protected methods + + + /** + * Retrieves the file name from the <code>Content-disposition</code> + * header. + * + * @param headers A <code>Map</code> containing the HTTP request headers. + * + * @return The file name for the current <code>encapsulation</code>. + */ + protected String getFileName(Map /* String, String */ headers) + { + String fileName = null; + String cd = getHeader(headers, CONTENT_DISPOSITION); + if (cd.startsWith(FORM_DATA) || cd.startsWith(ATTACHMENT)) + { + int start = cd.indexOf("filename=\""); + int end = cd.indexOf('"', start + 10); + if (start != -1 && end != -1) + { + fileName = cd.substring(start + 10, end).trim(); + } + } + return fileName; + } + + + /** + * Retrieves the field name from the <code>Content-disposition</code> + * header. + * + * @param headers A <code>Map</code> containing the HTTP request headers. + * + * @return The field name for the current <code>encapsulation</code>. + */ + protected String getFieldName(Map /* String, String */ headers) + { + String fieldName = null; + String cd = getHeader(headers, CONTENT_DISPOSITION); + if (cd != null && cd.startsWith(FORM_DATA)) + { + int start = cd.indexOf("name=\""); + int end = cd.indexOf('"', start + 6); + if (start != -1 && end != -1) + { + fieldName = cd.substring(start + 6, end); + } + } + return fieldName; + } + + + /** + * Creates a new {@link FileItem} instance. + * + * @param headers A <code>Map</code> containing the HTTP request + * headers. + * @param isFormField Whether or not this item is a form field, as + * opposed to a file. + * + * @return A newly created <code>FileItem</code> instance. + * + * @exception FileUploadException if an error occurs. + */ + protected FileItem createItem(Map /* String, String */ headers, + boolean isFormField) + throws FileUploadException + { + return getFileItemFactory().createItem(getFieldName(headers), + getHeader(headers, CONTENT_TYPE), + isFormField, + getFileName(headers)); + } + + + /** + * <p> Parses the <code>header-part</code> and returns as key/value + * pairs. + * + * <p> If there are multiple headers of the same names, the name + * will map to a comma-separated list containing the values. + * + * @param headerPart The <code>header-part</code> of the current + * <code>encapsulation</code>. + * + * @return A <code>Map</code> containing the parsed HTTP request headers. + */ + protected Map /* String, String */ parseHeaders(String headerPart) + { + Map headers = new HashMap(); + char buffer[] = new char[MAX_HEADER_SIZE]; + boolean done = false; + int j = 0; + int i; + String header, headerName, headerValue; + try + { + while (!done) + { + i = 0; + // Copy a single line of characters into the buffer, + // omitting trailing CRLF. + while (i < 2 || buffer[i - 2] != '\r' || buffer[i - 1] != '\n') + { + buffer[i++] = headerPart.charAt(j++); + } + header = new String(buffer, 0, i - 2); + if (header.equals("")) + { + done = true; + } + else + { + if (header.indexOf(':') == -1) + { + // This header line is malformed, skip it. + continue; + } + headerName = header.substring(0, header.indexOf(':')) + .trim().toLowerCase(); + headerValue = + header.substring(header.indexOf(':') + 1).trim(); + if (getHeader(headers, headerName) != null) + { + // More that one heder of that name exists, + // append to the list. + headers.put(headerName, + getHeader(headers, headerName) + ',' + + headerValue); + } + else + { + headers.put(headerName, headerValue); + } + } + } + } + catch (IndexOutOfBoundsException e) + { + // Headers were malformed. continue with all that was + // parsed. + } + return headers; + } + + + /** + * Returns the header with the specified name from the supplied map. The + * header lookup is case-insensitive. + * + * @param headers A <code>Map</code> containing the HTTP request headers. + * @param name The name of the header to return. + * + * @return The value of specified header, or a comma-separated list if + * there were multiple headers of that name. + */ + protected final String getHeader(Map /* String, String */ headers, + String name) + { + return (String) headers.get(name.toLowerCase()); + } + + + /** + * Thrown to indicate that the request is not a multipart request. + */ + public static class InvalidContentTypeException + extends FileUploadException + { + /** + * Constructs a <code>InvalidContentTypeException</code> with no + * detail message. + */ + public InvalidContentTypeException() + { + super(); + } + + /** + * Constructs an <code>InvalidContentTypeException</code> with + * the specified detail message. + * + * @param message The detail message. + */ + public InvalidContentTypeException(String message) + { + super(message); + } + } + + + /** + * Thrown to indicate that the request size is not specified. + */ + public static class UnknownSizeException + extends FileUploadException + { + /** + * Constructs a <code>UnknownSizeException</code> with no + * detail message. + */ + public UnknownSizeException() + { + super(); + } + + /** + * Constructs an <code>UnknownSizeException</code> with + * the specified detail message. + * + * @param message The detail message. + */ + public UnknownSizeException(String message) + { + super(message); + } + } + + + /** + * Thrown to indicate that the request size exceeds the configured maximum. + */ + public static class SizeLimitExceededException + extends FileUploadException + { + /** + * Constructs a <code>SizeExceededException</code> with no + * detail message. + */ + public SizeLimitExceededException() + { + super(); + } + + /** + * Constructs an <code>SizeExceededException</code> with + * the specified detail message. + * + * @param message The detail message. + */ + public SizeLimitExceededException(String message) + { + super(message); + } + } + +} \ No newline at end of file Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-23 13:29:37 UTC (rev 921) @@ -13,10 +13,10 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.lang.reflect.Array; -import java.util.Calendar; import java.util.Date; +import java.util.HashSet; import java.util.Properties; +import java.util.Set; /** * <p> @@ -35,8 +35,12 @@ private String pathToMedia; + private String pathToAttachements; + private Properties fileDSProps; + private final int BUF_SIZE = 32768; + public FileDataSource() { System.out.println("Looking for props file"); @@ -58,6 +62,9 @@ if (fileDSProps.getProperty("pathToMedia") != null) { pathToMedia = fileDSProps.getProperty("pathToMedia"); System.out.println("Path to media is: " + pathToMedia); + pathToAttachements = fileDSProps.getProperty("pathToAttachements"); + System.out + .println("Path to attachements is: " + pathToAttachements); } else { System.err .println("Your properties file lacks of pathToMedia property. It will not run properly ! Please update " @@ -205,6 +212,53 @@ return pageProps; } + public Properties getAttProps(String pageName, String attName) { + Properties attProps = new Properties(); + + File propFile = new File(pathToAttachements + "/" + pageName + "-att/" + + attName + "-dir/"); + + if (!propFile.exists()) { + // create dirs for this property file + propFile.mkdirs(); + } + + propFile = new File(pathToAttachements + "/" + pageName + "-att/" + + attName + "-dir/attachement.properties"); + + try { + attProps.load(new FileInputStream(propFile)); + } catch (IOException ioe) { + System.err + .println("Cannot read attachement.properties for attachement: " + + pathToAttachements + + "/" + + pageName + + "-att/" + + attName + "-dir/attachements.properties\n" + ioe); + } + + return attProps; + } + + public void saveAttProps(Properties props, String pageName, String attName) { + try { + props.store(new FileOutputStream(new File(pathToAttachements + "/" + + pageName + "-att/" + attName + + "-dir/attachement.properties")), + "Saved by FileDataSource of JBoss Wiki"); + } catch (Exception ioe) { + System.err + .println("Cannot store attachement.properties for attachement: " + + pathToAttachements + + "/" + + pageName + + "-att/" + + attName + "-dir/attachements.properties\n" + ioe); + } + + } + public WikiPage getPage(String pageName) { System.out.println("[WIKI:FileDataSource]: Getting new page: " + pageName); @@ -246,7 +300,7 @@ page = new WikiPage(pageName, author, pageContent, i, i, new Date(pageFile.lastModified()), this); - + page.setLength(pageFile.length()); } } @@ -345,10 +399,10 @@ ret += (char) nextChr; nextChr = input.read(); } - + page.setPageContent(ret); page.setLength(ret.length()); - + } catch (IOException ioe) { System.err.println(ioe); } @@ -356,7 +410,7 @@ page.setLength(pageFile.length()); page.setPageContent(null); } - + } public Date getDateAtVersion(String pageName, int version) { @@ -375,34 +429,6 @@ version + ".author")); } - /* - * public static void main(String[] args) { MediaDataSource fds = new - * FileDataSource(); - * - * String[] pageName = { "Rali", "Tomek", "Adam", "Dupa", "WhatIsJBossForge" }; - * - * for (int i = 0; i < Array.getLength(pageName); i++) { WikiPage page = - * fds.getPage(pageName[i]); - * - * if (page != null) { page.showPage(); } else { System.out.println("Page " + - * pageName[i] + " doesn't exist"); } } - * - * WikiPage page = fds.getPageAtVersion("WhatIsJBossForge", 7); - * - * if (page != null) { page.showPage(); } else { System.out .println("Page - * WhatIsJBossForge doesn't exist at version 7"); } - * - * page = fds.getPageAtVersion("Dupa", 7); - * - * if (page != null) { page.showPage(); } else { System.out.println("Page - * Dupa doesn't exist at version 7"); } - * - * page = fds.getPageAtVersion("WhatIsJBossForge", 70); - * - * if (page != null) { page.showPage(); } else { System.out .println("Page - * WhatIsJBossForge doesn't exist at version 70"); } } - */ - public boolean pageExists(String pageName) { File pageFile = new File(pathToMedia + "/" + pageName + ".txt"); @@ -413,4 +439,88 @@ } } + public void addAtachement(File attFile, String attName, WikiPage page, String user) { + String pageName = page.getName(); + Properties attProps = getAttProps(pageName, attName); + + int lastVersion = 1; + + if (attProps.size() > 0) { + // find last version of this file + while (attProps.getProperty(lastVersion + ".author") != null) { + lastVersion++; + } + } + + String[] extension = attName.split("\\."); + String fileName = pathToAttachements + + "/" + + pageName + + "-att/" + + attName + + "-dir/" + + lastVersion + + "." + + ((attName.indexOf('.') != -1) ? extension[extension.length - 1] + : "bin"); + + FileInputStream oldFile = null; + FileOutputStream newFile = null; + + try { + newFile = new FileOutputStream(new File(fileName)); + oldFile = new FileInputStream(attFile); + } catch (FileNotFoundException e) { + System.err.println(e); + } + + // writing old file to new one + try { + byte[] buffer = new byte[BUF_SIZE]; + int read; + while ((read = oldFile.read(buffer)) != -1) + newFile.write(buffer, 0, read); + } catch (Exception e2) { + // Nothing that we can really do. Just send an incomplete + // file. + } finally { + try { + newFile.close(); + oldFile.close(); + } catch (IOException e) { + System.err.println(e); + } + } + + // at the end delete the temp file + attFile.delete(); + + attProps.setProperty(lastVersion + ".author", user); + + saveAttProps(attProps, pageName, attName); + } + + public Set<String> getAttachementsSet(WikiPage page) { + Set<String> attSet = new HashSet<String>(); + + File attDir = new File(pathToAttachements+"/"+page.getName()+"-att"); + + if (attDir.exists()) { + File[] attachements = attDir.listFiles(); + + for (int i = 0; i < attachements.length; i++) { + if ((attachements[i].isDirectory())&&(attachements[i].getName().endsWith("-dir"))) { + String[] tokens = attachements[i].getName().split("/"); + attSet.add(tokens[tokens.length - 1].substring(0, tokens[tokens.length - 1].length()-4)); + } + } + } + else { + // page has no attachements + return null; + } + + return attSet; + } + } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java 2005-08-23 13:29:37 UTC (rev 921) @@ -7,6 +7,10 @@ * * *************************************************/ package org.jboss.wiki; + +import java.io.File; +import java.util.Set; + /** * <p></p> * @@ -84,6 +88,10 @@ public void getContentAtVersion(WikiPage page, boolean loadContent, int version); + + public void addAtachement(File attFile, String attName, WikiPage page, String user); + + public Set<String> getAttachementsSet(WikiPage page); } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-23 13:29:37 UTC (rev 921) @@ -8,10 +8,12 @@ *************************************************/ package org.jboss.wiki; +import java.io.File; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import java.util.HashMap; +import java.util.Set; import org.jboss.portal.core.model.User; @@ -375,4 +377,12 @@ public void setLength(long length) { this.length = length; } + + public void addAttachement(File attFile, String attName, String user) { + mediaDataSource.addAtachement(attFile, attName, this, user); + } + + public Set<String> getAttachementsSet() { + return mediaDataSource.getAttachementsSet(this); + } } Deleted: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPluginChain.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPluginChain.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPluginChain.java 2005-08-23 13:29:37 UTC (rev 921) @@ -1,64 +0,0 @@ -/************************************************** - * * - * JBoss Labs: Creating Professional Open Source * - * * - * Distributable under LGPL license. * - * See terms of license at gnu.org. * - * * - *************************************************/ - package org.jboss.wiki; - -import java.util.List; - -/** - * <p></p> - * - */ - /** - * - * @author <a href="mailto:ds...@jb...">Damon Sicore</a> - * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> - * @version $Id$ - */ -public class WikiPluginChain { - -/** - * <p>Represents ...</p> - * - */ - private List pluginList; -/** - * <p></p> - * - */ - public WikiType wikiType; - -/** - * <p>Does ...</p> - * - * - * @return - * @param wikiPlugin - */ - public void addPlugin(WikiPlugin wikiPlugin) { - // your code here - //return null; - } - -/** - * <p>Does ...</p> - * - * - * @return - * @param pluginDescriptor - */ - public void init(PluginDescriptor pluginDescriptor) { - // your code here - //return null; - } -/** - * <p></p> - * - */ - public WikiPlugin wikiPlugin; - } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-23 13:29:37 UTC (rev 921) @@ -8,12 +8,17 @@ *************************************************/ package org.jboss.wiki; -import java.util.Calendar; +import java.io.File; import java.util.Date; -import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import javax.portlet.*; import org.jboss.portlet.*; +import org.apache.commons.fileupload.PortletDiskFileUpload; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.commons.fileupload.FileItem; /** * The WikiPortlet. @@ -42,6 +47,69 @@ WikiContext wikiContext = null; + if (PortletDiskFileUpload.isMultipartContent(rReq)) { + PortletDiskFileUpload dfu = new PortletDiskFileUpload(); + + // maximum allowed file upload size (10 MB) + dfu.setSizeMax(10 * 1000 * 1000); + + // maximum size in memory (vs disk) (100 KB) + dfu.setSizeThreshold(100 * 1000); + + try { + // get the FileItems + List fileItems = dfu.parseRequest(rReq); + Iterator iter = fileItems.iterator(); + while (iter.hasNext()) { + FileItem item = (FileItem) iter.next(); + if (item.isFormField()) { + // pass along to render request + String fieldName = item.getFieldName(); + String value = item.getString(); + rResp.setRenderParameter(fieldName, value); + } else { + // write the uploaded file to a new location + String fieldName = item.getFieldName(); + String fileName = item.getName(); + String contentType = item.getContentType(); + long size = item.getSize(); + /* + * rResp .setRenderParameter("size", + * Long.toString(size)); + * rResp.setRenderParameter("contentType", contentType); + */ + String tempDir = System.getProperty("java.io.tmpdir"); + String serverFileName = fieldName + "-portlet.tmp"; + + File serverFile = new File(tempDir, serverFileName); + + item.write(serverFile); + /* + * rResp.setRenderParameter("serverFileName", + * serverFileName); + */ + getPortletContext().log( + "serverFileName : " + tempDir + "/" + + serverFileName + " filename: " + + fileName); + + WikiPage pageWithAtt = wikiEngine.getByName(rReq + .getParameter("page"), null); + pageWithAtt.addAttachement(serverFile, fileName, rReq + .getUser().getUserName()); + } + } + } catch (FileUploadException fue) { + String msg = "File Upload Exception: " + fue.getMessage(); + rResp.setRenderParameter("error", msg); + getPortletContext().log(msg, fue); + } catch (Exception e) { + String msg = "Exception: " + e.getMessage(); + rResp.setRenderParameter("error", msg); + getPortletContext().log(msg, e); + } + } + if (rReq.getParameter("action") != null) { rResp.setRenderParameter("action", rReq.getParameter("action")); } @@ -49,7 +117,7 @@ if (rReq.getParameter("type") != null) { rResp.setRenderParameter("type", rReq.getParameter("type")); } - + if (rReq.getParameter("version") != null) { System.out.println("[process action]Getting page " + rReq.getParameter("page") + " at version " @@ -138,19 +206,19 @@ page = "Edit.jsp"; pageToShow = wikiEngine.getByName(wikiPage, null); - + if (rReq.getParameter("version") != null) { // show previous version of page System.out.println("Getting page " + wikiPage + " at version " + rReq.getParameter("version")); - pageToShow = wikiEngine.getByName(wikiPage, null, - Integer.valueOf(rReq.getParameter("version"))); + pageToShow = wikiEngine.getByName(wikiPage, null, Integer + .valueOf(rReq.getParameter("version"))); rReq.setAttribute("showedVersion", Integer.valueOf(rReq .getParameter("version"))); } else { pageToShow = wikiEngine.getByName(wikiPage, null); } - + if (pageToShow == null) { // start editing new page // wikiPage = defaultPage; @@ -181,7 +249,7 @@ pageToShow = wikiEngine.getByName(wikiPage, null); if (pageToShow == null) { // if somebody entered a link to info - // non-existing page + // non-existing page page = "Wiki.jsp"; try { pageToShow = (WikiPage) noSuchPage.clone(); @@ -198,16 +266,16 @@ page = "Wiki.jsp"; String type = "HTML"; - + if (rReq.getParameter("type") != null) { type = rReq.getParameter("type"); - System.out.println("Getting type: "+type); + System.out.println("Getting type: " + type); } - + wikiContext = new WikiContext(rReq.getUser(), wikiEngine - .getWikiType(type), new PortletWikiSession(rReq.getPortletSession())); + .getWikiType(type), new PortletWikiSession(rReq + .getPortletSession())); - if (rReq.getParameter("version") != null) { // show previous version of page System.out.println("Getting page " + wikiPage + " at version " Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java 2005-08-23 13:29:37 UTC (rev 921) @@ -49,13 +49,6 @@ * </p> * */ - protected WikiPluginChain wikiPluginChain; - - /** - * <p> - * </p> - * - */ protected WikiContext wikiContext; protected Vector<WikiPlugin> plugins = new Vector<WikiPlugin>(); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 09:08:00 UTC (rev 920) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 13:29:37 UTC (rev 921) @@ -13,7 +13,6 @@ import java.io.IOException; import java.util.Properties; - import javax.activation.MimetypesFileTypeMap; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -43,36 +42,36 @@ private final int BUF_SIZE = 32768; private String attachementsPath; - + /* * private ForgeHelper forgeHelper; private ContentManager contentManager; - */ - private MimetypesFileTypeMap mimeTypes; - + */ + private MimetypesFileTypeMap mimeTypes; public void init(FilterConfig conf) { // load mime types map - - mimeTypes = new MimetypesFileTypeMap(WikiFileAccessFilter.class.getResourceAsStream("mime.types")); - + + mimeTypes = new MimetypesFileTypeMap(WikiFileAccessFilter.class + .getResourceAsStream("mime.types")); + // load path to attachements from filedatasource.properties - + Properties props = new Properties(); - + try { - props.load(FileDataSource.class.getResourceAsStream("filedatasource.properties")); - } - catch (IOException e) { + props.load(FileDataSource.class + .getResourceAsStream("filedatasource.properties")); + } catch (IOException e) { System.err.println(e); } - + // get the apropriate property attachementsPath = props.getProperty("pathToAttachements"); - - System.out.println("[WikiFileAccess]Loaded attachements path: "+attachementsPath); + + System.out.println("[WikiFileAccess]Loaded attachements path: " + + attachementsPath); } - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException { @@ -87,19 +86,26 @@ // get fileName of attachement and page which is connected to String fileName = tokens[tokens.length - 1]; String pageName = tokens[tokens.length - 2]; - - System.out.println("[WikiFileAccess]Getting file: "+fileName+" of page: "+pageName); - + + System.out.println(... [truncated message content] |
From: <jbo...@li...> - 2005-08-23 09:08:16
|
Author: szimano Date: 2005-08-23 05:08:00 -0400 (Tue, 23 Aug 2005) New Revision: 920 Added: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/fileaccess/ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/fileaccess/mime.types trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java Removed: trunk/forge/portal-extensions/wiki-file-access/ Modified: trunk/forge/portal-extensions/forge-jspwiki/maven.xml trunk/forge/portal-extensions/forge-wiki/project.xml trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/filedatasource.properties trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/web.xml trunk/forge/portal-extensions/jspwiki/maven.xml Log: wiki file access moved to wiki... use http:/domain/wiki/page/file Modified: trunk/forge/portal-extensions/forge-jspwiki/maven.xml =================================================================== --- trunk/forge/portal-extensions/forge-jspwiki/maven.xml 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/forge-jspwiki/maven.xml 2005-08-23 09:08:00 UTC (rev 920) @@ -14,10 +14,10 @@ </goal> <goal name="deploy"> - <!--<ant:copy todir="${local.deploy.dir}" flatten="true"> + <ant:copy todir="${local.deploy.dir}" flatten="true"> <ant:fileset dir="."> <ant:filename name="target/*.war" /> </ant:fileset> - </ant:copy>--> + </ant:copy> </goal> -</project> \ No newline at end of file +</project> Modified: trunk/forge/portal-extensions/forge-wiki/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/project.xml 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/forge-wiki/project.xml 2005-08-23 09:08:00 UTC (rev 920) @@ -7,7 +7,7 @@ <project> <pomVersion>3</pomVersion> <extend>../common.xml</extend> - <id>wiki-portlet</id> + <id>wiki</id> <name>Wiki portlet</name> <currentVersion>1.0</currentVersion> <!--<build> @@ -24,24 +24,43 @@ <url>http://mamut.net.pl</url> </organization> - <dependency> - <groupId>aslibs</groupId> - <artifactId>javax.servlet</artifactId> - <version>1.0</version> - <jar>javax.servlet.jar</jar> - </dependency> - - <dependency> - <groupId>aslibs</groupId> - <artifactId>javax.servlet.jsp</artifactId> - <version>1.0</version> - <jar>javax.servlet.jsp.jar</jar> - </dependency> - <dependency> - <groupId>junit</groupId> - <version>3.8.1</version> - <jar>javax.servlet.jsp.jar</jar> - </dependency> + <dependencies> + + <dependency> + <groupId>aslibs</groupId> + <artifactId>javax.servlet</artifactId> + <version>1.0</version> + <jar>javax.servlet.jar</jar> + </dependency> + + <dependency> + <groupId>aslibs</groupId> + <artifactId>javax.servlet.jsp</artifactId> + <version>1.0</version> + <jar>javax.servlet.jsp.jar</jar> + </dependency> + + <dependency> + <groupId>tmate</groupId> + <artifactId>javasvn</artifactId> + <version>1.0</version> + <jar>javasvn.jar</jar> + </dependency> + + <dependency> + <groupId>tmate</groupId> + <artifactId>jsch</artifactId> + <version>1.0</version> + <jar>jsch.jar</jar> + </dependency> + + <dependency> + <groupId>jboss</groupId> + <artifactId>activation</artifactId> + <version>1.0</version> + <jar>activation.jar</jar> + </dependency> + </dependencies> <build> <sourceDirectory>src/java</sourceDirectory> @@ -54,6 +73,10 @@ <directory>src/etc/</directory> <include>**/*.xml</include> </resource> + <resource> + <directory>src/etc/</directory> + <include>**/*.types</include> + </resource> </resources> </build> </project> Added: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/fileaccess/mime.types =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/fileaccess/mime.types 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/fileaccess/mime.types 2005-08-23 09:08:00 UTC (rev 920) @@ -0,0 +1,21 @@ +application/postscript ai eps ps +application/rtf rtf +application/slate +application/x-tex tex +application/x-texinfo texinfo texi +application/x-troff t tr roff +audio/basic au snd +audio/x-aiff aif aiff aifc +audio/x-wav wav +image/gif gif +image/ief ief +image/png png +image/jpeg jpeg jpg jpe +image/tiff tiff tif +image/x-xwindowdump xwd +text/html html +text/plain txt +video/mpeg mpeg mpg mpe +video/quicktime qt mov +video/x-msvideo avi +video/x-sgi-movie movie Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/filedatasource.properties =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/filedatasource.properties 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/filedatasource.properties 2005-08-23 09:08:00 UTC (rev 920) @@ -2,3 +2,6 @@ # pathToMedia - points, where JSPWiki file structure is situated pathToMedia = /usr/local/forge/wiki + +# pathToAttachements - points, where JSPWiki attachemets are situated +pathToAttachements = /usr/local/forge/wiki \ No newline at end of file Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-23 09:08:00 UTC (rev 920) @@ -0,0 +1,129 @@ +/***************************************** + * * + * JBoss Portal: The OpenSource Portal * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.wiki.fileaccess; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + + +import javax.activation.MimetypesFileTypeMap; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import javax.servlet.http.HttpServletRequest; + +import org.jboss.wiki.FileDataSource; + +// import org.jboss.forge.common.content.ContentManager; +// import org.jboss.forge.common.ForgeHelper; + +/** + * A filter that enables to download files which are stored in a working copy of + * a content repository. + * + * @author adamw + */ +public class WikiFileAccessFilter implements Filter { + /** + * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a + * file and sending it to the client. + */ + private final int BUF_SIZE = 32768; + + private String attachementsPath; + + /* + * private ForgeHelper forgeHelper; private ContentManager contentManager; + */ + private MimetypesFileTypeMap mimeTypes; + + + public void init(FilterConfig conf) { + // load mime types map + + mimeTypes = new MimetypesFileTypeMap(WikiFileAccessFilter.class.getResourceAsStream("mime.types")); + + // load path to attachements from filedatasource.properties + + Properties props = new Properties(); + + try { + props.load(FileDataSource.class.getResourceAsStream("filedatasource.properties")); + } + catch (IOException e) { + System.err.println(e); + } + + // get the apropriate property + attachementsPath = props.getProperty("pathToAttachements"); + + System.out.println("[WikiFileAccess]Loaded attachements path: "+attachementsPath); + } + + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException { + + if (request instanceof HttpServletRequest) { + HttpServletRequest httpRequest = (HttpServletRequest) request; + + String requestURI = httpRequest.getRequestURI(); + + // Parse URI to get filename and page name + String[] tokens = requestURI.split("[/]"); + + // get fileName of attachement and page which is connected to + String fileName = tokens[tokens.length - 1]; + String pageName = tokens[tokens.length - 2]; + + System.out.println("[WikiFileAccess]Getting file: "+fileName+" of page: "+pageName); + + tokens = fileName.split("\\."); + + System.out.println(attachementsPath+"/"+pageName+"-att/"+fileName+"-dir/1."+tokens[tokens.length - 1]); + + File file = new File(attachementsPath+"/"+pageName+"-att/"+fileName+"-dir/1."+tokens[tokens.length - 1]); + + FileInputStream fileIS = new FileInputStream(file); + + ServletOutputStream os = response.getOutputStream(); + + response.setContentType(mimeTypes.getContentType(file)); + response.setContentLength((int) file.length()); + + // Transferring the bytes + try { + byte[] buffer = new byte[BUF_SIZE]; + int read; + while ((read = fileIS.read(buffer)) != -1) + os.write(buffer, 0, read); + } catch (Exception e2) { + // Nothing that we can really do. Just send an incomplete + // file. + } finally { + os.close(); + fileIS.close(); + } + + } + else { + throw new IOException("This servlet should be called as HTTPServletRequest"); + } + } + + public void destroy() { + + } +} Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/web.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/web.xml 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/web.xml 2005-08-23 09:08:00 UTC (rev 920) @@ -7,4 +7,14 @@ <web-app> + <filter> + <filter-name>wikiFileAccessFilter</filter-name> + <filter-class>org.jboss.wiki.fileaccess.WikiFileAccessFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>wikiFileAccessFilter</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + </filter-mapping> </web-app> Modified: trunk/forge/portal-extensions/jspwiki/maven.xml =================================================================== --- trunk/forge/portal-extensions/jspwiki/maven.xml 2005-08-22 22:57:02 UTC (rev 919) +++ trunk/forge/portal-extensions/jspwiki/maven.xml 2005-08-23 09:08:00 UTC (rev 920) @@ -9,11 +9,11 @@ </goal> <goal name="deploy"> - <!--<ant:copy todir="${local.deploy.dir}" flatten="true"> + <ant:copy todir="${local.deploy.dir}" flatten="true"> <ant:fileset dir="."> <ant:filename name="releases/*.war" /> </ant:fileset> - </ant:copy>--> + </ant:copy> </goal> <goal name="prj-install"> @@ -21,4 +21,4 @@ <ant:fileset dir="to-copy" /> </ant:copy> </goal> -</project> \ No newline at end of file +</project> |
From: <jbo...@li...> - 2005-08-22 22:57:11
|
Author: szimano Date: 2005-08-22 18:57:02 -0400 (Mon, 22 Aug 2005) New Revision: 919 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java Log: changes Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-22 22:56:48 UTC (rev 918) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-22 22:57:02 UTC (rev 919) @@ -46,6 +46,10 @@ rResp.setRenderParameter("action", rReq.getParameter("action")); } + if (rReq.getParameter("type") != null) { + rResp.setRenderParameter("type", rReq.getParameter("type")); + } + if (rReq.getParameter("version") != null) { System.out.println("[process action]Getting page " + rReq.getParameter("page") + " at version " @@ -193,15 +197,17 @@ } else { page = "Wiki.jsp"; - if ((rReq.getParameter("action") != null) - && (rReq.getParameter("action").equals("Diff"))) { - wikiContext = new WikiContext(rReq.getUser(), wikiEngine - .getWikiType("DIFF"), new PortletWikiSession(rReq.getPortletSession())); - } else { - wikiContext = new WikiContext(rReq.getUser(), wikiEngine - .getWikiType("HTML"), new PortletWikiSession(rReq.getPortletSession())); + String type = "HTML"; + + if (rReq.getParameter("type") != null) { + type = rReq.getParameter("type"); + System.out.println("Getting type: "+type); } + + wikiContext = new WikiContext(rReq.getUser(), wikiEngine + .getWikiType(type), new PortletWikiSession(rReq.getPortletSession())); + if (rReq.getParameter("version") != null) { // show previous version of page System.out.println("Getting page " + wikiPage + " at version " |
From: <jbo...@li...> - 2005-08-22 22:56:51
|
Author: szimano Date: 2005-08-22 18:56:48 -0400 (Mon, 22 Aug 2005) New Revision: 918 Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp Log: changes... Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-08-22 22:54:39 UTC (rev 917) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-08-22 22:56:48 UTC (rev 918) @@ -58,7 +58,7 @@ "</td><td>"+ author + "</td><td>"+prevWikiPage.getLength()+ - "</td><td>"+ ((i > 1) ? "<a href='"+actionURL+"&action=Diff&version="+i+"&page="+wikiPage+"'>Changes from "+(i-1)+" to "+i+"</a>" : "") +"</td>"); + "</td><td>"+ ((i > 1) ? "<a href='"+actionURL+"&type=DIFF&version="+i+"&page="+wikiPage+"'>Changes from "+(i-1)+" to "+i+"</a>" : "") +"</td>"); } %> </table> |