You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/01/13 11:33:39 UTC

svn commit: r125056 - in cocoon/branches/BRANCH_2_1_X/src/blocks/portal: conf java/org/apache/cocoon/environment/portlet java/org/apache/cocoon/portal/coplets/basket java/org/apache/cocoon/portal/coplets/basket/events java/org/apache/cocoon/portal/impl samples/coplets/basket samples/coplets/basket/xml samples/coplets/basket/xsl samples/profiles/basket samples/profiles/copletdata samples/profiles/copletinstancedata samples/profiles/layout

Author: cziegeler
Date: Thu Jan 13 02:33:37 2005
New Revision: 125056

URL: http://svn.apache.org/viewcvs?view=rev&rev=125056
Log:
Update basket sample
Added:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractBasketTransformer.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Briefcase.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStore.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStoreDescription.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Folder.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/FolderTransformer.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UserConfiguration.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/AddItemEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/CleanBriefcaseEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ContentStoreEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/MoveItemEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RefreshBasketEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RemoveItemEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowBasketEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowItemEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/UploadItemEvent.java   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.js   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletlist.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithapp.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappdialog.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappresult.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithattr.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinline.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinput.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinputshow.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithupload.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/staticcoplet.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-post.xsl   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-pre.xsl   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithappresult.xsl   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithattr.xsl   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithinline.xsl   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/quota2result.xsl   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-cocoon.xml   (contents, props changed)
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-guest.xml   (contents, props changed)
Removed:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddItemEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/CleanBasketEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/RefreshBasketEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/RemoveItemEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/SaveBasketEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ShowBasketEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ShowItemEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UploadItemEvent.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/upload.xml
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/conf/portal.xconf	Thu Jan 13 02:33:37 2005
@@ -147,6 +147,13 @@
  <component class="org.apache.cocoon.components.variables.DefaultVariableResolverFactory" role="org.apache.cocoon.components.variables.VariableResolverFactory" />
  <!-- This is the basket manager -->
  <component class="org.apache.cocoon.portal.coplets.basket.BasketManagerImpl" 
-            role="org.apache.cocoon.portal.coplets.basket.BasketManager"/>
+            role="org.apache.cocoon.portal.coplets.basket.BasketManager">
+     <!-- This is only a sample configuration, it doesn't really work -->
+     <parameter name="basket:action:print" value="cocoon://print-basket"/>
+     <parameter name="basket:action:email" value="cocoon://email-basket"/>
+     <parameter name="briefcase:action:print" value="cocoon://print-briefcase"/>
+     <parameter name="briefcase:action:email" value="cocoon://email-briefcase"/>
+     <parameter name="briefcase:action:calc" value="cocoon://calc-briefcase"/>
+ </component>
 
 </xconf>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/environment/portlet/PortletRequest.java	Thu Jan 13 02:33:37 2005
@@ -84,6 +84,9 @@
         this.environment = environment;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.environment.Request#get(java.lang.String)
+     */
     public Object get(String name) {
         // if the request has been wrapped then access its method
         if (request instanceof MultipartActionRequest) {
@@ -252,6 +255,9 @@
         return this.portletRequestURI;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.environment.Request#getSitemapURI()
+     */
     public String getSitemapURI() {
         return this.environment.getURI();
     }

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractBasketTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractBasketTransformer.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractBasketTransformer.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.transformation.AbstractSAXTransformer;
+
+/**
+ * This is the base class for all basket transformers
+ *
+ * @version CVS $Id: BasketTransformer.java 47047 2004-09-22 12:27:27Z vgritsenko $
+ */
+public abstract class AbstractBasketTransformer
+    extends AbstractSAXTransformer
+    implements Disposable {
+
+    /** The namespace URI to listen for. */
+    public static final String NAMESPACE_URI = "http://apache.org/cocoon/portal/basket/1.0";
+
+    /** The basket manager */
+    protected BasketManager basketManager;
+    
+    /**
+     * Constructor
+     */
+    public AbstractBasketTransformer() {
+        super.defaultNamespaceURI = NAMESPACE_URI;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        super.service(manager);
+        this.basketManager = (BasketManager)this.manager.lookup(BasketManager.ROLE);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.basketManager);
+        }
+    }
+    
+}
\ No newline at end of file

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AbstractItem.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -26,27 +26,51 @@
  * 
  * It just adds attributes (or meta-data) functionality
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
- * @version CVS $Id: AbstractItem.java,v 1.2 2004/03/05 13:02:11 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class AbstractItem implements Serializable {
     
+    protected static long currentId = System.currentTimeMillis();
+    
     /** The attributes */
     protected Map attributes = new HashMap();
     
+    /** Unique id */
+    protected long id;
+    
+    public AbstractItem() {
+        synchronized ( this.getClass() ) {
+            currentId++;
+            this.id = currentId;
+        }
+    }
+
     /** Return an attribute or null */
-    public Object getAttribute(String name) { return this.attributes.get(name); }
+    public Object getAttribute(String name) { 
+        return this.attributes.get(name); 
+    }
     
     /** Set an attribute */
-    public void setAttribute(String name, Object value) { this.attributes.put(name, value); }
+    public void setAttribute(String name, Object value) { 
+        this.attributes.put(name, value); 
+    }
     
     /** Get all attribute names */
-    public Iterator getAttributeNames() { return this.attributes.keySet().iterator(); }
+    public Iterator getAttributeNames() { 
+        return this.attributes.keySet().iterator(); 
+    }
     
     /** Remove one attribute */
-    public void removeAttribute(String name) { this.attributes.remove(name); }
+    public void removeAttribute(String name) { 
+        this.attributes.remove(name);
+    }
     
     /** Check if an attribute is available */
-    public boolean hasAttribute(String name) { return this.attributes.containsKey(name); }
+    public boolean hasAttribute(String name) { 
+        return this.attributes.containsKey(name); 
+    }
+    
+    public long getId() {
+        return this.id;
+    }
 }

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddItemEvent.java?view=auto&rev=125055
==============================================================================

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/AddToBasketAspect.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -15,8 +15,14 @@
  */
 package org.apache.cocoon.portal.coplets.basket;
 
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.coplets.basket.events.AddItemEvent;
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.layout.Layout;
 import org.apache.cocoon.portal.layout.impl.CopletLayout;
@@ -32,12 +38,36 @@
  * basket-content and basket-link (boolean values) to stream
  * out the elements.
  * 
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
- * @version CVS $Id: AddToBasketAspect.java,v 1.2 2004/03/05 13:02:11 bdelacretaz Exp $
+ * @version CVS $Id$
  */
-public final class AddToBasketAspect extends AbstractAspect {
+public final class AddToBasketAspect 
+extends AbstractAspect 
+implements Disposable {
 
+    /** The basket manager */
+    protected BasketManager basketManager;
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        super.service(manager);
+        this.basketManager = (BasketManager)this.manager.lookup(BasketManager.ROLE);
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.basketManager);
+            this.basketManager = null;
+            this.manager = null;
+        }
+    }
+    
     /* (non-Javadoc)
      * @see org.apache.cocoon.portal.layout.renderer.RendererAspect#toSAX(org.apache.cocoon.portal.layout.renderer.RendererAspectContext, org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
      */
@@ -46,21 +76,41 @@
                         PortalService service,
                         ContentHandler contenthandler)
     throws SAXException {
-        CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();
+        final CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();
+        final ContentStore store;
+        final String elementName;
+        if ( context.getAspectConfiguration().equals(Boolean.TRUE) ) {
+            store = this.basketManager.getBasket();
+            elementName = "basket-add-content";
+        } else {
+            store = this.basketManager.getBriefcase();
+            elementName = "briefcase-add-content";
+        }
+        
         Boolean b = (Boolean)cid.getCopletData().getAttribute("basket-content");
         if ( b != null && b.equals(Boolean.TRUE) ) {
             Object item = new ContentItem(cid, true);
-            Event event = new AddItemEvent(item);
-            XMLUtils.createElement(contenthandler, "basket-add-content", service.getComponentManager().getLinkService().getLinkURI(event));
+            Event event = new AddItemEvent(store, item);
+            XMLUtils.createElement(contenthandler, elementName, service.getComponentManager().getLinkService().getLinkURI(event));
         }
         b = (Boolean)cid.getCopletData().getAttribute("basket-link");
         if ( b != null && b.equals(Boolean.TRUE) ) {
             Object item = new ContentItem(cid, false);
-            Event event = new AddItemEvent(item);
-            XMLUtils.createElement(contenthandler, "basket-add-link", service.getComponentManager().getLinkService().getLinkURI(event));            
+            Event event = new AddItemEvent(store, item);
+            XMLUtils.createElement(contenthandler, elementName, service.getComponentManager().getLinkService().getLinkURI(event));            
         }
         
         context.invokeNext( layout, service, contenthandler );
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
+     */
+    public Object prepareConfiguration(Parameters configuration)
+    throws ParameterException {
+        if ( configuration.getParameter("use-store", "basket").equalsIgnoreCase("basket") ) {
+            return Boolean.TRUE;
+        }
+        return Boolean.FALSE;
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Basket.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -15,82 +15,15 @@
  */
 package org.apache.cocoon.portal.coplets.basket;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-
 /**
- * This is a per user basket
+ * This is a per user basket that has the duration of a session
  * Make a subclass to add your specific functionality
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
  * @version CVS $Id$
  */
-public class Basket implements Serializable {
-    
-    /** The ordered list of items */
-    protected List items = new ArrayList();
-    
-    /**
-     * The constructor
-     */
-    public Basket() {
-        // nothing to do 
-    }
+public class Basket extends ContentStore {
     
-    /**
-     * Get an item at the index
-     */
-    public Object getItem(int index) {
-        return this.items.get(index);
-    }
-    
-    /**
-     * Add an item
-     */
-    public void addItem(Object item) {
-        this.items.add(item);
-    }
-    
-    /**
-     * Get the iterator
-     */
-    public Iterator getIterator() {
-        return this.items.iterator();
-    }
-    
-    /**
-     * Remove an item
-     */
-    public void removeItem(Object item) {
-        this.items.remove(item);
-    }
-    
-    /**
-     * Number of items in the basket
-     */
-    public int size() {
-        return this.items.size();
-    }
-
-    /**
-     * Calculate the size of a basket
-     */
-    public int contentSize() {
-        int size = 0;
-        Iterator i = this.items.iterator();
-        while (i.hasNext()) {
-            Object item = i.next();
-            if ( item instanceof ContentItem ) {
-                int v = ((ContentItem)item).size();
-                if ( v != -1 ) {
-                    size += v;
-                }
-            }
-        }
-        return size;
+    public Basket(String id) {
+        super(id);
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketContentGenerator.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -21,15 +21,11 @@
 
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.source.SourceUtil;
-import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.generation.ServiceableGenerator;
-import org.apache.cocoon.portal.Constants;
-import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.generation.AbstractCopletGenerator;
 import org.apache.cocoon.xml.SaxBuffer;
 import org.apache.cocoon.xml.XMLUtils;
 import org.apache.excalibur.source.Source;
@@ -38,26 +34,17 @@
 import org.xml.sax.SAXException;
 
 /**
- * This is a generator that display the content of one item
+ * This generator displays the content of one item.
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
- * @version CVS $Id: BasketContentGenerator.java,v 1.2 2004/03/05 13:02:11 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class BasketContentGenerator
-extends ServiceableGenerator {
+extends AbstractCopletGenerator {
     
     /** This is the attribute name containing the content */
     protected String attributeName;
     
     /* (non-Javadoc)
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(ServiceManager manager) throws ServiceException {
-        super.service(manager);
-    }
-
-    /* (non-Javadoc)
      * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
      */
     public void setup(SourceResolver resolver,
@@ -68,34 +55,6 @@
         super.setup(resolver, objectModel, src, par);
 
         this.attributeName = par.getParameter("attribute-name", null);
-    }
-
-    /**
-     * Get the coplet associated with this pipeline
-     */
-    protected CopletInstanceData getCopletInstanceData() 
-    throws SAXException {
-        PortalService portalService = null;
-        try {
-
-            portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
-
-            final Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
-            
-            String copletId = (String)context.get(Constants.COPLET_ID_KEY);
-
-            CopletInstanceData object = portalService.getComponentManager().getProfileManager().getCopletInstanceData( copletId );
-                
-            if (object == null) {
-                throw new SAXException("Could not find coplet instance data for " + copletId);
-            }
-                
-            return object;
-        } catch (ServiceException e) {
-            throw new SAXException("Error getting portal service.", e);
-        } finally {
-            this.manager.release( portalService );
-        }
     }
 
     /* (non-Javadoc)

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketEvent.java?view=auto&rev=125055
==============================================================================

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketGenerator.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -16,6 +16,7 @@
 package org.apache.cocoon.portal.coplets.basket;
 
 import java.io.IOException;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -27,17 +28,21 @@
 import org.apache.cocoon.generation.ServiceableGenerator;
 import org.apache.cocoon.portal.LinkService;
 import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.coplets.basket.events.CleanBriefcaseEvent;
+import org.apache.cocoon.portal.coplets.basket.events.RefreshBasketEvent;
+import org.apache.cocoon.portal.coplets.basket.events.RemoveItemEvent;
+import org.apache.cocoon.portal.coplets.basket.events.ShowBasketEvent;
+import org.apache.cocoon.portal.coplets.basket.events.ShowItemEvent;
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.cocoon.xml.XMLUtils;
 import org.xml.sax.SAXException;
 
 /**
  * This is a portlet that displays the contents of a basket
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
- * @version CVS $Id: BasketGenerator.java,v 1.4 2004/03/19 14:21:06 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class BasketGenerator
 extends ServiceableGenerator {
@@ -48,6 +53,12 @@
     /** This is the layout ID that is used to display the content */
     protected String showLayoutId;
 
+    /** The type of items to display */
+    protected String type;
+    
+    /** The location of the type information */
+    protected String typeLocation;
+    
     /** admin mode? */
     protected boolean adminMode;
     
@@ -86,6 +97,8 @@
         this.showCopletId = par.getParameter("show-coplet", null);
         this.showLayoutId = par.getParameter("show-layout", null);
         this.adminMode = par.getParameterAsBoolean("admin-mode", false);
+        this.type = par.getParameter("type", null);
+        this.typeLocation = par.getParameter("type-location", null);
     }
 
     /* (non-Javadoc)
@@ -97,53 +110,68 @@
         if ( this.adminMode ) {
             this.generateAdminMode();            
         } else {
-            Basket basket = this.basketManager.getBasket();
-    
             PortalService service = null;
             try {
                 service = (PortalService)this.manager.lookup(PortalService.ROLE);
-                LinkService linkService = service.getComponentManager().getLinkService();
+
+                final UserConfiguration uc = UserConfiguration.get(this.objectModel, service);
+                Basket    basket = null;
+                Briefcase briefcase = null;
+                Folder    folder = null;
+
+                if ( uc.isBasketEnabled() ) {
+                    basket = this.basketManager.getBasket();
+                }
+                if ( uc.isBriefcaseEnabled() ) {
+                    briefcase = this.basketManager.getBriefcase();
+                }
+                if ( uc.isFolderEnabled() ) {
+                    folder = this.basketManager.getFolder();
+                }
+    
+                final LinkService linkService = service.getComponentManager().getLinkService();
                 
                 XMLUtils.startElement(this.xmlConsumer, "basket-content");
     
-                XMLUtils.startElement(this.xmlConsumer, "item-count");
-                XMLUtils.data(this.xmlConsumer, String.valueOf(basket.size()));
-                XMLUtils.endElement(this.xmlConsumer, "item-count");
-                XMLUtils.startElement(this.xmlConsumer, "persist-url");
-                final Event saveEvent = new SaveBasketEvent();
-                XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(saveEvent));
-                XMLUtils.endElement(this.xmlConsumer, "persist-url");
+                this.toSAX(uc);
                 
-                if ( basket.size() > 0 ) {
-                    ProfileManager profileManager = service.getComponentManager().getProfileManager();
+                final ProfileManager profileManager = service.getComponentManager().getProfileManager();
                     
                     XMLUtils.startElement(this.xmlConsumer, "items");
-                    for(int i=0; i<basket.size();i++) {
-                        Object item = basket.getItem(i);
-                        XMLUtils.startElement(this.xmlConsumer, "item");
-                        XMLUtils.startElement(this.xmlConsumer, "id");
-                        XMLUtils.data(this.xmlConsumer, item.toString());
-                        XMLUtils.endElement(this.xmlConsumer, "id");
-                        if ( item instanceof ContentItem ) {
-                            ContentItem ci = (ContentItem)item;
-                            Event e = new ShowItemEvent(item, profileManager.getPortalLayout(null, this.showLayoutId), this.showCopletId);
-                            XMLUtils.startElement(this.xmlConsumer, "show-url");
-                            XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
-                            XMLUtils.endElement(this.xmlConsumer, "show-url");
-                            if (ci.size() != -1 ) {
-                                XMLUtils.startElement(this.xmlConsumer, "size");
-                                XMLUtils.data(this.xmlConsumer, String.valueOf(ci.size()));
-                                XMLUtils.endElement(this.xmlConsumer, "size");
-                            }                        
-                        }
-                        Event removeEvent = new RemoveItemEvent(item);
-                        XMLUtils.startElement(this.xmlConsumer, "remove-url");
-                        XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(removeEvent));
-                        XMLUtils.endElement(this.xmlConsumer, "remove-url");
-                        XMLUtils.endElement(this.xmlConsumer, "item");
-                    }
-                    XMLUtils.endElement(this.xmlConsumer, "items");
+                
+                int itemCount = 0;
+                long itemSize = 0;
+
+                StoreInfo info;
+                
+                info = this.toSAX(basket, linkService, profileManager);
+                itemCount += info.count;
+                itemSize += info.maxSize;
+                info = this.toSAX(briefcase, linkService, profileManager);
+                itemCount += info.count;
+                itemSize += info.maxSize;
+                info = this.toSAX(folder, linkService, profileManager);
+                itemCount += info.count;
+                itemSize += info.maxSize;
+
+                XMLUtils.endElement(this.xmlConsumer, "items");
+
+                XMLUtils.startElement(this.xmlConsumer, "item-count");
+                XMLUtils.data(this.xmlConsumer, String.valueOf(itemCount));
+                XMLUtils.endElement(this.xmlConsumer, "item-count");
+
+                XMLUtils.startElement(this.xmlConsumer, "item-size");
+                double f = itemSize / 10.24;
+                f = Math.floor(f);
+                if ( f < 10.0 && f > 0.1) {
+                    f = 10.0;
+                } else if ( f < 0.1 ) {
+                    f = 0.0;
                 }
+                f = f / 100.0;
+                XMLUtils.data(this.xmlConsumer, String.valueOf(f));
+                XMLUtils.endElement(this.xmlConsumer, "item-size");
+
                 XMLUtils.endElement(this.xmlConsumer, "basket-content");
             } catch (ServiceException se) {
                 throw new SAXException("Unable to lookup portal service.", se);
@@ -159,7 +187,7 @@
      */
     protected void generateAdminMode() 
     throws SAXException {
-        List baskets = this.basketManager.getBaskets();
+        List baskets = this.basketManager.getBriefcaseDescriptions();
 
         PortalService service = null;
         try {
@@ -169,7 +197,7 @@
             if ( baskets.size() > 0 ) {
                 XMLUtils.startElement(this.xmlConsumer, "baskets");
                 for(int i=0; i<baskets.size();i++) {
-                    BasketManager.BasketDescription item = (BasketManager.BasketDescription)baskets.get(i);
+                    ContentStoreDescription item = (ContentStoreDescription)baskets.get(i);
                     XMLUtils.startElement(this.xmlConsumer, "basket");
 
                     XMLUtils.startElement(this.xmlConsumer, "id");
@@ -180,7 +208,7 @@
                     XMLUtils.data(this.xmlConsumer, String.valueOf(item.size));
                     XMLUtils.endElement(this.xmlConsumer, "size");
                     
-                    Event event = new CleanBasketEvent(item.id);
+                    Event event = new CleanBriefcaseEvent((Briefcase)null);
                     XMLUtils.startElement(this.xmlConsumer, "remove-url");
                     XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(event));
                     XMLUtils.endElement(this.xmlConsumer, "remove-url");
@@ -200,7 +228,7 @@
             XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
             XMLUtils.endElement(this.xmlConsumer, "refresh-url");
             
-            e = new CleanBasketEvent();
+            e = new CleanBriefcaseEvent();
             XMLUtils.startElement(this.xmlConsumer, "clean-url");
             XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
             XMLUtils.endElement(this.xmlConsumer, "clean-url");
@@ -213,4 +241,111 @@
         }
     }
     
+    protected StoreInfo toSAX(ContentStore store, LinkService linkService, ProfileManager profileManager)
+    throws SAXException {
+        StoreInfo info = new StoreInfo();
+        if ( store != null ) {
+            for(int i=0; i<store.size();i++) {
+                Object item = store.getItem(i);
+                if ( item instanceof ContentItem ) {
+                    ContentItem ci = (ContentItem)item;
+                    
+                    boolean process = true;
+                    if ( this.type != null && this.type.length() > 0 && this.typeLocation != null ) {
+                        Map attributes = (Map)ci.getAttribute("coplet-attributes");
+                        if ( attributes != null ) {
+                            if ( !this.type.equals(attributes.get(this.typeLocation)) ) {
+                                process = false;
+                            }
+                        }
+                    }
+                    if ( process ) {
+                        info.count++;
+                        info.maxSize += ci.size();
+                        XMLUtils.startElement(this.xmlConsumer, "item");
+                        
+                        XMLUtils.createElement(this.xmlConsumer, "title", item.toString());
+        
+                        XMLUtils.startElement(this.xmlConsumer, "store");
+                        if ( store instanceof Briefcase ) {
+                            XMLUtils.data(this.xmlConsumer, "briefcase");
+                        } else if ( store instanceof Folder ) {
+                            XMLUtils.data(this.xmlConsumer, "folder");                    
+                        } else {
+                            XMLUtils.data(this.xmlConsumer, "basket");                    
+                        }
+                        XMLUtils.endElement(this.xmlConsumer, "store");
+                    
+                        XMLUtils.createElement(this.xmlConsumer, "id", String.valueOf(ci.getId()));
+                        Event e = new ShowItemEvent(store, item, profileManager.getPortalLayout(null, this.showLayoutId), this.showCopletId);
+                        XMLUtils.createElement(this.xmlConsumer, "show-url", linkService.getLinkURI(e));
+                        if (ci.size() != -1 ) {
+                            XMLUtils.createElement(this.xmlConsumer, "size", String.valueOf(ci.size()));
+                        }                        
+                        XMLUtils.startElement(this.xmlConsumer, "attributes");
+                        this.toSAX(ci.attributes);
+                        XMLUtils.endElement(this.xmlConsumer, "attributes");
+                        Event removeEvent = new RemoveItemEvent(store, item);
+                        XMLUtils.createElement(this.xmlConsumer, "remove-url", linkService.getLinkURI(removeEvent));
+                        
+                        XMLUtils.endElement(this.xmlConsumer, "item");
+                    }
+                }
+            }
+        }    
+        return info;
+    }
+    
+    protected void toSAX(Map attributes)
+    throws SAXException {
+        if ( attributes != null ) {
+            AttributesImpl a = new AttributesImpl();
+            final Iterator i = attributes.entrySet().iterator();
+            while ( i.hasNext() ) {
+                final Map.Entry current = (Map.Entry)i.next();
+                final String key = current.getKey().toString();
+                if ( "coplet-attributes".equals(key) ) {
+                    this.toSAX((Map)current.getValue());
+                } else {
+                    final Object value = current.getValue();
+                    final String valueText;
+                    if ( value != null ) {
+                        valueText = value.toString();
+                    } else {
+                        valueText ="";
+                    }
+                    a.addCDATAAttribute("name", key);
+                    a.addCDATAAttribute("value", valueText);
+                    XMLUtils.createElement(this.xmlConsumer, "attribute", a);
+                    a.clear();
+                }
+            }
+        }
+    }
+    
+    protected void toSAX(UserConfiguration uc)
+    throws SAXException {
+        XMLUtils.startElement(this.xmlConsumer, "configuration");
+        AttributesImpl attr = new AttributesImpl();
+        
+        if ( uc.isBasketEnabled() ) {
+            XMLUtils.createElement(this.xmlConsumer, "basket", attr, "enabled");
+            attr.clear();
+        }
+        if ( uc.isBriefcaseEnabled() ) {
+            XMLUtils.createElement(this.xmlConsumer, "briefcase", "enabled");
+            attr.clear();
+        }
+        if ( uc.isFolderEnabled() ) {
+            XMLUtils.createElement(this.xmlConsumer, "folder", "enabled");
+            attr.clear();
+        }
+        
+        XMLUtils.endElement(this.xmlConsumer, "configuration");
+    }
+    
+    public static final class StoreInfo {
+        int count;
+        long maxSize;
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManager.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -18,12 +18,11 @@
 import java.util.List;
 
 /**
- * This is the manager for baskets.
- * You can retrieve the current basket for the user from this manager.
+ * This is the manager for content-stores: baskets, briefcases and folders
+ * You can retrieve the current basket, briefcase or folder for the user 
+ * from this manager.
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
- * @version CVS $Id: BasketManager.java,v 1.2 2004/03/05 13:02:11 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public interface BasketManager {
     
@@ -31,10 +30,16 @@
     String ROLE = BasketManager.class.getName();
     
     /** This key is used to store the current basket in the session */
-    String BASKET_KEY = BasketManager.class.getName();
+    String BASKET_KEY = BasketManager.class.getName() + "/Basket";
+
+    /** This key is used to store the current briefcase in the session */
+    String BRIEFCASE_KEY = BasketManager.class.getName() + "/Briefcase";
+
+    /** This key is used to store the current folder in the session */
+    String FOLDER_KEY = BasketManager.class.getName() + "/Folder";
 
-    /** This key is used to store all baskets in the session */
-    String ALL_BASKETS_KEY = BasketManager.class.getName() + "/All";
+    /** This key is used to store all briefcases in the session (of the admin) */
+    String ALL_BRIEFCASES_KEY = BasketManager.class.getName() + "/All";
 
     /**
      * Return the basket of the current user
@@ -42,18 +47,62 @@
     Basket getBasket();
    
     /**
-     * Return all baskets. 
-     * This is a list of BasketDescription objects
+     * Return the briefcase of the current user
+     */
+    Briefcase getBriefcase();
+
+    /**
+     * Return the folder of the current user
      */
-    List getBaskets();
+    Folder getFolder();
 
     /**
-     * This class describes a basket
+     * Return all briefcases. 
+     * This is a list of {@link ContentStoreDescription} objects.
      */
-    public class BasketDescription {
-        /** The id */
-        public String id;
-        /** The size of the basket */
-        public int    size;
+    List getBriefcaseDescriptions();
+
+    /** 
+     * An action info consists of a name and a url
+     */
+    public static class ActionInfo {
+        public final String name;
+        public final String url;
+        
+        public ActionInfo(String n, String u) {
+            this.name = n;
+            this.url = u;
+        }
     }
+
+    /**
+     * Return all configured actions for a basket - this is a list of 
+     * {@link #ActionInfo}s.
+     */
+    List getBasketActions();
+
+    /**
+     * Get the info
+     */
+    ActionInfo getBasketAction(String name);
+    
+    /**
+     * Return all configured actions for a briefcase - this is a list of 
+     * {@link #ActionInfo}s.
+     */
+    List getBriefcaseActions();
+
+    /**
+     * Get the info
+     */
+    ActionInfo getBriefcaseAction(String name);
+
+    void addBatch(ContentItem item,
+                  int         frequencyInDays,
+                  ActionInfo  action);
+    
+    /**
+     * Update/save the content store
+     */
+    void update(ContentStore store);
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketManagerImpl.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -19,8 +19,10 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -28,6 +30,7 @@
 import java.util.Map;
 
 import org.apache.avalon.excalibur.io.IOUtil;
+import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.framework.context.Context;
@@ -44,11 +47,23 @@
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.components.cron.CronJob;
+import org.apache.cocoon.components.cron.JobScheduler;
+import org.apache.cocoon.components.cron.ServiceableCronJob;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.coplets.basket.events.AddItemEvent;
+import org.apache.cocoon.portal.coplets.basket.events.ContentStoreEvent;
+import org.apache.cocoon.portal.coplets.basket.events.CleanBriefcaseEvent;
+import org.apache.cocoon.portal.coplets.basket.events.MoveItemEvent;
+import org.apache.cocoon.portal.coplets.basket.events.RefreshBasketEvent;
+import org.apache.cocoon.portal.coplets.basket.events.RemoveItemEvent;
+import org.apache.cocoon.portal.coplets.basket.events.ShowBasketEvent;
+import org.apache.cocoon.portal.coplets.basket.events.ShowItemEvent;
+import org.apache.cocoon.portal.coplets.basket.events.UploadItemEvent;
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.event.EventManager;
 import org.apache.cocoon.portal.event.Filter;
@@ -65,13 +80,11 @@
 /**
  * This is the implementation of the basket manager
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
  * @version CVS $Id$
  */
 public class BasketManagerImpl
 extends AbstractLogEnabled
-implements BasketManager, Serviceable, Subscriber, Contextualizable, Initializable, Parameterizable, ThreadSafe, Component  {
+implements BasketManager, Serviceable, Subscriber, Contextualizable, Initializable, Disposable, Parameterizable, ThreadSafe, Component  {
     
     /** The service manager */
     protected ServiceManager manager;
@@ -85,12 +98,47 @@
     /** The class name of the basket */
     protected String basketClassName = Basket.class.getName();
     
+    /** The class name of the briefcase */
+    protected String briefcaseClassName = Briefcase.class.getName();
+
+    /** The class name of the folder */
+    protected String folderClassName = Folder.class.getName();
+
+    /** All actions for a basket */
+    protected List basketActions = new ArrayList();
+    
+    /** All actions for a briefcase */
+    protected List briefcaseActions = new ArrayList();
+    
+    /** All batches */
+    protected List batches = new ArrayList();
+    
+    /** Scheduler */
+    protected JobScheduler scheduler;
+    
     /* (non-Javadoc)
      * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
      */
     public void parameterize(Parameters parameters) throws ParameterException {
         this.directory = parameters.getParameter("directory", this.directory);
         this.basketClassName = parameters.getParameter("basket-class", this.basketClassName);
+        this.briefcaseClassName = parameters.getParameter("briefcase-class", this.briefcaseClassName);
+        this.folderClassName = parameters.getParameter("folder-class", this.folderClassName);
+        String[] names = parameters.getNames();
+        if ( names != null ) {
+            for(int i=0; i<names.length; i++) {
+                final String current = names[i];
+                if ( current.startsWith("basket:action:") ) {
+                    final String value = parameters.getParameter(current);
+                    final String key = current.substring(14);
+                    this.basketActions.add(new ActionInfo(key, value));
+                } else if ( current.startsWith("briefcase:action:") ) {
+                    final String value = parameters.getParameter(current);
+                    final String key = current.substring(17);
+                    this.briefcaseActions.add(new ActionInfo(key, value));
+                }
+            }
+        }
     }
 
     /* (non-Javadoc)
@@ -106,9 +154,21 @@
      */
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
+        this.scheduler = (JobScheduler)this.manager.lookup(JobScheduler.ROLE);
     }
 
     /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.scheduler);
+            this.scheduler = null;
+            this.manager = null;
+        }
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.avalon.framework.activity.Initializable#initialize()
      */
     public void initialize() throws Exception {
@@ -125,7 +185,7 @@
      * @see org.apache.cocoon.portal.event.Subscriber#getEventType()
      */
     public Class getEventType() {
-        return BasketEvent.class;
+        return ContentStoreEvent.class;
     }
 
     /* (non-Javadoc)
@@ -140,61 +200,64 @@
      */
     public void inform(Event event) {
         // dispatch
-        Session session = ContextHelper.getRequest(this.context).getSession();
-        Basket basket = this.getBasket();
+        final Session session = ContextHelper.getRequest(this.context).getSession();
         if ( event instanceof AddItemEvent ) {
             
-            this.processAddItemEvent((AddItemEvent)event, basket);
+            this.processAddItemEvent((AddItemEvent)event);
             
         } else if (event instanceof RemoveItemEvent ){
             
-            this.processRemoveItemEvent((RemoveItemEvent)event, basket);
-            
-        } else if (event instanceof SaveBasketEvent) {
-            
-            this.saveBasket(basket);
+            this.processRemoveItemEvent((RemoveItemEvent)event);
             
         } else if (event instanceof RefreshBasketEvent) {
             
-            session.removeAttribute(ALL_BASKETS_KEY);          
+            session.removeAttribute(ALL_BRIEFCASES_KEY);          
             
-        } else if (event instanceof CleanBasketEvent) {
+        } else if (event instanceof CleanBriefcaseEvent) {
             
-            this.processCleanBasketEvent((CleanBasketEvent)event, session);
+            this.processCleanBriefcaseEvent((CleanBriefcaseEvent)event, session);
             
         } else if ( event instanceof UploadItemEvent ) {
             
-            this.processUploadItemEvent((UploadItemEvent)event, basket);
+            this.processUploadItemEvent((UploadItemEvent)event);
         } else if ( event instanceof ShowItemEvent ) {
             
-            this.processShowItemEvent((ShowItemEvent)event, basket);
+            this.processShowItemEvent((ShowItemEvent)event);
         } else if ( event instanceof ShowBasketEvent ) {
             
             this.processShowBasketEvent((ShowBasketEvent)event, session);
+        } else if ( event instanceof MoveItemEvent ) {
+            ContentStore source = ((MoveItemEvent)event).getContentStore();
+            ContentStore target = ((MoveItemEvent)event).getTarget();
+            Object item = ((MoveItemEvent)event).getItem();
+            source.removeItem(item);
+            target.addItem(item);
+            this.saveContentStore(source);
+            this.saveContentStore(target);
         }
     }
 
     /**
-     * Process an upload and add the item to the basket
+     * Process an upload and add the item to the content store
      * @param event The event triggering the action
-     * @param basket The basket
      */
-    protected void processUploadItemEvent(UploadItemEvent event, Basket basket) {
-        Request req = ContextHelper.getRequest(this.context);
-        List paramNames = event.getItemNames();
-        Iterator i = paramNames.iterator();
+    protected void processUploadItemEvent(UploadItemEvent event) {
+        final ContentStore store = event.getContentStore();
+        final Request req = ContextHelper.getRequest(this.context);
+        final List paramNames = event.getItemNames();
+        final Iterator i = paramNames.iterator();
         while ( i.hasNext() ) {
-            String name = (String)i.next();
-            Object o = req.get(name);
+            final String name = (String)i.next();
+            final Object o = req.get(name);
             if ( o != null && o instanceof Part) {
-                Part file = (Part)o;
+                final Part file = (Part)o;
                 try {
                     byte[] c = IOUtil.toByteArray(file.getInputStream());
                     ContentItem ci = new ContentItem(file.getFileName(), true);
                     ci.setContent(c);
-                    basket.addItem(ci);
+                    store.addItem(ci);
                 } catch (Exception ignore) {
-                    // ignore it
+                    // ignore the exception
                 }
                 if ( file instanceof PartOnDisk) {
                     ((PartOnDisk)file).getFile().delete();
@@ -208,7 +271,7 @@
      * @param event  The event triggering the action
      * @param basket The basket
      */
-    protected void processShowItemEvent(ShowItemEvent event, Basket basket) {
+    protected void processShowItemEvent(ShowItemEvent event) {
         if ( event.getItem() instanceof ContentItem ) {
             PortalService service = null;
             try {
@@ -245,7 +308,8 @@
                         }
                         
                     } else {
-                        CopletData copletData = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId()).getCopletData();
+                        final CopletInstanceData original = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
+                        final CopletData copletData = original.getCopletData();
                         cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                         Map attributes = (Map) ci.getAttribute("coplet-attributes");
                         Iterator i = attributes.entrySet().iterator();
@@ -253,6 +317,13 @@
                             Map.Entry entry = (Map.Entry)i.next();
                             cid.setAttribute(entry.getKey().toString(), entry.getValue());
                         }
+                        // now copy the original attributes
+                        attributes = original.getAttributes();
+                        i = attributes.entrySet().iterator();
+                        while ( i.hasNext() ) {
+                            Map.Entry entry = (Map.Entry)i.next();
+                            cid.setAttribute(entry.getKey().toString(), entry.getValue());
+                        }
                     }
                 }
                 layout.setCopletInstanceData(cid);
@@ -270,36 +341,37 @@
      * Show the selected basket
      */
     protected void processShowBasketEvent(ShowBasketEvent event, Session session) {
-        Basket basket = this.loadBasket( event.getBasketId() );
-        session.setAttribute(BASKET_KEY, basket);
+        Briefcase briefcase = (Briefcase)this.loadContentStore( BRIEFCASE_KEY, event.getBasketId() );
+        session.setAttribute(BRIEFCASE_KEY, briefcase);
     }
+    
     /**
-     * Cleaning a basket or all
+     * Cleaning a briefcase or all
      * @param event   The triggering event
      * @param session The session
      */
-    protected void processCleanBasketEvent(CleanBasketEvent event, Session session) {
-        String basketId = event.getBasketId();
-        List baskets = (List)session.getAttribute(ALL_BASKETS_KEY);
-        if ( basketId == null) {
-            // remove all baskets
+    protected void processCleanBriefcaseEvent(CleanBriefcaseEvent event, Session session) {
+        final Briefcase briefcase = (Briefcase)event.getContentStore();
+        final List baskets = (List)session.getAttribute(ALL_BRIEFCASES_KEY);
+        if ( briefcase == null) {
+            // remove all briefcases
             if ( baskets != null ) {
                 Iterator i = baskets.iterator();
                 while (i.hasNext()) {
-                    BasketDescription entry = (BasketDescription)i.next();
-                    this.deleteBasket(entry.id);
+                    ContentStoreDescription entry = (ContentStoreDescription)i.next();
+                    this.deleteContentStore(BRIEFCASE_KEY, entry.id);
                 }
-                session.removeAttribute(ALL_BASKETS_KEY);
+                session.removeAttribute(ALL_BRIEFCASES_KEY);
             }
         } else {
-            // remove one basket
-            this.deleteBasket(basketId);
+            // remove one briefcase
+            this.deleteContentStore(BRIEFCASE_KEY, briefcase.getId());
             if ( baskets != null ) {
                 Iterator i = baskets.iterator();
                 boolean found = false;
                 while (i.hasNext() && !found) {
-                    BasketDescription entry = (BasketDescription)i.next();
-                    if ( entry.id.equals(basketId)) {
+                    ContentStoreDescription entry = (ContentStoreDescription)i.next();
+                    if ( entry.id.equals(briefcase.getId())) {
                         found = true;
                         i.remove();
                     }
@@ -309,34 +381,28 @@
     }
 
     /**
-     * This method processes removing one item from the basket
+     * This method processes removing one item from a content store
      * @param event The event triggering the action
-     * @param basket The basket
      */
-    protected void processRemoveItemEvent(RemoveItemEvent event, Basket basket) {
-        Object item = event.getItem();
-        basket.removeItem(item);
+    protected void processRemoveItemEvent(RemoveItemEvent event) {
+        final Object item = event.getItem();
+        final ContentStore store = event.getContentStore();
+        
+        store.removeItem(item);
+        
+        this.saveContentStore(store);
     }
 
     /**
-     * This method processes adding one item to the basket
+     * This method processes adding one item to a content store
      * @param event The event triggering the action
-     * @param basket The basket
      */
-    protected void processAddItemEvent(AddItemEvent event, Basket basket) {
-        Object item = event.getItem();
+    protected void processAddItemEvent(AddItemEvent event) {
+        final ContentStore store = event.getContentStore();
+        final Object item = event.getItem();
         if ( item instanceof ContentItem ) {
             ContentItem ci = (ContentItem)item;
-            boolean found = false;
-            //Iterator i = basket.getIterator();
-            // while ( i.hasNext() && ! found ) {
-            //    Object next = i.next();
-            //    if ( next instanceof ContentItem ) {
-            //        found = ((ContentItem)next).equalsItem(ci);
-            //    }
-            //}
-            if (!found) {
-                basket.addItem(ci);
+
                 if ( ci.isContent() ) {
                     SourceResolver resolver = null;
                     Source source = null;
@@ -345,7 +411,29 @@
                         resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                         url = ci.getURL();
                         if ( url == null ) {
+                        // copy coplet attributes
+                        PortalService service = null;
+                        try {
+                            service = (PortalService) this.manager.lookup(PortalService.ROLE);
+                            CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                             url = "coplet://" + ci.getCopletId();
+                            Map attributes = new HashMap();
+                            Iterator i = cid.getAttributes().entrySet().iterator();
+                            while ( i.hasNext() ) {
+                                Map.Entry entry = (Map.Entry)i.next();
+                                attributes.put(entry.getKey(), entry.getValue());
+                        }
+                            i = cid.getCopletData().getAttributes().entrySet().iterator();
+                            while ( i.hasNext() ) {
+                                Map.Entry entry = (Map.Entry)i.next();
+                                attributes.put(entry.getKey(), entry.getValue());
+                            }
+                            ci.setAttribute("coplet-attributes", attributes);
+                        } catch (ServiceException se) {
+                            this.getLogger().warn("Unable to lookup portal service.", se);
+                        } finally {
+                            this.manager.release(service);
+                        }
                         }
                         source = resolver.resolveURI(url);
                         ci.setContent(IOUtil.toByteArray(source.getInputStream()));
@@ -371,6 +459,11 @@
                             Map.Entry entry = (Map.Entry)i.next();
                             attributes.put(entry.getKey(), entry.getValue());
                         }
+                        i = cid.getCopletData().getAttributes().entrySet().iterator();
+                        while ( i.hasNext() ) {
+                            Map.Entry entry = (Map.Entry)i.next();
+                            attributes.put(entry.getKey(), entry.getValue());
+                        }
                         ci.setAttribute("coplet-attributes", attributes);
                     } catch (ServiceException se) {
                         this.getLogger().warn("Unable to lookup portal service.", se);
@@ -378,25 +471,44 @@
                         this.manager.release(service);
                     }
                 }
-            }
+            store.addItem(ci);
         } else { 
-            basket.addItem(item);
+            store.addItem(item);
+            }
+        this.saveContentStore(store);
+    }
+
+    /**
+     * Save the content store if it is a briefcase or a folder
+     */
+    protected void saveContentStore(ContentStore store) {
+        if ( store instanceof Briefcase ) {
+            this.saveContentStore(BRIEFCASE_KEY, store);
+        } else if ( store instanceof Folder ) {
+            this.saveContentStore(FOLDER_KEY, store);
         }
     }
 
     /** 
-     * Load the basket for a single user
-     * @return The basket or null
+     * Load the content store for a single user
+     * @param type The type of the content store (briefcase or folder)
+     * @return The content store or null
      */
-    protected Basket loadBasket(String userId) {
+    protected ContentStore loadContentStore(String type, String userId) {
         if ( this.directory != null ) {
-            File file = new File(this.directory, userId+".basket");
+            final String suffix;
+            if ( FOLDER_KEY.equals(type) ) {
+                suffix = ".folder";
+            } else {
+                suffix = ".briefcase";
+            }
+            File file = new File(this.directory, userId + suffix);
             if ( file.exists() ) {
                 try {
                     ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
-                    Basket basket = (Basket)ois.readObject();
+                    ContentStore store = (ContentStore)ois.readObject();
                     ois.close();
-                    return basket;
+                    return store;
                 } catch (Exception ignore) {
                     // ignore this
                 }
@@ -406,37 +518,51 @@
     }
     
     /** 
-     * Load the basket 
+     * Load a content store
+     * @param type The type of the content store (briefcase or folder)
      */
-    protected Basket loadBasket() {
-        Basket basket = null;
-        AuthenticationManager authManager = null;
+    protected ContentStore loadContentStore(String type) {
+        ContentStore store = null;
+        String user = this.getUser();
+        if ( user != null ) {
+            store = this.loadContentStore(type, user);
+        }
+        if ( store == null && user != null ) {
         try {
-            authManager = (AuthenticationManager)this.manager.lookup(AuthenticationManager.ROLE);
-            RequestState rs = authManager.getState();
-            final String user = (String)rs.getHandler().getContext().getContextInfo().get("ID");
-            basket = this.loadBasket(user);
-        } catch (ProcessingException ignore) {
-            // ignore this
-        } catch (ServiceException ignore) {
-            // ignore this
+                final String clazzName;
+                if ( BRIEFCASE_KEY.equals(type) ) {
+                    clazzName = this.briefcaseClassName;
+                } else {
+                    clazzName = this.folderClassName;
         }
-        if ( basket == null ) {
-            try {
-                basket = (Basket)ClassUtils.newInstance(this.basketClassName);
+                
+                final Class clazz = ClassUtils.loadClass(clazzName);
+                final Constructor constructor = clazz.getConstructor(new Class[] {String.class});
+                
+                store = (ContentStore)constructor.newInstance(new Object[] {user});
             } catch (Exception ignore) {
-                basket = new Basket();
+                if ( BRIEFCASE_KEY.equals(type) ) {
+                    store = new Briefcase(user);
+                } else {
+                    store = new Folder(user);
+            }
             }
         }
-        return basket;
+        return store;
     }
     
     /** 
-     * Delete the basket for a u ser
+     * Delete the content store for a user
      */
-    protected void deleteBasket(String userId) {
+    protected void deleteContentStore(String type, String userId) {
+        final String suffix;
+        if ( FOLDER_KEY.equals(type) ) {
+            suffix = ".folder";
+        } else {
+            suffix = ".briefcase";
+        }
         if ( this.directory != null ) {
-            File file = new File(this.directory, userId+".basket");
+            File file = new File(this.directory, userId+suffix);
             if ( file.exists() ) {
                 file.delete();
             }
@@ -444,18 +570,26 @@
     }
 
     /** 
-     * Save the basket for a single user
+     * Save the content store for a single user
      */
-    protected void saveBasket(Basket basket, String userId) {
+    protected void saveContentStore(String type, ContentStore store) {
+        final String userId = store.getId();
+        final String suffix;
+        if ( FOLDER_KEY.equals(type) ) {
+            suffix = ".folder";
+        } else {
+            suffix = ".briefcase";
+        }
+        
         if ( this.directory != null ) {
-            File file = new File(this.directory, userId+".basket");
+            File file = new File(this.directory, userId+suffix);
             try {
                 if ( !file.exists() ) {
                     file.createNewFile();
-                    file = new File(this.directory, userId+".basket");
+                    file = new File(this.directory, userId+suffix);
                 }
                 ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
-                oos.writeObject(basket);
+                oos.writeObject(store);
                 oos.close();
             } catch (Exception ignore) {
                 // ignore this
@@ -464,80 +598,291 @@
     }
     
     /**
-     * Get baskets of all users
+     * Get briefcases of all users
      */
-    protected List loadBaskets() {
+    protected List loadBriefcases() {
         if ( this.directory != null ) {
             File directory = new File(this.directory);
             if ( directory.exists()) {
-                List baskets = new ArrayList();
+                List briefcases = new ArrayList();
                 File[] files = directory.listFiles();
                 for(int i=0; i<files.length;i++) {
                     String user = files[i].getName();
-                    int pos = user.indexOf(".basket");
+                    int pos = user.indexOf(".briefcase");
                     if ( pos != -1 ) {
                         user = user.substring(0, pos);
-                        Basket basket = this.loadBasket(user);
-                        if ( basket != null ) {
-                            BasketDescription bd = new BasketDescription();
+                        ContentStore store = this.loadContentStore(BRIEFCASE_KEY, user);
+                        if ( store != null ) {
+                            ContentStoreDescription bd = new ContentStoreDescription();
                             bd.id = user;
-                            bd.size = basket.contentSize();
-                            baskets.add(bd);
+                            bd.size = store.contentSize();
+                            briefcases.add(bd);
                         }
                     }
                 }
-                return baskets;
+                return briefcases;
             }
         }
         return null;
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBasket()
+     */
+    public Basket getBasket() {
+        Session session = ContextHelper.getRequest(this.context).getSession();
+        Basket basket = (Basket) session.getAttribute(BASKET_KEY);
+        if ( basket == null ) {
+            final String user = this.getUser();
+            try {
+                final Class clazz = ClassUtils.loadClass(this.basketClassName);
+                final Constructor constructor = clazz.getConstructor(new Class[] {String.class});
+                
+                basket = (Basket)constructor.newInstance(new Object[] {user});
+            } catch (Exception ignore) {
+                basket = new Basket(user);
+            }
+            session.setAttribute(BASKET_KEY, basket);
+        }
+        return basket;
+    }
+   
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBriefcase()
+     */
+    public Briefcase getBriefcase() {
+        Session session = ContextHelper.getRequest(this.context).getSession();
+        Briefcase briefcase = (Briefcase) session.getAttribute(BRIEFCASE_KEY);
+        if ( briefcase == null ) {
+            briefcase = (Briefcase)this.loadContentStore(BRIEFCASE_KEY);
+            session.setAttribute(BRIEFCASE_KEY, briefcase);
+        }
+        return briefcase;
+    }
+    
+    public Folder getFolder() {
+        Session session = ContextHelper.getRequest(this.context).getSession();
+        Folder folder = (Folder) session.getAttribute(FOLDER_KEY);
+        if ( folder == null ) {
+            folder = (Folder)this.loadContentStore(FOLDER_KEY);
+            session.setAttribute(FOLDER_KEY, folder);
+        }
+        return folder;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBriefcaseDescriptions()
+     */
+    public List getBriefcaseDescriptions() {
+        Session session = ContextHelper.getRequest(this.context).getSession();
+        List briefcases = (List)session.getAttribute(ALL_BRIEFCASES_KEY);
+        if ( briefcases == null ) {
+            briefcases = this.loadBriefcases();
+            if (briefcases == null) {
+                briefcases = new ArrayList();
+            }
+            session.setAttribute(ALL_BRIEFCASES_KEY, briefcases);
+        }
+        return briefcases;
+    }    
+    
     /** 
-     * Save the basket 
+     * Get the current user
      */
-    protected void saveBasket(Basket basket) {
-        if ( basket != null ) {
+    protected String getUser() {
             AuthenticationManager authManager = null;
             try {
                 authManager = (AuthenticationManager)this.manager.lookup(AuthenticationManager.ROLE);
                 RequestState rs = authManager.getState();
-                final String user = (String)rs.getHandler().getContext().getContextInfo().get("ID");
-                this.saveBasket(basket, user);
-            } catch (ProcessingException ignore) {
-                // ignore this
+            return rs.getHandler().getUserId();
             } catch (ServiceException ignore) {
                 // ignore this
+        } finally {
+            this.manager.release(authManager);
             }
+        return null;
+        
         }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBasketActions()
+     */
+    public List getBasketActions() {
+        return this.basketActions;
     }
     
     /* (non-Javadoc)
-     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBasket()
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBriefcaseActions()
      */
-    public Basket getBasket() {
-        Session session = ContextHelper.getRequest(this.context).getSession();
-        Basket basket = (Basket) session.getAttribute(BASKET_KEY);
-        if ( basket == null ) {
-            basket = this.loadBasket();
-            session.setAttribute(BASKET_KEY, basket);
+    public List getBriefcaseActions() {
+        return this.briefcaseActions;
+        }
+        
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#addBatch(org.apache.cocoon.portal.coplets.basket.ContentItem, int, org.apache.cocoon.portal.coplets.basket.BasketManager.ActionInfo)
+     */
+    public void addBatch(ContentItem item, 
+                         int frequencyInDays,
+                         ActionInfo action) {
+        final String name = action.name + "_" + item;
+        
+        final BatchInfo info = new BatchInfo();
+        info.item = item;
+        info.frequencyInSeconds = frequencyInDays * 60 * 60 * 24;
+        info.action = action;
+        if ( frequencyInDays > 0 ) {
+            synchronized (this.batches) {
+                BatchInfo old = this.searchBatchInfo(item, action);
+                if ( old != null ) {
+                    this.batches.remove(old);
+                    this.scheduler.removeJob(name);
+                }
+                this.batches.add(info);
+            }
+        }
+        final Job job = new Job(action.url, item);
+        
+        try {
+            if ( frequencyInDays > 0) {
+                this.scheduler.addPeriodicJob(name, job, info.frequencyInSeconds, false, null, null);
+            } else {
+                this.scheduler.fireJob(job);
+            }
+                
+        } catch (Exception ignore) {
+            this.getLogger().warn("Exception during adding of new batch.", ignore);
         }
-        return basket;
     }
    
+    protected BatchInfo searchBatchInfo(ContentItem item, ActionInfo info) {
+        final Iterator i = this.batches.iterator();
+        while (i.hasNext()) {
+            final BatchInfo current = (BatchInfo)i.next();
+            if ( current.item.equals(item) ) {
+                if ( current.action.name.equals(info.name) ) {
+                    return current;
+                }
+            }
+        }
+        return null;
+            }
+    
+    protected static final class BatchInfo {
+        public ContentItem item;
+        public int frequencyInSeconds;
+        public ActionInfo action;
+    }
+    
     /* (non-Javadoc)
-     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBaskets()
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBasketAction(java.lang.String)
      */
-    public List getBaskets() {
-        Session session = ContextHelper.getRequest(this.context).getSession();
-        List baskets = (List)session.getAttribute(ALL_BASKETS_KEY);
-        if ( baskets == null ) {
-            baskets = this.loadBaskets();
-            if (baskets == null) {
-                baskets = new ArrayList();
+    public ActionInfo getBasketAction(String name) {
+        final Iterator i = this.basketActions.iterator();
+        while ( i.hasNext() ) {
+            final ActionInfo current = (ActionInfo)i.next();
+            if ( current.name.equals(name) ) {
+                return current;
+        }
+    }
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#getBriefcaseAction(java.lang.String)
+     */
+    public ActionInfo getBriefcaseAction(String name) {
+        final Iterator i = this.briefcaseActions.iterator();
+        while ( i.hasNext() ) {
+            final ActionInfo current = (ActionInfo)i.next();
+            if ( current.name.equals(name) ) {
+                return current;
+            }
+        }
+        return null;
+    }
+    
+    public static final class Job extends ServiceableCronJob implements CronJob {
+        
+        protected final String url;
+        
+        public Job(String url, ContentItem item) {
+            final StringBuffer buffer = new StringBuffer(url);
+            boolean hasParams = url.indexOf('?') != -1;
+            Iterator i = item.attributes.entrySet().iterator();
+            while ( i.hasNext() ) {
+                final Map.Entry current = (Map.Entry)i.next();
+                final String key = current.getKey().toString();
+                if ( !"coplet-attributes".equals(key) ) {
+                    if ( hasParams ) {
+                        buffer.append('&');
+                    } else {
+                        buffer.append('?');
+                        hasParams = true;
+                    }
+                    buffer.append(key);
+                    buffer.append('=');
+                    buffer.append(current.getValue().toString());
+                }
+            }
+            // now add coplet attributes
+            Map copletAttributes = (Map)item.attributes.get("coplet-attributes");
+            if ( copletAttributes != null ) {
+                i = copletAttributes.entrySet().iterator();
+                while ( i.hasNext() ) {
+                    final Map.Entry current = (Map.Entry)i.next();
+                    final String key = current.getKey().toString();
+                    if ( hasParams ) {
+                        buffer.append('&');
+                    } else {
+                        buffer.append('?');
+                        hasParams = true;
+                    }
+                    buffer.append(key);
+                    buffer.append('=');
+                    buffer.append(current.getValue().toString());
+                }
+        }
+            this.url = buffer.toString();
+    }
+   
+    /* (non-Javadoc)
+         * @see org.apache.cocoon.components.cron.CronJob#execute(java.lang.String)
+     */
+        public void execute(String jobname) {
+            SourceResolver resolver = null;
+            Source source = null;
+            try {
+                resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
+                source = resolver.resolveURI(this.url);
+
+                InputStreamReader r = new InputStreamReader(source.getInputStream());
+                try {
+                    char[] b = new char[8192];
+
+                    while( r.read(b) > 0) {
+                        // nothing to do
+                    }
+
+                } finally {
+                    r.close();
+                }
+            } catch (Exception ignore) {
+                // we ignore all
+                this.getLogger().warn("Exception during execution of job " + jobname, ignore);
+            } finally {
+                if ( resolver != null ) {
+                    resolver.release(source);
+                    this.manager.release(resolver);
+                }
             }
-            session.setAttribute(ALL_BASKETS_KEY, baskets);
         }
-        return baskets;
     }    
     
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.coplets.basket.BasketManager#update(org.apache.cocoon.portal.coplets.basket.ContentStore)
+     */
+    public void update(ContentStore store) {
+        this.saveContentStore(store);
+    }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -16,59 +16,56 @@
 package org.apache.cocoon.portal.coplets.basket;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.List;
 
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.environment.wrapper.RequestParameters;
 import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.coplets.basket.BasketManager.ActionInfo;
+import org.apache.cocoon.portal.coplets.basket.events.AddItemEvent;
 import org.apache.cocoon.portal.event.Event;
-import org.apache.cocoon.transformation.AbstractSAXTransformer;
 import org.apache.cocoon.xml.AttributesImpl;
-import org.apache.commons.lang.BooleanUtils;
+import org.apache.cocoon.xml.XMLUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
 /**
- * This transformer supports the basket feature. It can generate links to
- * add content and to upload files into the basket.
+ * This transformer supports the basket and briefcase feature. It can generate links to
+ * add content into a content store.
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @version CVS $Id$
  */
 public class BasketTransformer
-extends AbstractSAXTransformer {
-
-    /** The namespace URI to listen for. */
-    public static final String NAMESPACE_URI = "http://apache.org/cocoon/portal/basket/1.0";
+    extends AbstractBasketTransformer {
 
     /** Element to add a link */
     protected static final String ADD_ITEM_ELEMENT = "add-item";
 
-    /** Element to upload an item */
-    protected static final String UPLOAD_ITEM_ELEMENT = "upload-item";
+    /** Element to show all actions */
+    protected static final String SHOW_ACTIONS_ELEMENT = "show-actions";
 
-    /** Element for the upload form */
-    protected static final String UPLOAD_FORM_ELEMENT = "upload-form";
+    /** The default store: briefcase or basket */
+    protected String defaultStoreName = "basket";
 
-    /** Upload element list */
-    protected List uploadElements = new ArrayList();
+    /** The default link element name */
+    protected String defaultLinkElement = "a";
 
-    /**
-     * Constructor
-     */
-    public BasketTransformer() {
-        this.defaultNamespaceURI = NAMESPACE_URI;
-    }
+    /** The default namespace for the link element */
+    protected String defaultLinkElementNS = "";
 
     /* (non-Javadoc)
-     * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
-    public void recycle() {
-        super.recycle();
-        this.uploadElements.clear();
+    public void configure(Configuration configuration)
+    throws ConfigurationException {
+        super.configure(configuration);
+        this.defaultStoreName = configuration.getChild("default-store").getValue(this.defaultStoreName);
+        this.defaultLinkElement = configuration.getChild("default-link-element").getValue(this.defaultLinkElement);
+        this.defaultLinkElementNS = configuration.getChild("default-link-element-ns").getValue(this.defaultLinkElementNS);
     }
 
     /* (non-Javadoc)
@@ -77,12 +74,11 @@
     public void endTransformingElement(String uri, String name, String raw)
     throws ProcessingException, IOException, SAXException {
         if ( ADD_ITEM_ELEMENT.equals(name) ) {
-            this.endElement("", "a", "a");
-        } else if ( UPLOAD_ITEM_ELEMENT.equals(name) ) {
-            this.endElement("", "input", "input");
-        } else if ( UPLOAD_FORM_ELEMENT.equals(name) ) {
-            this.endElement("", "form", "form");
-            this.uploadElements = new ArrayList();
+            final String linkElementName = this.parameters.getParameter("link-element", this.defaultLinkElement);
+            final String linkElementNS = this.parameters.getParameter("link-element-ns", this.defaultLinkElementNS);
+            XMLUtils.endElement(this.contentHandler, linkElementNS, linkElementName);
+        } else if ( SHOW_ACTIONS_ELEMENT.equals(name) ) {
+            // nothing to do here
         }
     }
 
@@ -93,60 +89,83 @@
                                          String raw, Attributes attr)
     throws ProcessingException, IOException, SAXException {
         if ( ADD_ITEM_ELEMENT.equals(name) ) {
-            String value = attr.getValue("content");
-            boolean addContent = BooleanUtils.toBoolean(value);
-            String href = attr.getValue("href");
             PortalService service = null;
             try {
                 service = (PortalService)this.manager.lookup(PortalService.ROLE);
-                ContentItem ci = new ContentItem(href, addContent);
-                Event e = new AddItemEvent(ci);
-                AttributesImpl ai = new AttributesImpl();
-                ai.addCDATAAttribute("href", service.getComponentManager().getLinkService().getLinkURI(e));
-                this.startElement("", "a", "a", ai);
-            } catch (ServiceException se) {
-                throw new SAXException("Unable to lookup portal service.", se);
-            } finally {
-                this.manager.release(service);
+
+                // do we want to add content or a link?
+            boolean addContent = false;
+                final String value = attr.getValue("content");
+            if ( value != null ) {
+                addContent = new Boolean(value).booleanValue();
+            }
+                
+                // do we want to add a url or a coplet?
+                final ContentItem ci;
+                final String href = attr.getValue("href");            
+                if ( href != null ) {
+                    ci = new ContentItem(href, addContent);
+                } else {
+                    final String copletId = attr.getValue("coplet");
+                    final CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(copletId);                    
+                    ci = new ContentItem(cid, addContent);
             }
 
-        } else if ( UPLOAD_ITEM_ELEMENT.equals(name) ) {
-            this.uploadElements.add(attr.getValue("name"));
-            this.startElement("", "input", "input", attr);
+                // do we want to add the content to the basket or to the briefcase
+                final ContentStore store;
+                final String storeName = (attr.getValue("store") == null ? this.defaultStoreName : attr.getValue("store"));
+                if ("basket".equalsIgnoreCase(storeName) )     {
+                    store = this.basketManager.getBasket();
+                } else {
+                    store = this.basketManager.getBriefcase();
+                }
 
-        } else if ( UPLOAD_FORM_ELEMENT.equals(name) ) {
-            AttributesImpl ai = new AttributesImpl(attr);
-            PortalService service = null;
-            String parameters;
-            try {
-                service = (PortalService)this.manager.lookup(PortalService.ROLE);
-                Event e = new UploadItemEvent(this.uploadElements);
-                parameters = service.getComponentManager().getLinkService().getLinkURI(e);
-                int pos = parameters.indexOf('?');
-                ai.addCDATAAttribute("action", parameters.substring(0, pos));
-                parameters = parameters.substring(pos+1);
+                final Event e = new AddItemEvent(store, ci);
+                final AttributesImpl ai = new AttributesImpl();
+                String newLink = service.getComponentManager().getLinkService().getLinkURI(e);
+                // check for bockmark
+                final String bookmark = attr.getValue("bookmark");
+                if ( bookmark != null && bookmark.length() > 0) {
+                    int pos = newLink.indexOf('?') + 1;
+                    final char separator;
+                    if ( bookmark.indexOf('?') == -1 ) {
+                        separator = '?';
+                    } else {
+                        separator = '&';
+                    }
+                    newLink = bookmark + separator + newLink.substring(pos);
+                }
+                ai.addCDATAAttribute("href", newLink);
+
+                final String linkElementName = this.parameters.getParameter("link-element", this.defaultLinkElement);
+                final String linkElementNS = this.parameters.getParameter("link-element-ns", this.defaultLinkElementNS);
+                XMLUtils.startElement(this.contentHandler, linkElementNS, linkElementName, ai);
             } catch (ServiceException se) {
                 throw new SAXException("Unable to lookup portal service.", se);
             } finally {
                 this.manager.release(service);
             }
-            this.startElement("", "form", "form", ai);
-            if ( parameters != null && parameters.length() > 0 ) {
-                // create hidden input fields
-                RequestParameters pars = new RequestParameters(parameters);
-                Enumeration enumeration = pars.getParameterNames();
-                while ( enumeration.hasMoreElements() ) {
-                    String pName = (String)enumeration.nextElement();
-                    String pValue = pars.getParameter(pName);
-                    AttributesImpl hiddenAttrs = new AttributesImpl();
-                    hiddenAttrs.addCDATAAttribute("type", "hidden");
-                    hiddenAttrs.addCDATAAttribute("name", pName);
-                    hiddenAttrs.addCDATAAttribute("value", pValue);
-                    this.startElement("", "input", "input", hiddenAttrs);
-                    this.endElement("", "input", "input");
+        } else if ( SHOW_ACTIONS_ELEMENT.equals(name) ) {
+            // basket or briefcase
+            final List actions;
+            final String storeName = (attr.getValue("store") == null ? this.defaultStoreName : attr.getValue("store"));
+            if ("basket".equalsIgnoreCase(storeName) )     {
+                actions = this.basketManager.getBasketActions();
+            } else {
+                actions = this.basketManager.getBriefcaseActions();
                 }
+            final String checkedAction = attr.getValue("checked");
+            final Iterator i = actions.iterator();
+            AttributesImpl a = new AttributesImpl();
+            while ( i.hasNext() ) {
+                final BasketManager.ActionInfo current = (ActionInfo) i.next();
+                a.addCDATAAttribute("name", current.name);
+                if ( current.name.equals(checkedAction) ) {
+                    a.addCDATAAttribute("checked", "true");
+                }
+                XMLUtils.createElement(this.xmlConsumer, "action", a);
+                a.clear();
             }
-
         }
     }
 

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Briefcase.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Briefcase.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Briefcase.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+/**
+ * This is a per user basket that is persistent between sessions
+ * Make a subclass to add your specific functionality
+ *
+ * @version CVS $Id: Basket.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class Briefcase extends ContentStore {
+    
+    public Briefcase(String id) {
+        super(id);
+    }
+}
\ No newline at end of file

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/CleanBasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/CleanBasketEvent.java?view=auto&rev=125055
==============================================================================

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentItem.java	Thu Jan 13 02:33:37 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-2005 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.
@@ -24,9 +24,7 @@
  * This is an item that contains a link or a content.
  * The item can either reference a coplet or an URL.
  *
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * 
- * @version CVS $Id: ContentItem.java,v 1.2 2004/03/05 13:02:11 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class ContentItem extends AbstractItem implements Serializable {
     
@@ -137,5 +135,9 @@
             }
         }
         return false;
+    }
+    
+    public void setTitle(String title) {
+        this.stringRep = title;
     }
 }

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStore.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStore.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStore.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+/**
+ * This is a per user store that can contain any object. 
+ * Make a subclass to add your specific functionality.
+ *
+ * @version CVS $Id: Basket.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public abstract class ContentStore implements Serializable {
+    
+    /** The ordered list of items */
+    protected final List items = new ArrayList();
+    
+    /** The id */
+    protected final String id;
+    
+    /**
+     * The constructor
+     */
+    public ContentStore(String id) {
+        this.id = id;
+    }
+    
+    /**
+     * @return Returns the id.
+     */
+    public String getId() {
+        return this.id;
+    }
+    
+    /**
+     * Get an item at the index
+     */
+    public Object getItem(int index) {
+        return this.items.get(index);
+    }
+    
+    /**
+     * Add an item
+     */
+    public void addItem(Object item) {
+        this.items.add(item);
+    }
+    
+    /**
+     * Get the iterator
+     */
+    public Iterator getIterator() {
+        return this.items.iterator();
+    }
+    
+    /**
+     * Remove an item
+     */
+    public void removeItem(Object item) {
+        this.items.remove(item);
+    }
+    
+    /**
+     * Number of items in the basket
+     */
+    public int size() {
+        return this.items.size();
+    }
+
+    /**
+     * Calculate the size of a basket
+     */
+    public int contentSize() {
+        int size = 0;
+        Iterator i = this.items.iterator();
+        while (i.hasNext()) {
+            Object item = i.next();
+            if ( item instanceof ContentItem ) {
+                int v = ((ContentItem)item).size();
+                if ( v != -1 ) {
+                    size += v;
+                }
+            }
+        }
+        return size;
+    }
+    
+    /**
+     * Get an item with the id
+     */
+    public Object getItem(long id) {
+        Iterator i = this.items.iterator();
+        while (i.hasNext()) {
+            Object item = i.next();
+            if ( item instanceof AbstractItem ) {
+                if (((AbstractItem)item).getId() == id ) {
+                    return item;
+                }
+            }
+        }
+        return null;        
+    }
+}
+

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStoreDescription.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStoreDescription.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ContentStoreDescription.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+/**
+ * This class describes a {@link ContentStore}.
+ *
+ * @version CVS $Id: Basket.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class ContentStoreDescription {
+
+    /** The id */
+    public String id;
+    /** The size of the basket */
+    public int    size;
+
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Folder.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Folder.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/Folder.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+/**
+ * This is a per user basket that is persistent between sessions
+ * Make a subclass to add your specific functionality
+ *
+ * @version CVS $Id: Basket.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class Folder extends ContentStore {
+
+    public Folder(String id) {
+        super(id);
+    }
+
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/FolderTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/FolderTransformer.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/FolderTransformer.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.wrapper.RequestParameters;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.coplets.basket.events.UploadItemEvent;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.xml.AttributesImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * This transformer supports the basket feature. It can generate links to
+ * add content and to upload files into the basket.
+ *
+ * @version CVS $Id: BasketTransformer.java 47047 2004-09-22 12:27:27Z vgritsenko $
+ */
+public class FolderTransformer
+    extends AbstractBasketTransformer {
+
+    /** Element to upload an item */
+    protected static final String UPLOAD_ITEM_ELEMENT = "upload-item";
+
+    /** Element for the upload form */
+    protected static final String UPLOAD_FORM_ELEMENT = "upload-form";
+
+    /** Upload element list */
+    protected List uploadElements = new ArrayList();
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
+     */
+    public void recycle() {
+        super.recycle();
+        this.uploadElements.clear();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.transformation.AbstractSAXTransformer#endTransformingElement(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void endTransformingElement(String uri, String name, String raw)
+    throws ProcessingException, IOException, SAXException {
+        if ( UPLOAD_ITEM_ELEMENT.equals(name) ) {
+            this.endElement("", "input", "input");
+        } else if ( UPLOAD_FORM_ELEMENT.equals(name) ) {
+            this.endElement("", "form", "form");
+            this.uploadElements = new ArrayList();
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.transformation.AbstractSAXTransformer#startTransformingElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+     */
+    public void startTransformingElement(String uri, String name,
+                                         String raw, Attributes attr)
+    throws ProcessingException, IOException, SAXException {
+        if ( UPLOAD_ITEM_ELEMENT.equals(name) ) {
+            this.uploadElements.add(attr.getValue("name"));
+            this.startElement("", "input", "input", attr);
+        } else if ( UPLOAD_FORM_ELEMENT.equals(name) ) {
+            AttributesImpl ai = new AttributesImpl(attr);
+            PortalService service = null;
+            String parameters;
+            try {
+                service = (PortalService)this.manager.lookup(PortalService.ROLE);
+                Event e = new UploadItemEvent(this.basketManager.getFolder(), this.uploadElements);
+                parameters = service.getComponentManager().getLinkService().getLinkURI(e);
+                int pos = parameters.indexOf('?');
+                ai.addCDATAAttribute("action", parameters.substring(0, pos));
+                parameters = parameters.substring(pos+1);
+            } catch (ServiceException se) {
+                throw new SAXException("Unable to lookup portal service.", se);
+            } finally {
+                this.manager.release(service);
+            }
+            this.startElement("", "form", "form", ai);
+            if ( parameters != null && parameters.length() > 0 ) {
+                // create hidden input fields
+                RequestParameters pars = new RequestParameters(parameters);
+                Enumeration enum = pars.getParameterNames();
+                while ( enum.hasMoreElements() ) {
+                    String pName = (String)enum.nextElement();
+                    String pValue = pars.getParameter(pName);
+                    AttributesImpl hiddenAttrs = new AttributesImpl();
+                    hiddenAttrs.addCDATAAttribute("type", "hidden");
+                    hiddenAttrs.addCDATAAttribute("name", pName);
+                    hiddenAttrs.addCDATAAttribute("value", pValue);
+                    this.startElement("", "input", "input", hiddenAttrs);
+                    this.endElement("", "input", "input");
+                }
+            }
+        }
+    }
+
+}
\ No newline at end of file

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/RefreshBasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/RefreshBasketEvent.java?view=auto&rev=125055
==============================================================================

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/RemoveItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/RemoveItemEvent.java?view=auto&rev=125055
==============================================================================

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/SaveBasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/SaveBasketEvent.java?view=auto&rev=125055
==============================================================================

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ShowBasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ShowBasketEvent.java?view=auto&rev=125055
==============================================================================

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ShowItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/ShowItemEvent.java?view=auto&rev=125055
==============================================================================

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UploadItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UploadItemEvent.java?view=auto&rev=125055
==============================================================================

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UserConfiguration.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UserConfiguration.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/UserConfiguration.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket;
+
+import java.util.Map;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+import org.apache.cocoon.portal.profile.ProfileManager;
+
+/**
+ * This data object holds the configuration of a user for the basket
+ *
+ * @version CVS $Id: BasketTransformer.java 47047 2004-09-22 12:27:27Z vgritsenko $
+ */
+public class UserConfiguration {
+
+    /** The attribute name used to store this configuration in the session */
+    public static final String ATTR_NAME = "basket-config";
+    
+    protected boolean basketEnabled = true;
+    protected boolean briefcaseEnabled = false;
+    protected boolean folderEnabled = false;
+    
+    /**
+     * Get/create the user configuration
+     */
+    public static UserConfiguration get(Map           objectModel,
+                                        PortalService service) {
+        final Request req = ObjectModelHelper.getRequest(objectModel);
+        final Session session = req.getSession();
+        UserConfiguration uc = (UserConfiguration)session.getAttribute(ATTR_NAME);
+        if ( uc == null ) {
+            final ProfileManager pm = service.getComponentManager().getProfileManager();
+            final CopletInstanceData cid = pm.getCopletInstanceData("basket");
+            if ( cid != null ) {
+                uc = new UserConfiguration(cid.getAttributes());
+                session.setAttribute(ATTR_NAME, uc);
+            }
+        }
+        return uc;
+    }
+    
+    /**
+     * Constructor
+     * Read the configuration from the map
+     */
+    public UserConfiguration(Map attributes) {
+        final String enabledKinds = (String)attributes.get("basket:enabled-storages");
+        if ( enabledKinds != null ) {
+            this.basketEnabled = (enabledKinds.indexOf("basket") != -1);
+            this.briefcaseEnabled = (enabledKinds.indexOf("briefcase") != -1);
+            this.folderEnabled = (enabledKinds.indexOf("folder") != -1);
+        }
+    }
+    
+    public boolean isBasketEnabled() {
+        return this.basketEnabled;
+    }
+
+    public boolean isBriefcaseEnabled() {
+        return this.briefcaseEnabled;
+    }
+
+    public boolean isFolderEnabled() {
+        return this.folderEnabled;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/AddItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/AddItemEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/AddItemEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import org.apache.cocoon.portal.coplets.basket.ContentStore;
+
+/**
+ * This event is used to add an item to the content store
+ *
+ * @version CVS $Id: AddItemEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class AddItemEvent extends ContentStoreEvent {
+    
+    /** The item to add */
+    protected Object item;
+    
+    /**
+     * Constructor
+     * @param store   The content store
+     * @param item    The item that will be added to the content store
+     */
+    public AddItemEvent(ContentStore store, Object item) {
+        super(store);
+        this.item = item;
+    }
+    
+    /**
+     * The item
+     */
+    public Object getItem() {
+        return this.item;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/CleanBriefcaseEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/CleanBriefcaseEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/CleanBriefcaseEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import org.apache.cocoon.portal.coplets.basket.Briefcase;
+
+/**
+ * Clean all briefcases or a single one
+ *
+ * @version CVS $Id: CleanBasketEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class CleanBriefcaseEvent extends ContentStoreEvent {
+    
+    /**
+     * Constructor
+     * If this constructor is used all baskets will be cleaned
+     */
+    public CleanBriefcaseEvent() {
+        // nothing to do here
+    }
+    
+    /**
+     * Constructor
+     * One briefcase will be cleaned
+     * @param briefcaseId The briefcase
+     */
+    public CleanBriefcaseEvent(Briefcase briefcase) {
+        super(briefcase);
+    }
+    
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ContentStoreEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ContentStoreEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ContentStoreEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import org.apache.cocoon.portal.coplets.basket.ContentStore;
+import org.apache.cocoon.portal.event.Event;
+
+/**
+ * This is the base class for all content store events
+ *
+ * @version CVS $Id: BasketEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public abstract class ContentStoreEvent implements Event {
+    
+    protected final ContentStore store;
+    
+    /**
+     * this is a general event for a set of content stores
+     */
+    public ContentStoreEvent() {
+        this.store = null; 
+    }
+    
+    /**
+     * This event is for a defined content store
+     */
+    public ContentStoreEvent(ContentStore store) {
+        this.store = store;
+    }
+    
+    public ContentStore getContentStore() {
+        return this.store;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/MoveItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/MoveItemEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/MoveItemEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import org.apache.cocoon.portal.coplets.basket.ContentStore;
+
+/**
+ * Move an item from one store to another
+ *
+ * @version CVS $Id: RemoveItemEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class MoveItemEvent extends ContentStoreEvent {
+    
+    /** The item to move */
+    protected Object item;
+    
+    /** The target store */
+    protected final ContentStore target;
+    
+    /**
+     * Constructor
+     * @param store The content store
+     * @param item  The item to move
+     * @param target The target store
+     */
+    public MoveItemEvent(ContentStore store, Object item, ContentStore target) {
+        super(store);
+        this.item = item;
+        this.target = target;
+    }
+    
+    /**
+     * Return the item to remove
+     */
+    public Object getItem() {
+        return this.item;
+    }
+    
+    /** 
+     * Return the target
+     */
+    public ContentStore getTarget() {
+        return this.target;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RefreshBasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RefreshBasketEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RefreshBasketEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+
+
+/**
+ * Refresh the list of baskets for the administration
+ *
+ * @version CVS $Id: RefreshBasketEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class RefreshBasketEvent extends ContentStoreEvent {
+    
+    /**
+     * Constructor
+     */
+    public RefreshBasketEvent() {
+        // nothing to do here
+    }
+    
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RemoveItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RemoveItemEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/RemoveItemEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import org.apache.cocoon.portal.coplets.basket.ContentStore;
+
+/**
+ * Remove an item from the content store 
+ *
+ * @version CVS $Id: RemoveItemEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class RemoveItemEvent extends ContentStoreEvent {
+    
+    /** The item to remove */
+    protected Object item;
+    
+    /**
+     * Constructor
+     * @param store The icontent store
+     * @param item  The item to remove
+     */
+    public RemoveItemEvent(ContentStore store, Object item) {
+        super(store);
+        this.item = item;
+    }
+    
+    /**
+     * Return the item to remove
+     */
+    public Object getItem() {
+        return this.item;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowBasketEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowBasketEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowBasketEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+
+
+/**
+ * Show the contents of one basket
+ *
+ * @version CVS $Id: ShowBasketEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class ShowBasketEvent extends ContentStoreEvent {
+    
+    /** The basket to show */
+    protected String basketId;
+    
+    /**
+     * Constructor
+     * @param basketId The id of the basket
+     */
+    public ShowBasketEvent(String basketId) {
+        this.basketId = basketId;
+    }
+    
+    /**
+     * Return the basket id
+     */
+    public String getBasketId() {
+        return this.basketId;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowItemEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/ShowItemEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import org.apache.cocoon.portal.coplets.basket.ContentStore;
+import org.apache.cocoon.portal.layout.Layout;
+
+/**
+ * Show one item of a content store
+ *
+ * @version CVS $Id: ShowItemEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class ShowItemEvent extends ContentStoreEvent {
+    
+    /** The item to show */
+    protected final Object item;
+    
+    /** The layout object to use */
+    protected final Layout layout;
+    
+    /** The id of the coplet data used to display the content */
+    protected final String copletData;
+    
+    /**
+     * Constructor
+     * @param store      The content store
+     * @param item       The item to show
+     * @param layout     The layout object where the item is displayed
+     * @param copletData The coplet data id of a content coplet
+     */
+    public ShowItemEvent(ContentStore store, Object item, Layout layout, String copletData) {
+        super(store);
+        this.item = item;
+        this.layout = layout;
+        this.copletData = copletData;
+    }
+    
+    /**
+     * Return item
+     */
+    public Object getItem() {
+        return this.item;
+    }
+    
+    /**
+     * Return the layout
+     */
+    public Layout getLayout() {
+        return this.layout;
+    }
+    
+    /**
+     * Return the coplet data id
+     */
+    public String getCopletDataId() {
+        return this.copletData;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/UploadItemEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/UploadItemEvent.java?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/events/UploadItemEvent.java	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 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.cocoon.portal.coplets.basket.events;
+
+import java.util.List;
+
+import org.apache.cocoon.portal.coplets.basket.ContentStore;
+
+/**
+ * This event adds uploaded files to the content store
+ *
+ * @version CVS $Id: UploadItemEvent.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class UploadItemEvent extends ContentStoreEvent {
+    
+    /** List of parameter names containing uploaded files */
+    protected final List itemNames;
+    
+    /** 
+     * Constructor
+     * @param itemNames List of parameter names with uploaded files
+     */
+    public UploadItemEvent(ContentStore store, List itemNames) {
+        super(store);
+        this.itemNames = itemNames;
+    }
+    
+    /**
+     * Return the list of parameter names
+     */
+    public List getItemNames() {
+        return this.itemNames;
+    }
+}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java	Thu Jan 13 02:33:37 2005
@@ -232,11 +232,10 @@
         String encodedLabel;
         try {
             encodedLabel = SourceUtil.encode(label, "utf-8");
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             encodedLabel = SourceUtil.encode(label);
         }
         uri.append(parmName).append('=').append(encodedLabel);
         return uri.toString();
     }
-}
\ No newline at end of file
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.js
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.js?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.js	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,348 @@
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+
+// This function is invoked by every coplet to check if the basket is already full
+function add() {
+    var copletId = cocoon.parameters["id"];
+    var type = cocoon.parameters["type"];
+    var storage = "basket";
+
+    var pu = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
+    var dom = pu.processToDOM("fetch-quota", { "storage": storage, "type": type});
+
+    var node = org.apache.excalibur.xml.xpath.XPathUtil.getFirstNodeFromPath(dom,
+                        org.apache.excalibur.xml.xpath.XPathUtil.buildPathArray("result/attribute/item"), false);
+    var itemCount = org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(node);
+    node = org.apache.excalibur.xml.xpath.XPathUtil.getFirstNodeFromPath(dom,
+                        org.apache.excalibur.xml.xpath.XPathUtil.buildPathArray("result/attribute/size"), false);
+    var maxSize = org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(node);
+    
+    var manager = cocoon.getComponent(org.apache.cocoon.portal.coplets.basket.BasketManager.ROLE);
+    var store;
+    if ( storage.equals("basket" ) ) {
+        store = manager.getBasket();
+    } else {
+        store = manager.getBriefcase();
+    }
+    var isFull = true;
+    
+    if ( store.size() < itemCount && store.contentSize() < maxSize ) {
+        isFull = false;
+    }
+    cocoon.sendPage(cocoon.parameters["view"], {"bookmark" : type, "isBasketFull" : isFull});
+}
+
+// This function is invoked by every coplet to check if the basket is already full
+function getQuota() {
+    var type = cocoon.parameters["type"];
+    var storage = "basket";
+
+    var pu = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
+    var dom = pu.processToDOM("fetch-quota", { "storage": storage, "type": type});
+
+    var node = org.apache.excalibur.xml.xpath.XPathUtil.getFirstNodeFromPath(dom,
+                        org.apache.excalibur.xml.xpath.XPathUtil.buildPathArray("result/attribute/item"), false);
+    var itemCount = org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(node);
+    node = org.apache.excalibur.xml.xpath.XPathUtil.getFirstNodeFromPath(dom,
+                        org.apache.excalibur.xml.xpath.XPathUtil.buildPathArray("result/attribute/size"), false);
+    var maxSize = org.apache.cocoon.xml.dom.DOMUtil.getValueOfNode(node);
+    if ( maxSize != null && maxSize.length() > 0 ) {
+        var d = new java.lang.Double(maxSize).doubleValue();
+        d = d / 10.24;
+        d = Math.floor(d) / 100.0;
+        if ( d < 0.1 && d != 0.0 ) { d = 0.1; }
+        maxSize = java.lang.String.valueOf(d);
+    }
+    cocoon.sendPage(cocoon.parameters["view"], {"itemCount" : itemCount, "maxSize" : maxSize});
+}
+
+// This function is invoked by the coplet with input process
+function eval() {
+    var copletId = cocoon.parameters["id"];
+    var type = cocoon.parameters["type"];
+    var storage = "basket";
+
+    var manager = cocoon.getComponent(org.apache.cocoon.portal.coplets.basket.BasketManager.ROLE);
+    var store;
+    if ( storage.equals("basket" ) ) {
+        store = manager.getBasket();
+    } else {
+        store = manager.getBriefcase();
+    }
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var linkService = service.getComponentManager().getLinkService();
+    var profileManager = service.getComponentManager().getProfileManager();
+    // update the attribute of the current coplet:
+    var coplet = profileManager.getCopletInstanceData(copletId);
+    coplet.setAttribute("value", cocoon.request["text"]);
+   
+    var url;
+    
+    // let's check the action
+    if ( cocoon.request["content"] != null ) {
+        // the content button has been pressed
+        var target = profileManager.getCopletInstanceData("basket-sample-7");
+        target.setAttribute("value", cocoon.request["text"]);
+        var item = new Packages.org.apache.cocoon.portal.coplets.basket.ContentItem(target, true);
+        var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.AddItemEvent(store, item);
+        url = linkService.getLinkURI(event);
+        // now use a bookmark to switch the tab
+        var pos = url.indexOf('?');
+        url = "bookmark?baskettab=2&" + url.substring(pos+1);
+    } else if ( cocoon.request["link"] != null ) {
+        // the link button has been pressed
+        var target = profileManager.getCopletInstanceData("basket-sample-7");
+        target.setAttribute("value", cocoon.request["text"]);
+        var item = new Packages.org.apache.cocoon.portal.coplets.basket.ContentItem(target, false);
+        var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.AddItemEvent(store, item);
+        url = linkService.getLinkURI(event);
+        // now use a bookmark to switch the tab
+        var pos = url.indexOf('?');
+        url = "bookmark?baskettab=2&" + url.substring(pos+1);
+    } else {
+        // we redirect to the main page
+        url = "portal";
+    }
+    
+    // we have to reset our state
+    coplet.setAttribute("doNotCache", "1");
+    coplet.setTemporaryAttribute("application-uri", coplet.getCopletData().getAttribute("temporary:application-uri"));
+
+    // and now do a redirect
+    cocoon.redirectTo(url, true);
+}
+
+// This function changes the title
+function changeTitle() {
+    var copletId = cocoon.parameters["id"];
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var profileManager = service.getComponentManager().getProfileManager();
+    var coplet = profileManager.getCopletInstanceData(copletId);
+
+    // title is the first 25 characters
+    var title = coplet.getAttribute("value");
+    if ( title != null ) {
+        var l = 25;
+        if ( title.length() < 25 ) { l = title.length(); }
+        title = title.substring(0, l);
+    }
+    coplet.setAttribute("title", title);
+    cocoon.sendPage(cocoon.parameters["view"]);
+}
+
+// This function is invoked by the query sample
+function query() {
+    var copletId = cocoon.parameters["id"];
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var profileManager = service.getComponentManager().getProfileManager();
+    var coplet = profileManager.getCopletInstanceData(copletId);
+
+    var target = profileManager.getCopletInstanceData("basket-sample-2");
+    var value = target.getAttribute("value");
+    if ( value == null ) value = 0;
+    var millis = Packages.java.lang.System.currentTimeMillis();
+    millis = millis + ((new Packages.java.lang.Long(value).longValue()) * 60000);
+    var date = new Packages.java.util.Date(millis);
+    coplet.setAttribute("value", date);
+    
+    cocoon.sendPage(cocoon.parameters["view"], {"date" : date});
+}
+
+function showresult() {
+    var copletId = cocoon.parameters["id"];
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var profileManager = service.getComponentManager().getProfileManager();
+    var coplet = profileManager.getCopletInstanceData(copletId);
+
+    cocoon.sendPage(cocoon.parameters["view"], {"date" : coplet.getAttribute("value")});
+}
+
+// This function is invoked to add the result of the query
+function result() {
+    var copletId = cocoon.parameters["id"];
+    var storage = "basket";
+
+    var manager = cocoon.getComponent(org.apache.cocoon.portal.coplets.basket.BasketManager.ROLE);
+    var store;
+    if ( storage.equals("basket" ) ) {
+        store = manager.getBasket();
+    } else {
+        store = manager.getBriefcase();
+    }
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var profileManager = service.getComponentManager().getProfileManager();
+    var coplet = profileManager.getCopletInstanceData(copletId);
+
+    var item = new Packages.org.apache.cocoon.portal.coplets.basket.ContentItem("cocoon://samples/blocks/portal/coplets/basket/copletwithappresult.showresult.flow", true);
+    var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.AddItemEvent(store, item);
+
+    service.getComponentManager().getEventManager().getPublisher().publish(event);
+    
+    cocoon.sendPage(cocoon.parameters["view"]);
+}
+
+// this function is invoked to show the dialog after the query
+function dialog() {
+    var copletId = cocoon.parameters["id"];
+    var storage = "basket";
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var profileManager = service.getComponentManager().getProfileManager();
+    var coplet = profileManager.getCopletInstanceData(copletId);
+
+    var manager = cocoon.getComponent(org.apache.cocoon.portal.coplets.basket.BasketManager.ROLE);
+    var store;
+    if ( storage.equals("basket" ) ) {
+        store = manager.getBasket();
+    } else {
+        store = manager.getBriefcase();
+    }
+
+    var item = new Packages.org.apache.cocoon.portal.coplets.basket.ContentItem(coplet, false);
+    var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.AddItemEvent(store, item);
+
+    service.getComponentManager().getEventManager().getPublisher().publish(event);
+
+    var action;
+    if ( storage.equals("basket" ) ) {
+        action = manager.getBasketAction(cocoon.request["action"]);
+    } else {
+        action = manager.getBriefcaseAction(cocoon.request["action"]);
+    }
+    var freq = new Packages.java.lang.Integer(cocoon.request["frequency"]).intValue();
+    item.setAttribute("action-replay", "true");
+    item.setAttribute("action-name", cocoon.request["action"]);
+    item.setAttribute("action-freq", new java.lang.Long(freq).toString());
+   
+    manager.addBatch(item, freq, action);
+
+    cocoon.sendPage(cocoon.parameters["view"]);
+}    
+
+// This function is invoked by the coplet list sample
+function list() {
+    var copletId = cocoon.parameters["id"];
+    var storage = "basket";
+
+    var manager = cocoon.getComponent(org.apache.cocoon.portal.coplets.basket.BasketManager.ROLE);
+    var store;
+    if ( storage.equals("basket" ) ) {
+        store = manager.getBasket();
+    } else {
+        store = manager.getBriefcase();
+    }
+
+    // get the portal service
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    var profileManager = service.getComponentManager().getProfileManager();
+    var coplet = profileManager.getCopletInstanceData(copletId);
+    
+    // now test check boxes
+    if ( cocoon.request["sample1"] != null ) {
+        addCoplet(profileManager, service, store, "basket-sample-1");
+    }
+    if ( cocoon.request["sample2"] != null ) {
+        addCoplet(profileManager, service, store, "basket-sample-2");
+    }
+    if ( cocoon.request["sample3"] != null ) {
+        addCoplet(profileManager, service, store, "basket-sample-3");
+    }
+    if ( cocoon.request["sample4"] != null ) {
+        addCoplet(profileManager, service, store, "basket-sample-4");
+    }
+    if ( cocoon.request["sample5"] != null ) {
+        addCoplet(profileManager, service, store, "basket-sample-5");
+    }
+
+    // we have to reset our state
+    coplet.setTemporaryAttribute("application-uri", coplet.getCopletData().getAttribute("temporary:application-uri"));
+
+    cocoon.redirectTo(coplet.getTemporaryAttribute("application-uri"), false);
+}
+
+// helper function
+function addCoplet(profileManager, service, store, copletId) {
+    var coplet = profileManager.getCopletInstanceData(copletId);
+    var item = new Packages.org.apache.cocoon.portal.coplets.basket.ContentItem(coplet, true);
+    var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.AddItemEvent(store, item);
+
+    service.getComponentManager().getEventManager().getPublisher().publish(event);
+}
+
+// process the form of the content portlet
+function processBasket() {
+    var manager = cocoon.getComponent(org.apache.cocoon.portal.coplets.basket.BasketManager.ROLE);
+    var service = cocoon.getComponent(org.apache.cocoon.portal.PortalService.ROLE);
+    if ( service.getPortalName() == null ) {
+        service.setPortalName("portal");
+    }
+    
+    // test parameters
+    var names = cocoon.request.getParameterNames();
+    while ( names.hasMoreElements()) {
+        var name = names.nextElement();
+        if ( name.startsWith("c" )) {
+            var id = name.substring(1);
+            var actionName = cocoon.request["a"+id];
+            var storage = cocoon.request["s"+id]
+            var store;
+            if ( storage.equals("basket" ) ) {
+                store = manager.getBasket();
+            } else if ( storage.equals("folger") ) {
+                store = manager.getFolder();
+            } else {
+                store = manager.getBriefcase();
+            }
+            var item = store.getItem(new Packages.java.lang.Long(id));
+            
+            if ( "delete".equals(actionName) ) {
+                // delete
+                var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.RemoveItemEvent(store, item);
+                service.getComponentManager().getEventManager().getPublisher().publish(event);
+            } else if ( "briefcase".equals(actionName) ) {
+                // move to briefcase
+                var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.MoveItemEvent(store, item, manager.getBriefcase());               
+                service.getComponentManager().getEventManager().getPublisher().publish(event);
+            } else if ( "basket".equals(actionName) ) {
+                // move to basket
+                var event = new Packages.org.apache.cocoon.portal.coplets.basket.events.MoveItemEvent(store, item, manager.getBasket());               
+                service.getComponentManager().getEventManager().getPublisher().publish(event);
+            } else {
+                // this is a real action
+			    var action;
+			    if ( storage.equals("basket" ) ) {
+			        action = manager.getBasketAction(actionName);
+			    } else {
+			        action = manager.getBriefcaseAction(actionName);
+			    }
+			    var freq = new Packages.java.lang.Integer(cocoon.request["f"+id]).intValue();
+			    if ( cocoon.request["r"+id] != null ) {
+  			        // store values
+  			        item.setAttribute("action-replay", cocoon.request["r"+id]);
+  			        item.setAttribute("action-name", actionName);
+			        item.setAttribute("action-freq", new java.lang.Long(freq).toString());
+  			    } else {
+  			        item.removeAttribute("action-name");
+  			        item.removeAttribute("action-freq");
+  			        item.removeAttribute("action-replay");
+  			        freq = -1;
+  			    }
+			    manager.update(store);
+			    
+			    // call batch
+			    manager.addBatch(item, freq, action);
+            }        
+        }
+    }
+    cocoon.redirectTo("../../portal", true);
+}
\ No newline at end of file

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/basket.xsl?view=auto&rev=125055
==============================================================================

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sample.xml	Thu Jan 13 02:33:37 2005
@@ -16,6 +16,6 @@
 -->
 <p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
 This is a sample for the basket portlet.<br/>
-<basket:add-item href="context://samples/blocks/portal/coplets/basket/sample.xml">Add a link to the content of this coplet.</basket:add-item><br/>
-<basket:add-item href="context://samples/blocks/portal/coplets/basket/sample.xml" content="true">Add the content of this coplet.</basket:add-item><br/>
-</p>
\ No newline at end of file
+<basket:add-item href="context://samples/blocks/portal/coplets/basket/sample.xml" content="true">Add the content</basket:add-item>&#160;
+<basket:add-item href="context://samples/blocks/portal/coplets/basket/sample.xml">Add the link</basket:add-item>
+</p>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/sitemap.xmap	Thu Jan 13 02:33:37 2005
@@ -16,7 +16,6 @@
 -->
 
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
 <map:components>
   <map:generators default="file">
     <map:generator name="basket" src="org.apache.cocoon.portal.coplets.basket.BasketGenerator"/>
@@ -24,19 +23,55 @@
   </map:generators>
   <map:transformers default="xslt">
     <map:transformer name="basket" src="org.apache.cocoon.portal.coplets.basket.BasketTransformer"/>
+      <map:transformer name="folder" src="org.apache.cocoon.portal.coplets.basket.FolderTransformer"/>
   </map:transformers>
 </map:components>
 
-<map:pipelines>
+  <!-- indicates what flowscript to attach to this sitemap -->
+  <map:flow language="javascript">
+    <map:script src="basket.js"/>
+  </map:flow>
     
+<map:pipelines>
   <map:pipeline>	
 
-    <map:match pattern="upload-sample">
-        <map:generate src="upload.xml"/>
-        <map:transform type="basket"/>
+        <map:match pattern="application">
+            <map:generate src="{coplet:temporaryAttributes/application-uri}?copletid={coplet:#}"/>
+            <map:transform type="portal-html-eventlink">
+                <map:parameter name="attribute-name" value="application-uri"/>
+            </map:transform>
         <map:serialize type="xml"/>
     </map:match>
 
+      <!-- This is the preprocessing pipeline: 
+           First a function in flow script is called which in turn
+           calls the view
+      -->
+      <map:match pattern="*.*.preflow">
+        <map:call function="{2}">
+          <map:parameter name="id" value="{coplet:#}"/>
+          <map:parameter name="type" value="{coplet:copletData/attributes/group}"/>
+          <map:parameter name="view" value="{1}"/>
+        </map:call>
+      </map:match>
+
+      <map:match pattern="*.*.flow">
+        <map:act type="portal-object-model">
+          <map:parameter name="copletId" value="{request-param:copletid}"/>
+          <map:parameter name="portalName" value="portal"/>
+        </map:act>
+        <map:call function="{2}">
+          <map:parameter name="id" value="{request-param:copletid}"/>
+          <map:parameter name="type" value="{coplet:copletData/attributes/group}"/>
+          <map:parameter name="view" value="{1}"/>
+        </map:call>
+      </map:match>
+
+      <map:match pattern="*.process">
+        <map:call function="{1}">
+        </map:call>
+      </map:match>
+
     <map:match pattern="sample">
         <map:generate src="sample.xml"/>
         <map:transform type="basket"/>
@@ -51,13 +86,28 @@
         <map:serialize type="xml"/>
     </map:match>
 
+     <!-- show the whole basket -->
     <map:match pattern="basket">
+        <map:call function="getQuota">
+          <map:parameter name="type" value="{coplet:attributes/type}"/>
+          <map:parameter name="view" value="basket-view"/>
+        </map:call>
+      </map:match>
+
+      <map:match pattern="basket-view">
         <map:generate type="basket">
             <map:parameter name="show-coplet" value="BasketContent"/>
             <map:parameter name="show-layout" value="basket-content"/>
             <map:parameter name="admin-mode" value="false"/>
+          <map:parameter name="type" value="{coplet:attributes/type}"/>
+          <map:parameter name="type-location" value="group"/>
         </map:generate>
-        <map:transform type="xslt" src="basket.xsl"/>
+        <map:transform src="xsl/basket-pre.xsl">
+          <map:parameter name="itemCount" value="{flow-attribute:itemCount}"/>
+          <map:parameter name="maxSize" value="{flow-attribute:maxSize}"/>
+        </map:transform>
+        <map:transform type="basket"/>
+        <map:transform src="xsl/basket-post.xsl"/>
         <map:serialize type="xml"/>
     </map:match>
 
@@ -77,11 +127,113 @@
             <map:parameter name="show-layout" value="basket-content-admin"/>
             <map:parameter name="admin-mode" value="true"/>
         </map:generate>
-        <map:transform type="xslt" src="basket.xsl"/>
+        <map:transform src="xsl/basket-pre.xsl"/>
         <map:serialize type="xml"/>
     </map:match>
 
-  </map:pipeline>
+      <!-- This is the static sample coplet -->
+      <map:match pattern="staticcoplet">
+        <map:generate src="xml/staticcoplet.xml" type="jx"/>
+        <map:transform type="basket"/>
+        <map:serialize type="xml"/>
+      </map:match>
+    
+      <!-- This is the coplet list sample-->
+      <map:match pattern="copletlist">
+        <map:generate src="xml/copletlist.xml" type="jx"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- This is the pipeline for the coplet with attribute sample -->
+      <map:match pattern="copletwithattr">
+        <map:generate src="xml/copletwithattr.xml" type="jx"/>
+        <map:transform type="basket"/>
+        <map:transform src="xsl/copletwithattr.xsl">
+          <map:parameter name="value" value="{coplet:attributes/value}"/>
+          <map:parameter name="coplet" value="{coplet:#}"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+    
+      <!-- This is the pipeline for the coplet with inline process sample -->
+      <map:match pattern="copletwithinline">
+        <map:generate src="xml/copletwithinline.xml" type="jx"/>
+        <map:transform src="xsl/copletwithinline.xsl">
+          <map:parameter name="value" value="{coplet:attributes/value}"/>
+          <map:parameter name="coplet" value="{coplet:#}"/>
+        </map:transform>
+        <map:transform type="basket">
+          <map:parameter name="link-element" value="parameter"/>
+          <map:parameter name="link-element-ns" value="http://apache.org/cocoon/portal/coplet/1.0"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- This is the pipeline for the coplet with input process sample -->
+      <map:match pattern="copletwithinput">
+        <map:generate src="xml/copletwithinput.xml" type="jx">
+          <map:parameter name="value" value="{coplet:attributes/value}"/>
+        </map:generate>
+        <map:serialize type="xml"/>
+      </map:match>
+      <!-- This is the pipeline for the coplet with input process show sample -->
+      <map:match pattern="copletwithinputshow">
+        <map:generate src="xml/copletwithinputshow.xml" type="jx">
+          <map:parameter name="value" value="{coplet:attributes/value}"/>
+          <map:parameter name="title" value="{coplet:attributes/title}"/>
+        </map:generate>
+        <map:serialize type="xml"/>
+      </map:match>
 
+      <!-- This is the pipeline for the coplet with application sample -->
+      <map:match pattern="copletwithapp">
+        <map:generate src="xml/copletwithapp.xml" type="jx"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- This is the pipeline for the coplet with application sample -->
+      <map:match pattern="copletwithappresult">
+        <map:generate src="xml/copletwithappresult.xml" type="jx">
+          <map:parameter name="copletId" value="{coplet:#}"/>
+        </map:generate>
+        <map:transform type="basket"/>
+        <map:transform src="xsl/copletwithappresult.xsl"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- This is the pipeline for the coplet with upload sample -->
+      <map:match pattern="copletwithupload">
+        <map:generate src="xml/copletwithupload.xml" type="jx"/>
+        <map:transform type="folder"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- This pipeline is used to fetch the quota for a user -->
+      <map:match pattern="fetch-quota">
+        <!-- we need the user ID -->
+        <map:act type="auth-protect">
+          <map:parameter name="handler" value="portal-handler"/>
+          <map:parameter name="application" value="portal"/>
+ 
+          <map:select type="resource-exists">
+            <map:when test="context://samples/blocks/portal/profiles/basket/quotas-user-{ID}.xml">
+              <map:generate src="context://samples/blocks/portal/profiles/basket/quotas-user-{ID}.xml"/>
+            </map:when>
+            <map:when test="context://samples/blocks/portal/profiles/basket/quotas-role-{role}.xml">
+              <map:generate src="context://samples/blocks/portal/profiles/basket/quotas-role-{role}.xml"/>
+            </map:when>
+            <map:otherwise>
+              <map:generate src="context://samples/blocks/portal/profiles/basket/quotas.xml"/>                     
+            </map:otherwise>
+          </map:select>
+          <map:transform src="xsl/quota2result.xsl">
+             <map:parameter name="storage" value="{flow-attribute:storage}"/> 
+             <map:parameter name="type" value="{flow-attribute:type}"/> 
+          </map:transform>
+          <map:serialize type="xml"/>
+        </map:act>
+      </map:match>
+
+  </map:pipeline>
 </map:pipelines>
 </map:sitemap>

Deleted: /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/upload.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/upload.xml?view=auto&rev=125055
==============================================================================

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletlist.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletlist.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletlist.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+Add one (or more) coplets to your basket.
+<form method="POST" action="copletlist.list.flow">
+  <table>
+    <tr><th>&#160;</th><th>Title</th></tr>
+    <tr><td><input type="checkbox" name="sample1" value="sample1"/></td><td>Static Coplet</td></tr>
+    <tr><td><input type="checkbox" name="sample2" value="sample2"/></td><td>Coplet with Attribute</td></tr>
+    <tr><td><input type="checkbox" name="sample3" value="sample3"/></td><td>Coplet with Inline Processing</td></tr>
+    <tr><td><input type="checkbox" name="sample4" value="sample4"/></td><td>Coplet with Input Processing</td></tr>
+    <tr><td><input type="checkbox" name="sample5" value="sample5"/></td><td>Coplet with Application</td></tr>
+  </table>
+  <input type="submit" name="Add" value="Add"/>
+</form>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithapp.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithapp.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithapp.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p>
+This application adds the number stored in the 'Coplet with attribute'
+to the current time.
+<form method="POST" action="copletwithappresult.query.flow">
+  <input type="submit" name="query" value="Query"/>
+</form>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappdialog.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappdialog.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappdialog.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+The stored time is ${date}.
+<a href="copletwithappdialog">Add the query</a>&#160;
+<a href="copletwithapp.result.flow">Add the result</a>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappresult.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappresult.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithappresult.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+The stored time is ${date}.
+<a href="copletwithapp.result.flow">Add the result</a><br/>
+<form method="POST" action="copletwithapp.dialog.flow">
+  Frequency: <input type="text" name="frequency" value="1"/><br/>
+  Action: <select name="action" size="2">
+    <basket:show-actions/>
+  </select><br/>
+  <input type="submit" value="Add the query"/>
+</form>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithattr.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithattr.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithattr.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+This number (<value/>) is stored in an attribute.<br/>
+<buttons/>
+<basket:add-item coplet="basket-sample-2" content="true">Add the content</basket:add-item>&#160;
+<basket:add-item coplet="basket-sample-2">Add the link</basket:add-item>
+<jx:if test="#{isBasketFull}" xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+<br/><b>You have reached the allowed quota for your basket.</b>
+</jx:if>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinline.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinline.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinline.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0" xmlns:coplet="http://apache.org/cocoon/portal/coplet/1.0">
+  This number (<value/>) is stored in an attribute.<br/>
+  <table><tr>
+    <td>
+      <coplet:links format="html-form" method="POST" base-url="bookmark">
+        <coplet:parameter href="baskettab=1"/>
+        <plus>Plus one and add the content</plus>
+        <basket:add-item coplet="basket-sample-3" content="true"/>
+      </coplet:links>
+    </td>
+    <td>
+      <coplet:links format="html-form" method="POST" base-url="bookmark">
+        <coplet:parameter href="baskettab=1"/>
+        <plus>Plus one and add the link</plus>
+        <basket:add-item coplet="basket-sample-3"/>
+      </coplet:links>
+    </td>
+  </tr></table>
+<jx:if test="#{isBasketFull}" xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+<br/><b>You have reached the allowed quota for your basket.</b>
+</jx:if>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinput.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinput.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinput.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p>
+  Enter some text:<br/>
+<form method="POST" action="copletwithinput.eval.flow">
+  <textarea name="text" cols="30" rows="7">${parameters.getParameter('value')}</textarea>&#160;
+  <input type="submit" name="save" value="Save"/>
+  <input type="submit" name="content" value="Add the content and goto basket"/>
+  <input type="submit" name="link" value="Add the link and goto basket"/>
+</form>
+<jx:if test="#{isBasketFull}" xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+<br/><b>You have reached the allowed quota for your basket.</b>
+</jx:if>
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinputshow.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinputshow.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithinputshow.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p>
+  Title: ${parameters.getParameter('title')}<br/>
+  Your message was: ${parameters.getParameter('value')}
+</p>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithupload.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithupload.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/copletwithupload.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<basket:upload-form method="POST" enctype="multipart/form-data"  xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+Upload Test
+  <basket:upload-item type="file" name="doc"/><br/>
+  <input type="submit"/>
+<jx:if test="#{isBasketFull}" xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+<br/><b>You have reached the allowed quota for your basket.</b>
+</jx:if>
+<br/>
+This sample does only work, if you enabled uploads for Cocoon!
+</basket:upload-form>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/staticcoplet.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/staticcoplet.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xml/staticcoplet.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<p xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+This is a sample for the basket portlet.<br/>
+  <basket:add-item href="context://samples/blocks/portal/coplets/basket/sample.xml" content="true">Add the content</basket:add-item>&#160;
+  <basket:add-item href="context://samples/blocks/portal/coplets/basket/sample.xml">Add the link</basket:add-item>&#160;&#160;
+  <basket:add-item store="briefcase" href="context://samples/blocks/portal/coplets/basket/sample.xml" content="true">Add the content to the briefcase</basket:add-item>&#160;
+  <basket:add-item store="briefcase" href="context://samples/blocks/portal/coplets/basket/sample.xml">Add the link to the briefcase</basket:add-item>
+<jx:if test="#{isBasketFull}" xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+<br/><b>You have reached the allowed quota for your basket.</b>
+</jx:if>
+</p>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-post.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-post.xsl?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-post.xsl	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="action">
+  <option value="{@name}">
+    <xsl:if test="@checked">
+      <xsl:attribute name="selected">selected</xsl:attribute>
+    </xsl:if>
+    <xsl:value-of select="@name"/>
+  </option>
+</xsl:template>
+
+<xsl:template match="@*|node()" ><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-pre.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-pre.xsl?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/basket-pre.xsl	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+<!-- $Id: basket.xsl 36225 2004-08-11 14:36:46Z vgritsenko $ 
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:param name="itemCount"/>
+<xsl:param name="maxSize"/>
+
+<xsl:template match="basket-content">
+  <h1>Your Basket</h1>
+  <p>You have <xsl:value-of select="item-count"/> items in your basket (Allowed: <xsl:value-of select="$itemCount"/>)
+     / <xsl:value-of select="item-size"/> Kb (Allowed: <xsl:value-of select="$maxSize"/> Kb).</p>
+  <xsl:apply-templates select="items"/>
+</xsl:template>
+
+<xsl:template match="items">
+    <form method="POST" action="coplets/basket/processBasket.process">
+  <table>
+    <tr>
+      <th>&#160;</th>
+      <th>Title</th>
+      <th>Size</th>
+      <th>Storage</th>
+      <th>Replay</th>
+      <th>Frequency</th>
+      <th>Action</th>
+    </tr>
+    <xsl:for-each select="item" xmlns:basket="http://apache.org/cocoon/portal/basket/1.0">
+   
+      <tr>
+        <td><input type="checkbox" name="c{id}" value="{id}"/>&#160;</td>
+        <td><a href="{show-url}"><xsl:value-of select="title"/></a></td>
+        <td><xsl:value-of select="size"/></td>
+        <td><xsl:value-of select="store"/><input type="hidden" value="{store}" name="s{id}"/></td>
+        <td>
+          <input type="checkbox" name="r{id}" value="{id}">
+            <xsl:if test="attributes/attribute[@name='action-replay']/@value != ''">
+              <xsl:attribute name="checked">checked</xsl:attribute>
+            </xsl:if>
+          </input>
+           &#160;
+        </td>
+        <xsl:variable name="freq">
+          <xsl:choose>
+            <xsl:when test="attributes/attribute[@name='action-freq']/@value != ''">
+              <xsl:value-of select="attributes/attribute[@name='action-freq']/@value"/>
+            </xsl:when>
+            <xsl:otherwise>1</xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <td>Days: <input type="text" name="f{id}" value="{$freq}" size="3"/></td>
+        <td>
+          <select name="a{id}" size="1">
+            <xsl:choose>
+              <xsl:when test="store = 'basket' and //configuration/basket">
+                <option selected="selected" value="briefcase">Move to Briefcase</option>
+              </xsl:when>
+              <xsl:when test="store = 'briefcase' and //configuration/briefcase">
+                <option selected="selected" value="basket">Move to Basket</option>
+              </xsl:when>
+            </xsl:choose>
+            <option value="delete">delete</option>
+            <basket:show-actions storage="{store}" checked="{attributes/attribute[@name='action-name']/@value}"/>
+          </select>
+        </td>
+      </tr>
+    </xsl:for-each>
+  </table>
+  <input type="submit" value="Change" name="Change"/>
+  </form>
+</xsl:template>
+
+<xsl:template match="basket-admin">
+  <h1>Basket Administration</h1>
+  <xsl:apply-templates select="baskets"/>
+  <p><a href="{refresh-url}">Refresh list</a> - <a href="{clean-url}">Clean all baskets</a></p>
+</xsl:template>
+
+<xsl:template match="baskets">
+  <table>
+    <xsl:for-each select="basket">
+      <tr>
+        <td><a href="{show-url}"><xsl:value-of select="id"/></a></td>
+        <td><xsl:value-of select="size"/></td>
+        <td><a href="{remove-url}">Clean Basket</a></td>
+      </tr>
+    </xsl:for-each>
+  </table>
+</xsl:template>
+
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithappresult.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithappresult.xsl?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithappresult.xsl	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="action">
+  <option value="{@name}">
+    <xsl:value-of select="@name"/>
+  </option>
+</xsl:template>
+
+<xsl:template match="@*|node()" ><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithattr.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithattr.xsl?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithattr.xsl	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:coplet="http://apache.org/cocoon/portal/coplet/1.0">
+
+  <xsl:param name="value"/>
+  <xsl:param name="coplet"/>
+
+  <xsl:template match="value">
+    <xsl:choose>
+      <xsl:when test="$value = ''">0</xsl:when>
+      <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match="buttons">
+    <xsl:variable name="definedvalue">
+      <xsl:choose>
+        <xsl:when test="$value = ''">0</xsl:when>
+        <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <table><tr>
+    <td>
+    <coplet:link method="POST" format="html-form" coplet="{$coplet}" path="attributes/value" value="{$definedvalue + 1}">
+      <input type="submit" name="+1" value="+1"/>
+    </coplet:link>
+    </td>
+    <td>
+    <coplet:link method="POST" format="html-form" coplet="{$coplet}" path="attributes/value" value="{$definedvalue - 1}">
+      <input type="submit" name="-1" value="-1"/>
+    </coplet:link>
+    </td>
+    </tr></table>
+  </xsl:template>
+
+  <!-- Add a style attribute to the links -->
+  <xsl:template match="a">
+    <a style="color:blue;font-size:200%">
+      <xsl:apply-templates select="@*|text()"/>
+    </a>
+  </xsl:template>
+  
+  <xsl:template match="@*|node()" ><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithinline.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithinline.xsl?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/copletwithinline.xsl	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                              xmlns:coplet="http://apache.org/cocoon/portal/coplet/1.0">
+
+  <xsl:param name="value"/>
+  <xsl:param name="coplet"/>
+
+  <xsl:template match="value">
+    <xsl:choose>
+      <xsl:when test="$value = ''">0</xsl:when>
+      <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template match="plus">
+    <xsl:variable name="definedvalue">
+      <xsl:choose>
+        <xsl:when test="$value = ''">0</xsl:when>
+        <xsl:otherwise><xsl:value-of select="$value"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <coplet:link coplet="{$coplet}" path="attributes/value" value="{$definedvalue + 1}"/>
+    <coplet:content><input type="submit" name="{.}" value="{.}"/></coplet:content>
+  </xsl:template>
+
+  <xsl:template match="@*|node()" ><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/quota2result.xsl
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/quota2result.xsl?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/basket/xsl/quota2result.xsl	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-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.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:param name="storage"/>
+<xsl:param name="type"/>
+
+<xsl:template match="/">
+  <result>
+    <xsl:if test="$storage='folder'">
+      <!-- Copy the global values for the folder -->
+      <attribute>
+        <xsl:copy-of select="basket-quota/storage/storage[@value='folder']/*"/>
+      </attribute>
+    </xsl:if>
+    <xsl:if test="$storage!='folder'">
+      <!-- If type is not specified use global values -->
+      <xsl:if test="$type=''">
+        <attribute>
+          <xsl:copy-of select="basket-quota/storage/storage[@value=$storage]/*"/>
+        </attribute>
+      </xsl:if>
+      <xsl:if test="$type!=''">
+        <xsl:copy-of select="basket-quota/storage/storage[@value=$storage]/attribute[@name='type']/attribute[@value=$type]"/>
+      </xsl:if>
+    </xsl:if>
+  </result>
+</xsl:template>
+
+</xsl:stylesheet>
+

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-cocoon.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-cocoon.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-cocoon.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-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.
+-->
+<basket-quota>
+     <storage>
+            <storage value="basket">
+                <item>5</item>
+                <size>8096</size>
+                <attribute name="type">
+                    <attribute value="document">      
+                        <item>2</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="request">      
+                        <item>2</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="result">      
+                        <item>2</item>
+                        <size>10240</size>
+                    </attribute>
+                    <attribute value="notepad">      
+                        <item>2</item>
+                        <size>2048</size>
+                    </attribute>
+                    <attribute value="folder">      
+                        <item>100</item>
+                        <size>102400</size>
+                    </attribute>
+                 </attribute>
+            </storage>
+            <storage value="briefcase">
+                <item>5</item>
+                <size>8096</size>
+                <attribute name="type">
+                    <attribute value="document">      
+                        <item>10</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="request">      
+                        <item>5</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="result">      
+                        <item>10</item>
+                        <size>10240</size>
+                    </attribute>
+                    <attribute value="notepad">      
+                        <item>5</item>
+                        <size>2048</size>
+                    </attribute>
+                    <attribute value="folder">      
+                        <item>100</item>
+                        <size>102400</size>
+                    </attribute>
+                 </attribute>
+            </storage>
+            <storage value="folder">
+                <item>100</item>
+                <size>102400</size>
+            </storage>
+      </storage>
+</basket-quota>
+

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-guest.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-guest.xml?view=auto&rev=125056
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/basket/quotas-user-guest.xml	Thu Jan 13 02:33:37 2005
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-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.
+-->
+<basket-quota>
+     <storage>
+            <storage value="basket">
+                <item>5</item>
+                <size>8096</size>
+                <attribute name="type">
+                    <attribute value="document">      
+                        <item>2</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="request">      
+                        <item>2</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="result">      
+                        <item>2</item>
+                        <size>10240</size>
+                    </attribute>
+                    <attribute value="notepad">      
+                        <item>2</item>
+                        <size>2048</size>
+                    </attribute>
+                    <attribute value="folder">      
+                        <item>100</item>
+                        <size>102400</size>
+                    </attribute>
+                 </attribute>
+            </storage>
+            <storage value="briefcase">
+                <item>5</item>
+                <size>8096</size>
+                <attribute name="type">
+                    <attribute value="document">      
+                        <item>10</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="request">      
+                        <item>5</item>
+                        <size>1024</size>
+                    </attribute>
+                    <attribute value="result">      
+                        <item>10</item>
+                        <size>10240</size>
+                    </attribute>
+                    <attribute value="notepad">      
+                        <item>5</item>
+                        <size>2048</size>
+                    </attribute>
+                    <attribute value="folder">      
+                        <item>100</item>
+                        <size>102400</size>
+                    </attribute>
+                 </attribute>
+            </storage>
+            <storage value="folder">
+                <item>100</item>
+                <size>102400</size>
+            </storage>
+      </storage>
+</basket-quota>
+

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml	Thu Jan 13 02:33:37 2005
@@ -236,14 +236,15 @@
    </coplet-data>
 
    <!--
-     +  The basket coplet
+     +  The basket coplets
+     +  The uri's for these coplets have to be absolut, so you have to use cocoon://!
      -->
    <coplet-data id="BasketContent" name="standard">
       <title>Basket Item</title>
       <coplet-base-data>URICoplet</coplet-base-data>
       <attribute>
          <name>uri</name>
-         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/basket/content</value>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/content</value>
       </attribute>
    </coplet-data>
    <coplet-data id="BasketAdmin" name="standard">
@@ -251,7 +252,7 @@
       <coplet-base-data>URICoplet</coplet-base-data>
       <attribute>
          <name>uri</name>
-         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/basket/basket-admin</value>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/basket-admin</value>
       </attribute>
    </coplet-data>
    <coplet-data id="Basket" name="standard">
@@ -259,7 +260,7 @@
       <coplet-base-data>URICoplet</coplet-base-data>
       <attribute>
          <name>uri</name>
-         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/basket/basket</value>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/basket</value>
       </attribute>
    </coplet-data>
    <coplet-data id="Basket.admin" name="standard">
@@ -267,31 +268,139 @@
       <coplet-base-data>URICoplet</coplet-base-data>
       <attribute>
          <name>uri</name>
-         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/basket/basket.admin</value>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/basket.admin</value>
       </attribute>
    </coplet-data>
-   <coplet-data id="BasketSample" name="standard">
-      <title>Basket Sample</title>
+   <coplet-data id="BasketSampleStaticCoplet" name="standard">
+      <title>Static Coplet</title>
       <coplet-base-data>URICoplet</coplet-base-data>
       <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">document</value>
+      </attribute>
+      <attribute>
+         <name>uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/staticcoplet.add.preflow</value>
+      </attribute>
+   </coplet-data>
+   <coplet-data id="BasketSampleCopletWithAttribute" name="standard">
+      <title>Coplet with Attribute</title>
+      <coplet-base-data>URICoplet</coplet-base-data>
+      <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">document</value>
+      </attribute>
+      <attribute>
          <name>uri</name>
-         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/basket/sample</value>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletwithattr.add.preflow</value>
+      </attribute>
+   </coplet-data>
+   <coplet-data id="BasketSampleCopletWithInlineProcess" name="standard">
+      <title>Coplet with Inline Process</title>
+      <coplet-base-data>URICoplet</coplet-base-data>
+      <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">document</value>
       </attribute>
       <attribute>
-         <name>basket-link</name>
+         <name>uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletwithinline.add.preflow</value>
+      </attribute>
+   </coplet-data>
+   <coplet-data id="BasketSampleCopletWithInputProcess" name="standard">
+      <title>Coplet with Input Processing</title>
+      <coplet-base-data>CachingURICoplet</coplet-base-data>
+      <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">notepad</value>
+      </attribute>
+      <attribute>
+         <name>buffer</name>
          <value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
       </attribute>
       <attribute>
-         <name>basket-content</name>
+         <name>handleParameters</name>
          <value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
       </attribute>
+      <attribute>
+         <name>uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/application</value>
+      </attribute>
+      <attribute>
+         <name>temporary:application-uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletwithinput.add.flow</value>
+      </attribute>
    </coplet-data>
-   <coplet-data id="BasketUploadSample" name="standard">
-      <title>Basket Upload</title>
+   <coplet-data id="BasketSampleCopletWithInputProcessShow" name="standard">
+      <title>Show Input</title>
       <coplet-base-data>URICoplet</coplet-base-data>
       <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">notepad</value>
+      </attribute>
+      <attribute>
+         <name>uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletwithinputshow.changeTitle.preflow</value>
+      </attribute>
+   </coplet-data>
+   <coplet-data id="BasketSampleCopletWithApp" name="standard">
+      <title>Coplet with Application</title>
+      <coplet-base-data>CachingURICoplet</coplet-base-data>
+      <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">request</value>
+      </attribute>
+      <attribute>
+         <name>buffer</name>
+         <value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
+      </attribute>
+      <attribute>
+         <name>handleParameters</name>
+         <value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
+      </attribute>
+      <attribute>
+         <name>uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/application</value>
+      </attribute>
+      <attribute>
+         <name>temporary:application-uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletwithapp.add.flow</value>
+      </attribute>
+   </coplet-data>
+   <coplet-data id="BasketSampleCopletList" name="standard">
+      <title>Coplet List</title>
+      <coplet-base-data>CachingURICoplet</coplet-base-data>
+      <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">request</value>
+      </attribute>
+      <attribute>
+         <name>buffer</name>
+         <value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
+      </attribute>
+      <attribute>
+         <name>handleParameters</name>
+         <value xsi:type="java:java.lang.Boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
+      </attribute>
+      <attribute>
+         <name>uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/application</value>
+      </attribute>
+      <attribute>
+         <name>temporary:application-uri</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletlist</value>
+      </attribute>
+   </coplet-data>
+   <coplet-data id="BasketSampleCopletWithUpload" name="standard">
+      <title>Coplet with Input Process</title>
+      <coplet-base-data>URICoplet</coplet-base-data>
+      <attribute>
+         <name>group</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">folder</value>
+      </attribute>
+      <attribute>
          <name>uri</name>
-         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/basket/upload-sample</value>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon://samples/blocks/portal/coplets/basket/copletwithupload.add.preflow</value>
       </attribute>
    </coplet-data>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml	Thu Jan 13 02:33:37 2005
@@ -90,23 +90,84 @@
       <coplet-data>Portlet2</coplet-data>
    </coplet-instance-data>
 
-   <coplet-instance-data id="Basket" name="standard">
+   <!-- This is the basket sample
+   -->
+   <coplet-instance-data id="basket" name="standard">
       <coplet-data>Basket</coplet-data>
+      <attribute>  <!-- which kinds are enabled for this user: briefcase, basker, folder? -->
+         <name>basket:enabled-storages</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">briefcase,basket,folder</value>
+      </attribute>
    </coplet-instance-data>
+
+   <coplet-instance-data id="basket-document" name="standard">
+       <coplet-data>Basket</coplet-data>
+      <attribute>
+         <name>type</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">document</value>
+      </attribute>       
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-request" name="standard">
+       <coplet-data>Basket</coplet-data>
+      <attribute>
+         <name>type</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">request</value>
+      </attribute>       
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-result" name="standard">
+       <coplet-data>Basket</coplet-data>
+      <attribute>
+         <name>type</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">result</value>
+      </attribute>       
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-notepad" name="standard">
+      <coplet-data>Basket</coplet-data>
+      <attribute>
+         <name>type</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">notepad</value>
+      </attribute>       
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-folder" name="standard">
+       <coplet-data>Basket</coplet-data>
+      <attribute>
+         <name>type</name>
+         <value xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">folder</value>
+      </attribute>       
+   </coplet-instance-data>
+
    <coplet-instance-data id="Basket.admin" name="standard">
       <coplet-data>Basket.admin</coplet-data>
    </coplet-instance-data>
-   <coplet-instance-data id="BasketContent" name="standard">
+   <coplet-instance-data id="basket-content" name="standard">
       <coplet-data>BasketContent</coplet-data>
    </coplet-instance-data>
    <coplet-instance-data id="BasketAdmin" name="standard">
       <coplet-data>BasketAdmin</coplet-data>
    </coplet-instance-data>
-   <coplet-instance-data id="BasketSample" name="standard">
-      <coplet-data>BasketSample</coplet-data>
+   <coplet-instance-data id="basket-sample-1" name="standard">
+      <coplet-data>BasketSampleStaticCoplet</coplet-data>
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-sample-2" name="standard">
+      <coplet-data>BasketSampleCopletWithAttribute</coplet-data>
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-sample-3" name="standard">
+      <coplet-data>BasketSampleCopletWithInlineProcess</coplet-data>
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-sample-4" name="standard">
+      <coplet-data>BasketSampleCopletWithInputProcess</coplet-data>
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-sample-5" name="standard">
+      <coplet-data>BasketSampleCopletWithApp</coplet-data>
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-sample-6" name="standard">
+      <coplet-data>BasketSampleCopletWithUpload</coplet-data>
+   </coplet-instance-data>
+   <coplet-instance-data id="basket-sample-7" name="standard">
+      <coplet-data>BasketSampleCopletWithInputProcessShow</coplet-data>
    </coplet-instance-data>
-   <coplet-instance-data id="BasketUploadSample" name="standard">
-      <coplet-data>BasketUploadSample</coplet-data>
+   <coplet-instance-data id="basket-sample-8" name="standard">
+      <coplet-data>BasketSampleCopletList</coplet-data>
    </coplet-instance-data>
 
    <coplet-instance-data id="TestPortlet-1" name="standard">

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml?view=diff&rev=125056&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml&r1=125055&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml&r2=125056
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/layout/portal.xml	Thu Jan 13 02:33:37 2005
@@ -220,20 +220,46 @@
     <!-- This is the basket demo. Usually you would only have the user
     tab for users and the admin tab for the admin and not both at
     the same time (But this is a demo...) -->
-    <composite-layout name="tab">
-      <named-item name="User">
-
+    <composite-layout name="tab" id="baskettab">
+      <named-item name="List">
         <composite-layout name="row">
           <item>
             <composite-layout name="column">
               <item>
                 <coplet-layout name="coplet">
-                  <coplet-instance-data>BasketSample</coplet-instance-data>
+                  <coplet-instance-data>basket-sample-8</coplet-instance-data>
+                </coplet-layout>
+              </item>
+            </composite-layout>
+          </item>
+        </composite-layout>
+      </named-item>
+      <named-item name="Input">
+        <composite-layout name="row">
+          <item>
+            <composite-layout name="column">
+              <item>
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-sample-1</coplet-instance-data>
+                </coplet-layout>
+              </item>
+              <item>
+                <coplet-layout name="coplet" >
+                  <coplet-instance-data>basket-sample-2</coplet-instance-data>
+                </coplet-layout>
+              </item>
+            </composite-layout>
+          </item>
+          <item>
+            <composite-layout name="column">
+              <item>
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-sample-3</coplet-instance-data>
                 </coplet-layout>
               </item>
               <item>
                 <coplet-layout name="coplet" >
-                  <coplet-instance-data>BasketUploadSample</coplet-instance-data>
+                  <coplet-instance-data>basket-sample-4</coplet-instance-data>
                 </coplet-layout>
               </item>
             </composite-layout>
@@ -242,14 +268,66 @@
             <composite-layout name="column">
               <item>
                 <coplet-layout name="coplet">
-                  <coplet-instance-data>Basket</coplet-instance-data>
+                  <coplet-instance-data>basket-sample-5</coplet-instance-data>
+                </coplet-layout>
+              </item>
+              <item>
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-sample-6</coplet-instance-data>
                 </coplet-layout>
               </item>
+            </composite-layout>
+          </item>
+        </composite-layout>
+      </named-item>
+      <named-item name="Content">
+        <composite-layout name="row">
+          <item>
+            <composite-layout name="tab">
+              <named-item name="All">
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket</coplet-instance-data>
+                </coplet-layout>
+              </named-item>
+              <named-item name="Document">
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-document</coplet-instance-data>
+                </coplet-layout>
+              </named-item>
+              <named-item name="Request">
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-request</coplet-instance-data>
+                </coplet-layout>
+              </named-item>
+              <named-item name="Result">
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-result</coplet-instance-data>
+                </coplet-layout>
+              </named-item>
+              <named-item name="Notepad">
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-notepad</coplet-instance-data>
+                </coplet-layout>
+              </named-item>
+              <named-item name="Folder">
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-folder</coplet-instance-data>
+                </coplet-layout>
+              </named-item>
+            </composite-layout>
+          </item>
+          <item>
+            <composite-layout name="column">
               <item>
                 <coplet-layout name="coplet" id="basket-content">
-                  <coplet-instance-data>BasketContent</coplet-instance-data>
+                  <coplet-instance-data>basket-content</coplet-instance-data>
                 </coplet-layout>
               </item>
+              <item>
+                <coplet-layout name="coplet">
+                  <coplet-instance-data>basket-sample-7</coplet-instance-data>
+                </coplet-layout>
+              </item>         
             </composite-layout>
           </item>
         </composite-layout>
@@ -268,7 +346,7 @@
           </item>
           <item>
             <coplet-layout name="coplet" id="basket-content-admin">
-              <coplet-instance-data>BasketContent</coplet-instance-data>
+              <coplet-instance-data>basket-content</coplet-instance-data>
             </coplet-layout>
           </item>
         </composite-layout>