cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jheym...@apache.org
Subject svn commit: r330548 [2/132] - in /cocoon/whiteboard/maven2/cocoon-flat-layout: ./ cocoon-ajax-block/ cocoon-ajax-block/api/ cocoon-ajax-block/api/src/ cocoon-ajax-block/api/src/main/ cocoon-ajax-block/api/src/main/java/ cocoon-ajax-block/api/src/main/r...
Date Thu, 03 Nov 2005 14:00:48 GMT

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov  3 05:41:06 2005
@@ -0,0 +1,3 @@
+.classpath
+.project
+.wtpmodules

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/api/pom.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/api/pom.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/api/pom.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/api/pom.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 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.
+-->
+<!--+
+    | @version $Id:$
+    |
+    +-->
+<project>
+  <parent>
+    <groupId>apache-cocoon</groupId>
+    <artifactId>cocoon-ajax-block</artifactId>
+    <version>2.2-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>apache-cocoon</groupId>
+  <artifactId>cocoon-ajax-api</artifactId>
+  <version>2.2-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Ajax API</name>
+</project>
\ No newline at end of file

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/pom.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/pom.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/pom.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/pom.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 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.
+-->
+<!--+
+  | @version $Id:$
+  |
+  +-->
+<project>
+  <parent>
+    <groupId>apache-cocoon</groupId>
+    <artifactId>cocoon-ajax-block</artifactId>
+    <version>2.2-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>apache-cocoon</groupId>
+  <artifactId>cocoon-ajax-impl</artifactId>
+  <version>2.2-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Ajax Implementation</name>
+  <dependencies>
+    <dependency>
+      <groupId>apache-cocoon</groupId>
+      <artifactId>cocoon-ajax-api</artifactId>
+      <version>2.2-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxHelper.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxHelper.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxHelper.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 1999-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.ajax;
+
+import org.apache.cocoon.environment.Request;
+
+/**
+ * Helper class to handle Ajax requests
+ * 
+ * @version $Id: AjaxHelper.java 292158 2005-09-28 10:24:51Z sylvain $
+ * @since 2.1.8
+ */
+public class AjaxHelper {
+    
+    private AjaxHelper() {
+        // Forbid instanciation
+    }
+
+    /**
+     * The request parameter that, if set, indicates an Ajax request.
+     */
+    public static final String AJAX_REQUEST_PARAMETER = "cocoon-ajax";
+    
+    /**
+     * The namespace URI of the "browser update" xml dialect
+     */
+    public static final String BROWSER_UPDATE_URI = "http://apache.org/cocoon/browser-update/1.0";
+
+    /**
+     * Is the request an Ajax request?
+     * 
+     * @param req the request
+     * @return true if this is an Ajax request
+     */
+    public static boolean isAjaxRequest(Request req) {
+        return req.getParameter(AJAX_REQUEST_PARAMETER) != null;
+    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestMatcher.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestMatcher.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestMatcher.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestMatcher.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1999-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.ajax;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.matching.Matcher;
+import org.apache.cocoon.sitemap.PatternException;
+
+/**
+ * A matcher that tests if the current request is an Ajax request. This matcher
+ * provides no sitemap variables.
+ * <p>
+ * Example:
+ * <pre>
+ *   &lt;map:match type="ajax-request"&gt;
+ *     ... ajax request ...
+ *   &lt;/map:match&gt;
+ * </pre>
+ * 
+ * @since 2.1.8
+ * @version $Id: AjaxRequestMatcher.java 292158 2005-09-28 10:24:51Z sylvain $
+ */
+public class AjaxRequestMatcher implements Matcher, ThreadSafe {
+
+    public Map match(String pattern, Map objectModel, Parameters parameters) throws PatternException {
+        Request req = ObjectModelHelper.getRequest(objectModel);
+        
+        return AjaxHelper.isAjaxRequest(req) ? Collections.EMPTY_MAP : null;
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestSelector.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestSelector.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestSelector.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestSelector.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 1999-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.ajax;
+
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.selection.AbstractSwitchSelector;
+import org.apache.commons.lang.BooleanUtils;
+
+/**
+ * Choose a select branch depending on if the current request is an Ajax request.
+ * The test value can be either "<code>true</code>" or "<code>false</code>".
+ * 
+ * <pre>
+ *   &lt;map:select type="ajax-request"&gt;
+ *     &lt;map:when test="true"&gt;
+ *       ... ajax request ...
+ *     &lt;/map:when&gt;
+ *     &lt;map:otherwise&gt;
+ *       ... non ajax request ...
+ *     &lt;/map:otherwise&gt;
+ *   &lt;/map:select&gt;
+ * </pre>
+ * 
+ * @since 2.1.8
+ * @version $Id: AjaxRequestSelector.java 292158 2005-09-28 10:24:51Z sylvain $
+ */
+public class AjaxRequestSelector extends AbstractSwitchSelector implements ThreadSafe {
+    
+    public Object getSelectorContext(Map objectModel, Parameters parameters) {
+        Request req = ObjectModelHelper.getRequest(objectModel);
+        return BooleanUtils.toBooleanObject(AjaxHelper.isAjaxRequest(req));
+    }
+
+    public boolean select(String expression, Object selectorContext) {
+        boolean test = BooleanUtils.toBoolean(expression);
+
+        return test == ((Boolean)selectorContext).booleanValue();
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/AjaxRequestSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/BrowserUpdateTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/BrowserUpdateTransformer.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/BrowserUpdateTransformer.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/BrowserUpdateTransformer.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,180 @@
+/*
+ * Copyright 1999-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.ajax;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.transformation.AbstractTransformer;
+import org.apache.cocoon.xml.AttributesImpl;
+import org.apache.cocoon.xml.RedundantNamespacesFilter;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * 
+ * @version $Id: BrowserUpdateTransformer.java 292158 2005-09-28 10:24:51Z sylvain $
+ */
+
+public class BrowserUpdateTransformer extends AbstractTransformer {
+    
+    public static final String AJAXMODE_PARAM = "cocoon-ajax";
+    
+    public static final String BU_NSURI = "http://apache.org/cocoon/browser-update/1.0";
+    
+    private boolean ajaxRequest = false;
+    
+    private int replaceDepth = 0;
+    
+    private boolean inUpdateTag = false;
+    private String updateTagId = null;
+    
+    Locator locator;
+
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException {
+
+        Request request = ObjectModelHelper.getRequest(objectModel);
+        this.ajaxRequest = request.getParameter(AJAXMODE_PARAM) != null;
+    }
+    
+    public void setDocumentLocator(Locator locator) {
+        super.setDocumentLocator(locator);
+        this.locator = locator;
+    }
+
+    public void startDocument() throws SAXException {
+        
+        if (ajaxRequest) {
+            // Add the namespace filter to our own output.
+            // This is needed as flattening bu:* elements can lead to some weird reordering of
+            // namespace declarations...
+            RedundantNamespacesFilter nsPipe = new RedundantNamespacesFilter();
+            if (this.xmlConsumer != null) {
+                nsPipe.setConsumer(this.xmlConsumer);
+            } else {
+                nsPipe.setContentHandler(this.contentHandler);
+            }
+            setConsumer(nsPipe);
+        }
+        
+        super.startDocument();
+        if (ajaxRequest) {
+            // Add a root element. The original one is very likely to be stripped
+            super.startPrefixMapping("bu", BU_NSURI);
+            super.startElement(BU_NSURI, "document", "bu:document", new AttributesImpl());
+        }
+    }
+    
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        // Passthrough if not in ajax mode or if in a bu:replace
+        if (!this.ajaxRequest || this.replaceDepth > 0) {
+            super.startPrefixMapping(prefix, uri);
+        }
+    }
+
+    public void startElement(String uri, String loc, String raw, Attributes attrs) throws SAXException {
+        if (BU_NSURI.equals(uri) && "replace".equals(loc)) {
+            // Keep the id attribute. It may be null, in which case the one of the
+            // child element will be used.
+            this.updateTagId = attrs.getValue("id");
+            this.inUpdateTag = true;
+            if (this.ajaxRequest && this.replaceDepth == 0) {
+                // Pass this element through
+                super.startElement(uri, loc, raw, attrs);
+            }
+            replaceDepth++;
+        } else {
+            // Passthrough if not in ajax mode or if in a bu:replace
+            
+            // Is the enclosing element a bu:replace?
+            if (this.inUpdateTag) {
+                this.inUpdateTag = false;
+                // Is there already an id?
+                String localId = attrs.getValue("id");
+                if (localId != null) {
+                    // Yes: check it's the same
+                    if (this.updateTagId != null && !localId.equals(this.updateTagId)) {
+                        throw new SAXParseException("Id on bu:replace (" + this.updateTagId + ") and " + raw + " (" +
+                                localId + ") don't match.", this.locator);
+                    }
+                } else {
+                    // No: add it
+                    if (this.updateTagId == null) {
+                        throw new SAXParseException("Neither bu:replace nor " + raw + " have an id attribute.", this.locator);
+                    }
+                    AttributesImpl newAttrs = new AttributesImpl(attrs);
+                    newAttrs.addCDATAAttribute("id", this.updateTagId);
+                    attrs = newAttrs;
+                }
+                this.updateTagId = null;
+            }
+            if (!this.ajaxRequest || this.replaceDepth > 0) {
+                super.startElement(uri, loc, raw, attrs);
+            }
+        }
+    }
+
+    public void characters(char[] buffer, int offset, int len) throws SAXException {
+        if (this.inUpdateTag) {
+            // Check that it's only spaces
+            for (int i = offset; i < len; i++) {
+                if (!Character.isWhitespace(buffer[i])) {
+                    throw new SAXParseException("bu:replace must include a single child element and no text.", this.locator);
+                }
+            }
+        }
+        if (!this.ajaxRequest || this.replaceDepth > 0) {
+            super.characters(buffer, offset, len);
+        }
+    }
+    
+    public void endElement(String uri, String loc, String raw) throws SAXException {
+        if (BU_NSURI.equals(uri) && "replace".equals(loc)) {
+            replaceDepth--;
+            if (this.ajaxRequest && this.replaceDepth == 0) {
+                // Pass this element through
+                super.endElement(uri, loc, raw);
+            }
+        } else {
+            // Passthrough if not in ajax mode or if in a bu:replace
+            if (!this.ajaxRequest || this.replaceDepth > 0) {
+                super.endElement(uri, loc, raw);
+            }
+        }
+    }
+
+    public void endPrefixMapping(String prefix) throws SAXException {
+        // Passthrough if not in ajax mode or if in a bu:replace
+        if (!this.ajaxRequest || this.replaceDepth > 0) {
+            super.endPrefixMapping(prefix);
+        }
+    }
+
+    public void endDocument() throws SAXException {
+        if (ajaxRequest) {
+            super.endElement(BU_NSURI, "document", "bu:document");
+            super.endPrefixMapping("bu");
+        }
+        super.endDocument();
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/BrowserUpdateTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/GetContinuationAction.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/GetContinuationAction.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/GetContinuationAction.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/GetContinuationAction.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1999-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.ajax;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.acting.ServiceableAction;
+import org.apache.cocoon.components.flow.ContinuationsManager;
+import org.apache.cocoon.components.flow.FlowHelper;
+import org.apache.cocoon.components.flow.WebContinuation;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Redirector;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.sitemap.SitemapParameters;
+
+/**
+ * Get a continuation knowing its identifier, and set it as the current continuation
+ * in the object model, in the same manner as <code>cocoon.sendPageAndWait()</code> does.
+ * This action is useful when an Ajax request is made that needs to access data related
+ * to the continuation that originally displayed the current page.
+ * <p>
+ * The continuation id is either the <code>src</code> attribute in <code>&lt;map:act&gt;</code>
+ * or, if not specified, the <code>continuation-id</code> request parameter.
+ * <p>
+ * This action is successful if the continuation exists and is still valid.
+ * 
+ * @since 2.1.8
+ * @version $Id: GetContinuationAction.java 326838 2005-10-20 06:26:53Z sylvain $
+ */
+public class GetContinuationAction extends ServiceableAction implements ThreadSafe, Disposable {
+    ContinuationsManager contManager;
+
+    public void service(ServiceManager manager) throws ServiceException {
+        super.service(manager);
+        this.contManager = (ContinuationsManager)manager.lookup(ContinuationsManager.ROLE);
+    }
+
+    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
+        String continuationId;
+        if (source == null) {
+            continuationId = ObjectModelHelper.getRequest(objectModel).getParameter("continuation-id");
+        } else {
+            continuationId = source;
+        }
+        
+        // The interpreter id is the sitemap's URI
+        String interpreterId = SitemapParameters.getLocation(parameters).getURI();
+        WebContinuation wk = this.contManager.lookupWebContinuation(continuationId, interpreterId);
+        if (wk == null || wk.disposed()) {
+            return null;
+        } else {
+            // Getting the continuation updates the last access time
+            wk.getContinuation();
+            FlowHelper.setWebContinuation(objectModel, wk);
+            return Collections.EMPTY_MAP;
+        }
+    }
+
+    public void dispose() {
+        this.manager.release(this.contManager);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/ajax/GetContinuationAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1999-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.transformation;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.util.Deprecation;
+import org.xml.sax.SAXException;
+
+/**
+ * @deprectated use {@link org.apache.cocoon.ajax.BrowserUpdateTransformer}
+ * @version $Id: BrowserUpdateTransformer.java 326838 2005-10-20 06:26:53Z sylvain $
+ */
+public class BrowserUpdateTransformer extends org.apache.cocoon.ajax.BrowserUpdateTransformer {
+
+    public static final String AJAXMODE_PARAM = "cocoon-ajax";
+    
+    public static final String BU_NSURI = "http://apache.org/cocoon/browser-update/1.0";
+    
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException {
+        Deprecation.logger.error("Please use the BrowserUpdateTransformer in the Ajax block");
+        super.setup(resolver, objectModel, src, par);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/java/org/apache/cocoon/transformation/BrowserUpdateTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/block.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/block.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/block.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/block.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,23 @@
+<?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. 
+-->
+<block xmlns="http://apache.org/cocoon/blocks/cob/1.0" id="http://apache.org/cocoon/forms/1.0">
+
+  <name short="forms" version="1.0">Cocoon Ajax</name>
+  <author href="http://cocoon.apache.org">Cocoon Community</author>
+  <license href="http://www.apache.org/LICENSE-2.0/">Apache Software License 2.0</license>
+  
+</block>
\ No newline at end of file

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/block.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/sitemap-additions/cocoon-ajax.xconf
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/sitemap-additions/cocoon-ajax.xconf?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/sitemap-additions/cocoon-ajax.xconf (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/sitemap-additions/cocoon-ajax.xconf Thu Nov  3 05:41:06 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.
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+</map:sitemap>
\ No newline at end of file

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/sitemap-additions/cocoon-ajax.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/wiring.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/wiring.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/wiring.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/wiring.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,21 @@
+<?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. 
+-->
+<wiring xmlns="http://apache.org/cocoon/blocks/wiring/1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://apache.org/cocoon/blocks/wiring/1.0 wiring-schema-1.0.xsd">
+
+</wiring>
\ No newline at end of file

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/wiring.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/xconf/cocoon-ajax.xconf
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/xconf/cocoon-ajax.xconf?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/xconf/cocoon-ajax.xconf (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/xconf/cocoon-ajax.xconf Thu Nov  3 05:41:06 2005
@@ -0,0 +1,3 @@
+<components>
+  <!-- nothing special here for now -->
+</components>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/COB-INF/xconf/cocoon-ajax.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/META-INF/Manifest.mf
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/META-INF/Manifest.mf?rev=330548&view=auto
==============================================================================
    (empty)

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/META-INF/Manifest.mf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/browserupdater.js
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/browserupdater.js?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/browserupdater.js (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/browserupdater.js Thu Nov  3 05:41:06 2005
@@ -0,0 +1,163 @@
+/*
+ * Copyright 1999-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.
+ */
+
+/* @version $Id$ */
+
+
+Cocoon.Ajax.BrowserUpdater = Class.create();
+Object.extend(Object.extend(Cocoon.Ajax.BrowserUpdater.prototype, Ajax.Request.prototype), {
+  initialize: function(url, options) {
+    this.transport = Ajax.getTransport();
+    this.setOptions(options);
+
+    var onComplete = this.options.onComplete || Prototype.emptyFunction;
+    this.options.onComplete = (function() {
+    	if (this.checkContinue(this.options.form)) {
+				this.updateContent();
+				onComplete(this.transport);
+      }
+    }).bind(this);
+
+    this.request(url);
+  },
+
+  updateContent: function() {
+		var doc = this.transport.responseXML;
+    if (doc) {
+				var nodes = doc.documentElement.childNodes;
+				for (var i = 0; i < nodes.length; i++) {
+						var node = nodes[i];
+						if (node.nodeType == DOMUtils.ELEMENT_NODE) {
+								var handler;
+								if (node.localName) {
+										handler = node.localName;
+								} else {
+										// No DOM2 support (IE6)
+										handler = node.nodeName.replace(/.*:/, "");
+								}
+								var handlerFunc = Cocoon.Ajax.BrowserUpdater.Handlers[handler];
+								if (handlerFunc) {
+										handlerFunc(node);
+								} else {
+										this.handleError("No handler found for element " + handler, this.transport);
+										return;
+								}
+						}
+				}
+    } else {
+    	this.handleError("No xml answer", this.transport);
+      return;
+    }
+
+    if (this.responseIsSuccess()) {
+      if (this.onComplete) {
+        setTimeout((function() {this.onComplete(this.transport)}).bind(this), 10);
+      }
+			document.body.style.cursor = "auto";
+			self.status = "Update Complete";
+    }
+  },
+  
+  checkContinue: function(form) {
+  	if (!form) return true;
+		var xca;
+		try { // An exception is thrown if header doesn't exist (at least in Moz)
+				xca = this.transport.getResponseHeader("X-Cocoon-Ajax");
+		} catch (e) {
+				// header doesn't exist
+		}
+		if (xca == "continue") {
+			// Interaction with this page is finished: redirect the browser to the form's action URL
+			// Get the continuation-id, if any.
+			var contParam = '?cocoon-ajax-continue=true';
+			if (form.elements && form.elements["continuation-id"]) {
+					contParam += "&continuation-id=" + form.elements["continuation-id"].value;
+			}
+			window.location.href = form.action + contParam;
+			return false;
+    } else {
+			return true;
+		}
+  },
+
+	handleError: function(message, request) {
+    if (confirm(message + "\nShow server response?")) {
+        var w = window.open(undefined, "Cocoon Error", "location=no");
+        if (w == undefined) {
+            alert("You must allow popups from this server to display the response.");
+        } else {
+	        var doc = w.document;
+	        doc.open();
+	        doc.write(request.responseText);
+	        doc.close();
+	    }
+    }
+	}
+	
+});
+
+Cocoon.Ajax.BrowserUpdater.Handlers = {
+    replace :  function(element) {
+        var id = element.getAttribute("id"); // the id from the incoming element
+        if (!id) {
+           alert("no id found on update element");
+           return;
+        }    
+        var oldElement = $(id); // the element that is being replaced
+        if (!oldElement) {
+            alert("no element '" + id + "' in source document");
+            return;
+        }
+        // Get the first child element (the first child may be some text!)
+        var content = DOMUtils.firstChildElement(element); // the element to replace with
+        var insertion = new Cocoon.Ajax.Insertion.Replace(oldElement, content);
+        
+        var newElement = $(id);
+				// Ensure the new node has the correct id
+        newElement.setAttribute("id", id);
+
+        if (Cocoon.Ajax.BrowserUpdater.highlight) {
+           new Cocoon.Ajax.BrowserUpdater.highlight(newElement);
+        }
+    }
+
+}
+
+Cocoon.Ajax.BrowserUpdater.highlight = Effect.Highlight;
+
+Cocoon.Ajax.Insertion = new Object();
+Cocoon.Ajax.Insertion.Replace = Class.create();
+Cocoon.Ajax.Insertion.Replace.prototype = Object.extend(new Abstract.Insertion(''), {
+
+  initialize: function(element, content) {
+  	this.element = $(element);
+    this.content = content;
+    this.insertContent();
+  },
+  
+  insertContent: function() {
+  	if (typeof this.content == "string") {
+  		var newDiv = document.createElement('div');
+  		newDiv.innerHTML = this.content;
+  		var newElement = newDiv.firstChild;
+  		this.element.parentNode.replaceChild(newElement, this.element);
+  	} else { // hopefully 'content' is a DOM Fragment
+			var newElement = DOMUtils.importNode(this.content, document);
+			this.element.parentNode.replaceChild(newElement, this.element);
+		}
+  }
+
+});

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/browserupdater.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js Thu Nov  3 05:41:06 2005
@@ -0,0 +1,321 @@
+/*
+ * Copyright 1999-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.
+ */
+
+if (typeof cocoon == "undefined") cocoon = {};
+
+cocoon.ajax = {};
+
+/**
+ * Create an XHR if the browser supports it.
+ */
+cocoon.ajax.newXMLHttpRequest = function () {
+    if (window.XMLHttpRequest)
+        return new XMLHttpRequest;
+    else if (window.ActiveXObject)
+        return new ActiveXObject("Microsoft.XMLHTTP");
+}
+
+//-------------------------------------------------------------------------------------------------
+
+cocoon.ajax.DOMUtils = {
+    // Stupid IE doesn't have these constants
+    ELEMENT_NODE : 1,
+    ATTRIBUTE_NODE : 2,
+    TEXT_NODE : 3,
+    CDATA_SECTION_NODE : 4,
+    ENTITY_REFERENCE_NODE : 5,
+    ENTITY_NODE : 6,
+    PROCESSING_INSTRUCTION_NODE : 7,
+    COMMENT_NODE : 8,
+    DOCUMENT_NODE : 9,
+    DOCUMENT_TYPE_NODE : 10,
+    DOCUMENT_FRAGMENT_NODE : 11
+}
+
+/**
+ * Get the first child element of an element, ignoring text nodes
+ */
+cocoon.ajax.DOMUtils.firstChildElement = function(element) {
+    var nodes = element.childNodes;
+    for (var i = 0; i < nodes.length; i++) {
+        var node = nodes[i];
+        if (node.nodeType == this.ELEMENT_NODE) {
+            return node;
+        }
+    }
+}
+
+/**
+ * Imports an element into a document, taking care of using the correct implementation
+ * so that the browser interprets it as displayable XML
+ */
+cocoon.ajax.DOMUtils.importNode = function(node, targetDoc) {
+    if(node.xml) {
+        // IE
+        var div = targetDoc.createElement("DIV");
+        div.innerHTML = node.xml;
+        return this.firstChildElement(div);
+    } else {
+        return this._importNode(node, targetDoc);
+    }
+}
+
+/**
+ * DOM implementation of importNode, recursively creating nodes
+ */
+cocoon.ajax.DOMUtils._importNode = function(node, targetDoc) {
+    switch(node.nodeType) {
+        case this.ELEMENT_NODE:
+            var element = targetDoc.createElement(node.nodeName);
+            //var element = targetDoc.createElementNS(node.namespaceURI, node.nodeName);
+            var attrs = node.attributes;
+            for (var i = 0; i < attrs.length; i++) {
+                attr = attrs[i];
+                element.setAttribute(attr.nodeName, attr.nodeValue);
+                //element.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.nodeValue);
+            }
+            var children = node.childNodes;
+            for (var j = 0; j < children.length; j++) {
+                var imported = this.importNode(children[j], targetDoc);
+                if (imported) element.appendChild(imported);
+            }
+            return element;
+        break;
+        
+        case this.TEXT_NODE:
+            return targetDoc.createTextNode(node.nodeValue);
+        break;
+        
+        case this.CDATA_SECTION_NODE:
+            return targetDoc.createTextNode(node.nodeValue);
+        break;
+    }
+}
+
+//-------------------------------------------------------------------------------------------------
+// General purpose AJAX infrastructure to handle a BU ("browser update") response
+//
+// To implement a new system-wide instruction, add the corresponding function as a property of
+// BrowserUpdate.handlers.
+// To add a new handler for a given request, create a new BrowserUpdater and update its
+// handlers property.
+//-------------------------------------------------------------------------------------------------
+
+cocoon.ajax.BrowserUpdater = function() {
+    this.handlers = {};
+};
+
+cocoon.ajax.BrowserUpdater.highlight = null;
+
+cocoon.ajax.BrowserUpdater.prototype.processResponse = function(doc, request) {
+    var nodes = doc.documentElement.childNodes;
+    for (var i = 0; i < nodes.length; i++) {
+        var node = nodes[i];
+        if (node.nodeType == cocoon.ajax.DOMUtils.ELEMENT_NODE) {
+            var handler;
+            if (node.localName) {
+                handler = node.localName;
+            } else {
+                // No DOM2 support (IE6)
+                handler = node.nodeName.replace(/.*:/, "");
+            }
+            var handlerFunc = this.handlers[handler] || cocoon.ajax.BrowserUpdater.handlers[handler];
+            if (handlerFunc) {
+                handlerFunc(node);
+            } else {
+                this.handleError("No handler found for element " + handler, request);
+            }
+        }
+    }
+}
+
+/**
+ * System-wide handlers
+ */
+cocoon.ajax.BrowserUpdater.handlers = {
+    replace :  function(element) {
+        var id = element.getAttribute("id");
+        if (!id) {
+           alert("no id found on update element");
+           return;
+        }    
+        // Get the first child element (the first child may be some text!)
+        var firstChild = cocoon.ajax.DOMUtils.firstChildElement(element);
+    
+        var oldElement = document.getElementById(id);
+        
+        if (!oldElement) {
+            alert("no element '" + id + "' in source document");
+            return;
+        }
+    
+        var newElement = cocoon.ajax.DOMUtils.importNode(firstChild, document);
+        
+        // Warn: it's replace(new, old)!!
+        oldElement.parentNode.replaceChild(newElement, oldElement);
+        // Ensure the new node has the correct id
+        newElement.setAttribute("id", id);
+        
+        if (cocoon.ajax.BrowserUpdater.highlight) {
+           cocoon.ajax.BrowserUpdater.highlight(newElement);
+        }
+    }
+}
+
+cocoon.ajax.BrowserUpdater.handleError = function(message, request) {
+    if (confirm(message + "\nShow server response?")) {
+        var w = window.open(undefined, "Cocoon Error", "location=no");
+        if (w == undefined) {
+            alert("You must allow popups from this server to display the response.");
+        } else {
+	        var doc = w.document;
+	        doc.open();
+	        doc.write(request.responseText);
+	        doc.close();
+	    }
+    }
+}
+
+//-------------------------------------------------------------------------------------------------
+// Fader used to highlight page areas that have been updated
+// WARNING: don't rely too much on these effects, as they're very likely to be replaced
+//          by some third party library in the near future
+//-------------------------------------------------------------------------------------------------
+
+/**
+ * Create a fader that will progressively change an element's background color from
+ * a given color back to its original color.
+ *
+ * @param elt the element to fade
+ * @param color the starting color (default yellow)
+ * @param duration the fade duration in msecs (default 1000)
+ * @param fps the animation frames per seconds (default 25)
+ */
+cocoon.ajax.Fader = function(elt, color, duration, fps) {
+   // Set default values
+   if (!color) color = "#FFFF80"; // yellow
+   if (!duration) duration = 1000; // 1 sec
+   if (!fps) fps = 25; // 25 frames/sec
+   
+   this.element = elt;
+   this.fromColor = cocoon.ajax.Fader.colorToRgb(color);
+   this.toColor = cocoon.ajax.Fader.colorToRgb(cocoon.ajax.Fader.getBgColor(this.element));
+   
+   this.maxFrames = Math.round(fps * duration / 1000.0);
+   this.delay = duration / this.maxFrames;
+}
+
+/**
+ * Creates a default fader for a given element. This function can be used to set BrowserUpdate.highlight
+ */
+cocoon.ajax.Fader.fade = function(elt) {
+   new cocoon.ajax.Fader(elt).start();
+}
+
+cocoon.ajax.Fader.prototype.start = function() {
+   this.frame = 0;
+   this._changeColor();
+}
+
+cocoon.ajax.Fader.prototype._changeColor = function() {
+    if (this.frame < this.maxFrames) {
+        // Schedule the next iteration right now to keep a more accurate timing
+        var fader = this;
+        setTimeout(function() {fader._changeColor();}, this.delay);
+    }
+    var newColor = new Array(3);
+    for (var channel = 0; channel < 3; channel++) {
+        newColor[channel] = Math.floor(
+            this.fromColor[channel] * ((this.maxFrames - this.frame) / this.maxFrames) +
+            this.toColor[channel] * (this.frame/this.maxFrames)
+        );
+    }
+
+    this.frame++;
+    var color = cocoon.ajax.Fader.rgbToColor(newColor[0], newColor[1], newColor[2]);
+    this.element.style.backgroundColor = color;
+}
+
+/** Converts a "#RRGGBB" color as an array of 3 ints */
+cocoon.ajax.Fader.colorToRgb = function(hex) {
+    return [
+        parseInt(hex.substr(1,2),16),
+        parseInt(hex.substr(3,2),16),
+        parseInt(hex.substr(5,2),16) ];
+}
+
+/** Converts rgb values to a "#RRGGBB" color */
+cocoon.ajax.Fader.rgbToColor = function(r, g, b) {
+    r = r.toString(16); if (r.length == 1) r = '0' + r;
+    g = g.toString(16); if (g.length == 1) g = '0' + g;
+    b = b.toString(16); if (b.length == 1) b = '0' + b;
+    return "#" + r + g + b;
+}
+
+/** Get the background color of an element */
+cocoon.ajax.Fader.getBgColor = function(elt) {
+    while(elt) {
+        var c;
+        if (window.getComputedStyle) c = window.getComputedStyle(elt,null).getPropertyValue("background-color");
+        if (elt.currentStyle) c = elt.currentStyle.backgroundColor;
+        if ((c != "" && c != "transparent") || elt.tagName == "BODY") { break; }
+        elt = elt.parentNode;
+    }
+    if (c == undefined || c == "" || c == "transparent" || c == "white") c = "#FFFFFF";
+
+    var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
+    if (rgb) return this.rgbToColor(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
+    return c;
+}
+
+//-------------------------------------------------------------------------------------------------
+// Blinker used to highlight page areas that have been updated
+//-------------------------------------------------------------------------------------------------
+
+cocoon.ajax.Blinker = function(elt, color, hltDelay, normalDelay, blinks) {
+    this.element = elt;
+    if (!color) color = "#FFFF80"; // yellow
+    if (!hltDelay) hltDelay = 100;
+    if (!normalDelay) normalDelay = 100;
+    if (!blinks) blinks = 2;
+    
+    this.hltColor = color;
+    this.hltDelay = hltDelay;
+    this.normalDelay = normalDelay;
+    this.normalColor = cocoon.ajax.Fader.getBgColor(elt);
+    this.maxBlinks = blinks * 2;
+    this.blink = 0;
+}
+
+cocoon.ajax.Blinker.prototype.start = function() {
+   this.blink = 0;
+   this._doBlink();
+}
+
+cocoon.ajax.Blinker.blink = function(elt) {
+   new cocoon.ajax.Blinker(elt).start();
+}
+
+cocoon.ajax.Blinker.prototype._doBlink = function() {
+   var hlt = (this.blink % 2 == 0);
+   this.element.style.backgroundColor = hlt ? this.hltColor : this.normalColor;;
+   if (this.blink <= this.maxBlinks) {
+      var blinker = this;
+      setTimeout(function() {blinker._doBlink();}, hlt ? this.hltDelay : this.normalDelay);
+   }
+   this.blink++;
+}
+

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js Thu Nov  3 05:41:06 2005
@@ -0,0 +1,218 @@
+/*
+ * Copyright 1999-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.
+ */
+
+/* @version $Id$ */
+
+
+Cocoon.Ajax.TimedBrowserUpdater = Class.create();
+Cocoon.Ajax.TimedBrowserUpdater.prototype = Object.extend(new Ajax.Base(), {
+  initialize: function(url, options) {
+    this.setOptions(options);
+    this.onComplete = this.options.onComplete;
+		this.autostart = (this.options.autostart || true); // default autostart: true
+    this.frequency = (this.options.frequency || 30);   // default frequency: 5 minutes
+    this.decay = 1;																		 // default decay: none
+		this.populated = false;
+    this.updater = {};
+    this.widgets = {};
+    this.url = url;
+		this.timerIsRunning = false;
+    this.start();
+  },
+
+  start: function() {
+    this.options.onComplete = this.updateComplete.bind(this);
+    this.onTimerEvent();
+    this.timerIsRunning = true;
+    self.status = "Timer Starting";
+  },
+
+  stop: function() {
+    this.updater.onComplete = undefined;
+    clearTimeout(this.timer);
+    this.timerIsRunning = false;
+    self.status = "Timer Stoping";
+  },
+
+  updateComplete: function(request) {
+    if (this.options.decay) {
+      this.decay = (request.responseText == this.lastText ? 
+        this.decay * this.options.decay : 1);
+
+      this.lastText = request.responseText;
+    }
+    this.updateWidgets(request.responseXML);
+    this.timer = setTimeout(this.onTimerEvent.bind(this), this.decay * this.frequency * 1000);
+  },
+
+  onTimerEvent: function() {
+    if (this.populated) {
+    	this.options.postBody = this.buildQueryString();
+    	this.updater = new Cocoon.Ajax.BrowserUpdater(this.url, this.options);
+    	    self.status = "Timer fired event";
+    } else {
+    	this.timer = setTimeout(this.onTimerEvent.bind(this), this.decay * this.frequency * 1000);
+    }
+  },
+  
+  updateWidgets: function(doc) {
+		var nodes = doc.documentElement.childNodes;
+		for (var i = 0; i < nodes.length; i++) {
+			var node = nodes[i];
+			if (node.nodeType == DOMUtils.ELEMENT_NODE) {
+				this.widgets[node.getAttribute("id")] = node.getAttribute("state");
+			}
+		}
+	},
+
+	registerWidget: function(id, state) {
+		this.widgets[id] = state;
+		this.populated = true;
+	},
+	
+	buildQueryString: function () {
+		var result = "cocoon-ajax=true";
+		for (var key in this.widgets) {
+			result += "&" + encodeURIComponent(key) + "=" + encodeURIComponent(this.widgets[key]);
+		}
+		// see if there is a form with a continuation parameter
+		for (var form in document.forms) {
+			if (form != null && form.elements != null && form.elements["continuation-id"] != null) {
+				result += "&continuation-id=" + form.elements["continuation-id"].value;
+				break;
+			}
+		}
+		self.status = result;
+		return result;
+	}
+	
+});
+
+Cocoon.Ajax.TimedBrowserUpdater.Console = Class.create();
+Cocoon.Ajax.TimedBrowserUpdater.Console.prototype = Object.extend(new Ajax.Base(), {
+	initialize: function(client, options) {
+		this.expires = 604800000; // cookie expiry, 1 week
+		this.client = client;
+		this.setOptions(options);
+		this.console = this.options.console;
+		this.message("Initialise");
+    this.isRunningTitle = ( this.options.isRunningTitle || "ON" );
+		this.notRunningTitle = ( this.options.notRunningTitle || "OFF" );
+		this.isRunningHint = ( this.options.isRunningHint || "Click to Stop" );
+		this.notRunningHint = ( this.options.notRunningHint || "Click to Start" );
+		this.frequencyControl = this.options.frequencyControl;
+		this.toggleControl = this.options.toggleControl;
+		
+		var autorun = this.getPreference( "TimedBrowserUpdater.autorun" );
+		if ( autorun == undefined ) {
+			this.message("Autorun undefined");
+			this.startTimer(  );
+		} else if ( autorun == "true" ) {
+			this.message("Autorun true");
+			this.startTimer(  );
+		} else {
+			this.message("Autorun false");
+			this.stopTimer(  );
+		}
+		
+		var frequency =  this.getPreference( "TimedBrowserUpdater.frequency" );
+		if ( frequency == undefined ) frequency = 300;
+		this.setFrequency(frequency);
+	},
+	
+	message: function(message) {
+		if (this.console != undefined) {
+			this.console.value = this.console.value + "\n" + message;
+		} else {
+			self.status = message;
+		}
+	},
+	
+	toggleTimer: function() {
+		if (this.client.timerIsRunning) {
+			this.stopTimer();
+		} else {
+			this.startTimer();
+		}
+	},
+	
+	startTimer: function() {
+			if (!this.client.timerIsRunning) {
+				this.client.start(  );
+				this.message("Client Started");
+			}
+			this.setPreference( "TimedBrowserUpdater.autorun", "true" );
+			this.toggleControl.value = this.isRunningTitle;
+			this.toggleControl.title =  this.isRunningHint;
+	},
+
+	stopTimer: function() {
+			if (this.client.timerIsRunning) {
+				this.client.stop(  );
+				this.message("Client Stopped");
+			}
+			this.setPreference( "TimedBrowserUpdater.autorun", "false" );
+			this.toggleControl.value = this.notRunningTitle;
+			this.toggleControl.title =  this.notRunningHint;
+	},	
+	
+	setFrequency: function() {
+		var frequency = this.frequencyControl.value;
+		this.client.frequency = frequency;
+		this.setPreference( "TimedBrowserUpdater.frequency", frequency );
+		for ( var i=0;i < this.frequencyControl.options.length;i++ ) {
+			if ( frequency == this.frequencyControl.options[i].value ) {
+				this.frequencyControl.selectedIndex = i;
+				break;
+			}
+		}
+	},
+	
+	setPreference: function(name, value) {
+		var expiredate = new Date();
+		expiredate.setTime(expiredate.getTime() + this.expires);
+		document.cookie = name + "=" + value + "; expires=" + expiredate.toGMTString() + "; path=/";
+		this.message("Set Preference: " + name + ": " + value);
+	},
+
+	getPreference: function(name){
+		var neq = name + "=";
+		var k = document.cookie.split(';');
+		for (var i=0; i < k.length; i++) {
+			var c = k[i];
+			while (c.charAt(0)==' ') c = c.substring(1,c.length);
+			if (c.indexOf(neq) == 0) {
+				var result = c.substring(neq.length,c.length);
+				this.message( "Read Preference: " + name + ": " + result);
+				return result;
+			}
+		}
+		this.message( "Read Preference: " + name + ": undefined");
+		return undefined;
+	}
+
+
+
+});
+
+TimedBrowserUpdaterInstance = new Cocoon.Ajax.TimedBrowserUpdater(
+	document.location, 
+	{
+		method: 'post', 
+		onFailure: Cocoon.Ajax.BrowserUpdater.handleError,
+		insertion: Cocoon.Ajax.Insertion.Replace
+	}
+);

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/js/timedbrowserupdater.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-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.
+-->
+<!--
+  @version $Id$
+-->
+
+<!-- An implementation of the TimedBrowserUpdate template engine as a JXTemplate tag library -->
+    
+    <!--+	Usage Instructions
+    		+
+    		+		The purpose of this Macro is to make regions in a webpage 
+    		+		that update themselves periodically without user interaction.
+    		+		This is implemented using AJAX techniques taken from CForms.
+    		+
+    		+		1. Import this macro into your JXTemplate :
+    		+
+    		+			<jx:import uri="resource://org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml"/>
+    		+
+    		+		2. Use the tags in your page where you want auto-updating to occur :
+    		+
+    		+			<tbu:replace id="element.id" state="${change.value}">
+    		+				<td id="element.id">
+    		+					Your value is: <b>${change.value}</b>
+    		+				</td>
+				+			</tbu:replace>
+				+
+				+			Where:
+				+				"element.id" is an id that is unique to your page
+				+				"change.value" is the value that you are primarilily interested in tracking
+				+				i.e. the update is only made if this value changes.
+				+
+				+			Note: The id attribute of both the <tbu:replace> and the child of <tbu:replace> 
+				+			would normally be the same as this indicates that this is the element being replaced.
+				+			Only the first child of <tbu:replace> is used.
+    		+
+    		+		3. Add the BrowserUpdateTransformer to your pipeline, after the JXTGenerator.
+    		+
+    		+			<map:transform type="browser-update"/>
+    		+
+    		+		4. Have your page load the JavaScript.
+    		+
+				+			<script type="text/javascript" src="resources/ajax/js/cocoon-ajax.js"/>
+				+			<script type="text/javascript" src="resources/ajax/js/timedbrowserupdater.js"/>
+    		+
+    		+		5. Effect
+    		+
+    		+			When the page is first loaded, it will display all of it's content normally, 
+    		+			including the content of the <tbu:replace> tags.
+    		+			Thereafter, every 5 minutes, the regions inside <tbu:replace> tags will 
+    		+			automatically update, having retrieved any changed values via an XMLHTTPRequest
+    		+			in the background, to the same URI as the page.
+    		+
+    		+		6. Console
+    		+
+    		+		There is an optional sample console to control TimedBrowserUpdate.
+    		+
+    		+			<tbu:console i18nCatalogue="catalogue.name"/>
+    		+
+    		+		This outputs a simple form to control the Updater.
+    		+		It is not designed to be placed on the page more than once.
+    		+
+    		+		You need to supply the name of an i18n Catalogue that contain terms used by the console
+    		+		and you need to ensure that the I18nTransformer is in your pipeline.
+    		+
+    		+		The Console used these i18n keys :
+    		+
+    		+			tbu.name.title						the label in the console
+    		+			tbu.name.hint							the hint of the console
+    		+			tbu.delay.title						the label of the delay control
+    		+			tbu.delay.hint            the hint of the delay control
+    		+			tbu.delay.30  						delay for 300 secs
+    		+			tbu.delay.60  						delay for 60 secs
+    		+			tbu.delay.120  	  				delay for 120 secs
+    		+			tbu.delay.300   					delay for 300 secs
+    		+			tbu.delay.600   					delay for 600 secs
+    		+			tbu.isrunning.title				button text for running state
+    		+			tbu.isrunning.hint				button hint for running state
+    		+			tbu.notrunning.title			button text for not running state
+    		+			tbu.notrunning.hint				button hint for not running state
+    		+			
+    		+-->
+    
+    
+    
+<jx:template 	xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+							xmlns:bu="http://apache.org/cocoon/browser-update/1.0"
+							xmlns:tbu="http://apache.org/cocoon/timed-browser-update/1.0"
+							xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+    <jx:macro name="replace" targetNamespace="http://apache.org/cocoon/timed-browser-update/1.0">
+      <jx:parameter name="id"/>
+      <jx:parameter name="state"/>
+			<jx:choose>
+				<jx:when test="${cocoon.request.getParameter('cocoon-ajax') == 'true' &amp;&amp; cocoon.request.getParameter(id) != state}">
+					<bu:replace id="${id}" state="${state}">
+						<jx:evalBody/>
+					</bu:replace>
+				</jx:when>
+				<jx:otherwise>
+					<script language="Javascript">
+						TimedBrowserUpdaterInstance.registerWidget("${id}","${state}");
+					</script>
+					<jx:evalBody/>
+				</jx:otherwise>
+			</jx:choose>
+    </jx:macro>
+
+
+    <jx:macro name="console" targetNamespace="http://apache.org/cocoon/timed-browser-update/1.0">
+			<jx:parameter name="i18nCatalogue"/>
+			
+			<form id="tbuconsole" name="tbuconsole">
+				<table class="tbuConsole" title="${i18nCatalogue}:tbu.name.hint" i18n:attr="title">
+					<tr>
+						<th class="tbuName">
+							<i18n:text i18n:catalogue="${i18nCatalogue}">tbu.name.title</i18n:text>
+						</th>
+						<td class="tbuRunning">
+							<input id="tbuToggleRunButton" 
+								type="button" 
+								title="" 
+								value="" 
+								onClick="TimedBrowserConsole.toggleTimer();"  
+								tabindex="32000"
+							/>
+						</td>
+					</tr>
+					<tr>
+						<th class="tbuFrequencyTitle">
+							<i18n:text i18n:catalogue="${i18nCatalogue}">tbu.frequency.title</i18n:text>
+						</th>
+						<td class="tbuFrequency">
+							<select id="tbuFrequencySelector" 
+								size="1" 
+								onchange="TimedBrowserConsole.setFrequency();" 
+								title="${i18nCatalogue}:tbu.frequency.hint"
+								i18n:attr="title"
+								tabindex="32001"
+							>
+								<option value="30"><i18n:text i18n:catalogue="${i18nCatalogue}">tbu.frequency.30</i18n:text></option>
+								<option value="60"><i18n:text i18n:catalogue="${i18nCatalogue}">tbu.frequency.60</i18n:text></option>
+								<option value="120"><i18n:text i18n:catalogue="${i18nCatalogue}">tbu.frequency.120</i18n:text></option>
+								<option value="300"><i18n:text i18n:catalogue="${i18nCatalogue}">tbu.frequency.300</i18n:text></option>
+								<option value="600"><i18n:text i18n:catalogue="${i18nCatalogue}">tbu.frequency.600</i18n:text></option>
+							</select>
+						</td>
+					</tr>
+					<!-- uncomment this row to see the debug console -->
+					<!--<tr>
+						<th align="top">console</th>
+						<td class="tbuDebugConsole">
+							<textarea id="tbuConsole" rows="10" cols="40"></textarea>
+						</td>
+					</tr>-->
+				</table>
+			</form>
+			<script language="Javascript">
+				TimedBrowserConsole = new Cocoon.Ajax.TimedBrowserUpdater.Console (
+					TimedBrowserUpdaterInstance,
+					{
+						frequencyControl: $("tbuFrequencySelector"),
+						toggleControl: $("tbuToggleRunButton"),
+						console: $("tbuDebugConsole"),
+						isRunningTitle: "<i18n:text i18n:catalogue="${i18nCatalogue}">tbu.isrunning.title</i18n:text>",
+						notRunningTitle: "<i18n:text i18n:catalogue="${i18nCatalogue}">tbu.notrunning.title</i18n:text>",
+						isRunningHint: "<i18n:text i18n:catalogue="${i18nCatalogue}">tbu.isrunning.hint</i18n:text>",
+						notRunningHint: "<i18n:text i18n:catalogue="${i18nCatalogue}">tbu.notrunning.hint</i18n:text>"
+					}
+				)
+			</script>
+		</jx:macro>
+
+
+</jx:template>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/macros/timedbrowserupdater.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/xslt/ajax-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/xslt/ajax-styling.xsl?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/xslt/ajax-styling.xsl (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/xslt/ajax-styling.xsl Thu Nov  3 05:41:06 2005
@@ -0,0 +1,78 @@
+<?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:bu="http://apache.org/cocoon/browser-update/1.0"
+		xmlns:xl="http://www.w3.org/1999/xlink"
+	>
+	
+	
+	<!-- first version of tag -->
+	
+	<xsl:template match="a[@bu:target]">
+		<xsl:variable name="loc" select="generate-id()"/>
+		<xsl:variable name="verb" select="substring-before(@bu:target,'#')"/>
+		<xsl:variable name="id" select="substring-after(@bu:target,'#')"/>
+		<xsl:variable name="params" select="substring-after(@href,'?')"/>
+		<xsl:variable name="url">
+			<xsl:choose>
+				<xsl:when test="$params != ''"><xsl:value-of select="substring-before(@href,'?')"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="@href"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="insertion">
+			<xsl:choose>
+				<xsl:when test="$verb = 'insert-before'">Insertion.Before</xsl:when>
+				<xsl:when test="$verb = 'insert-after'">Insertion.After</xsl:when>
+				<xsl:when test="$verb = 'insert-top'">Insertion.Top</xsl:when>
+				<xsl:when test="$verb = 'insert-bottom'">Insertion.Bottom</xsl:when>
+				<xsl:otherwise>Cocoon.Ajax.Insertion.Replace</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="effect-target">
+			<xsl:choose>
+				<xsl:when test="$verb = 'insert-before'">.previousSibling</xsl:when>
+				<xsl:when test="$verb = 'insert-after'">.nextSibling</xsl:when>
+				<xsl:when test="$verb = 'insert-top'">.firstChild</xsl:when>
+				<xsl:when test="$verb = 'insert-bottom'">.lastChild</xsl:when>
+				<xsl:otherwise></xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+    <script type="text/javascript">
+      function ajax<xsl:value-of select="$loc"/>() { 
+				var up = new Ajax.Updater(
+					{success: "<xsl:value-of select="$id"/>"}, 
+					"<xsl:value-of select="$url"/>", 
+					{ 
+						parameters: "<xsl:value-of select="$params"/>", 
+						onFailure: Cocoon.Ajax.BrowserUpdater.handleError,
+						onComplete: function(request) { new Effect.Highlight($("<xsl:value-of select="$id"/>")<xsl:value-of select="$effect-target"/>); },
+						insertion: <xsl:value-of select="$insertion"/> 
+					}
+				);
+      }
+    </script>
+		<a href="#" onclick="{concat('ajax',$loc,'();')}" title="{@title}"><xsl:apply-templates/></a>
+	</xsl:template>
+	
+	
+	<!-- Catches all unrecognised elements as they are-->
+	<xsl:template match="*|@*|node()|text()" priority="-1">
+		<xsl:copy><xsl:apply-templates select="*|@*|node()|text()"/></xsl:copy>
+	</xsl:template>
+</xsl:stylesheet>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/main/resources/org/apache/cocoon/ajax/resources/xslt/ajax-styling.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,21 @@
+<?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.
+-->
+<fi:selection-list xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+  
+  <fi:item value="10/11/03"><fi:label>10/11/03</fi:label></fi:item>
+  <fi:item value="2/4/63"><fi:label>My birthdate</fi:label></fi:item>
+</fi:selection-list>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+
+package org.apache.cocoon.forms.datatype;
+
+import java.io.Writer;
+import java.util.Locale;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.cocoon.core.container.ContainerTestCase;
+import org.apache.cocoon.forms.FormsConstants;
+import org.apache.cocoon.xml.dom.DOMBuilder;
+import org.apache.excalibur.source.impl.ResourceSource;
+import org.custommonkey.xmlunit.Diff;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Test case for CForms's DynamicSelectionList datatype.
+ * @version $Id: DynamicSelectionListTestCase.java 326838 2005-10-20 06:26:53Z sylvain $
+ */
+public class DynamicSelectionListTestCase extends ContainerTestCase {
+
+    protected DatatypeManager datatypeManager;
+    protected DocumentBuilder parser;
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        datatypeManager = (DatatypeManager) this.lookup(DatatypeManager.ROLE);
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        parser = factory.newDocumentBuilder();
+    }
+    
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        if (datatypeManager != null) {
+            this.release(datatypeManager);
+        }
+        super.tearDown();
+    }
+    
+    /**
+     * Test the generateSaxFragment method.
+     * @throws MalformedURLException
+     * @throws ParserConfigurationException
+     */
+    public void testGenerateSaxFragment() throws Exception {
+        DOMBuilder dest = new DOMBuilder();
+        ResourceSource source = 
+            new ResourceSource("resource://org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml");
+        Document sourceDoc = parser.parse(source.getInputStream());
+        Element datatypeElement = (Element) sourceDoc.getElementsByTagNameNS(FormsConstants.DEFINITION_NS, "convertor").item(0);
+        Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
+        DynamicSelectionList list = 
+            new DynamicSelectionList(datatype, null, this.getManager());
+        list.generateSaxFragment(dest, Locale.ENGLISH, source);
+        ResourceSource expectedSource =
+            new ResourceSource("resource://org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml");
+        Document expected = parser.parse(expectedSource.getInputStream());
+        assertEqual("Test if output is what is expected",
+                expected, dest.getDocument());
+    }
+
+    /**
+     * Check is the source document is equal to the one produced by the method under test.
+     * @param message A message to print in case of failure.
+     * @param expected The expected (source) document.
+     * @param actual The actual (output) document.
+     */
+    private void assertEqual(String message, Document expected, Document actual) {
+        expected.getDocumentElement().normalize();
+        actual.getDocumentElement().normalize();
+        // DIRTY HACK WARNING: we add the "xmlns:wi" attribute reported
+        // by DOM, as expected, but not generated by the method under test,
+        // otherwise the comparison would fail. 
+        actual.getDocumentElement().setAttribute(FormsConstants.INSTANCE_PREFIX,
+                FormsConstants.INSTANCE_NS);
+        Diff diff =  new Diff(expected, actual);
+        assertTrue(message + ", " + diff.toString(), diff.similar());
+    }
+
+    /**
+     * Print a document to a writer for debugging purposes.
+     * @param document The document to print.
+     * @param out The writer to write to.
+     */
+    public final void print(Document document, Writer out) {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        try {
+            javax.xml.transform.Transformer serializer =
+                factory.newTransformer();
+            serializer.transform(
+                new DOMSource(document),
+                new StreamResult(out));
+            out.write('\n');
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<!--+
+    |   Source file for DynamicSelectionList test case.
+    |   $Id: DynamicSelectionListTestCase.source.xml 149119 2005-01-30 10:20:07Z sylvain $
+    +-->
+
+<fd:selection-list xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+  <fd:convertor type="formatting" base="date">
+    <fd:patterns>
+      <fd:pattern>yyyy-MM-dd</fd:pattern>
+    </fd:patterns>
+  </fd:convertor>
+  <fd:item value="2003-10-11"/>
+  <fd:item value="1963-02-04"><fd:label>My birthdate</fd:label></fd:item>
+</fd:selection-list>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-ajax-block/impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message