You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/01/11 13:02:44 UTC

svn commit: r495205 - in /lenya/trunk/src: modules/blog/ modules/blog/config/ modules/blog/config/cocoon-xconf/ modules/blog/java/ modules/blog/java/src/org/apache/lenya/cms/workflow/usecases/ modules/blog/usecases/ modules/blog/usecases/workflow/ pubs...

Author: andreas
Date: Thu Jan 11 04:02:42 2007
New Revision: 495205

URL: http://svn.apache.org/viewvc?view=rev&rev=495205
Log:
Moving some blog resources to blog modules. This way, usecases can be registered correctly.

Added:
    lenya/trunk/src/modules/blog/
    lenya/trunk/src/modules/blog/config/
    lenya/trunk/src/modules/blog/config/cocoon-xconf/
    lenya/trunk/src/modules/blog/config/cocoon-xconf/resourcetypes.xconf
      - copied unchanged from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/resourcetypes.xconf
    lenya/trunk/src/modules/blog/config/cocoon-xconf/usecase-workflow-delete.xconf
      - copied, changed from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecase-workflow-delete.xconf
    lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-site-create.xconf
      - copied, changed from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-site-create.xconf
    lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf
      - copied, changed from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf
    lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-publish.xconf
      - copied, changed from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-publish.xconf
    lenya/trunk/src/modules/blog/java/
      - copied from r494821, lenya/trunk/src/pubs/blog/java/
    lenya/trunk/src/modules/blog/module.xml
    lenya/trunk/src/modules/blog/usecases/
    lenya/trunk/src/modules/blog/usecases/workflow/
      - copied from r494821, lenya/trunk/src/pubs/blog/lenya/usecases/workflow/
Removed:
    lenya/trunk/src/pubs/blog/config/cocoon-xconf/resourcetypes.xconf
    lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecase-workflow-delete.xconf
    lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-site-create.xconf
    lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf
    lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-publish.xconf
    lenya/trunk/src/pubs/blog/java/
    lenya/trunk/src/pubs/blog/lenya/usecases/site/
    lenya/trunk/src/pubs/blog/lenya/usecases/workflow/
Modified:
    lenya/trunk/src/modules/blog/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java
    lenya/trunk/src/pubs/blog/config/ac/usecase-policies.xml
    lenya/trunk/src/pubs/blog/config/menus/feed.xsp

Copied: lenya/trunk/src/modules/blog/config/cocoon-xconf/usecase-workflow-delete.xconf (from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecase-workflow-delete.xconf)
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/blog/config/cocoon-xconf/usecase-workflow-delete.xconf?view=diff&rev=495205&p1=lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecase-workflow-delete.xconf&r1=494821&p2=lenya/trunk/src/modules/blog/config/cocoon-xconf/usecase-workflow-delete.xconf&r2=495205
==============================================================================
--- lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecase-workflow-delete.xconf (original)
+++ lenya/trunk/src/modules/blog/config/cocoon-xconf/usecase-workflow-delete.xconf Thu Jan 11 04:02:42 2007
@@ -25,7 +25,7 @@
     <component-instance name="blog/workflow.delete"
                         logger="lenya.usecases.workflow"
                         class="org.apache.lenya.blog.cms.usecases.Delete">
-      <view template="usecases/workflow/delete.jx"/>
+      <view template="modules/blog/usecases/workflow/delete.jx"/>
     </component-instance>
 
   </xconf>

Copied: lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-site-create.xconf (from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-site-create.xconf)
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-site-create.xconf?view=diff&rev=495205&p1=lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-site-create.xconf&r1=494821&p2=lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-site-create.xconf&r2=495205
==============================================================================
--- lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-site-create.xconf (original)
+++ lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-site-create.xconf Thu Jan 11 04:02:42 2007
@@ -18,10 +18,10 @@
 
 <!-- $Id$ -->
 
-<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'blog/site.create']">
-  <component-instance name="blog/site.create"
+<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'blog.createEntry']">
+  <component-instance name="blog.createEntry"
                       logger="lenya.site"
                       class="org.apache.lenya.cms.site.usecases.CreateBlogEntry">
-    <view template="usecases/site/create.jx"/>
+    <view template="modules/blog/usecases/site/create.jx"/>
   </component-instance>
 </xconf>

Copied: lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf (from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf)
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf?view=diff&rev=495205&p1=lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf&r1=494821&p2=lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf&r2=495205
==============================================================================
--- lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf (original)
+++ lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-deactivate.xconf Thu Jan 11 04:02:42 2007
@@ -25,7 +25,7 @@
     <component-instance name="blog/workflow.deactivate"
                         logger="lenya.usecases.workflow"
                         class="org.apache.lenya.blog.cms.usecases.Deactivate">
-      <view template="usecases/workflow/deactivate.jx"/>
+      <view template="modules/blog/usecases/workflow/deactivate.jx"/>
     </component-instance>
 
   </xconf>

Copied: lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-publish.xconf (from r494821, lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-publish.xconf)
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-publish.xconf?view=diff&rev=495205&p1=lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-publish.xconf&r1=494821&p2=lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-publish.xconf&r2=495205
==============================================================================
--- lenya/trunk/src/pubs/blog/config/cocoon-xconf/usecases-workflow-publish.xconf (original)
+++ lenya/trunk/src/modules/blog/config/cocoon-xconf/usecases-workflow-publish.xconf Thu Jan 11 04:02:42 2007
@@ -22,6 +22,6 @@
   <component-instance name="blog/workflow.publish"
                       logger="lenya.workflow"
                       class="org.apache.lenya.cms.workflow.usecases.Publish">
-    <view template="usecases/workflow/publish.jx"/>
+    <view template="modules/blog/usecases/workflow/publish.jx"/>
   </component-instance>
 </xconf>

Modified: lenya/trunk/src/modules/blog/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/blog/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java?view=diff&rev=495205&r1=494821&r2=495205
==============================================================================
--- lenya/trunk/src/modules/blog/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java (original)
+++ lenya/trunk/src/modules/blog/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java Thu Jan 11 04:02:42 2007
@@ -23,10 +23,11 @@
 import java.util.Date;
 import java.util.List;
 
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.metadata.dublincore.DublinCoreHelper;
+import org.apache.lenya.cms.publication.Area;
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.DocumentUtil;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.util.DocumentSet;
 import org.apache.lenya.cms.repository.Node;
@@ -62,20 +63,13 @@
             NodeSet subsite = SiteUtil.getSubSite(this.manager, doc.getLink().getNode());
             set.addAll(new DocumentSet(subsite.getDocuments()));
 
-            Document liveDoc = doc.getAreaVersion(Publication.LIVE_AREA);
-            if (liveDoc.exists()) {
-                NodeSet liveSubsite = SiteUtil.getSubSite(this.manager, liveDoc.getLink().getNode());
-                set.addAll(new DocumentSet(liveSubsite.getDocuments()));
-            }
-            else
-                set.add(liveDoc);
-
             Document[] documents = set.getDocuments();
             for (int i = 0; i < documents.length; i++) {
                 nodes.add(documents[i].getRepositoryNode());
             }
 
-            nodes.add(liveDoc.area().getSite().getRepositoryNode());
+            Area live = doc.getPublication().getArea(Publication.LIVE_AREA);
+            nodes.add(live.getSite().getRepositoryNode());
             return (Node[]) nodes.toArray(new Node[nodes.size()]);
 
         } catch (Exception e) {
@@ -106,8 +100,12 @@
                     getLogger(),
                     getSourceDocument(),
                     event)) {
+                String title = DublinCoreHelper.getTitle(getSourceDocument());
+                if (title == null) {
+                    title = "";
+                }
                 addErrorMessage("error-workflow-document", new String[] { getEvent(),
-                        getSourceDocument().getId() });
+                        title });
             }
 
         }
@@ -141,17 +139,18 @@
     }
 
     protected void updateFeed() throws Exception {
-        DocumentFactory map = DocumentUtil.createDocumentFactory(this.manager, getSession());
 
         Document[] docs = new Document[2];
         org.w3c.dom.Document[] doms = new org.w3c.dom.Document[2];
 
-        docs[0] = map.get(this.getSourceDocument().getPublication(),
-                Publication.LIVE_AREA,
-                "/feeds/all/index");
-        docs[1] = map.get(this.getSourceDocument().getPublication(),
-                Publication.AUTHORING_AREA,
-                "/feeds/all/index");
+        Publication pub = getSourceDocument().getPublication();
+        Area authoring = pub.getArea(Publication.AUTHORING_AREA);
+        Area live = pub.getArea(Publication.LIVE_AREA);
+        String path = "/feeds/all/index";
+        String language = pub.getDefaultLanguage();
+        
+        docs[0] = live.getSite().getNode(path).getLink(language).getDocument();
+        docs[1] = authoring.getSite().getNode(path).getLink(language).getDocument();
 
         DateFormat datefmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
         DateFormat ofsfmt = new SimpleDateFormat("Z");
@@ -162,18 +161,18 @@
                 + dateofs.substring(3, 5);
 
         for (int i = 0; i < 2; i++) {
-            doms[i] = DocumentHelper.readDocument(docs[i].getFile());
+            doms[i] = SourceUtil.readDOM(docs[i].getSourceURI(), this.manager);
             Element parent = doms[i].getDocumentElement();
             // set modified date on publish
             Element element = (Element) XPathAPI.selectSingleNode(parent,
                     "/*[local-name() = 'feed']/*[local-name() = 'modified']");
             DocumentHelper.setSimpleElementText(element, datestr);
-            DocumentHelper.writeDocument(doms[i], docs[i].getFile());
+            SourceUtil.writeDOM(doms[i], docs[i].getSourceURI(), this.manager);
         }
     }
 
     protected void updateBlogEntry(Document doc) throws Exception {
-        org.w3c.dom.Document dom = DocumentHelper.readDocument(doc.getFile());
+        org.w3c.dom.Document dom = SourceUtil.readDOM(doc.getSourceURI(), this.manager);
         Element parent = dom.getDocumentElement();
 
         DateFormat datefmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
@@ -208,7 +207,7 @@
             DocumentHelper.setSimpleElementText(element, datestr);
         }
 
-        DocumentHelper.writeDocument(dom, doc.getFile());
+        SourceUtil.writeDOM(dom, doc.getSourceURI(), this.manager);
     }
 
     /**

Added: lenya/trunk/src/modules/blog/module.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/blog/module.xml?view=auto&rev=495205
==============================================================================
--- lenya/trunk/src/modules/blog/module.xml (added)
+++ lenya/trunk/src/modules/blog/module.xml Thu Jan 11 04:02:42 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
+
+<module xmlns="http://apache.org/lenya/module/1.0">
+  <id>org.apache.lenya.modules.blog</id>
+  <depends module="org.apache.lenya.modules.usecase"/>
+  <package>org.apache.lenya.modules</package>
+  <version>0.1-dev</version>
+  <name>Blog</name>
+  <lenya-version>@lenya.version@</lenya-version>
+  <description>Blog module</description>
+</module>
\ No newline at end of file

Modified: lenya/trunk/src/pubs/blog/config/ac/usecase-policies.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/pubs/blog/config/ac/usecase-policies.xml?view=diff&rev=495205&r1=495204&r2=495205
==============================================================================
--- lenya/trunk/src/pubs/blog/config/ac/usecase-policies.xml (original)
+++ lenya/trunk/src/pubs/blog/config/ac/usecase-policies.xml Thu Jan 11 04:02:42 2007
@@ -19,7 +19,7 @@
 <!-- $Id$ -->
 
 <usecases xmlns="http://apache.org/cocoon/lenya/ac/1.0">
-  <usecase id="site.create"><role id="edit" method="grant"/></usecase>
+  <usecase id="blog.createEntry"><role id="edit" method="grant"/></usecase>
   <usecase id="editors.oneform"><role id="edit" method="grant"/></usecase>
   <usecase id="editors.forms"><role id="edit" method="grant"/></usecase>
   <usecase id="workflow.publish"><role id="edit" method="grant"/></usecase>

Modified: lenya/trunk/src/pubs/blog/config/menus/feed.xsp
URL: http://svn.apache.org/viewvc/lenya/trunk/src/pubs/blog/config/menus/feed.xsp?view=diff&rev=495205&r1=495204&r2=495205
==============================================================================
--- lenya/trunk/src/pubs/blog/config/menus/feed.xsp (original)
+++ lenya/trunk/src/pubs/blog/config/menus/feed.xsp Thu Jan 11 04:02:42 2007
@@ -38,7 +38,7 @@
   <menus>
     <menu i18n:attr="name" name="File">
       <block>
-        <item uc:usecase="site.create" href="?">Add&#160;new&#160;Entry</item>
+        <item uc:usecase="blog.createEntry" href="?">Add&#160;new&#160;Entry</item>
       </block>
       <block>
         <item uc:usecase="editors.oneform" href="../../sidebar.html">Edit Sidebar (one Form)</item>



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