OpenNTF.org - LotusScript class to track mod
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
LotusScript class to track modification history 
Rating:
Not Rated Yet 
Contributor:
Andrew Jones 
Category:
Lotusscript 
Type:
 
Last Modified:
17 Jun 2002 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Usage / Example
This code computes and displays the modification history of a document. The document must contain a field (mine is hidden) called HIDDENHISTORY, an editable text list field. This field takes holds the edit history. Use as you would any class.

I put this code in the QuerySave event where "doc" is a global variable defined in the form's global declarations and assigned in the postopen event:
Dim modify As New Modification

modify.ModifyHiddenHistory doc

This code is in a form action button pressed to display the modification history:
Dim modify As New Modification

modify.ModHistory



Code


Class Modification


'---Stowe Spivey, November 29, 2001

Function numtosee '---how many modifications do you wnat to see in the
messagebox
numtosee=12
End Function

Sub ModifyHiddenHistory(doc As NotesDocument)
Dim session1 As New NotesSession
Dim dateTime As New NotesDateTime( "" )
Dim item As NotesItem
Set item=doc.GetFirstItem("HiddenHistory")
dateTime.LSLocalTime = Now
item.AppendToTextList session1.CommonUserName & " " &
dateTime.LSLocalTime & ";"
doc.Save True, False
End Sub

Sub ModHistory
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim upper As Integer
Dim lower As Integer
Dim history As String
Dim ending As String
Dim havehas As String
Set uidoc=ws.Currentdocument
Set doc=uidoc.Document
updaters = doc.getitemvalue("HiddenHistory")
upper=Ubound(updaters)
If upper < (numtosee - 1) Then
lower=0
Else
lower=upper - numtosee + 1

'adding 1 takes into account the counting of the first item
End If
history=""
For i = upper To lower Step -1
history=history & updaters(i) & Chr(10)
Next i
If upper > 0 Then '---customizes the output to plural if needed.
ending = "s"
havehas = "have"
Else
ending=""
havehas = "has"
End If
Messagebox history, 64, "There "& havehas &" been " & upper
+ 1 & " modification" & ending & ". Following are the most recent
" & upper - lower + 1
End Sub
End Class

 Comments

No documents found

 Add your comment!