You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2005/03/24 11:19:17 UTC

svn commit: r158907 [1/2] - in lenya/branches/BRANCH_1_2_X/src: java/org/apache/lenya/cms/cocoon/generation/ java/org/apache/lenya/cms/cocoon/transformation/ java/org/apache/lenya/cms/publication/ webapp/lenya/ webapp/lenya/pubs/default/ webapp/lenya/resources/css/ webapp/lenya/resources/javascript/ webapp/lenya/xslt/info/ webapp/lenya/xslt/navigation/

Author: michi
Date: Thu Mar 24 02:19:14 2005
New Revision: 158907

URL: http://svn.apache.org/viewcvs?view=rev&rev=158907
Log:
thanks to Josias Thoeny we now have a better javascript tree implementation which has no problem with the license

Added:
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/javascript/navtree.js
Modified:
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/info.xmap
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/usecase-bxeng.xmap
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/css/tabs.css
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/javascript/tree.js
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/info/root.xsl
    lenya/branches/BRANCH_1_2_X/src/webapp/lenya/xslt/navigation/sitetree2nav.xsl

Added: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java?view=auto&rev=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java (added)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java Thu Mar 24 02:19:14 2005
@@ -0,0 +1,496 @@
+/*
+ * 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.
+ *
+ */
+
+/* @version $Id$*/
+
+package org.apache.lenya.cms.cocoon.generation;
+
+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.generation.AbstractGenerator;
+import org.apache.lenya.cms.publication.Label;
+import org.apache.lenya.cms.publication.PageEnvelope;
+import org.apache.lenya.cms.publication.PageEnvelopeFactory;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.SiteTree;
+import org.apache.lenya.cms.publication.SiteTreeException;
+import org.apache.lenya.cms.publication.SiteTreeNode;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Generates a fragment of the XML from the sitetree, corresponding to a given
+ * node. The node is specified by the sitemap parameters area/documentid. If the
+ * sitemap parameter initialTree is true, the top nodes of the tree will be
+ * generated and the node given by the sitemap parameters area/documentid will
+ * be unfolded. If initialTree is false, only the children of the selected node
+ * will be generated.
+ *  
+ */
+public class SitetreeFragmentGenerator extends AbstractGenerator {
+
+    protected Publication publication;
+
+    /** Parameter which denotes the documentid of the clicked node */
+    protected String documentid;
+
+    /** Parameter which denotes the area of the clicked node */
+    protected String area;
+
+    /**
+     * Parameter which decides if the initial tree with the root nodes is
+     * generated
+     */
+    protected boolean initialTree;
+
+    /**
+     * Parameter which denotes a comma-separated list of areas, for which the
+     * xml will be generated.
+     */
+    protected String[] areas = null;
+
+    /**
+     * Convenience object, so we don't need to create an AttributesImpl for
+     * every element.
+     */
+    protected AttributesImpl attributes;
+
+    protected static final String PARAM_AREA = "area";
+
+    protected static final String PARAM_DOCUMENTID = "documentid";
+
+    protected static final String PARAM_INITIAL = "initial";
+
+    protected static final String PARAM_AREAS = "areas";
+
+    /** The URI of the namespace of this generator. */
+    protected static final String URI = "http://apache.org/cocoon/lenya/sitetree/1.0";
+
+    protected static final String XML_URI = "http://www.w3.org/XML/1998/namespace";
+
+    /** The namespace prefix for this namespace. */
+    protected static final String PREFIX = "site";
+
+    protected static final String XML_PREFIX = "xml";
+
+    protected static final String NODE_NODE = "node";
+
+    protected static final String NODE_LABEL = "label";
+
+    protected static final String NODE_SITE = "site";
+
+    protected static final String NODE_FRAGMENT = "fragment";
+
+    protected static final String ATTR_ID = "id";
+
+    protected static final String ATTR_FOLDER = "folder";
+
+    protected static final String ATTR_AREA = "area";
+
+    protected static final String ATTR_LABEL = "label";
+
+    protected static final String ATTR_VISIBLEINNAV = "visibleinnav";
+
+    protected static final String ATTR_LINK = "link";
+
+    protected static final String ATTR_BASE = "base";
+
+    protected static final String ATTR_SUFFIX = "suffix";
+
+    protected static final String ATTR_HREF = "href";
+
+    protected static final String ATTR_LANG = "lang";
+
+    /**
+     * @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, Map objectModel, String src,
+            Parameters par) throws ProcessingException, SAXException,
+            IOException {
+        super.setup(resolver, objectModel, src, par);
+
+        PageEnvelope envelope = null;
+
+        if (getLogger().isDebugEnabled()) {
+            Request request = ObjectModelHelper.getRequest(objectModel);
+            getLogger().debug(
+                    "Resolving page envelope for URL ["
+                            + request.getRequestURI() + "]");
+        }
+
+        this.area = par.getParameter(PARAM_AREA, null);
+        this.documentid = par.getParameter(PARAM_DOCUMENTID, null);
+
+        if (par.isParameter(PARAM_INITIAL)) {
+            this.initialTree = Boolean.valueOf(
+                    par.getParameter(PARAM_INITIAL, null)).booleanValue();
+        } else {
+            this.initialTree = false;
+        }
+
+        if (par.isParameter(PARAM_AREAS)) {
+            String parAreas = par.getParameter(PARAM_AREAS, null);
+            this.areas = parAreas.split(",");
+        } else {
+            String temp[] = { "authoring", "archive", "trash" };
+            this.areas = temp;
+        }
+
+        if (this.getLogger().isDebugEnabled()) {
+            this.getLogger().debug("Parameter area: " + this.area);
+            this.getLogger().debug("Parameter documentid: " + this.documentid);
+            this.getLogger()
+                    .debug("Parameter initialTree: " + this.initialTree);
+            String areasStr = "";
+            for (int i = 0; i < this.areas.length; i++)
+                areasStr += this.areas[i] + " ";
+            this.getLogger().debug("Parameter areas: " + areasStr);
+        }
+
+        try {
+            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(
+                    objectModel);
+        } catch (Exception e) {
+            throw new ProcessingException("Resolving page envelope failed: ", e);
+        }
+
+        this.publication = envelope.getPublication();
+        this.attributes = new AttributesImpl();
+
+    }
+
+    /**
+     * @see org.apache.cocoon.generation.Generator#generate()
+     */
+    public void generate() throws IOException, SAXException,
+            ProcessingException {
+
+        try {
+
+            this.contentHandler.startDocument();
+            this.contentHandler.startPrefixMapping(PREFIX, URI);
+
+            attributes.clear();
+            if (!initialTree) {
+                attributes.addAttribute("", ATTR_AREA, ATTR_AREA, "CDATA",
+                        this.area);
+                attributes.addAttribute("", ATTR_BASE, ATTR_BASE, "CDATA",
+                        this.documentid);
+            }
+
+            this.contentHandler.startElement(URI, NODE_FRAGMENT, PREFIX + ':'
+                    + NODE_FRAGMENT, this.attributes);
+
+            if (this.initialTree) {
+                for (int i = 0; i < this.areas.length; i++) {
+                    generateFragmentInitial(this.areas[i]);
+                }
+            } else {
+                generateFragment();
+            }
+
+            this.contentHandler.endElement(URI, NODE_FRAGMENT, PREFIX + ':'
+                    + NODE_FRAGMENT);
+
+            this.contentHandler.endPrefixMapping(PREFIX);
+            this.contentHandler.endDocument();
+
+        } catch (SAXException e) {
+            throw new ProcessingException(e);
+        } catch (SiteTreeException e) {
+            throw new ProcessingException(e);
+        }
+
+    }
+
+    /**
+     * Generates a fragment of the tree which contains the children of a given
+     * node.
+     * 
+     * @throws SiteTreeException
+     * @throws SAXException
+     * @throws ProcessingException
+     */
+    protected void generateFragment() throws SiteTreeException, SAXException,
+            ProcessingException {
+
+        SiteTree siteTree = null;
+        if (!this.area.equals(Publication.AUTHORING_AREA)
+                && !this.area.equals(Publication.ARCHIVE_AREA)
+                && !this.area.equals(Publication.TRASH_AREA)
+                && !this.area.equals(Publication.STAGING_AREA)
+                && !this.area.equals(Publication.LIVE_AREA)) {
+            throw new ProcessingException("Invalid area: " + this.area);
+        }
+        siteTree = publication.getSiteTree(this.area);
+
+        SiteTreeNode node = siteTree.getNode(this.documentid);
+        if (this.getLogger().isDebugEnabled()) {
+            this.getLogger().debug(
+                    "Node with documentid " + documentid + " found.");
+        }
+        if (node == null)
+            throw new SiteTreeException("Node with documentid " + documentid
+                    + " not found.");
+
+        SiteTreeNode[] children = node.getChildren();
+
+        for (int i = 0; i < children.length; i++) {
+            startNode(NODE_NODE, children[i]);
+            addLabels(children[i]);
+            endNode(NODE_NODE);
+        }
+    }
+
+    /**
+     * Generates the top node of the given area and then calls a recursive
+     * method to traverse the tree, if the node given by area/documentid is in
+     * this area.
+     * 
+     * @param siteArea
+     * @throws SiteTreeException
+     * @throws SAXException
+     * @throws ProcessingException
+     */
+    protected void generateFragmentInitial(String siteArea)
+            throws SiteTreeException, SAXException, ProcessingException {
+
+        SiteTree siteTree = publication.getSiteTree(siteArea);
+
+        String label = "";
+        String isFolder = "";
+
+        // FIXME: don't hardcode area label
+        if (siteArea.equals(Publication.AUTHORING_AREA))
+            label = "Authoring";
+        if (siteArea.equals(Publication.ARCHIVE_AREA))
+            label = "Archive";
+        if (siteArea.equals(Publication.TRASH_AREA))
+            label = "Trash";
+        if (siteArea.equals(Publication.LIVE_AREA))
+            label = "Live";
+        if (siteArea.equals(Publication.STAGING_AREA))
+            label = "Staging";
+
+        if (siteTree.getTopNodes().length > 0)
+            isFolder = "true";
+        else
+            isFolder = "false";
+
+        this.attributes.clear();
+        this.attributes.addAttribute("", ATTR_AREA, ATTR_AREA, "CDATA",
+                siteArea);
+        this.attributes.addAttribute("", ATTR_FOLDER, ATTR_FOLDER, "CDATA",
+                isFolder);
+        this.attributes
+                .addAttribute("", ATTR_LABEL, ATTR_LABEL, "CDATA", label);
+
+        startNode(NODE_SITE);
+
+        if (area.equals(siteArea)) {
+            generateFragmentRecursive(siteTree.getTopNodes(), this.documentid);
+        }
+
+        endNode(NODE_SITE);
+    }
+
+    /**
+     * Follows the documentid to find the way in the sitetree to the specified
+     * node and opens all folders on its way.
+     * 
+     * @param nodes
+     * @param docid
+     * @throws SiteTreeException
+     * @throws SAXException
+     */
+    protected void generateFragmentRecursive(SiteTreeNode[] nodes, String docid)
+            throws SiteTreeException, SAXException {
+        String nodeid;
+        String childid;
+
+        if (nodes == null)
+            return;
+        if (docid.startsWith("/"))
+            docid = docid.substring(1);
+        if (docid.indexOf("/") != -1) {
+            nodeid = docid.substring(0, docid.indexOf("/"));
+            childid = docid.substring(docid.indexOf("/") + 1);
+        } else {
+            nodeid = docid;
+            childid = "";
+        }
+
+        for (int i = 0; i < nodes.length; i++) {
+            startNode(NODE_NODE, nodes[i]);
+            addLabels(nodes[i]);
+            if (nodes[i].getId().equals(nodeid)) {
+                generateFragmentRecursive(nodes[i].getChildren(), childid);
+            }
+            endNode(NODE_NODE);
+        }
+    }
+
+    /**
+     * Begins a named node and calls setNodeAttributes to set its attributes.
+     * 
+     * @param nodeName
+     *            the name of the new node
+     * @throws SAXException
+     *             if an error occurs while creating the node
+     */
+    protected void startNode(String nodeName) throws SAXException {
+        this.contentHandler.startElement(URI, nodeName,
+                PREFIX + ':' + nodeName, this.attributes);
+    }
+
+    /**
+     * Begins a named node and calls setNodeAttributes to set its attributes.
+     * 
+     * @param nodeName
+     *            the name of the new node
+     * @param node
+     *            The attributes are taken from this node
+     * @throws SAXException
+     *             if an error occurs while creating the node
+     */
+    protected void startNode(String nodeName, SiteTreeNode node)
+            throws SAXException {
+        setNodeAttributes(node);
+        this.contentHandler.startElement(URI, nodeName,
+                PREFIX + ':' + nodeName, this.attributes);
+    }
+
+    /**
+     * Sets the attributes for a given node. Sets attributes id, href, folder,
+     * suffix, basic-url, language-suffix.
+     * 
+     * @param node
+     * @throws SAXException
+     *             if an error occurs while setting the attributes
+     */
+    protected void setNodeAttributes(SiteTreeNode node) throws SAXException {
+        this.attributes.clear();
+
+        String id = node.getId();
+        String isVisible = Boolean.toString(node.visibleInNav());
+        String hasLink = Boolean.toString(node.hasLink());
+        String href = node.getHref();
+        String suffix = node.getSuffix();
+        String isFolder = isFolder(node);
+
+        if (this.getLogger().isDebugEnabled()) {
+            this.getLogger().debug("adding attribute id: " + id);
+            this.getLogger().debug(
+                    "adding attribute visibleinnav: " + isVisible);
+            this.getLogger().debug("adding attribute link: " + hasLink);
+            if (href != null)
+                this.getLogger().debug("adding attribute href: " + href);
+            if (suffix != null)
+                this.getLogger().debug("adding attribute suffix: " + suffix);
+            this.getLogger().debug("adding attribute folder: " + isFolder);
+        }
+        this.attributes.addAttribute("", ATTR_ID, ATTR_ID, "CDATA", id);
+        this.attributes.addAttribute("", ATTR_VISIBLEINNAV, ATTR_VISIBLEINNAV,
+                "CDATA", isVisible);
+        this.attributes
+                .addAttribute("", ATTR_LINK, ATTR_LINK, "CDATA", hasLink);
+        if (href != null)
+            this.attributes.addAttribute("", ATTR_HREF, ATTR_HREF, "CDATA",
+                    href);
+        if (suffix != null)
+            this.attributes.addAttribute("", ATTR_SUFFIX, ATTR_SUFFIX, "CDATA",
+                    suffix);
+        this.attributes.addAttribute("", ATTR_FOLDER, ATTR_FOLDER, "CDATA",
+                isFolder);
+    }
+
+    /**
+     * Returns a value to indicate whether a node is a folder (contains
+     * subnodes). With the incremental sitetree loading, we sometimes load nodes
+     * which are folders, but we don't load their children. But we still have to
+     * know if it's a folder or not, i.e. if it can be opened.
+     * 
+     * @param node
+     * @return "true" or "false"
+     */
+    protected String isFolder(SiteTreeNode node) {
+        if (node.getChildren().length > 0)
+            return "true";
+        else
+            return "false";
+    }
+
+    /**
+     * Ends the named node.
+     * 
+     * @param nodeName
+     *            the name of the new node
+     * @throws SAXException
+     *             if an error occurs while closing the node
+     */
+    protected void endNode(String nodeName) throws SAXException {
+        this.contentHandler.endElement(URI, nodeName, PREFIX + ':' + nodeName);
+    }
+
+    /**
+     * Finds all the label children of a node and adds them to the nav xml.
+     * 
+     * @param node
+     * @throws SAXException
+     */
+    protected void addLabels(SiteTreeNode node) throws SAXException {
+        Label[] labels = node.getLabels();
+
+        for (int i = 0; i < labels.length; i++) {
+            String lang = labels[i].getLanguage();
+            if (lang == null)
+                lang = "";
+            addLabel(labels[i].getLabel(), lang);
+        }
+    }
+
+    /**
+     * Adds a label element of a given language.
+     * 
+     * @param label
+     *            the value of the label
+     * @param language
+     *            the language of the label
+     * @throws SAXException
+     */
+    protected void addLabel(String label, String language) throws SAXException {
+        this.attributes.clear();
+        this.attributes.addAttribute(XML_URI, ATTR_LANG, XML_PREFIX + ":"
+                + ATTR_LANG, "CDATA", language);
+
+        this.contentHandler.startElement(URI, NODE_LABEL, PREFIX + ':'
+                + NODE_LABEL, this.attributes);
+        char[] labelArray = label.toCharArray();
+        this.contentHandler.characters(labelArray, 0, labelArray.length);
+        this.contentHandler.endElement(URI, NODE_LABEL, PREFIX + ':'
+                + NODE_LABEL);
+    }
+
+}
\ No newline at end of file

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java?view=diff&r1=158906&r2=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java Thu Mar 24 02:19:14 2005
@@ -167,6 +167,13 @@
 
         Attributes attributes = attr;
 
+        if (isFragmentNode(uri, localName)) {
+            String area = attr.getValue("area"); // FIXME: don't hardcode
+            String base = attr.getValue("base");
+            if (area!=null && base!=null) {
+                documentId = "/"+area+base;
+            }
+        }
         if (isNode(uri, localName)) {
             String id = attr.getValue(SiteTreeNodeImpl.ID_ATTRIBUTE_NAME);
             if (id != null) {
@@ -225,6 +232,17 @@
     protected boolean isNode(String uri, String localName) {
         return uri.equals(SiteTree.NAMESPACE_URI)
             && (localName.equals(SiteTreeNodeImpl.NODE_NAME) || localName.equals("site"));
+    }
+
+    /**
+     * Returns if an element represents a fragment node.
+     * @param uri The namespace URI.
+     * @param localName The local name.
+     * @return A boolean value.
+     */
+    protected boolean isFragmentNode(String uri, String localName) {
+        return uri.equals(SiteTree.NAMESPACE_URI)
+            && (localName.equals("fragment"));
     }
 
 }

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java?view=diff&r1=158906&r2=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/DefaultSiteTree.java Thu Mar 24 02:19:14 2005
@@ -455,6 +455,24 @@
     }
 
     /**
+     * @see org.apache.lenya.cms.publication.SiteTree#getTopNodes()
+     */
+    public SiteTreeNode[] getTopNodes() {
+        List childElements = new ArrayList();
+
+        NamespaceHelper helper = new NamespaceHelper(NAMESPACE_URI, "", document);
+ 
+        Element[] elements = helper.getChildren((Element) document.getDocumentElement(), SiteTreeNodeImpl.NODE_NAME);
+
+        for (int i = 0; i < elements.length; i++) {
+            SiteTreeNode newNode = new SiteTreeNodeImpl(elements[i]);
+            childElements.add(newNode);
+        }
+
+        return (SiteTreeNode[]) childElements.toArray(new SiteTreeNode[childElements.size()]);
+    }
+    
+    /**
      * Move up the node amongst its siblings.
      * 
      * @param documentid The document id for the node.

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java?view=diff&r1=158906&r2=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/SiteTree.java Thu Mar 24 02:19:14 2005
@@ -205,6 +205,12 @@
     SiteTreeNode getNode(String documentId);
 
     /**
+     * Return the top level nodes in the sitetree.
+     * @return the top nodes in the sitetree, or empty array if there are none
+     */
+    SiteTreeNode[] getTopNodes();
+    
+   /**
      * Move up the node amongst its siblings.
      * 
      * @param documentid The document id of the node.

Modified: lenya/branches/BRANCH_1_2_X/src/webapp/lenya/info.xmap
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/info.xmap?view=diff&r1=158906&r2=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/webapp/lenya/info.xmap (original)
+++ lenya/branches/BRANCH_1_2_X/src/webapp/lenya/info.xmap Thu Mar 24 02:19:14 2005
@@ -20,7 +20,9 @@
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
   <map:components>
-    <map:generators default="file"/>
+    <map:generators default="file">
+      <map:generator name="sitetree-fragment" label="content,data" logger="sitemap.generator.sitetree-fragment" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.lenya.cms.cocoon.generation.SitetreeFragmentGenerator"/>
+    </map:generators>
     <map:transformers default="xslt"/>
     <map:readers default="resource"/>
     <map:serializers default="html"/>
@@ -85,12 +87,20 @@
       </map:match>
       
       <!-- {publication-id}/{area}/info-sitetree -->
-      <map:match pattern="*/*/info-sitetree/sitetree.js">
-        <map:aggregate element="lenya" label="aggregate">
-          <map:part src="cocoon:/{1}/authoring/sitetree.xml"/>
-          <map:part src="cocoon:/{1}/archive/sitetree.xml"/>
-          <map:part src="cocoon:/{1}/trash/sitetree.xml"/>
-        </map:aggregate>
+      <map:match pattern="*/*/info-sitetree/sitetree-fragment.xml">
+        <map:generate type="sitetree-fragment">
+          <map:parameter name="areas" value="{request-param:areas}"/>
+          <map:parameter name="area" value="{request-param:area}"/>
+          <map:parameter name="contextprefix" value="{request:contextPath}"/>
+          <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
+          <map:parameter name="documentid" value="{request-param:documentid}"/>
+          <map:parameter name="initial" value="{request-param:initial}"/>
+        </map:generate>
+        <!-- <map:call resource="i18n"/> -->
+        <map:transform type="access-control-sitetree">
+          <map:parameter name="publication-id" value="{1}"/>
+          <map:parameter name="area" value="{2}"/>
+        </map:transform>
         <map:act type="set-header">
           <map:parameter name="Cache-Control" value="pre-check=0" />
           <map:parameter name="Expires" value="-1" />
@@ -99,29 +109,14 @@
           <map:parameter name="chosenlanguage" value="{request-param:language}"/>
           <map:parameter name="defaultlanguage" value="{page-envelope:default-language}"/>
         </map:transform>
-        <map:transform src="{fallback:xslt/info/sitetree2tree.xsl}" label="content">
-          <map:parameter name="contextprefix" value="{request:contextPath}"/>
-          <map:parameter name="publicationid" value="{1}"/>
-          <map:parameter name="chosenlanguage" value="{request-param:language}"/>
-          <map:parameter name="defaultlanguage" value="{page-envelope:default-language}"/>
-          <map:parameter name="cutdocumentid" value="{session-attr:org.apache.lenya.cms.info.cutdocumentid}"/>
-        </map:transform>
-        <map:serialize type="text"/>
+        <map:serialize type="xml"/>
       </map:match>
     </map:pipeline>
     
     <!-- Sitetree Javascript array      -->
     <map:pipeline>
-      <map:match pattern="*/*/info-sitetree/tree.js">
-        <map:read src="resources/javascript/tree.js"/>
-        <map:serialize type="text"/>
-      </map:match>
-    </map:pipeline>
-
-    <!-- Sitetree Javascript array      -->
-    <map:pipeline>
-      <map:match pattern="*/*/info-sitetree/ua.js">
-        <map:read src="resources/javascript/ua.js"/>
+      <map:match pattern="*/*/info-sitetree/*.js">
+        <map:read src="resources/javascript/{3}.js"/>
         <map:serialize type="text"/>
       </map:match>
     </map:pipeline>
@@ -134,7 +129,7 @@
         <map:transform src="xslt/info/info.xsl">
           <map:parameter name="tab" value="{2}"/>
           <map:parameter name="area" value="{1}"/>
-      	  <map:parameter name="contextprefix" value="{request:contextPath}"/>
+          <map:parameter name="contextprefix" value="{request:contextPath}"/>
           <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
           <map:parameter name="documentid" value="{page-envelope:document-id}"/>
           <map:parameter name="languageexists" value="true"/>
@@ -148,7 +143,7 @@
         <map:transform src="xslt/info/info.xsl">
           <map:parameter name="tab" value="{2}"/>
           <map:parameter name="area" value="{1}"/>
-      	  <map:parameter name="contextprefix" value="{request:contextPath}"/>
+          <map:parameter name="contextprefix" value="{request:contextPath}"/>
           <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
           <map:parameter name="documentid" value="{page-envelope:document-id}"/>
           <map:parameter name="languageexists" value="true"/>
@@ -164,8 +159,8 @@
           <map:transform src="xslt/info/info.xsl">
             <map:parameter name="tab" value="{../2}"/>
             <map:parameter name="area" value="{../1}"/>
-        	  <map:parameter name="contextprefix" value="{request:contextPath}"/>
-            <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
+          <map:parameter name="contextprefix" value="{request:contextPath}"/>
+          <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
             <map:parameter name="documentid" value="{page-envelope:document-id}"/>
             <map:parameter name="languageexists" value="true"/>
           </map:transform>
@@ -176,6 +171,8 @@
         <map:transform src="xslt/info/info.xsl">
           <map:parameter name="tab" value="{2}"/>
           <map:parameter name="area" value="{1}"/>
+          <map:parameter name="contextprefix" value="{request:contextPath}"/>
+          <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
           <map:parameter name="documentid" value="{page-envelope:document-id}"/>
           <map:parameter name="languageexists" value="false"/>
         </map:transform>
@@ -299,6 +296,7 @@
             <map:parameter name="documentextension" value="{page-envelope:document-extension}"/>
             <map:parameter name="defaultlanguage" value="{page-envelope:default-language}"/>
             <map:parameter name="languages" value="{page-envelope:publication-languages-csv}"/>
+            <map:parameter name="cutdocumentid" value="{session-attr:org.apache.lenya.cms.info.cutdocumentid}"/>
           </map:transform>
           
           <map:transform src="cocoon://lenya-page/{../1}/info/default.xml"/>

Modified: lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/usecase-bxeng.xmap
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/usecase-bxeng.xmap?view=diff&r1=158906&r2=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/usecase-bxeng.xmap (original)
+++ lenya/branches/BRANCH_1_2_X/src/webapp/lenya/pubs/default/usecase-bxeng.xmap Thu Mar 24 02:19:14 2005
@@ -173,28 +173,6 @@
         <map:call resource="style-cms-page"/>
       </map:match>
       
-      <!-- {publication-id}/{area}/info-sitetree -->
-      <map:match pattern="link-tree" type="step">
-        <map:aggregate element="lenya" label="aggregate">
-          <map:part src="content/authoring/sitetree.xml"/>
-        </map:aggregate>
-
-        <map:transform src="../../xslt/navigation/sitetree2nav.xsl" label="navtree">
-          <map:parameter name="chosenlanguage" value="{request-param:language}"/>
-          <map:parameter name="defaultlanguage" value="{page-envelope:default-language}"/>
-        </map:transform>
-
-        <map:transform src="../../xslt/bxeng/sitetree2tree.xsl" label="content">
-          <map:parameter name="contextprefix" value="{request:contextPath}"/>
-          <map:parameter name="publicationid" value="{page-envelope:publication-id}"/>
-          <map:parameter name="chosenlanguage" value="{request-param:language}"/>
-          <map:parameter name="defaultlanguage" value="{page-envelope:default-language}"/>
-          <map:parameter name="cutdocumentid" value="{session-attr:org.apache.lenya.cms.info.cutdocumentid}"/>
-         </map:transform>
-
-        <map:serialize type="text"/>
-      </map:match>      
-
       <map:match pattern="**/*.html">
         <!-- configuration -->
         <map:match type="step" pattern="config">

Modified: lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/css/tabs.css
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/css/tabs.css?view=diff&r1=158906&r2=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/css/tabs.css (original)
+++ lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/css/tabs.css Thu Mar 24 02:19:14 2005
@@ -82,16 +82,38 @@
 
 }
 
-#lenya-info-tree td {
+#lenya-info-tree span {
     font-family: verdana, helvetica, sans-serif;
     font-size: small;
+    color: #333333; text-decoration: none;
+    cursor: pointer;
 }
 
-#lenya-info-treecanvas a { color: #333333; text-decoration: none; }
+#lenya-info-treecanvas .lenya-info-root { font-weight: bold; cursor: default; }
 #lenya-info-treecanvas .lenya-info-nolanguage { color: #AAAAAA; }
 #lenya-info-treecanvas .lenya-info-cut { color: #FFAAAA; font-style: italic; }
 #lenya-info-treecanvas .lenya-info-protected { color: #CC3333; }
-#lenya-info-treecanvas a:hover { text-decoration: underline; }
+#lenya-info-treecanvas span:hover { text-decoration: underline; }
+
+#lenya-info-tree table { 
+  border-spacing: 0px;
+  border-collapse: collapse;
+}
+#lenya-info-tree td {
+  vertical-align: top;
+  margin: 0px;
+  padding: 0px; 
+}
+#lenya-info-tree td.lenya-info-label-td {
+  vertical-align: top;
+  margin: 0px;
+  padding: 0px 0px 0px 2px; 
+}
+
+#lenya-info-treecanvas .treenode_icon { padding-left: 2px; padding-right: 1px; }
+#lenya-info-treecanvas .selected_node span { background-color: rgb(221, 220, 207); }
+#lenya-info-treecanvas .treenode_sign { vertical-align: top; padding: 0px; }
+
 
 #lenya-info-content {
 	float: left;

Added: lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/javascript/navtree.js
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/javascript/navtree.js?view=auto&rev=158907
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/javascript/navtree.js (added)
+++ lenya/branches/BRANCH_1_2_X/src/webapp/lenya/resources/javascript/navtree.js Thu Mar 24 02:19:14 2005
@@ -0,0 +1,484 @@
+/*
+  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.
+*/
+
+var xmlhttp;
+
+function NavRoot(doc, rootElement) {
+    this.doc = doc;
+    this.rootElement = rootElement;
+    this.selected = null;
+};
+
+NavRoot.prototype = new Root;
+
+NavRoot.prototype.getItems = function(item, handler, allow_cache) {
+  if (item.root == item) {
+    alert('getTtems() of root called. This should not happen, loadInitialTree should be called first.');
+  } else {
+    item.loadSubTree(handler);
+  }
+};
+
+NavRoot.prototype.loadInitialTree = function(area, documentid) {
+  var url = CONTEXT_PREFIX + '/' + PUBLICATION_ID + PIPELINE_PATH + '?area='+area+'&documentid='+documentid+'&language='+CHOSEN_LANGUAGE+'&initial=true&areas='+ALL_AREAS;  
+  var fragment = loadSitetreeFragment(url);
+  if (fragment!=null) {
+    this.initialTreeLoaded(fragment);
+    this.select(this.getItemByPath(PUBLICATION_ID+'/'+area+documentid)); // FIXME: is the path always correct?
+  }
+};
+
+NavRoot.prototype.addItems = function(items) {
+    this.items = {};
+    this.itemids = [];
+    for (var i = items.length - 1; i >= 0; i--) {
+        var item = items[i];
+        this.items[item.id] = item;
+        this.itemids.unshift(item.id);
+    };
+};
+
+NavRoot.prototype.initialTreeLoaded = function(xml)
+{
+  var root = xml.documentElement;
+  var children = root.childNodes;
+  var items=[];
+  var item;
+  for (var i = 0; i < children.length; i++) {
+     if (children[i].tagName == "nav:site") {
+        item = this.addLoadedSite(children[i]);
+        items.push(item);
+        item.addNodesRec(children[i]);
+     }
+  }
+  this.addItems(items);
+  this.open();
+}
+
+NavRoot.prototype.addLoadedSite = function(site)
+{
+  var langSuffix = '';
+  if (CHOSEN_LANGUAGE!=DEFAULT_LANGUAGE) langSuffix = '_'+CHOSEN_LANGUAGE;
+
+  var siteArea = site.getAttribute('area');
+  var newSite = new NavNode(siteArea, this);
+  newSite.init();
+  
+  newSite.isfolder = isNodeFolder(site);
+  newSite.area = siteArea;
+  newSite.documentid = '/';
+  newSite.isprotected = isNodeProtected(site);
+  newSite.href = langSuffix;
+  newSite.label = site.getAttribute('label');
+  
+  return newSite;
+}
+
+/* NavRoot.prototype.getIcon = function(item) {
+    // don't use an icon for root and area nodes
+    if (item.depth<2) return this.doc.createTextNode('');
+
+    var img = this.doc.createElement('img');
+    img.setAttribute('src', IMAGE_PATH + 'document.gif');
+    return img;
+}; */
+
+/* return an img object that represents the file type */
+NavRoot.prototype.getIcon = function(item) {
+    return this.doc.createTextNode('');
+};
+
+/* creates the item name and any icons and such */
+NavRoot.prototype.createItemLine = function(item) {
+    var span = this.doc.createElement('span');
+    var icon = this.getIcon(item);
+    if (icon.nodeType == 1) {
+        icon.className = 'treenode_icon';
+    };
+    span.appendChild(icon);
+    
+    var text = this.doc.createTextNode(item.label ? item.label : item.id);
+    
+    if (item.root==item) {
+        span.className = 'lenya-info-root';
+    } else {
+        if (item.isprotected) {
+            span.className = 'lenya-info-protected';
+        } else if (item.documentid == CUT_DOCUMENT_ID) {
+            span.className = 'lenya-info-cut';
+        } else if (!item.existsChosenLanguage) {
+            span.className = 'lenya-info-nolanguage';
+        } else {
+            span.className = 'treenode_label';
+        }
+    }
+    span.appendChild(text);
+    
+    return span;
+};
+
+NavRoot.prototype.createItemHtml = function(item) {
+    var div = this.doc.createElement('div');
+    div.className = 'treenode';
+
+    // place a reference to the item on the div
+    div.treeitem = item;
+    
+    var table = this.doc.createElement('table');
+    div.appendChild(table);
+    var tbody = this.doc.createElement('tbody');
+    table.appendChild(tbody);
+    var tr = this.doc.createElement('tr');
+    tbody.appendChild(tr);
+
+    // add the lines:
+    this.addLines(item, tr);
+
+    // add the opensign
+    var td1 = this.doc.createElement('td');
+    tr.appendChild(td1);
+    item.opensign = this.getCloseSign(item);
+    item.opensign.className = 'treenode_sign';
+
+    if (this.getSignType(item) == 'T') {
+        // if the label of this item is too long the line will wrap
+        // by setting the background image we get a continuos line
+        td1.style.backgroundImage = 'url('+IMAGE_PATH+'vertical-line.gif)';
+    }
+
+    td1.appendChild(item.opensign);
+    
+    // add the label
+    var td2 = this.doc.createElement('td');
+    tr.appendChild(td2);
+    td2.className = 'lenya-info-label-td';
+    var line = this.createItemLine(item);
+    td2.appendChild(line);
+    
+    addEventHandler(line, 'click', this.handleItemClick, this, item);
+    addEventHandler(item.opensign, 'click', this.handleItemSignClick, 
+                    this, item);
+
+    if (this.selected == item.getPath()) {
+        this.unselect();
+        this.select(item);
+        div.className = 'selected_node';
+    };
+
+    return div;
+};
+
+/* decide if the [+] or [-] sign is 'L' or '|-' type */
+Root.prototype.getSignType = function(item) {
+    if (item.root != item) {
+        if (isLastChild(item.parent, item)) {
+            return 'L';
+        } else {
+            return 'T';
+        }
+    }
+    return 'X';  // invalid type
+};
+
+/* get the [+] sign for a collection or resource */
+Root.prototype.getCloseSign = function(item) {
+    var opensign = this.doc.createElement('img');
+    opensign.className = 'treenode_sign';
+    
+    if (item.root == item) {
+        // the root needs no opensign
+        opensign.setAttribute('src', IMAGE_PATH+'empty.gif');
+        opensign.setAttribute('width', '0');
+    } else {
+        var suffix = this.getSignType(item);
+        if (item.isCollection()) {
+            opensign.setAttribute('src', IMAGE_PATH+'closed-collection-'+suffix+'.gif');
+        } else {
+            opensign.setAttribute('src', IMAGE_PATH+'non-collection-'+suffix+'.gif');
+        };
+    }
+    return opensign;
+};
+
+/* get the [-] sign for a collection */
+Root.prototype.getOpenSign = function(item) {
+    var opensign = this.doc.createElement('img');
+    opensign.className = 'treenode_sign';
+
+    if (item.root == item) {
+        // the root needs no opensign
+        opensign.setAttribute('src', IMAGE_PATH+'empty.gif');
+        opensign.setAttribute('width', '0');
+    } else {
+        var suffix = this.getSignType(item);
+        opensign.setAttribute('src', IMAGE_PATH+'opened-collection-'+suffix+'.gif');
+    }
+    return opensign;
+};
+
+/* add the lines of an item (the edges of the tree) */
+NavRoot.prototype.addLines = function(item, parentElement) {
+    var linesStr = this.computeLinesString(item);
+    // linesStr is in the reverse order
+    for (var i=linesStr.length-1; i>0; i--) {
+        var td = this.doc.createElement('td');
+        var img = this.doc.createElement('img');
+        
+        var imageName = '';
+        if (linesStr.charAt(i)=='I') {
+            imageName = 'vertical-line.gif';
+            // if the label of this item is too long the line will wrap
+            // by setting the background image we get a continuos line
+            td.style.backgroundImage = 'url('+IMAGE_PATH+'vertical-line.gif)';
+        } else {
+            imageName = 'empty.gif';
+        }
+        img.setAttribute('src', IMAGE_PATH+imageName);
+        img.className = 'treenode_sign';
+
+        td.appendChild(img);
+        parentElement.appendChild(td);
+    }
+}
+
+/* computes the lines of an item as a string (the edges of the tree)
+     E: ' ' empty
+     I: '|' vertical line
+     L: 'L' 
+     T: '|-'
+*/
+NavRoot.prototype.computeLinesString = function(item) {
+    var lines = ''
+    
+    if (item.root == item) return lines;
+    
+    // first level, decide T or L
+    if (isLastChild(item.parent, item)) {
+        lines += 'L';
+    } else {
+        lines += 'T';
+    }
+    item = item.parent;
+
+    // subsequent levels, decide I or E
+    while (item.root != item) {
+        if (isLastChild(item.parent, item)) {
+            lines += 'E'; // empty
+        } else {
+            lines += 'I'; // vertical line
+        }
+        item = item.parent;
+    }
+    
+    return lines;
+}
+
+function isLastChild(parent, child) {
+    // this should be a method of Node
+    for (var i=0; i<parent.itemids.length-1; i++) {
+        if (parent.itemids[i] == child.id) return false;
+    };
+    return true;
+}
+
+NavRoot.prototype.handleItemClick = function(item, event) {
+    if (!item.isprotected && item.root!=item) {
+        href = CONTEXT_PREFIX+'/'+PUBLICATION_ID+"/info-"+item.area+"/"+item.href+"?lenya.usecase=info-overview&lenya.step=showscreen"; 
+        window.location = href;
+    }
+};
+
+/******************************************
+ *  NavNode 
+ ******************************************/
+
+function NavNode(id, parent) {
+    this.id = id;
+    this.parent = parent;
+    this.items = {};
+    this.isfolder = false;
+    this.href = '';
+    this.label = '';
+    this.area = '';
+    this.documentid = '';
+    this.isprotected = true;
+    this.existsChosenLanguage = true;
+};
+
+NavNode.prototype = new Node;
+
+NavNode.prototype.addItems = function(items) {
+    this.items = {};
+    this.itemids = [];
+    for (var i = items.length - 1; i >= 0; i--) {
+        var item = items[i];
+        this.items[item.id] = item;
+        this.itemids.unshift(item.id);
+    };
+};
+
+NavNode.prototype.isCollection = function() {
+    return this.isfolder;
+};
+
+NavNode.prototype.loadSubTree = function(handler) 
+{
+  area = this.area;
+  documentid = this.documentid;  
+  
+  var url = CONTEXT_PREFIX + '/' + PUBLICATION_ID + PIPELINE_PATH + '?area='+area+'&documentid='+documentid+'&language='+CHOSEN_LANGUAGE+'&areas='+ALL_AREAS;
+
+  var xml = loadSitetreeFragment(url);
+  if (xml!=null) this.subTreeLoaded(xml, handler);
+}
+
+NavNode.prototype.subTreeLoaded = function(xml, handler)
+{
+  var root = xml.documentElement;
+
+  var children = root.childNodes;
+  var items=[];
+  for (var i = 0; i < children.length; i++) {
+     if (children[i].tagName == "nav:node") {
+        items.push(this.addLoadedNode(children[i]));
+     } 
+  }
+  //handler(items);
+  this._continueOpen(items);
+
+}
+
+NavNode.prototype.addNodesRec = function(parentNode)
+{
+    var children = parentNode.childNodes;
+    var items = [];
+    var nodes = [];
+    var item;
+    for (var i = 0; i < children.length; i++) {
+       if (children[i].tagName == "nav:node") {
+          this.reopen = true; // this causes the parent to unfold
+          item = this.addLoadedNode(children[i]);
+          items.push(item);
+          item.addNodesRec(children[i]); 
+       } 
+    }
+    this.addItems(items);
+}
+
+NavNode.prototype.addLoadedNode = function(node)
+{
+    var newItem = new NavNode(node.getAttribute('id'), this);
+    newItem.init();
+  
+    newItem.isfolder = isNodeFolder(node);
+    newItem.area = this.area;
+    newItem.documentid = '/' + node.getAttribute('basic-url');
+    newItem.isprotected = isNodeProtected(node);
+    newItem.href = node.getAttribute('href');
+    newItem.label = getLabel(node);
+    newItem.existsChosenLanguage = existsChosenLanguage(node);
+  
+    return newItem;
+}
+
+
+
+/******************************************
+ *  Dynamic loading and helper functions 
+ ******************************************/
+
+
+function loadSitetreeFragment(url)
+{
+  if (xmlhttp==null) createXMLHttp();
+  
+  //alert('load subtree for '+url);
+  // do synchronous loading 
+  xmlhttp.open("GET",url,false);  
+  xmlhttp.setRequestHeader('Accept','text/xml');
+  xmlhttp.send(null);
+  
+  //alert('result: '+xmlhttp.responseText);
+  
+  var xml = xmlhttp.responseXML;
+  if( xml == null || xml.documentElement == null) {
+    alert('Error: could not load sitetree xml');
+    return null;
+  } 
+  return xml;
+}
+
+function getLabel(node) 
+{
+    var cs = node.childNodes;
+    var l = cs.length;
+    // lenya generates the xml and is responsible to insert the label
+    // of the correct language
+    for (var i = 0; i < l; i++) {
+       if (cs[i].tagName=='nav:label') {
+          return cs[i].firstChild.nodeValue;
+       } 
+    }
+    return '';
+}
+
+function isNodeProtected(node) 
+{
+  var prot = node.getAttribute('protected');
+  if (prot == 'true') return true;
+  return false;
+}
+
+function isNodeFolder(node) 
+{
+  var isfolder = node.getAttribute('folder');
+  if (isfolder == 'true') return true;
+  return false;
+}
+
+// check if the node has a label of the chosen language
+function existsChosenLanguage(node) 
+{
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+       if (children[i].tagName=='nav:label' && children[i].getAttribute('xml:lang')==CHOSEN_LANGUAGE) {
+          return true;
+       } 
+    }
+    return false;
+}
+
+// create the xmlhttp object
+function createXMLHttp() 
+{
+    /*@cc_on @*/
+    /*@if (@_jscript_version >= 5)
+    // JScript gives us Conditional compilation, we can cope with old IE versions.
+    // and security blocked creation of the objects.
+     try {
+      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+     } catch (e) {
+      try {
+       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+      } catch (E) {
+       xmlhttp = false;
+      }
+     }
+    @end @*/
+    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
+      xmlhttp = new XMLHttpRequest();
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org