You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ch...@apache.org on 2006/01/12 03:56:06 UTC
svn commit: r368246 - in /lenya/trunk/src: confpatch/ modules/webdav/
modules/webdav/config/ modules/webdav/java/ modules/webdav/java/src/
modules/webdav/java/src/org/ modules/webdav/java/src/org/apache/
modules/webdav/java/src/org/apache/lenya/ module...
Author: chestnut
Date: Wed Jan 11 18:55:51 2006
New Revision: 368246
URL: http://svn.apache.org/viewcvs?rev=368246&view=rev
Log:
cleaned up webDAV, moving it to a module
Added:
lenya/trunk/src/modules/webdav/
lenya/trunk/src/modules/webdav/config/
lenya/trunk/src/modules/webdav/config/usecases-webdav-delete.xconf (with props)
lenya/trunk/src/modules/webdav/config/usecases-webdav-filePropfind.xconf (with props)
lenya/trunk/src/modules/webdav/config/usecases-webdav-propfind.xconf (with props)
lenya/trunk/src/modules/webdav/config/usecases-webdav-put.xconf (with props)
lenya/trunk/src/modules/webdav/java/
lenya/trunk/src/modules/webdav/java/src/
lenya/trunk/src/modules/webdav/java/src/org/
lenya/trunk/src/modules/webdav/java/src/org/apache/
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/FilePropfind.java (with props)
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java (with props)
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java (with props)
lenya/trunk/src/modules/webdav/sitemap.xmap (with props)
lenya/trunk/src/modules/webdav/usecases/
lenya/trunk/src/modules/webdav/usecases/webdav/
lenya/trunk/src/modules/webdav/usecases/webdav/filePropfind.jx
lenya/trunk/src/modules/webdav/usecases/webdav/propfind.jx
lenya/trunk/src/modules/webdav/usecases/webdav/status.jx
lenya/trunk/src/modules/webdav/webdav.js (with props)
lenya/trunk/src/modules/webdav/xslt/
lenya/trunk/src/modules/webdav/xslt/NSclean.xsl (with props)
lenya/trunk/src/modules/webdav/xslt/init.xsl (with props)
lenya/trunk/src/modules/webdav/xslt/limitResponse.xsl (with props)
lenya/trunk/src/modules/webdav/xslt/lock.xsl (with props)
lenya/trunk/src/webapp/lenya/xslt/exception/forbidden.xsl (with props)
Removed:
lenya/trunk/src/webapp/lenya/pubs/default/config/usecases-webdav-delete.xconf
lenya/trunk/src/webapp/lenya/pubs/default/config/usecases-webdav-filePropfind.xconf
lenya/trunk/src/webapp/lenya/pubs/default/config/usecases-webdav-propfind.xconf
lenya/trunk/src/webapp/lenya/pubs/default/config/usecases-webdav-put.xconf
Modified:
lenya/trunk/src/confpatch/pipelines.xmap
lenya/trunk/src/confpatch/selectors.xmap
lenya/trunk/src/modules/xhtml/config/module.xconf
lenya/trunk/src/modules/xhtml/sitemap.xmap
lenya/trunk/src/webapp/global-sitemap.xmap
lenya/trunk/src/webapp/lenya/pubs/default/sitemap.xmap
Modified: lenya/trunk/src/confpatch/pipelines.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/confpatch/pipelines.xmap?rev=368246&r1=368245&r2=368246&view=diff
==============================================================================
--- lenya/trunk/src/confpatch/pipelines.xmap (original)
+++ lenya/trunk/src/confpatch/pipelines.xmap Wed Jan 11 18:55:51 2006
@@ -68,13 +68,23 @@
</map:act>
<map:act type="set-header">
<map:parameter name="WWW-Authenticate" value="Basic Realm=lenya" />
- <map:generate type="html" src="fallback://lenya/usecases/webdav/401error.html"/>
+ <map:generate src="context://lenya/content/util/empty.xml" />
+ <map:transform src="fallback://lenya/xslt/exception/forbidden.xsl">
+ <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+ <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+ <map:parameter name="area" value="{page-envelope:area}"/>
+ </map:transform>
<map:serialize type="xhtml" status-code="401"/>
</map:act>
</map:act>
<map:act type="set-header">
<map:parameter name="WWW-Authenticate" value="Basic Realm=lenya" />
- <map:generate type="html" src="fallback://lenya/usecases/webdav/401error.html"/>
+ <map:generate src="context://lenya/content/util/empty.xml" />
+ <map:transform src="fallback://lenya/xslt/exception/forbidden.xsl">
+ <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+ <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+ <map:parameter name="area" value="{page-envelope:area}"/>
+ </map:transform>
<map:serialize type="xhtml" status-code="401"/>
</map:act>
</map:match>
Modified: lenya/trunk/src/confpatch/selectors.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/confpatch/selectors.xmap?rev=368246&r1=368245&r2=368246&view=diff
==============================================================================
--- lenya/trunk/src/confpatch/selectors.xmap (original)
+++ lenya/trunk/src/confpatch/selectors.xmap Wed Jan 11 18:55:51 2006
@@ -17,15 +17,6 @@
<xmap xpath="/sitemap/components/selectors">
<map:selector logger="sitemap.selector.browser" name="client" src="org.apache.cocoon.selection.BrowserSelector">
- <browser name="webdav" useragent="UCI DAV Explorer/0.91 RPT-HTTPClient/0.3-3E"/>
- <browser name="webdav" useragent="Microsoft Data Access Internet Publishing Provider Protocol Discovery"/>
- <browser name="webdav" useragent="UCI"/>
- <browser name="webdav" useragent="DAV"/>
- <browser name="webdav" useragent="dav"/>
- <browser name="webdav" useragent="Goliath"/>
- <browser name="webdav" useragent="Contribute"/>
- <!-- cadaver -->
- <browser name="webdav" useragent="gnome-vfs/2.10.0 neon/0.24.7"/>
<browser name="explorer" useragent="MSIE"/>
<browser name="mozilla5" useragent="Mozilla/5"/>
<browser name="mozilla5" useragent="Netscape6/"/>
Added: lenya/trunk/src/modules/webdav/config/usecases-webdav-delete.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/config/usecases-webdav-delete.xconf?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/config/usecases-webdav-delete.xconf (added)
+++ lenya/trunk/src/modules/webdav/config/usecases-webdav-delete.xconf Wed Jan 11 18:55:51 2006
@@ -0,0 +1,25 @@
+<?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.
+-->
+
+ <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'webdav.delete']">
+
+ <component-instance name="webdav.delete"
+ logger="lenya.usecases.delete"
+ class="org.apache.lenya.cms.site.usecases.Delete">
+ </component-instance>
+
+ </xconf>
Propchange: lenya/trunk/src/modules/webdav/config/usecases-webdav-delete.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/config/usecases-webdav-filePropfind.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/config/usecases-webdav-filePropfind.xconf?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/config/usecases-webdav-filePropfind.xconf (added)
+++ lenya/trunk/src/modules/webdav/config/usecases-webdav-filePropfind.xconf Wed Jan 11 18:55:51 2006
@@ -0,0 +1,26 @@
+<?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.
+-->
+
+ <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'webdav.filePropfind']">
+
+ <component-instance name="webdav.filePropfind"
+ logger="lenya.publication"
+ class="org.apache.lenya.cms.usecases.webdav.FilePropfind">
+ <view template="usecases/webdav/filePropfind"/>
+ </component-instance>
+
+ </xconf>
Propchange: lenya/trunk/src/modules/webdav/config/usecases-webdav-filePropfind.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/config/usecases-webdav-propfind.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/config/usecases-webdav-propfind.xconf?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/config/usecases-webdav-propfind.xconf (added)
+++ lenya/trunk/src/modules/webdav/config/usecases-webdav-propfind.xconf Wed Jan 11 18:55:51 2006
@@ -0,0 +1,26 @@
+<?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.
+-->
+
+ <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'webdav.propfind']">
+
+ <component-instance name="webdav.propfind"
+ logger="lenya.publication"
+ class="org.apache.lenya.cms.usecases.webdav.Propfind">
+ <view template="usecases/webdav/propfind"/>
+ </component-instance>
+
+ </xconf>
Propchange: lenya/trunk/src/modules/webdav/config/usecases-webdav-propfind.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/config/usecases-webdav-put.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/config/usecases-webdav-put.xconf?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/config/usecases-webdav-put.xconf (added)
+++ lenya/trunk/src/modules/webdav/config/usecases-webdav-put.xconf Wed Jan 11 18:55:51 2006
@@ -0,0 +1,25 @@
+<?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.
+-->
+
+ <xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'webdav.put']">
+
+ <component-instance name="webdav.put"
+ logger="lenya.publication"
+ class="org.apache.lenya.cms.usecases.webdav.Put">
+ </component-instance>
+
+ </xconf>
Propchange: lenya/trunk/src/modules/webdav/config/usecases-webdav-put.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/FilePropfind.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/FilePropfind.java?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/FilePropfind.java (added)
+++ lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/FilePropfind.java Wed Jan 11 18:55:51 2006
@@ -0,0 +1,139 @@
+/*
+ * 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.usecases.webdav;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Vector;
+
+import org.apache.lenya.cms.publication.Document;
+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.URLInformation;
+import org.apache.lenya.cms.rc.RCEnvironment;
+import org.apache.lenya.cms.rc.RCML;
+import org.apache.lenya.cms.rc.RCMLEntry;
+import org.apache.lenya.cms.rc.RevisionController;
+import org.apache.lenya.cms.site.usecases.SiteUsecase;
+
+/**
+ * Usecase to display the overview tab in the site area for a document.
+ *
+ */
+public class FilePropfind extends SiteUsecase {
+
+ protected static final String DOCUMENT = "document";
+ protected static final String DOCUMENTS = "documents";
+ protected static final String SOURCEURL = "sourceURL";
+ protected static final String DATEFORMAT = "dateFormat";
+ protected static final String RC = "rc";
+
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+ */
+ protected void initParameters() {
+ super.initParameters();
+
+ Publication _publication = this.getPublication();
+
+ Vector docs = new Vector();
+ Vector checkedOut = new Vector();
+
+ String request = getSourceURL();
+
+ try {
+ // get Parameters for RC
+ String publicationPath = _publication.getDirectory().getCanonicalPath();
+ RCEnvironment rcEnvironment = RCEnvironment.getInstance(_publication.getServletContext()
+ .getCanonicalPath());
+ String rcmlDirectory = rcEnvironment.getRCMLDirectory();
+ rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
+ String backupDirectory = rcEnvironment.getBackupDirectory();
+ backupDirectory = publicationPath + File.separator + backupDirectory;
+
+ // Initialize Revision Controller
+ RevisionController rc = new RevisionController(rcmlDirectory,
+ backupDirectory,
+ publicationPath);
+
+ Document doc = getTargetDocument(false);
+ docs.add(doc);
+
+ String filename = doc.getFile().getCanonicalPath();
+ filename = filename.substring(publicationPath.length());
+ RCMLEntry entry = rc.getRCML(filename).getLatestEntry();
+ if ((entry != null) && (entry.getType() == RCML.co))
+ checkedOut.add(entry);
+ else
+ checkedOut.add(null);
+
+ setParameter(DOCUMENTS, docs);
+ setParameter(RC, checkedOut);
+ setParameter(SOURCEURL, request);
+ SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz");
+ setParameter(DATEFORMAT, format);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @return The area without the "info-" prefix.
+ */
+ public String getArea() {
+ URLInformation info = new URLInformation(getSourceURL());
+ return info.getArea();
+ }
+
+ /**
+ * Returns the document to be redirected to after the usecase has been completed. If the
+ * parameter <code>success</code> is false, the source document is returned (override this
+ * method to change this behaviour).
+ * @param success If the usecase was successfully completed.
+ * @return A document.
+ */
+ protected Document getTargetDocument(boolean success) {
+ Document document = (Document) getParameter(TARGET_DOCUMENT);
+ if (document == null) {
+ document = getSourceDocument();
+ }
+ return document;
+ }
+
+ private Publication publication;
+
+ /**
+ * Access to the current publication. Use this when the publication is not yet known in the
+ * usecase: e.g. when creating a global asset. When adding a resource or a child to a document,
+ * access the publication via that document's interface instead.
+ *
+ * @return the publication in which the use-case is being executed
+ */
+ protected Publication getPublication() {
+ if (this.publication == null) {
+ try {
+ this.publication = PublicationUtil.getPublicationFromUrl(this.manager, getSourceURL());
+ } catch (PublicationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return this.publication;
+ }
+
+}
Propchange: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/FilePropfind.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java (added)
+++ lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java Wed Jan 11 18:55:51 2006
@@ -0,0 +1,215 @@
+/*
+ * 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.usecases.webdav;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Vector;
+import java.text.SimpleDateFormat;
+
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.lenya.cms.rc.RCEnvironment;
+import org.apache.lenya.cms.rc.RCML;
+import org.apache.lenya.cms.rc.RCMLEntry;
+import org.apache.lenya.cms.rc.RevisionController;
+import org.apache.lenya.cms.site.SiteManager;
+import org.apache.lenya.cms.site.usecases.SiteUsecase;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentIdentifier;
+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.Resource;
+import org.apache.lenya.cms.publication.ResourcesManager;
+import org.apache.lenya.cms.publication.URLInformation;
+import org.apache.lenya.cms.publication.DocumentBuilder;
+
+/**
+ * Usecase to provide WebDAV propfind support for a document.
+ *
+ */
+public class Propfind extends SiteUsecase {
+
+ protected static final String DOCUMENT = "document";
+ protected static final String DOCUMENTS = "documents";
+ protected static final String SOURCEURL = "sourceURL";
+ protected static final String DATEFORMAT = "dateFormat";
+ protected static final String RC = "rc";
+
+ /**
+ * Ctor.
+ */
+ public Propfind() {
+ super();
+ }
+
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+ */
+ protected void initParameters() {
+ super.initParameters();
+
+ Publication _publication = this.getPublication();
+
+ ServiceSelector siteManagerSelector = null;
+ ServiceSelector docBuilderSelector = null;
+ SiteManager siteManager = null;
+ ResourcesManager resourcesManager = null;
+ DocumentBuilder docBuilder = null;
+ Vector docs = new Vector();
+ Vector checkedOut = new Vector();
+
+ String request = getSourceURL();
+ if (request.endsWith(".html"))
+ request = request.substring(0, request.indexOf(".html"));
+ if (!request.endsWith("/"))
+ request = request + "/";
+ if (request.indexOf("webdav") > -1) {
+ request = request.replaceFirst("webdav","authoring");
+ }
+ try {
+ // get Parameters for RC
+ String publicationPath = _publication.getDirectory().getCanonicalPath();
+ RCEnvironment rcEnvironment = RCEnvironment.getInstance(_publication.getServletContext()
+ .getCanonicalPath());
+ String rcmlDirectory = rcEnvironment.getRCMLDirectory();
+ rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
+ String backupDirectory = rcEnvironment.getBackupDirectory();
+ backupDirectory = publicationPath + File.separator + backupDirectory;
+
+ // Initialize Revision Controller
+ RevisionController rc = new RevisionController(rcmlDirectory,
+ backupDirectory,
+ publicationPath);
+
+ siteManagerSelector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE
+ + "Selector");
+ siteManager = (SiteManager) siteManagerSelector.select(_publication.getSiteManagerHint());
+ Document[] documents = siteManager.getDocuments(getDocumentIdentityMap(),
+ _publication,
+ Publication.AUTHORING_AREA);
+
+ docBuilderSelector = (ServiceSelector) this.manager.lookup(DocumentBuilder.ROLE
+ + "Selector");
+ docBuilder = (DocumentBuilder) docBuilderSelector.select(_publication.getDocumentBuilderHint());
+
+ for (int i = 0; i < documents.length; i++) {
+ String test = documents[i].getCanonicalWebappURL().replaceFirst("/[^/]*.html", "");
+ if (!test.endsWith("/"))
+ test = test + "/";
+ if (test.equals(request)) {
+ docs.add(documents[i]);
+
+ String filename = documents[i].getFile().getCanonicalPath();
+ filename = filename.substring(publicationPath.length());
+ RCMLEntry entry = rc.getRCML(filename).getLatestEntry();
+ if ((entry != null) && (entry.getType() == RCML.co))
+ checkedOut.add(entry);
+ else
+ checkedOut.add(null);
+ // get additional language documents
+ String[] langs = documents[i].getLanguages();
+ for (int j = 0; j < langs.length; j++) {
+ if (!(langs[j].equals(documents[i].getLanguage()))) {
+ String url = documents[i].getCanonicalWebappURL()
+ .replaceFirst(".html$", "_" + langs[j] + ".html");
+ DocumentIdentifier identifier = docBuilder.getIdentitfier(url);
+ Document langDoc = docBuilder.buildDocument(documents[i].getIdentityMap(),
+ identifier);
+ docs.add(langDoc);
+
+ filename = langDoc.getFile().getCanonicalPath();
+ filename = filename.substring(publicationPath.length());
+ entry = rc.getRCML(filename).getLatestEntry();
+ if ((entry != null) && (entry.getType() == RCML.co))
+ checkedOut.add(entry);
+ else
+ checkedOut.add(null);
+ }
+ }
+ }
+ }
+
+ // get assets if we are currently looking at a document
+ if (!request.equals("/" + _publication.getId() + "/authoring/")) {
+ String url = request.substring(0, request.length() - 1) + ".html";
+ DocumentIdentifier identifier = docBuilder.getIdentitfier(url);
+ Document currentDoc = docBuilder.buildDocument(getDocumentIdentityMap(), identifier);
+ if (currentDoc.exists()) {
+ resourcesManager = (ResourcesManager) this.manager.lookup(ResourcesManager.ROLE);
+ Resource[] resources = resourcesManager.getResources(currentDoc);
+ setParameter("assets", Arrays.asList(resources));
+ }
+ }
+
+ setParameter(DOCUMENTS, docs);
+ setParameter(RC, checkedOut);
+ setParameter(SOURCEURL, request);
+ SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz");
+ setParameter(DATEFORMAT, format);
+ Date rootModDate = new Date();
+ setParameter("rootModDate", rootModDate);
+ String defaultLang = _publication.getDefaultLanguage();
+ setParameter("defaultLang", defaultLang);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (siteManagerSelector != null) {
+ if (siteManager != null) {
+ siteManagerSelector.release(siteManager);
+ }
+ this.manager.release(siteManagerSelector);
+ }
+ if (docBuilderSelector != null) {
+ if (docBuilder != null) {
+ docBuilderSelector.release(docBuilder);
+ }
+ this.manager.release(docBuilderSelector);
+ }
+ }
+ }
+
+ /**
+ * @return The area without the "info-" prefix.
+ */
+ public String getArea() {
+ return Publication.AUTHORING_AREA;
+ }
+
+ private Publication publication;
+
+ /**
+ * Access to the current publication. Use this when the publication is not yet known in the
+ * usecase: e.g. when creating a global asset. When adding a resource or a child to a document,
+ * access the publication via that document's interface instead.
+ *
+ * @return the publication in which the use-case is being executed
+ */
+ protected Publication getPublication() {
+ if (this.publication == null) {
+ try {
+ this.publication = PublicationUtil.getPublicationFromUrl(this.manager, getSourceURL());
+ } catch (PublicationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return this.publication;
+ }
+
+}
Propchange: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java (added)
+++ lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java Wed Jan 11 18:55:51 2006
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.lenya.cms.usecases.webdav;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.metadata.dublincore.DublinCore;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentException;
+import org.apache.lenya.cms.publication.DocumentIdToPathMapper;
+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.publication.util.DocumentSet;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.site.SiteStructure;
+import org.apache.lenya.cms.site.SiteUtil;
+import org.apache.lenya.cms.usecase.DocumentUsecase;
+import org.apache.lenya.cms.usecase.UsecaseException;
+import org.apache.lenya.cms.usecase.xml.UsecaseErrorHandler;
+import org.apache.lenya.workflow.WorkflowManager;
+import org.apache.lenya.xml.DocumentHelper;
+import org.apache.lenya.xml.Schema;
+import org.apache.lenya.xml.ValidationUtil;
+
+/**
+ * Supports WebDAV PUT.
+ *
+ */
+public class Put extends DocumentUsecase {
+
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+ */
+ protected void doExecute() throws Exception {
+ super.doExecute();
+ SourceResolver resolver = null;
+ WorkflowManager wfManager = null;
+
+ try {
+ resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
+
+ Document doc = getSourceDocument();
+ // sanity check
+ if (doc == null)
+ throw new IllegalArgumentException("illegal usage, source document may not be null");
+
+ if (!doc.exists()) {
+ DocumentManager documentManager = null;
+ ServiceSelector selector = null;
+ ResourceType resourceType = null;
+ try {
+ selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
+
+ documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
+
+ DocumentIdentityMap map = getDocumentIdentityMap();
+ Document document = map.get(getPublication(),
+ doc.getArea(),
+ doc.getId(),
+ doc.getLanguage());
+
+ resourceType = (ResourceType) selector.select("xhtml");
+ documentManager.add(document, resourceType, doc.getName(), true, null);
+
+ setMetaData(document);
+ doc = document;
+ } finally {
+ if (documentManager != null) {
+ this.manager.release(documentManager);
+ }
+ if (selector != null) {
+ if (resourceType != null) {
+ selector.release(resourceType);
+ }
+ this.manager.release(selector);
+ }
+ }
+ }
+
+ DocumentIdToPathMapper mapper = doc.getPublication().getPathMapper();
+ String path = mapper.getPath(doc.getId(), getSourceDocument().getLanguage());
+ String sourceUri = doc.getSourceURI();
+ String pubId = doc.getPublication().getId();
+ String uploadSourceUri = "cocoon:/request/PUT";
+
+ // lets copy the source to temp work area
+ String tempSourceUri = "context://lenya/pubs/" + pubId + "/work/webdav/content/"
+ + doc.getArea() + "/" + path + ".tmp";
+ tempSourceUri = tempSourceUri.substring("lenya://".length());
+ tempSourceUri = "context://" + tempSourceUri;
+
+ try {
+ SourceUtil.copy(resolver, uploadSourceUri, tempSourceUri, true);
+ } catch (Exception e) {
+ addErrorMessage("invalid source xml");
+ }
+
+ if (!hasErrors()) {
+
+ Source tempSource = resolver.resolveURI(tempSourceUri);
+ if (!tempSource.exists()) {
+ throw new IllegalArgumentException("The temp file [" + tempSource.getURI()
+ + "] does not exist.");
+ }
+
+ // validity check
+ ResourceType resourceType = doc.getResourceType();
+ Schema schema = resourceType.getSchema();
+
+ org.w3c.dom.Document xmlDoc = DocumentHelper.readDocument(tempSource.getInputStream());
+ ValidationUtil.validate(this.manager, xmlDoc, schema, new UsecaseErrorHandler(this));
+
+ if (SourceUtil.exists(tempSourceUri, this.manager)) {
+ SourceUtil.copy(resolver, tempSourceUri, sourceUri, true);
+ SourceUtil.delete(tempSourceUri, this.manager);
+ }
+
+ }
+
+ } finally {
+ if (resolver != null) {
+ this.manager.release(resolver);
+ }
+ if (wfManager != null) {
+ this.manager.release(wfManager);
+ }
+ }
+ }
+
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
+ */
+ protected Node[] getNodesToLock() throws UsecaseException {
+ try {
+ List nodes = new ArrayList();
+ Document doc = getSourceDocument();
+
+ DocumentSet set = SiteUtil.getSubSite(this.manager, doc);
+ Document[] documents = set.getDocuments();
+ for (int i = 0; i < documents.length; i++) {
+ nodes.add(documents[i].getRepositoryNode());
+ }
+
+ SiteStructure structure = SiteUtil.getSiteStructure(this.manager, getSourceDocument());
+ nodes.add(structure.getRepositoryNode());
+
+ return (Node[]) nodes.toArray(new Node[nodes.size()]);
+
+ } catch (Exception e) {
+ throw new UsecaseException(e);
+ }
+ }
+
+ /**
+ * Sets the meta data of the created document.
+ *
+ * @param document The document.
+ * @throws DocumentException if an error occurs.
+ */
+ protected void setMetaData(Document document) throws DocumentException {
+
+ if (document == null)
+ throw new IllegalArgumentException("parameter document may not be null");
+
+ Map dcMetaData = new HashMap();
+ dcMetaData.put(DublinCore.ELEMENT_TITLE, document.getName());
+ dcMetaData.put(DublinCore.ELEMENT_CREATOR, "");
+ dcMetaData.put(DublinCore.ELEMENT_PUBLISHER, "");
+ dcMetaData.put(DublinCore.ELEMENT_SUBJECT, "");
+ dcMetaData.put(DublinCore.ELEMENT_DATE, "");
+ dcMetaData.put(DublinCore.ELEMENT_RIGHTS, "");
+ dcMetaData.put(DublinCore.ELEMENT_LANGUAGE, document.getLanguage());
+
+ document.getMetaDataManager().setDublinCoreMetaData(dcMetaData);
+ }
+
+ private Publication publication;
+
+ /**
+ * Access to the current publication. Use this when the publication is not yet known in the
+ * usecase: e.g. when creating a global asset. When adding a resource or a child to a document,
+ * access the publication via that document's interface instead.
+ *
+ * @return the publication in which the use-case is being executed
+ */
+ protected Publication getPublication() {
+ if (this.publication == null) {
+ try {
+ this.publication = PublicationUtil.getPublicationFromUrl(this.manager,
+ getSourceURL());
+ } catch (PublicationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return this.publication;
+ }
+
+}
Propchange: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Put.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/sitemap.xmap?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/sitemap.xmap (added)
+++ lenya/trunk/src/modules/webdav/sitemap.xmap Wed Jan 11 18:55:51 2006
@@ -0,0 +1,272 @@
+<?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.
+-->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components ================================ -->
+
+ <map:components>
+ <map:matchers default="wildcard">
+ <map:matcher name="destination" src="org.apache.cocoon.matching.WildcardHeaderMatcher">
+ <header-name>Destination</header-name>
+ </map:matcher>
+ </map:matchers>
+
+ <map:serializers default="xhtml">
+ <map:serializer name="xml-get" src="org.apache.cocoon.serialization.XMLSerializer" mime-type="text/xml">
+ <encoding>utf-8</encoding>
+ <omit-xml-declaration>yes</omit-xml-declaration>
+ </map:serializer>
+ </map:serializers>
+
+ </map:components>
+
+<!-- ========================== Flowscript ================================= -->
+
+ <map:flow language="javascript">
+ <map:script src="fallback://lenya/modules/webdav/webdav.js"/>
+ </map:flow>
+
+<!-- =========================== Views ===================================== -->
+
+ <map:views>
+ <map:view name="content" from-label="content">
+ <map:serialize type="xml" />
+ </map:view>
+ </map:views>
+
+ <map:pipelines>
+
+ <map:pipeline type="noncaching">
+
+ <map:match pattern="limitResponse.xsl">
+ <map:generate type="file" src="cocoon:/request/generate"/>
+ <map:transform src="fallback://lenya/modules/webdav/xslt/limitResponse.xsl"/>
+ <map:serialize type="xml" status-code="200"/>
+ </map:match>
+
+ <!--
+ This internal sitemap fragment renders the usecase, once the
+ executeUsecase() flowscript has completed and issued a redirect,
+ which is matched here.
+ -->
+ <map:match pattern="view/*/**" internal-only="true">
+ <map:generate type="jx" src="fallback://lenya/modules/webdav/{2}.jx"/>
+ <map:transform type="i18n">
+ <map:parameter name="locale" value="{request:locale}"/>
+ </map:transform>
+ <map:transform type="xslt" src="fallback://lenya/modules/webdav/xslt/NSclean.xsl"/>
+ <map:select type="request-method">
+ <map:when test="PROPFIND">
+ <map:transform src="cocoon:/limitResponse.xsl" />
+ <map:serialize type="xml" status-code="207"/>
+ </map:when>
+ <map:otherwise>
+ <map:serialize type="xml" status-code="200"/>
+ </map:otherwise>
+ </map:select>
+ </map:match>
+
+ </map:pipeline>
+
+<!-- ========================= Private Resources =========================== -->
+
+ <map:pipeline type="noncaching" internal-only="true">
+
+ <!-- Read the request for binaries PUT -->
+ <!--
+ <map:match pattern="request/read">
+ <map:read type="request" />
+ </map:match>
+ -->
+
+ <map:match pattern="request/generate">
+ <map:generate type="stream" />
+ <map:serialize type="xml" />
+ </map:match>
+
+ <!--+
+ | If you need to check or change the XML that is being PUT
+ | you can do that here. This is the pipeline that will
+ | generate the input for the PUT method.
+ + -->
+ <map:match pattern="request/PUT">
+ <map:generate type="stream">
+ <map:parameter name="defaultContentType" value="text/xml" />
+ </map:generate>
+ <map:act type="resource-exists" src="{fallback://lenya/modules/{page-envelope:document-type}/xslt/clean-{page-envelope:document-type}.xsl}">
+ <map:transform src="{fallback://lenya/modules/{page-envelope:document-type}/xslt/clean-{page-envelope:document-type}.xsl}"/>
+ </map:act>
+ <map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
+ <map:serialize type="xml" />
+ </map:match>
+
+ </map:pipeline>
+
+<!-- ========================= Public Resources =========================== -->
+
+ <map:pipeline type="caching">
+
+ <map:match pattern="webdav">
+ <map:call function="selectMethod">
+ <map:parameter name="page" value=""/>
+ <map:parameter name="requestURI" value="{request:requestURI}" />
+ </map:call>
+ </map:match>
+ <map:match pattern="webdav/**">
+ <map:call function="selectMethod">
+ <map:parameter name="page" value="{1}"/>
+ <map:parameter name="requestURI" value="{request:requestURI}" />
+ </map:call>
+ </map:match>
+
+ <map:match pattern="{page-envelope:publication-id}">
+ <map:call function="selectMethod">
+ <map:parameter name="page" value=""/>
+ <map:parameter name="requestURI" value="{request:requestURI}" />
+ </map:call>
+ </map:match>
+ <map:match pattern="{page-envelope:publication-id}/">
+ <map:call function="selectMethod">
+ <map:parameter name="page" value=""/>
+ <map:parameter name="requestURI" value="{request:requestURI}" />
+ </map:call>
+ </map:match>
+
+ <map:match pattern="GET/**">
+ <map:call function="get">
+ <map:parameter name="forward" value="{resource-type:format-webdavGET}"/>
+ </map:call>
+ </map:match>
+
+ <map:match pattern="PROPFIND/**.html">
+ <map:match pattern="PROPFIND/**_*.html">
+ <map:act type="resource-exists" src="context://lenya/pubs/{page-envelope:publication-id}/content/authoring/{1}/index_{page-envelope:document-language}.xml">
+ <map:call function="filePropfind" >
+ <map:parameter name="last-modified" value="{page-envelope:document-lastmodified}"/>
+ </map:call>
+ </map:act>
+ </map:match>
+ <map:match pattern="PROPFIND/**.html">
+ <map:act type="resource-exists" src="context://lenya/pubs/{page-envelope:publication-id}/content/authoring/{1}/index_{page-envelope:document-language}.xml">
+ <map:call function="filePropfind" >
+ <map:parameter name="last-modified" value="{page-envelope:document-lastmodified}"/>
+ </map:call>
+ </map:act>
+ </map:match>
+ <!-- does not exist -->
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize status-code="404"/>
+ </map:match>
+
+ <map:match pattern="PROPFIND/**">
+ <map:call function="propfind" />
+ </map:match>
+
+ <map:match pattern="OPTIONS/**">
+ <map:call function="options">
+ <map:parameter name="uri" value="{request:requestURI}" />
+ </map:call>
+ </map:match>
+
+ <map:match pattern="HEAD/**.html">
+ <map:match pattern="HEAD/**_*.html">
+ <map:act type="resource-exists" src="context://lenya/pubs/{page-envelope:publication-id}/content/authoring/{1}/index_{page-envelope:document-language}.xml">
+ <map:act type="set-header">
+ <map:parameter name="Last-Modified" value="{page-envelope:document-lastmodified}" />
+ <map:call function="filePropfind" />
+ </map:act>
+ </map:act>
+ </map:match>
+ <map:match pattern="HEAD/**.html">
+ <map:act type="resource-exists" src="context://lenya/pubs/{page-envelope:publication-id}/content/authoring/{1}/index_{page-envelope:document-language}.xml">
+ <map:act type="set-header">
+ <map:parameter name="Last-Modified" value="{page-envelope:document-lastmodified}" />
+ <map:call function="filePropfind" />
+ </map:act>
+ </map:act>
+ </map:match>
+ <!-- doesn't exist -->
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize status-code="404"/>
+ </map:match>
+
+ <map:match pattern="HEAD/**">
+ <map:call function="propfind" />
+ </map:match>
+
+ </map:pipeline>
+
+ <map:pipeline type="noncaching">
+
+ <map:match pattern="checkin">
+ <map:act type="reserved-checkin">
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="423"/>
+ </map:act>
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="201" />
+ </map:match>
+
+ <map:match pattern="PUT/**.html">
+ <map:call function="put" />
+ </map:match>
+
+
+ <map:match pattern="MKCOL/**">
+ <map:call function="mkcol" />
+ </map:match>
+
+ <map:match pattern="DELETE/**">
+ <map:call function="remove" />
+ </map:match>
+
+ <map:match pattern="LOCK/**">
+ <map:select type="resource-exists">
+ <map:parameter name="prefix" value="lenya://"/>
+ <map:when test="lenya/pubs/{page-envelope:publication-id}/content/authoring/{page-envelope:document-path}">
+ <map:act type="reserved-checkout">
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="423"/>
+ </map:act>
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:transform type="xslt" src="fallback://lenya/modules/webdav/xslt/lock.xsl">
+ <map:parameter name="userid" value="{access-control:user-id}"/>
+ <map:parameter name="docid" value="{page-envelope:document-id}"/>
+ </map:transform>
+ <map:serialize type="xml" status-code="200" />
+ </map:when>
+ <map:otherwise>
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="412"/>
+ </map:otherwise>
+ </map:select>
+ </map:match>
+
+ <map:match pattern="UNLOCK/**">
+ <map:act type="reserved-checkin">
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="424"/>
+ </map:act>
+ <map:generate src="context://lenya/content/util/empty.xml"/>
+ <map:serialize type="xml" status-code="204" />
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+
+</map:sitemap>
Propchange: lenya/trunk/src/modules/webdav/sitemap.xmap
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/usecases/webdav/filePropfind.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/usecases/webdav/filePropfind.jx?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/usecases/webdav/filePropfind.jx (added)
+++ lenya/trunk/src/modules/webdav/usecases/webdav/filePropfind.jx Wed Jan 11 18:55:51 2006
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<D:multistatus xmlns:D="DAV:"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:collection="http://apache.org/cocoon/collection/1.0"> -->
+ <jx:set var="sourceURL" value="${usecase.getParameter('sourceURL')}" />
+ <jx:set var="dateFormat" value="${usecase.getParameter('dateFormat')}"/>
+ <jx:set var="checkedOut" value="${usecase.getParameter('rc')}" />
+ <jx:forEach var="doc" items="${usecase.getParameter('documents')}" varStatus="status">
+ <jx:if test="${doc.getId()}">
+ <D:response>
+ <D:href>/${doc.getPublication().getId()}/${doc.getArea()}${doc.getId()}_${doc.getLanguage()}.html</D:href>
+ <D:propstat>
+ <D:prop>
+ <D:displayname>${doc.getName()}_${doc.getLanguage()}.html</D:displayname>
+ <D:getlastmodified>${dateFormat.format(doc.getLastModified())}</D:getlastmodified>
+ <D:creationdate />
+ <D:getcontenttype>text/html</D:getcontenttype>
+ <D:getcontentlength>${doc.getFile().length()}</D:getcontentlength>
+ <D:resourcetype />
+ <D:lockdiscovery>
+ <jx:if test="${checkedOut[status.index] != null}">
+ <D:activelock>
+ <D:locktype><D:write/></D:locktype>
+ <D:lockscope><D:exclusive/></D:lockscope>
+ <D:depth>0</D:depth>
+ <D:owner><D:href>${checkedOut[status.index].getIdentity()}</D:href></D:owner>
+ <D:timeout>Infinite</D:timeout>
+ <D:locktoken>
+ <D:href>${usecase.getParameter('sourceURL')}</D:href>
+ </D:locktoken>
+ </D:activelock>
+ </jx:if>
+ </D:lockdiscovery>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+ </jx:if>
+ </jx:forEach>
+
+</D:multistatus>
Added: lenya/trunk/src/modules/webdav/usecases/webdav/propfind.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/usecases/webdav/propfind.jx?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/usecases/webdav/propfind.jx (added)
+++ lenya/trunk/src/modules/webdav/usecases/webdav/propfind.jx Wed Jan 11 18:55:51 2006
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<D:multistatus xmlns:D="DAV:"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:collection="http://apache.org/cocoon/collection/1.0">
+ <jx:set var="sourceURL" value="${usecase.getParameter('sourceURL')}" />
+ <jx:set var="dateFormat" value="${usecase.getParameter('dateFormat')}"/>
+ <jx:set var="moddate" value="${usecase.getParameter('rootModDate')}"/>
+ <jx:set var="defaultLang" value="${usecase.getParameter('defaultLang')}"/>
+ <jx:set var="depth" value="${usecase.getParameter('header-Depth')}"/>
+ <D:response>
+ <D:href>${sourceURL.replaceFirst("authoring","webdav")}</D:href>
+ <D:propstat>
+ <D:prop>
+ <D:displayname>webdav</D:displayname>
+ <D:getlastmodified>${dateFormat.format(moddate)}</D:getlastmodified>
+ <D:creationdate></D:creationdate>
+ <D:resourcetype>
+ <D:collection />
+ </D:resourcetype>
+ <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
+ <D:contentlength>0</D:contentlength>
+ <D:lockdiscovery />
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+<jx:if test="${depth > 0}">
+ <jx:forEach var="doc" items="${usecase.getParameter('documents')}">
+ <jx:if test="${doc.getId()}">
+ <jx:if test="${doc.getLanguage().equals(defaultLang)}">
+ <D:response>
+ <D:href>/${doc.getPublication().getId()}/webdav${doc.getId()}</D:href>
+ <D:propstat>
+ <D:prop>
+ <D:displayname>${doc.getName()}</D:displayname>
+ <D:getlastmodified>${dateFormat.format(doc.getLastModified())}</D:getlastmodified>
+ <D:creationdate></D:creationdate>
+ <D:resourcetype>
+ <D:collection />
+ </D:resourcetype>
+ <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
+ <D:contentlength>0</D:contentlength>
+ <D:lockdiscovery />
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+ </jx:if>
+ </jx:if>
+ </jx:forEach>
+ <jx:set var="checkedOut" value="${usecase.getParameter('rc')}" />
+ <jx:forEach var="doc" items="${usecase.getParameter('documents')}" varStatus="status">
+ <jx:if test="${doc.getId()}">
+ <D:response>
+ <D:href>/${doc.getPublication().getId()}/webdav${doc.getId()}_${doc.getLanguage()}.${doc.getExtension()}</D:href>
+ <D:propstat>
+ <D:prop>
+ <D:displayname>${doc.getName()}_${doc.getLanguage()}.${doc.getExtension()}</D:displayname>
+ <D:getlastmodified>${dateFormat.format(doc.getLastModified())}</D:getlastmodified>
+ <D:creationdate />
+ <D:getcontenttype>application/xml</D:getcontenttype>
+ <D:getcontentlength>${doc.getFile().length()}</D:getcontentlength>
+ <D:resourcetype />
+ <D:lockdiscovery><jx:if test="${checkedOut[status.index] != null}">
+ <D:activelock>
+ <D:locktype><D:write/></D:locktype>
+ <D:lockscope><D:exclusive/></D:lockscope>
+ <D:depth>0</D:depth>
+ <D:owner><D:href>${checkedOut[status.index].getIdentity()}</D:href></D:owner>
+ <D:timeout>Infinite</D:timeout>
+ <D:locktoken>
+ <D:href>${usecase.getParameter('sourceURL')}</D:href>
+ </D:locktoken>
+ </D:activelock>
+ </jx:if></D:lockdiscovery>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+ </jx:if>
+ </jx:forEach>
+ <jx:forEach var="asset" items="${usecase.getParameter('assets')}">
+ <D:response>
+ <D:href>/${sourceURL.replaceFirst("authoring","webdav")}${asset.getName()}</D:href>
+ <D:propstat>
+ <D:prop>
+ <D:displayname>${asset.getName()}</D:displayname>
+ <D:getlastmodified>${dateFormat.format(asset.getLastModified())}</D:getlastmodified>
+ <D:creationdate />
+ <D:getcontenttype>asset.getMimeType()</D:getcontenttype>
+ <D:getcontentlength>${asset.getContentLength()}</D:getcontentlength>
+ <D:resourcetype />
+ <D:lockdiscovery/>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+ </jx:forEach>
+</jx:if>
+</D:multistatus>
Added: lenya/trunk/src/modules/webdav/usecases/webdav/status.jx
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/usecases/webdav/status.jx?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/usecases/webdav/status.jx (added)
+++ lenya/trunk/src/modules/webdav/usecases/webdav/status.jx Wed Jan 11 18:55:51 2006
@@ -0,0 +1,20 @@
+<?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.
+-->
+<response>
+ <status>${parameters.getParameter("status")}</status>
+ <message>${message}</message>
+</response>
Added: lenya/trunk/src/modules/webdav/webdav.js
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/webdav.js?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/webdav.js (added)
+++ lenya/trunk/src/modules/webdav/webdav.js Wed Jan 11 18:55:51 2006
@@ -0,0 +1,325 @@
+/*
+* 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.
+*/
+
+/* Helper method to add all request parameters to a usecase */
+function passRequestParameters(flowHelper, usecase) {
+ var names = cocoon.request.getParameterNames();
+ while (names.hasMoreElements()) {
+ var name = names.nextElement();
+ if (!name.equals("lenya.usecase")
+ && !name.equals("lenya.continuation")
+ && !name.equals("submit")) {
+
+ var value = flowHelper.getRequest(cocoon).get(name);
+
+ var string = new Packages.java.lang.String();
+ if (string.getClass().isInstance(value)) {
+ usecase.setParameter(name, value);
+ }
+ else {
+ usecase.setPart(name, value);
+ }
+
+ }
+ }
+}
+
+/* Helper method to add all request headers to a usecase */
+function passRequestHeaders(flowHelper, usecase) {
+ var names = cocoon.request.getHeaderNames();
+ while (names.hasMoreElements()) {
+ var name = names.nextElement();
+ var value = flowHelper.getRequest(cocoon).getHeader(name);
+
+ var string = new Packages.java.lang.String();
+ if (string.getClass().isInstance(value)) {
+ usecase.setParameter("header-"+name, value);
+ }
+ else {
+ usecase.setPart("header-"+name, value);
+ }
+ }
+}
+
+function selectMethod() {
+ var page = cocoon.parameters["page"];
+ var requestURI = cocoon.parameters["requestURI"];
+ var method = cocoon.request.getMethod();
+ cocoon.sendPage(method+"/"+page, {"requestURI":requestURI});
+}
+
+function sendStatus(sc) {
+ cocoon.sendStatus(sc);
+}
+
+function mkcol() {
+ var status = executeUsecase("webdav.mkcol");
+ if(status)
+ sendStatus(201);
+ else
+ sendStatus(403);
+}
+
+function put() {
+ var status = executeUsecase("webdav.put");
+ if(status)
+ sendStatus(204);
+ else {
+ sendStatus(415);
+ }
+}
+
+function remove() {
+ var status = executeUsecase("webdav.delete");
+ sendStatus(200);
+}
+
+function get() {
+ var uri = new java.lang.String(cocoon.parameters["forward"]);
+ var uri = uri.substring(8, uri.length());
+ cocoon.sendPage(uri);
+}
+
+function filePropfind() {
+ var status = executeUsecase("webdav.filePropfind");
+ sendStatus(500);
+}
+
+function propfind() {
+ var status = executeUsecase("webdav.propfind");
+ sendStatus(500);
+}
+
+function options(type) {
+ cocoon.response.setHeader("DAV","1");
+ var options = "";
+ if (type == "file") {
+ options = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
+ } else {
+ options = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,LOCK,UNLOCK";
+ }
+ cocoon.response.setHeader("Allow",options);
+
+ //interoperability with Windows 2000
+ var w2kDAVDiscoverAgent = "Microsoft Data Access Internet"
+ + " Publishing Provider Protocol Discovery";
+ if (cocoon.request.getHeader("User-Agent") == w2kDAVDiscoverAgent) {
+ cocoon.response.setHeader("MS-Author-Via","DAV");
+ }
+
+ sendStatus(200);
+}
+
+/*
+ * parse the depth header to find out if recursion
+ * take place. (used by MOVE and COPY)
+ */
+function isRecurse(depth) {
+ var recurse;
+ if (depth == null || depth == '') {
+ recurse = true;
+ }
+ else if (depth == 'Infinity') {
+ recurse = true;
+ }
+ else {
+ recurse = false;
+ }
+ return recurse;
+}
+
+/*
+ * convert the overwrite header into a boolean type
+ */
+function isOverwrite(header) {
+ var overwrite = true;
+ if (header == 'F') {
+ overwrite = false;
+ }
+ return overwrite;
+}
+
+function executeUsecase(usecaseName) {
+ var view;
+ var proxy;
+ var menu = "nomenu";
+
+ var usecaseResolver;
+ var usecase;
+ var sourceUrl;
+
+ if (cocoon.log.isDebugEnabled())
+ cocoon.log.debug("usecases.js::executeUsecase() called, parameter lenya.usecase = [" + usecaseName + "]");
+
+ try {
+
+ var flowHelper = cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
+ var request = flowHelper.getRequest(cocoon);
+ sourceUrl = Packages.org.apache.lenya.util.ServletHelper.getWebappURI(request);
+
+ usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
+ usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
+ usecase.setSourceURL(sourceUrl);
+ usecase.setName(usecaseName);
+ view = usecase.getView();
+
+ passRequestParameters(flowHelper, usecase);
+ passRequestHeaders(flowHelper, usecase);
+ usecase.checkPreconditions();
+ usecase.lockInvolvedObjects();
+ proxy = new Packages.org.apache.lenya.cms.usecase.UsecaseProxy(usecase);
+ }
+ finally {
+ /* done with usecase component, tell usecaseResolver to release it */
+ if (usecaseResolver != null) {
+ if (usecase != null) {
+ usecaseResolver.release(usecase);
+ usecase = undefined;
+ }
+ cocoon.releaseComponent(usecaseResolver);
+ }
+ }
+
+ var success = false;
+ //var targetUrl;
+ var form;
+ var scriptString;
+ var evalFunc;
+ var generic;
+
+ /*
+ * If the usecase has a view, this means we want to display something
+ * to the user before proceeding. This also means the usecase consists
+ * several steps; repeated until the user chooses to submit or cancel.
+ *
+ * If the usecase does not have a view, it is simply executed.
+ */
+
+ if (view) {
+ var ready = false;
+ while (!ready) {
+
+ try {
+ var templateUri = view.getTemplateURI();
+ if (templateUri) {
+ var viewUri = "view/" + menu + "/" + view.getTemplateURI();
+ if (cocoon.log.isDebugEnabled())
+ cocoon.log.debug("usecases.js::executeUsecase() in usecase " + usecaseName + ", creating view, calling Cocoon with viewUri = [" + viewUri + "]");
+
+ cocoon.sendPageAndWait(viewUri, {"usecase" : proxy});
+
+ }
+ else {
+ var viewUri = view.getViewURI();
+ cocoon.sendPage(viewUri);
+ return;
+ }
+ }
+ catch (exception) {
+ /* if an exception was thrown by the view, allow the usecase to rollback the transition */
+ try {
+ usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
+ usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
+ proxy.setup(usecase);
+ usecase.cancel();
+ throw exception;
+ }
+ finally {
+ if (usecaseResolver != null) {
+ if (usecase != null) {
+ usecaseResolver.release(usecase);
+ usecase = undefined;
+ }
+ cocoon.releaseComponent(usecaseResolver);
+ }
+ }
+ }
+
+ if (cocoon.log.isDebugEnabled())
+ cocoon.log.debug("usecases.js::executeUsecase() in usecase " + usecaseName + ", after view, now advancing in usecase");
+
+ try {
+ usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
+ usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
+ proxy.setup(usecase);
+
+ passRequestParameters(flowHelper, usecase);
+ usecase.advance();
+
+ if (cocoon.request.getParameter("submit")) {
+ usecase.checkExecutionConditions();
+ if (! usecase.hasErrors()) {
+ usecase.execute();
+ if (! usecase.hasErrors()) {
+ usecase.checkPostconditions();
+ if (! usecase.hasErrors()) {
+ ready = true;
+ success = true;
+ }
+ }
+ }
+ }
+ else if (cocoon.request.getParameter("cancel")) {
+ usecase.cancel();
+ ready = true;
+ }
+ proxy = new Packages.org.apache.lenya.cms.usecase.UsecaseProxy(usecase);
+ }
+ catch (exception) {
+ /* allow usecase to rollback the transition */
+ usecase.cancel();
+ throw exception;
+ }
+ finally {
+ if (usecaseResolver != null) {
+ if (usecase != null) {
+ usecaseResolver.release(usecase);
+ usecase = undefined;
+ }
+ cocoon.releaseComponent(usecaseResolver);
+ }
+ }
+ }
+ }
+ else {
+ try {
+ usecaseResolver = cocoon.getComponent("org.apache.lenya.cms.usecase.UsecaseResolver");
+ usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
+ proxy.setup(usecase);
+
+ usecase.execute();
+ if (! usecase.hasErrors()) {
+ usecase.checkPostconditions();
+ if (! usecase.hasErrors()) {
+ success = true;
+ }
+ }
+ }
+ catch (exception) {
+ /* allow usecase to rollback the transition */
+ usecase.cancel();
+ throw exception;
+ }
+ finally {
+ usecaseResolver.release(usecase);
+ usecase = undefined;
+ cocoon.releaseComponent(usecaseResolver);
+ }
+ }
+
+ return success;
+
+}
Propchange: lenya/trunk/src/modules/webdav/webdav.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/xslt/NSclean.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/xslt/NSclean.xsl?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/xslt/NSclean.xsl (added)
+++ lenya/trunk/src/modules/webdav/xslt/NSclean.xsl Wed Jan 11 18:55:51 2006
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:collection="http://apache.org/cocoon/collection/1.0"
+ xmlns:D="DAV:"
+ exclude-result-prefixes="jx">
+
+<!-- Identity transformation template -->
+<xsl:template match="/ | @* | * | comment() | processing-instruction() | text()">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | * | comment() | processing-instruction() | text()"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="D:multistatus">
+ <multistatus xmlns="DAV:" xmlns:collection="http://apache.org/cocoon/collection/1.0">
+ <xsl:apply-templates select="@* | * | processing-instruction() | text()"/>
+ </multistatus>
+</xsl:template>
+
+<xsl:template match="D:*">
+ <xsl:element name="{local-name()}" namespace="DAV:">
+ <xsl:apply-templates select="@* | * | processing-instruction() | text()"/>
+ </xsl:element>
+</xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/trunk/src/modules/webdav/xslt/NSclean.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/xslt/init.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/xslt/init.xsl?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/xslt/init.xsl (added)
+++ lenya/trunk/src/modules/webdav/xslt/init.xsl Wed Jan 11 18:55:51 2006
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:param name="pubid" />
+
+ <xsl:template match="/">
+ <D:multistatus xmlns:D="DAV:" xmlns:collection="http://apache.org/cocoon/collection/1.0">
+ <D:response>
+ <D:href>/<xsl:value-of select="$pubid" />/</D:href>
+
+ <D:propstat>
+ <D:prop>
+ <D:displayname><xsl:value-of select="$pubid" /></D:displayname>
+
+ <D:getlastmodified></D:getlastmodified>
+
+ <D:creationdate />
+
+ <D:resourcetype>
+ <D:collection />
+ </D:resourcetype>
+
+ <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
+
+ <D:contentlength>0</D:contentlength>
+ </D:prop>
+
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+
+ <D:response>
+ <D:href>/<xsl:value-of select="$pubid" />/webdav</D:href>
+
+ <D:propstat>
+ <D:prop>
+ <D:displayname>webdav</D:displayname>
+
+ <D:getlastmodified></D:getlastmodified>
+
+ <D:creationdate />
+
+ <D:resourcetype>
+ <D:collection />
+ </D:resourcetype>
+
+ <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
+
+ <D:contentlength>0</D:contentlength>
+ </D:prop>
+
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>
+
+
+ </D:multistatus>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/trunk/src/modules/webdav/xslt/init.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/xslt/limitResponse.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/xslt/limitResponse.xsl?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/xslt/limitResponse.xsl (added)
+++ lenya/trunk/src/modules/webdav/xslt/limitResponse.xsl Wed Jan 11 18:55:51 2006
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xso="http://apache.org/cocoon/lenya/xslt/1.0"
+ xmlns:D="DAV:"
+ >
+
+<xsl:namespace-alias stylesheet-prefix="xso" result-prefix="xsl"/>
+
+<xsl:template match="/">
+
+ <xso:stylesheet version="1.0"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="xhtml">
+
+ <xso:output method="xml" indent="yes"/>
+
+ <xso:template match="node()|@*">
+ <xso:copy>
+ <xso:apply-templates select="node()|@*"/>
+ </xso:copy>
+ </xso:template>
+
+ <xso:template match="D:displayname">
+ <xsl:if test="//D:prop/D:displayname"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ <xso:template match="D:getlastmodified">
+ <xsl:if test="//D:prop/D:getlastmodified"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ <xso:template match="D:creationdate">
+ <xsl:if test="//D:prop/D:creationdate"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ <xso:template match="D:resourcetype">
+ <xsl:if test="//D:prop/D:resourcetype"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ <xso:template match="D:getcontenttype">
+ <xsl:if test="//D:prop/D:getcontenttype"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ <xso:template match="D:contentlength">
+ <xsl:if test="//D:prop/D:contentlength"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ <xso:template match="D:lockdiscovery">
+ <xsl:if test="//D:prop/D:lockdiscovery"><xso:copy-of select="."/></xsl:if>
+ </xso:template>
+
+ </xso:stylesheet>
+
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/trunk/src/modules/webdav/xslt/limitResponse.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/webdav/xslt/lock.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/webdav/xslt/lock.xsl?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/modules/webdav/xslt/lock.xsl (added)
+++ lenya/trunk/src/modules/webdav/xslt/lock.xsl Wed Jan 11 18:55:51 2006
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:param name="userid"/>
+ <xsl:param name="docid"/>
+
+ <xsl:template match="/">
+ <D:prop xmlns:D="DAV:">
+ <D:lockdiscovery>
+ <D:activelock>
+ <D:locktype><D:write/></D:locktype>
+ <D:lockscope><D:exclusive/></D:lockscope>
+ <D:depth>Infinity</D:depth>
+ <D:owner><D:href><xsl:value-of select="$userid"/></D:href></D:owner>
+ <D:timeout>Second-604800</D:timeout>
+ <D:locktoken>
+ <D:href>
+ <xsl:value-of select="docid"/>
+ </D:href>
+ </D:locktoken>
+ </D:activelock>
+ </D:lockdiscovery>
+ </D:prop>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
Propchange: lenya/trunk/src/modules/webdav/xslt/lock.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lenya/trunk/src/modules/xhtml/config/module.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/xhtml/config/module.xconf?rev=368246&r1=368245&r2=368246&view=diff
==============================================================================
--- lenya/trunk/src/modules/xhtml/config/module.xconf (original)
+++ lenya/trunk/src/modules/xhtml/config/module.xconf Wed Jan 11 18:55:51 2006
@@ -29,6 +29,7 @@
</creator>
<link-attribute xpath="//*[namespace-uri() = 'http://www.w3.org/1999/xhtml']/@href"/>
<format name="xhtml" uri="cocoon://modules/xhtml/xhtml.xml"/>
+ <format name="webdavGET" uri="cocoon://modules/xhtml/davget.xml"/>
</component-instance>
</xconf>
Modified: lenya/trunk/src/modules/xhtml/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/xhtml/sitemap.xmap?rev=368246&r1=368245&r2=368246&view=diff
==============================================================================
--- lenya/trunk/src/modules/xhtml/sitemap.xmap (original)
+++ lenya/trunk/src/modules/xhtml/sitemap.xmap Wed Jan 11 18:55:51 2006
@@ -19,6 +19,19 @@
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+<!-- =========================== Components ================================ -->
+
+ <map:components>
+
+ <map:serializers default="xhtml">
+ <map:serializer name="xml-get" src="org.apache.cocoon.serialization.XMLSerializer" mime-type="text/xml">
+ <encoding>utf-8</encoding>
+ <omit-xml-declaration>yes</omit-xml-declaration>
+ </map:serializer>
+ </map:serializers>
+
+ </map:components>
+
<map:pipelines>
<map:pipeline>
@@ -35,6 +48,15 @@
</map:transform>
<map:serialize type="xml"/>
</map:match>
+ </map:match>
+
+ <!-- webdav GET matcher -->
+ <map:match pattern="davget.xml">
+ <map:act type="set-header">
+ <map:parameter name="Last-Modified" value="{page-envelope:document-lastmodified}" />
+ <map:generate src="lenyadoc:/{page-envelope:document-language}/{page-envelope:document-id}"/>
+ <map:serialize type="xml-get"/>
+ </map:act>
</map:match>
<!-- parametrized doctype matcher -->
Modified: lenya/trunk/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/global-sitemap.xmap?rev=368246&r1=368245&r2=368246&view=diff
==============================================================================
--- lenya/trunk/src/webapp/global-sitemap.xmap (original)
+++ lenya/trunk/src/webapp/global-sitemap.xmap Wed Jan 11 18:55:51 2006
@@ -303,23 +303,7 @@
<map:pipeline>
<map:match pattern="">
- <map:select type="request-method">
- <map:when test="PROPFIND">
- <map:generate src="lenya/content/util/empty.xml" />
- <map:transform src="lenya/xslt/exception/document-does-not-exist.xsl"/>
- <map:transform src="lenya/xslt/util/page2xhtml.xsl" />
- <map:serialize type="xhtml" status-code="404"/>
- </map:when>
- <map:when test="OPTIONS">
- <map:generate src="lenya/content/util/empty.xml" />
- <map:transform src="lenya/xslt/exception/document-does-not-exist.xsl"/>
- <map:transform src="lenya/xslt/util/page2xhtml.xsl" />
- <map:serialize type="xhtml" status-code="404"/>
- </map:when>
- <map:otherwise>
- <map:redirect-to uri="index.html"/>
- </map:otherwise>
- </map:select>
+ <map:redirect-to uri="index.html"/>
</map:match>
<map:match pattern="index.html">
@@ -341,14 +325,14 @@
<map:match pattern="*">
<map:select type="request-method">
<map:when test="PROPFIND">
- <map:generate type="file" src="fallback://lenya/usecases/webdav/dummy.xml"/>
- <map:transform src="fallback://lenya/usecases/webdav/init.xsl">
+ <map:generate type="file" src="context://lenya/content/util/empty.xml"/>
+ <map:transform src="fallback://lenya/modules/webdav/xslt/init.xsl">
<map:parameter name="pubid" value="{page-envelope:publication-id}"/>
</map:transform>
<map:serialize type="xml" status-code="207"/>
</map:when>
<map:when test="OPTIONS">
- <map:mount uri-prefix="" src="{fallback://lenya/usecases/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+ <map:mount uri-prefix="" src="{fallback://lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
</map:when>
</map:select>
</map:match>
@@ -356,14 +340,14 @@
<map:match pattern="{page-envelope:publication-id}/">
<map:select type="request-method">
<map:when test="PROPFIND">
- <map:generate type="file" src="fallback://lenya/usecases/webdav/dummy.xml"/>
- <map:transform src="fallback://lenya/usecases/webdav/init.xsl">
+ <map:generate type="file" src="context://lenya/content/util/empty.xml"/>
+ <map:transform src="fallback://lenya/modules/webdav/xslt/init.xsl">
<map:parameter name="pubid" value="{page-envelope:publication-id}"/>
</map:transform>
<map:serialize type="xml" status-code="207"/>
</map:when>
<map:when test="OPTIONS">
- <map:mount uri-prefix="" src="{fallback://lenya/usecases/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+ <map:mount uri-prefix="" src="{fallback://lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
</map:when>
</map:select>
</map:match>
Modified: lenya/trunk/src/webapp/lenya/pubs/default/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/sitemap.xmap?rev=368246&r1=368245&r2=368246&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/sitemap.xmap (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/sitemap.xmap Wed Jan 11 18:55:51 2006
@@ -64,12 +64,12 @@
<map:pipeline>
<map:match pattern="**">
<map:match pattern="webdav**">
- <map:mount uri-prefix="" src="{fallback:lenya/usecases/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+ <map:mount uri-prefix="" src="{fallback:lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
</map:match>
<map:select type="request-method">
<!-- many client editors like to PUT changes -->
<map:when test="PUT">
- <map:mount uri-prefix="" src="{fallback:lenya/usecases/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+ <map:mount uri-prefix="" src="{fallback:lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>
</map:when>
</map:select>
</map:match>
Added: lenya/trunk/src/webapp/lenya/xslt/exception/forbidden.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/exception/forbidden.xsl?rev=368246&view=auto
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/exception/forbidden.xsl (added)
+++ lenya/trunk/src/webapp/lenya/xslt/exception/forbidden.xsl Wed Jan 11 18:55:51 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!--
+ 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.
+-->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ >
+
+ <xsl:param name="documentid"/>
+ <xsl:param name="documenturl"/>
+
+ <xsl:template match="/">
+
+ <page:page>
+ <page:title><i18n:text>forbidden-401</i18n:text></page:title>
+ <page:body>
+ <div class="lenya-box">
+ <div class="lenya-box-title"><i18n:text>error-document-forbidden-short</i18n:text></div>
+ <div class="lenya-box-body">
+ <p>
+ <i18n:translate>
+ <i18n:text i18n:key="error-document-forbidden" />
+ <i18n:param>'<xsl:value-of select="$documenturl"/>'</i18n:param>
+ <i18n:param>'<xsl:value-of select="$documentid"/>'</i18n:param>
+ </i18n:translate>
+ </p>
+ </div>
+ </div>
+ </page:body>
+ </page:page>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: lenya/trunk/src/webapp/lenya/xslt/exception/forbidden.xsl
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org