This seems like a really cheaky request, or I've not spent enough time googling the answer!

I'd like the url field to accept something like this J:\Groups\Invest\
or file://J:\Groups\Invest\
or file://in02\groups\invest\
or file://CL1_IN02_SERVER\IN02\GROUPS\blah.htm

Comments

akeerie’s picture

ok, I've been dabbling this and have come up with the following solution. I'm clueless with regard to how to get this into a new version or whether it's worthy. I'd be really grateful if someone would take a look at this

I basically followed the steer from this after finding out that the link code refers to a variable called filter_allowed_protocols rather than adding git, I chose to add file.

http://iheartryan.com/post/allowing-git-urls-drupal-link-module

I ran the following code : - variable_set($name, $value)
eg variable_set('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'file'))

Then I added the following code to link.module

$file_pattern ='/^file:/';

and this into the clauses

if (in_array('file', $allowed_protocols) && preg_match($file_pattern, $text)) {
return LINK_EXTERNAL;
}

The link works in ie, not so sure about firefox

dragonwize’s picture

Status: Active » Postponed (maintainer needs more info)

I am not an expert but I believe that file:/// protocol is only a local protocol. Only someone on the local machine the server is on or has access to would be able to access the the link. Since the Drupal interface is being served up via http would it not make more sense to use a http link to your file?

The main catch with http is that the file has to be web accessible with your server but that is for security concerns.

epersonae2’s picture

You might want to use file:/// for an intranet that doesn't allow off-site use. Then users can link to a file on a shared drive w/out being forced to upload a copy to Drupal. Other employees may continue to look for the file through the shared drive, and having only one copy (the shared drive copy) makes it less likely that there will be a mismatch in file versions. When you're talking about procedure manuals, HR materials, etc., it can be a big deal. (I hope that makes sense; this is a fairly critical issue in my research on a new project.)

dqd’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)