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/27 21:38:45 UTC

svn commit: r417568 - 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/impl/ src/java/org/apache/lenya/cms/content/ src/java/org/apache/lenya/c...

Author: solprovider
Date: Tue Jun 27 12:38:44 2006
New Revision: 417568

URL: http://svn.apache.org/viewvc?rev=417568&view=rev
Log:
Working on the Link ResourceType Module, I kept finding bugs in Cocoon2.1.6, so I reinstalled/reorganized my development system with Cocoon2.1.9 and a fresh copy of Lenya1.3.  Fixed some bugs with Hierarchical content while testing the new installation.

Updated INSTALL-SRC.txt with instructions based on new installation (especially how Cocoon's BAT files are formatted wrong.)
Bug fixes for Hierarchical Content.
Migrate: Use live revision for edit revision if no authoring revision (unlikely in Lenya1.2).
Added Edit Module for entry into Flat Resource maintenance.
Fixed Form Module's post.xsp to handle checkboxes (multiple fields with the same name).
Added ResourceTransformer for changing structural information of Resources.  Still being tested.
Added StringSource and VirtualSourceFactory.  The Cocoon project might benefit from them.  VirtualSourceFactory needs to be thread-safe.

Added:
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/StringSource.java   (with props)
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/VirtualSourceFactory.java   (with props)
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/ResourceTransformer.java   (with props)
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/nav/search.xsl   (with props)
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/search.xsl   (with props)
Modified:
    lenya/branches/revolution/1.3.x/INSTALL-SRC.txt
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ContentModule.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ModuleModule.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationModule.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ContentSourceFactory.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ModuleSourceFactory.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Content.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Resource.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/SitetreeGenerator.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatContent.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRevision.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java
    lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/post.xsp
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xmap
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xmap
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/module.xmap
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xmap
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/xhtml.xsl
    lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap

Modified: lenya/branches/revolution/1.3.x/INSTALL-SRC.txt
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/INSTALL-SRC.txt?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/INSTALL-SRC.txt (original)
+++ lenya/branches/revolution/1.3.x/INSTALL-SRC.txt Tue Jun 27 12:38:44 2006
@@ -1,4 +1,4 @@
-  Installation of the source version of Apache Lenya 1.2.x 
+  Installation of the source version of Apache Lenya 1.3
 
   This is an abbreviated version of the installation instuctions found
   at http://lenya.apache.org/installation/source_version.html
@@ -17,8 +17,9 @@
 	* Java 2 Platform, Standard Edition
 	  version 1.4.2 or newer, 1.5.x works with some limitations
 	  (see http://issues.apache.org/bugzilla/show_bug.cgi?id=32923)
+          Lenya 1.3 was developed with j2sdk1.4.2_07
 
-	* Apache Cocoon, version 2.1.7
+	* Apache Cocoon, version 2.1.9
 	  Available from http://cocoon.apache.org/mirror.cgi
 
 	* Apache Tomcat, version 5
@@ -32,20 +33,27 @@
 
 	1.	Create a directory src/ in a location with no spaces in the path
 
-	2.	Unpack Cocoon in src/, thereby creating src/cocoon-2.1.7
+	2.	Unpack Cocoon in src/, thereby creating src/cocoon-2.1.9
 
-	3.	Unpack Lenya in src/, thereby creating src/lenya-1.2.x
+	3.	Unpack Lenya in src/, thereby creating src/lenya-1.3.x
 
   Build Cocoon
 
 	1.	Copy
 
-			src/lenya-1.2.x/src/cocoon/local.build.properties
-			src/lenya-1.2.x/src/cocoon/local.blocks.properties
+			src/lenya-1.3.x/src/cocoon/local.build.properties
+			src/lenya-1.3.x/src/cocoon/local.blocks.properties
 
-		to	src/cocoon-2.1.7/
+		to	src/cocoon-2.1.9/
 
-	2.	Go to src/cocoon-2.1.7 and type
+        2.      If Windows, fix the 4 batch files.
+                    src\cocoon-2.1.9\tools\bin
+                    ant.bat  antRun.bat  appendcp.bat  lcp.bat
+                Convert to DOS format.  
+                Copy from src\lenya-1.3\tools\bin
+                OR Open each in Wordpad and save it.)
+
+	3.	Go to src/cocoon-2.1.9 and type
 
 			./build.sh on Unix
 			build.bat  on Windows
@@ -54,7 +62,7 @@
 
 	1.	Configure Lenya
 
-		In lenya-1.2.x, copy
+		In lenya-1.3.x, copy
 
 			build.properties
 
@@ -62,7 +70,7 @@
  
 		Edit local.build.properties and make sure that
 
-			cocoon.src.dir=../cocoon-2.1.7
+			cocoon.src.dir=../cocoon-2.1.9
 			web.app.server=Jetty
 
 		If you want to upload files to your Lenya website
@@ -72,7 +80,7 @@
 
 	2.	Build Lenya 
 
-		In lenya-1.2.x, execute
+		In lenya-1.3.x, execute
 
 			./build.sh on Unix
 			build.bat  on Windows
@@ -86,7 +94,7 @@
 
 	3.	Start Lenya/Jetty
 
-		In lenya-1.2.x, type
+		In lenya-1.3.x, type
 
 			./lenya.sh servlet on Unix
 			lenya.bat servlet  on Windows
@@ -102,7 +110,7 @@
 
 	1.	Configure Lenya
 
-		In lenya-1.2.x, copy
+		In lenya-1.3.x, copy
 
 			build.properties
 
@@ -110,7 +118,7 @@
 
 		Edit local.build.properties and make sure that
 
-			cocoon.src.dir=../cocoon-2.1.7
+			cocoon.src.dir=../cocoon-2.1.9
 			web.app.server=Tomcat
 			tomcat.home.dir=[path_to_tomcat]
 
@@ -127,7 +135,7 @@
 
 	2.	Build Lenya
 
-		In lenya-1.2.x, execute
+		In lenya-1.3.x, execute
 
 			./build.sh on Unix
 			build.bat  on Windows

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ContentModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ContentModule.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ContentModule.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ContentModule.java Tue Jun 27 12:38:44 2006
@@ -33,8 +33,6 @@
 
 /**
  * Retrieves Content Variables from the appropriate Resource
- * 
- * Variables are specified as <module name="modulename"><variable name="{variablename}">{value}</variable></module>
  */
 public class ContentModule extends AbstractPageEnvelopeModule implements Serviceable, Contextualizable, ThreadSafe {
     private ServiceManager manager;
@@ -52,13 +50,16 @@
         Publication pub = pe.getPublication();
         String publication = pub.getId();
         Content content = pub.getContent();
-//        Resource resource = content.getResource();
-//        if(name.equalsIgnoreCase("type")) return resource.getType();
-//        if(name.equalsIgnoreCase("doctype")) return resource.getDocumentType();
-//        if(name.equalsIgnoreCase("documenttype")) return resource.getDocumentType();
-//        if(name.equalsIgnoreCase("defaultlanguage")) return resource.getDefaultLanguage();
-//        if(name.equalsIgnoreCase("extension")) return resource.getExtension();
-        return "test";
+        String unid = "";
+        int pos = name.indexOf(":");
+        if(pos < 1) return "error";
+        unid = name.substring(pos + 1);
+        name = name.substring(0, pos);
+        Resource resource = content.getResource(unid);
+        if(name.equalsIgnoreCase("type")) return resource.getType();
+        if(name.equalsIgnoreCase("doctype") || name.equalsIgnoreCase("documenttype")) return resource.getDocumentType();
+        if(name.equalsIgnoreCase("defaultlanguage")) return resource.getDefaultLanguage();
+        return "";
     }
 
     /**

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ModuleModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ModuleModule.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ModuleModule.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ModuleModule.java Tue Jun 27 12:38:44 2006
@@ -42,21 +42,21 @@
      * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String,
      *      org.apache.avalon.framework.configuration.Configuration, java.util.Map)
      */
-
+    private String module = "";
+    private String program = "";  //Name of calling file
+    private String process = "";  //Name of calling file without extension
     public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
         if(getLogger().isDebugEnabled()) {
            getLogger().debug("Resolving [" + name + "]");
         }
+        init();
+        //Standard Variables
+        if(name.equalsIgnoreCase("module")) return module;
+        //Module Variables
         PageEnvelope pe = getEnvelope(objectModel);
         Publication pub = pe.getPublication();
         String publication = pub.getId();
         Modules modules = pub.getModules();
-        String module = getModuleID();
-        if(name.equalsIgnoreCase("module")) return module;
-//TEST
-//String ret = modules.getVariable(publication, module, name);
-//System.out.println("VAR:" + publication  + "." + module + "." + name+"="+ ret);
-//return ret;
         return modules.getVariable(publication, module, name);
     }
 
@@ -96,9 +96,8 @@
     public void configure(Configuration conf) throws ConfigurationException {
         super.configure(conf);
     }
-   private String getModuleID() {
+   private void init() {
         String uri = "";
-        String module = "";
         try{
            SourceResolver resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
            Source source = resolver.resolveURI("");
@@ -115,17 +114,5 @@
         StringTokenizer tokens = new StringTokenizer(uri, "/");
         while(tokens.hasMoreTokens() && !(tokens.nextToken().equals("modules")));
         if(tokens.hasMoreTokens()) module = tokens.nextToken();
-/* Obsolete
-        int pos = uri.indexOf("modules/");
-        if(pos > -1){
-             pos += "modules/".length();
-             int endpos = uri.indexOf("/", pos);
-             if(endpos > -1){
-               module = uri.substring(pos, endpos);
-             }else module = uri.substring(pos);
-        }
-*/
-        // Finish
-        return module;
    }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationModule.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationModule.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/modules/input/PublicationModule.java Tue Jun 27 12:38:44 2006
@@ -1,4 +1,5 @@
 package org.apache.lenya.cms.cocoon.components.modules.input;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ContentSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ContentSourceFactory.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ContentSourceFactory.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ContentSourceFactory.java Tue Jun 27 12:38:44 2006
@@ -31,6 +31,11 @@
 import org.apache.lenya.cms.publication.PageEnvelopeFactory;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.PublicationFactory;
+
+import org.apache.lenya.cms.content.Resource;
+import org.w3c.dom.Document;
+
+
 /**
  * Implements content: protocol.
  * This should call the Content API that calls a Content Impl.
@@ -48,6 +53,10 @@
 public class ContentSourceFactory
     implements SourceFactory, ThreadSafe, URIAbsolutizer, Contextualizable {
 
+    private static final int REQUEST_DATA = 0;
+    private static final int REQUEST_META = 1;
+    private static final int REQUEST_INFO = 2;
+
     protected org.apache.avalon.framework.context.Context context;
     private String servletContextPath;
     String pubsPrefix;
@@ -66,7 +75,7 @@
        org.apache.cocoon.environment.http.HttpContext httpcontext = 
              (org.apache.cocoon.environment.http.HttpContext) contextmap.get("context");
        servletContextPath = httpcontext.getRealPath("");
-//WORK: Move resolver, pubsPrefix and other init out of getSource().  Make static?
+//TODO: Move resolver, pubsPrefix and other init out of getSource().  Make static?
         ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
         try{
            resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
@@ -87,11 +96,12 @@
         }
        String publication;
        String contentpath;
+       Publication pub;
        Content content;
        try{
             PageEnvelope envelope = 
                   PageEnvelopeFactory.getInstance().getPageEnvelope(ContextHelper.getObjectModel(context));
-            Publication pub = envelope.getPublication();
+            pub = envelope.getPublication();
             publication = pub.getId();
             content = pub.getContent();
             contentpath = pub.getContentDirectory().getAbsolutePath() + File.separator;
@@ -99,6 +109,15 @@
             throw new MalformedURLException("Could not get Publication ID.");
         }
        // Decide Usage
+       // Content or Meta
+       int requestType = REQUEST_DATA;
+       pos = location.indexOf(":::");
+       if(pos != -1){
+          requestType = REQUEST_INFO;
+       }else{
+          pos = location.indexOf("::");
+          if(pos != -1) requestType = REQUEST_META;
+       }
        //Revision
        String revision = "live";
        pos = location.lastIndexOf("!");
@@ -113,12 +132,12 @@
           language = location.substring(pos + 1);
           location = location.substring(0, pos);
        }
-//WORK: Set language to document or publication's default if not specified.
-       pos = location.indexOf(":///");
+//TODO: Set language to document or publication's default if not specified.
        int endpos;
        String structure = "";
        String unid = "";
        String fullid = "";
+       pos = location.indexOf(":///");
        if(pos != -1){
           // content:///parents/resourceID
           //Guess structure?
@@ -132,6 +151,7 @@
              if(endpos > 0){
                 structure = location.substring(pos, endpos);
                 fullid = location.substring(endpos + 1);
+//System.out.println("CSF SF S=" + structure + "  F=" + fullid);
              }else{
                 structure = location.substring(pos);
              }
@@ -157,45 +177,42 @@
        if(unid.length() < 1){
           unid = content.getUNID(structure, "/" + fullid);
        }
-
-       /********** Get Source *************/
-       String resourcepath = contentpath + "resource" + File.separator + unid + File.separator;
-       String resourcefile = resourcepath + "resource.xml";
-       String translationfile = resourcepath + language + File.separator + "translation.xml";
-       String revisionfile = resourcepath + language + File.separator + revision + ".xml";
-
-       //Revision as filename
-       try{
-          Source source = resolver.resolveURI(revisionfile);
+       if(language.length() < 1){
+          Resource resource = content.getResource(unid);
+          if(resource != null) language = resource.getDefaultLanguage();
+       }
+       if(language.length() < 1) language = pub.getDefaultLanguage();
+
+       /********** Get Source (uses Content) *************/
+       Source source;
+       if(REQUEST_INFO == requestType){
+//TODO: Catch errors
+          Resource resource = content.getResource(unid);
+if(resource == null) System.out.println("NO RESOURCE");
+          Document doc = resource.getInfoDocument();
+if(doc == null) System.out.println("NO DOC");
+          source = new StringSource(manager, doc);
+if(source == null) System.out.println("NO SOURCE");
+          return source;
+       }
+       if(REQUEST_META == requestType){
+          source = resolver.resolveURI(content.getMetaURI(unid, language, revision));
           if(source.exists()){
-            if (resolver != null) manager.release(resolver);
+             if (resolver != null) manager.release(resolver);
              return source;
           }
-       }catch(java.net.MalformedURLException mue2){
-       }catch(java.io.IOException ioe1){
        }
-       //Revision as translation parameter
-       try{
-//IOException!!!
-          File tf = new File(translationfile);
-          Configuration config = builder.buildFromFile(tf);
-          String newrevision = config.getAttribute(revision, null);
-          revisionfile = resourcepath + language + File.separator + newrevision + ".xml";
-System.out.println("REV2=" + revisionfile);
-             Source source = resolver.resolveURI(revisionfile);
-             if(source.exists()){
-               if (resolver != null) manager.release(resolver);
-                return source;
-             }
-       }catch(org.xml.sax.SAXException se){
-       }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
-       }catch(java.net.MalformedURLException mue2){
-       }catch(java.io.IOException ioe1){
-System.out.println("IOE=" + ioe1.getMessage());
+//System.out.println("CSF UNID=" + unid + " LANG=" + language + "  REV=" + revision);
+      
+       String curi = content.getURI(unid, language, revision);
+//System.out.println("CSF CURI=" + curi);
+       source = resolver.resolveURI(curi);
+       if(source.exists()){
+          if (resolver != null) manager.release(resolver);
+          return source;
        }
-
        if (resolver != null) manager.release(resolver);
-       throw new SourceNotFoundException("Not found: " + plocation);
+       throw new SourceNotFoundException("Not found: " + plocation + " (" + curi + ")");
     }
     public void release(Source source1) {
     }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ModuleSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ModuleSourceFactory.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ModuleSourceFactory.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/ModuleSourceFactory.java Tue Jun 27 12:38:44 2006
@@ -50,6 +50,7 @@
     }
 
     public Source getSource(String location, Map parameters) throws IOException, MalformedURLException {
+//System.out.println("MSF LOC=" + location);
        int pos;
        Map contextmap = ContextHelper.getObjectModel(context);
        org.apache.cocoon.environment.http.HttpContext httpcontext = 
@@ -99,6 +100,15 @@
        pos = location.indexOf(":///");
        int endpos;
        String module = getModuleID(uri);
+       // BUG ALERT: 
+       // <map:mount> tries both module://module/filepath and module://module/
+       // If filepath has a default, the second attempt will error.
+       // Not having the default destroys Flow:
+       //    source = resolver.resolveURI("cocoon:/pipeline");
+       //    var is = new Packages.org.xml.sax.InputSource(source.getInputStream());
+       // This errors.
+       // Every Module must have a module.xmap (even if it is empty)!
+//       String filepath = "";
        String filepath = "module.xmap";
        if(pos != -1){
           // module:/filepath/filename.ext
@@ -109,12 +119,14 @@
 	    if(pos != -1){
              // module://modulename/filepath/filename.ext
              pos += 3;
-             endpos = location.indexOf("/", pos);
+             endpos = location.indexOf("/", pos + 1);
              if(endpos > 0){
                 module = location.substring(pos, endpos);
                 filepath = location.substring(endpos + 1);
+//System.out.println("MSF MOD=" + module + "  FIL=" + filepath);
              }else{
                 module = location.substring(pos);
+//System.out.println("MSF MOD=" + module + "  POS=" + pos);
              }
           }else{
              pos = location.indexOf(":/");
@@ -144,6 +156,7 @@
        // Verify
        if(publication.length() < 1) throw new MalformedURLException("No Publication ID found.");
        if(module.length() < 1) module = getModuleID(uri);
+       // BUG ALERT: See descrption above about no default 
        if(filepath.length() < 1) filepath = "module.xmap";
        //Check current publication
        if(!modules.isAllowed(module)) 
@@ -184,6 +197,7 @@
        }catch(java.io.IOException ioe1){
        }
        if (resolver != null) manager.release(resolver);
+//System.out.println("Not found: " + publication + "/" + module + "/" + filepath);
        throw new SourceNotFoundException("Not found: " + publication + "/" + module + "/" + filepath);
     }
 

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/StringSource.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/StringSource.java?rev=417568&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/StringSource.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/StringSource.java Tue Jun 27 12:38:44 2006
@@ -0,0 +1,101 @@
+package org.apache.lenya.cms.cocoon.components.source.impl;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.util.Map;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.impl.AbstractSource;
+import org.apache.excalibur.xml.sax.XMLizable;
+import org.apache.cocoon.serialization.XMLSerializer;
+import org.apache.cocoon.xml.dom.DOMStreamer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.ComponentSelector;
+import org.apache.cocoon.serialization.Serializer;
+
+
+/**
+ * Creates a Source from a String, Document, Node, or XMLizable.
+ * 
+ * If a String does not start with "<", it is wrapped with <text> tags.
+ * If a String does not start with "<?xml", an XML header is added.
+ */
+
+public class StringSource extends AbstractSource {
+    final static private String ENCODING = "ISO-8859-1";
+    private Object inputObject;
+    private boolean exists = true;
+    private ComponentManager manager;
+
+    public StringSource(ComponentManager mgr, Object object){
+       manager = mgr;
+       inputObject = object;
+    }
+    
+    /**
+     * Implement this method to obtain SAX events.
+     */
+    public void toSAX(ContentHandler handler) throws SAXException {
+        if (inputObject instanceof Document ) {
+            DOMStreamer domStreamer = new DOMStreamer( handler );
+            domStreamer.stream( (Document)inputObject );
+        } else if(inputObject instanceof Node ) {
+            DOMStreamer domStreamer = new DOMStreamer( handler );
+            handler.startDocument();
+            domStreamer.stream( (Node)inputObject );
+            handler.endDocument();
+        } else if(inputObject instanceof XMLizable ) {
+            ((XMLizable)inputObject).toSAX( handler );
+        } else {
+            exists = false;
+            throw new SAXException("The " + inputObject.getClass() +" could not be serialized to XML.");
+        }
+    }
+
+    /**
+     * Return an <code>InputStream</code> object to read from the source.
+     *
+     * @throws IOException if I/O error occured.
+     */
+    public InputStream getInputStream() throws IOException, SourceException {
+        ByteArrayInputStream inputStream = null;
+        if (inputObject instanceof String){
+           String temp = (String) inputObject;
+           if(!temp.startsWith("<")) temp="<text>" + temp + "</text>";
+           if(!temp.startsWith("<?xml")) temp = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + temp;
+           inputStream = new ByteArrayInputStream(temp.getBytes(ENCODING));
+        }else{
+           // Serialize the SAX events to the XMLSerializer:
+           ComponentSelector serializerSelector = null;
+           Serializer serializer = null;
+           try{
+              serializerSelector = (ComponentSelector) manager.lookup(Serializer.ROLE + "Selector");
+              serializer = (Serializer)serializerSelector.select("xml");
+              ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+              serializer.setOutputStream((OutputStream) outputStream );
+              toSAX( serializer );
+              inputStream = new ByteArrayInputStream( outputStream.toByteArray() );
+           }catch(org.apache.avalon.framework.component.ComponentException ce){
+              exists = false;
+              throw new SourceException("StringSource: ComponentException", ce );
+           }catch(SAXException se){
+              exists = false;
+              throw new SourceException("Could not serialize to a ByteArray.", se );
+           }
+        }
+        return inputStream;
+    }
+    /**
+     * @return true if the resource was created properly.
+     */
+    public boolean exists() {
+        return exists;
+    }
+}

Propchange: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/StringSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/VirtualSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/VirtualSourceFactory.java?rev=417568&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/VirtualSourceFactory.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/VirtualSourceFactory.java Tue Jun 27 12:38:44 2006
@@ -0,0 +1,41 @@
+package org.apache.lenya.cms.cocoon.components.source.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceFactory;
+import org.apache.excalibur.source.SourceNotFoundException;
+
+public class VirtualSourceFactory implements SourceFactory, ThreadSafe {
+    static private Map sources = new HashMap();
+    static private Random random = new Random();
+
+    public Source getSource(String plocation, Map parameters) throws SourceNotFoundException{
+       String location = plocation;
+//System.out.println("VS LOC=" + location);
+       int pos = location.lastIndexOf("/");
+       if((pos > -1) && (pos + 1 < location.length())) location = location.substring(pos + 1);
+       pos = location.lastIndexOf(":");
+       if((pos > -1) && (pos + 1 < location.length())) location = location.substring(pos + 1);
+       if(sources.containsKey(location)) return (Source) sources.get(location);
+       throw new SourceNotFoundException("VirtualSource not found: " + location);
+    }
+    public void release(Source source1){
+    }
+//TODO: synchronize
+   static public String addSource(Source source){
+      String key = Integer.toString(random.nextInt(1000)) + getDateString();
+      while(sources.containsKey(key)) key = key + Integer.toString(random.nextInt(1000));
+      sources.put(key, source);
+      return key;
+   }
+   static public void releaseSource(String key){
+      if(sources.containsKey(key)) sources.remove(key);
+   }
+   static private String getDateString(){
+      return Long.toString(new java.util.Date().getTime());
+   }
+
+}
\ No newline at end of file

Propchange: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/cocoon/components/source/impl/VirtualSourceFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Content.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Content.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Content.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Content.java Tue Jun 27 12:38:44 2006
@@ -12,4 +12,5 @@
    public String getUNID(String structure, String id);
    public String getIndexFilename(String indexName, String language);
    public String[] getLanguages();
+   public Resource getResource(String unid);
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Resource.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Resource.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Resource.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/Resource.java Tue Jun 27 12:38:44 2006
@@ -2,9 +2,9 @@
 
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceNotFoundException;
+import org.w3c.dom.Document;
 
 public interface Resource{
-/* These 3 functions are called URI (in preparation for JCR) but return filenames. */
    public String getURI();
    public String getMetaURI();
    public String getNewURI();
@@ -16,6 +16,8 @@
    public String getLanguage();
    public String getDefaultLanguage();
    public String[] getLanguages();
+   public Document getInfoDocument();
+   public Document update(Document document);
 
 /**
  * Get Navigation Title from live revision of current language.

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/ResourceTransformer.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/ResourceTransformer.java?rev=417568&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/ResourceTransformer.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/ResourceTransformer.java Tue Jun 27 12:38:44 2006
@@ -0,0 +1,43 @@
+package org.apache.lenya.cms.content;
+
+import org.apache.cocoon.transformation.AbstractDOMTransformer;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.lenya.cms.content.Content;
+import org.apache.lenya.cms.content.Resource;
+import org.apache.lenya.cms.publication.PageEnvelope;
+import org.apache.lenya.cms.publication.Publication;
+import org.w3c.dom.Document;
+
+/**
+ * This transformer modifies the structural information of a Resource.
+ * 
+ * It accepts a UNID as the src parameter.
+ * It can:
+ * - change the id and defaultlanguage of the Resource,
+ * - delete Translations and Revisions, 
+ * - change the live and edit Revisions of Translations.
+ * 
+ * <resource [id="newid"] [defaultlanguage="aa"]>
+ *    <translation language="xx" [action="delete"] [live="1137958604000"] [edit="1137958604000"]>
+ *       <revision revision="1137958604000" [action="delete"]/>
+ *    </translation>
+ * </resource>
+ * 
+ * action="delete" has top priority.
+ * Any settings not included will not be affected.
+ * 
+ * @author <a href="mailto:solprovider@apache.org">Paul Ercolino</a>
+ */
+public class ResourceTransformer extends AbstractDOMTransformer{
+    protected org.w3c.dom.Document transform(org.w3c.dom.Document doc){
+       Request request = ObjectModelHelper.getRequest(super.objectModel);
+       PageEnvelope envelope = (PageEnvelope) request.getAttribute(PageEnvelope.class.getName());
+       Publication pub = envelope.getPublication();
+       Content content = pub.getContent();
+       String unid = this.source;
+       Resource resource = content.getResource(unid);
+       resource.update(doc);
+       return doc;
+    }
+}

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

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/SitetreeGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/SitetreeGenerator.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/SitetreeGenerator.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/SitetreeGenerator.java Tue Jun 27 12:38:44 2006
@@ -13,6 +13,7 @@
 import org.apache.cocoon.caching.CacheableProcessingComponent;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.generation.AbstractGenerator;
 import org.apache.cocoon.generation.ServiceableGenerator;
 import org.apache.excalibur.xml.sax.XMLConsumer;
 import org.apache.excalibur.source.Source;
@@ -23,16 +24,7 @@
 import org.apache.lenya.cms.publication.PageEnvelopeFactory;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.PublicationFactory;
-
 import org.xml.sax.SAXException;
-/*
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.XMLReaderFactory;
-*/
-
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.generation.AbstractGenerator;
 
 /**
  * The <code>SitetreeGenerator</code> is a class that reads XML from a source

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatContent.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatContent.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatContent.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatContent.java Tue Jun 27 12:38:44 2006
@@ -33,12 +33,16 @@
       return resource.getMetaURI();
    }
    public String getNewURI(String unid, String language){
+
       Resource resource = getResource(unid, language, "live");
       return resource.getNewURI();
    }
    public String getUNID(String structure, String id){
       FlatRelations relations = getRelations(structure);
       return relations.getUNID(id);
+   }
+   public Resource getResource(String unid){
+      return (Resource) new FlatResource(directory, unid);
    }
 /* FlatContent API */
    public String[] getLanguages(){

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java Tue Jun 27 12:38:44 2006
@@ -1,10 +1,12 @@
 package org.apache.lenya.cms.content.flat;
 
 import java.io.File;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceNotFoundException;
 import org.apache.lenya.cms.content.Resource;
-//import org.apache.lenya.cms.content.Translation;
 import org.apache.lenya.xml.DocumentHelper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -20,37 +22,55 @@
    String type = "xml";
    String doctype = "";
    String defaultLanguage = "en";
+   String defaultLanguageParameter = "";
    String defaultRevision = "live";
    String extension = "";
-   String[] languages = {"en"};
+   String[] languages;
+   boolean isChanged = false;
 
    public FlatResource(File directory, String punid, String language, String revision){
       contentDirectory = directory;
       unid = punid;
-      defaultLanguage = language;
+      if(language.length() > 0) defaultLanguage = language;
       defaultRevision = revision;
       init(false);
    }
    public FlatResource(File directory, String punid, String language){
       contentDirectory = directory;
       unid = punid;
-      defaultLanguage = language;
+      if(language.length() > 0) defaultLanguage = language;
       init(false);
    }
    public FlatResource(File directory, String punid){
       contentDirectory = directory;
       unid = punid;
-//TODO: defaultLanguage = Publication's default language.
       init(true);
    }
-   private void init(boolean useDefaultLanguage){
+   private void init(boolean puseDefaultLanguage){
+      boolean useDefaultLanguage = puseDefaultLanguage;
+      //Check if unid_lang!revision format
+      int pos = unid.lastIndexOf("!");
+      if(pos > 0){
+         defaultRevision = unid.substring(pos);
+         unid = unid.substring(0, pos);
+      }
+      pos = unid.lastIndexOf("_");
+      if(pos > 0){
+         defaultLanguage = unid.substring(pos);
+         unid = unid.substring(0, pos);
+         useDefaultLanguage = false;
+      }
+//TODO: defaultLanguage = Publication's default language.
       resourceDirectory = new File(contentDirectory, "resource" + File.separator + unid);
       try{
          resource = DocumentHelper.readDocument(new File(resourceDirectory, "resource.xml"));
          root = resource.getDocumentElement();
+         if(root.hasAttribute("defaultlanguage")){
+            defaultLanguageParameter = root.getAttribute("defaultlanguage");
+         }
          if(useDefaultLanguage){
-            if(root.hasAttribute("defaultlanguage")){
-              defaultLanguage = root.getAttribute("defaultlanguage");
+            if(defaultLanguageParameter.length() > 0){
+               defaultLanguage = defaultLanguageParameter;
             }else{
 //TODO: Use Publication's Default Language
             }
@@ -58,13 +78,16 @@
          if(root.hasAttribute("doctype")) doctype = root.getAttribute("doctype");
          if(root.hasAttribute("type")) type = root.getAttribute("type");
          if(root.hasAttribute("id")) id = root.getAttribute("id");
-         NodeList ts = root.getElementsByTagName("translation");
-         int length = ts.getLength();
-         languages = new String[length];
+         String[] files = resourceDirectory.list();
+         int length = files.length;
+         int count = 0;
+         List list = new ArrayList();
          for(int i = 0; i < length; i++){
-            Element t = (Element) ts.item(i);
-            languages[i] = t.getAttribute("language");
+            File file = new File(resourceDirectory, files[i]);
+            if(file.isDirectory()) list.add(files[i]);
          }
+         languages = (String[]) list.toArray(new String[0]);
+         Arrays.sort(languages);
       }catch(javax.xml.parsers.ParserConfigurationException pce){
       }catch(org.xml.sax.SAXException saxe){
       }catch(java.io.IOException ioe){
@@ -122,7 +145,7 @@
       try{
          return getTranslation(language).getRevision(revision).getTitle();
       }catch(java.lang.NullPointerException npe){
-System.out.println("FR.gTitle NPE UNID=" + unid);
+System.out.println("FlatResource.getTitle NullPointerException UNID=" + unid);
          return "";
       }
    }
@@ -185,14 +208,150 @@
       FlatRevision revision = translation.getRevision(defaultRevision);
       if(null == revision) return false;
       boolean exists = revision.exists();
-      if(getTitle().length() < 1){
-         System.out.println("Exists=" + exists + " U=" + unid + " L=" + defaultLanguage + " R=" + defaultRevision);
-         return false;
-      }
+//DEV TEST
+//      if(getTitle().length() < 1){
+//         System.out.println("Exists=" + exists + " U=" + unid + " L=" + defaultLanguage + " R=" + defaultRevision);
+//         return false;
+//      }
       try{
          return getTranslation(defaultLanguage, false).getRevision(defaultRevision).exists();
       }catch(java.lang.NullPointerException npe){
          return false;
       }
+   }
+   public Document getInfoDocument(){
+      Document document;
+      try{
+         document = org.apache.lenya.xml.DocumentHelper.createDocument("", "resource", null);
+      }catch(javax.xml.parsers.ParserConfigurationException pce){
+         System.out.println("Resource InfoDocument: ParserConfigurationException");
+         return (Document) null;
+      }
+      Element root = document.getDocumentElement();
+      root.setAttribute("unid", unid);
+      root.setAttribute("type", type);
+      root.setAttribute("id", id);
+      if(defaultLanguageParameter.length() > 0) root.setAttribute("defaultlanguage", defaultLanguageParameter);
+      if(doctype.length() > 0) root.setAttribute("doctype", doctype);
+      String tmp;
+      for(int l = 0; l < languages.length; l++){
+         Element te = addElement(document, root, "translation");
+         te.setAttribute("language", languages[l]);
+         FlatTranslation translation = getTranslation(languages[l]);
+         tmp = translation.getEdit();
+         if(tmp.length() > 0) te.setAttribute("edit", tmp);
+         tmp = translation.getLive();
+         if(tmp.length() > 0) te.setAttribute("live", tmp);
+         String[] revisions = translation.getRevisions();
+         for(int r = 0; r < revisions.length; r++){
+            Element re = addElement(document, te, "revision");
+            re.setAttribute("revision", revisions[r]);
+            FlatRevision revision = translation.getRevision(revisions[r]);
+            tmp = revision.getTitle();
+            if(tmp.length() > 0) re.setAttribute("title", tmp);
+            tmp = revision.getExtension();
+            if(tmp.length() > 0) re.setAttribute("extension", tmp);
+            tmp = revision.getHREF();
+            if(tmp.length() > 0) re.setAttribute("href", tmp);
+         }            
+      }
+      return document;
+   }
+   /* Used by getInfoDocument() */
+   private Element addElement(Document document, Element parent, String newElementName){
+      Element newElement = document.createElement(newElementName);
+      parent.appendChild(newElement);
+      return newElement;
+   }
+   public Document update(Document document){
+      Element root = document.getDocumentElement();
+      if(root.hasAttribute("id")) setID(root.getAttribute("id"));
+      if(root.hasAttribute("defaultlanguage")) setDefaultLanguage(root.getAttribute("defaultlanguage"));
+      save();
+      NodeList translations = root.getElementsByTagName("translation");
+      int translationslength = translations.getLength();
+      FlatTranslation ft = null;
+      for(int t = 0; t < translationslength; t++){
+         Element translation = (Element) translations.item(t);
+         String language = translation.getAttribute("language");
+         boolean exist = true;
+         if(translation.hasAttribute("action")){
+            String action = translation.getAttribute("action");
+            if(action.equalsIgnoreCase("delete")){
+               deleteTranslation(language);
+               exist = false;
+            }
+         }
+         if(exist){
+            ft = getTranslation(language, false);
+            if(null == ft) exist = false;
+         }
+         if(exist){
+            if(translation.hasAttribute("live")) ft.setLive(translation.getAttribute("live"));
+            if(translation.hasAttribute("edit")) ft.setEdit(translation.getAttribute("edit"));
+            NodeList revisions = translation.getElementsByTagName("revision");
+            int revisionslength = revisions.getLength();
+            for(int r = 0; r < revisionslength; r++){
+              Element revision = (Element) revisions.item(t);
+              if(revision.hasAttribute("action")){
+                 String action = revision.getAttribute("action");
+                 if(action.equalsIgnoreCase("delete")){
+                    String revisionid = revision.getAttribute("revision");
+                    ft.deleteRevision(revisionid);
+                  }
+               }
+            }
+            ft.save();
+         }
+      }
+      return document;
+   }
+   private void setID(String newid){
+      if(!id.equals(newid)){
+//        id = newid;
+// TODO: Must update Structures
+      }   
+//      isChanged = true;
+   }
+   private void setDefaultLanguage(String language){
+      defaultLanguageParameter = language;
+      defaultLanguage = language;
+      isChanged = true;
+   }
+   private void deleteTranslation(String language){
+      File translationDirectory = new File(resourceDirectory, language);
+//TODO: Backup before delete.  Use renameTo() to move outside the resource directory.
+      translationDirectory.delete();
+   }
+   private void save(){
+      if(isChanged){
+         File file = new File(resourceDirectory, "resource.xml");
+         Document doc;
+         try{
+            doc = DocumentHelper.readDocument(file);
+         }catch(javax.xml.parsers.ParserConfigurationException pce){
+System.out.println("FlatResource.save - ParserConfigurationException:" + file.getAbsolutePath());
+            return;
+         }catch(org.xml.sax.SAXException saxe){
+System.out.println("FlatResource.save - SAXException:" + file.getAbsolutePath());
+            return;
+         }catch(java.io.IOException ioe){
+System.out.println("FlatResource.save - Could not read file:" + file.getAbsolutePath());
+            return;
+         }
+         root = doc.getDocumentElement();
+         root.setAttribute("defaultlanguage", defaultLanguageParameter);
+         root.setAttribute("id", id);
+         try{
+            DocumentHelper.writeDocument(doc, file);
+         }catch(javax.xml.transform.TransformerConfigurationException tce){
+System.out.println("FlatResource.save - TransformerConfigurationException:" + file.getAbsolutePath());
+         }catch(javax.xml.transform.TransformerException te){
+System.out.println("FlatResource.save - TransformerException:" + file.getAbsolutePath());
+         }catch(java.io.IOException ioe2){
+System.out.println("FlatResource.save - Could not write file:" + file.getAbsolutePath());
+         }
+      }
+      isChanged = false;
    }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRevision.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRevision.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRevision.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRevision.java Tue Jun 27 12:38:44 2006
@@ -3,7 +3,6 @@
 import java.io.File;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceNotFoundException;
-//import org.apache.lenya.cms.content.Revision;
 import org.apache.lenya.xml.DocumentHelper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java Tue Jun 27 12:38:44 2006
@@ -22,8 +22,10 @@
    Document document;
    Element root;
    FlatRevision fr;
-
+   boolean initRevisions = false;
    SortedSet revisions = new TreeSet();
+   boolean isChanged = false;
+
    public FlatTranslation(File directory, String planguage, String pdefaultLanguage, String prevision){
       resourceDirectory = directory;
       language = planguage;
@@ -59,16 +61,19 @@
       }catch(java.io.IOException ioe){
 System.out.println("FlatTranslation: IOException");
       }
-      String[] filelist = translationDirectory.list();
-      for(int f = 0; f < filelist.length; f++){
-         String filename = filelist[f];
-         int pos = filename.lastIndexOf(".");
-         if(pos > 0) filename = filename.substring(0, pos);
-         if(!filename.equalsIgnoreCase("translation")) revisions.add(filename);
-      }
    }
    public String[] getRevisions() {
-      return (String[]) revisions.toArray();
+      if(!initRevisions){
+         String[] filelist = translationDirectory.list();
+         for(int f = 0; f < filelist.length; f++){
+            String filename = filelist[f];
+            int pos = filename.lastIndexOf(".");
+            if(pos > 0) filename = filename.substring(0, pos);
+            if(!filename.equalsIgnoreCase("translation")) revisions.add(filename);
+         }
+         initRevisions = true;
+      }
+      return (String[]) revisions.toArray(new String[0]);
    }
    public String getLive() {
       return live;      
@@ -124,5 +129,57 @@
    }
    private String getDateString(){
       return Long.toString(new java.util.Date().getTime());
+   }
+   void setLive(String revision){
+      live = revision;
+      isChanged = true;
+   }
+   void setEdit(String revision){
+      edit = revision;
+      isChanged = true;
+   }
+   void save(){
+      if(isChanged){
+         File file = new File(translationDirectory, "translation.xml");
+         Document doc;
+         try{
+            doc = DocumentHelper.readDocument(file);
+         }catch(javax.xml.parsers.ParserConfigurationException pce){
+System.out.println("FlatTranslation.save - ParserConfigurationException:" + file.getAbsolutePath());
+            return;
+         }catch(org.xml.sax.SAXException saxe){
+System.out.println("FlatTranslation.save - SAXException:" + file.getAbsolutePath());
+            return;
+         }catch(java.io.IOException ioe){
+System.out.println("FlatTranslation.save - Could not read file:" + file.getAbsolutePath());
+            return;
+         }
+         root = doc.getDocumentElement();
+         root.setAttribute("live", live);
+         root.setAttribute("edit", edit);
+         try{
+            DocumentHelper.writeDocument(doc, file);
+         }catch(javax.xml.transform.TransformerConfigurationException tce){
+System.out.println("FlatTranslation.save - TransformerConfigurationException:" + file.getAbsolutePath());
+         }catch(javax.xml.transform.TransformerException te){
+System.out.println("FlatTranslation.save - TransformerException:" + file.getAbsolutePath());
+         }catch(java.io.IOException ioe2){
+System.out.println("FlatTranslation.save - Could not write file:" + file.getAbsolutePath());
+         }
+      }
+      isChanged = false;
+   }
+   void deleteRevision(String revision){
+      FlatRevision fr = getRevision(revision);
+      String extension = fr.getExtension();
+//TODO: Backup before delete.  Use renameTo() to move outside the resource directory.
+      File file = new File(translationDirectory, revision + ".xml");
+      if(file.exists()){
+         file.delete();
+         if(extension.length() > 0){
+            file = new File(translationDirectory, revision + "." + extension);
+            if(file.exists()) file.delete();
+         }
+      }
    }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java Tue Jun 27 12:38:44 2006
@@ -21,21 +21,29 @@
 //WORK?  Filter by language and transform sitetree to index XML.
    }
    public String getUNID(String structure, String id){
-      return structure + File.separator + id;
+      return id;
    }
    public String[] getLanguages(){
       return languages;
    }
    public String getURI(String unid, String language, String revision){
-      return new File(directory, revision + File.separator + unid + File.separator + "index_" + language +"." + ".xml").getPath();
+      String area = revision;
+      if(area.equalsIgnoreCase("edit")) area = "authoring";
+      return new File(directory, area + unid + File.separator + "index_" + language +".xml").getPath();
    }
    public String getMetaURI(String unid, String language, String revision){
-      return new File(directory, revision + File.separator + unid + File.separator + "index_" + language +"." + ".xml").getPath();
+      String area = revision;
+      if(area.equalsIgnoreCase("edit")) area = "authoring";
+      return new File(directory, area + unid + File.separator + "index_" + language +".xml").getPath();
    }
    public String getNewURI(String unid, String language){
-      return new File(directory, "live" + File.separator + unid + File.separator + getDateString() + "_" + language +"." + ".xml").getPath();
+      return new File(directory, "live" + unid + File.separator + getDateString() + "_" + language +".xml").getPath();
    }
    private String getDateString(){
       return Long.toString(new java.util.Date().getTime());
+   }
+   public Resource getResource(String unid){
+//TODO: HierarchicalResource
+      return (Resource) null;
    }
 }

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=417568&r1=417567&r2=417568&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 Tue Jun 27 12:38:44 2006
@@ -128,6 +128,7 @@
     <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"/>
+    <component-instance class="org.apache.lenya.cms.cocoon.components.source.impl.VirtualSourceFactory" name="virtual"/>
   </xsl:copy>
 </xsl:template>
 

Modified: 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=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap Tue Jun 27 12:38:44 2006
@@ -19,7 +19,7 @@
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   <map:components/>
   <map:views>
-    <map:view from-label="aggregation" name="aggregation">
+    <map:view from-label="debug" name="debug">
       <map:serialize type="xml"/>
     </map:view>
   </map:views>
@@ -57,13 +57,25 @@
     </map:component-configurations>
 
     <map:pipeline>
+<!-- For editing flat content.  Wait until the ResourceType Modules are complete.
+            <map:select type="parameter">
+               <map:parameter name="parameter-selector-test" value="{publication:contenttype}"/>
+               <map:when test="flat">
+                  <map:act type="resource-exists" src="module://edit/module.xmap">
+                     <map:generate src="cocoon://edit/module.xmap"/> 
+                     <map:serialize type="html"/>
+                  </map:act>
+               </map:when>
+            </map:select>
+-->
+
+      <map:match pattern="{module:module}">
+        <map:redirect-to uri="{module:module}/index.html"/>
+      </map:match>
       <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">
@@ -112,12 +124,12 @@
     <map:pipeline>
       <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
       <map:match pattern="lenyabody-*/*/*/*/**">
-        <map:aggregate element="cmsbody">
+        <map:aggregate element="cmsbody" label="debug">
           <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:part src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}" label="xdebug"/>
         </map:aggregate>
         <map:transform src="module:///../../xslt/page2xhtml-{4}.xsl">
           <map:parameter name="root" value="{page-envelope:context-prefix}/{2}/{3}"/>
@@ -151,20 +163,11 @@
       
       <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:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-url}" label="debug"/>
               <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>
 

Modified: 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=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/content3.xsl Tue Jun 27 12:38:44 2006
@@ -43,16 +43,17 @@
 </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>1</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: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:value-of select="$live"/></xsl:otherwise>
 </xsl:choose></xsl:variable>
 
   <xsl:copy><xsl:apply-templates select="@*"/>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/resources3.xsl Tue Jun 27 12:38:44 2006
@@ -36,16 +36,17 @@
 </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>1</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: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:value-of select="$live"/></xsl:otherwise>
 </xsl:choose></xsl:variable>
 
   <xsl:copy><xsl:apply-templates select="@*"/>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/post.xsp
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/post.xsp?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/post.xsp (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/post.xsp Tue Jun 27 12:38:44 2006
@@ -5,7 +5,10 @@
 	Enumeration pns = request.getParameterNames();
 while(pns.hasMoreElements()){
 	String pn = (String) pns.nextElement(); 
-	String pv = request.getParameter(pn);
+	String[] pvs = request.getParameterValues(pn);
+      for(int p = 0; p &lt; pvs.length; p++){
+         String pv = pvs[p];
 </xsp:logic><field><xsp:attribute name="name"><xsp:expr>pn</xsp:expr></xsp:attribute><xsp:expr>pv</xsp:expr></field><xsp:logic>
+      }
 }
 </xsp:logic></form></xsp:page>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xmap?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xmap Tue Jun 27 12:38:44 2006
@@ -17,12 +17,11 @@
             <!-- Get the current document -->
             <map:match pattern="*/cocoon/**">
                <map:aggregate element="cmsbody">
-                  <map:part src="cocoon://{publication:publication}/session/info"/>
                   <map:part src="cocoon://{publication:publication}/navigation/breadcrumb{page-envelope:document-id}_{page-envelope:document-language}"/>
                   <map:part src="cocoon://{publication:publication}/navigation/tabs{page-envelope:document-id}_{page-envelope:document-language}"/>
                   <map:part src="cocoon://{publication:publication}/navigation/menu{page-envelope:document-id}_{page-envelope:document-language}"/>
                   <map:part src="cocoon://{publication:publication}/navigation/search{page-envelope:document-id}_{page-envelope:document-language}"/>
-                  <map:part src="cocoon://{publication:publication}/xhtml/view/live/index_{page-envelope:document-language}.html"/>
+                  <map:part src="cocoon://{publication:publication}/xhtml/live/index_{page-envelope:document-language}.html"/>
                </map:aggregate>
                <map:transform type="i18n" label="debug">
                   <map:parameter name="locale" value="{page-envelope:document-language}"/>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xmap?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xmap Tue Jun 27 12:38:44 2006
@@ -17,28 +17,27 @@
                   <map:redirect-to uri="index.html"  session="false"/>
                </map:match>
                <map:match pattern="**/index*">
-                  <map:act type="resource-exists" src="module://homepage">
+                  <map:act type="resource-exists" src="module://homepage/module.xmap">
                      <map:mount uri-prefix="" src="module://homepage/module.xmap"/> 
                      <map:serialize type="html"/>
                   </map:act>
                </map:match>
             <!-- Get the current document -->
-            <map:match pattern="*/cocoon/live/**">
+            <map:match pattern="*/cocoon/{module:module}/**">
                <map:aggregate element="cmsbody">
-                  <map:part src="cocoon://{publication:publication}/session/info"/>
                   <map:part src="cocoon://{publication:publication}/navigation/breadcrumb{page-envelope:document-id}_{page-envelope:document-language}"/>
                   <map:part src="cocoon://{publication:publication}/navigation/tabs{page-envelope:document-id}_{page-envelope:document-language}"/>
                   <map:part src="cocoon://{publication:publication}/navigation/menu{page-envelope:document-id}_{page-envelope:document-language}"/>
                   <map:part src="cocoon://{publication:publication}/navigation/search{page-envelope:document-id}_{page-envelope:document-language}"/>
 <!--  WORK: Get doctype from Resource -->
-                  <map:part src="cocoon://{publication:publication}/xhtml/view/live/{2}"/>
+                  <map:part src="cocoon://{publication:publication}/xhtml/{module:module}/{2}"/>
                </map:aggregate>
-               <map:transform type="i18n" label="debug">
+               <map:transform type="i18n">
                   <map:parameter name="locale" value="{page-envelope:document-language}"/>
                </map:transform>
                <map:transform src="module:///page2xhtml.xsl">
                  <map:parameter name="contenttype" value="{publication:contenttype}"/>
-                 <map:parameter name="root" value="{page-envelope:context-prefix}/{publication:publication}/live"/>
+                 <map:parameter name="root" value="{page-envelope:context-prefix}/{publication:publication}/{module:module}"/>
                  <map:parameter name="url" value="{2}"/>
                  <map:parameter name="document-id" value="{page-envelope:document-id}"/>
                  <map:parameter name="document-name" value="{page-envelope:document-name}"/>

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/nav/search.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/nav/search.xsl?rev=417568&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/nav/search.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/nav/search.xsl Tue Jun 27 12:38:44 2006
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
+    xmlns="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="nav"
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+    >
+    
+<xsl:param name="chosenlanguage"/>
+
+<xsl:template match="nav:site">
+  <div id="search">
+<form action=""><div style="display:inline;"><input type="hidden" name="lenya.usecase" value="search"/><input type="hidden" name="language" value="{$chosenlanguage}"/><input class="searchfield" type="text" name="query" alt="Search field"/><input class="searchsubmit" type="submit" i18n:attr="value" value="Search" name="find"/></div></form>
+  </div>
+</xsl:template>
+
+<xsl:template match="@*|node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> 

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

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/module.xmap?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/module.xmap Tue Jun 27 12:38:44 2006
@@ -97,11 +97,13 @@
             </map:call>
         </map:act>
 <!-- Navigation XSL -->
-        <map:generate src="cocoon:/sitetree/{2}"/>
-        <map:call resource="finish">
-           <map:parameter name="stylesheet" value="/{1}.xsl"/>
-           <map:parameter name="url" value="{2}.html"/>
-        </map:call>
+        <map:act type="resource-exists" src="module:///{1}.xsl">
+           <map:generate src="cocoon:/sitetree/{../2}"/>
+           <map:call resource="finish">
+              <map:parameter name="stylesheet" value="/{../1}.xsl"/>
+              <map:parameter name="url" value="{../2}.html"/>
+           </map:call>
+        </map:act>
       </map:match>
 <!-- Default -->
         <map:generate src="cocoon:/sitetree/index"/>

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/search.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/search.xsl?rev=417568&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/search.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/navigation/search.xsl Tue Jun 27 12:38:44 2006
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
+    xmlns="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="nav"
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+    >
+    
+<xsl:param name="chosenlanguage"/>
+
+<xsl:template match="nav:site">
+  <div id="search">
+<form action=""><div style="display:inline;"><input type="hidden" name="lenya.usecase" value="search"/><input type="hidden" name="language" value="{$chosenlanguage}"/><input class="searchfield" type="text" name="query" alt="Search field"/><input class="searchsubmit" type="submit" i18n:attr="value" value="Search" name="find"/></div></form>
+  </div>
+</xsl:template>
+
+<xsl:template match="@*|node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> 

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

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xmap?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xmap Tue Jun 27 12:38:44 2006
@@ -4,41 +4,29 @@
    <map:pipelines>
       <map:pipeline>
          <map:match pattern="**">
-         <map:match pattern="**.html">
-            <map:generate src="cocoon:/{1}.xml"/>
-            <map:serialize type="xml"/>
-         </map:match>
-         <!-- xhtml/{view|edit}/{area}/{docpath}_{language}.xml -->
-         <map:match pattern="*/*/*/**_*.xml">
+            <!-- Remove extension -->
+            <map:match pattern="**.*">
+               <map:generate src="cocoon:/{1}"/>
+               <map:serialize type="xml"/>
+            </map:match>
             <!-- Step: View Revision from Lenya 1.2 -->
             <map:match type="step" pattern="view-revision">
                <map:generate type="serverpages" src="module:///../../../../content/rc/view.xsp"/>
                <map:transform src="module:///../../../../xslt/rc/toDoc.xsl"/>
                <map:transform src="module:///xhtml.xsl">
-                  <map:parameter name="rendertype" value="{2}"/>
                   <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>
-<!-- Revision: ?revision=live|edit|xxx -->           
-            <map:select type="parameter">
-               <map:parameter name="parameter-selector-test" value="{request-param:revision}"/>
-               <map:when test="">
-                  <map:generate src="content://{page-envelope:area}/{4}_{5}"/>
-               </map:when>
-               <map:otherwise>
-                  <map:generate src="content://{page-envelope:area}/{4}_{5}!{request-param:revision}"/>
-               </map:otherwise>
-            </map:select>
-            <map:transform src="module:///xhtml.xsl">
-               <map:parameter name="rendertype" value="{2}"/>
-               <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>
+            <!-- xhtml/{view|edit}/{area}/{docpath}_{language}.xml -->
+            <map:match pattern="{module:module}/**">
+               <map:generate src="content://{1}"/>
+               <map:transform src="module:///xhtml.xsl">
+                  <map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
+               </map:transform>
+               <map:serialize type="xml"/>
+           </map:match>
+       </map:match>
       </map:pipeline>
    </map:pipelines>
 </map:sitemap>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/xhtml.xsl?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/xhtml.xsl (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/xhtml.xsl Tue Jun 27 12:38:44 2006
@@ -9,16 +9,13 @@
     exclude-result-prefixes="xhtml lenya"
     >
 
-<xsl:param name="rendertype" select="''"/>
 <xsl:param name="nodeid"/>
 
 <xsl:template match="/xhtml:html">
 <xhtml:html>
   <xsl:copy-of select="lenya:meta"/>
   <div id="body">
-    <xsl:if test="$rendertype = 'edit'">
-      <xsl:attribute name="bxe_xpath">/xhtml:html/xhtml:body</xsl:attribute>
-    </xsl:if>
+    <xsl:attribute name="bxe_xpath">/xhtml:html/xhtml:body</xsl:attribute>
     <xsl:apply-templates select="xhtml:body/node()"/>
   </div>
 </xhtml:html>

Modified: lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap?rev=417568&r1=417567&r2=417568&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap Tue Jun 27 12:38:44 2006
@@ -133,7 +133,10 @@
     </map:transformer>
 
 <!-- Lenya 1.3 BEGIN -->
-    <map:transformer name="create-revision" logger="sitemap.transformer.create-revision" src="org.apache.lenya.cms.content.flat.CreateRevisionTransformer"/>
+    <map:transformer name="create-revision" logger="sitemap.transformer.create-revision"
+          src="org.apache.lenya.cms.content.flat.CreateRevisionTransformer"/>
+    <map:transformer name="resource" logger="sitemap.transformer.resource"
+          src="org.apache.lenya.cms.content.ResourceTransformer"/>
 <!-- Lenya 1.3 END -->
 
   </map:transformers>



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