Create your own Lotus Notes template storage database with revision history

Keep track of your Lotus Notes/Domino database templates with the handy Template Warehouse. This article describes how to create the Template Warehouse, and includes a complete working example you can use at your own site.

Donald Russell, Advisory QA Engineer, IBM Corporation

Donald Russell is an Advisory QA Engineer for Lotus Education and has been working in IBM's Lotus Software division since 1996. Prior to his current position, Donald was an advisory IS application developer and a senior Premium Notes Support Analyst. He holds a Bachelor of Science in Electrical Engineering and is a Certified Novell Administrator. Donald has written over 500 technical documents and white papers for the IBM DCF and Lotus Knowledge Base and has published technical articles for The View magazine. Outside of work, Donald was a Cub Scout Den leader and now an Assistant Scout Master for the Boy Scouts.



28 June 2005

If your organization creates custom Lotus Notes applications, you need to consider how you will manage and store copies of their templates (NTF files). In many companies, using a library to safely and securely store each Notes database application with its revision history is needed for developer assignments, backups, and record of change history. By creating a revision history and associated views, a librarian can easily keep track of the applications for checking in an updated design.

In this article, we describe an application we call the Template Warehouse, which stores databases and their icons and automatically categorizes them. This database extracts all the template database properties to populate the storage documents used in building the views for easy access. This article explains how we put together the Template Warehouse, teaching you design tricks not shown in the standard documentation, such as creating a My View, a frameset, a system parameter document for database administration data, and so on.

You can download the example Template Warehouse database from the Download section at the end of this article. This database contains all the code shown in this article. The database downloads as a zip file, and includes a separate Readme document that contains installation instructions. The Download section also includes an animated demo showing how to use the Template Warehouse. The Readme file that comes with the Template Warehouse download explains how to set up the demo to run locally. You can also launch the demo without downloading it by clicking here.

We assume you're an experienced Lotus Notes/Domino developer.

Template Warehouse database components

To create the Template Warehouse, we started with a copy of the Microsoft Office Library template that comes with Notes/Domino R5. (The Notes/Domino 6 version of this template would also work, although there would be some cosmetic differences.) We then added the following design elements to this database:

  • Template Storage document form. This is the main interface for storing a template in the Template Warehouse.
  • System Parameter document form. This document contains the mailing list for sending doclinks to individuals or groups with a beginning comment and HTTP URL to announce new templates (or reference existing ones).
  • Views showing the Template Storage documents.
  • View Action button called "CreateTemStorDoc - Serv/Local" with LotusScript (to create storage documents).
  • Email agents to add to the views.
  • Template Revisions agent.
  • Pages, outline, and frameset.

The following sections explain how we created these elements.


Template Storage form

To create the Template Storage form, we created an icon with an appropriate storage-related graphic (such as a stack of papers) and included the following fields:

Form label (if any)Field nameField typeFormula (if any)
NoneSubjectText - computed@If(TempTitle = ""; "New Template"; "Template DB Title: " + TempTitle)
CreatedDocCreatedDateDate - Computed when composed@Now
Doc # DocUniqueNumberText - Computed when composed@Unique
Created ByDocCreatedNameAuthors - Computed when composed@UserName
This document was marked expired onExpiredDateDisplayDate - Computed for displayExpireDate

We included a note explaining that some fields will be populated automatically when the document is created and the database NTF is automatically attached. Other fields must be filled in manually. Then we added a drop-down checklist to remind the storage document creator that the new NTF must be prepared as follows:

  • The template ACL must be copied from the database ACL and the default must not be "No Access." In addition, all appropriate roles must be assigned to allow the proper local access.
  • The template database title name must include the template and revision (for example, LEIS Developer's Code Lib Template Rev A).
  • The template database file name must contain the date, revision, and the developer's initials (for example, 011206aLEISDevCodeLib-DAR.ntf).
  • The template database design name should not include the words "template" or "revision" (for instance, LEIS Developer's Code Lib).
  • Check "List in Database Catalog" and "Show in 'Open Database' Dialog," and add a category name (for example, Notes Developers Code Library).
  • Each system parameter document should be copied from the database it was made from.

Next, we added a table that contains the NTF database properties where most are filled in automatically. The automatic fields are hidden so they cannot be changed. That is why there is a computed display field:

Form label (if any)Field nameField typeFormula (if any)
Template Database TitleTempTitleDisplayText - ComputedTempTitle
NoneTempTitle Text - EditableNone
Template CategoryTempCategoryDisplayText - ComputedTempCategory
NoneTempCategoryText - EditableNone
Template Design NameTempNameDisplayText - ComputedTempTitle
NoneTempNameText - EditableNone
Template File NameTempFileNameDisplayText - ComputedTempFileName
NoneTempFileNameText - EditableNone
Template Creation DateTempCreatedDateDisplayDate - ComputedTempCreatedDate
NoneTempCreatedDateNoneNone
Template DB SizeTempSizeDisplayText - ComputedTempSize
NoneTempSizeText - EditableNone
Template Revision (A, B, C... AA, AB)TempRevText - EditableNone
Web DatabaseTempIsWebRadio Button - EditableNone

We also included the following fields after the preceding table:

Field nameField type
ShortDocCommentText - Editable
TempRevChangesRich Text - Editable
TemplateDBRich Text
TemplatePicRich Text
DocCommentsRich Text
SynonymsText

Next, we added an "Attach DB" button. This should only be used for changing the database attachment, because the database is automatically attached when the user creates the document. The File Upload button can also be used for changing the attachment from the browser. However, we recommend changing the attachment in Notes.

The template revision is usually designated by using letters A, B, C, and so on. If there are many revision changes for each of the stored templates, we recommend using a four-digit number (0001, 0002, 0003, and so on) and archive older revisions.

Figure 1 shows the completed Template Storage form:

Figure 1. Template Storage form
Template Storage form

Click to see larger image

Figure 1. Template Storage form

Template Storage form

The Attach NTF File button shown in Figure 1 can also be used to change the attachment, but normally the Create Storage Document button automatically adds the attachment. The code behind the Create Storage Document button is as follows:

@Command([EditGotoField];"TemplateDB");
@Command([EditInsertFileAttachment]);
@Command([EditGotoField];"TempRev")


System Parameter document form

The System Parameter document contains the mailing list for sending links to individuals or groups with a beginning comment and HTTP URL to announce new templates, or references to existing ones. It is always good practice to set up any local data in a document so a local database administrator can add or change it. For security, the fields in the section are in a drop-down access-controlled section. A role is assigned to the section, so only the database administrator or designated group can make changes to this data.

In the System Parameter document there is a general comments field, a mailing list field, and a database browser URL access field. An email agent in the Admin views reads these fields and looks up the data for populating an email to send to the group.

Form label (if any)Field nameField type
The Admin Sends Selected Doclinks to the Following group(s)TemplateMailListText - Editable
This is the First Comment in the Template EmailBeginComment Text - Editable
This DB URL for Browser AccessDBURLNone
CommentsCommentsRich Text - Editable

The System Parameter document also includes context-sensitive online help. This help is accessible through the "?" icons. These are actually hotspots with popup text, for example:

Enter the name of the people or group(s) from the Lotus Domino Directory that will receive this email. People and groups must be separated by a comma. (For example, John A Smith/CHI/ACME,Jane J Jones/BOS/ACME)

Figure 2 illustrates the System Parameter document form:

Figure 2. System Parameter document form
System Parameter document

Views

Now we need to create views to show our custom Notes templates. With all the database properties that are now automatically populated in the documents, you can create views using this data. The sample database provides discussion views and forms for database template documentation storage and user comments.

All by Title

Figure 3 shows the All by Title view. This is categorized by database title and shows all revisions, providing easy access to the latest versions. The columns of this view are as follows:

Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8
DB TitleRevTemplate Name: RevTemp Creation DateTemp SizeTemplate File NameDoc Creation DateShort Comment
Figure 3. All by Title view
All by Title view

The first column of this view is categorized with the NTF database title. This shows revisions in alphabetical order. The code for this column is as follows:

TitleList := @Left(TempTitle; "Template Rev");

@If(
	@Left(TempTitle; 8) = "Template";
		@LeftBack(TempTitle; "Template");
	@Contains(TempTitle; "Template");
		TitleList;
	@Trim(TempTitle) )

My View

To create a My View that lets developers see just their own database templates, use the following selection formula:

SELECT form = "Template Storage Form" &
@IsMember(@Name([CN];@V3UserName);@Name([CN];DocCreatedName))

Other views show other database properties in the first column. This lets you find templates using other criteria.


View Action button

The View Action button lets you create a new storage document, populate the table with the database properties, and then attach the database to the rich text field. To create this button, open the All by Title view in Domino Designer and choose Create - Action in the programmer's pane. Choose LotusScript, and then add the LotusScript button code in this sidefile. To add this button to all the database views in this database, create a shared action.

Let's take a look at how the View Action button code works. The following snippet of code cycles through databases in the directory to gather all titles and stores them in array items:

i =1
	Nod = 0 ' Number of DBs in Directory (Initialize)
	While (i < 3)
		Set Fetchdb = dbdir.GetFirstDatabase(TEMPLATE)
		j=0
		While Not (Fetchdb Is Nothing)
			If ( i > 1) Then
				If ( j = 0) Then
					' ReDim only once when i =2 and j = 0
					RDim=Nod - 1 ' Dimension starts at zero so 
					  Dimension # is one less than # of Docs
					Redim StanResD(RDim) As Notesdocument
					Redim itms(RDim) As String
				End If
			'-------------------------------------------------------------------
			' 1st Loop of I - do not get properties from DB, just count the DBs
				itms(j) = Fetchdb.Title
				j=j+1
			End If
		'------------------------------------------------------------------------ 
			If ( i = 1) Then
				Nod = Nod+1 ' count the number of DBs (nod) in this dir for 
				  the first loop of I only
			End If
			Set Fetchdb = dbdir.GetNextDatabase
		Wend
		i = i +1
	Wend

This next code snippet sets the UI Doc to the current UI document and chooses a database title:

userchuz = workspace.Prompt(PROMPT_OKCANCELLISTMULT,
  "Database Template List", "Do not attach Templates that have Default = No Access and 
    LEIS Developers must be Manager in the ACL. Now Please select the Database Template 
    to attach from the list","", itms)
	If (userchuz(0) <> "") Then
		'Continue
		Goto Cont01
	Else
	'No Choice was made
		Exit Sub
	End If
Cont01:

Now the code cycles through the databases, stops at the chosen one, and gathers all the template database properties:

'Now cycle through the DBs and stop at the chosen one.
	'-------------------------------------------------------------------------
	K=0
	upperBound = Ubound(userchuz)
	While (K <= upperbound)
		Set Fetchdb = dbdir.GetFirstDatabase(TEMPLATE)
		j=0
		While Not (Fetchdb Is Nothing)
			itms(j) = Fetchdb.Title
			' y is set to "0" if the following string does compare.
			y = Strcomp(itms(j),userchuz(k), 5)
			If (y = 0) Then
				Goto Cont03 ' Choice is found - proceed to attach it
			Else
			' Choice is not found keep looking
			End If
			j=j+1
			Set Fetchdb = dbdir.GetNextDatabase
		Wend 'Line 100
	' Choice not found
		Exit Sub
Cont03:
		dbServ = Fetchdb.Server
		dbFileN = Fetchdb.FileName
		dbFileP = Fetchdb.FilePath
		If Fetchdb.IsOpen Then  ' Only Open DB if it is not already open or error 
		  will occur
		Else
			On Error Goto DBOpenErr ' DB open error Send E-mail and resume 
			  next DB
			Call Fetchdb.Open(dbServ,dbFileP)
		End If
		On Error Goto GeneralErr
		Dim dbcopy As NotesDatabase
		Set dbcopy = Fetchdb.CreateCopy _
		( "","c:\temp\"+dbFileN)
		Set ritmv = Stordoc.CreateRichTextItem("TemplateDB")
		Call ritmv.EmbedObject(EMBED_ATTACHMENT,"","c:\temp\"+dbFilen)
		Goto AttachDone
		k=k+1
	Wend
AttachDone:
	'Msgbox Fetchdb.Title, , Fetchdb.FileName
	FetchTitle=Fetchdb.title
	FetchTemName=Fetchdb.TemplateName
	FetchCreateDate = Fetchdb.Created
	FetchTempSize = Fetchdb.Size
	Set item = StorDoc.ReplaceItemValue("TempTitle",FetchTitle)
	Set item = StorDoc.ReplaceItemValue("TempName",FetchTemName)
	Set item = Stordoc.ReplaceItemValue("TempFileName",dbFileN)
	Set item = StorDoc.ReplaceItemValue("TempCreatedDate",FetchCreateDate)
	Set item = StorDoc.ReplaceItemValue("TempSize",FetchTempSize)
	Set item = StorDoc.ReplaceItemValue("TempRev","")

Then the program determines whether or not the revision is greater than six (meaning the new doc is not the first revision or Rev. A). Static description data such as template purpose, short description, and the database icon screen shot can now be automatically copied to the new storage document being created for newer template revisions above Rev A:

message$ = " " & cr$ _
	& " Do you want to retrieve other field data from prior rev doc? " + cr$ _
	& " "  + cr$ _
	& " Click Yes to Proceed "  + cr$ _
	& " Click No to Save new Rev document "
	boxType& = 36 ' MB_YESNO + MB_ICONQuestion
	answer% = Messagebox(message$, boxType&, _ 
	"Retrieve Field Data from older Revision ")
	              ' 6 is the return value for pressing Yes - 7 is the return 
	                value for pressing No
	If(answer% = 6) Then
		' Answer is 6 = Yes (Retrieve data from prior Rev Doc)
		Goto ContToGetData
	Else
		' Answer must be 7 = No (Do not retrieve data from prior Rev Doc)
		Goto AllDone
	End If
ContToGetData: 'Line 150
	dbtSearchTitleDef = FetchTitle
ContSearch:
	dbtERevTitle = Inputbox("Change the default Title to the Title of the prior 
	  Rev  ","You Must Qualify the The Search String for the Prior Rev Template 
	  Title Name where Data will be copied From ",dbtSearchTitleDef)
' Keyed Lookup thru all the Docs in the current hidden view called 
  (HERevTempAllbyTitle)
	Set viewH=Curdb.getview("(HERevTempAllbyTitle)") ' Hidden View of all 
	  docs by template db title
	viewH.AutoUpdate = False ' If a status field is changed when doc is processed, 
	  then this will keep the doc in the view so next doc can be found.
' find doc by a keyed lookup to the hidden view on the first sorted column which is 
  Col. 1 - Template title
	formula = dbtERevTitle
	Set doc1 = viewH.GetDocumentByKey(formula)
	If (doc1 Is Nothing) Then
		message$ = "   " & cr$ _
		& " Your New Template should have the word Template and Rev in the 
		  Title Name " & cr$ _
		& " Your New Template Title Name for this Doc is: " & cr$ _
		& FetchTitle & cr$ _
		& " The Prior Rev Template Title Name typed in that was not found 
		  is: " & cr$ _
		& formula & cr$ _
		& " To Re-Type the Prior Rev Template Name and search again 
		  click - OK " & cr$ _
		& " To stop creating this new template storage doc click - Cancel  "
		'Set up the box type - See chart below
		boxType& = 33 ' MB_OKCANCEL + MB_ICONQUESTION
		answer% = Messagebox(message$, boxType&, _ 
		"The Prior Rev Doc Cannot Be Found.")
		                  ' 1 is the return value for pressing OK
		If(answer% = 1) Then
			dbtSearchTitleDef = formula
			Goto ContSearch ' OK - Type Prior Rev Template Name again
		Else
			Exit Sub ' If another box type is used with a choice, then an 
			  alternative path may be taken.
		End If
	End If
				' Copy TempIsWeb field to new doc				
	Set item = doc1.GetFirstItem("TempIsWeb")
	item = doc1.GetItemValue("TempIsWeb")
	items=Cstr(item(0))
	Call Stordoc.ReplaceItemValue("TempIsWeb",items)
				' Copy ShortDocComment field to new doc
	Set item = doc1.GetFirstItem("ShortDocComment")
	item = doc1.GetItemValue("ShortDocComment")
	items=Cstr(item(0))
	Call Stordoc.ReplaceItemValue("ShortDocComment",items)
				' Copy TemplatePic RichText field to new doc
	Set ritmv0 = Doc1.GetFirstItem("TemplatePic")
	Call ritmv0.CopyItemToDocument(Stordoc,"TemplatePic")
				' Copy DocComments RichText field to new doc
	Set ritmv0 = Doc1.GetFirstItem("DocComments")
	Call ritmv0.CopyItemToDocument(Stordoc,"DocComments")
				' Copy Synonyms field to new doc
	Set item = doc1.GetFirstItem("Synonyms")
	item = doc1.GetItemValue("Synonyms")
	items=Cstr(item(0))
	Call Stordoc.ReplaceItemValue("Synonyms",items) 'Line 200
	Goto AllDone
AllDone:

Now the code saves the new document and brings it into edit mode for adding the revision history changes:

Call Stordoc.Save(False, False)
	Call dbcopy.remove
	DelDBAns = Inputbox("Delete the DB Template from Server = " + 
	  dbtServer + " dir? (No or Blank = No Del)","Delete the Database 
	    Template ","Yes")
	yy = Strcomp(DelDBAns, "Yes", 5)
	If (yy = 0) Then
		Fetchdb.remove ' Remove the DB Template from the Server directory
	End If
	Set CurrentDocument = Stordoc
	Set CurUIDoc = workspace.CurrentDocument
	Set CurUIDoc = workspace.EditDocument(True,Stordoc,False) ' The 
	  EditDocument method brings the back end doc into the front end.
	Call CurUIDoc.GotoField("TempRev")
	Goto TEnd

Don't forget the error checking routines for troubleshooting!

GeneralErr:
	message$ = " " & cr$ _
	& " An error was encountered in executing. " & cr$ _
	& "  Error # = " + Str(Err)+ cr$ _
	& "  Error String = " + Error$ + cr$_
	& "  Error Line # = " + Str(Erl) + cr$_
	& " Report this error to your DB Designer with the following 
	  information " + cr$ _
	& " The Notes Version Running this DB = " + version + cr$ _
	& " Error in LotusScript Code" + cr$ _
	& " Type and Name = View Action Button --CreateTemStorDoc 
	  - Serv/Local -- " + cr$ _
	& " View name = (HERevTempAllbyTitle)" + cr$ _
	& " Agnet Database Title = " + Curdb.Title + cr$ _
	& " Agent Database Filename = " + Curdb.Filename + cr$ _
	& " Agent Database Directory Path = " + Curdb.Filepath + cr$ _
	& " Fetch Database Title = " + Fetchdb.Title + cr$ _
	& " Fetch Database Filename = " + Fetchdb.Filename + cr$ _
	& " Fetch Database Directory Path = " + Fetchdb.Filepath + cr$ _
	& "" + cr$_
	& " Click OK to continue - Cancel to quit "
	boxType& = 17 ' MB_OKCANCEL + MB_ICONStop
	answer% = Messagebox(message$, boxType&, _ 
	"Error in execution of LS Code!")
	If(answer% = 1) Then
		Goto ContResN ' OK - Continue with next statement in LotusScript
	Else
		Exit Sub ' Cancel so quit out.
	End If
ContResN:
	Resume Next
DBOpenErr:
	message$ = " " & cr$ _
	& " An error was encountered in executing. " & cr$ _
	& "  Error # = " + Str(Err)+ cr$ _
	& "  Error String = " + Error$ + cr$_
	& "  Error Line # = " + Str(Erl) + cr$_
	& " The Template DB cannot be opened for copy and 
	  attachment " + cr$ _
	& " Report this error to your DB Designer with the following 
	  information " + cr$ _
	& " The Notes Version Running this DB = " + version + cr$ _
	& " Error in LotusScript Code" + cr$ _
	& " Type and Name = View Action Button --
	  CreateTemStorDoc - Serv/Local -- " + cr$ _
	& " View name = (HERevTempAllbyTitle)" + cr$ _
	& " Fetch Database Title = " + Fetchdb.Title + cr$ _
	& " Fetch Database Filename = " + Fetchdb.Filename + cr$ _
	& " Fetch Database Directory Path = " + 
	  Fetchdb.Filepath + cr$ _
	& "" + cr$_
	& " Click OK to continue - Cancel to quit "
	boxType& = 17 ' MB_OKCANCEL + MB_ICONStop
	answer% = Messagebox(message$, boxType&, _ 
	"Error in execution of LS Code!")
	If(answer% = 1) Then
		Goto ContN ' OK - Continue with next statement in LotusScript
	Else
		Exit Sub ' Cancel so quit out.
	End If
ContN:
	Resume Next
TEnd:
End Sub

For added security in the database script QueryDocumentDelete event, we added the following code. This gives only the database administrator document deletion rights:

Sub Querydocumentdelete(Source As Notesuidatabase, 
  Continue As Variant)
	Dim s As New NotesSession
	Dim user As String
	user = s.CommonUserName
	Dim message As String
	
	If user <> "John Russo" Then
'		Continue = False
'		message = "Please do not delete any documents in this database. 
  Contact the db manager if you need to remove any documents."
'		Messagebox message, 16 ,"Error!"
	End If
	
End Sub

Email agents

Next, we created the email agents that create and send doclinks to the selected documents in the Admin view. You want to call the LotusScript agent to create and send the email, then deselect the documents. These email agents are shared, triggered on event, in the agent list selection. The target is all selected documents. You can deselect the checks on the selected view documents in the user interface by running a formula after the LotusScript agent.

This sidefile contains the complete code listing for our email agent. Note that the view referenced in our code sample must be sorted for the email to be populated with the doclink.


Creating pages, outline, and frameset

Our sample Template Warehouse database comes with a simple four-frame design. The upper-left page places the user's name in the computed value when the database is accessed from the server. The formula for this is @Name([CN] ; @UserName).

The Template Warehouse outline can be automatically generated or custom designed by just adding the views.

The frameset design is also needed to showcase the application from a browser on a Domino HTTP server. The frames automatically adjust for different screen resolutions. This is why frames and tables are important design elements for the Web. Our sample Welcome page design will display "anonymous" if Web access is set up that way. Notes buttons do not work from the browser, so we suggest that this access be used only for viewing and downloading database template files. Create the pages for each frame and then add them to the frameset as shown in Figure 4. The pages in the sample database have names that reference their Frameset location:

  • TemplateWareHouseNavL - Left Navigator
  • TemplateWareHouseNavUL - Upper Left
  • TemplateWareHouseNavUC - Upper Center

All other properties use the defaults given in the Domino Designer.

Figure 4. Frameset with Welcome Page
Frameset with Welcome Page

On the Welcome page form is an introduction to the Template Warehouse and a button to create a new storage document. The view link goes to the All Docs by Title view, and the close button closes the database. The center can open to a form as shown. The frame properties in our sample database have the name as "body" with type Named Element - Form and value equal to "NavMainFrame" with the default target of "body".


Final design check

As a final check to ensure that all design elements inherit the design from this new template database, open the Design Properties box for each modified or new design element and select the "Prohibit design refresh or replace to modify" option. Here is a list of new design elements:

  • Forms - Template Storage Document Form, System Parameter Document Form, and NavMainFrame is the main page for the frameset.
  • View - 01. Templates\02. All by Title
  • View - 01. Templates\03. All by Revision
  • View - 01. Templates\04. All by Doc Creation Date
  • View - 01. Templates\05. All by By Web or Non Web
  • View - 01. Templates\06. All by Title Flat
  • View - 01. Templates\09. All by Creator
  • View - 01. Templates\10. My View
  • View - 03. Administration \ 01. All by Notes ID
  • View - 03. Administration \ 01. All by Doc Unique ID
  • View - 03. Administration \ 01. System Parameter
  • View - Discussion\01. By Author
  • View - Discussion\02. By Category
  • View - (HERevTempAllByTitle) - Hidden view for agents
  • View - ($All)
  • Agent - CreateTemStorDoc - Serv/Local
  • Agent - Memo of Selected DocLinks to Dept Group
  • Agent - Memo of Selected DocLinks to Self
  • Agent - Finding the changes between Template Revisions
  • Page - TemplateWareHouseNavL
  • Page - TemplateWareHouseNavUC
  • Page - TemplateWareHouseNavUL
  • Outline - Warehouse Outline

As we mentioned earlier, you can download the sample Template Warehouse database (from the Download section at the end of this article) and customize it.


Setting up the System Parameter document

Now create the new System Parameter document and fill in the data for your department or local area. This document is used by the two email agents that send doclinks to either yourself or your group. Use a group in the Domino Directory or add the hierarchical email names directly. There are three fields for the local database administrator to enter the local data (see Figure 5).

Figure 5. New System Parameter document
New System Parameter document

Using the Template Warehouse database

Create a Template Warehouse storage document to save the Design Template. To do this, click the Left Navigator button called CreateTemStorDoc - Serv/Local (or select the same option in the Action Menu).

As we've seen in this article, this button has approximately 270 lines of LotusScript code behind it to automatically populate the storage document with information. You can edit the LotusScript to add the default server name of your Domino server for the Template Warehouse database. Leave in the default name of the Domino server, or delete it and leave the field blank if the template is on your local hard drive (see Figure 6).

Figure 6. Specifying the name of the template server
Specifying the name of the template server

Select the template from the Database Template List dialog box for automatic document creation. All database templates must reside in the Notes Data directory (either locally or on the Domino server) to appear in the list box shown in Figure 7:

Figure 7. Database Template List dialog
Database Template List dialog

When you add a template to the database that already exists, you are prompted to retrieve data from a previous storage document created for an earlier version (or revision) of the template. New versions are assigned a letter (A, B, C, and so on). For revisions greater than revision A, select a document from which to copy information and a database icon. After you select which revision to copy from, you are asked whether or not to delete the new template from the server (see figure 8). The default is yes, which stores the template in the database and removes all copies from the server (see Figure 8).

Figure 8. Delete the Database Template dialog
Delete the Database Template dialog

The following section explains the fields in the Template Storage document and where to add the manual data to the new document. First, let's discuss fields in which data only needs to be manually added once for a Rev A storage document:

  • The Web Database radio button categorizes the application as either accessed mostly by browsers on the Web or internally through Notes. A view can be generated of all the Web databases if this is required.
  • The Short Comment field is for a generic application name that can be shown in the view and should not usually change after it is entered into the Rev A document.
  • The template icon is a good way of identifying the application by people who use it. This is what they will see on their desktop. After a screen shot of the desktop icons has been taken, a simple selected cut and paste can add it into a new document.
  • The "Purpose and description of the application" field describes the general business usage of the application and should not change.
  • The Search Words field makes it easy to find the document in a large view that is full-text indexed.

Now let's examine the fields that need to be changed for each revision of the template storage document. The Template Revision field must be manually entered for all revision documents; the cursor is initially positioned on this field by default. And in the following fields, data is automatically added by the Create Document button's LotusScript code (these are extracted from the database properties):

  • The Subject field is populated with the database title name.
  • Template Database Title.
  • Template Name.
  • Template File Name.
  • Template Creation Date.
  • Template DB Size.

Figure 9 shows these fields on the Template Storage form:

Figure 9. New document with revision changes
New document with revision changes

Email result using agent button

As database administrator, you can send links to yourself, to others, or to a group using the email agents included with data from the System Parameter documents (see figure 10). The only difference between the "email to self" agent and the "email to group" agent is that the latter contains the URL for browser access to the Template Warehouse database.

Figure 10. Example email
Example email

A special feature in our sample Template Warehouse application is an agent to find out what has changed from one revision to another in a side-by-side comparison. This information can be displayed with another custom form called ShowResults. This form includes a listbox and two text fields in a layout region on the first tab. There are two text fields on the second tab, and two buttons to manage replication conflicts on the third tab. A view action button called "Find Diff of 2 Revs" calls the LotusScript agent named "Difference of 2 revisions." This is a good tool for managing Save Replication conflicts as well. Figure 11 shows the TempRevChanges plain text field with the data from the Rev B and Rev C storage documents. Because there are many sub functions, all the LotusScript can be seen in the sample database.

Figure 11. Revision Difference screen
Revision Difference screen

Summary

The Template Warehouse database makes it very easy to create a safe storage area for your Lotus Notes design templates. The views are categorized to make it much easier than if they were buried in the file system across multiple servers. We've even included a sample Archive Profile form and archive agent in our sample database for a complete solution. And browser access for viewing and downloading the templates makes them more accessible.

We hope you found this article helpful. Try out our sample Template Warehouse, and let us know what you think!


Downloads

DescriptionNameSize
Sample Template Warehouse database and docDeptTemplate_Readme.zip1293 KB
Flash demoTemplateFlashDemo.zip826 KB

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into IBM collaboration and social software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Lotus
ArticleID=87096
ArticleTitle=Create your own Lotus Notes template storage database with revision history
publish-date=06282005