Drag & Drop documents in Lotus Notes?

A tipical Lotus Notes application is a kind of Documents Library.
For example you design a form containing Subject Field,
TimeDateCreation Field , User Field ,Body Field (Rich Text).
You design a view sorted by 3 columns (except body field) and
finally you have your Documents Library.
If you put this application on Domino server all user can add

How to make users able to creating documents in Documents Library ?

First Solution (Classic)
Create an action button with @command([compose]) in view.
In that way users have to open application every time they wants to
create new documents.

Many users ask me how to create documents without open application.
(Because they are just over the source document with mouse pointer)
For example form mail they want to be able to tranfer a document in
library to make it available for others users.

Second solution (User-Enemy)
Create a mail-in database entry in Domino address book and suggest
users to forward document to library.

Third solution : DRAG&DROP. (My best solution)
To make this possible you have to :
- Bookmark application in Notes Client main Bookmarks bar (main bar only)
In the first design element you defined to be a first opened
by application. (Es. Page or View in frameset) :
- Define a notesdocument global variable.
- Write a lotusscript in queryopen event to get notesdocument through
notesuiview and copy it into new library notesdocument.
(es. rendertortitem)
- write a lotusscript in postopen event to open new document in edit

Now users can select a document form any Domino application views,
drag it over bookmarked icon and they will be prompted to save a new document
in Documents Library.

This is possible because in queyopen event you can set dragging document
object to notesdocument class.

Scenario :"Main" FrameSet contaning a "Main" page.
This is the "Main" Page code

Dim NewDoc As NotesDocument

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

Dim Ws As New NotesUIWorkspace
Dim Session As New NotesSession
Dim Db As notesDatabase
Dim UiView As NotesUiView

Dim Doc As NotesDocument
' Dim NewDoc As NotesDocument
Dim RtItem As NotesRichTextItem
Set UiView = Ws.CurrentView
If Not(UiView Is Nothing) Then
Set Coll = UiView.Documents

If Coll.Count = 1 Then

Set Doc = Coll.GetFirstDocument
Set Db = Session.CurrentDatabase
Set NewDoc = New NotesDocument(Db)
NewDoc.Form = "Main"
Set RtItem = New NotesRichTextItem(NewDoc,"Body")
Call Doc.RenderToRTItem(RtItem)
Call NewDoc.ComputeWithForm(False,False)

End If
End If
End Sub

Sub Postopen(Source As Notesuidocument)
Dim Ws As New NotesUIWorkspace
If Not(NewDoc Is Nothing) Then
Call Source.Close
Call Ws.EditDocument(True,NewDoc)
End If
End Sub

No comments: