Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs

February, 2005
  01 02 03 04 05
06 07 08 09 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28

Search the weblog

Genii Weblog

Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.

Fri 4 Feb 2005, 01:27 PM
I have been working with CoexEdit, and needed a template that used the FCKEditor.  When I have done this before, I have simply stored the FCKEditor directory under the \lotus\domino\data\domino\html\FCKEditor directory, which works reasonably well, but which requires a level of access to the directory structure of the server that I don't always have, and it works less well with CoexEdit which likes to use image resources, since those can be accessed via both the Notes client and the web browser.

So, I decided to mimic the directory structure in the Notes database.  I used the existing Midas ability to create image resources, plus our new Midas ability to create file resources, including style sheets, and wrote a fairly simple agent to create the whole structure.  The only really important part of the agent is:

Sub CreateResource(db As NotesDatabase, name As String, src As String)
  Dim rtitem As New GeniiRTitem
  If Instr(Lcase(name), ".gif") > 0 Or Instr(Lcase(name), ".jpg") > 0 Then
   Set rtitem = gSession.CreateImageResource(db.FilePath, db.FilePath, name, |SourceFile='|+src+|' URLEncode='Yes'|)
  Elseif Instr(name, ".") > 0 Then
   Set rtitem = gSession.CreateFileResource(db.Server, db.FilePath, name, |SourceFile='|+src+|' URLEncode='Yes'|)
  End If
End Sub

which creates the image and file resources.  A key component is the URLEncode='Yes', which switches backslashes into forward slashes among other things.  This is where the beauty of the scheme comes in.  Both Internet Explorer and Firefox will switch from backslashes to forward slashes automatically, so even though the FCKEditor assumes you have this in a directory structure, the directory is translated.  The image resources then have names such as editor/dialog/images/logo_fckeditor.gif, which are allowed in Notes.

But a picture is worth a thousand words.  Here is what it looks like in Firefox, with an image down in the directory structure displayed.  Note the circled words, both in the URL and in the properties for the image.  They don't look like ordinary Domino URLs, but that is all they are.

Inline JPEG image

Copyright 2005 Genii Software Ltd.