Return to Jive Software

Currently Being Moderated

Enabling the file:// protocol

VERSION 1 

Created on: Feb 3, 2009 2:44 PM by Karl Cyr - Last Modified:  Feb 3, 2009 3:10 PM by Karl Cyr

One of the more popular customization requests we receive is to enable the "file://" protocol in Clearspace hyperlinks, thereby allowing users to access files directly from the file server on which they are stored. This document will explain how you can set up Clearspace to support this functionality.

 

** Quick Disclaimer **

The reason the file protocol is NOT enabled by default is because it poses some well-known security risks. Most major browsers (Firefox, Chrome, Safari) do not enable the links at all, though Internet Explorer still does. If you are going to enable the file protocol in your Clearspace instance, be sure you fully understand the risks involved. This should not be enabled on an externally facing site.

 

There are three simple changes you'll need to make:

 

1) Add "file://" to the "Allowed URL Schemes" field in the URL Filter (Admin Console > Spaces > Settings > Filters and Macros).

2) Similarly, add "file://" to the "Allowed src/href Schemes" field on the HTML Filter.

3) Finally, add the template file /template/global/content-picker.ftl to your global theme, and find the following function:

 

function isUrl(s) {
            var regexp = /(ftp|http|https|xmpp|feed|mailto):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ 
            return regexp.test(s);
        }


 

 

You'll want to change the regex to include the "file" protocol prefix, i.e. "(ftp|http|https|xmpp|feed|mailto|file)". Then you should be able to create "file://" links just as with any other type of link.

 

Enjoy!

1,201 Views Tags: customization, hyperlink, file, file_system
Average User Rating
(6 ratings)
My Rating:
Long Ton That Long Ton That  says:

Nice post Carl with a K

Carl Kubalsky Carl Kubalsky  says:

Karl - Thanks for the doc explaining this. I'd like to mention that this method works exactly the same for other protocols too.

 

For example, our SCM tool is StarTeam and if the StarTeam client is installed on the brower's system, the starteam:// protocol opens the StarTeam fat client when starteam:// links are clicked.  Enabling this in clearspace just requires that starteam:// gets added to the aforementioned ftl and filters.

 

-Carl with a C :-)

Vinh Vinh  says:

5 stars

Todd West Todd West  says in response to Vinh:

I gave it 0 stars to balance it out. But really I thought it was awesome

mmccrory mmccrory  says in response to Todd West:

I'm a little late to the game but I just wanted to hop on here and say thanks for this post.  I was trying to do a direct link to a network resource the other day and it made me sad that I couldn't .  I found this article lastnight and just got done setting it up on our test site, works great and just like it should.  Thanks for the information!

 

- Matt

talsupport talsupport  says:

I have 2 questions.

- Which content-picker.ftl i should edit?

     I have 2 content-picker.ftl

     /usr/local/jive/var/work/sbs/0-ROOT/WEB-INF/classes/template/global/content-picker.ftl
     /usr/local/jive/applications/template/application/WEB-INF/classes/template/global/content-picker.ftl

 

- Can Lotus Notes protocol also be enabled? Lotus Notes protocol is Notes:///

 

Thanks~

Bookmarked By (0)

More Like This

  • Retrieving data ...