You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by so...@apache.org on 2006/06/12 01:24:58 UTC

svn commit: r413547 [3/15] - in /lenya/branches/revolution/1.3.x: ./ src/java/org/apache/lenya/cms/cocoon/components/modules/input/ src/java/org/apache/lenya/cms/cocoon/components/source/ src/java/org/apache/lenya/cms/cocoon/components/source/impl/ src...

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java Sun Jun 11 16:24:48 2006
@@ -0,0 +1,285 @@
+package org.apache.lenya.cms.publication;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+
+//TODO: Rearchitect so can reset all without restarting Lenya?
+
+public class Modules {
+   private ArrayList templates   = new ArrayList(); // Default list of Publications for inherit.
+//TODO: external and exclude should have defaults in module.xml.  
+//Current algorithm needs replacing.  
+//Use TRUE, FALSE, UNSET rather than Boolean.
+//Change exclude to Map.
+   private Map external    = new HashMap();   // Every Module in Publication with Boolean.
+   private Set exclude     = new HashSet();   // Only Modules excluded.
+   private Map inherit     = new HashMap();   // Only Modules overriding inherit.
+   private Map modules = new HashMap();   // Only Modules overriding inherit with new moduleID.
+   boolean allAllowed  = true;
+   boolean allExternal = true;
+   static Map variables = new HashMap();  //publication.module.variablename = value from publication.xconf
+   static Map defaultvariables = new HashMap();  //publication.module.variablename = value from module.xml
+   static Map globalvariables = new HashMap(); //module.variable = value from global module.xml
+   static boolean isGlobalvariablesSet = false;
+   private String servletContextPath;
+
+//Dev testing
+   Configuration config;
+
+   public Modules(String publication, String servletContextPath, Configuration config){
+      if(null == config) return;
+      int i;
+      this.servletContextPath = servletContextPath;
+      this.config = config;  //TESTING
+      
+      String[] attrnames = config.getAttributeNames();
+      for(i = 0; i < attrnames.length; i++ ) {
+         try{
+            String attribute = attrnames[i];
+            String value = config.getAttribute(attrnames[i]);
+            if(attribute.equalsIgnoreCase("include")){
+               if(!value.equalsIgnoreCase("all")) allAllowed = false;
+            }else if(attribute.equalsIgnoreCase("external")){
+               if(!(value.equalsIgnoreCase("all") | value.equalsIgnoreCase("true"))) allExternal = false;
+            }else if((attribute.equalsIgnoreCase("inherit")|attribute.equalsIgnoreCase("template"))){
+               templates.add(value);
+            }
+         }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
+            //TODO: Log Errors?
+         }
+      }  //For each Attribute
+      Configuration[] children = config.getChildren();
+      for(int c = 0; c < children.length; c++ ) {
+         String element = children[c].getName();
+         attrnames = children[c].getAttributeNames();
+         if(element.equalsIgnoreCase("inherit")){
+            for(i = 0; i < attrnames.length; i++ ) {
+               try{
+                  templates.add(children[c].getAttribute(attrnames[i]));
+               }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
+                  //TODO: Log Errors?
+               }
+            }
+            try{
+                  templates.add(children[c].getValue());
+            }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
+               // Error means no value
+            }
+         }else if(element.equalsIgnoreCase("module")){
+             boolean isExternal = true;
+             boolean isExcluded = false;
+             String name = "";
+             String template = "";
+             String module = "";
+             for(i = 0; i < attrnames.length; i++ ) {
+                String attribute = attrnames[i];
+                try{
+                   String value = children[c].getAttribute(attrnames[i]);
+                   if(attribute.equalsIgnoreCase("external")){
+                      if(!(value.equalsIgnoreCase("yes") | value.equalsIgnoreCase("true"))) isExternal = false;
+                   }else if(attribute.equalsIgnoreCase("exclude")){
+                      if(!(value.equalsIgnoreCase("yes") | value.equalsIgnoreCase("true"))) isExcluded = true;
+                   }else if(attribute.equalsIgnoreCase("name")){
+                      name = value;
+                   }else if((attribute.equalsIgnoreCase("inherit")|attribute.equalsIgnoreCase("template"))){
+                      template = value;
+                   }else if(attribute.equalsIgnoreCase("module")){
+                      module = value;
+                   }
+               }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
+                  //TODO: Log Errors?
+               }
+             }
+             if(name.length() > 0){
+                if(isExcluded){
+                   exclude.add(name);
+                }else{
+                   external.put(name, new Boolean(isExternal));
+                   if(template.length() > 0) inherit.put(name, template);
+                   if(module.length() > 0) inherit.put(name, module);
+                   //Variables
+                   Map varmap = getVariablesFromConfiguration(children[c]);
+                   Iterator keys = varmap.keySet().iterator();
+                   while(keys.hasNext()){
+                      String key = (String) keys.next();
+                      variables.put(publication + "." + name + "." + key, varmap.get(key));
+                   }
+/* OBSOLETE
+                   Configuration[] vchildren = children[c].getChildren();
+                   for(int v = 0; v < vchildren.length; v++ ) {
+                      String velement = vchildren[v].getName();
+                      if(velement.equalsIgnoreCase("variable")|velement.equalsIgnoreCase("param")|
+                            velement.equalsIgnoreCase("parameter")){
+                         try{
+                            String vname = vchildren[v].getAttribute("name");
+                            String vvalue = vchildren[v].getValue();
+                            variables.put(publication + "." + name + "." + vname, vvalue);
+                         }catch(org.apache.avalon.framework.configuration.ConfigurationException vce){
+                            // Do Nothing?
+                         }  //try
+                      }  // if variable
+                   } //for
+OBSOLETE - END */
+               } // isExcluded
+            } // Has name
+         } //element tag
+      } // for each child
+      // Get variables from module.xml if each is not set
+      loadModuleVariables(publication);
+      loadGlobalVariables();
+   }  // function
+   public boolean isExternal(String moduleID){
+      if(exclude.contains(moduleID)) return false;
+      if(allExternal) return true;
+      if(external.containsKey(moduleID)) return ((Boolean) external.get(moduleID)).booleanValue();
+      //TODO: Check parent templates?
+      return allAllowed;
+   }
+
+   public boolean isAllowed(String moduleID){
+      if(exclude.contains(moduleID)) return false;
+      if(allAllowed) return true;
+      if(external.containsKey(moduleID)) return true;
+      return false;
+   }
+   public String[] getTemplates(String moduleId){
+      if(inherit.containsKey(moduleId)){ 
+         ArrayList tmpArray = new ArrayList();
+         tmpArray.add(inherit.get(moduleId));
+         tmpArray.addAll(templates);
+         return (String[]) tmpArray.toArray(new String[0]);
+      }
+      return (String[]) templates.toArray(new String[0]);
+   }
+   public String getInheritedModule(String moduleId){
+      if(modules.containsKey(moduleId)) return (String) modules.get(moduleId);
+      return moduleId; 
+   }
+
+   public String getVariable(String publication, String module, String varname){
+      String moduleID = module;
+      if(exclude.contains(moduleID)) return "";
+      if(variables.containsKey(publication + "." + moduleID + "." + varname)){
+         return (String) variables.get(publication + "." + moduleID + "." + varname);
+      }
+//TODO: ModuleID could change with inheritance.  Use inherit.
+      String[] templates = getTemplates(moduleID);
+      for(int i = 0; i < templates.length; i++) {
+         if(variables.containsKey(templates[i] + "." + moduleID + "." + varname)){
+               return (String) variables.get(templates[i] + "." + moduleID + "." + varname);
+         }
+      }
+      moduleID = module;
+      //Check Module Variables
+      if(defaultvariables.containsKey(publication + "." + moduleID + "." + varname)){
+         return (String) defaultvariables.get(publication + "." + moduleID + "." + varname);
+      }
+//TODO: ModuleID could change with inheritance.  Use inherit.
+      for(int i = 0; i < templates.length; i++) {
+         if(defaultvariables.containsKey(templates[i] + "." + moduleID + "." + varname)){
+               return (String) defaultvariables.get(templates[i] + "." + moduleID + "." + varname);
+         }
+      }
+      //Check Global Variables
+      //ModuleID could change with inheritance.  Only check highest inheritance, not current module.
+      if(globalvariables.containsKey(moduleID + "." + varname)){
+         return (String) globalvariables.get(moduleID + "." + varname);
+      }
+      //Default
+      return "";
+   }
+
+   public void loadModuleVariables(String publication){
+      File directory = new File(servletContextPath, Publication.PUBLICATION_PREFIX 
+            + File.separator + publication + File.separator + "modules");
+      //For each directory in pub/modules, check directory/module.xml
+      if(directory.exists() && directory.isDirectory()){
+         String[] files = directory.list();
+         for(int f = 0; f < files.length; f++) {
+            File moduledirectory = new File(directory, files[f]);
+            if(moduledirectory.exists() && moduledirectory.isDirectory()){
+               File modulexml = new File(moduledirectory, "module.xml");
+               if(modulexml.exists()){
+                  Map varmap = getModuleXMLValues(modulexml);
+                  Iterator keys = varmap.keySet().iterator();
+                  while(keys.hasNext()){
+                     String key = (String) keys.next();
+                     defaultvariables.put(publication + "." + files[f] + "." + key, varmap.get(key));             
+System.out.println("Default:"+ publication + "." + files[f] + "." + key +"="+ varmap.get(key));             
+                  }
+               }
+            }
+         }
+      }
+   }
+
+   public void loadGlobalVariables(){
+      if(!isGlobalvariablesSet){
+         File directory = new File(servletContextPath, "lenya" + File.separator + "modules");
+//For each directory in lenya/modules, check directory/module.xml
+         if(directory.exists() && directory.isDirectory()){
+            String[] files = directory.list();
+            for(int f = 0; f < files.length; f++) {
+               File moduledirectory = new File(directory, files[f]);
+               if(moduledirectory.exists() && moduledirectory.isDirectory()){
+                  File modulexml = new File(moduledirectory, "module.xml");
+                  if(modulexml.exists()){
+                     Map varmap = getModuleXMLValues(modulexml);
+                     Iterator keys = varmap.keySet().iterator();
+                     while(keys.hasNext()){
+                        String key = (String) keys.next();
+                        globalvariables.put(files[f] + "." + key, varmap.get(key));             
+                     }
+                  }
+               }
+            }
+         }
+         //Finish
+         isGlobalvariablesSet = true;
+      }
+   }
+   private Map getModuleXMLValues(File modulexml){
+         DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+      try{
+         Configuration config = builder.buildFromFile(modulexml);
+//TEST: Is top level?
+         return getVariablesFromConfiguration(config);
+      }catch(org.xml.sax.SAXException saxe){
+      }catch(java.io.IOException ioe){
+      }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
+      }
+      return new HashMap();
+   }
+   private Map getVariablesFromConfiguration(Configuration config){
+      Map map = new HashMap();
+      Configuration[] vchildren = config.getChildren();
+      for(int v = 0; v < vchildren.length; v++ ) {
+         String velement = vchildren[v].getName();
+//Standardize on "parameter"?
+         if(velement.equalsIgnoreCase("variable")|velement.equalsIgnoreCase("param")
+               |velement.equalsIgnoreCase("parameter")){
+            try{
+               map.put(vchildren[v].getAttribute("name"), vchildren[v].getValue());
+            }catch(org.apache.avalon.framework.configuration.ConfigurationException vce){
+               // Do Nothing?
+            }  //try
+         }  // if variable
+      } //for
+      return map;
+   }
+
+   private Publication getPublication(String publication){
+      try{
+         return PublicationFactory.getPublication(publication, servletContextPath);
+      }catch(org.apache.lenya.cms.publication.PublicationException pe){
+         return (Publication) null;
+      }
+   }
+}
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java?rev=413547&r1=413546&r2=413547&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java Sun Jun 11 16:24:48 2006
@@ -22,6 +22,10 @@
 import java.io.File;
 
 import org.apache.lenya.cms.publishing.PublishingEnvironment;
+// LENYA1.3 - BEGIN
+import org.apache.lenya.cms.content.Content;
+// LENYA1.3 - END
+
 
 /**
  * A Lenya publication.
@@ -252,5 +256,12 @@
      * @return An array of strings.
      */
     String[] getRewriteAttributeXPaths();
-    
+
+//Lenya1.3 - BEGIN
+    Modules getModules();
+    Content getContent();
+    File getContentDirectory();
+    String getContentType();
+//Lenya1.3 - END
+
 }

Modified: lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl?rev=413547&r1=413546&r2=413547&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl Sun Jun 11 16:24:48 2006
@@ -111,8 +111,29 @@
       class="org.apache.lenya.cms.cocoon.components.modules.input.PublicationContentDirModule">
     </component-instance>
 
+<!-- Lenya1.3 BEGIN -->
+<component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.ContentModule" name="content" logger="core.modules.input.module"/>
+<component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.ModuleModule" name="module" logger="core.modules.input.module"/>
+<component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.PublicationModule" name="publication" logger="core.modules.input.module"/>
+<component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.Usecase2ModuleModule" name="u2m" logger="core.modules.input.usecase2module"/>
+<!-- Lenya1.3 END -->
+
   </xsl:copy>
 </xsl:template>
+
+<!-- LENYA1.3 BEGIN: Changed "module:" protocol from Cocoon to Lenya1.3. -->
+<xsl:template match="source-factories">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+    <component-instance class="org.apache.lenya.cms.cocoon.components.source.impl.ModuleSourceFactory" name="module"/>
+    <component-instance class="org.apache.lenya.cms.cocoon.components.source.impl.ContentSourceFactory" name="content"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="source-factories/component-instance[@name = 'module']"  priority="3"/>
+<!-- LENYA1.3 END -->
+
 
 <xsl:template match="cocoon">
   <xsl:copy>

Modified: lenya/branches/revolution/1.3.x/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/global-sitemap.xmap?rev=413547&r1=413546&r2=413547&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/global-sitemap.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/global-sitemap.xmap Sun Jun 11 16:24:48 2006
@@ -92,7 +92,9 @@
    
     <map:resource name="i18n">
       <map:transform type="i18n">
-        <map:parameter name="locale" value="{request:locale}"/>
+<!-- Lenya1.3 - BEGIN : Fix for 1.2 -->
+        <map:parameter name="locale" value="{page-envelope:document-language}"/>
+<!-- Lenya1.3 - END -->
       </map:transform>
     </map:resource>
  </map:resources>
@@ -372,8 +374,10 @@
       <!-- Internal usecases -->
       <map:pipeline internal-only="true">
         <map:match type="usecase" pattern="*">
-          <map:match pattern="*/**">
-            <map:mount uri-prefix="{1}" src="lenya/pubs/{1}/sitemap.xmap" check-reload="true" reload-method="synchron"/>
+<!-- LENYA1.3 BEGIN -->
+          <map:match pattern="*/*/**">
+            <map:mount uri-prefix="{1}" src="lenya/pubs/{1}/modules/{2}/module.xmap" check-reload="true" reload-method="synchron"/>
+<!-- LENYA1.3 END -->
           </map:match>
         </map:match>
       </map:pipeline>
@@ -436,6 +440,30 @@
       
       <!-- Enter the actual publication -->
       <map:match pattern="*/**">
+<!-- LENYA1.3 BEGIN: Area as Module -->
+<!-- Just Module -->
+         <map:match pattern="*/*">
+            <map:select type="resource-exists">
+              <map:when test="lenya/pubs/{1}/modules/{2}/module.xmap">
+                 <map:mount uri-prefix="{1}" src="lenya/pubs/{1}/modules/{2}/module.xmap" check-reload="true" reload-method="synchron"/>
+              </map:when>
+              <map:when test="lenya/modules/{2}/module.xmap">
+                 <map:mount uri-prefix="{1}" src="lenya/modules/{2}/module.xmap" check-reload="true" reload-method="synchron"/>
+              </map:when>
+            </map:select>
+         </map:match>
+<!-- With param -->
+         <map:match pattern="*/*/**">
+            <map:select type="resource-exists">
+              <map:when test="lenya/pubs/{1}/modules/{2}/module.xmap">
+                 <map:mount uri-prefix="{1}" src="lenya/pubs/{1}/modules/{2}/module.xmap" check-reload="true" reload-method="synchron"/>
+              </map:when>
+              <map:when test="lenya/modules/{2}/module.xmap">
+                 <map:mount uri-prefix="{1}" src="lenya/modules/{2}/module.xmap" check-reload="true" reload-method="synchron"/>
+              </map:when>
+            </map:select>
+         </map:match>
+<!-- LENYA1.3 END -->
         <map:mount uri-prefix="{1}" src="lenya/pubs/{1}/sitemap.xmap" check-reload="true" reload-method="synchron"/>
       </map:match>
 

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/info.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/info.xmap?rev=413547&r1=413546&r2=413547&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/info.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/info.xmap Sun Jun 11 16:24:48 2006
@@ -74,7 +74,7 @@
       
       <!-- {publication-id}/{area}/sitetree.xml -->
       <map:match pattern="*/*/sitetree.xml">
-        <map:generate type="sitetree">
+        <map:generate type="sitetree2">
 	  <map:parameter name="area" value="{2}"/>
 	</map:generate>
         <map:call resource="i18n"/>

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap Sun Jun 11 16:24:48 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:components/>
+
+  <map:views></map:views>
+
+  <map:resources/>
+
+  <map:pipelines>
+
+    <!-- View Revision? -->
+    <map:pipeline>
+      <map:match pattern="*/*/*/**.xml">
+        <map:match type="step" pattern="view-revision">
+          <map:generate type="serverpages" src="module:///../../../../content/rc/view.xsp">
+          </map:generate>
+          <map:transform src="module:///../../../../xslt/rc/toDoc.xsl"/>
+        <map:transform src="module:///../../xslt/{../3}2xhtml.xsl">
+          <map:parameter name="rendertype" value="{1}"/>
+          <map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
+          <map:parameter name="language" value="{page-envelope:document-language}"/>
+        </map:transform>
+          <map:serialize type="xml"/>
+        </map:match>
+      </map:match>
+
+      <!-- parametrized doctype matcher -->
+      <!-- pattern="{rendertype}/{area}/{doctype}/{document-path}" -->
+      <map:match pattern="*/*/*/**.xml">
+        <map:generate src="module:///../../content/{2}/{4}.xml"/>
+        <map:transform src="module:///../../xslt/{3}2xhtml.xsl">
+          <map:parameter name="rendertype" value="{1}"/>
+          <map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
+          <map:parameter name="language" value="{page-envelope:document-language}"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap Sun Jun 11 16:24:48 2006
@@ -0,0 +1,213 @@
+<?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.
+-->
+<!-- Authoring Module for Lenya 1.3.  Migrated from 1.2.x publication-sitemap.xmap.  -->
+<!-- Assumes Hierarchical Storage.  Needs to be aware of Flat storage. -->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:components/>
+  <map:views>
+    <map:view from-label="aggregation" name="aggregation">
+      <map:serialize type="xml"/>
+    </map:view>
+  </map:views>
+  <map:resources>
+    <map:resource name="style-cms-page">
+      <map:transform type="i18n">      
+        <map:parameter name="locale" value="{request:locale}"/>
+      </map:transform>    
+      <map:transform src="module:///../../../../xslt/util/page2xhtml.xsl">
+        <map:parameter name="contextprefix" value="{request:contextPath}"/>
+      </map:transform>
+      <map:transform src="module:///../../../../xslt/util/strip_namespaces.xsl"/>
+      <map:select type="parameter">
+        <map:parameter name="parameter-selector-test" value="{statusCode}"/>
+        <map:when test="">
+          <map:serialize/>
+        </map:when>
+        <!-- FIXME workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=32336 -->
+        <map:when test="404">
+          <map:serialize status-code="404"/>
+        </map:when>
+        <map:otherwise>
+          <map:serialize status-code="{statusCode}"/>
+        </map:otherwise>
+      </map:select>
+    </map:resource>
+  </map:resources>
+
+  <map:pipelines>
+
+    <map:component-configurations>
+      <global-variables>
+        <cache-dir>work/cache</cache-dir>
+      </global-variables>
+    </map:component-configurations>
+
+    <map:pipeline>
+      <map:match pattern="**/">
+        <map:redirect-to uri="index.html"/>
+        <!--<map:redirect-to uri="{1}.html"/>-->
+      </map:match>
+    </map:pipeline>
+    
+    <map:pipeline>
+      <!-- pattern="{rendertype}/{area}/{doctype}/{document-path}" -->
+      <!-- NOTE: rendertype seems to be 'edit' or 'view' -->
+      <map:match pattern="lenya-document-*/*/*/**.xml">
+        <map:mount check-reload="true" reload-method="synchron" src="module:///doctypes.xmap" uri-prefix="lenya-document-"/>
+      </map:match>
+    </map:pipeline>
+    <!-- BX Editor: RNG Schema, CSS -->
+    <map:pipeline type="noncaching">
+      
+      <map:match pattern="*/**.rng">
+        <map:generate src="module:///../../config/doctypes/schemas/{2}.rng"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <map:match pattern="**/*-bxeng.css">
+        <map:read mime-type="text/css" src="module:///../../resources/misc/bxeng/{2}-bxeng.css"/>
+      </map:match>
+      
+      <map:handle-errors>
+        <map:select type="exception">
+           <map:when test="resourcenotfound">
+             <map:generate src="module:///../../../../content/util/empty.xml" />
+            <map:transform src="module:///../../../../xslt/exception/document-does-not-exist.xsl">
+              <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+            </map:transform>
+            <map:call resource="style-cms-page">
+              <map:parameter name="statusCode" value="404"/>
+            </map:call>
+          </map:when>
+      <map:otherwise>
+        <map:generate type="notifying"/>
+        <map:transform src="module:///../../../../../stylesheets/system/error2html.xslt">
+          <map:parameter name="contextPath" value="{request:contextPath}"/>
+        </map:transform>
+      </map:otherwise>
+        </map:select>
+        <map:serialize type="xhtml"/>
+      </map:handle-errors>    
+      </map:pipeline>
+    <!-- /BX Editor: RNG Schema -->
+    
+    <!-- This is the pipeline that builds the page. It aggregates all
+    the navigational elements (breadcrumb, tabs, menu) with the actual
+    content of the document. -->
+    <map:pipeline>
+      <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
+      <map:match pattern="lenyabody-*/*/*/*/**">
+        <map:aggregate element="cmsbody">
+          <map:part src="cocoon://navigation/{2}/{3}/breadcrumb/{5}.xml"/>
+          <map:part src="cocoon://navigation/{2}/{3}/tabs/{5}.xml"/>
+          <map:part src="cocoon://navigation/{2}/{3}/menu/{5}.xml"/>
+          <map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
+          <map:part src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}"/>
+        </map:aggregate>
+        <map:transform src="module:///../../xslt/page2xhtml-{4}.xsl">
+          <map:parameter name="root" value="{page-envelope:context-prefix}/{2}/{3}"/>
+          <map:parameter name="url" value="{5}"/>
+          <map:parameter name="document-id" value="{page-envelope:document-id}"/>
+          <map:parameter name="document-type" value="{page-envelope:document-type}"/>
+          <map:parameter name="language" value="{page-envelope:document-language}"/>
+        </map:transform>
+        <map:transform type="i18n">      
+          <map:parameter name="locale" value="{page-envelope:document-language}"/>
+        </map:transform>    
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test" value="{1}"/>
+          <map:when test="view">
+	      <map:transform type="link-rewrite"/>
+          </map:when>
+        </map:select>
+        <map:serialize type="xml"/>
+      </map:match>
+    </map:pipeline>
+    
+    <!-- This is the main entry point into the publication. This
+    pipeline uses the uriparametrizer to determine the doctype of this
+    request. It then aggregates the lenya menu (for the given area) and
+    the lenya body, the actual document. -->
+    <map:pipeline>
+      <map:match pattern="**.bxe.html">
+        <map:generate src="cocoon:/lenyabody-edit/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-url}"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <map:match pattern="**.html">
+        <map:act type="language-exists">
+              <map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-url}"/>
+              <map:match pattern="authoring/**.html">
+                <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{../../1}.xml?doctype={page-envelope:document-type}"/>
+              </map:match>
+              <map:transform src="module:///../../../../xslt/util/strip_namespaces.xsl"/>
+              <map:match pattern="live/**.html">
+                <map:transform src="module:///../../../../xslt/authoring/edit/addSourceTags.xsl">
+                  <map:parameter name="source" value="{global:cache-dir}/live/{1}.html"/>
+                </map:transform>
+                <map:transform type="write-source">
+                  <map:parameter name="serializer" value="xhtml"/>
+                </map:transform>
+                <map:transform src="module:///../../../../xslt/authoring/edit/removeSourceTags.xsl"/>
+              </map:match>
+              <map:serialize type="xhtml"/>
+        </map:act>
+
+        <!-- There is no version of the requested document-id for the
+             requested language. -->
+        <map:generate type="serverpages" src="module:///../../../../content/exception/missing-language.xsp"/>
+        <map:transform src="module:///../../../../xslt/exception/missing-language.xsl"/>
+        <map:call resource="style-cms-page"/>
+
+      </map:match>
+      
+      <map:handle-errors>
+        <map:select type="exception">
+          <map:when test="document-does-not-exist">
+            <map:generate src="module:///../../../../content/util/empty.xml"/>
+            <map:transform src="module:///../../../../xslt/exception/document-does-not-exist.xsl">
+              <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+            </map:transform>
+            <map:call resource="style-cms-page">
+              <map:parameter name="statusCode" value="404"/>
+            </map:call>
+          </map:when>
+           <map:when test="resourcenotfound">
+             <map:generate src="module:///../../../../content/util/empty.xml" />
+            <map:transform src="module:///../../../../xslt/exception/document-does-not-exist.xsl">
+              <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+            </map:transform>
+            <map:call resource="style-cms-page">
+              <map:parameter name="statusCode" value="404"/>
+            </map:call>
+          </map:when>
+      <map:otherwise>
+        <map:generate type="notifying"/>
+        <map:transform src="module:///../../../../../stylesheets/system/error2html.xslt">
+          <map:parameter name="contextPath" value="{request:contextPath}"/>
+        </map:transform>
+      </map:otherwise>
+        </map:select>
+        <map:serialize type="xhtml"/>
+      </map:handle-errors>
+      
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml Sun Jun 11 16:24:48 2006
@@ -0,0 +1,6 @@
+<module id="authoring" name="Authoring">
+<version>1.3</version>
+<content>Hierarchical</content>
+<description>This is the Lenya 1.2 authoring code moved to a Module.  It only supports the Hierarchical Content.</description>
+<usage></usage>
+</module>
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap Sun Jun 11 16:24:48 2006
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Cache Module -->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:views>
+    <map:view name="debug" from-label="debug">
+       <map:serialize type="xml"/>
+    </map:view> 
+  </map:views>
+
+<!-- ************************************************************** -->
+   <map:pipelines>
+      <map:pipeline type="noncaching">
+      <map:match pattern="*/**">
+         <!-- Has querystring? -->
+            <map:select type="parameter">
+               <map:parameter name="parameter-selector-test" value="{request:queryString}"/>
+               <map:when test="">
+               </map:when>
+               <map:otherwise>
+        <map:generate src="cocoon://{page-envelope:publication-id}/{1}/cocoon/{1}/{2}"/>
+        <map:serialize type="html"/>
+               </map:otherwise>
+            </map:select>
+            <!-- Is visitor logged in? -->
+            <map:select type="parameter">
+               <map:parameter name="parameter-selector-test" value="{access-control:user-id}"/>
+               <map:when test="">
+               </map:when>
+               <map:otherwise>
+                  <!-- Add individual caching? -->
+        <map:generate src="cocoon://{page-envelope:publication-id}/{1}/cocoon/{1}/{2}"/>
+        <map:serialize type="html"/>
+               </map:otherwise>
+            </map:select>
+            <!-- Check Cache -->
+            <map:select type="resource-exists">
+              <map:when test="{module:cache-dir}/{1}/{2}">
+                 <map:read src="{module:cache-dir}/{1}/{2}" mime-type="text/html"/>
+              </map:when>
+            </map:select>
+            <!-- Else Cache -->
+               <map:generate src="cocoon://{page-envelope:publication-id}/{1}/cocoon/{1}/{2}"/>
+               <map:transform src="module:///../../../../xslt/authoring/edit/addSourceTags.xsl">
+                  <map:parameter name="source" value="{module:cache-dir}/{1}/{2}"/>
+               </map:transform>
+               <map:transform type="write-source">
+                  <map:parameter name="serializer" value="html-no-dtd"/>
+               </map:transform>
+               <map:transform src="module:///../../../../xslt/authoring/edit/removeSourceTags.xsl"/>
+               <map:serialize type="html"/>
+         </map:match>
+      </map:pipeline>
+   </map:pipelines>
+</map:sitemap>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml Sun Jun 11 16:24:48 2006
@@ -0,0 +1,7 @@
+<module id="cache" name="Cache">
+<version>1.3</version>
+<content>All</content>
+<description>Handles smart caching of Resources.</description>
+<usage></usage>
+<parameter name="cache-dir">module:///work/</parameter>
+</module>
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cdir.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cdir.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cdir.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cdir.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:dir="http://apache.org/cocoon/directory/2.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+
+<xsl:param name="area" select="live"/>
+
+<xsl:template match="/dir:directory" priority="3">
+<files>
+<xsl:apply-templates select="dir:directory"/>
+</files>
+</xsl:template>
+
+<xsl:template match="dir:directory">
+   <xsl:param name="path" select="''"/>
+   <xsl:apply-templates select="dir:file">
+      <xsl:with-param name="path" select="concat($path, '/', @name)"/>
+   </xsl:apply-templates>
+   <xsl:apply-templates select="dir:directory">
+      <xsl:with-param name="path" select="concat($path, '/', @name)"/>
+   </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="dir:file[contains(@name, '_')]">
+<xsl:param name="path" select="''"/>
+<xsl:element name="file">
+<xsl:attribute name="idl"><xsl:value-of select="$path"/>_<xsl:value-of select="substring-before(substring-after(@name, '_'), '.')"/></xsl:attribute>
+<xsl:attribute name="filename"><xsl:value-of select="$path"/>/<xsl:value-of select="@name"/></xsl:attribute>
+<xsl:attribute name="time"><xsl:value-of select="@lastModified"/></xsl:attribute>
+</xsl:element>
+</xsl:template>
+
+
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cdir.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cmerge.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cmerge.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cmerge.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cmerge.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    >
+
+<xsl:template match="/content">
+<xsl:apply-templates select="pages"/>
+</xsl:template>
+
+<xsl:template match="pages">
+<resources>
+<xsl:apply-templates select="page"/>
+</resources>
+</xsl:template>
+
+<xsl:template match="page">
+<xsl:variable name="idl"><xsl:value-of select="@idl"/></xsl:variable>
+<xsl:variable name="href"><xsl:value-of select="@href"/></xsl:variable>
+<xsl:element name="resource">
+<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
+<xsl:attribute name="idl"><xsl:value-of select="@idl"/></xsl:attribute>
+<xsl:attribute name="language"><xsl:value-of select="@language"/></xsl:attribute>
+<xsl:attribute name="visible"><xsl:value-of select="@visible"/></xsl:attribute>
+<xsl:attribute name="navtitle"><xsl:value-of select="@navtitle"/></xsl:attribute>
+<xsl:attribute name="navtitle"><xsl:value-of select="@navtitle"/></xsl:attribute>
+<xsl:attribute name="area"><xsl:value-of select="@area"/></xsl:attribute>
+<xsl:attribute name="position"><xsl:value-of select="@position"/></xsl:attribute>
+<xsl:choose>
+<xsl:when test="$href = ''">
+<xsl:attribute name="type">xml</xsl:attribute>
+<xsl:attribute name="filename">content/<xsl:value-of select="@area"/><xsl:value-of select="/content/files/file[@idl=$idl]/@filename"/></xsl:attribute>
+<xsl:attribute name="time"><xsl:value-of select="/content/files/file[@idl=$idl]/@time"/></xsl:attribute>
+</xsl:when>
+<xsl:otherwise>
+<xsl:attribute name="type">link</xsl:attribute>
+<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:element>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-1">
+</xsl:template>
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/cmerge.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/code.js
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/code.js?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/code.js (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/code.js Sun Jun 11 16:24:48 2006
@@ -0,0 +1,381 @@
+var PublicationDirectory;
+var ContentDirectoryNew;
+var ResourcesDirectory;
+var RelationsDirectory;
+
+function init(){
+//Inconsistent directories.
+//Java assumes lenya installation root.
+//JS assumes module directory, which changes whether in Publication or global.
+//Use absolute paths for everything except module code (Use module: protocol).
+   var publication = cocoon.parameters.publication;
+   var module = cocoon.parameters.module;
+   var file = new Packages.java.io.File("");
+   PublicationDirectory = file.getAbsolutePath() + "/build/lenya/webapp/lenya/pubs/" + publication + "/";
+   ContentDirectoryNew = PublicationDirectory + "content/";
+   ResourcesDirectory = ContentDirectoryNew + "resource/";
+   RelationsDirectory = ContentDirectoryNew + "relation/";
+}
+
+var incremental = false;
+
+function migrate() {
+   init();
+   var resource;
+   var resourcedoc;
+   var resourceroot;
+   var translations;
+   var translationslength;
+   var translation;
+   var translationdoc;
+   var translationroot;
+   var files;
+   var fileslength;
+   var file;
+   var filedoc;
+   var fileroot;
+   var oldfilename;
+   var indexes;
+   var indexeslength;
+   var index;
+   var indexdoc;
+   var indexroot;
+   var fullid;
+   var pos;  //temporary variable for String manipulation
+   var id;
+   var unid;
+   var parentid;
+   var parentunid;
+   var position;
+   var resourcetabledoc;
+   var resourcetableroot;
+   var resourcetableentry;
+   var type;
+   var extension;
+   var id2unid = new Packages.java.util.HashMap();
+   var homeunid = "0001";
+   var nextunid = 1;
+   var unidformatter = new Packages.java.text.DecimalFormat("0000");
+   var dom = loadDocument("cocoon:/all");
+   var root = dom.getDocumentElement();
+   var resources = root.getElementsByTagName("resource");
+   var resourceslength = resources.getLength();
+   if(0 < resourceslength){
+      resource = resources.item(0);
+      homeunid = resource.getAttribute("unid");
+   }
+   // Load Relations - BEGIN
+   var testfile = new Packages.java.io.File(ContentDirectoryNew + "relations.xml");
+   if(testfile.exists()) incremental = true;
+   resourcetabledoc = createDocument("relations", ContentDirectoryNew + "relations.xml");
+   resourcetableroot = resourcetabledoc.getDocumentElement();
+   if(resourcetableroot.hasAttribute("home")) homeunid = resourcetableroot.getAttribute("home");
+   if(resourcetableroot.hasAttribute("next")) 
+         nextunid = Packages.java.lang.Integer.parseInt(resourcetableroot.getAttribute("next"));
+   var resourcetableentries = resourcetableroot.getElementsByTagName("resource");
+   var resourcetablelength = resourcetableentries.getLength();
+   for(var x = 0; x < resourcetablelength; x++){
+      resourcetableentry = resourcetableentries.item(x);
+      unid = resourcetableentry.getAttribute("unid");
+      fullid = resourcetableentry.getAttribute("full");
+      id2unid.put(fullid, unid);
+   }
+   // Load Relations - END
+   // Reset Relations XML
+   resourcetabledoc = Packages.org.apache.lenya.xml.DocumentHelper.createDocument("", "relations", null);
+   resourcetableroot = resourcetabledoc.getDocumentElement();
+   addComment(resourcetabledoc, resourcetableroot, " ### This is a temporary file created by the migration process for Lenya 1.2 publications to Lenya 1.3 flat storage.  Do not use this file for any functions.  It may be deleted after the conversion has been tested. ### ");
+print("*** Resources ***");
+
+// ### Resources ###
+   for(var r = 0; r < resourceslength; r++){
+      // Resource
+      resource = resources.item(r);
+      fullid = resource.getAttribute("id");
+      if(incremental){
+         unid = id2unid.get(fullid);
+         if(unid == null || unid.length() < 1){
+            unid = unidformatter.format(nextunid);
+            nextunid++;
+         }
+      }else{
+         if(resource.hasAttribute("unid")){
+            unid = resource.getAttribute("unid");
+            id2unid.put(fullid, unid);
+         }else{
+            unid = unidformatter.format(nextunid);
+            nextunid++;
+            incremental = true;
+         }
+      }
+      resourcedoc = createDocument("resource", ResourcesDirectory + unid + resource.getAttribute("filename"));
+      resourceroot = resourcedoc.getDocumentElement();
+
+      resourceroot.setAttribute("unid", unid);
+      position = resource.getAttribute("position");
+      pos = fullid.lastIndexOf("/");
+      id = fullid.substring(pos + 1);
+      // Extension - BEGIN
+      extension = "";
+      pos = id.lastIndexOf(".");
+      if(pos > 0) extension = id.substring(pos + 1);
+// WORKAROUND: BUG with JS String.length.  If length > 0 returns function code rather than number.
+      var hasExtension = (extension.length == 0 ? false : true);
+      // Extension - END
+      pos = fullid.lastIndexOf("/" + id);
+      parentid = fullid.substring(0, pos);
+      //Translate ID to UNID.
+      parentunid = id2unid.get(parentid);
+      if(parentunid == null || parentunid.length() < 1) parentunid = "";
+      resourceroot.setAttribute("id", id);
+      type = resource.getAttribute("type")
+      resourceroot.setAttribute("type", type);
+      resourceroot.setAttribute("defaultlanguage", "en");
+      if(resource.hasAttribute("doctype")) resourceroot.setAttribute("doctype", resource.getAttribute("doctype"));
+      //Indexes
+      indexes = resource.getElementsByTagName("index");
+      indexeslength = indexes.getLength();
+      for(var i = 0; i < indexeslength; i++){
+         //Index
+         index = indexes.item(i);
+         resourcetableentry = addElement(resourcetabledoc, resourcetableroot, "resource");
+         resourcetableentry.setAttribute("structure", index.getAttribute("name"));
+         resourcetableentry.setAttribute("parent", parentunid);
+         resourcetableentry.setAttribute("unid", unid);
+         resourcetableentry.setAttribute("position", index.getAttribute("position"));
+         resourcetableentry.setAttribute("full", fullid);
+         resourcetableentry.setAttribute("id", id);
+      }
+//Translations
+      translations = resource.getElementsByTagName("translation");
+      translationslength = translations.getLength();
+      for(var t = 0; t < translationslength; t++){
+//Translation
+         translation = translations.item(t);
+         translationdoc = createDocument("translation", ResourcesDirectory + unid + translation.getAttribute("filename"));
+         translationroot = translationdoc.getDocumentElement();
+         translationroot.setAttribute("language", translation.getAttribute("language"));
+         translationroot.setAttribute("edit", translation.getAttribute("edit"));
+         translationroot.setAttribute("live", translation.getAttribute("live"));
+//DESIGN: Added <Translation language="xx">.  Repeats information from directory structure (extra maintenance).
+//         var element = addElement(resourcedoc, resourceroot, "translation");
+//         element.setAttribute("language", translation.getAttribute("language"));
+//Files
+         files = translation.getElementsByTagName("file");
+         fileslength = files.getLength();
+         for(var f = 0; f < fileslength; f++){
+//File
+            file = files.item(f);
+            oldfilename = file.getAttribute("oldfilename");
+            if(oldfilename.length() > 0){
+               filedoc = loadDocument(PublicationDirectory + oldfilename);
+            }else{
+                filedoc = createDocument(resource.getAttribute("type"), 
+                      ResourcesDirectory + unid + file.getAttribute("filename"));
+            }
+            fileroot = filedoc.getDocumentElement();
+            if(file.hasAttribute("navtitle")){
+               fileroot.setAttribute("title", file.getAttribute("navtitle"));
+            }else{
+               var titles = fileroot.getElementsByTagName("title");
+               if(titles.getLength() > 0){
+                  fileroot.setAttribute("title", getText(titles.item(0)));
+               }else{
+                  titles = fileroot.getElementsByTagNameNS("*", "title");
+                  if(titles.getLength() > 0){
+                     fileroot.setAttribute("title", getText(titles.item(0)));
+                  }else{
+                    fileroot.setAttribute("title", id);
+                  }
+               }
+            }
+            if(file.hasAttribute("href")) fileroot.setAttribute("href", file.getAttribute("href"));
+            if(hasExtension) fileroot.setAttribute("extension", extension);
+            writeDocument(filedoc, ResourcesDirectory + unid + file.getAttribute("filename"));
+            if(file.hasAttribute("binaryfilenameold")){
+               //Copy binaryfilenameold to binaryfilenamenew
+               copyfile(PublicationDirectory + file.getAttribute("binaryfilenameold"),
+                     ResourcesDirectory + unid + file.getAttribute("binaryfilenamenew"));
+            }
+         }
+         writeDocument(translationdoc, ResourcesDirectory + unid + translation.getAttribute("filename"));
+      }
+      writeDocument(resourcedoc, ResourcesDirectory + unid + resource.getAttribute("filename"));
+      if(!incremental){
+         nextunid = 1 + Packages.java.lang.Integer.parseInt(unid);
+      }
+   }
+   resourcetableroot.setAttribute("home", homeunid);
+   resourcetableroot.setAttribute("next", nextunid);
+   writeDocument(resourcetabledoc, ContentDirectoryNew + "relations.xml");
+   //### SPLIT RELATIONS BY STRUCTURE ###
+   var dom = loadDocument("cocoon:/structures");
+   var root = dom.getDocumentElement();
+   var structures = root.getElementsByTagName("structure");
+   var structurelength = structures.getLength();
+   // Use module: protocol to get XSLT
+   var resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
+   var xslsource = resolver.resolveURI("module:///structure2.xsl");
+   var stylesheet = new Packages.javax.xml.transform.stream.StreamSource(xslsource.getURI());
+   for(var i = 0; i < structurelength; i++){
+      var structure = structures.item(i);
+      var structureName = structure.getAttribute("name");
+      var newDoc = Packages.org.apache.lenya.xml.DocumentHelper.createDocument("", "resources", null);
+      var newRoot = newDoc.getDocumentElement();
+      newRoot.setAttribute("name", structureName);
+      var resources = structure.getElementsByTagName("resource");
+      var resourceslength = resources.getLength();
+      for(var r = 0; r < resourceslength; r++){
+         var resource = resources.item(r);
+            var newResource = addElement(newDoc, newRoot, "resource");
+            copyAttributes(resource, newResource);
+      }
+      // Transform
+      var factory = Packages.javax.xml.transform.TransformerFactory.newInstance();
+      var transformer = factory.newTransformer(stylesheet);
+      var source = new Packages.javax.xml.transform.dom.DOMSource(newDoc);
+      var newDoc2 = Packages.org.apache.lenya.xml.DocumentHelper.createDocument("", "resources", null);
+      var resultFile = new Packages.java.io.File(RelationsDirectory + structureName + ".xml");
+      createNewFile(resultFile);
+      var result = new Packages.javax.xml.transform.stream.StreamResult(resultFile);
+      transformer.transform(source, result);
+   }
+   //### Copy Indexes
+   var isource = resolver.resolveURI("module:///index");
+   var oldindexdirectoryURI = new Packages.java.net.URI(isource.getURI());
+   var oldindexdirectory = new Packages.java.io.File(oldindexdirectoryURI);
+   var newindexdirectory = new Packages.java.io.File(ContentDirectoryNew, "index");
+   if(!newindexdirectory.exists()){
+      newindexdirectory.mkdirs();
+   }
+   var indexfilenames = oldindexdirectory.list();
+   var indexfilenameslength = indexfilenames.length;
+   for(var f = 0; f < indexfilenameslength; f++){
+      var filename = indexfilenames[f];
+      var newfile = new Packages.java.io.File(newindexdirectory, filename);
+      if(!newfile.exists()){
+         var oldfile = new Packages.java.io.File(oldindexdirectory, filename);
+         copyfile(oldfile.getAbsolutePath(), newfile.getAbsolutePath());
+      }
+   }
+   //### Return
+   cocoon.sendPage("finish");
+}
+
+function createNewFile(file){
+   file.getParentFile().mkdirs();
+   file.createNewFile();
+}
+
+function copyAttributes(srcElement, dstElement){
+   var attrList = srcElement.getAttributes();
+   for(var a = 0; a < attrList.getLength(); a++){
+      var attributeName = attrList.item(a).getNodeName();
+      dstElement.setAttribute(attributeName, srcElement.getAttribute(attributeName));
+   }
+}
+
+function copyfile(srcFilename, dstFilename){
+   var src = new Packages.java.io.File(srcFilename);
+   var dst = new Packages.java.io.File(dstFilename);
+   var sin = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(src));
+   var sout = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(dst));
+   var sbuf = sin.read();
+   while (sbuf != -1){
+     sout.write(sbuf);
+     sbuf = sin.read();
+   }
+   sin.close();
+   sout.close();
+}
+
+function printElement(element){
+   print("ELEMENT: " + element.getLocalName());
+   var attributes = element.getAttributes();
+   var alen = attributes.getLength();
+   for(var a = 0; a < alen; a++){
+      print(attributes.item(a).getNodeName() + ": " + attributes.item(a).getNodeValue());
+   }
+}
+
+function getText(node){
+   var text = "";
+   if(node.getFirstChild() != null) text = node.getFirstChild().getNodeValue();
+   return text;
+}
+
+function getFieldText(node, fieldname){
+   var text = "";
+   if(node.getElementsByTagName(fieldname).item(0)) text = getText(node.getElementsByTagName(fieldname).item(0));
+   return text;
+}
+
+function addElement(document, parent, newElementName){
+   var newElement = document.createElement(newElementName);
+   parent.appendChild(newElement);
+   return newElement;
+}
+function addComment(document, parent, comment){
+   var newComment = document.createComment(comment);
+   parent.appendChild(newComment);
+   return newComment;
+}
+
+function writeDocument(document, filename){
+   var file = new Packages.java.io.File(filename);
+   Packages.org.apache.lenya.xml.DocumentHelper.writeDocument(document, file);
+}
+
+function createDocument(rootnode, filename) {
+   if(incremental){
+      var testfile = new Packages.java.io.File(filename);
+      if(testfile.exists()) if(testfile.canRead()){
+         return loadDocument(filename);
+      }
+   }
+   return Packages.org.apache.lenya.xml.DocumentHelper.createDocument("", rootnode, null);
+}
+
+/**
+ * loadDocument() reads in an XML file and returns a DOM Document.
+**/
+function loadDocument(uri) {
+  var parser = null;
+  var source = null;
+  var resolver = null;
+  try {
+      parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
+      resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
+      source = resolver.resolveURI(uri);
+      var is = new Packages.org.xml.sax.InputSource(source.getInputStream());
+      is.setSystemId(source.getURI());
+      return parser.parseDocument(is);
+  } finally {
+      if (source != null) resolver.release(source);
+      if (parser != null) cocoon.releaseComponent(parser);
+      if (resolver != null) cocoon.releaseComponent(resolver);
+  }
+}
+
+
+function createfile(filename, content) {
+   var fileOutputStream = new Packages.java.io.FileOutputStream(ContentDirectoryNew + filename, true);
+   //## ADD DATA TO FILE
+   toFile(fileOutputStream, content);
+   //## CLOSE FILE
+   fileOutputStream.close();
+}
+
+function toFile( fileOutputStream, pString){
+   if(pString != null){
+      var tmpString = Packages.java.lang.String(pString);   
+      var bs = tmpString.getBytes("UTF-8");
+      var bc = 0;
+      var ch = bs[bc];
+      while((bc < bs.length)){
+         fileOutputStream.write(ch);
+         bc += 1;
+         ch = bs[bc];
+      }
+   }
+}

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/code.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/combine.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/combine.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/combine.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/combine.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    >
+<!-- Combine resources. -->
+
+<xsl:template match="/content">
+<resources>
+<xsl:apply-templates select="resources"/>
+</resources>
+</xsl:template>
+
+<xsl:template match="resources">
+<xsl:apply-templates select="resource"></xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="resource">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()" mode="resource"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="resource">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()" mode="resource"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-1"/>
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/combine.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content.xml?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content.xml (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content.xml Sun Jun 11 16:24:48 2006
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<content xmlns:cinclude="http://apache.org/cocoon/include/1.0">
+<cinclude:include src="cocoon:/carea/live"/>
+<cinclude:include src="cocoon:/carea/authoring"/>
+</content>
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content2.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content2.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content2.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content2.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    >
+<!-- Group into flat structure -->
+
+<xsl:key name="ids" match="resource" use="@id" />
+<xsl:key name="idls" match="resource" use="@idl" />
+
+<xsl:template match="/resources">
+<content>
+<xsl:for-each select="resource[generate-id() = generate-id(key('ids', @id)[1])]">
+    <xsl:sort select="@id" />
+<resource id="{@id}" type="{@type}">
+    <xsl:for-each select="key('ids', @id)[generate-id() = generate-id(key('idls', @idl)[1])]">
+      <xsl:element name="translation">
+      <xsl:attribute name="language"><xsl:value-of select="@language"/></xsl:attribute>
+    <xsl:for-each select="key('idls', @idl)">
+         <file>
+         <xsl:apply-templates select="@*|node()" mode="resource"/>
+         </file>
+    </xsl:for-each>
+
+       </xsl:element>
+    </xsl:for-each>
+</resource>
+  </xsl:for-each>
+</content>
+</xsl:template>
+
+<xsl:template match="@type" mode="resource"/>
+<xsl:template match="@id" mode="resource"/>
+<xsl:template match="@idl" mode="resource"/>
+
+<xsl:template match="resource">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()" mode="resource"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="resource">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()" mode="resource"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|node()" priority="-1"/>
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content2.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    >
+<!-- Add attributes and index fields. Cleanup.  -->
+
+<xsl:template match="/content">
+  <xsl:copy>
+<xsl:apply-templates/>
+<!--
+<xsl:apply-templates select="@*"/>
+   <xsl:apply-templates select="resource[@id='/index']"/>
+   <xsl:apply-templates select="resource[@id!='/index']"/>
+-->
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="resource">
+<xsl:variable name="unid"><xsl:value-of select="format-number(position(), '0000')"/></xsl:variable>
+  <xsl:copy><xsl:apply-templates select="@id"/><xsl:apply-templates select="@*"/>
+<xsl:attribute name="unid"><xsl:value-of select="$unid"/></xsl:attribute>
+<xsl:attribute name="filename">/resource.xml</xsl:attribute>
+<xsl:choose>
+<xsl:when test="@id='/index'"><xsl:attribute name="doctype">homepage</xsl:attribute></xsl:when>
+<xsl:when test="@type='xml'"><xsl:attribute name="doctype">xhtml</xsl:attribute></xsl:when>
+</xsl:choose>
+
+<xsl:for-each select="translation/file">
+<xsl:element name="index">
+<xsl:attribute name="name"><xsl:value-of select="@area"/></xsl:attribute>
+<xsl:attribute name="position"><xsl:value-of select="@position"/></xsl:attribute>
+</xsl:element>
+<xsl:if test="@visible='true'">
+<xsl:element name="index">
+<xsl:attribute name="name"><xsl:value-of select="@area"/>menu</xsl:attribute>
+<xsl:attribute name="position"><xsl:value-of select="@position"/></xsl:attribute>
+</xsl:element>
+</xsl:if>
+</xsl:for-each>
+        <xsl:apply-templates select="translation"/>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="translation">
+<xsl:variable name="editf"><xsl:value-of select="file[@area='authoring']/@time"/></xsl:variable>
+<xsl:variable name="edit"><xsl:choose>
+   <xsl:when test="string-length($editf) &gt; 0"><xsl:value-of select="$editf"/></xsl:when>
+   <xsl:otherwise></xsl:otherwise>
+</xsl:choose></xsl:variable>
+
+<xsl:variable name="livef"><xsl:value-of select="file[@area='live']/@time"/></xsl:variable>
+<xsl:variable name="live"><xsl:choose>
+   <xsl:when test="string-length($livef) &gt; 0"><xsl:value-of select="$livef"/></xsl:when>
+   <xsl:otherwise>1</xsl:otherwise>
+</xsl:choose></xsl:variable>
+
+  <xsl:copy><xsl:apply-templates select="@*"/>
+<xsl:attribute name="filename">/<xsl:value-of select="@language"/>/translation.xml</xsl:attribute>
+<xsl:attribute name="edit"><xsl:value-of select="$edit"/></xsl:attribute>
+<xsl:attribute name="live"><xsl:value-of select="$live"/></xsl:attribute>
+        <xsl:apply-templates select="file"/>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="file">
+  <xsl:copy>
+<xsl:apply-templates select="@*"/>
+<xsl:attribute name="oldfilename"><xsl:value-of select="@filename"/></xsl:attribute>
+<xsl:attribute name="filename">/<xsl:value-of select="@language"/>/<xsl:choose>
+<xsl:when test="@time"><xsl:value-of select="@time"/></xsl:when>
+<xsl:otherwise>1</xsl:otherwise>
+</xsl:choose>.xml</xsl:attribute>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="file/@area"/>
+<xsl:template match="file/@filename"/>
+<xsl:template match="file/@language"/>
+<xsl:template match="file/@time"/>
+<xsl:template match="file/@visible"/>
+<xsl:template match="file/@position"/>
+
+<xsl:template match="@*|node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content4.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content4.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content4.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content4.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    >
+<!-- Sort id="/index" first. -->
+<!-- Sort and Unique "index" elements.   -->
+
+<xsl:key name="uniqueIndex" match="index" use="concat(../@unid, @name)"/>
+<xsl:template match="/content">
+<resources>
+   <xsl:apply-templates select="@*"/>
+   <xsl:apply-templates select="resource[@id='/index']"/>
+   <xsl:apply-templates select="resource[@id!='/index']"/>
+</resources>
+</xsl:template>
+
+<xsl:template match="resource">
+<xsl:copy>
+   <xsl:apply-templates select="@*"/>
+   <xsl:choose>
+      <xsl:when test="@id='/index'">
+         <!-- Homepage Indexes -->
+<index name="authoring" position="1"/>
+<index name="homepage" position="1"/>
+<index name="live" position="1"/>
+      </xsl:when>
+      <xsl:otherwise>
+         <xsl:apply-templates select="index"><xsl:sort select="@name"/></xsl:apply-templates>
+      </xsl:otherwise>
+   </xsl:choose>
+   <xsl:apply-templates select="*[local-name() != 'index']"/>
+</xsl:copy>
+</xsl:template>
+
+<xsl:template match="index">
+<xsl:if test="generate-id()=generate-id(key('uniqueIndex', concat(../@unid, @name)))">
+<xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+</xsl:copy>
+</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="@*|node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content4.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/csitetree.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/csitetree.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/csitetree.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/csitetree.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:tree="http://apache.org/cocoon/lenya/sitetree/1.0"
+>
+<xsl:param name="area" select="live"/>
+
+<xsl:template match="tree:site">
+<pages>
+<xsl:apply-templates select="tree:node"/>
+</pages>
+</xsl:template>
+
+<xsl:template match="tree:node">
+   <xsl:param name="path" select="''"/>
+   <xsl:variable name="pos"><xsl:number count="//tree:node" level="any"/></xsl:variable>
+   <xsl:apply-templates select="tree:label">
+      <xsl:with-param name="path" select="concat($path, '/', @id)"/>
+      <xsl:with-param name="visible" select="@visibleinnav"/>
+      <xsl:with-param name="href" select="@href"/>
+      <xsl:with-param name="pos" select="$pos"/>
+   </xsl:apply-templates>
+   <xsl:apply-templates select="tree:node">
+      <xsl:with-param name="path" select="concat($path, '/', @id)"/>
+   </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="tree:label">
+  <xsl:param name="path" select="''"/>
+  <xsl:param name="visible" select="''"/>
+  <xsl:param name="href" select="''"/>
+  <xsl:param name="pos" select="1"/>
+<xsl:element name="page">
+<xsl:attribute name="position"><xsl:value-of select="$pos"/></xsl:attribute>
+<xsl:attribute name="area"><xsl:value-of select="$area"/></xsl:attribute>
+<xsl:attribute name="language"><xsl:value-of select="@xml:lang"/></xsl:attribute>
+<xsl:attribute name="id"><xsl:value-of select="$path"/></xsl:attribute>
+<xsl:attribute name="idl"><xsl:value-of select="$path"/>_<xsl:value-of select="@xml:lang"/></xsl:attribute>
+<xsl:attribute name="visible"><xsl:value-of select="$visible"/></xsl:attribute>
+<xsl:attribute name="navtitle"><xsl:value-of select="."/></xsl:attribute>
+<xsl:if test="$href">
+<xsl:attribute name="href"><xsl:value-of select="$href"/></xsl:attribute>
+</xsl:if>
+</xsl:element>
+</xsl:template>
+   
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/csitetree.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/done.html
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/done.html?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/done.html (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/done.html Sun Jun 11 16:24:48 2006
@@ -0,0 +1,9 @@
+<HTML>
+<HEAD>
+<TITLE>Migration to Flat Datastore</TITLE>
+</HEAD>
+<BODY>
+<H1>Migration to Flat Datastore</H1>
+Completed.
+</BODY>
+</HTML>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/done.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/all.xconf
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/all.xconf?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/all.xconf (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/all.xconf Sun Jun 11 16:24:48 2006
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<index/>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/all.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/assets.xconf
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/assets.xconf?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/assets.xconf (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/assets.xconf Sun Jun 11 16:24:48 2006
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<index>
+<filter property="type">file</filter>
+</index>
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/assets.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/edit.xconf
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/edit.xconf?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/edit.xconf (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/edit.xconf Sun Jun 11 16:24:48 2006
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<index structure="authoring" revision="edit"/>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/edit.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/editmenu.xconf
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/editmenu.xconf?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/editmenu.xconf (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/editmenu.xconf Sun Jun 11 16:24:48 2006
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<index structure="authoringmenu" revision="edit"/>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/editmenu.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/live.xconf
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/live.xconf?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/live.xconf (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/live.xconf Sun Jun 11 16:24:48 2006
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<index structure="live"/>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/live.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/livemenu.xconf
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/livemenu.xconf?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/livemenu.xconf (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/livemenu.xconf Sun Jun 11 16:24:48 2006
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<index structure="livemenu">
+<filter property="type">xml</filter>
+<filter property="doctype">xhtml|link</filter>
+</index>
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/index/livemenu.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap Sun Jun 11 16:24:48 2006
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:flow language="javascript">
+     <map:script src="module:///code.js"/>
+  </map:flow>
+
+  <map:pipelines>
+    <map:pipeline type="noncaching">
+
+      <map:match pattern="**">
+<!-- Content BEGIN -->
+        <map:match pattern="site/*">
+          <map:generate src="module:///../../content/{1}/sitetree.xml"/>
+          <map:transform src="module:///csitetree.xsl">
+            <map:parameter name="area" value="{1}"/>
+          </map:transform>
+          <!-- pages/page/title,path,language -->
+          <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="cfiles/*">
+          <map:generate type="directory" src="module:///../../content/{1}">
+            <map:parameter name="depth" value="99"/>
+          </map:generate>
+          <!-- Mess of all files -->
+          <map:transform src="module:///cdir.xsl">
+            <map:parameter name="area" value="{1}"/>
+          </map:transform>
+          <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="carea/*">
+          <map:aggregate element="content">
+            <map:part src="cocoon:/site/{1}"/>
+            <map:part src="cocoon:/cfiles/{1}"/>
+          </map:aggregate>
+          <map:transform src="module:///cmerge.xsl"/>
+          <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="cinfo">
+           <map:generate src="module:///content.xml"/>
+           <map:transform type="cinclude"/>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="content">
+           <map:generate src="cocoon:/cinfo"/>
+           <map:transform src="module:///combine.xsl"/>
+           <map:transform src="module:///content2.xsl"/>
+           <map:transform src="module:///content3.xsl"/>
+           <map:transform src="module:///content4.xsl"/>
+           <map:serialize type="xml"/>
+        </map:match>
+<!-- Content END -->
+<!-- Resources BEGIN -->
+        <map:match pattern="rfiles/*">
+          <map:act type="resource-exists" src="module:///../../resources/{1}">
+            <map:generate type="directory" src="module:///../../resources/{../1}">
+               <map:parameter name="depth" value="99"/>
+             </map:generate>
+             <!-- Mess of all files -->
+             <map:transform src="module:///rdir.xsl">
+               <map:parameter name="area" value="{../1}"/>
+             </map:transform>
+             <map:serialize type="xml"/>
+             </map:act>
+            <map:generate src="module:///../../../../content/util/empty.xml"/>
+            <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="rinfo">
+           <map:generate src="module:///resources.xml"/>
+           <map:transform type="cinclude"/>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="resources">
+           <map:generate src="cocoon:/rinfo"/>
+           <map:transform src="module:///combine.xsl"/>
+           <map:transform src="module:///resources2.xsl"/>
+           <map:transform src="module:///resources3.xsl"/>
+           <map:serialize type="xml"/>
+        </map:match>
+<!-- Resources END -->
+        <map:match pattern="all">
+          <map:aggregate element="content">
+            <map:part src="cocoon:/content"/>
+            <map:part src="cocoon:/resources"/>
+          </map:aggregate>
+           <map:transform src="module:///combine.xsl"/>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="structures">
+           <map:generate src="module:///../../content/relations.xml"/>
+           <map:transform src="module:///structure.xsl"/>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="finish">
+           <map:generate type="html" src="module:///done.html"/>
+           <map:serialize type="html"/>
+        </map:match>
+<!-- Migrate Entry Point -->
+        <map:match pattern="*/migrate">
+           <map:call function="migrate">
+             <map:parameter name="publication" value="{page-envelope:publication-id}"/>
+             <map:parameter name="module" value="{module:module}"/>
+           </map:call>
+        </map:match>
+<!-- TEST -->
+        <map:match pattern="*/testr1">
+            <map:generate type="directory" src="module:///../../resources/live">
+               <map:parameter name="depth" value="99"/>
+             </map:generate>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="*/testr2">
+            <map:generate src="cocoon:/rfiles/live"/>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="*/testc1">
+          <map:generate type="directory" src="module:///../../content/live">
+            <map:parameter name="depth" value="99"/>
+          </map:generate>
+           <map:serialize type="xml"/>
+        </map:match>
+        <map:match pattern="*/testc2">
+            <map:generate src="cocoon:/cfiles/live"/>
+           <map:serialize type="xml"/>
+        </map:match>
+<!-- Default (Tests most XML generation) -->
+           <map:generate src="cocoon:/all"/>
+           <map:serialize type="xml"/>
+     </map:match>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/rdir.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/rdir.xsl?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/rdir.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/rdir.xsl Sun Jun 11 16:24:48 2006
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:dir="http://apache.org/cocoon/directory/2.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+
+<xsl:param name="area" select="live"/>
+
+<xsl:template match="/dir:directory" priority="3">
+<resources>
+<xsl:apply-templates select="dir:directory"/>
+</resources>
+</xsl:template>
+
+<xsl:template match="dir:directory">
+   <xsl:param name="path" select="''"/>
+   <xsl:apply-templates select="dir:file[@name = concat(substring-before(@name, '.meta'), '.meta')]">
+      <xsl:with-param name="path" select="concat($path, '/', @name)"/>
+   </xsl:apply-templates>
+   <xsl:apply-templates select="dir:directory">
+      <xsl:with-param name="path" select="concat($path, '/', @name)"/>
+   </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="dir:file">
+<xsl:param name="path" select="''"/>
+<xsl:variable name="name"><xsl:value-of select="substring-before(@name, '.meta')"/></xsl:variable>
+<xsl:element name="resource">
+<xsl:attribute name="area"><xsl:value-of select="$area"/></xsl:attribute>
+<xsl:attribute name="type">file</xsl:attribute>
+<xsl:attribute name="id"><xsl:value-of select="$path"/>/<xsl:value-of select="$name"/></xsl:attribute>
+<xsl:attribute name="filename">resources/<xsl:value-of select="$area"/><xsl:value-of select="$path"/>/<xsl:value-of select="$name"/></xsl:attribute>
+<xsl:attribute name="metafilename">resources/<xsl:value-of select="$area"/><xsl:value-of select="$path"/>/<xsl:value-of select="@name"/></xsl:attribute>
+<xsl:attribute name="time"><xsl:value-of select="@lastModified"/></xsl:attribute>
+</xsl:element>
+</xsl:template>
+
+</xsl:stylesheet> 
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/rdir.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources.xml?rev=413547&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources.xml (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources.xml Sun Jun 11 16:24:48 2006
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<content xmlns:cinclude="http://apache.org/cocoon/include/1.0">
+<cinclude:include src="cocoon:/rfiles/live"/>
+<cinclude:include src="cocoon:/rfiles/authoring"/>
+</content>
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources.xml
------------------------------------------------------------------------------
    svn:eol-style = native



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