We are using Drupal 4.6 to run an internal intranet site. Is there any way to link to documents on our local filesystem from the menu in drupal? I have been trawling through the forums but so far I haven't managed to find a way to do it.

I'm also having difficulty with linking from one node to another. I use tinymce, and it keeps changing the url to something unusable by adding ../ etc. I'm not sure whether the problem is with tinymce or just the way Drupal deals with links. Again, I've been looking through the forums and have found a few posts on this but have not been able to find a solution that works.

Thanks

Brian

Comments

wings’s picture

Help!

dman’s picture

in which case your links would be "file://w:/shared/docs" or possibly "file://fileserver/shared/docs" maybe with an extra slash somewhere.
No easy way to browse and link, but possible manually.

A dozen other suggestions may be available, but not if you won't describe your server platforms etc.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

wings’s picture

Yeah, I'm referring to drives on the intranet.

That doesn't work as Drupal changes the URL. so for file://w:/shared/docs it would tend to make it into www.mydrupal.com/shared/docs which is pretty useless.

I'm running Drupal 4.6.6, on a Linux (Red Hat I think) running Apache httpd 2.2.0 and PHP 4.4.2.

Kinda inherited this job from someone else so am not really an expert. I think the input filter is changing the URLs, I might either try and disable them or adjust one to suit my needs (God help me!).

Thanks for the reply

Brian

wings’s picture

One of the things I'm trying to do is link from a menu item to a file on our V drive. Obviously, tinymce has nothing to do with that. I do have a slightly similar problem when linking within tinymce though, even when I'm linking to pages within Drupal - it changes the URL to something different, no matter whether I put in an absolute or relative URL it still messes it up. I tried rellinkfilter, but it then messed up all other links on the site.

Hope that doesn't confuse the issue more.

Brian

Ivis’s picture

Posted the same question here http://drupal.org/node/92349 and I may have a solution for inserting the link manually (disabling TinyMCE) but it only works for IE.
I use the following as URL: file:\\//servername/foldername/filename
Neither Firefox nor Opera understand this URL though.

wings’s picture

Do I need the fully qualified server name?
We have it mapped as the V drive on all our machines - do I need to actually use //servername/somefolder/wheremyfiles/are

Did you ever get any further?

Thats a bit annoying if it only works with IE as nearly everyone here uses Firefox and we already have the problem that noone ever looks at the page!

I was thinking of delving into the innards of Drupal and try and figure out what actually changes the URLs, and make an exception in the case of V or something. I'm really only new to PHP though so that could be a bit of a (mis)adventure.

Brian

dman’s picture

In my experience, fully qualified server names are a bit more reliable when deploying all over the place. Can't trust everyones local mappings (developers). Conversely, in a locked-down profile type intranet, drive mappings can be redirected transparently. It's a choice...

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

wings’s picture

Thanks btw. I managed to get it to link with IE (had to guess a folder name, but guessed right).

I can't understand why it gets it so wrong with Firefox - it adds it onto the end of the Drupal path. Is it Drupal or Firefox that is doing that?

Brian

Ivis’s picture

Haven't managed to go any further with this problem but if I do I will let you know.

cheers

wings’s picture

I have found that using the format

file:///V:/folder/file.xls

will give me access to files on local drives using both Firefox and IE. The problem is getting that address into the address bar. If I use this format for the link, neither IE or Firefox will get to the file - it all gets appended to www.host.com/drupal/V:/folder/file.xls.

Arrgh!

Brian

dman’s picture

I was aware of some differences between 2 and three protocol slashes in IE and FF ... and PHP vs Samba vs Explorer etc. Eventually you find a version that fits.

But address bar? by the time you've asked for that document, surely you are intending to launch an app that will handle it for you, thus it never goes right to the address bar? Unless you paste it manually ... no, that's not right.
If your menu items get you to the target, isn't that what you need?

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

wings’s picture

Well what I meant by putting it in the address bar was that it would get me to the right place. I haven't managed to link from the menu as it keeps adding http://www.mysite.com/drupal/ in front of file:\\\etc. I can link from everywhere else though, which is quite frustrating. Looks like I'm going to have to create a page to hold a link, and all I wanted was to put that link on the menu.

Brian

cooperaj’s picture

It is not firefox that links to the files like this. It is drupal not recognising the file:// protocol as an allowed one. I had to rummage through drupal core to find out how to work around this. There is a variable that you can set (though no interface to do it) that will allow the protocol through. You can set the variable using the conf[] array in your settings.php.

My conf array now looks like:

 // This needs to be here to allow the 'file://' protocol to work.
 $conf = array(
   'filter_allowed_protocols' => array('http', 'https', 'ftp', 'news', 
      'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'file'),
 ); 
wings’s picture

I know now that firefox will not link to any local files for security reasons, but you can copy the location into the address bar to get where you want to go. The problem still remains to get the correct link into the menu so that it will work in IE and that firefox users can use the context menu to obtain the correct link URL.

wings’s picture

I fixed my node linking problem, which was a problem with tinymce thanks to this page

http://drupal.org/node/32320

I am still having difficulty linking to local files from the menu.

wings’s picture

I can now link from the menu to a local file. I managed to fix the problem by using adding a new variable to the variables table. Full details are found here:

http://drupal.org/node/97524

Brian

dman’s picture

I wasn't aware of that protocol filter getting in the way there before. I guess it's a security thing.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/