Insert HTML action buttons for the Notes Client BlogEntry form
BTW: This is my 50st post. How time flies.
Both BlogSphere and the IBM blog template convert Notes RichText in HTML. In BlogSphere you also have the option to use plain text with hand coded HTML tags. My own blog template has only plain text, so up to now, I hand typed every single HTML tag. But then I saw some very nice Actions in the BlogSphere template to insert HTML tags.
The actions
Copying the actions from one database to another is easy. Next, I adapted them to my own needs. My target field is called "Content" and also the HTML I want is different. In the end, I even added my tool to convert code to HTML:

Which gives this in my Notes Client:

Section
This adds a header and a paragraph.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uiDocument As NotesUIDocument
Dim CRLF As String
CRLF=Chr(13)+Chr(10)
Set uiDocument = workspace.CurrentDocument
If uidocument.CurrentField = "Content" Then
Call workspace.currentdocument.InsertText(CRLF+"<h2></h2>"+CRLF+"<p></p>"+CRLF)
End If
End Sub
Paragraph
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uiDocument As NotesUIDocument
Dim CRLF As String
CRLF=Chr(13)+Chr(10)
Set uiDocument = workspace.CurrentDocument
If uidocument.CurrentField = "Content" Then
Call workspace.currentdocument.InsertText("<p></p>"+CRLF)
End If
End Sub
Unordered list
An unordered list must have at least 3 items. Less looks kinda stupid.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uiDocument As NotesUIDocument
Dim CRLF As String
CRLF=Chr(13)+Chr(10)
Set uiDocument = workspace.CurrentDocument
If uidocument.CurrentField = "Content" Then
Call workspace.currentdocument.InsertText("<ul>"+CRLF+"<li></li>"+CRLF+"<li></li>"+CRLF+"<li></li>"
+CRLF+"</ul>"+CRLF)
End If
End Sub
Image
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uiDocument As NotesUIDocument
Dim CRLF As String
CRLF=Chr(13)+Chr(10)
Set uiDocument = workspace.CurrentDocument
If uidocument.CurrentField = "Content" Then
Call workspace.currentdocument.InsertText(|<img src="" alt="" />|+CRLF)
End If
End Sub
Did I mention that I have a formula to calculate all paths of attachments when I use them in my text? I only have to specify the filename:
a:=@AttachmentNames;
b:=DbPath+"archive/"+PostName+"/$file/"+@AttachmentNames;
@ReplaceSubstring(@Implode(Content; @NewLine); a; b)
External link
For hyperlinks, I use the class "external" which triggers a JavaScript behaviour to open the link in a new window. The link also gets a small icon (CSS) to indicate this.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uiDocument As NotesUIDocument
Set uiDocument = workspace.CurrentDocument
If uidocument.CurrentField = "Content" Then
Call workspace.currentdocument.InsertText(|<a href="" class="external"></a>|+CRLF)
End If
End Sub
And finally
I've added a link to my own 'code to HTML' tool so that I never have to remember and type the URL again. You may do the same and link the tool in your blog. If it gets really popular, I will put Google Ads on the page and become very rich (just kidding).
@URLOpen("http://blog.lotusnotes.be/domino/code2html")
Many thanks, BlogSphere. I still have to get used to this luxury. At present, I find myself starting to type the tags by hand, stopping half-way because I remember I don't have to do this anymore, erasing the typed tags and selecting them from the action menu. Oh well. Have fun.
Comments
05/07/2007 08:55:39, Erwin Heeren
>> This is my 50st post. How time flies. Where do you find the time to blog? I hope you spend your time blogging on a customer site, instead of stealing time from your daughter or your contrabass ;-) BTW, thanks for being my and other people's Lotus Notes development Guru. Without you, I would not love Notes the way I do.
05/07/2007 08:58:58, Erwin Heeren
:: find myself starting to type the tags by hand What's your reason for not using one of those rich text editors?
05/07/2007 14:08:36, Michel Van der Meiren
@Erwin: Thanks! My daughter is on vacation in Switzerland at the moment, and my next gig is in Den Haag (The Netherlands) on July the 13th :-) Not using a rich editor: I use Notes to update my blog, and Notes RichText has only limited possibilities to convert to XHTML 1.0 strict. I'll explain this in a next post. For the web interface, I plan to make my own Rich Text Editor because all the ones I find on the internet load too slow and/or do not output valid XHTML.
15/07/2007 15:56:57, Thomas Bahn
You could use some NotesUIDocument methods to cut selected text into the clipboard, insert starting tag, paste clipboard, insert ending tag. This way you could "convert" already written text into a headline, a link or so.
Thomas http://www.assono.de/blog.nsf/
To add a comment, log in or register as new user. It's free and safe.