Jun 1, 2004, 2:40 PM
Post #6 of 6
(1835 views)
Permalink
Richards,Michael wrote:
> Another related question: is there a way to *link* to an external
> file on a file system, using perhaps UNC (Universal Naming
> Convention), e.g. [<\\servername\sharename\path\filename> External
> File] or some such syntax? On some Mediawiki installations other than
> Wikipedia (e.g. ours) this would be extremely useful to link to
> non-wiki flat files (e.g. Microsoft Word).
If you enable the file: URL scheme you can do this:
file://servername/sharename/path/filename
or
[file://servername/sharename/path/filename External file]
There's no option for it so you have to make the change manually. In
includes/Parser.php there's a function like this:
/* private */ function replaceExternalLinks( $text )
{
$fname = "Parser::replaceExternalLinks";
wfProfileIn( $fname );
$text = $this->subReplaceExternalLinks( $text, "http", true );
$text = $this->subReplaceExternalLinks( $text, "https", true );
$text = $this->subReplaceExternalLinks( $text, "ftp", false );
$text = $this->subReplaceExternalLinks( $text, "irc", false );
$text = $this->subReplaceExternalLinks( $text, "gopher", false ;
$text = $this->subReplaceExternalLinks( $text, "news", alse );
$text = $this->subReplaceExternalLinks( $text, "mailto", false );
wfProfileOut( $fname );
return $text;
}
Add in another line to the bunch:
$text = $this->subReplaceExternalLinks( $text, "file", false );
(The boolean value controls whether to allow using those external URLs
as image links if they edit with '.jpg' or '.gif' etc.) Such file URLs
might not work on different platforms, but if you're an all-windows shop
it should work consistently.
-- brion vibber (brion @ pobox.com)