IL EEEEEST VIIIIIVAAAAAANT !!!!
Il a fallu mélanger les deux codes (celui de Ahamay et celui de Henning Heinz) mais à la fin j'ai réussi à obtenir quelque chose de satisfaisant (et que je me hâte de poster illico) :
Form "MonDocument" :
- Création des champs suivants :
LienDoc : Texte Riche/Modifiable ;
DocLinkUNID : Texte/Modifiable ;
DbServer : Texte/Calculé à la création, Valeur : [syntax="Formula"]@Name([CN]; @Subset(@DbName; 1))[/syntax]
PathBase : Texte/Calculé à la création, Valeur : [syntax="Formula"]@ReplaceSubstring(@Subset(@DbName;-1); "\\"; "/")[/syntax]
- Événement "QueryClose" du Form : [syntax="LotusScript"]Sub Queryclose(Source As Notesuidocument, Continue As Variant)
Dim rti As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Dim doc As NotesDocument
Dim rtrange As NotesRichTextRange
Dim rtlink As NotesRichTextDocLink
Dim linkProperties As String, tdGlobal As String
Dim tdReplicaID As String, tdViewID As String, tdDocID As String, tdServer As String, tdPath As String
If source.EditMode = False Then
Continue = True
Exit Sub
End If
Set doc = Source.Document
Set rti = doc.GetFirstItem("LienDoc")
Set rtnav = rti.CreateNavigator
If rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then
Set rtrange = rti.CreateRange()
Set rtlink = rtnav.GetElement
Else
Continue = True
Exit Sub
End If
Dim linkDb As New NotesDatabase("", "")
Call linkDb.OpenByReplicaID(rtlink.ServerHint, rtlink.DbReplicaID)
Call Source.FieldSetText("DocLinkUNID", rtlink.DocUNID)
Call Source.Save()
Continue =True
End Sub[/syntax]
Vue "MaVue" : - Création d'une nouvelle colonne : Nom : "DocLink" ;
Options à cocher (1èr onglet) : "Valeurs sous forme d'icônes" + "Colonne modifiable" ;
Valeur de colonne : [syntax="Formula"]Icon := 41;
Icon[/syntax]
Style (4ème onglet) : Nombre.
- Événement "InViewEdit" de la vue :
[syntax="LotusScript"]Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant, Continue As Variant)
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim caret As String
Dim URLparts(4) As String
caret = Source.CaretNoteID
If caret = "0" Then Exit Sub 'check for click on a doc, not a category
Set db = Source.View.Parent
Set doc = db.GetDocumentByID(caret)
'build the url to the link target document
URLparts(0) = "Notes:/" 'Notes protocol for the URL
URLparts(1) = doc.DbServer(0) 'this assumes the target db is on the same server as the current db
URLparts(2) = doc.PathBase(0) 'your db path goes here
URLparts(3) = "0" 'special view placeholder, don't change
URLparts(4) = doc.DocLinkUNID(0) 'replace with fieldname containing a UNID for the target doc
Call ws.URLOpen( Join( URLparts, "/") )
End Sub[/syntax]
Il ne reste plus qu'à cliquer sur l'icône du DocLink et il s'ouvrira comme si on avait cliqué sur l'icône contenue dans un document.
Encore un grand merci à Ahamay et à Henning Heinz pour leur travail ainsi qu'à toi, Abertisch, (de m'avoir répondu et remonté le moral au moment où j'allais tout envoyer valser)...et bien entendu, merci à tout ceux qui contribuent à la vie de ce forum (qui m'a aidé maintes de fois à comprendre l'obscure fonctionnement de Lotus Notes).
Bonne journée et bonne continuation à tous.
Max.