Opening WebDAV URLs Directly From the Browser

Company Blogs February 10, 2011 By Samuel Kong Staff

Liferay Portal provides a WebDAV URL to all documents in the Document Library so that you can access the documents from your computer's desktop. While this is a great feature, it can be a little annoying to
    1) copy the WebDAV URL
    2) open Microsoft Word (for example)
    3) click the open icon
    4) paste the file's WebDAV URL into the open dialog window.
While this is very straight forward, it's a lot of steps.

To make it easier for your users to open files, you can create a link which will automatically open the file using WebDAV. By opening the file using WebDAV, changes to the file are automatically uploaded back to the server. The user doesn't need to manually upload the file back to the server.

<a href="#" onclick="new ActiveXObject('SharePoint.OpenDocuments.1').EditDocument('<%= webDavUrl %>');">Open Now</a>

This solution is not very flexible, because it will only work with Internet Explorer. But if you're running an intranet site and know everyone uses IE, this can be a great UI improvement for your users.

If you would like to give this a try, you can depoy this sample hook for Liferay Portal 6.0.5. The hook will add an "Open Now" link below the WebDAV URL in the screen seen above.

Adding a JavaScript to Every Page

Company Blogs October 23, 2009 By Samuel Kong Staff

Have you ever found yourself in a situation where you need to deploy a piece of JavaScript (such as Google Analytics) to every single page in the portal? Up to now, the most common way to accomplish this is to include the JavaScript in your theme. However, this can be really annoying if your site uses multiple themes.

So, in this blog, I want to show you how you can create a very simple portlet to add a piece of JavaScript to every page on your portal. Liferay already has a very convenient way of integrating with Google Analytics (Manage Pages > Settings > Monitoring), so for this example, I'm going to create a portlet that adds RefTagger to every page. RefTagger uses a small piece of JavaScript to scan a page for words it recorgnizes and turns them into a hyperlinks with a tooltip.

So let's get started.

1) First, you'll need to get a copy of the Liferay Plugins SDK if you don't already have it.

2) From a command prompt, navigate to <plugins-sdk>/portlets/ and type

create logos-reftagger "Logos RefTagger"

This will automatically create a barebone portlet from which we can start building our portlet.

3) Navigate to <plugins-sdk>/portlets/logos-reftagger-portlet/docroot/ and open view.jsp

4) Change the content of view.jsp to the following:

<%@ taglib uri="" prefix="liferay-util" %>
    <script src="" type="text/javascript"></script>
    <script type="text/javascript">
       Logos.ReferenceTagging.lbsBibleVersion = "ESV";
       Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;
       Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";
       Logos.ReferenceTagging.lbsNoSearchTagNames = [ "h1", "h2", "h3" ];

For you portlet, just replace the the <script> tags with your own script tags.

Now here's the neat part. Take a look at the <liferay-util:html-bottom> tag. This tag will force whatever is within the tag to the bottom of the page (between </body> and </html>).

If you script needs to appear within the <head> section of the page, you can use <liferay-util:html-top> instead.

All that is left to do now is just make sure this portlet appears on every page.

5) Create a liferay-hook.xml in <plugins-sdk>/portlets/logos-reftagger-portlet/docroot/WEB-INF/.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 5.3.0//EN" "">

And create a in <plugins-sdk>/portlets/logos-reftagger-portlet/docroot/WEB-INF/src/


For more information on the property layout.static.portlets.all, take a look at the file in the Liferay source code.

6) Since we don't want users adding this portlet to a page and don't want the portlet border to appear, we need to set "system" to true and "use-default-template" to false in <plugins-sdk>/portlets/logos-reftagger-portlet/docroot/WEB-INF/ so:


7) Deploy your portlet with the ant command ant deploy and your JavaScript will be on every page in your portal!

You can get this portlet from our public SVN or download the war below:
    For 5.2.3
    For trunk


Company Blogs May 1, 2008 By Samuel Kong Staff

I was introduced to WebDAV the other day, and I thought it would be great to use my first blog post to tell other people about it also.

What is WebDAV?

Think of it as a way to upload, download, and edit files located in your document library and image gallery from the convenience of your desktop.

How to get started.

For this tutorial, I'll be using Liferay 5.0.1 on Windows XP. There are some known problems with Windows implementation of WebDAV, but but hopefully these instructions will work for you.

1. Add the Document Library portlet to your page.

2. Make a note of the of the WebDAV URL.

3. Open up My Network Places on your computer.

4. Under Network Tasks, click Add a network place. The Add Network Place Wizard should pop up.

5. Click Next until you see the screen below. Select Choose another network location and click Next

6. For the Internet or network address, enter the WebDAV URL (from step 2) and click Next.

7. When the login prompt pops up, enter your email address and password. (Note: If you're using Liferay 4.4.x, you should use your user ID number as the user name.)

8. Continue clicking Next/finish until the wizard is done. You should now have a new folder in your My Network Places to your document library. The folder will behave just like a local folder. You can get files, drag files into document library, delete files, create directories, etc.

Note: You can't add files to the root directory of your document library. So, create at least one sub-directory.

Showing 3 results.