| <?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')}"/> |
| <!-- returns root webdav directory --> |
| <D:response> |
| <D:href>${request.getContextPath()}${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:getcontentlength>0</D:getcontentlength> |
| <D:lockdiscovery/> |
| </D:prop> |
| <D:status>HTTP/1.1 200 OK</D:status> |
| </D:propstat> |
| </D:response> |
| <jx:if test="${request.getHeader('depth') > 0}"> |
| <jx:forEach var="doc" items="${usecase.getParameter('documents')}"> |
| <!-- FIXME: shouldn't this conditional be doc.exists()? --> |
| <jx:if test="${doc.getId()}"> |
| <jx:if test="${doc.getLanguage().equals(defaultLang)}"> |
| <!-- create a directory for each document; |
| the language check is to prevent multiple folders appearing with the same name |
| since concepts_en and concepts_de would both produce a folder called concepts --> |
| <D:response> |
| <D:href>${request.getContextPath()}/${doc.getPublication().getId()}/webdav${doc.getPath()}</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:getcontentlength>0</D:getcontentlength> |
| <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()}"> |
| <jx:set var="fileExtension" value="${doc.getSourceExtension()}"/> |
| <jx:if test="${doc.getSourceExtension().equals('xml')}"> |
| <jx:set var="fileExtension" value="html"/> |
| </jx:if> |
| <!-- create a file for each document, the href is the path to the file and the |
| display name is what will appear in the webdav folder --> |
| <D:response> |
| <D:href>${request.getContextPath()}/${doc.getPublication().getId()}/webdav${doc.getPath()}_${doc.getLanguage()}.${fileExtension}</D:href> |
| <D:propstat> |
| <D:prop> |
| <D:displayname>${doc.getName()}_${doc.getLanguage()}.${fileExtension}</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')}"> |
| <!-- similar to documents, a file is created for each asset with an href and display name --> |
| <D:response> |
| <D:href>${request.getContextPath()}/${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> |