Selects those documents which are in review and have due dates which have passed. Based upon the review style of the document, it then either moves it along to the next reviewer, marks it as complete, or simply notifies the current reviewer(s) that their review is overdue.1SfL3
'++LotusScript Development Environment:2:5:(Options):0:66
Option Public
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Initialize
Declare Sub SendReminder(EmailType)
Declare Function GetString(StringType)
'++LotusScript Development Environment:2:5:(Declarations):0:10
Dim session As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim documents As NotesDocumentCollection
Dim note As NotesDocument
Dim parent As NotesDocument
Dim emaildoc As NotesDocument
Dim dt As NotesDateTime
Dim item As NotesItem
Dim rtitem As NotesRichTextItem
Dim nam As NotesName
Dim ReviewerList As Variant
Dim ReviewerNumber As Integer
Dim ReviewWindow As String
Dim NextReviewer As String
'++LotusScript Development Environment:2:2:Initialize:1:10
Sub Initialize
%REM
changes:
ReviewerNumber is 1 based so when Reviewer 1 is reviewing ReviewerNumber = 1.
Therefore, using a 0 based array, NextReviewer = ReviewerList(ReviewerNumber)
send the message
increment next reviewer if necessary
%END REM
'While this is similar to the same agent in doclib4, it is slightly different. The differences are commented
Set session = New NotesSession
Set db = session.CurrentDatabase
Set documents = db.Search("@Today => @Date(DueDateTime) & Status = 2", Nothing, 0)
If documents.Count = 0 Then Exit Sub
For d = 1 To documents.Count
Set note = documents.GetNthDocument(d)
ReviewWindow = note.ReviewWindow(0)
ReviewerList = note.ReviewerList
ReviewerNumber = note.ReviewerNumber(0)
Set dt = New NotesDateTime(note.DueDateTime(0))
Set nam = New NotesName(note.From(0))
'ReviewWindow in the Web version has values of 0 (no time limit), 1 (move to next reviewer), and 2 (send notification)
Select Case ReviewWindow
Case "1" 'Move to next reviewer
SendReminder("WindowExpired")
If ReviewerNumber <= Ubound(ReviewerList) Then
SendReminder("NotifyNextReviewer")
Else
SendReminder("NotifyOriginator")
note.Status = 3
End If
note.ReviewerNumber = ReviewerNumber + 1
Case "2" 'Send notification to current reviewer
SendReminder("Reminder")
End Select
If note.IsResponse Then note.RemoveItem("DueDateTime")
note.Save True, True, True
Next
End Sub
'++LotusScript Development Environment:2:2:SendReminder:1:8
Sub SendReminder(EmailType)
If note.IsResponse Then Exit Sub
Set maildoc = New NotesDocument(db)
Set rtitem = New NotesRichTextItem(maildoc, "Body")
maildoc.InheritedSubject = note.Subject
maildoc.InheritedDbTitle = db.Title
Select Case EmailType
Case "Reminder"
maildoc.SendTo = ReviewerList(ReviewerNumber - 1)
maildoc.Subject = GetString(1)
rtitem.AppendText(GetString(2))
Call rtitem.AppendDocLink(note, GetString(3))
Case "WindowExpired"
maildoc.SendTo = ReviewerList(ReviewerNumber - 1)
maildoc.Subject = GetString(4)
rtitem.AppendText(GetString(5))
Call rtitem.AppendDocLink(note, GetString(3))
'reset the due date
Set dt = New NotesDateTime("")
dt.SetNow
ReviewTime = note.ReviewTime(0)
If Isnumeric(ReviewTime) Then
dt.AdjustDay(ReviewTime)
Set note.DueDateTime = dt
End If
Case "NotifyNextReviewer"
maildoc.SendTo = ReviewerList(ReviewerNumber)
maildoc.Subject = GetString(6)
rtitem.AppendText(GetString(7))
Call rtitem.AppendDocLink(note, GetString(8))
Case "NotifyOriginator"
maildoc.SendTo = note.From
maildoc.Subject = GetString(9)
rtitem.AppendText(GetString(10))
Call rtitem.AppendDocLink(note, GetString(8))
End Select
maildoc.Form = "Memo"
On Error Resume Next
Call maildoc.Send (False)
End Sub
'++LotusScript Development Environment:2:1:GetString:1:8
Function GetString(StringType)
Select Case StringType
Case 1 'Subject of a reminder email
GetString = "Overdue Document Review"
Case 2 'Body of a reminder email
GetString = "Your review of the document entitled " & note.Subject(0) & " was due on " & dt.DateOnly &_
". Please review the document and mark it as complete, because you will continue to receive these notifications until you do so. "
Case 3 'comment for the AppendDocLink method
GetString = "DocLink to Overdue Document"
Case 4 'Subject of WindowExpired email
GetString = "Document Review Period has Expired"
Case 5 'Body of a expired email
GetString = "The time limit for your review of the document entitled " & note.Subject(0) & " expired on " & dt.DateOnly & ". "
Case 6 'Subject for email notifying next reviewer that they need to review this
GetString = "Document Requires Review"
Case 7 'Body of email to ntes reviewer
GetString = nam.Common & " would like you to review the document entitled " & note.Subject(0) & " before " & dt.DateOnly & ". "
Case 8 'comment for the AppendDocLink method
GetString = "DocLink to Document requiring review"
Case 9 'Subject on email to originator
GetString = "Document Review is Complete"
Case 10 'Body of expired email to originator
GetString = "The time limit for the review of the document entitled " & note.Subject(0) & " expired on " & dt.DateOnly & ". "
End Select
End Function
\ \ \
O=Lotus Notes
O=Lotus Notes
PURSAFO
|.:#U
O=Lotus Notes
CN=Lotus Notes Template Development/O=Lotus Notes
PURSAFO
Fde!f^^
$TITLE
$AssistType
$AssistLastRun
$AssistDocCount
$Comment
$AssistFlags
$AssistTrigger
$AssistInfo
$AssistQuery
$AssistAction
$AssistAction_Ex
O=Lotus Notes
O=Lotus Notes
PURSAFO
|.:#U
O=Lotus Notes
CN=Lotus Notes Template Development/O=Lotus Notes
PURSAFO
Fde!f^^
sZ%!ZM}
$Flags
Times New Roman
bullet
/All?OpenView
(Return to All Documents View)
T !hA
!ATA!T!TJ3U
&XKBU
C'UBK#JThT
J#9#9
[$U%U>L
MLUB&B%
B4B4%
4BKB^U4B&K
f#fKf
NVM$B&K
TJZ9J=J9E
NCML>^4UL
U%BKelg
AbA!T!T
K&KJ
hKeK3K&J
cf%K#J J
N*MLUB
K9J#Kh
= JT!TJ9J]JKf
$U4>_g
L>B3XU>
gN(L4B3K
J9J&L
4B3B4
fUB&l
M5L>:5
fC5:C
$U4ULT
B&3BL
C:>U:B
l+`:U&393Z3ZJT!
=J=]=
'UB3&B$
(_%^>L
M:U4^>:
= J ]
=TATA
LU%U'
V[$U>_5
gN6:>_5ND
m"P8;*:U3KZ
CLUlU
VMLU^_5c
U >:UM
6M:>U
?`':L5J
D8-DON*Y':[
C'L>Lf
+C5[:5L
h7VML$56C
Ck$Ui%
k$>$Mf
O65L:56
DNC:U%_:M
MLU>:%
T!T!T!T
J T=
q8;VM(
eD,D8P
C)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T
JK^U>
K3B4U>
MC6`*6C
5M:LS
U>UL:5
>4B9J
JeU$L
>U3K#K
K 9 J
%BeK#KJK&BU>
%U4U2
K3X&B^
T!T!T
!TJ34U%U>SU4XB
>:M5M:
4BX&3
=J=J]=
3#g=J9
#KJK3K
4 U>4B&3&3B
X3BFB4U
J9K9K3K3&
#fKfK
J] hA
XB4U4B&3K
]JK3BXB
K 3B43BX3KX
X43KJ
T TJ=
JZ39J
T!T9
3439K
BF3K9J
=J#K9J9Z3
J9Z3K9K
#K39Z
=JT T
!hThT
h!ThT
K9]J]
9]!hTJ9Z9J
hA!h!h
TJ JT
AbAb
!TAh!T
bAbAbAb
T=]JT
s{{kss{
k{{cssZkk
ks{cks
ss{{{
Using Document Library
This database allows you to capture and track information about documents.
Functions of the Database:
To add a document to this database
Click the New Document action from any of the views.
To respond to a document
Open a document, then click the Response action. From a Notes Client, you can also highlight that document in a view, then click Response from there. For Notes Client users, this creates a response to the main document in the thread. For browser clients, this creates a response to the current document.
To respond to a response
From a Notes Client, highlight the response you wish to respond to, then click Response to Response. This function is performed from a browser by using the Response action, as described above.
To flag a document as Private:
You can use the "Mark Private" and
"Mark Public" actions in the template to control whether anyone other than yourself can read a specific document. For example, if you have not completed the writing of a particular document, you can click the "Mark Private" action and others will not be able to see the document. When you complete the document, you can click the
"Mark Public"
action to make it available for others to read. If a document is marked private after it has been submitted for review, the document author and the reviewers will be able to read the document.
ACL Settings
This application was designed with the intention that all users, except the manager, should have Author access. If they have editor access, the review cycle may not function correctly. Anonymous access is also not permitted.
Features
Document Review Cycle:
The author of a document has the option of setting up a document review cycle for that document. To do so simply click on the Setup Review Cycle link and fill in the necessary information.
Note:
Do not use
@Domain
when entering approver names. Any domain added will be stripped off and may cause complications when attempting to route a request. Also, only enter Person-names as approvers. Group names are not supported.
Processing Late Reviews:
If the Process Late Reviews agent is enabled, it selects those documents which are in review and have due dates which have passed. Based on the time limit options chosen by the originator, it then either moves it along to the next reviewer, marks it as complete, or simply notifies the current reviewer that the review is overdue.
Document Archiving:
This is a process by which certain documents are removed from the current database and stored in a different database. This keeps the document library up-to-date with only the latest topics. Most of the Archiving activities take place from the "Archiving" view. You must switch to this view in order to initiate archiving on a document library database.
To set up archiving on any document library database, switch to the Archiving view and click the action called "Setup Archive". The Archive Profile appears. This document contains criteria that the user specifies for archiving topics in a document library (e.g., inactive after 'x' days, or expired after 'x' days). The archive database is automatically created when the Profile is saved. The archival database filename is also specified in the Archive Profile; the title of the archive will be the title of the Document Library database followed by "(Archived)". After the archive criteria have been specified in the Archive Profile, other agents run on the database to move the document(s).
Mark/Unmark Document as Expired:
Marks a topic as "expired".
If the Archive Profile specifies that
expired
topics should be archived, the document(s) marked with this agent would fall into that criterion. If a document is already marked as expired, this agent tells the user what the expire date was, and will ask if the user wants to un-expire it.
Periodic Archive:
Reviews the Archive Profile and moves documents which meet the archive criteria into the archive database. This agent is run automatically on the server; the schedule is set by the database manager/designer.
A Document Library application is an electronic filing cabinet that stores reference documents for access by a workgroup. The database might contain anything from environmental impact statements for a group of engineers to financial statements for a group of loan officers.
Who will use this database?
Anyone who wishes to create a record of a document or review available documents may use this database.
Important Features
Web or Notes client:
Database can be accessed from either a Web browser or a Notes Client.
Review Cycle:
Used to route a document to a series of recipients.
Document Archiving:
Used to move expired documents to an archive database.
Suggestions for Modifications
Full text search:
If you wish to use Notes' full text search capabilities for a database created with this template, select menu File, Database, Properties, go to the Full Text panel and then select Create Index... to create the full text index.
Where to find more information?
More information can be found in the
Notes
/$Help?OpenHelp
3S4S6S11S21S
Using This Database
document, or refer to the following documentation database on http://www.notes.net: Best Practices: Templates and Sample Databases (BPTEMP.NSF)
Access Control
Very Important:
Access level should be
Author
for all users of this database. This will prevent unauthorized editing of documents within the database. The Author fields within the forms govern who will be able to edit/review particular documents. Errors will occur if someone with Editor access attempts to review a document when they are not an authorized reviewer of that document. For those accessing the database from a Web browser, the database does not accept Anonymous users.
O=Lotus Notes
O=Lotus Notes
PURSAFO
|.:#U
O=Lotus Notes
CN=Lotus Notes Template Development/O=Lotus Notes
PURSAFO
Fde!f^^
$Info
$Body
'++LotusScript Development Environment:2:5:(Options):0:74
Option Public
Option Explicit
Use "SubmitForReview"
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Initialize
'++LotusScript Development Environment:2:5:(Declarations):0:2
'++LotusScript Development Environment:2:2:Initialize:1:10
Sub Initialize
'logging is for debug purposes
Set dbug = New NotesLog("SubmitDocument")
'to turn off the debug log, set this to False
dbug.LogActions = True
dbug.OpenAgentLog
On Error Goto StandardError
Set session = New NotesSession
Set db = session.CurrentDatabase
DbName = getdbpath
Set note = session.DocumentContext
If note.Form(0) <> "Document" Then Goto ExitWithoutSend
If note.HasItem("SaveOnly") Then
note.RemoveItem("SaveOnly")
Exit Sub
End If
If note.SubmitNow(0) = "1" Then SubmitNow = True
'If we are not submitting for review, we don't need to do the rest of this
If (Not(SubmitNow) Or note.Status(0) = 3) And note.Resubmit(0) = "0" Then Goto ExitWithoutSend
'Validate the Originator is not in the ReviewerList
If ListIncludesOriginator Then
ErrorText = GetString(17)
Goto ValidationError
End If
'Validate that ReviewTime has a valid entry if ReviewWindow is not 0
Set item = note.GetFirstItem("ReviewTime")
If note.ReviewWindow(0) <> "0" Then
Dim InvalidReviewTime As Integer
'This verifies that it is not 0 or blank or a string
If item.Text = "" Or item.Text = "0" Or item.Text Like "*ERROR*" Then
InvalidReviewTime = True
'This verifies that it is a whole number > 0
Elseif note.ReviewTime(0) < 1 Or Int(note.ReviewTime(0)) <> note.ReviewTime(0) Then
InvalidReviewTime = True
End If
If InvalidReviewTime Then
FieldName = "Time Limit"
ErrorText = GetString(16)
Goto ValidationError
End If
End If
'Validate that ReviewerList is not empty
If note.ReviewerList(0) = "" Then
FieldName = "Reviewer List"
ErrorText = GetString(19)
Goto ValidationError
End If
SendToNext 'in scriptlib SubmitForReview
Exit Sub
ExitWithoutSend: 'You submitted the form but were not sending anything to anyone
Print "<h3>" & GetString(9) & "</h3>"
Goto ViewLinks
StandardError: 'This is for errors which we are not specifically handling
'++LotusScript Development Environment:2:5:(Options):0:74
Option Public
Option Explicit
Option Compare Nocase
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Function GetString(StringType)
Declare Function SendToNext
Declare Function ListIncludesOriginator
Declare Function GetDBPath
'++LotusScript Development Environment:2:5:(Declarations):0:10
Dim session As NotesSession
Dim db As NotesDatabase
Dim note As NotesDocument
Dim mailnote As NotesDocument
Dim savenote As NotesDocument
Dim rtitem As NotesRichTextItem
Dim item As NotesItem
Dim dbug As NotesLog
Dim username As NotesName
Dim fromname As NotesName
Dim sendtoName As NotesName
Dim reviewername As NotesName
Dim dt As NotesDateTime
Dim ReviewerNumber, TotalReviewers, Position, SubmitNow, IsCurrentReviewer As Integer
Dim ReviewerList, ReviewTime As Variant
Dim NextReviewer, DbName, ViewList, NotificationType, ClientType, FieldName, ErrorText As String
'++LotusScript Development Environment:2:1:GetString:1:8
Function GetString(StringType)
Select Case StringType
Case 1 'Subject of the original copy of the document
GetString = "Original Copy: " & note.Subject(0)
Case 2 'Subject of the final reviewer email stating that all reviewers have completed their review
GetString = "Review is complete for the document entitled: " & note.Subject(0)
Case 3 'Subject of email informing a reviewer that they need to review this doc
GetString = fromname.Common & " would like you to review the document entitled: " & note.Subject(0)
Case 4 'First line of acknowledgement page, informing user that email was successfully sent to originator
GetString = sendtoname.Common & " has been notified that review of this document is complete"
Case 5 'First line of acknowledgement page, informing user that email was successfully sent to next reviewer
GetString = sendtoname.Common & " has been notified that this document requires review"
Case 6 'Line in Reviewer Log stating when the doc was submitted for review by the originator
GetString = "Submitted for review on " & Today
Case 7 'Line in Reviewer Log stating that a particular reviewer has been skipped
'GetString = ReviewerList(ReviewerNumber - 1) & " was skipped over by " & username.Common & " on " & Today
GetString = reviewername.Common & " was skipped over by " & username.Common & " on " & Today
Case 8 'Line in Reviewer Log stating when a particular reviewer completed their review
GetString = "Review completed by " & username.Common & " on " & Today
Case 9 'User submitted form but did not indicate that they needed to send anything
GetString = "Document has been saved"
Case 10 'Text for the Body field of the notification email
GetString = "Click on this link to access the document. "
Case 11 'Text associated with the AppendDocLink method
GetString = db.Title & ", " & note.Subject(0)
Case 12 'An error that we are not specifically handling
GetString = Err & " - " & Error
Case 13 'First line on the acknowledgment page when there was an error sending the document
GetString = "Error sending review notification to " & sendtoName.Common
Case 14 '1st string in the second line on the acknowledgement page when there was an error sending the document
'(the string says "Return to Document, fix the whatever, and resubmit" and Return to Document is a link back to the doc"
GetString = "Please click here to return to the document"
Case 15 '2nd string in the second line on the acknowledgement page when there was a validation or send error
GetString = ", fix the " & FieldName & ", and resubmit."
Case 16 '1st line of Error if user entered a ReviewWindow but no ReviewTime
GetString = "You indicated what should happen when the time limit expires but you did not indicate a valid Time Limit (a whole number greater than 0). "
Case 17 '1st line of Error if originator included themself in the reviewer list
GetString = "The document's originator cannot be included in the reviewer list. "
Case 18 'messagebox text for validation errors
GetString = "Please enter a valid " & FieldName & "."
Case 19 'User indicated submit for review but didn't enter any reviewers
GetString = "You did not indicate who should review this document."
Case 30 '30-33 are the names of views you can go to from the submitted page
GetString = "All Documents"
Case 31 '30-33 are the names of views you can go to from the submitted page
GetString = "By Author"
Case 32 '30-33 are the names of views you can go to from the submitted page
GetString = "Review Status"
Case 33 '30-33 are the names of views you can go to from the submitted page
GetString = "By Category"
Case 40 'Title bar for messageboxes (Notes client only)
GetString = "Document Library"
Case 41 'Title bar for error messageboxes (Notes client only)
GetString = "Document Library - Error"
End Select
End Function
'++LotusScript Development Environment:2:1:SendToNext:1:8
Function SendToNext
If Not(dbug Is Nothing) Then dbug.LogAction("SendToNext")
SendToNext = True
On Error Goto StandardError
Set mailnote = New NotesDocument(db)
ReviewerList = note.ReviewerList
TotalReviewers = Ubound(ReviewerList)
Set username = New NotesName(note.CurrentUser(0))
Set reviewername = New NotesName(note.CurrentEditor(0))
Set fromname = New NotesName(note.From(0))
If Lcase(username.Common) = Lcase(reviewername.Common) Then IsCurrentReviewer = True
'Statuses: 1=New, 2=In Review, 3=Review Complete
If note.Status(0) = 1 Then
'savenote is a copy of the original which we save as a response to the copy that will be reviewed
If Not(note.HasItem("OriginalSaved")) Then
note.save True, True, True
Set savenote = New NotesDocument(db)
Call note.CopyAllItems(savenote, False)
'from the Notes client, the body field is not available to note until a ui save
If note.HasItem("Body") Then
Set rtitem = note.GetFirstItem("Body")
savenote.RemoveItem("Body")
Call rtitem.CopyItemToDocument(savenote, "Body")
Else
note.CopyBody = True
End If
Call savenote.MakeResponse(note)
savenote.~$RefOptions = "1"
savenote.Subject = GetString(1)
savenote.save True, True, True
note.OriginalSaved = savenote.UniversalId
End If
'if we are skipping the first reviewer on the initial send, we need to increment the reviewernumber
If note.Resubmit(0) = "2" Then
ReviewerNumber = 1
note.ReviewerNumber = 1
Else
ReviewerNumber = 0
note.ReviewerNumber = 0
End If
Else
ReviewerNumber = note.ReviewerNumber(0)
End If
'in this case we are resubmitting after a successful send so we decrement the ReviewerNumber
If note.Resubmit(0) = "1" And Not(note.HasItem("SendError")) Then
ReviewerNumber = ReviewerNumber - 1
'in this case we are skipping this person and sending notification to the next person
Elseif note.Resubmit(0) = "2" And IsCurrentReviewer Then
ReviewerNumber = ReviewerNumber + 1
End If
'in this case I am the last person in the reviewer list
If ReviewerNumber > TotalReviewers Then
mailnote.SendTo = note.From
mailnote.Subject = GetString(2)
NotificationType = "complete"
Gosub SendMail
note.Status = 3
note.RemoveItem("DocAuthors")
Else
NotificationType = "review"
'if this is a resubmit, you might have entered something new in the NewReviewer field, so we need to put that in ReviewerList
'++LotusScript Development Environment:2:5:(Options):0:66
Option Public
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Initialize
Declare Sub ProcessExistingArchiveDB
Declare Sub ProcessNonExistingArchiveDB
Declare Sub ProcessArchiveDbExists
Declare Sub CreateNewArchiveDB
'++LotusScript Development Environment:2:5:(Declarations):0:10
%INCLUDE "lsconst.lss"
Dim s As NotesSession
Dim w As NotesUIWorkspace
Dim db As NotesDatabase
Dim existingdb As NotesDatabase
Dim archivedb As NotesDatabase
Dim view As NotesView
Dim note As NotesDocument
Dim profile As NotesDocument
Dim archivedoc As NotesDocument
Dim doc As NotesUIDocument
Dim DocWasSaved As Integer
Dim DoNotClose As Variant
Dim ExistingServer As String
Dim ExistingPath As String
'++LotusScript Development Environment:2:2:Initialize:1:10
Sub Initialize
End Sub
'++LotusScript Development Environment:2:2:ProcessExistingArchiveDB:1:12
Sub ProcessExistingArchiveDB
an existing archive already exists and the user has choosen to create a new one
this function gets called on one of two occasions
either the document has a value in the tmpArchivePath field
or the user entered a server and path that has an existing database
we need to handle both cases
%END REM
End Sub
'++LotusScript Development Environment:2:2:ProcessNonExistingArchiveDB:1:8
Sub ProcessNonExistingArchiveDB
On Error Goto ProcessError
On Error 4005 Goto DbCreateError
'render the dialog box to get the location of the archive database
If (w.DialogBox("(ArchiveProfileDlg)",True,True,"Specify New Location")) Then
'see if the archive database exists
Set archivedb = New NotesDatabase(note.ArchiveServer(0),note.ArchivePath(0))
If (archivedb.IsOpen) Then
Msgbox "Database already exists. Enter a new location"
ProcessNonExistingArchiveDB
Else
Set archivedb = db.CreateCopy(note.ArchiveServer(0),note.ArchivePath(0))
archivedb.Title = db.Title & " (Archive)"
End If
Call doc.Reload
Call doc.Refresh
Else
note.ArchiveServer = ""
note.ArchivePath = ""
End If
Exit Sub
DbCreateError:
Select Case Msgbox("Error creating archive database. The server may be down or you don't have access to create new databases on the server. Click Yes to try a different location now or No to cancel.",36,"Error")
Case 6
ProcessNonExistingArchiveDb
End Select
Exit Sub
ProcessError:
Msgbox Error & " - (ProcessNonExistingArchiveDB)"
Exit Sub
End Sub
'++LotusScript Development Environment:2:2:ProcessArchiveDbExists:1:8
Sub ProcessArchiveDbExists
'this function gets called if a database already exists in the tmpArchiveServer field
'render the dialog box to get the location of the archive database
On Error 4005 Goto DbCreateError
If (w.DialogBox("(ProcessExistingDbDlg)",True,True,"Specify New Location")) Then
On Error Resume Next
'see if the archive database exists
Set archivedb = New NotesDatabase(note.ArchiveServer(0),note.ArchivePath(0))
If (archivedb.IsOpen) Then
Msgbox "Database already exists. Enter a new location"
ProcessArchiveDbExists
Else
Call CreateNewArchiveDB
archivedb.Title = db.Title & " (Archive)"
End If
Call doc.reload
Call doc.refresh
End If
Exit Sub
DbCreateError:
Select Case Msgbox("Error creating archive database. The server may be down or you don't have access to create new databases on the server. Click Yes to try a different location now or No to cancel.",36,"Error")
Case 6
ProcessNonExistingArchiveDb
End Select
Exit Sub
End Sub
'++LotusScript Development Environment:2:2:CreateNewArchiveDB:1:8
Sub CreateNewArchiveDB
On Error 4005 Goto DbCreateError
On Error Goto ProcessError
'first, create the archive database
Set archivedb = db.CreateCopy(note.ArchiveServer(0),note.ArchivePath(0))
'if the profile says to copy new documents, then copy them now
If (note.CopyOptions(0) = "1") Then
Set allDocs = existingdb.AllDocuments
For i = 1 To allDocs.Count
Set archivedoc = allDocs.GetNthDocument(i)
Call archivedoc.CopyToDatabase(archivedb)
Next
End If
'if the profile says we should delete the original archive database, then remove it
If (note.DeleteOptions(0) = "1") Then Call existingdb.Remove
Exit Sub
DbCreateError:
Select Case Msgbox("Error creating archive database. The server may be down or you don't have access to create new databases on the server. Click Yes to try a different location now or No to cancel.",36,"Error")
Case 6
ProcessNonExistingArchiveDb
End Select
Exit Sub
ProcessError:
Msgbox Error & " - (ProcessNonExistingArchiveDB)"
Exit Sub
End Sub
Archive Profile'++LotusScript Development Environment:2:5:(Options):0:66
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Queryclose(Source As Notesuidocument, Continue As Variant)
Declare Sub Querysave(Source As Notesuidocument, Continue As Variant)
Declare Sub Postopen(Source As Notesuidocument)
'++LotusScript Development Environment:2:5:(Declarations):0:2
'++LotusScript Development Environment:2:2:BindEvents:1:129
Private Sub BindEvents(Byval Objectname_ As String)
Static Source As NOTESUIDOCUMENT
Set Source = Bind(Objectname_)
On Event Queryclose From Source Call Queryclose
On Event Querysave From Source Call Querysave
On Event Postopen From Source Call Postopen
End Sub
'++LotusScript Development Environment:2:2:Queryclose:1:12
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
If (DocWasSaved = False) Or (profile Is Nothing) Or DoNotClose Then Exit Sub
ItemList = profile.Items
Forall n In ItemList
profile.RemoveItem(n.Name)
End Forall
note.CopyAllItems profile
profile.SaveOptions = "1"
profile.save True, True
End Sub
'++LotusScript Development Environment:2:2:Querysave:1:12
Sub Querysave(Source As Notesuidocument, Continue As Variant)
DocWasSaved = True
DoNotClose = False
If Not(profile Is Nothing) Then note.SaveOptions = "0"
If (note.ArchivePath(0) = "") Then Msgbox "You will need to specify a location of the archive database before you can archive documents.",16
source.Reload
source.RefreshHideFormulas
End Sub
'++LotusScript Development Environment:2:2:Postopen:1:12
Sub Postopen(Source As Notesuidocument)
'initialize global variables
Set note = source.Document
Set w = New NotesUIWorkspace
Set s = New NotesSession
Set db = s.CurrentDatabase
Set view = db.GetView("Archiving")
Set doc = source
'turn off auto reload to make processing faster
source.AutoReload = False
'if this is not a new doc, we don't need to continue
If Not (source.IsNewDoc) Then Exit Sub
'get the existing profile
key = "Archive Profile"
Set profile = view.GetDocumentByKey(key,False)
If profile Is Nothing Then
'an existing profile was not found
note.ProtectFromArchive = 1
note.ExcludeFromView = "D"
note.From = "Archiving"
note.Subject = "Archive Profile"
note.Categories = "(Archive)"
Call note.ReplaceItemValue("_ViewIcon", 11)
source.reload
Else
'copy the profile fields to this document
ItemList = note.Items
Forall n In ItemList
note.RemoveItem(n.Name)
End Forall
profile.CopyAllItems note
source.Reload
If source.EditMode Then source.Refresh
End If
DocWasSaved = False
End Sub
K ,`
Subject used for displaying the form name in the views
Archive Profile
Subject
Used for returning information to the user when the form is saved on the web
$$Return
STS)TST
S)T)TS)
)SdSdS)d
)S)S)
)T)TSdT)Sd
)SdTdS)T)T
S)dSd)S)dSd
S )5dSdST)T
S)SdSdT)STc5c
d)S)dB
d 5Sd5)Td5S
)d5d5d5d)5
dSdS)Td)d5ST)dS
ScdS)S)
XWXc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skc
{1)!ZJ9
cZR1JB!
{RRJ11)!!
kkkkkkkkkkkkkkkk
Document Instructions
ModifyArchive
0R4S
Archiving
0S0E
AxH|~
JLKJ}
111ccc{{{
ZRRB999111)))!!
RJB1)!ZJ9)!
{kkcRRJ991kkZ11)99)
([FileCloseWindo
Terminate
Close
/WebDelete?OpenAgent&
UNID"
0R10S
{E,FCwvu*
?BwI|
;>AwI
A?*s?
{skZRJ
kRB)B)
{kcZJ
{{sssk
t Profile"
Delete
/(ArchiveInstructions)?OpenForm
C|NRW
ulowuv
}|C$/
%klko
!!!999RRRccckkk
{sscZZ1))
{skskc
{1)!ZJ9
cZR1JB!
{RRJ11)!!
Document Instructions
ModifyArchive
Periodic Archive
0R4S
0S0E
Bqo=<:i6
36i<n
p{IOT
Dpl9g
3h9lnA
JI{xwCs
Submit
Archiving
0S0E
AxH|~
JLKJ}
111ccc{{{
ZRRB999111)))!!
RJB1)!ZJ9)!
{kkcRRJ991kkZ11)99)
([FileCloseWindo
Terminate
Close
Select Document Archiving Preferences
vate
ArchiveExpired
Archive Expired documents | Yes
after
ExpiredLife
Number cannot be negative.{
3S4S6S11SExpiredLife
days
ArchiveInactive
Archive documents which have no activity | Yes
after
DocumentLife
Number cannot be negative.{
3S4S6S11SDocumentLife
days
ArchiveLog
Generate an Archive Log each time an archive occurs | Yes
The Archive Profile allows you to specify which documents should be removed from the current database and stored in an archive database. This allows you to keep your database up-to-date with only the latest topics. Archiving tasks can only be performed by designers or managers of the database.
You can choose the following in your ArchiveProfile:
Archive expired documents
Choose this option if you wish to archive documents which have been marked as expired. Indicate the number of days to wait before the expired documents are archived.
Archive documents which have no activity
Choose this option if you wish to archive documents which have had no activity. Indicate the number of days to wait before the inactive documents are archived.
Generate an Archive Log each time an archive occurs
Choose this option if you wish to have an Archive Log created when documents are archived. You can also indicate if you would like document links to the archived documents included in the Archive Log.
Archive Profile Editors:
Specify the names of those users that should be allowed to modify the Archive Profile.
Specify Archive Location:
Click on this button to specify the server and filename of the Archive database. The archive database is created for you based upon the values specified in the dialog box.
Documents are Archived:
Select the location for the archive database. Options are Locally or On Server. What you select depends on where you intend to locate the archive database. In order to create databases on a server, you must have the proper access rights in the server document for the specific server.
Archive Database Server:
Specify the server which you would like to create the archive database on. If you are entering this from a web browser, you can only enter the current server that the database is located on. Use a Domino Designer client to enter a server other than the current server where the database resides.
In order to create databases on a server, you must have the proper access rights in the server document for the specific server.
Archive File:
Specify the filepath and filename of the archive database. If no path is specified, the database will be created in the Notes data directory on the server or on the local client.