You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2005/02/17 23:57:30 UTC
svn commit: r154214 [2/10] - in incubator/graffito/trunk/applications: ./
browser/ browser/src/ browser/src/java/ browser/src/java/org/
browser/src/java/org/apache/ browser/src/java/org/apache/portals/
browser/src/java/org/apache/portals/graffito/
browser/src/java/org/apache/portals/graffito/portlets/
browser/src/java/org/apache/portals/graffito/portlets/resources/
browser/src/java/org/apache/portals/graffito/portlets/util/
browser/src/java/org/apache/portals/graffito/servlets/
browser/src/java/org/apache/portals/graffito/util/ browser/src/webapp/
browser/src/webapp/WEB-INF/ browser/src/webapp/WEB-INF/tabs/
browser/src/webapp/WEB-INF/velocity/ browser/src/webapp/WEB-INF/view/
browser/src/webapp/WEB-INF/view/document/
browser/src/webapp/WEB-INF/view/folder/
browser/src/webapp/WEB-INF/view/security/ browser/src/webapp/kupu/
browser/src/webapp/kupu/kupudrawers/
browser/src/webapp/kupu/kupudrawers/logos/
browser/src/webapp/kupu/kupuimages/ browser/src/webapp/kupu/kupupopups/
Added: incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletDiskFileUpload.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletDiskFileUpload.java?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletDiskFileUpload.java (added)
+++ incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletDiskFileUpload.java Thu Feb 17 15:57:09 2005
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package org.apache.portals.graffito.portlets.util;
+
+
+import java.io.File;
+import java.util.List;
+import javax.portlet.ActionRequest;
+
+import org.apache.commons.fileupload.DefaultFileItemFactory;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+
+
+
+/**
+ * <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:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @author Sean C. Sullivan
+ *
+ * @version $Id: 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 parseRequest(ActionRequest req, int sizeThreshold, long sizeMax, String path)
+ throws FileUploadException
+ {
+ setSizeThreshold(sizeThreshold);
+ setSizeMax(sizeMax);
+ setRepositoryPath(path);
+ return parseRequest(req);
+ }
+
+}
Added: incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUpload.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUpload.java?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUpload.java (added)
+++ incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUpload.java Thu Feb 17 15:57:09 2005
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package org.apache.portals.graffito.portlets.util;
+
+import org.apache.commons.fileupload.FileItemFactory;
+
+
+/**
+ * <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:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">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: incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUploadBase.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUploadBase.java?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUploadBase.java (added)
+++ incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/util/PortletFileUploadBase.java Thu Feb 17 15:57:09 2005
@@ -0,0 +1,698 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+
+package org.apache.portals.graffito.portlets.util;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.portlet.ActionRequest;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.MultipartStream;
+
+import sun.reflect.FieldInfo;
+
+
+/**
+ * <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:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author Sean C. Sullivan
+ *
+ * @version $Id: Exp $
+ */
+public abstract class PortletFileUploadBase
+{
+
+
+ /**
+ * 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;
+
+
+ /**
+ * FileItem found in the multipart data form
+ */
+ private List fileItems;
+
+ // ----------------------------------------------------- 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 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;
+ }
+
+
+ /**
+ * Check if a field name is defined in the multipart form
+ *
+ * @param request The portlet request
+ * @param fieldName The field name to check
+ * @return true if the field name is present
+ */
+ public boolean hasFieldName(ActionRequest request, String fieldName)
+ {
+ try
+ {
+ if (fileItems == null)
+ {
+ fileItems = this.parseRequest(request);
+ }
+
+ for (int i = 0; i<fileItems.size(); i++)
+ {
+ if (((FileItem)fileItems.get(i)).getFieldName().equals(fieldName))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ catch(Exception e)
+ {
+ return false;
+ }
+ }
+
+ public FileItem getFileItem(ActionRequest request, String fileItemName) throws FileUploadException
+ {
+
+ if (fileItems == null)
+ {
+ fileItems = this.parseRequest(request);
+ }
+
+ for (int i = 0; i<fileItems.size(); i++)
+ {
+ FileItem fileItem = (FileItem)fileItems.get(i);
+ if (fileItem.getFieldName().equals(fileItemName))
+ {
+ return fileItem;
+ }
+ }
+
+ return null;
+ }
+
+ // ------------------------------------------------------ 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 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 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 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 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 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);
+ }
+ }
+
+}
Added: incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java (added)
+++ incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java Thu Feb 17 15:57:09 2005
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.servlets;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.services.JetspeedPortletServices;
+import org.apache.jetspeed.services.PortletServices;
+import org.apache.portals.graffito.ContentModelService;
+import org.apache.portals.graffito.exception.ContentManagementException;
+import org.apache.portals.graffito.model.Document;
+
+
+
+/**
+ * This servlet can be used to display a document stream like a word document, images, pdf, ....
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @version $Id: Exp $
+ */
+public class GraffitoViewerServlet extends HttpServlet
+{
+ /** URI REQUEST PARAM */
+ private static final String URI_PARAM = "uri";
+
+ static final int BLOCK_SIZE=4096;
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+
+ PortletServices services = JetspeedPortletServices.getSingleton();
+ ContentModelService modelService = (ContentModelService) services.getService("ContentModel");
+ if (null == modelService)
+ {
+ throw new ServletException("Failed to find the content model service");
+ }
+
+ String uri = (String) request.getParameter(URI_PARAM);
+ try
+ {
+ Document document = modelService.getDocument(uri);
+ if (document!=null)
+ {
+ response.setContentType(document.getContentType());
+ InputStream documentStream = document.getContent().getContentStream();
+ drain(documentStream, response.getOutputStream());
+ documentStream.close();
+ }
+ else
+ {
+ response.setContentType("text/html");
+ InputStream documentStream = new ByteArrayInputStream(new String(" ").getBytes());
+ drain(documentStream, response.getOutputStream());
+ documentStream.close();
+ }
+
+ }
+ catch (ContentManagementException e)
+ {
+ throw new ServletException("Failed to retrieve the document : " + uri);
+ }
+ }
+
+ /**
+ *
+ * @param r
+ * @param w
+ * @throws IOException
+ */
+ public static void drain(InputStream r,OutputStream w) throws IOException
+ {
+ byte[] bytes=new byte[BLOCK_SIZE];
+ try
+ {
+ int length=r.read(bytes);
+ while(length!=-1)
+ {
+ if(length!=0)
+ {
+ w.write(bytes,0,length);
+ }
+ length=r.read(bytes);
+ }
+ }
+ finally
+ {
+ bytes=null;
+ }
+
+ }
+
+
+}
Added: incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/util/GraffitoTools.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/util/GraffitoTools.java?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/util/GraffitoTools.java (added)
+++ incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/util/GraffitoTools.java Thu Feb 17 15:57:09 2005
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.util;
+
+import java.util.ArrayList;
+
+import org.apache.portals.graffito.model.CmsObject;
+import org.apache.portals.graffito.model.Document;
+import org.apache.portals.graffito.model.Folder;
+
+/**
+ *
+ * Velocity tools used for Graffito
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class GraffitoTools
+{
+ public static Folder[] getParents(CmsObject cmsObject)
+ {
+ ArrayList parents = new ArrayList();
+ Folder parent = cmsObject.getParentFolder();
+ while (parent != null)
+ {
+ parents.add(0,parent);
+ parent = parent.getParentFolder();
+ }
+
+ if (parents.size() == 0)
+ {
+ return null;
+ }
+
+ return (Folder[]) parents.toArray(new Folder[parents.size()]);
+
+ }
+
+ /**
+ * This method can be used in a velocity template to check if a document has to be view with the
+ * Graffito servlet viewer or not. HTML and text document can be display direclty in the portlet.
+ * Other content types (PDF, Open office documents, Ms Word, ...) require the Graffito viewer servlet.
+ *
+ * @param document the document to check
+ * @return true if the Graffito servlet viewer is required
+ */
+ public static boolean requireGraffitoViewer(Document document)
+ {
+
+ if (document.getContentType().equals("text/plain") || document.getContentType().equals("text/html"))
+ {
+ return false;
+ }
+
+ return true;
+ }
+}
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/jetspeed-portlet.xml?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/jetspeed-portlet.xml (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/jetspeed-portlet.xml Thu Feb 17 15:57:09 2005
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<portlet-app id="graffito-test" version="1.0"
+ xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:js="http://portals.apache.org/jetspeed"
+ xmlns:dc="http://www.purl.org/dc">
+
+ <portlet>
+ <portlet-name>BrowserPortlet</portlet-name>
+ <dc:title>Graffito Browser Portlet</dc:title>
+ <dc:creator>Graffito Team</dc:creator>
+ </portlet>
+
+
+ <js:services>
+ <js:service name='ContentServer'/>
+ <js:service name='ContentModel'/>
+ </js:services>
+
+</portlet-app>
\ No newline at end of file
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/portlet.xml?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/portlet.xml (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/portlet.xml Thu Feb 17 15:57:09 2005
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<portlet-app id="graffito-browser" version="1.0">
+ <portlet id="graffitoBrowser">
+ <description>Graffito Content Browser Portlet</description>
+ <portlet-name>graffitoBrowser</portlet-name>
+ <display-name>Graffito Browser</display-name>
+ <portlet-class>org.apache.portals.graffito.portlets.BrowserPortlet</portlet-class>
+ <init-param>
+ <name>AllowPreferences</name>
+ <value>true</value>
+ </init-param>
+ <init-param>
+ <name>ViewPage</name>
+ <value>/WEB-INF/view/folder/folder-browser.vm</value>
+ </init-param>
+ <init-param>
+ <name>EditPage</name>
+ <value>/WEB-INF/view/folder/folder-edit.vm</value>
+ </init-param>
+ <init-param>
+ <name>HelpPage</name>
+ <value>/WEB-INF/view/help.vm</value>
+ </init-param>
+ <init-param>
+ <name>TabConfig</name>
+ <value>/WEB-INF/tabs/tabs.xml</value>
+ </init-param>
+ <init-param>
+ <name>DocumentTypes</name>
+ <value>document.type.upload,document.type.text,document.type.html,document.type.news</value>
+ </init-param>
+ <init-param>
+ <name>DocumentLanguages</name>
+ <value>document.en,document.fr</value>
+ </init-param>
+
+ <expiration-cache>-1</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ <portlet-mode>HELP</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <resource-bundle>org.apache.portals.graffito.portlets.resources.messages</resource-bundle>
+ <portlet-preferences>
+ <preference>
+ <name>graffito.content.scope</name>
+ <value>/graffito</value>
+ </preference>
+ </portlet-preferences>
+ </portlet>
+</portlet-app>
+
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/tabs/tabs.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/tabs/tabs.xml?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/tabs/tabs.xml (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/tabs/tabs.xml Thu Feb 17 15:57:09 2005
@@ -0,0 +1,6 @@
+<tabs>
+ <tab id="folder">
+ <page id="General" label="tab.general" view= "/WEB-INF/view/folder-general.vm" />
+ <page id="Security" label="tab.security" view= "/WEB-INF/view/security.vm" />
+ </tab>
+</tabs>
\ No newline at end of file
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/graffito-macros.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/graffito-macros.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/graffito-macros.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/graffito-macros.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,135 @@
+#macro (formFieldInput $label $value $size $id $MESSAGES $ERRORS)
+ #if ($ERRORS)
+ #set ($eflag = "$!ERRORS.get($id)")
+ #else
+ #set ($eflag = "")
+ #end
+ <tr>
+ <th class="portlet-section-alternate"><font class="portlet-form-field-label">$!MESSAGES.getString($label)</font></th>
+ <td>
+ <input id="$!id" type="text" name="$!id" size="$!size" value="$!value" class="portlet-form-label-field">
+ </td>
+ #if ($!eflag == "")
+ <td width="5%" align="left"> </td>
+ #else
+ <td width="5%" class="portlet-msg-error" align="left"> </td>
+ #end
+ </tr>
+#end
+
+#macro (formFieldFile $label $value $size $id $MESSAGES $ERRORS)
+ #if ($ERRORS)
+ #set ($eflag = "$!ERRORS.get($id)")
+ #else
+ #set ($eflag = "")
+ #end
+ <tr>
+ <th class="portlet-section-alternate"><font class="portlet-form-field-label">$!MESSAGES.getString($label)</font></th>
+ <td>
+ <input id="$!id" type="file" name="$!id" size="$!size" value="$!value" class="portlet-form-label-field">
+ </td>
+ #if ($!eflag == "")
+ <td width="5%" align="left"> </td>
+ #else
+ <td width="5%" class="portlet-msg-error" align="left"> </td>
+ #end
+ </tr>
+#end
+
+#macro (formFieldSelect $label $elements $id $MESSAGES $ERRORS)
+ #if ($ERRORS)
+ #set ($eflag = "$!ERRORS.get($id)")
+ #else
+ #set ($eflag = "")
+ #end
+ <tr>
+ <th class="portlet-section-alternate"><font class="portlet-form-field-label">$!MESSAGES.getString($label)</font></th>
+ <td>
+ <select name="$id" class="portlet-form-field-label">
+ #foreach($element in $elements)
+ <option value="$element">
+ $MESSAGES.getString($element)
+ </option>
+ #end
+ </select>
+ </td>
+ </tr>
+#end
+
+#macro (formFieldTextArea $content $id $MESSAGES $ERRORS)
+ #if ($ERRORS)
+ #set ($eflag = "$!ERRORS.get($id)")
+ #else
+ #set ($eflag = "")
+ #end
+ <textarea cols="75" id ="$!id" name="$!id" rows="15">$!content</textarea>
+#end
+
+
+
+#macro (tab $tab $MESSAGES $urlAction)
+
+ #set ($tabPages = $tab.getPages())
+
+
+ <div>
+ <table border="0" cellpadding="0" cellspacing="0" width="50%">
+ <tbody>
+ <tr>
+ <td style="font-size: 1pt;" nowrap="true"> </td>
+ <td style="font-size: 1pt;" nowrap="true"> </td>
+ <td style="font-size: 1pt;" nowrap="true"> </td>
+ #foreach($tabPage in $tabPages)
+ #if($tab.isSelected($tabPage))
+ <td class="LTabLeft" style="font-size: 1pt;" nowrap="true"> </td>
+ <td class="LTab" align="center" valign="middle">$MESSAGES.getString($tabPage.getLabel())</td>
+ <td class="LTabRight" style="font-size: 1pt;" nowrap="true"> </td>
+ #else
+ <td class="LTabLeftLow" style="font-size: 1pt;" nowrap="true"> </td>
+ <td class="LTabLow" align="center" valign="middle"><a href="$urlAction?selectTab=$tab.getId()&selectPage=$tabPage.getId()">$MESSAGES.getString($tabPage.getLabel())</a></td>
+ <td class="LTabRightLow" style="font-size: 1pt;" nowrap="true"> </td>
+ #end
+ #end
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="portlet-section-alternate" /></div>
+ #parse($tab.getSelectedPage().getView())
+#end
+
+
+#macro (cmsPath $server $cmsObjects $renderResponse $MESSAGES)
+
+ [$MESSAGES.getString("div.server")] $server.getAlias()
+ #foreach($cmsObject in $cmsObjects)
+ >> $cmsObject.getName()
+ #end
+#end
+
+
+#macro (cmsPathLink $server $cmsObjects $renderResponse $MESSAGES)
+
+ <a href="$renderResponse.createRenderURL()?uri=$server.getScope()"> [$MESSAGES.getString("div.server")] $server.getAlias()</a>
+ #foreach($cmsObject in $cmsObjects)
+ >> <a href="$renderResponse.createRenderURL()?uri=$cmsObject.getUri()">$cmsObject.getName()</a>
+ #end
+#end
+
+#macro (documentLink $document $renderResponse)
+
+ #if ($graffitoTools.requireGraffitoViewer($document))
+ <font class="portlet-menu-item">
+ <a href="/graffito-browser/viewer?uri=$document.getUri()">$document.getTitle()</a>
+ </font>
+ #else
+ <font class="portlet-menu-item">
+ <a href="$renderResponse.createRenderURL()?uri=$document.getUri()">$document.getTitle()</a>
+ </font>
+ #end
+ <font class="portlet-font-dim"> by $document.getOwner()</font>
+ <br>
+ <font class="portlet-section-text">$document.getDescription()</font>
+ <br><br><br>
+
+#end
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/toolbox.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/toolbox.xml?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/toolbox.xml (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/toolbox.xml Thu Feb 17 15:57:09 2005
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<toolbox>
+</toolbox>
\ No newline at end of file
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity-macros.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity-macros.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity-macros.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity-macros.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,117 @@
+#macro (headerCell $body)
+ <th class="portlet-section-header">
+ <b>
+ $body
+ </b>
+ </th>
+#end
+
+#macro (entryCell $body)
+ <td class='portlet-section-body'>
+ $body
+ </td>
+#end
+
+#macro (entryCell2 $body $count)
+#if (($count % 2) == 0)
+ <td class='portlet-section-body'>
+#else
+ <td class='portlet-section-alternate'>
+#end
+ $body
+ </td>
+#end
+
+
+#macro (formField $label $value $size $id $MESSAGES $ERRORS)
+#if ($ERRORS)
+#set ($eflag = "$!ERRORS.get($id)")
+#else
+#set ($eflag = "")
+#end
+ <tr colspan="4" align="right">
+ #if ($!eflag == "")
+ <td width="5%" align="left"> </td>
+ #else
+ <td width="5%" class="portlet-msg-error" align="left"> </td>
+ #end
+ <td nowrap class="portlet-section-alternate" align="right">$!MESSAGES.getString($label): </td>
+ <td class="portlet-section-body" align="left">
+ <input id="$!id" type="text" name="$!id" size="$!size" value="$!value" class="portlet-form-label-field">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
+
+#macro (ErrorMessages $ERRORS)
+#if ($ERRORS)
+#if ($ERRORS.size() > 0)
+#foreach ($msg in $ERRORS)
+<div class="portlet-msg-error">
+$msg<br/>
+</div>
+#end
+<br/>
+#end
+#end
+#end
+
+#macro (OnePref $pf)
+#set ($pv = $pf.Value)
+#foreach ($x in $pv)
+#set ($extr = $x)
+#end
+$pf.Key $!extr
+#end
+
+#macro (prefField $key $values $size)
+#if ($ERRORS)
+#set ($eflag = "$!ERRORS.get($id)")
+#else
+#set ($eflag = "")
+#end
+#set ($pv = $pf.Value)
+#foreach ($x in $pv)
+#set ($extr = $x)
+#end
+#foreach ($x in $values)
+#set ($extr = $x)
+#end
+ <tr colspan="4" align="right">
+ #if ($!eflag == "")
+ <td width="5%" align="left"> </td>
+ #else
+ <td width="5%" class="portlet-msg-error" align="left"> </td>
+ #end
+ <td nowrap class="portlet-section-alternate" align="right">$!key: </td>
+ <td class="portlet-section-body" align="left">
+ <input id="$!id" type="text" name="$!key" size="$!size" value="$!extr" class="portlet-form-label-field">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
+
+#macro (form4ColumnCell $label $value $size $id)
+ <tr colspan="4" align="right">
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ <td nowrap class="portlet-section-alternate" align="left">$!label: </td>
+ <td class="portlet-form-input-field" align="left">
+ <input id="$!id" type="text" name="$!id" size="$!size" value="$!value">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
+
+#macro (form4PasswordCell $label $value $size $id)
+ <tr colspan="4" align="right">
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ <td nowrap class="portlet-section-alternate" align="left">$!label: </td>
+ <td class="portlet-form-input-field" align="left">
+ <input id="$!id" type="password" name="$!id" size="$!size" value="$!value">
+ </td>
+ <td width="5%" class="portlet-form-label" align="left"> </td>
+ </tr>
+#end
+
+
+
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity.properties
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity.properties?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity.properties (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/velocity/velocity.properties Thu Feb 17 15:57:09 2005
@@ -0,0 +1,116 @@
+# Copyright 2004 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#----------------------------------------------------------------------------
+# These are the default properties for the
+# Velocity Runtime. These values are used when
+# Runtime.init() is called, and when Runtime.init(properties)
+# fails to find the specificed properties file.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# R U N T I M E L O G
+#----------------------------------------------------------------------------
+# This is the location of the Velocity Runtime log.
+#----------------------------------------------------------------------------
+
+runtime.log = velocity.log
+
+#----------------------------------------------------------------------------
+# T E M P L A T E E N C O D I N G
+#----------------------------------------------------------------------------
+
+template.encoding=8859_1
+
+#----------------------------------------------------------------------------
+# C O N T E N T T Y P E
+#----------------------------------------------------------------------------
+# This is the default content type for the VelocityServlet.
+#----------------------------------------------------------------------------
+
+default.contentType=text/html
+
+#----------------------------------------------------------------------------
+# F O R E A C H P R O P E R T I E S
+#----------------------------------------------------------------------------
+# These properties control how the counter is accessed in the #foreach
+# directive. By default the reference $velocityCount will be available
+# in the body of the #foreach directive. The default starting value
+# for this reference is 1.
+#----------------------------------------------------------------------------
+
+counter.name = velocityCount
+counter.initial.value = 1
+
+#----------------------------------------------------------------------------
+# I N C L U D E P R O P E R T I E S
+#----------------------------------------------------------------------------
+# These are the properties that governed the way #include'd content
+# is governed.
+#----------------------------------------------------------------------------
+
+include.path=.
+include.cache = false
+include.output.errormsg.start = <!-- include error :
+include.output.errormsg.end = see error log -->
+
+#----------------------------------------------------------------------------
+# P A R S E P R O P E R T I E S
+#----------------------------------------------------------------------------
+
+parse_directive.maxdepth = 10
+
+#----------------------------------------------------------------------------
+# T E M P L A T E L O A D E R S
+#----------------------------------------------------------------------------
+#
+#
+#----------------------------------------------------------------------------
+
+template.loader.1.public.name = File
+template.loader.1.description = Velocity File Template Loader
+template.loader.1.class = org.apache.velocity.runtime.loader.FileTemplateLoader
+template.loader.1.template.path = .
+template.loader.1.cache = false
+template.loader.1.modificationCheckInterval = 2
+
+velocimacro.library.autoreload = true
+velocimacro.permissions.allow.inline.to.replace.global = true
+velocimacro.library = /WEB-INF/VM_global_library.vm, /WEB-INF/velocity/velocity-macros.vm, /WEB-INF/velocity/graffito-macros.vm
+
+#template.loader.2.public.name = URL
+#template.loader.2.description = Velocity URL Template Loader
+#template.loader.2.class = org.apache.velocity.runtime.loader.URLTemplateLoader
+#template.loader.2.template.path = http://localhost/templates/
+#template.loader.2.cache = false
+
+#----------------------------------------------------------------------------
+# E X T E R N A L S E R V I C E I N I T I A L I Z A T I O N
+#----------------------------------------------------------------------------
+# If this property is set to true then an external service will
+# set certain system properties and initialize the Velocity
+# Runtime. This method is used by Turbine to initialize the
+# Velocity Runtime for the TurbineVelocityService.
+#----------------------------------------------------------------------------
+
+external.init = false
+
+#----------------------------------------------------------------------------
+# C H A R A C T E R E N C O D I N G
+#----------------------------------------------------------------------------
+# Character encoding for input (templates). Using this, you can use
+# alternative encoding for your templates, such as UTF-8.
+#----------------------------------------------------------------------------
+input.encoding = UTF-8
+
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-edit.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-edit.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-edit.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-edit.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,41 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+#set ($document = $browserInfo.getCurrentCmsObject())
+
+<div class="portlet-menu">$MESSAGES.getString('div.newdocument') #cmsPath($browserInfo.getCurrentServer() $browserInfo.getFolderPath() $renderResponse $MESSAGES ) </div>
+
+<div class="portlet-section-header">Text Editor</div>
+
+<!-- div class="portlet-section-header">Folder Info </div -->
+<form action="$renderResponse.createActionURL()" method="post">
+ <input type="hidden" name="uri" value="$document.getUri()" size="100" maxlength="100"/>
+ #formFieldTextArea($document.getContent().getContentAsString() "content" $MESSAGES $ERRORS)
+ <div class="portlet-section-footer">
+ <input type="submit" name="document.save" value="Save" class="portlet-dlg-icon-label"/>
+ <input type="submit" name="cancel" value="Cancel" class="portlet-dlg-icon-label"/>
+ </div>
+</form>
+
+
+#ErrorMessages($ERRORS)
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-html-view.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-html-view.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-html-view.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-text-html-view.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,28 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+#set ($document = $browserInfo.getCurrentCmsObject())
+
+<div class="portlet-menu">$MESSAGES.getString('div.path') #cmsPathLink($browserInfo.getCurrentServer() $browserInfo.getFolderPath() $renderResponse $MESSAGES ) </div>
+<br>
+$document.getContent().getContentAsString()
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-type.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-type.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-type.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-type.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,49 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+#set ($document = $browserInfo.getCurrentCmsObject())
+
+<div class="portlet-menu">$MESSAGES.getString('div.newdocument') #cmsPath($browserInfo.getCurrentServer() $browserInfo.getParentFolders() $renderResponse $MESSAGES ) </div>
+
+<div class="portlet-section-header">General Information</div>
+
+<!-- div class="portlet-section-header">Folder Info </div -->
+<form action="$renderResponse.createActionURL()" method="post">
+ <input type="hidden" name="uri" value="$document.getUri()" size="100" maxlength="100"/>
+ <table border="0" cellspacing="2" cellpadding="3">
+ #formFieldInput('field.name' "$!document.getName()" "25" 'name' $MESSAGES $ERRORS)
+ #formFieldInput('field.title' "$!document.getTitle()" "25" 'title' $MESSAGES $ERRORS)
+ #formFieldInput('field.description' "$!document.getDescription()" "50" 'description' $MESSAGES $ERRORS)
+ #formFieldInput('field.owner' "$!document.getOwner()" "25" 'owner' $MESSAGES $ERRORS)
+ #formFieldSelect('field.language' $browserInfo.getDocumentLanguages() 'language' $MESSAGES $ERRORS )
+ #formFieldSelect('field.type' $browserInfo.getDocumentTypes() 'documentType' $MESSAGES $ERRORS )
+
+ </table>
+ <div class="portlet-section-footer">
+ <input type="submit" name="document.new.step2" value="Next" class="portlet-dlg-icon-label"/>
+ <input type="submit" name="cancel" value="Cancel" class="portlet-dlg-icon-label"/>
+ </div>
+</form>
+
+
+#ErrorMessages($ERRORS)
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-upload-edit.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-upload-edit.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-upload-edit.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document-upload-edit.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,39 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+#set ($document = $browserInfo.getCurrentCmsObject())
+
+<div class="portlet-menu">$MESSAGES.getString('div.newdocument') #cmsPath($browserInfo.getCurrentServer() $browserInfo.getFolderPath() $renderResponse $MESSAGES ) </div>
+
+<div class="portlet-section-header">Upload Document</div>
+
+<form action="$renderResponse.createActionURL()" method="post" enctype="multipart/form-data" >
+ <table border="0" cellspacing="2" cellpadding="3">
+ #formFieldFile('file.upload' "" "50" 'file' $MESSAGES $ERRORS)
+ </table>
+ <div class="portlet-section-footer">
+ <input type="submit" name="document.upload" value="Upload" class="portlet-dlg-icon-label"/>
+ <input type="submit" name="cancel" value="Cancel" class="portlet-dlg-icon-label"/>
+ </div>
+</form>
+#ErrorMessages($ERRORS)
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/document/document.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,45 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+#set ($document = $browserInfo.getCurrentCmsObject())
+
+<div class="portlet-menu">$MESSAGES.getString('div.newdocument') #cmsPath($browserInfo.getCurrentServer() $browserInfo.getParentFolders() $renderResponse $MESSAGES ) </div>
+
+<div class="portlet-section-header">Document Info </div>
+
+<!-- div class="portlet-section-header">Folder Info </div -->
+<form action="$renderResponse.createActionURL()" method="post">
+ <input type="hidden" name="uri" value="$document.getUri()" size="100" maxlength="100"/>
+ <table border="0" cellspacing="2" cellpadding="3">
+ #formFieldInput('field.name' "$!document.getName()" "25" 'name' $MESSAGES $ERRORS)
+ #formFieldInput('field.title' "$!document.getTitle()" "25" 'title' $MESSAGES $ERRORS)
+ #formFieldInput('field.description' "$!document.getDescription()" "50" 'description' $MESSAGES $ERRORS)
+ </table>
+ <div class="portlet-section-footer">
+ <input type="submit" name="document.save" value="Save" class="portlet-dlg-icon-label"/>
+ <input type="submit" name="cancel" value="Cancel" class="portlet-dlg-icon-label"/>
+ </div>
+</form>
+
+
+#ErrorMessages($ERRORS)
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/edit-tab-sample.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/edit-tab-sample.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/edit-tab-sample.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/edit-tab-sample.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,28 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+
+<div class="portlet-menu">$MESSAGES.getString('div.path') $browserInfo.getUri()</div>
+
+#tab($tabs.get("document") $MESSAGES $renderResponse.createActionURL())
+
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-browser.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-browser.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-browser.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-browser.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,60 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+
+<div class="portlet-menu">$MESSAGES.getString('div.path') #cmsPathLink($browserInfo.getCurrentServer() $browserInfo.getFolderPath() $renderResponse $MESSAGES )</div>
+#if( $browserInfo.isEmpty())
+ <div class="portlet-msg-info">$MESSAGES.getString('info.nocontent')</div>
+#else
+ #set ($folders = $browserInfo.getFolders())
+ #if($folders.size() > 0)
+ <!-- div class="portlet-menu">$MESSAGES.getString('div.folders')</div -->
+ <table border="0">
+ <tr>
+ <td>
+ <table border="0" cellpadding="10" cellspacing="20">
+ <tr>
+ #foreach ($folder in $folders)
+ <td>
+ <img src="content/tigris/images/folder.gif" border="0"/><font class="portlet-portlet-item"><a href="$renderResponse.createRenderURL()?uri=$folder.getUri()">$folder.getName()</a></font>
+ </td>
+ #end
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <!-- /div -->
+ #end
+
+ #set ($documents = $browserInfo.getDocuments())
+ #if($documents.size() > 0)
+ <div class="portlet-menu">$MESSAGES.getString('div.documents')</div>
+
+ #foreach ($document in $documents)
+ #documentLink($document $renderResponse)
+ #end
+ #end
+#end
+
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-detail.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-detail.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-detail.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-detail.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,45 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+#set ($folder = $browserInfo.getCurrentCmsObject())
+
+<div class="portlet-menu">$MESSAGES.getString('div.newfolder') #cmsPath($browserInfo.getCurrentServer() $browserInfo.getFolderPath() $renderResponse $MESSAGES ) </div>
+
+<div class="portlet-section-header">Folder Info </div>
+
+<!-- div class="portlet-section-header">Folder Info </div -->
+<form action="$renderResponse.createActionURL()" method="post">
+ <input type="hidden" name="uri" value="$folde.getUri()" size="100" maxlength="100"/>
+ <table border="0" cellspacing="2" cellpadding="3">
+ #formFieldInput('field.name' "$!folder.getName()" "25" 'name' $MESSAGES $ERRORS)
+ #formFieldInput('field.title' "$!folder.getTitle()" "25" 'title' $MESSAGES $ERRORS)
+ #formFieldInput('field.description' "$!folder.getDescription()" "50" 'description' $MESSAGES $ERRORS)
+ </table>
+ <div class="portlet-section-footer">
+ <input type="submit" name="folder.save" value="Save" class="portlet-dlg-icon-label"/>
+ <input type="submit" name="cancel" value="Cancel" class="portlet-dlg-icon-label"/>
+ </div>
+</form>
+
+
+#ErrorMessages($ERRORS)
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-edit.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-edit.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-edit.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/folder/folder-edit.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,94 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+
+<div class="portlet-menu">$MESSAGES.getString('div.path') #cmsPath($browserInfo.getCurrentServer() $browserInfo.getFolderPath() $renderResponse $MESSAGES )</div>
+
+<form action="$renderResponse.createActionURL()" method="post">
+ #set ($folders = $browserInfo.getFolders())
+ #set ($documents = $browserInfo.getDocuments())
+ #set ($count = 0)
+ #if($browserInfo.isEmpty())
+ <div class="portlet-msg-info">$MESSAGES.getString('info.nocontent')</div>
+ #else
+ <table>
+
+ <tr>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.select')</th>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.type')</th>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.name')</th>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.title')</th>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.description')</th>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.creationdate')</th>
+ <th class="portlet-section-header">$MESSAGES.getString('edit.tab.modificationdate')</th>
+ </tr>
+
+ #foreach ($folder in $folders)
+ #set ($count = $count + 1)
+ #set ($cssClass = "portlet-section-alternate")
+ #if (($count % 2)==0)
+ #set ($cssClass = "portlet-section-body")
+ #end
+ <tr>
+ <td class="$cssClass"><input type="checkbox" name="uri" value="$folder.getUri()" /></td>
+ <td class="$cssClass"><img src="content/tigris/images/folder.gif" border="0"/></td>
+ <td class="$cssClass">$folder.getName()</td>
+ <td class="$cssClass">$folder.getTitle()</td>
+ <td class="$cssClass">$folder.getDescription()</td>
+ <td class="$cssClass">$!folder.getCreationDate()</td>
+ <td class="$cssClass">$!folder.getModificationDate()</td>
+ </tr>
+
+ #end
+
+ #foreach ($document in $documents)
+ #set ($count = $count + 1)
+ #set ($cssClass = "portlet-section-alternate")
+
+ #if (($count % 2)==0)
+ #set ($cssClass = "portlet-section-body")
+ #end
+ <tr>
+ <td class="$cssClass"><input type="checkbox" name="uri" value="$document.getUri()" /></td>
+ <td class="$cssClass">$document.getContentType() </td>
+ <td class="$cssClass">$document.getName()</td>
+ <td class="$cssClass">$document.getTitle()</td>
+ <td class="$cssClass">$document.getDescription()</td>
+ <td class="$cssClass">$!document.getCreationDate()</td>
+ <td class="$cssClass">$!document.getModificationDate()</td>
+ </tr>
+
+ #end
+ </table>
+ #end
+
+ <div class="portlet-menu">
+ <input type="submit" name="folder.add" value="$MESSAGES.getString('link.addfolder')" class="portlet-dlg-icon-label" />
+ <input type="submit" name="document.add" value="$MESSAGES.getString('link.adddocument')" class="portlet-dlg-icon-label" />
+ <input type="submit" name="cmsobject.delete" value="$MESSAGES.getString('link.delete')" class="portlet-dlg-icon-label" />
+ </div>
+
+</form>
+
+
+
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/help.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/help.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/help.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/help.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,27 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+
+#set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))
+
+<div class="portlet-section-body">$MESSAGES.getString('help.text.view')</div>
+<div class="portlet-section-body">$MESSAGES.getString('help.text.edit')</div>
Added: incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/security/security.vm
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/security/security.vm?view=auto&rev=154214
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/security/security.vm (added)
+++ incubator/graffito/trunk/applications/browser/src/webapp/WEB-INF/view/security/security.vm Thu Feb 17 15:57:09 2005
@@ -0,0 +1,24 @@
+#*
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*#
+
+#**
+
+@author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+@version $Id: Exp $
+
+*#
+
+Security
\ No newline at end of file