You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by th...@apache.org on 2006/03/07 16:39:40 UTC

svn commit: r383910 - in /lenya/trunk/src/modules/opendocument: config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/ java/src/org/apache/ java/src/org/apache/lenya/ java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/ java/src...

Author: thorsten
Date: Tue Mar  7 07:39:38 2006
New Revision: 383910

URL: http://svn.apache.org/viewcvs?rev=383910&view=rev
Log:
Added new create usecase for openDocument. This usecase is bypassing the 'normal' routine and creating a new document on basis of the odt sample. Activated the usecase in the menu.

Added:
    lenya/trunk/src/modules/opendocument/config/cocoon-xconf/usecase-create-odt.xconf   (with props)
    lenya/trunk/src/modules/opendocument/java/
    lenya/trunk/src/modules/opendocument/java/src/
    lenya/trunk/src/modules/opendocument/java/src/org/
    lenya/trunk/src/modules/opendocument/java/src/org/apache/
    lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/
    lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/
    lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/
    lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/
    lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/CreateOpenDocument.java   (with props)
    lenya/trunk/src/modules/opendocument/usecases/
    lenya/trunk/src/modules/opendocument/usecases/create.jx
Modified:
    lenya/trunk/src/modules/opendocument/config/cocoon-xconf/resource-type-opendocument.xconf
    lenya/trunk/src/modules/opendocument/config/menus/opendocument.xsp

Modified: lenya/trunk/src/modules/opendocument/config/cocoon-xconf/resource-type-opendocument.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/config/cocoon-xconf/resource-type-opendocument.xconf?rev=383910&r1=383909&r2=383910&view=diff
==============================================================================
--- lenya/trunk/src/modules/opendocument/config/cocoon-xconf/resource-type-opendocument.xconf (original)
+++ lenya/trunk/src/modules/opendocument/config/cocoon-xconf/resource-type-opendocument.xconf Tue Mar  7 07:39:38 2006
@@ -23,7 +23,7 @@
                       logger="lenya.resourcetypes.opendocument"
                       class="org.apache.lenya.cms.publication.ResourceTypeImpl">
     <creator src="org.apache.lenya.cms.authoring.DefaultBranchCreator">
-      <sample-name>fallback://lenya/modules/opendocument/templates/helloworld.odt</sample-name>
+      <sample-name>fallback://lenya/modules/opendocument/samples/helloworld.odt</sample-name>
     </creator>
     <!-- NOTE: Will be matched within sitemap of this module (modules/opendocument/sitemap.xmap) -->
     <format name="xhtml" uri="cocoon://modules/opendocument/xhtml.xml"/>

Added: lenya/trunk/src/modules/opendocument/config/cocoon-xconf/usecase-create-odt.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/config/cocoon-xconf/usecase-create-odt.xconf?rev=383910&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/config/cocoon-xconf/usecase-create-odt.xconf (added)
+++ lenya/trunk/src/modules/opendocument/config/cocoon-xconf/usecase-create-odt.xconf Tue Mar  7 07:39:38 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: usecase-create-metadata.xconf 7081 2005-11-11 13:04:23Z felix $ -->
+
+<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'module.odt.create']">
+
+  <component-instance name="module.odt.create" logger="lenya.module.odt"
+    class="org.apache.lenya.cms.site.usecases.CreateOpenDocument">
+    <view template="modules/opendocument/usecases/create.jx"/>
+  </component-instance>
+  
+</xconf>

Propchange: lenya/trunk/src/modules/opendocument/config/cocoon-xconf/usecase-create-odt.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lenya/trunk/src/modules/opendocument/config/menus/opendocument.xsp
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/config/menus/opendocument.xsp?rev=383910&r1=383909&r2=383910&view=diff
==============================================================================
--- lenya/trunk/src/modules/opendocument/config/menus/opendocument.xsp (original)
+++ lenya/trunk/src/modules/opendocument/config/menus/opendocument.xsp Tue Mar  7 07:39:38 2006
@@ -36,25 +36,28 @@
   <menu>
 
 <!-- TODO: New and edit implementation needs to be finished" -->
-<!--
+
     <menus>
       <menu i18n:attr="name" name="File">
         <block admin="false">
-          <item uc:usecase="site.create" href="?doctype=opendocument"><i18n:text>New ODT</i18n:text></item>
+          <item uc:usecase="module.odt.create" href="?doctype=opendocument"><i18n:text>New ODT</i18n:text></item>
         </block>
       </menu>
-      <menu i18n:attr="name" name="Edit">
+      <!--<menu i18n:attr="name" name="Edit">
           <xsp:logic>
             String doctype = <input:get-attribute module="page-envelope" as="string" name="document-type"/>;
             if ("opendocument".equals(doctype)) {
                 <block info="false">
-                  <item wf:event="edit" uc:usecase="download.odt" href="?"><i18n:text>Download ODT</i18n:text></item>
+                  <item wf:event="edit" uc:usecase="module.odt.download" href="?"><i18n:text>Download ODT</i18n:text></item>
+                </block>
+                <block info="false">
+                  <item wf:event="edit" uc:usecase="module.odt.upload" href="?"><i18n:text>Upload ODT</i18n:text></item>
                 </block>
             }
           </xsp:logic>
-      </menu>
+      </menu>-->
     </menus>
--->
+
     
   </menu>
 </xsp:page>

Added: lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/CreateOpenDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/CreateOpenDocument.java?rev=383910&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/CreateOpenDocument.java (added)
+++ lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/CreateOpenDocument.java Tue Mar  7 07:39:38 2006
@@ -0,0 +1,340 @@
+/*
+ * Copyright  1999-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.lenya.cms.site.usecases;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.cms.metadata.LenyaMetaData;
+import org.apache.lenya.cms.metadata.MetaData;
+import org.apache.lenya.cms.metadata.dublincore.DublinCore;
+import org.apache.lenya.cms.metadata.usecases.Metadata;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentBuilder;
+import org.apache.lenya.cms.publication.DocumentException;
+import org.apache.lenya.cms.publication.DocumentIdentityMap;
+import org.apache.lenya.cms.publication.DocumentManager;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.repository.SourceNode;
+import org.apache.lenya.cms.site.SiteManager;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+
+/**
+ * Usecase to create a document.
+ * 
+ * @version $Id: CreateDocument.java 379098 2006-02-20 11:35:10Z andreas $
+ */
+public class CreateOpenDocument extends Create {
+
+    protected static final String PARENT_ID = "parentId";
+
+    protected static final String DOCUMENT_TYPE = "doctype";
+
+    protected static final String RELATION = "relation";
+
+    protected static final String RELATIONS = "relations";
+
+    protected static final String RELATION_CHILD = "child";
+
+    protected static final String RELATION_BEFORE = "sibling before";
+
+    protected static final String RELATION_AFTER = "sibling after";
+
+    protected static final String DOCUMENT_ID_PROVIDED = "documentIdProvided";
+
+    protected static final String ODT_EXTENSION = ".odt";
+
+    protected static final String DEFAULT_INDEX = "index";
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+     */
+    protected void initParameters() {
+        super.initParameters();
+
+        Document parent = getSourceDocument();
+        if (parent == null) {
+            setParameter(PARENT_ID, "");
+        } else {
+            setParameter(PARENT_ID, parent.getId());
+            String[] languages = parent.getPublication().getLanguages();
+            setParameter(LANGUAGES, languages);
+        }
+
+        String[] relations = { RELATION_CHILD, RELATION_AFTER };
+        setParameter(RELATIONS, relations);
+        setParameter(RELATION, RELATION_CHILD);
+
+        String documentId = getParameterAsString(DOCUMENT_ID);
+        boolean provided = documentId != null && !documentId.equals("");
+        setParameter(DOCUMENT_ID_PROVIDED, Boolean.valueOf(provided));
+    }
+
+    protected String[] getSupportedRelations() {
+        return new String[] { RELATION_CHILD, RELATION_AFTER };
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
+     */
+    protected void doCheckExecutionConditions() throws Exception {
+        super.doCheckExecutionConditions();
+
+        String documentName = getParameterAsString(DOCUMENT_ID);
+        String language = getParameterAsString(LANGUAGE);
+        String relation = getParameterAsString(RELATION);
+
+        if (!Arrays.asList(getSupportedRelations()).contains(relation)) {
+            addErrorMessage("The relation '" + relation + "' is not supported.");
+        }
+
+        ServiceSelector selector = null;
+        DocumentBuilder builder = null;
+        try {
+            selector = (ServiceSelector) this.manager
+                            .lookup(DocumentBuilder.ROLE + "Selector");
+            String hint = getSourceDocument().getPublication()
+                            .getDocumentBuilderHint();
+            builder = (DocumentBuilder) selector.select(hint);
+
+            boolean provided = getParameterAsBoolean(DOCUMENT_ID_PROVIDED,
+                            false);
+            if (!provided && !builder.isValidDocumentName(documentName)) {
+                addErrorMessage("The document ID may not contain any special characters.");
+            } else {
+                Publication publication = getSourceDocument().getPublication();
+                String newDocumentId = getNewDocumentId();
+                Document document = getSourceDocument().getIdentityMap().get(
+                                publication, getSourceDocument().getArea(),
+                                newDocumentId, language);
+                if (document.exists()) {
+                    addErrorMessage("The document with ID " + newDocumentId
+                                    + " already exists.");
+                }
+            }
+        } finally {
+            if (selector != null) {
+                if (builder != null) {
+                    selector.release(builder);
+                }
+                this.manager.release(selector);
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+     */
+    protected void doExecute() throws Exception {
+
+        // create new document
+        DocumentManager documentManager = null;
+        ServiceSelector selector = null;
+        ResourceType resourceType = null;
+        try {
+
+            documentManager = (DocumentManager) this.manager
+                            .lookup(DocumentManager.ROLE);
+
+            DocumentIdentityMap map = getDocumentIdentityMap();
+            Document document = map.get(getPublication(), getArea(),
+                            getNewDocumentId(), getParameterAsString(LANGUAGE));
+            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE
+                            + "Selector");
+            resourceType = (ResourceType) selector
+                            .select(getDocumentTypeName());
+            if (getParameterAsString(SAMPLE) != null
+                            && getParameterAsString(SAMPLE).length() > 0)
+                resourceType.setSampleURI(getParameterAsString(SAMPLE));
+            // now that the source is determined, lock involved nodes
+            Node node = document.getRepositoryNode();
+            node.lock();
+            addODT(document, resourceType);
+
+            Map lenyaMetaData = new HashMap(2);
+            lenyaMetaData.put(LenyaMetaData.ELEMENT_RESOURCE_TYPE, resourceType.getName());
+            lenyaMetaData.put(LenyaMetaData.ELEMENT_CONTENT_TYPE, "xml");
+            document.getMetaDataManager().setLenyaMetaData(lenyaMetaData);
+            setMetaData(document);
+
+            // the location to navigate to after completion of usecase
+            setTargetURL(document.getCanonicalWebappURL());
+
+        } finally {
+            if (documentManager != null) {
+                this.manager.release(documentManager);
+            }
+            if (selector != null) {
+                if (resourceType != null) {
+                    selector.release(resourceType);
+                }
+                this.manager.release(selector);
+            }
+        }
+
+    }
+
+    protected void addODT(Document document, ResourceType resourceType)
+                    throws Exception {
+        SourceResolver resolver = null;
+        String publicationId = null;
+        String contentDir = null;
+        String destination = null;
+        String sourceUri = resourceType.getSampleURI();
+        SiteManager siteManager = null;
+        ServiceSelector selector = null;
+        try {
+            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
+            resolver = (SourceResolver) this.manager
+                            .lookup(SourceResolver.ROLE);
+            String pubBase = Node.LENYA_PROTOCOL
+                            + Publication.PUBLICATION_PREFIX_URI + "/";
+            String publicationsPath = document.getPublication().getSourceURI()
+                            .substring(pubBase.length());
+            publicationId = publicationsPath.split("/")[0];
+            Publication pub = PublicationUtil.getPublication(this.manager,
+                            publicationId);
+            contentDir = pub.getContentDir();
+            String urlID = "content/" + document.getArea() + document.getId()
+                            + "/" + DEFAULT_INDEX + "_"
+                            + document.getLanguage() + ODT_EXTENSION;
+            if (contentDir == null) {
+                destination = SourceNode.CONTEXT_PREFIX
+                                + Publication.PUBLICATION_PREFIX_URI + "/"
+                                + publicationId + "/" + urlID;
+            } else {
+                if (new File(contentDir).isAbsolute()) {
+                    // Absolute
+                    destination = SourceNode.FILE_PREFIX + contentDir
+                                    + File.separator + urlID;
+                } else {
+                    // Relative
+                    destination = SourceNode.CONTEXT_PREFIX + contentDir
+                                    + File.separator + urlID;
+                }
+            }
+            SourceUtil.copy(resolver, sourceUri, destination);
+            siteManager = (SiteManager) selector.select(document
+                            .getPublication().getSiteManagerHint());
+            if (siteManager.contains(document)) {
+                throw new PublicationException("The document [" + document
+                                + "] is already contained in this publication!");
+            }
+
+            siteManager.add(document);
+            siteManager.setLabel(document,
+                            getParameterAsString(DublinCore.ELEMENT_TITLE));
+            siteManager.setVisibleInNav(document, getVisibleInNav());
+        } catch (Exception e) {
+            throw new Exception(e);
+        } finally {
+            if (selector != null) {
+                if (siteManager != null) {
+                    selector.release(siteManager);
+                }
+            }
+            this.manager.release(selector);
+            this.manager.release(resolver);
+        }
+
+    }
+
+    /**
+     * @see Create#getNewDocumentName()
+     */
+    protected String getNewDocumentName() {
+        final String documentId = getParameterAsString(DOCUMENT_ID);
+        String documentName;
+        if (getParameterAsBoolean(DOCUMENT_ID_PROVIDED, false)) {
+            documentName = documentId
+                            .substring(documentId.lastIndexOf("/") + 1);
+        } else {
+            documentName = documentId;
+        }
+        return documentName;
+    }
+
+    /**
+     * @return The relation between the source document and the created
+     *         document.
+     */
+    protected String getRelation() {
+        return getParameterAsString(RELATION);
+    }
+
+    /**
+     * @see Create#getNewDocumentId()
+     */
+    protected String getNewDocumentId() {
+        if (getParameterAsBoolean(DOCUMENT_ID_PROVIDED, false)) {
+            return getParameterAsString(DOCUMENT_ID);
+        } else {
+            String relation = getRelation();
+            Document sourceDoc = getSourceDocument();
+            if (relation.equals(RELATION_CHILD)) {
+                return sourceDoc.getId() + "/" + getNewDocumentName();
+            } else if (relation.equals(RELATION_BEFORE)) {
+                return sourceDoc.getId().substring(
+                                0,
+                                sourceDoc.getId().lastIndexOf(
+                                                sourceDoc.getName()))
+                                + getNewDocumentName();
+            } else if (relation.equals(RELATION_AFTER)) {
+                return sourceDoc.getId().substring(
+                                0,
+                                sourceDoc.getId().lastIndexOf(
+                                                sourceDoc.getName()))
+                                + getNewDocumentName();
+            } else {
+                return getSourceDocument().getId() + "/" + getNewDocumentName();
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.site.usecases.Create#getDocumentTypeName()
+     */
+    protected String getDocumentTypeName() {
+        return getParameterAsString(DOCUMENT_TYPE);
+    }
+
+    /**
+     * @see org.apache.lenya.cms.site.usecases.Create#setMetaData(org.apache.lenya.cms.publication.Document)
+     */
+    protected void setMetaData(Document document) throws DocumentException {
+        super.setMetaData(document);
+
+        MetaData customMeta = document.getMetaDataManager().getCustomMetaData();
+        String[] paramNames = getParameterNames();
+        for (int i = 0; i < paramNames.length; i++) {
+            if (paramNames[i].startsWith(Metadata.CUSTOM_FORM_PREFIX)) {
+                String key = paramNames[i]
+                                .substring(Metadata.CUSTOM_FORM_PREFIX.length());
+                String value = getParameterAsString(paramNames[i]);
+                customMeta.addValue(key, value);
+            }
+        }
+    }
+}

Propchange: lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/CreateOpenDocument.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: lenya/trunk/src/modules/opendocument/usecases/create.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/usecases/create.jx?rev=383910&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/usecases/create.jx (added)
+++ lenya/trunk/src/modules/opendocument/usecases/create.jx Tue Mar  7 07:39:38 2006
@@ -0,0 +1,236 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2005 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: create.jx 376630 2006-02-10 10:58:23Z thorsten $ -->
+
+<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" 
+  xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0" 
+  xmlns="http://www.w3.org/1999/xhtml" 
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
+  
+  <page:title><i18n:text>New Document</i18n:text></page:title>
+  <page:body>
+    <div class="lenya-box">
+      <div class="lenya-box-title">
+        <i18n:text>New Document</i18n:text>
+      </div>
+      
+      <jx:import uri="fallback://lenya/usecases/templates/messages.jx"/>
+      
+      <div class="lenya-box-body">
+        <form id="form-create">
+          <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
+          <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
+          <table class="lenya-table-noborder">
+            <jx:if test="${!usecase.getParameter('documentIdProvided')}">
+              <tr>
+                <td class="lenya-entry-caption">
+                  <i18n:text>Parent ID</i18n:text>:</td>
+                <td>
+                  <jx:out value="${usecase.getParameter('parentId')}"/>
+                </td>
+              </tr>
+            </jx:if>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="documentId"><i18n:text>Document ID</i18n:text>*: </label></td>
+              <td>
+                <jx:choose>
+                  <jx:when test="${usecase.getParameter('documentIdProvided')}">
+                    <jx:out value="${usecase.getParameter('documentId')}"/>
+                  </jx:when>
+                  <jx:otherwise>
+                    <input class="lenya-form-element" type="text" name="documentId" value="${usecase.getParameter('documentId')}"/>
+                    <br/> (<i18n:text>No whitespace, no special characters</i18n:text>)
+                  </jx:otherwise>
+                </jx:choose>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="title"><i18n:text>Navigation Title</i18n:text>*: </label></td>
+              <td>
+                <input class="lenya-form-element" type="text" name="title" value="${usecase.getParameter('title')}"/>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="visibleinnav"><i18n:text>Document visible in Navigation</i18n:text>*: </label></td>
+              <jx:set var="visible" value="yes"/>
+              <jx:if test="${usecase.getParameter('visibleInNav').equals('false')}">
+                <jx:set var="visible" value="no"/>
+              </jx:if> 
+              <td>
+                <select class="lenya-form-element" name="visibleInNav">
+                  <jx:choose>
+                    <jx:when test="${visible.equals('yes')}">
+                      <option value="true" selected="selected"><i18n:text>yes</i18n:text></option>
+                      <option value="false"><i18n:text>no</i18n:text></option>
+                    </jx:when>
+                    <jx:otherwise>
+                      <option value="true"><i18n:text>yes</i18n:text></option>
+                      <option value="false" selected="selected"><i18n:text>no</i18n:text></option>
+                    </jx:otherwise>
+                  </jx:choose>
+                </select>
+              </td>
+            </tr>
+            <jx:if test="${!usecase.getParameter('documentIdProvided')}">
+              <tr>
+                <td class="lenya-entry-caption">
+                  <label for="relation"><i18n:text>Relation</i18n:text>*: </label>
+                </td>
+                <td>
+                  <jx:forEach var="relation" items="${usecase.getParameter('relations')}">
+                    <jx:choose>
+                      <jx:when test="${relation.equals(usecase.getParameter('relation'))}">
+                        <input type="radio" name="relation" value="${relation}" checked="checked"/><i18n:text>${relation}</i18n:text>
+                      </jx:when>
+                      <jx:otherwise>
+                        <input type="radio" name="relation" value="${relation}"/><i18n:text>${relation}</i18n:text>
+                      </jx:otherwise>
+                    </jx:choose>
+                  </jx:forEach>
+                </td>
+              </tr>
+            </jx:if>
+            <jx:set var="languages" value="${usecase.getParameter('languages')}"/>
+            <jx:choose>
+              <jx:when test="${languages.size() &gt; 1}">            
+                <tr>
+                  <td class="lenya-entry-caption">
+                    <label for="language"><i18n:text>Language</i18n:text>*: </label></td>
+                  <td>
+                    <select class="lenya-form-element" name="language">
+                      <jx:forEach var="language" items="${usecase.getParameter('languages')}">
+                        <option value="${language}">${language}</option>
+                       </jx:forEach>
+                    </select>
+                  </td>
+                </tr>
+              </jx:when>
+              <jx:otherwise>
+                <tr>
+                  <td colspan="2">
+                    <jx:set var="language" value="${languages[0]}"/>
+                    <input type="hidden" name="language" value="${language}"/>
+                  </td>
+                </tr>
+              </jx:otherwise>
+            </jx:choose>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="creator"><i18n:text>Creator</i18n:text>:</label></td>
+              <td>
+                <input class="lenya-form-element" type="text" name="creator" value="${usecase.getParameter('creator')}"/>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="subject"><i18n:text>Subject</i18n:text>:</label></td>
+              <td>
+                <input class="lenya-form-element" type="text" name="subject" value="${usecase.getParameter('subject')}"/>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="publisher"><i18n:text>Publisher</i18n:text>:</label></td>
+              <td>
+                <input class="lenya-form-element" type="text" name="publisher" value="${usecase.getParameter('publisher')}"/>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption">
+                <i18n:text>Date</i18n:text>:</td>
+              <td>
+                <jx:out value="${usecase.getParameter('date')}"/>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption">
+                <label for="rights"><i18n:text>Rights</i18n:text>:</label></td>
+              <td>
+                <input class="lenya-form-element" type="text" name="rights" value="${usecase.getParameter('rights')}"/>
+              </td>
+            </tr>
+            <tr>
+              <td class="lenya-entry-caption"><label for="myMeta"><i18n:text>My
+                custom metadata</i18n:text>:</label></td>
+              <td>
+                <input type="text" id="myMeta" name="meta.custom.myMeta"
+                  class="lenya-form-element"
+                  value="${usecase.getParameter('meta.custom.myMeta')}"/>
+              </td>
+            </tr>
+            <jx:set var="resourceTypes" value="${usecase.getParameter('resourceTypes')}"/>
+            <jx:if test="${resourceTypes.size()  &gt; 0}">
+              <tr>
+                <td class="lenya-entry-caption">
+                  <label for="sample"><i18n:text>Resource Type</i18n:text>:</label></td>
+                <td>
+                  <select name="doctype">
+                    <jx:forEach var="item" items="${resourceTypes}">
+                      <jx:choose>
+                        <jx:when test="${usecase.getParameter('doctype').equals(item)}">
+                          <option value="${item}" selected="selected">${item}</option>
+                        </jx:when>
+                        <jx:otherwise>
+                          <option value="${item}">${item}</option>
+                        </jx:otherwise>
+                      </jx:choose>
+                    </jx:forEach>
+                  </select>
+                </td>
+              </tr>
+            </jx:if>
+            <jx:set var="samples" value="${usecase.getParameter('samples')}"/>
+            <jx:if test="${samples.size() &gt; 0}">
+              <tr>
+                <td class="lenya-entry-caption">
+                  <label for="sample"><i18n:text>Page Layout</i18n:text>:</label></td>
+                <td>
+                  <jx:forEach var="item" items="${samples}">
+                    <jx:choose>
+                      <jx:when test="${usecase.getParameter('sample').equals(item)}">
+                        <input type="radio" name="sample" value="${item}" checked="checked"/>${item}<br />
+                      </jx:when>
+                      <jx:otherwise>
+                        <input type="radio" name="sample" value="${item}"/>${item}<br />
+                      </jx:otherwise>
+                    </jx:choose>
+                  </jx:forEach>
+                </td>
+              </tr>
+            </jx:if>  
+            <tr>
+              <td class="lenya-entry-caption">* <i18n:text>required fields</i18n:text>
+              </td>
+            </tr>
+            <tr>
+              <td/>
+              <td>
+                <input i18n:attr="value" type="submit" name="submit" value="Create"/>
+                &#160;
+                <input i18n:attr="value" type="submit" name="cancel" value="Cancel"/>
+              </td>
+            </tr>
+          </table>
+        </form>
+      </div>
+    </div>
+  </page:body>
+</page:page>



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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Andreas Hartmann <an...@apache.org>.
Michael Wechner wrote:
> Andreas Hartmann wrote:
> 
>> [...]
>>
>>  
>>
>>>> - the resource type can be asked for the path to read the document from
>>>>  (or maybe it is sufficient to ask the resource type for the
>>>>  file extension)
>>>>     
>>> I dunno understand, can you explain a bit more.
>>>   
>>
>> We have a circular dependency:
>>
>> - The resource type is stored in the meta data.
>> - The location of the meta data is determined by the DocIdToPathMapper.
>> - The DocIdToPathMapper should be determined by the resource type.
>>
>> That's why we have to break a dependency. The easiest one
>> to break is the dependency from the meta data location to
>> the DocIdToPathMapper. We could use a generic location for
>> meta files, without using the mapper. Just something like
>>
>>  {document-id}.{language}.meta
>>  
>>
> 
> why not have something like
> 
> .lenya/meta/{document-id}
> 
> whereas the ".lenya" would be configurable?

The best would be to use UUIDs, otherwise the meta data files
have to be moved when documents are move.

> (this path could also be used within a JCR repo)
>
> It seems to me that SVN shows how nicely this can be
> done and how clear it separates ones data from the managing
> system.

Good point. The hidden directories certainly make sense.

-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Andreas Hartmann <an...@apache.org>.
Michael Wechner wrote:
> Andreas Hartmann wrote:
> 
>> [...]
>>
>>  
>>
>>>> - the resource type can be asked for the path to read the document from
>>>>  (or maybe it is sufficient to ask the resource type for the
>>>>  file extension)
>>>>     
>>> I dunno understand, can you explain a bit more.
>>>   
>>
>> We have a circular dependency:
>>
>> - The resource type is stored in the meta data.
>> - The location of the meta data is determined by the DocIdToPathMapper.
>> - The DocIdToPathMapper should be determined by the resource type.
>>
>> That's why we have to break a dependency. The easiest one
>> to break is the dependency from the meta data location to
>> the DocIdToPathMapper. We could use a generic location for
>> meta files, without using the mapper. Just something like
>>
>>  {document-id}.{language}.meta
>>  
>>
> 
> why not have something like
> 
> .lenya/meta/{document-id}
> 
> whereas the ".lenya" would be configurable?
> (this path could also be used within a JCR repo)

Just FYI: The JCRSourceNode uses JCR properties to store the
meta data, so no special path is needed.

-- Andreas



-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Michael Wechner <mi...@wyona.com>.
Andreas Hartmann wrote:

>[...]
>
>  
>
>>>- the resource type can be asked for the path to read the document from
>>>  (or maybe it is sufficient to ask the resource type for the
>>>  file extension)
>>>      
>>>
>>I dunno understand, can you explain a bit more.
>>    
>>
>
>We have a circular dependency:
>
>- The resource type is stored in the meta data.
>- The location of the meta data is determined by the DocIdToPathMapper.
>- The DocIdToPathMapper should be determined by the resource type.
>
>That's why we have to break a dependency. The easiest one
>to break is the dependency from the meta data location to
>the DocIdToPathMapper. We could use a generic location for
>meta files, without using the mapper. Just something like
>
>  {document-id}.{language}.meta
>  
>

why not have something like

.lenya/meta/{document-id}

whereas the ".lenya" would be configurable?
(this path could also be used within a JCR repo)

It seems to me that SVN shows how nicely this can be
done and how clear it separates ones data from the managing
system.

Michi

>This way, we can
>
>- read the meta file
>- determine the resource type
>- call resourceType.getPathMapper().getPath(document)
>
>which will return /foo/bar/index_en.odt for the ODT resource type.
>
>-- Andreas
>
>--------------------------------------------------------------
>Andreas Hartmann     andreas.hartmann@wyona.com +41 1 272 9161
>                     Wyona AG, Hardstrasse 219, CH-8005 Zurich
>Open Source CMS      http://www.wyona.org http://www.wyona.com
>--------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
>For additional commands, e-mail: dev-help@lenya.apache.org
>
>
>  
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Andreas Hartmann <an...@apache.org>.
[...]

>> - the resource type can be asked for the path to read the document from
>>   (or maybe it is sufficient to ask the resource type for the
>>   file extension)
>
> I dunno understand, can you explain a bit more.

We have a circular dependency:

- The resource type is stored in the meta data.
- The location of the meta data is determined by the DocIdToPathMapper.
- The DocIdToPathMapper should be determined by the resource type.

That's why we have to break a dependency. The easiest one
to break is the dependency from the meta data location to
the DocIdToPathMapper. We could use a generic location for
meta files, without using the mapper. Just something like

  {document-id}.{language}.meta

This way, we can

- read the meta file
- determine the resource type
- call resourceType.getPathMapper().getPath(document)

which will return /foo/bar/index_en.odt for the ODT resource type.

-- Andreas

--------------------------------------------------------------
Andreas Hartmann     andreas.hartmann@wyona.com +41 1 272 9161
                     Wyona AG, Hardstrasse 219, CH-8005 Zurich
Open Source CMS      http://www.wyona.org http://www.wyona.com
--------------------------------------------------------------

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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler wrote:
> El jue, 09-03-2006 a las 09:58 +0100, Andreas Hartmann escribió:
>> Thorsten Scherler wrote:
>>
>> [...]
>>
>>>> btw, you might just want to improve the line above by using the lenya 
>>>> protocol, etc. ;-)
>>> Well http://lenya.apache.org/1_4/reference/protocols/lenya.html
>>> "The resolution of the URI is based on the context: protocol handler."
>>> so not an option.
>> That's not the whole story. The lenya:// protocol just points to respository
>> nodes. Whether the nodes use context:// sources, or JCR nodes, or whatever,
>> depends on the NodeFactory you use.
>>
> 
> Does that mean that I can get with 
> Node node = getRepositoryNode(destination);
> node.lock();
> any given destination uri?

I don't quite understand what you mean with "destination URI" ...
You can access all nodes which are provided by the NodeFactory.

[...]

>>> Further it does not solve the "custom DocumentIdToPathMapper" problem.
>> Yes, which is the root of all evil in this issue. We have to solve it,
>> then the problems will vanish.
> 
> Ok, then we should start the meta data stuff.

+1

-- Andreas

-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Thorsten Scherler <th...@apache.org>.
El jue, 09-03-2006 a las 09:58 +0100, Andreas Hartmann escribió:
> Thorsten Scherler wrote:
> 
> [...]
> 
> >> btw, you might just want to improve the line above by using the lenya 
> >> protocol, etc. ;-)
> > 
> > Well http://lenya.apache.org/1_4/reference/protocols/lenya.html
> > "The resolution of the URI is based on the context: protocol handler."
> > so not an option.
> 
> That's not the whole story. The lenya:// protocol just points to respository
> nodes. Whether the nodes use context:// sources, or JCR nodes, or whatever,
> depends on the NodeFactory you use.
> 

Does that mean that I can get with 
Node node = getRepositoryNode(destination);
node.lock();
any given destination uri?

> 
> > lenya-doc http://lenya.apache.org/1_4/reference/protocols/lenyadoc.html
> > is assuming file extension xml as far as I understand it ATM, so not an
> > option.
> 
> That's only because the DocumentIdToPathMapper is tied to the publication
> and not to the resource type. We have already discussed that.

ok

> 
> > One could extend the above protocols though (I think best would be the
> > lenya-doc). The only protocol that I made aware of the content-dir is
> > the fallback:// but it feels like an abuse to use it to get content.
> 
> This is true. Please don't use it!

;)


> > Further it does not solve the "custom DocumentIdToPathMapper" problem.
> 
> Yes, which is the root of all evil in this issue. We have to solve it,
> then the problems will vanish.

Ok, then we should start the meta data stuff.

> -- Andreas
> 

Thanks for your feedback. :)

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler wrote:

[...]

>> btw, you might just want to improve the line above by using the lenya 
>> protocol, etc. ;-)
> 
> Well http://lenya.apache.org/1_4/reference/protocols/lenya.html
> "The resolution of the URI is based on the context: protocol handler."
> so not an option.

That's not the whole story. The lenya:// protocol just points to respository
nodes. Whether the nodes use context:// sources, or JCR nodes, or whatever,
depends on the NodeFactory you use.


> lenya-doc http://lenya.apache.org/1_4/reference/protocols/lenyadoc.html
> is assuming file extension xml as far as I understand it ATM, so not an
> option.

That's only because the DocumentIdToPathMapper is tied to the publication
and not to the resource type. We have already discussed that.


> One could extend the above protocols though (I think best would be the
> lenya-doc). The only protocol that I made aware of the content-dir is
> the fallback:// but it feels like an abuse to use it to get content.

This is true. Please don't use it!


> Further it does not solve the "custom DocumentIdToPathMapper" problem.

Yes, which is the root of all evil in this issue. We have to solve it,
then the problems will vanish.

-- Andreas

-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Thorsten Scherler <th...@wyona.com>.
El mié, 08-03-2006 a las 00:42 +0100, Michael Wechner escribió:
> Thorsten Scherler wrote:
> 
> >El mar, 07-03-2006 a las 17:00 +0100, Thorsten Scherler escribió:
> >  
> >
> >>El mar, 07-03-2006 a las 16:49 +0100, Andreas Hartmann escribió:
> >>    
> >>
> >>>>+            String urlID = "content/" + document.getArea() + document.getId()
> >>>>+                            + "/" + DEFAULT_INDEX + "_"
> >>>>+                            + document.getLanguage() + ODT_EXTENSION;
> >>>>        
> >>>>
> >>>:(
> >>>
> >>>This code will break with a custom DocumentIdToPathMapper.
> >>>      
> >>>
> >>Yeah, I know. :(
> >>    
> >>
> >
> >BTW that is not the only part of this module. Like I said in the other
> >thread you can find in lenya-trunk/src/modules/opendocument/sitemap.xmap
> > <map:generate
> >src="zip:context://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}/{page-envelope:document-id}/index_{page-envelope:document-language}.odt!/content.xml"/>
> >
> >You are right, that does not make the above code better but since the
> >usages is already limited I just used this knowledge. ;)
> >  
> >
> 
> btw, you might just want to improve the line above by using the lenya 
> protocol, etc. ;-)

Well http://lenya.apache.org/1_4/reference/protocols/lenya.html
"The resolution of the URI is based on the context: protocol handler."
so not an option.

lenya-doc http://lenya.apache.org/1_4/reference/protocols/lenyadoc.html
is assuming file extension xml as far as I understand it ATM, so not an
option.

One could extend the above protocols though (I think best would be the
lenya-doc). The only protocol that I made aware of the content-dir is
the fallback:// but it feels like an abuse to use it to get content.
Further it does not solve the "custom DocumentIdToPathMapper" problem.

I will have a closer look now on the lenya-doc.

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Michael Wechner <mi...@wyona.com>.
Thorsten Scherler wrote:

>El mar, 07-03-2006 a las 17:00 +0100, Thorsten Scherler escribió:
>  
>
>>El mar, 07-03-2006 a las 16:49 +0100, Andreas Hartmann escribió:
>>    
>>
>>>>+            String urlID = "content/" + document.getArea() + document.getId()
>>>>+                            + "/" + DEFAULT_INDEX + "_"
>>>>+                            + document.getLanguage() + ODT_EXTENSION;
>>>>        
>>>>
>>>:(
>>>
>>>This code will break with a custom DocumentIdToPathMapper.
>>>      
>>>
>>Yeah, I know. :(
>>    
>>
>
>BTW that is not the only part of this module. Like I said in the other
>thread you can find in lenya-trunk/src/modules/opendocument/sitemap.xmap
> <map:generate
>src="zip:context://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}/{page-envelope:document-id}/index_{page-envelope:document-language}.odt!/content.xml"/>
>
>You are right, that does not make the above code better but since the
>usages is already limited I just used this knowledge. ;)
>  
>

btw, you might just want to improve the line above by using the lenya 
protocol, etc. ;-)

Michi

>salu2
>  
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Thorsten Scherler <th...@wyona.com>.
El mar, 07-03-2006 a las 17:00 +0100, Thorsten Scherler escribió:
> El mar, 07-03-2006 a las 16:49 +0100, Andreas Hartmann escribió:
> > > +            String urlID = "content/" + document.getArea() + document.getId()
> > > +                            + "/" + DEFAULT_INDEX + "_"
> > > +                            + document.getLanguage() + ODT_EXTENSION;
> > 
> > :(
> > 
> > This code will break with a custom DocumentIdToPathMapper.
> 
> Yeah, I know. :(

BTW that is not the only part of this module. Like I said in the other
thread you can find in lenya-trunk/src/modules/opendocument/sitemap.xmap
 <map:generate
src="zip:context://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}/{page-envelope:document-id}/index_{page-envelope:document-language}.odt!/content.xml"/>

You are right, that does not make the above code better but since the
usages is already limited I just used this knowledge. ;)

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Thorsten Scherler <th...@wyona.com>.
El mar, 07-03-2006 a las 16:49 +0100, Andreas Hartmann escribió:
> > +            String urlID = "content/" + document.getArea() + document.getId()
> > +                            + "/" + DEFAULT_INDEX + "_"
> > +                            + document.getLanguage() + ODT_EXTENSION;
> 
> :(
> 
> This code will break with a custom DocumentIdToPathMapper.

Yeah, I know. :(

> I agree that there's no clean way to do this ATM - but IMO it would
> be a better workaround to use the extension .xml instead of .odt.

Hmm, the problem is that you cannot create the document (even with .xml)
since we assume a sample (in xml) in the DefaultCreator.java. 

I could rewrite this part to Input/OutputStream, but I am unsure whether
that is the way to go.

> Maybe we find a way to allow resource type based mappers.
> A solution would be to
> 
> - use a common syntax for meta data paths, independent from the mapper:
>   /foo/bar.en.meta instead of /foo/bar/index_en.meta

hmm, I am all for a flat but that will cause confusion if the doc would
still resist in /foo/bar/index_en.xml.

> 
> - this way, we can determine the resource type without accessing
>   the mapper

yeah.

> - the resource type can be asked for the path to read the document from
>   (or maybe it is sufficient to ask the resource type for the
>   file extension)

I dunno understand, can you explain a bit more.

TIA

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


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


Re: svn commit: r383910 - in /lenya/trunk/src/modules/opendocument:config/cocoon-xconf/ config/menus/ java/ java/src/ java/src/org/java/src/org/apache/ java/src/org/apache/lenya/java/src/org/apache/lenya/cms/ java/src/org/apache/lenya/cms/site/java/src...

Posted by Andreas Hartmann <an...@apache.org>.
> +            String urlID = "content/" + document.getArea() + document.getId()
> +                            + "/" + DEFAULT_INDEX + "_"
> +                            + document.getLanguage() + ODT_EXTENSION;

:(

This code will break with a custom DocumentIdToPathMapper.
I agree that there's no clean way to do this ATM - but IMO it would
be a better workaround to use the extension .xml instead of .odt.

Maybe we find a way to allow resource type based mappers.
A solution would be to

- use a common syntax for meta data paths, independent from the mapper:
  /foo/bar.en.meta instead of /foo/bar/index_en.meta

- this way, we can determine the resource type without accessing
  the mapper

- the resource type can be asked for the path to read the document from
  (or maybe it is sufficient to ask the resource type for the
  file extension)

-- Andreas



--------------------------------------------------------------
Andreas Hartmann     andreas.hartmann@wyona.com +41 1 272 9161
                     Wyona AG, Hardstrasse 219, CH-8005 Zurich
Open Source CMS      http://www.wyona.org http://www.wyona.com
--------------------------------------------------------------

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