par oguruma » 25 Jan 2004 à 22:03
1) bibliothèque STEControlSendToLibSynopsis de base de documents Lotus Notes - créé à 21:38:37 le 25/01/2004Informations de bibliothèque de codesNom : STEControlSendToLibDernière modification : 25/01/2004 20:51:41Code LotusScript :Option PublicConst CTRL="[PIECES JOINTES NON AUTORISEES]"Const VIMGROUPS ="($VIMGroups)"Const NAB="Names.NSF"Dim Ws As NotesUIWorkSpaceDim Session As NotesSessionDim Db As NotesDatabaseDim Note As NotesDocumentDim UIDoc As NotesUIDocumentDim DbAddressBook As NotesDatabaseDim SendField (1 To 3) As StringDim Zone (1 To 3) As StringDim ItemSendTo As NotesItemDim ViewVIMGroups As NotesViewDim DocVIMGroups As NotesDocumentDim CommonUser As StringDim UserName As StringSub InitializeEnd SubSub ControlSendTo Dim OkSendTo (1 To 3) As Integer Dim FieldOK As Integer Dim i As Integer On Error Goto handler '// Init de l'environnement Call InitArraySendTo Call GetVIMObject '// pour forcer le optimizedAddress Call uidoc.refresh '// Analyse des champs SendTo, CopyTo, BlindCopyTo For i=1 To 3 If Note.HasItem(SendField(i)) Then Set ItemSendTo=Note.GetFirstItem(SendField(i)) If Trim$(ItemSendTo.Text)<>"" Then OkSendTo(i)=ProcessField(i) Else OkSendTo(i)=True End If End If Next I '// Pour envoyer le message les trois zones doivent être correctes FieldOK= OkSendTo(1) And okSendTo(2) And OkSendTo(3) '// On enregistre dans le Notes.INI afin de récupérer la valeur de la variable dans l'agent If FieldOK Then Call Session.SetEnvironmentVar( "STEControlSendTo", "OK",False ) Else Call Session.SetEnvironmentVar( "STEControlSendTo", "NOK",False ) End If Exit Subhandler: Messagebox "erreur " & Err & " " & Error$ & " ligne " & Erl,16,"ControlSendTo" Resume finfin:End SubFunction ProcessField (C As Integer) As Integer Dim Ret As Integer Dim K As Integer Dim Dest As Variant On Error Goto handler Dest=ItemSendTo.Values Ret=True For K=0 To Ubound(Dest) If IsGroup(Dest(K)) Then '// Le groupe peut-il recevoir des pièces jointes If note.HasEmbedded Then If Not Autorized () Then Messagebox Zone(C) & " - Vous n'êtes pas autorisé à envoyer des pièces jointes à ce groupe " & Dest(K),48,"Envoyer - " & ItemSendTo.Name Ret=False Dest(K)="" End If End If End If Next K ProcessField=Ret Exit Functionhandler: Messagebox "erreur " & Err & " " & Error$ & " ligne " & Erl,16,"ProcessField" Resume fin fin: ProcessField=RetEnd FunctionFunction Autorized () As Integer Dim itemDescription As NotesItem On Error Goto handler Autorized=True If docVimGroups.HasItem("ListDescription") Then Set itemDescription=docVimGroups.getFirstItem("ListDescription") If Instr(itemDescription.text,CTRL) Then Autorized=False End If End If Exit Functionhandler: Messagebox "erreur " & Err & " " & Error$ & " ligne " & Erl,16,"Autorized" Resume finfin:End FunctionFunction IsGroup (Grp As Variant) As Integer Dim N As NotesName On Error Goto handler Set N=New NotesName(Grp) Set DocVIMGroups=ViewVIMGroups.GetDocumentByKey(N.Common) If DocVIMGroups Is Nothing Then IsGroup=False Else IsGroup=True End If Exit Functionhandler: Messagebox "erreur " & Err & " " & Error$ & " ligne " & Erl,16,"isGroup" Resume finfin:End FunctionSub InitArraySendTo On Error Goto handler SendField(1)="SendTo" SendField(2)="CopyTo" SendField(3)="BlindCopyTo" Zone(1)="Champ Pour :" Zone(2)="Champ CC :" Zone(3)="Champ CCC :" Exit Subhandler: Messagebox "erreur " & Err & " " & Error$ & " ligne " & Erl,16,"ControlSendTo" Resume finfin:End SubSub GetVIMObject On Error Goto handler Set Ws=New NotesUIWorkSpace Set Session=New NotesSession Set Db=Session.CurrentDatabase Set UIDoc=Ws.CurrentDocument Set Note=UIDoc.Document Set DbAddressBook=New NotesDatabase(Db.Server,NAB) Set ViewVIMGroups=DbAddressBook.GetView(VIMGROUPS) CommonUser=Session.CommonUserName UserName=Session.UserName Exit Subhandler: Messagebox "erreur " & Err & " " & Error$ & " ligne " & Erl,16,"GetVimObject" Resume finfin:End Sub
Bien à vous
http://www.dominoarea.org/oguruma/
Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci
Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)