svn commit: r778132 - in /lenya/branches/BRANCH_2_0_X/src/modules/sitetree: ./ java/src/org/apache/lenya/cms/cocoon/generation/ java/src/org/apache/lenya/cms/cocoon/transformation/

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Sun May 24 12:52:44 2009
New Revision: 778132

URL: http://svn.apache.org/viewvc?rev=778132&view=rev
Log:
Reverting last change. We should review the sitetree handling after the 2.0.3 release, now it is too risky.

Modified:
    lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java
    lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java
    lenya/branches/BRANCH_2_0_X/src/modules/sitetree/sitemap.xmap

Modified: lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java?rev=778132&r1=778131&r2=778132&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java (original)
+++ lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/generation/SitetreeFragmentGenerator.java Sun May 24 12:52:44 2009
@@ -79,7 +79,6 @@
     private SiteStructure site;
 
     private String path;
-    private String documentElement;
 
     private String cacheKey;
     private SourceValidity validity;
@@ -92,12 +91,6 @@
     protected static final String PARAM_INITIAL = "initial";
     protected static final String PARAM_TYPE = "mimetype";
     protected static final String PARAM_AREAS = "areas";
-    
-    /**
-     * The local name of the document element to be generated.
-     * Optional, defaults to {@link #NODE_FRAGMENT}. 
-     */
-    protected static final String PARAM_DOCUMENT_ELEMENT = "document-element";
 
     /** The URI of the namespace of this generator. */
     public static final String URI = "http://apache.org/cocoon/lenya/sitetree/1.0";
@@ -164,12 +157,6 @@
             String temp[] = { "authoring", "archive", "trash" };
             this.areas = temp;
         }
-        
-        if (par.isParameter(PARAM_DOCUMENT_ELEMENT)) {
-            this.documentElement = par.getParameter(PARAM_DOCUMENT_ELEMENT, null);
-        } else {
-            this.documentElement = NODE_FRAGMENT;
-        }
 
         if (this.getLogger().isDebugEnabled()) {
             this.getLogger().debug("Parameter area: " + area);
@@ -257,7 +244,7 @@
                 this.attributes.addAttribute("", ATTR_BASE, ATTR_BASE, "CDATA", this.path);
             }
 
-            this.contentHandler.startElement(URI, this.documentElement, PREFIX + ':' + this.documentElement,
+            this.contentHandler.startElement(URI, NODE_FRAGMENT, PREFIX + ':' + NODE_FRAGMENT,
                     this.attributes);
 
             if (this.initialTree) {
@@ -268,7 +255,7 @@
                 generateFragment();
             }
 
-            this.contentHandler.endElement(URI, this.documentElement, PREFIX + ':' + this.documentElement);
+            this.contentHandler.endElement(URI, NODE_FRAGMENT, PREFIX + ':' + NODE_FRAGMENT);
 
             this.contentHandler.endPrefixMapping(PREFIX);
             this.contentHandler.endDocument();

Modified: lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java?rev=778132&r1=778131&r2=778132&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java (original)
+++ lenya/branches/BRANCH_2_0_X/src/modules/sitetree/java/src/org/apache/lenya/cms/cocoon/transformation/AccessControlSitetreeTransformer.java Sun May 24 12:52:44 2009
@@ -133,24 +133,15 @@
 
         Attributes attributes = attr;
 
-        if (isFragmentElement(uri, localName) || isSiteElement(uri, localName)) {
-            
-            String pubIdAttr = attr.getValue(SitetreeFragmentGenerator.ATTR_PUBLICATION);
-            if (isFragmentElement(uri, localName)) {
-                Assert.notNull(SitetreeFragmentGenerator.ATTR_PUBLICATION + " attribute", pubIdAttr);
-            }
-            if (pubIdAttr != null) {
-                this.pubId = pubIdAttr;
+        if (isFragmentElement(uri, localName)) {
+            this.pubId = attr.getValue(SitetreeFragmentGenerator.ATTR_PUBLICATION);
+            Assert.notNull("publication attribute", this.pubId);
+
+            String area = attr.getValue("area");
+            if (area != null) {
+                this.area = area;
             }
 
-            String areaAttr = attr.getValue(SitetreeFragmentGenerator.ATTR_AREA);
-            if (isSiteElement(uri, localName)) {
-                Assert.notNull(SitetreeFragmentGenerator.ATTR_AREA + " attribute", areaAttr);
-            }
-            if (areaAttr != null) {
-                this.area = areaAttr;
-            }
-            
             String basePath = attr.getValue(SitetreeFragmentGenerator.ATTR_BASE);
             this.basePath = basePath == null ? "" : basePath;
 
@@ -163,6 +154,9 @@
                 throw new SAXException(e);
             }
 
+        } else if (isSiteElement(uri, localName)) {
+            this.area = attr.getValue("area");
+            Assert.notNull("area attribute", this.area);
         } else if (isNodeElement(uri, localName)) {
             String id = attr.getValue(SitetreeFragmentGenerator.ATTR_ID);
             Assert.notNull("id attribute", id);

Modified: lenya/branches/BRANCH_2_0_X/src/modules/sitetree/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules/sitetree/sitemap.xmap?rev=778132&r1=778131&r2=778132&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules/sitetree/sitemap.xmap (original)
+++ lenya/branches/BRANCH_2_0_X/src/modules/sitetree/sitemap.xmap Sun May 24 12:52:44 2009
@@ -71,15 +71,14 @@
       <!-- sitetree -->
       <!-- pattern: sitetree/{1:pub-id}/{2:area}.xml -->
       <map:match pattern="sitetree/*/*.xml">
-        <map:generate type="sitetree-fragment">
-          <map:parameter name="pub" value="{1}"/>
-          <map:parameter name="area" value="{2}"/>
-          <map:parameter name="areas" value="{2}"/>
-          <map:parameter name="path" value="/"/>
-          <map:parameter name="initial" value="false"/>
-          <map:parameter name="mimetype" value="false"/>
-          <map:parameter name="document-element" value="site"/>
-        </map:generate>
+        <map:select type="resource-exists">
+          <map:when test="lenya://lenya/pubs/{1}/content/{2}/sitetree.xml">
+            <map:generate src="lenya://lenya/pubs/{1}/content/{2}/sitetree.xml"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="fallback://lenya/modules/sitetree/resources/content/emptySitetree.xml"/>
+          </map:otherwise>
+        </map:select>
         <map:serialize type="xml"/>
       </map:match>
       
@@ -119,7 +118,10 @@
       <map:match pattern="*/*/sitetree.xml">
         <map:generate src="cocoon:/sitetree/{1}/{2}.xml"/>
         <map:call resource="i18n"/>
-        <map:transform type="access-control-sitetree"/>
+        <map:transform type="access-control-sitetree">
+          <map:parameter name="publication-id" value="{1}"/>
+          <map:parameter name="area" value="{2}"/>
+        </map:transform>
         <map:transform src="fallback://lenya/modules/sitetree/xslt/info/sitetree2areatree.xsl">
           <map:parameter name="area" value="{2}"/>
         </map:transform>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.