Anonymous
Domino 2.0 Rich Internet Applications with IBM Lotus Notes/Domino
You are here: Today » A Domino WysiWiki
« The first anniversary of my blog
The future of Domino web development »

A Domino WysiWiki

Everyone knows the brilliant Domino Wiki of Ben Poole. At my company however, we needed a wiki solution that had to blend in with other applications, all together in one Notes database. Furthermore, most non-technical people didn't like the WikiMarkup used in the original WikiWiki, in the famous Wikipedia and also in Ben's Domino Wiki. We needed a Wysiwyg wiki. So I decided to combine my rich text editor with wiki features.

The power of the wiki

The ultimate power of wikis is in the WikiLinks: any word or phrase with a special syntax is automatically converted in a hyperlink to another WikiPage. If this page not yet exists, following the link lets you create a new page. In the first wikis, any CamelCase word was considered as a WikiLink. Later on, this was heavily discussed, because it leaded to malformed words: you would type LotusNotes or BenPoole instead of 'Lotus Notes' and 'Ben Poole' to make WikiLinks. Therefor, another solution was proposed: anything between double square brackets would be considered a WikiLink. And you could provide a page key and a more explicit text for the link by using the pipe character. A page leading to "wiki/lotus-notes" would be entered as: [[lotus-notes|IBM Lotus Notes]]. This would result in: <a href="/wiki/lotus-notes">IBM Lotus Notes</a> on the WikiPage.

The LotusScript to resolve WikiLinks

This script converts the HTML of a WikiPage in the QueryOpen agent:

getWikiDoc returns the UniversalId if a Wikipage if it exists, an empty string if not:

Function getWikiDoc(Byval key As String)
    Dim entry As NotesViewEntry
    
    Set entry=wikiLookup.GetEntryByKey(key)
    If entry Is Nothing Then
        getWikiDoc=""
    Else
        getWikiDoc=entry.UniversalID
    End If    
End Function

getWikiLinks resolves all WikiLinks in the XHTML text:

Function getWikiLinks(Byval txt As String)As String
    On Error Goto catch
    
    Dim tmp As New stringbuffer(100)
    Dim arr, i As Integer,p,pp,q,qq
    
    arr=Split(txt, "[[")
    
    tmp.add arr(0)
    For i=1 To Ubound(arr)
        p=Split(arr(i), "]]")
        pp=Split(p(0)& "|" & p(0), "|")
        q=replacesubstring(Lcase(pp(0)), " ", "-")
        qq=getWikiDoc(q)
        If qq="" Then
            tmp.add |<a href="| & path & |wikipage?readform&key=| & q & |" class="wiki-new" title="wiki:new">| & pp(1) & |</a>|
        Else
            tmp.add |<a href="| & path & |pub/| & q & |" class="wiki-page" title="wiki:| & q & |">| & pp(1) & |</a>|
        End If
        tmp.add p(1)
    Next
    
    Goto finally
catch:
    Error Err, Error & " in " & Getthreadinfo(1) & ", line " & Erl
    Resume finally
finally:
    getWikiLinks=tmp.collapse(NEWLINE)
End Function

Next?

Two other powerful features that any wiki needs: version and comparison of versions. But that's for another day.

Star rating

100%

Comments

  1. 24/12/2008 00.22.24, gaetano gastaldin

    Hi , we are working in similar project and interested to cooperate .

    My best//g

To add a comment, log in or register as new user. It's free and safe.