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 2008/02/07 16:17:47 UTC

svn commit: r619438 - in /lenya/branches/revolution/1.3.x: ./ src/java/org/apache/lenya/cms/content/flat/ src/java/org/apache/lenya/cms/modules/ src/webapp/lenya/modules/live/ src/webapp/lenya/modules/new/

Author: solprovider
Date: Thu Feb  7 07:17:43 2008
New Revision: 619438

URL: http://svn.apache.org/viewvc?rev=619438&view=rev
Log:
Fixed bug: CreateRevision was ignoring language.
"New" Module is new and incomplete.

Added:
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/edit.css
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xmap
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xml
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/resource.xsl
Modified:
    lenya/branches/revolution/1.3.x/13TODO.txt
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/CreateRevisionTransformer.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java
    lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java
    lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xml

Modified: lenya/branches/revolution/1.3.x/13TODO.txt
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/13TODO.txt?rev=619438&r1=619437&r2=619438&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/13TODO.txt (original)
+++ lenya/branches/revolution/1.3.x/13TODO.txt Thu Feb  7 07:17:43 2008
@@ -11,8 +11,13 @@
 Link rewriting (CreateRevisionTransformer and HTMLSeriralizer)
 Structure editor.
 
-Xinha adds xmlns:xhtml="http://www.w3.org/1999/xhtml to some elements (P H1).
+Replace all ResourceExists Actions with the ResourceExists Selector.
+Replace uses of post.xsp with RequestGenerator.
+
+Modules - Add Resource description distinguished from Module description.
 
+
+Xinha adds xmlns:xhtml="http://www.w3.org/1999/xhtml to some elements (P H1).
 
 ==== ToDo List from 2006
 === 1.2.x Conversion

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/CreateRevisionTransformer.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/CreateRevisionTransformer.java?rev=619438&r1=619437&r2=619438&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/CreateRevisionTransformer.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/CreateRevisionTransformer.java Thu Feb  7 07:17:43 2008
@@ -59,11 +59,11 @@
       String language = envelope.getDocument().getLanguage(); // default
       // check if unid contains language
       int pos = workUnid.indexOf("_");
-      if(pos > 0){
-         workUnid = workUnid.substring(0, pos);
-         language = workUnid.substring(pos);
+      if(pos > 0){ // Use unid to avoid using the variable that is changing.
+         language = unid.substring(pos + 1);
+         workUnid = unid.substring(0, pos);
       }
-      // System.out.println("CreateRevision TEST: u=" + unid + " l=" + language);
+      // System.out.println("CreateRevision TEST: u=" + unid + " w=" + workUnid + " l=" + language + " p=" + pos);
       String newFilename = content.getNewURI(workUnid, language);
       if(newFilename == null){
          System.out.println("CreateRevision: Could not get new filename.");

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java?rev=619438&r1=619437&r2=619438&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java Thu Feb  7 07:17:43 2008
@@ -132,8 +132,11 @@
                String[] parents = resource.split("/");
                for(int p = parents.length - 1; p > -1; p--){
                   String parent = parents[p];
-                  if((parent.length() > 0) && (!parent.equalsIgnoreCase(id)) && (!inheritList.contains(parent))){
-                     inheritList.add(parents[p]);
+                  if((parent.length() > 0) && (!parent.equalsIgnoreCase(id))){
+                     String key = publicationId + "." + parent;
+                     if(!inheritList.contains(key)){
+                        inheritList.add(key);
+                     }
                   }
                }
             }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java?rev=619438&r1=619437&r2=619438&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java Thu Feb  7 07:17:43 2008
@@ -47,18 +47,18 @@
          Map.Entry entry = (Map.Entry) moduleI.next();
          String moduleKey = (String) entry.getKey();
          Object o = entry.getValue();
-         String[] moduleKeyParts = moduleKey.split(".", 2);
+         String[] moduleKeyParts = moduleKey.split("\\.", 2);
          String publicationId = moduleKeyParts[0];
          String moduleId = "";
          AttributesImpl attributes = new AttributesImpl();
          if(moduleKeyParts.length > 1){
             moduleId = moduleKeyParts[1];
          }
+         attributes.addAttribute(URI, ATTR_MODULE_PUBLICATION, ATTR_MODULE_PUBLICATION, "CDATA", publicationId);
          if(publicationId.length() < 1){
             attributes.addAttribute(URI, ATTR_MODULE_TYPE, ATTR_MODULE_TYPE, "CDATA", "global");
          }else{
             attributes.addAttribute(URI, ATTR_MODULE_TYPE, ATTR_MODULE_TYPE, "CDATA", "publication");
-            attributes.addAttribute(URI, ATTR_MODULE_PUBLICATION, ATTR_MODULE_PUBLICATION, "CDATA", publicationId);
          }
          attributes.addAttribute(URI, ATTR_MODULE_ID, ATTR_MODULE_ID, "CDATA", moduleId);
          handler.startElement(URI, ELEMENT_MODULE, ELEMENT_MODULE, attributes);
@@ -94,7 +94,7 @@
       String description = module.getDescription();
       int length = description.length();
       if(length > 0){
-         handler.startElement(URI, ELEMENT_DESCRIPTION, ELEMENT_DESCRIPTION, null);
+         handler.startElement(URI, ELEMENT_DESCRIPTION, ELEMENT_DESCRIPTION, new AttributesImpl());
          handler.characters(description.toCharArray(), 0, length);
          handler.endElement(URI, ELEMENT_DESCRIPTION, ELEMENT_DESCRIPTION);
       }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java?rev=619438&r1=619437&r2=619438&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java Thu Feb  7 07:17:43 2008
@@ -24,6 +24,7 @@
    private static final String ATTR_RESOURCE = "resource";
    private static final String ATTR_MODULE_NAME = "name";
    private static final String ATTR_PUB_ID = "publication";
+   private static final String ATTR_PUB_CONTENT = "content";
    public Serializable getKey() {
       // TODO Auto-generated method stub
       return null;
@@ -43,6 +44,7 @@
       AttributesImpl attributes = new AttributesImpl();
       // attributes.addAttribute("", "xmlns", "xmlns", "CDATA", URI);
       attributes.addAttribute(URI, ATTR_PUB_ID, ATTR_PUB_ID, "CDATA", publication.getId());
+      attributes.addAttribute(URI, ATTR_PUB_CONTENT, ATTR_PUB_CONTENT, "CDATA", publication.getContentType());
       // attributes.addAttribute("xmlns", PREFIX, "xmlns:" + PREFIX, "CDATA", URI);
       handler.startElement(URI, ELEMENT_TOP, ELEMENT_TOP, attributes);
       handleResources(handler, resources);

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xml?rev=619438&r1=619437&r2=619438&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/live/module.xml Thu Feb  7 07:17:43 2008
@@ -1,15 +1,8 @@
-<module id="live" name="Live">
-   <version>
-      <minimum>1.2</minimum>
-      <created>1.3</created>
-      <content>all</content>
-   </version>
-   <dependencies>
-      <required id="navigation">Creates nevigation elements</required>
-      <required id="xhtml">For document</required>  
-      <recommended id="cache">Use file cache for anonymous.</recommended>
-      <optional id="homepage">Redirects index* if available.</optional>
-   </dependencies>
+<module id="live" name="Live" minimum="1.2" created="1.3" content="all">
+   <required id="navigation">Creates nevigation elements</required>
+   <required id="xhtml">For documents</required>  
+   <recommended id="cache">Use file cache for anonymous.</recommended>
+   <optional id="homepage">Redirects index* if available.</optional>
    <description>Main entry point as in Lenya 1.2.</description>
    <usage>
    </usage>

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/edit.css
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/edit.css?rev=619438&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/edit.css (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/edit.css Thu Feb  7 07:17:43 2008
@@ -0,0 +1,42 @@
+/* Header Menu */
+body {
+   font-family: Tahoma, Verdana, sans-serif;
+   background-color: #EEFFEE;
+}
+
+h1 {  padding: 0px 0px 0px 0px; }
+
+table {
+   padding: 1 1 1 1px;
+   border: solid 0px #336633;
+   background-color: #EEFFEE;
+   border-collapse: collapse;
+   border-color: #669966;
+   width: auto;
+}
+tr {
+    vertical-align: top;
+}
+
+th{
+    font-size: 80%;
+    padding: 3px;
+    background-color: #EEFFEE;
+   border: solid 1px #336633;
+    vertical-align: center;
+}
+
+td{
+    font-size: 80%;
+    padding: 3px;
+    background-color: #EEFFEE;
+    border: solid 1px #336633;
+    vertical-align: top;
+}
+.spacer{
+   border: solid 0px #336633;
+}
+.dark{
+    background-color: #DDEEDD;
+}
+

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xmap?rev=619438&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xmap (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xmap Thu Feb  7 07:17:43 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- New Resource Module -->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+   <map:pipelines>
+      <map:pipeline>
+         <map:match pattern="**">
+<!-- CSS bypass -->
+         <map:match pattern="{module:module}/*.css">
+            <map:read src="module:///{1}.css" mime-type="text/css"/>
+         </map:match>
+<!-- Parts -->
+            <map:match pattern="modules">
+                  <map:generate type="modules"/>
+                  <map:serialize type="xml"/>
+            </map:match>
+            <map:match pattern="publication-modules">
+                  <map:generate type="publication-modules"/>
+                  <map:serialize type="xml"/>
+            </map:match>
+<!-- Actions -->
+   <!-- Create Resource from POST data -->
+            <map:match pattern="{module:module}/save*">
+<!-- TODO: Create Resource from POST data -->
+               <map:generate type="request"/>
+               <map:serialize type="xml"/>
+            </map:match>
+   <!-- Development -->
+            <map:match pattern="{module:module}/data">
+               <map:aggregate element="data">
+                  <map:part src="cocoon:/publication-modules"/>
+                  <map:part src="cocoon:/modules"/>
+               </map:aggregate>
+               <map:serialize type="xml"/>
+            </map:match>
+<!-- Default: Show form -->
+            <map:aggregate element="data">
+               <map:part src="cocoon:/publication-modules"/>
+               <map:part src="cocoon:/modules"/>
+            </map:aggregate>
+<!-- TODO: Finish and remove unneeded variables -->
+            <map:transform src="module::///resource.xsl">
+               <map:parameter name="module" value="{module:module}"/>
+               <map:parameter name="publication" value="{publication:publication}"/>
+               <map:parameter name="publicationname" value="{publication:name}"/>
+               <map:parameter name="languages" value="{publication:languages}"/>
+            </map:transform>
+          <map:serialize type="xml"/>
+         </map:match>
+      </map:pipeline>
+   </map:pipelines>
+</map:sitemap>

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xml?rev=619438&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xml (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/module.xml Thu Feb  7 07:17:43 2008
@@ -0,0 +1,11 @@
+<module id="new" name="New Resource" minimum="1.2" created="1.3" content="all">
+   <recommended id="file">Resource Type</recommended>
+   <recommended id="home">Resource Type</recommended>
+   <recommended id="link">Resource Type</recommended>
+   <recommended id="xhtml">Resource Type</recommended>
+   <recommended id="text">Resource Type</recommended>
+   <recommended id="xml">Resource Type</recommended>
+   <description>Create new Resource depending on Resource Modules available to Publication.</description>
+   <usage>
+   </usage>
+</module>
\ No newline at end of file

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/resource.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/resource.xsl?rev=619438&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/resource.xsl (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/new/resource.xsl Thu Feb  7 07:17:43 2008
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:xhtml="http://www.w3.org/1999/xhtml"
+    xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+    xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:dcterms="http://purl.org/dc/terms/"
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+    exclude-result-prefixes="page xhtml"
+xmlns:publication="http://apache.org/lenya/1.3/publication"
+xmlns:modules="http://apache.org/lenya/1.3/modules"
+>
+
+<xsl:param name="module"/>
+<xsl:param name="publication"/>
+<xsl:param name="publicationname"/>
+<xsl:param name="languages"/>
+
+
+<xsl:template match="/">
+  <html><head>
+  <xsl:call-template name="head"/>
+  </head><body>
+<h1><xsl:value-of select="$publicationname"/>&#160;<i18n:text>XML</i18n:text>&#160;<i18n:text>New Resource</i18n:text></h1>
+<form method="post" action="/{$publication}/{$module}/save">
+<table>
+<tr><td>Resource Type</td><td>
+  <xsl:call-template name="types"/>
+</td></tr>
+<tr><td>UNID</td><td>
+<xsl:element name="input">
+<xsl:attribute name="type">radio</xsl:attribute>
+<xsl:attribute name="name">unid</xsl:attribute>
+<xsl:attribute name="value">auto</xsl:attribute>
+<xsl:attribute name="checked"/>
+</xsl:element>Generate UUID or 
+<br/><xsl:element name="input">
+<xsl:attribute name="type">radio</xsl:attribute>
+<xsl:attribute name="name">unid</xsl:attribute>
+<xsl:attribute name="value">name</xsl:attribute>
+</xsl:element>Specify
+<xsl:element name="input">
+<xsl:attribute name="type">text</xsl:attribute>
+<xsl:attribute name="name">unidname</xsl:attribute>
+<xsl:attribute name="value"></xsl:attribute>
+</xsl:element></td></tr>
+<tr><td>URL identifier (no spaces): </td><td><xsl:element name="input">
+<xsl:attribute name="type">text</xsl:attribute>
+<xsl:attribute name="name">id</xsl:attribute>
+<xsl:attribute name="value"></xsl:attribute>
+</xsl:element></td></tr>
+</table>
+<input type="submit"/>
+</form>
+   </body></html>
+</xsl:template>
+
+
+<xsl:template name="head">
+<link rel="stylesheet" href="/{$publication}/{$module}/edit.css" type="text/css"/>
+<title><xsl:value-of select="$publicationname"/>&#160;<i18n:text>New Resource</i18n:text></title>
+</xsl:template>
+
+<xsl:template name="types">
+<table>
+<xsl:apply-templates select="/data"/>
+</table>
+</xsl:template>
+
+<xsl:template match="data">
+<xsl:apply-templates select="publication:modules"/>
+</xsl:template>
+
+<xsl:template match="publication:modules">
+<xsl:apply-templates select="publication:resource"/>
+</xsl:template>
+
+
+<xsl:template match="publication:resource">
+<xsl:variable name="publication"><xsl:value-of select="@publication:publication"/></xsl:variable>
+<xsl:variable name="module"><xsl:value-of select="@publication:module"/></xsl:variable>
+<tr><td><xsl:element name="input">
+<xsl:attribute name="type">radio</xsl:attribute>
+<xsl:attribute name="name">type</xsl:attribute>
+<xsl:attribute name="value"><xsl:value-of select="@publication:resource"/></xsl:attribute>
+</xsl:element><xsl:value-of select="@publication:name"/> (<xsl:value-of select="@publication:resource"/>)</td>
+<td>
+<xsl:apply-templates select="/data/modules:modules/modules:module[(@modules:publication = $publication) and (@modules:id = $module)]" mode="description"/>
+</td></tr>
+</xsl:template>
+
+<xsl:template match="modules:modules" mode="description">
+<xsl:value-of select="modules:description"/>
+</xsl:template>
+
+<!-- Copy -->
+<xsl:template match="@*|node()" priority="-1">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet> 



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