A minor dominoWiki enhancement!.... :-)
Warning: there's a bit of Lotuscript & HTML code in this entry if you're not interested in Notes/Domino development then you might want to skip this one...
You may remember from an earlier posting we're using Ben's dominoWiki in our shiny new work Intranet (I've been a permie for a while now
)
Someone asked if they could link to a network share using unc syntax from a dominoWiki page. For example I might want to link to a shared directory containing some interesting files. This would be the equivalent of typing the following in the browsers address bar:
file://///myserver/myshare
or
creating an HTML link like
<a href="file://///myserver/myshare">my interesting files</a>
or
\\myserver\myshare
dominoWiki doesn't seem to support this out of the box. We tried all sorts of tag combinations <nowiki> <code> etc and couldn't get it to work.
So a quick dip into the code to find the function that handles stuff between single brackets [ ]. The function is declared in the script library wiki.class (declarations section) as follows:
Public Function convertSingleBracket (txt As String) As String
It handles quite a few protocols http, https, ftp and so on but "file" is a reserved dominoWiki word to enable linking to attachments on a page. I didn't want to lose that functionality so I extended the convertSingleBracket function with a new protocol: unc:// as in [unc://myserver/myshare my interesting files].
The function uses Select Case to process each protocol so I added:
Case "unc"
newText = |<a class="wiki-| + protocolText + |link" href="file:///| & Right(leftText,Len(leftText)-Len("unc://")) & |">|
If (rightText = "") Then
newText = newText & leftText & |</a>|
Else
newText = newText & rightText & |</a>|
End If
Just before the Case Else statement.
Now when you add something like [unc://myserver/myshare my intersting files] to a dominoWiki page, save and view the page the HTML is <a href="file://///myserver/myshare">my interesting files</a>.
This works out of the box for IE but not for FireFox (and possibly other browsers) I think to try and prevent exploits that might allow external parties to grab usernames/passwords or similar. But there is a workaround or two. You can tell Firefox to trusting file links to local files when the page comes from a particular domain (like your intranet).
Workaround 1:
Create a file called user.js in your firefox profile directory (if you don't know where that is look here) the file should be plain text and contain these three lines:
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "<INSERT_YOUR_INTRANET_FQDN_HERE>");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
for example
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://intranet.jasonhookonline.com");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
Save the file and restart Firefox. For more information try these pages Very readable explanation (look for the heading "Firefox 1.5 and local files") or more comprehensive explanation.
Workaround 2:
Install a Firefox add-on called localLink. Which allows you to right click on a link that executes file:/// and open the link via a menu.
OK so neither workaround is great but they work!
That's it I think. Time to go home
Jason
You may remember from an earlier posting we're using Ben's dominoWiki in our shiny new work Intranet (I've been a permie for a while now
Someone asked if they could link to a network share using unc syntax from a dominoWiki page. For example I might want to link to a shared directory containing some interesting files. This would be the equivalent of typing the following in the browsers address bar:
file://///myserver/myshare
or
creating an HTML link like
<a href="file://///myserver/myshare">my interesting files</a>
or
\\myserver\myshare
dominoWiki doesn't seem to support this out of the box. We tried all sorts of tag combinations <nowiki> <code> etc and couldn't get it to work.
So a quick dip into the code to find the function that handles stuff between single brackets [ ]. The function is declared in the script library wiki.class (declarations section) as follows:
Public Function convertSingleBracket (txt As String) As String
It handles quite a few protocols http, https, ftp and so on but "file" is a reserved dominoWiki word to enable linking to attachments on a page. I didn't want to lose that functionality so I extended the convertSingleBracket function with a new protocol: unc:// as in [unc://myserver/myshare my interesting files].
The function uses Select Case to process each protocol so I added:
Case "unc"
newText = |<a class="wiki-| + protocolText + |link" href="file:///| & Right(leftText,Len(leftText)-Len("unc://")) & |">|
If (rightText = "") Then
newText = newText & leftText & |</a>|
Else
newText = newText & rightText & |</a>|
End If
Just before the Case Else statement.
Now when you add something like [unc://myserver/myshare my intersting files] to a dominoWiki page, save and view the page the HTML is <a href="file://///myserver/myshare">my interesting files</a>.
This works out of the box for IE but not for FireFox (and possibly other browsers) I think to try and prevent exploits that might allow external parties to grab usernames/passwords or similar. But there is a workaround or two. You can tell Firefox to trusting file links to local files when the page comes from a particular domain (like your intranet).
Workaround 1:
Create a file called user.js in your firefox profile directory (if you don't know where that is look here) the file should be plain text and contain these three lines:
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "<INSERT_YOUR_INTRANET_FQDN_HERE>");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
for example
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://intranet.jasonhookonline.com");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
Save the file and restart Firefox. For more information try these pages Very readable explanation (look for the heading "Firefox 1.5 and local files") or more comprehensive explanation.
Workaround 2:
Install a Firefox add-on called localLink. Which allows you to right click on a link that executes file:/// and open the link via a menu.
OK so neither workaround is great but they work!
That's it I think. Time to go home
Jason


Nice job Jason, make sure you send the updated template to Ben so that it will get incorporated into a future version.
Matt
Yep, Jason's been great about updating me with his work... rest assured we will be adding this stuff in future releases. Thanks Jason!
Ben's been really kind too answering the questions about dominoWiki. So thanks Ben for that and for the wiki itself
Jason