Learn / eZ Publish / eZ Publish Knowledge Series: WebDAV support in eZ Publish 4.1 now using eZ Components

eZ Publish Knowledge Series: WebDAV support in eZ Publish 4.1 now using eZ Components

New features

Delete files behaviour

By default, the WebDAV files are sent to Trash when deleted. Site administrators or power users usually are responsible for emptying the Trash. If you want to permanently remove objects when browsing the content base from WebDAV ( without placing them in the Trash ), this setting must be changed in an override of content.ini :

[RemoveSettings]
# delete or trash
DefaultRemoveAction=delete

This setting is shared for controlling the web based remove operations

Copy

The previous eZ Publish WebDAV engine did not support copying of files and folders. This is now possible as well. The only existing limitation is that copying and moving files and folders across siteaccesses is not supported.

Setting up WebDAV support

For a long and thorough description of the setup procedure, consult the online documentation :

Here is a quick starter :
  • Set up a fresh 4.1 eZ Publish instance. Select the brand new eZ Flow package and make sure you installed eZ Components properly.
  • Adapt your Virtual Host configuration in Apache ( for those using other webservers, simply setup a similar configuration ). You need to add the following piece of configuration :

    <VirtualHost *:80>
          ServerName webdav.mydomain.com
    
           DocumentRoot "<path/to/ez/publish/4.1>"
    
           RewriteEngine On
           Rewriterule .* /webdav.php
    </VirtualHost>

    Replace webdav.mydomain.com by your actual webdav-dedicated domain name, and <path/to/ez/publish/4.1> by the actual path to your existing eZ Publish 4.1 instance. You may also need to add, prior to this Virtual Host definition, the following piece of configuration :

    NameVirtualHost *:80

Using WebDAV

The webdav feature in eZ Publish allows to manipulate your content base pretty much like your local files. Adding, moving, deleting, renaming content is possible. Uploaded files are transformed to the appropriate content object, based on their Mime type. This mapping between Mime types and content classes is configurable in upload.ini, as follows :

[CreateSettings]
# Maps from a mime-type or mime-group to a class identifier
MimeClassMap[]
MimeClassMap[image]=image
MimeClassMap[video/quicktime]=quicktime
MimeClassMap[video/x-msvideo]=windows_media
MimeClassMap[video/vnd.rn-realvideo]=real_video
MimeClassMap[application/vnd.rn-realmedia]=real_video
MimeClassMap[application/x-shockwave-flash]=flash

Further settings are available to customise the way files are imported in the content base, and more, you can define your own import handler, as it is done in the OpenOffice extension ( http://svn.ez.no/svn/extensions/ezodf/) for importing Open Office and MS Word documents. Have a closer look at the upload.ini file for details on how to make this happen.

Example : drag and dropping pictures online

Take the simple use-case where you come back from a wonderful event, and want to share the pictures you took there with your friends and blog readers. You would open your webDAV client ( using Transmit under Mac in this use-case ), and connect to eZ Publish :

You are then proposed the list of available siteaccesses. Pick the relevant one, and choose the subtree you want to push your pictures in. You can choose between 'Content' and 'Media'. In our case we navigate to Content, where we create a folder which will receive our gallery.

Note that when you create a folder with spaces (or other "special" characters in the name), the file names you see in the DAV client basically are the url aliases. This means these names will be converted by the same rules as other url transformation. So if you create a folder named "eZ Community Event" it might show up as that in your client (varies with different clients), however if you refresh, it will be shown as "eZ-Community-Event", and this is the correct name, to be used.
And we then upload the pictures :

And there we are, all set with our picture gallery, built in a few drag and drops :

Example : sharing a meeting report

Another simple use case is the one of a document sharing platform. You just come back from a team meeting, and were in charge of writing the report. Once you are done, you will want to share it, and its attachment and appendices, with your colleagues. Being a linux user, you open Nautilus and in the address bar, you type in :

dav://webdav.mydomain.com/eng

where 'eng' is the siteaccess name.

You will be prompted for credentials, and then land on your document sharing platform's top content level :

Navigate to the place where you usually store meeting reports (Content/Meeting-reports/ here). For easier retrieval of information, we could think of a tree-based tagging storage of the type year/month/day, which we create right away, still from Nautilus :

On top of making this report available as a document, you would like it to be viewable online too. Here comes the OpenOffice extension in play, shipped by default in eZ Publish. It allows you to :

  • Import an OpenOffice document (MS Word is also supported, but requires a few setup steps)
  • Export a piece of content into an OpenOffice document

This perfectly suits our needs.

Here is how we proceed to push this meeting report live. We first write it down in an OpenOffice document. It looks like this eventually :

Download the original OpenOffice meeting report here. We then drag-and-drop it into eZ Publish :

And we are done, the meeting report is online in one drag and drop, viewable as an Article, and downloadable as a document, using the built-in OpenOffice export :

Example: attaching resources to the report

Back home after your work day, during which you wrote and published the meeting report ( plus a few other things I hope ), you suddenly figure out that you accidentally forgot to add, on your intranet, the useful resources discussed during the meeting. Among other, you promised to upload the latest version of eZ Publish, for those who still do not have it installed on their laptops ( side note : which is unacceptable ). At work, you were using Nautilus, under linux, to work on eZ Publish through WebDAV. Here at home, there's not the slightest trace of a linux computer. Neither of a Mac one. Let us use Internet Explorer as a WebDAV client.

After a few pre-configuration steps ( [ 1] ), click the “Open” entry in the “File” menu. Enter the web address as follows :

Note that the “Open as Web Folder” checkbox must be checked, and that we appended a “#” at the end of the domain name. This is required for Internet Explorer to work properly as WebDAV client. So once you see you content repository in Explorer, you take a simple drag and drop of the files you wanted to attach to the meeting report, as follows (high definition image) :

And you are done, it is now downloadable :

Conclusion

The integration of the WebDAV Component as base-layer to WebDAV support in eZ Publish 4.1 provides a significant improvement for using eZ Publish beyond the browser. It is also yet another step in the continuous integration of the eZ Components into eZ Publish. eZ Publish 4.1 now integrates :

  • Webdav
  • Archive
  • System Information
  • Console Tools

And was already making use of :

  • Base

Future

The evolution of the WebDAV feature is in the pipeline for the forthcoming releases, and will bring at minimum :

  • Locking support
    At the moment locking is not yet implemented in eZ Publish's WebDAV. It will based on the new object states feature of eZ Publish.
  • Wider WebDAV client support
    More clients shall be supported in the future. This will be made possible among other by the support of locking.

As communicated before at various occasions, eZ Components are gradually replacing former building blocks in eZ Publish with highly tested, maintained and upper quality pieces of software [ 2]. This will continue, making them become the base of both the CMS and the CMF ( for “Framework” ). This means that using them in your custom eZ Publish extensions is highly recommended already! They do solve quite a few common problems and save you a lot of headaches !

Thanks for reading, sharing and participating !

Authors

References