Using WebDAV
About this document
First, this document introduces WebDAV as a concept and it's relation to Plone, including how to set it up. We continue by giving examples on what to use WebDAV for. Finally, we give examples and step-by-step guides on how to use WebDAV from Windows and in particular NetDrive, OS X and Linux. We conclude with a short list of known bugs and caveats.
What is WebDAV?
WebDAV is a way to mange files over HTTP, an extension to the normal protocol of the World wide web. You can think of it as something in-between FTP and a network share on your local network.
WebDAV is becoming the de facto standard for managing web content. Zope provides WebDAV, but usually on a different port to avoid the confusion between editing the source documents (the real content) and the presentation view of the documents (the HTML with menues and portlets normally sent to web browsers).
By mounting your Plone site, you can manage documents and folders almost as easy as if it was there on your local machine.
Enabling WebDAV in Zope
You must enable the WebDAV port in your Zope config to use it. Add the following to zope.conf:
<webdav-source-server>
# valid keys are "address" and "force-connection-close"
address www.mydomain.com:1980
force-connection-close off
</webdav-source-server>
This will enable the WebDAV server on http://www.mydomain.com:1980/. Note that you cannot use this URL in your web browser, just in WebDAV clients. Using the web browser will give you an error message AttributeError: manage_FTPget. You could also just run the WebDAV server on localhost with address 1980, forcing you to either use a WebDAV client locally or proxy WebDAV through Apache.
A way to cope with the port problems with Zope is to use Apache's Rewrite rules to ProxyPass the URL /dav or a seperate vhost dav.site.com to the seperate WebDAV port, usually 1980. This way, clients can use just http://www.site.com/dav/ or http://dav.site.com/. This makes it possible to access WebDAV even from behind a strict firewall.
You will have to find out what the URL to your WebDAV service will be. In this document, the URL http://plone.s11.no/dav/felles/s11 will be used as an example. This is a rewrite /dav on the vhost plone.s11.no, and felles/s11 is the path to the Plone instance inside Zope, as shown in the Zope management interface /manage. By using the full path to the Plone instance WebDAV clients can log in using the normal Plone user instead of the global zope user.
What should I use it for?
One obvious answer: Save Word documents straight onto the Internet. This will make your boss go wild. Since the Plone site mounts as a regular drive, you can just drag over whatever old files you have laying around. If you dear to try out the PortalTransforms product, you can have features like HTML previews of documents, and even index them so that you can use the regular Plone search for finding content inside the documents.
If you use the gallery product CMFPhoto, you will discover that with WebDAV uploading photos is just a matter of drag and drop. In fact, you can drag a complete folder right into your CMFPhotoAlbum, and it will appear on the web immediately, complete with thumbnails. And the other way around, if you browse your mounted gallery folder, you can turn on thumbnail views and move/delete images from there.
Another way to use the WebDAV mounting is for editing existing content. You will however discover that not everything is good in the WebDAV land. Many applications will for instance do saving in the fashion of delete-old-file-and-create-a-new-one. This will obviously discard meta information stored in Zope, such as discussions and publishing information. Other programs create temporary files that can be hard to get rid of. You will have to try out which programs behave nice, and which don't. You can always drag-and-drop files back and forward as a backup solution.
WebDAV in Windows
Windows does have a built-in WebDAV client in XP and 2003 Server. To use it, open My network places and click Add network place. Enter the WebDAV URL. You will however notice that this WebDAV support is rather crappy, as it only supports browsing from inside Explorer. The Plone
site is not mounted as a real network drive, like P:. There might also
be problems with authenticating if your Windows computer is in a
domain, to work-around this, include the username in the URL, like http://username@plone.s11.no/dav/felles/s11.
With the built-in client, all you can do is drag and drop files back
and forth, and there are several other problems. Is there no better
way?
Well, there is, but through seperate programs. One of those programs are WebDrive. What this program does is to mount a WebDAV site as a seperate drive, like Z:. Then, any program can be used almost as usual. However, WebDrive costs money, so it would require Plone providers to buy a license for each seperate user at each customers site.
Now, Novell has released silently their WebDAV client for Windows, called NetDrive. The client is marketed as a way to connect to Novell iFolder. But in reality the client also works against FTP, SFTP and WebDAV sites. We only need WebDAV, and the good part about NetDrive is that it's free!
Using NetDrive
Here are some screenshots. Mounting is easy, as long as you know the URL for your WebDAV server:
This gives a normal drive W: that can be browsed through Explorer, from where you can use whatever program you feel is appropriate to edit your web content:
As NetDrive provides a real drive, you can also save files directly from most programs. You will have to experiment with this, though, as applications save files in the most peculiar ways, using temporary files and other tricks that might mess up your Plone site.
WebDAV in OS X
Unlike Windows, Apple has made the built-in support for WebDAV in OS X really good, except that it does not support SSL (https). Here's a step-by-step guide on how to connect to your Plone site from OS X.
Click Finder or on the desktop. From the Finder menu, select Go -> Connect to Server.
This will bring up a prompt for your server address. Fill in the URL, and press the + button to save it as a favourite.
Next, fill out your username and password. You can chose to save the password.
Finally a Finder window will appear with your Plone site mounted. An icon for the site will also be available on your desktop.
Note that you don't only see documents and images on your site, but also different metafiles and -folders, like portal_properties and plone_utils. The reason you see all these extra files is that WebDAV
is a "source" view, almost like the Zope management interface (ZMI). It
is advised not to try managing such files and folders through WebDAV.
As OS X has native support for mounting WebDAV, you can of course use the Terminal and access your site through the shell.
Using the shell permits allows some fun, such as using grep and find. Note though that this is not a normal filesystem, so some things will not work. For instance, the df disk free command is rather confused.
WebDAV in Linux
Linux and other UNIXes don't have a common way to mount WebDAV, although there exists attempts to mount WebDAV as a filesystem, davfs is one such solution for Linux.
Other typical Linux desktop environments have their internal WebDAV support. For instance, KDE supports WebDAV by just using URLs that start with webdav:// instead of http://. For HTTPS, use webdavs://.
The Gnome file browser Nautilus also has WebDAV support in recent versions, using normal URLs with http://
Bugs and caveats
WebDAV support in Plone is not flawless yet, and there is some things you must be aware of. The WebDAV mounting of a Plone site is not a regular network share, it's a view into the source code of your site. Not all file types might work. Try to avoid large files.
You
might experience problems with temporary files and locking, not all
applications will work good with saving directly to the site. Zope
exposes many internal Plone folders and objects that shouldn't be edited through WebDAV. Meta information is added to HTML and TXT documents as seperate <meta>
tags or text lines and can be edited. Special content types might not
work well, for instance if you use ATContentType you will experience
several bugs.