IBM Notes and Domino 9.0 Social Edition beta now available

Ed Brill just announced that the IBM Notes and Domino 9.0 Social Edition betas are now available for download. The beta program is open for everyone so go ahead and sign up and try the new IBM Notes 9.0 🙂 Use the 9.0 beta forum for feedback.

Here’s the beautiful IBM Notes 9.0 (Mac) client:
IBM Notes 9

I have upgraded my developer environment to 9.0 and look forward to lots of improvements to IBM Domino Designer.

I’m speaking at IBM Connect 2013

Session abstract notifications for the IBM Connect 2013 conference were sent out yesterday (the conference previously known as Lotusphere). I submitted two session abstracts with Bruce Elgort and I am proud to say that we had one of the session abstracts accepted!

Bruce and I will be speaking about “How We Built CollaborationToday.info in a Matter of Weeks” on the new Spotlight on IBM Business Partners track.

This is the session abstract:

In this session, we will show you how we developed a great-looking, user-driven community news site called “Collaboration Today”. We will walk you through how we developed the site’s user experience and architecture. We will dive into how we made the app scalable, quick and accessible on all mobile devices and web browsers using responsive design. Best of all, this app is built with open-source components and is itself an open-source app available for you to download and use today. We will show you how other apps can utilize and present the content from Collaboration Today using the app’s API.

The session focuses on the Collaboration Today news site that was released by OpenNTF in September 2012 and recently released as open source too.

This will be my first appearance as speaker at Lotusphere and IBM Connect. I am really looking forward to it! See you there 🙂

XPages: dynamically updating rich text content in a CKEditor

For the Sherlock Web solution I had a need to be able to update rich text content in a CKEditor with rich text content from backend document templates. These backend document templates can be created and edited with the Lotus Notes client and will in some cases contain rich text content of type Rich Text (and not MIME). I can not change these backend document templates to be stored as MIME, so in order to be able to update the rich text content in a CKEditor, I thought I had to wrestle with conversion of Rich Text to MIME.

I spent a lot of time getting Rich Text to MIME conversion to work in order to add the backend document templates to the rich text content in the CKEditor. I ended up with a clumsy solution that involved saving the XPages backend document in order for the updated content to appear. I had a lot of inspiration from the answers to this Stack Overflow question on appending and prepending text to a rich text field. It worked, but…

A couple of good XPages guys suggested I took a look at using the datasource getValue() and setValue() methods instead. This turned out to be right way to go.

Part of trick is that I use the wrapDocument() function from XSnippet  to get a NotesXspDocument representation of the backend document template. I can then just use getValue(“body”) on that NotesXspDocument followed by getHTML() to get a HTML representation of the content. Brilliant!

The setValue method on the inputRichText control expects MIME and not text, so I use an XPages supplied method that converts from HTML to MIME. This is necessary in order to save the document at all.

So here is the important part of my code that reads content from the target field and updates it with a backend document field contaning Notes Rich Text, and ends up saving it as MIME:

if (templateDoc != null) {
   // Insert contents into existing field
   if (templateDoc.hasItem("body")) {
      var orgValue = document.getValue(bodyFieldName);
      var origValue;
      if (orgValue != null) {
         // The target field already has content
         origValue = ((typeof orgValue == "string")? orgValue : orgValue.getHTML()) + "";
      } else {
         // The target field is empty
         origValue = "";
      }

      var templateField = wrapDocument(templateDoc).getValue("body");
      importPackage(com.ibm.xsp.http);
      document.setValue(bodyFieldName, com.ibm.xsp.http.MimeMultipart.fromHTML(origValue + templateField.getHTML()));
   }
}

I also used an answer from Sven Hasselbach on partially refreshing contents in a CKEditor to put my inputRichText control inside a div control in order to partially refresh the div control when the above logic runs.

Using this method I am completely rid of the need to save the backend document. This just works! 🙂

I have added the part about updating the inputRichText control with MIME to the OpenNTF XSnippets catalog.

Notice: this code snippet does not work with embedded images and attachments.

Update October 2013: Here’s my solution for adding embedded images.