File Link Extension
Context and Purpose
When mediawiki is used as an internal collaborating platform or a Personal Information Management tool, its access is mostly limited to a single computer or a single subnet (shared network environment). In such situations, it is sometimes useful to have the "file://" protocol enabled, so that links to files that can be normally accessed can be made in the documents. Mediawiki FAQ explains how to do this. (Needs to enable the functionality in Mediawiki AND all the client browsers. Once both those change sare made, it is possible to make links like
[[file://data6/manual.pdf]]
in wikitext and clicking on them will open (or download) the respective link. On of the issues in this approach is that the users need to make the
file://
link themselves. This can sometimes be an tedious and error-prone process (particularly in windows environment). This extensions adds a editor toolbar button which will trigger a file open dialog so that the user can simply select the file to be linked. The extension places the correctly formatted file:// protocol link in the current position of the edit box.
Warning
Using fileprotocol links, even in a intranet environment can kill the integrity wiki, unless it is very carefully controlled. For example, one should never link files that will be later moved to some other place, or the are not shared (with the same path) among all the client computers.
How to use
- Download the source code: File:FileLinkExtension.tar.gz
- Expand it at the mediawiki extensions folder
- Add the following to the LocalSettings.php
#settings for fileLinkExtension $wgFilelinkExtensionPath = "extensions/FilelinkExtension"; include("$IP/$wgFilelinkExtensionPath/FilelinkExtension.php"); #end settings for fileLinkExtension
To be done
- Consider this as an alpha version. Not tested for many OS/browser environments yet.
- Conversion of filenames to urls (e.g. escaping the spaces, converting \ to / in windows, etc.) are done in an ad-hoc fasion. Have to find a better way to do this.