Archive for April, 2009

Mimicing the preview-switch option

I thought I give this Thursday a ‘SnTT’ swing (what happened with that phenomena?).

My collegue Tomas can be sometime tough with progressive ideas, but this makes you just try that extra effort to make something in Notes a little bit better than expected.

When I asked him for ideas for a standard development template he liked the ideas to have multiple collapsible preview panes BUT he wanted the option for the user to switch in preview in bottom or preview on side, just like in the Notes 8 mail template.

previewbutton

Since we know that the mail is a composite application with it specific functionality a different approach to provide something similar in the ‘classic’ client.

Solution

The following image shows the frameset for my application:

main_frameset2

So in frame ‘main’ I have a frameset. By default the frameset is the one that contains a preview on the bottom. This frameset is called ‘$fs-notes-documents-vr’ (vr for vertical). I have a second frameset that is called ‘$fs-notes-documents-hr’ (hr vor horizontal) that will be displayed in frame ‘main’ when the user chooses for a preview on side.

In my horizontal menu (alternative menu) I have added 2 action buttons:

  • Preview on Bottom.

@SetTargetFrame(“Main”);
@Command( [OpenFrameset] ; “$fs-notes-documents-vr” );
@Environment(“AppCode-AppPreview”;”$fs-notes-documents-vr”)

  • Preview on Side.

@SetTargetFrame(“Main”);
@Command( [OpenFrameset] ; “$fs-notes-documents-hr” );
@Environment(“AppCode-AppPreview”;”$fs-notes-documents-hr”)

These actions will place the appropiate frameset in frame ‘main’ and set an environment variable. This variable is being read when the ‘default’ frameset (the frameset that contains frame ‘main’) is being used when opening the application.

For frame ‘main’ I have as computed value:

varFrSetDefault:=@Environment( “AppCode-AppPreview” );
@If ( varFrmSetDefault = “” ; “$fs-notes-documents-vr” ; varFrmSetDefault)

So if the user has used the application before and has set a preview preference the next time the user comes in the application the ‘prefered’ frameset / preview option is being used!

Too bad there is no option to read which design element is currently used in a frame (like in a @GetTargetFrame). In that way I would have been able to re-open the currently opened view / folder (okej I could use another environment variable for that).

Comments (1)

Maintaining the universal identifier when copying documents from one App. to another

I received an incident that some documents where removed from an application in production. Since it was not sure when the documents where deleted and what other changes have occured in the application the quickest way was to quickly copy the documents from the recovery database back into the production database.

Unfortunately the documents are being linked on our intranet so a copy and paste action would modify their universal ids.

This code will reset the universal ID to the one of the original even though a copy is being made via an agent:

Sub Initialize

Dim ws As New NotesUIWorkspace

Dim destinationDb As New NotesDatabase( “ServerName”, “directory\application.nsf” )

Dim uiView As NotesUIView

Set uiView = ws.Currentview

Dim dc As NotesDocumentCollection

Set dc = uiView.Documents

Dim orgDoc  As NotesDocument

Dim newDoc  As NotesDocument

Dim junkUNID As String

Dim dontWantThisDoc  As NotesDocument

Set orgDoc = dc.GetFirstDocument

Do Until (orgDoc Is Nothing)

Set newDoc = orgDoc.CopyToDatabase(destinationDb)

junkUNID = newDoc.UniversalID

newDoc.UniversalID = orgDoc.UniversalID

Set dontWantThisDoc = destinationDb.GetDocumentByUNID(junkUNID)

‘Call dontWantThisDoc.Remove(True)

Set orgDoc = dc.GetNextDocument(orgDoc)

Loop

End Sub

Leave a Comment