Genii Weblog

Mimic a directory structure in Domino

Fri 4 Feb 2005, 01:27 PM



by Ben Langhinrichs
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
  rtitem.Save
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.

What has been said:


283.1. Neil Gower
(09/02/2005 02:06)

Hi,

Dont suppose you could post the db with the editor in, I am currently just starting to look at this, and a db with all the files imported would be a great help..


283.2. Ben Langhinrichs
(02/09/2005 07:02 AM)

Excellent question. I'll send you one for now, but in the near future I intend to create these for several major rich text editors and I will make them available from my website (with CoexEdit integration ready if you want it, I might add).


283.3. Johan Känngård
(03/03/2005 02:27 AM)

The Query string generated by some FCKeditor buttons/commands are invalid Domino URLs, like fckeditor.html?InstanceName=xx. These has to be changed into URLs like fckeditor.html?Open&InstanceName=xx... Have you done this with the current version of FCKeditor? I am very interested in obtaining that database then :-)

- Johan

http://dev.kanngard.net


283.4. mark davenport
(05/07/2008 09:19 AM)

Ben;

I'm wondering if you might still be able to send along the above-mentioned sample db where you emulated the directory structure of FCKeditor and it's files using Domino's file resources...

TIA