I'm currently creating an Intranet for a customer using Notes as the client.
Yes, you can do this, and yes, it can be full-featured and nice looking!

There are 4 types of links we need to be able to use:
Information, Attachment, Notes Database and Internet Site.
Instead of letting my users use different kind of hotspot links,
I just teach them 'copy as document link' and 'create/hotspot/link'.

Here's the issue: the document they link to, needs to be intelligent.
Here are my 4 types of links, and the wanted behavior:

  • Information: just open the document to look at the details
  • Attachment: open the (first) attachment, do not open the document itself
  • Notes Database: open a database, do not open the document itself
  • Internet Site: open a URL, do not open the document itself

I created a simple form called 'News':
Image:Intelligent Document Launching
Title, Type and Body is always visible.
Link, Server and Database depending on the selected Type.

Here's the view:
Image:Intelligent Document Launching
On the form, there's a PostOpen script:
(QueryOpen would have been more interesting, but you can't use certain UI calls)

Sub Postopen(Source As Notesuidocument)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim URL As String
Dim dbserver As String
Dim dbname As String

If Not source.EditMode Then 'read mode only
Set doc=source.Document
Set db=s.CurrentDatabase

Select Case doc.Type(0)
Case "Attachment"
'I can get to the object, but I can't get it to launch
Case "DB"
If dbserver="" Then dbserver=db.Server
If Lcase(doc.Server(0))="local" Then dbserver=""
Call source.Close(True) 'the doc should not open
Call ws.OpenDatabase(dbserver, dbname)
Case "Link"
If Instr(URL,"//")=0 Then URL="http://" & URL
Call source.Close(True) 'the doc should not open
Call ws.URLOpen(url)
End Select
End If
End Sub
Important here is, that the code only executes when in Read-mode.
I still want to be able to edit it.
Most of the code should be self-explanatory.
Note that there is no code for launching an attachment ! I couldn't get it to work, without saving the attachment first, and I didn't like doing this.
If you have a clean way of opening the first attachment in LS, please let me know.

Notes has a build in form property for auto-launching an attachment.
So I created a EMPTY form called 'AutoLaunch', with this property set:
Image:Intelligent Document Launching
Here's the clue. Did you notice there is a field on the 'News' form called 'Form' ?
It's computed like this:
@If(Type="Attachment" & @Attachments;"AutoLaunch";"News")
So, when the type is Attachment, (and there is one), the form is saved as 'AutoLaunch', else as a regular 'News'.
When you double click (or use the doclink in a hotspot), the correct form is used, with the correct behavior.
There is one more thing to solve: the user needs to be able to modify the document (using the 'News' form).
The code behind the 'Modify' button on the view is:
The form of the selected document is switched back to 'News' and the form is opened in edit mode.
One small issue: if the user closes an 'Attachment' type document, without saving, the form field is not computed back to 'AutoLaunch'.
Easily fixed on the form during QueryClose:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
If source.EditMode Then
If source.Document.Type(0)="Attachment" Then Call source.Save
End If
End Sub

Interesting? Let me know!
Here's a sample db, with the 2 forms and the view:

Category:  Lotus  Notes  Domino  | TechnoratiTechnorati: , ,