9780764526114 chapter 7 standard templates

Upload: adminharry

Post on 30-May-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    1/8

    Lotus Notes and Domino 6 Programming Bibleby Brian Benz, Rocky Oliver and Richard SchwartzWiley Publishing, Inc.. (c) 2003. Copying Prohibited.

    Reprinted for Satyendra K. Jha, [email protected]

    Reprinted with permission as a subscription benefit of Books24x7,http://www.books24x7.com/

    All rights reserved. Reproduction and/or distribution in whole or in part inelectronic,paper or other forms without written permission is prohibited.

    http://www.books24x7.com/http://www.books24x7.com/
  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    2/8

    Table of ContentsChapter 7: Standard Templates......................................................................................................1

    Overview............................................................... .................................................................1The Mail Template.................................................................................................................1The Personal Address Book Template..................................................................................2The Discussion Template......................................................................................................3The Document Library Templates..........................................................................................4Summary................................................................................................................................5

    i

  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    3/8

    Chapter 7: Standard Templates

    Overview

    By Richard Schwartz

    Notes and Domino provide powerful tools for the development of custom applications. Many Notesand Domino users, however, are totally unaware of this fact. They know only that their companyuses Notes and Domino for email, calendaring, and address books. Others know only that itprovides email and online discussion facilities. What they don't know is that IBM engineers havebuilt all the most popular features of Notes and Domino using the same programming tools that areavailable to every Notes and Domino programmer for custom applications.

    The features of Notes and Domino that endusers know best and that are responsible for much ofthe popularity of the products are built from ordinary Notes and Domino templates. Every Notes andDomino programmer can examine those templates to learn how those features work.

    Notes and Domino ship with more than 30 different template files. Many are employed in systemadministration tasks and are unfamiliar to most users; others are extremely useful for learning howto develop your own applications.

    This chapter briefly describes the templates that are most familiar to end users: the Mail template,the Personal Address Book template, the Discussion template, and the Document Library template.

    The Mail Template

    As the name implies, the Mail template provides all the email functionality of the mail system forthe Notes client. It also provides the calendaring functionality. These two seemingly different areasof functionality are combined into one NTF file, MAIL6.NTF, to allow tight integration of sending andreceiving invitations, responses to invitations, and the rescheduling of notices for calendarappointments. The standard Mail template also provides a Web user interface for the mail andcalendar features. Although it's quite powerful, it is not the nicest Web mail interface for Domino. Ifyou need a powerful Web mail client, check out iNotes Web Access, as it is one of the mostimpressive Web clients available.

    Note IBM released an alternative Web user interface, known as iNotes Web Access, forDomino R5. iNotes takes advantage of the advanced features of the latest browserversions and is therefore able to provide a slicker and more seamless userinterface for mail and calendaring in a browser. The version of iNotes for Domino 6,however, was not ready to ship at the time that the rest of Notes and Domino 6were available; however it will be a part of Notes/Domino 6.0.1. Also, IBM wants toprotect its intellectual property investment in iNotes and deliberately obfuscated

    some of the code. This book, therefore, can't cover the workings of the iNotes WebAccess template.

    The Mail template is, of course, theplace to go to find out how to work with email messages inyour applications. Of course, the Mail template has evolved over many years and many releases ofNotes and Domino, and some of the things that you will find in it are not necessarily always donewith the easiest techniques available in Notes and Domino 6. In the Memo form, for example, someaction buttons are used in the Notes client, and duplicate action buttons perform the samefunctionality and are used in a Web browser. The Notes client versions are hidden from Webbrowsers, and vice versa. This works, but there's a better way of doing this in Notes and Domino 6,which you find out about in Chapter 16.

    Reprinted for [email protected], IBM John Wiley & Sons (US), Wiley Publishing, Inc. (c) 2003, Copying Prohibited

    http://www.books24x7.com//viewer.asp?bkid=6059&destid=577#577http://www.books24x7.com//viewer.asp?bkid=6059&destid=577#577
  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    4/8

    The Memo form has many other interesting characteristics. The Send action programmed for theNotes client uses Notes Formula language to execute @Command([FileCloseWindow]) incombination with the Present Mail Send Dialog property on that form to cause the message to besent. The Send action for the browser is written in JavaScript, and it simply submits the message tothe server, where a WebQuerySave agent called wMemo is invoked. The agent sets the value ofthe reserved item MailOptions to 1 to accomplish the same thing. The Memo form uses thereserved fields SendTo, CopyTo, and BlindCopyTo for addressing. Any form using these same fieldnames can be addressed and mailed by Notes and Domino.

    One of the most interesting parts of the mail template is the Calendaring and Scheduling (C&S)area. Creating calendars can be tricky if you have never done it before. The Help file is a prettygood start, but there are more advanced features that you will want to use in your applications and most of these are showcased in the C&S area of the mail template. However, you should avoidthe temptation to copy design elements from the mail template and attempt to shoehorn them intoyour own application. The C&S area of the Notes 6 mail template is one of the most complicatedfeatures in anyNotes application and is comprised of literally dozens of design elements, most ofwhich would make no sense in an application outside of a mail template. A better approach toutilizing the mail template in general, and the C&S features specifically, is to examine how certainfeatures are accomplished. For instance, there are great examples of using theNotesUIView.RegionDoubleClick (for doing things like composing new documents from the datethat is doubleclicked), NotesUIView_.PostEntryResize (for resizing appointment times in the viewand recording it to the underlying document), and much more. There are even two really goodexamples of building LotusScript classes to make it easy to handle an otherwise exceedinglycomplex task the CSEventClass and CSUIViewClass, which are housed in LotusScript Librariesof the same name. Therefore it is recommended that you get inspiration from the C&S feature in theNotes mail template, but don't try copying it outright from the template itself.

    The Personal Address Book Template

    The Personal Address Book database enables users to manage personal and business contacts, tomaintain Group documents for mailing lists, and also to maintain some configuration information forthe Notes client. There are several features that are of interest, and fortunately the way thepernames.ntf template works is easy to understand. These features include the Preferences dialogbox, the Edit Contact Labels button, and the AddressPicker form.

    Users can control the display format for contact information using the Personal Address BookPreferences dialog box, which creates a profile document to store the preference information. Userscan also customize the labels used to identify various fields within each document. The Contactform, shown in Figure 71, makes extensive use of hidewhen settings, computed text andcomputed for display fields, and a programmable table, which is used to implement a highlyconfigurable display for users. This form is also a good example of using nested tables to create avery clean look.

    Lotus Notes and Domino 6 Programming Bible 2

    Reprinted for [email protected], IBM John Wiley & Sons (US), Wiley Publishing, Inc. (c) 2003, Copying Prohibited

  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    5/8

    Figure 71: The Contact formThe Edit Contact Labels button on the Contact form is an example of the use of the @DialogBoxfunction in Notes Formula language. If you open the form in Domino Designer and select Preview inBrowser from the Actions menu, you find that this button does not work. The @DialogBox function isone of several Notes features that doesn't work in browsers. IBM has not Webenabled thePersonal Address Book application. If they were to do so, they would have to change the code inthis button to use JavaScript instead of using Notes Formula language.

    The Personal Address Book template contains the AddressPicker form, which gives users access to30 buttons, 26 of which are used (in the U.S. English version of the template) for selecting theletters A through Z for indexing the Contacts list. Although a very straightforward technique couldhave been used, it would have been harder to adapt for foreign languages, so IBM engineersassigned a number to each of the buttons and used it to look up a letter value in a list stored in afield named AlphList. Modifying this code to work with other alphabets requires only three steps:changing the contents of the AlphList field, entering the number of letters in the alphabet into theAlphNumber field, and changing the caption and alternate text properties on each of the buttongraphics.

    The Discussion Template

    Discussion is the archetypal Notes and Domino application. Apart from email, it is probably theapplication users associate most with Notes and Domino. The Discussion template, discsw6.ntf, is agood demonstration of several of the most frequently used Notes and Domino features.

    The Discussion template enables Notes clients and browser users to open new topics for discussionusing the Main Topic form, and to participate in threadsby adding new documents using theResponse or Response to Response forms. The All Documents view uses Show ResponseDocuments in a Hierarchy to create an indented display that graphically shows the flow of eachdiscussion thread (see Figure 72).

    Lotus Notes and Domino 6 Programming Bible 3

    Reprinted for [email protected], IBM John Wiley & Sons (US), Wiley Publishing, Inc. (c) 2003, Copying Prohibited

  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    6/8

    Figure 72: Response hierarchy in the Discussion templateThe By Author and By Category views demonstrate categorization, a different organizationaltechnique. Chapter 9 covers both response hierarchy and categorization. The By Author view alsoshows that the Discussion template tracks authorship of documents. An Author Names field is usedfor tracking purposes and for security. These fields make it possible to design applications that allowusers to modify only those documents that they have created. Chapter 21 covers Author Namesfields.

    Users of Discussion applications can also fill in Personal Profile and Interest Profile forms. An agentcalled Send Newsletters, which sends out email messages to users to inform them when newdocuments that match the profile are added to the discussion, uses the Interest Profile forms. Thisagent is a good example of the use of the NotesNewsletter class in LotusScript.

    The Document Library Templates

    Notes and Domino also ship with a family of three templates known as the Document Librarytemplates. The family includes a generic version, along with versions customized for storingMicrosoft Office documents and Lotus SmartSuite documents. The generic version is intended foruse with the Notes client and a Web browser. The Office and SmartSuite versions are intended onlyfor use with the Notes client. The Office and SmartSuite versions demonstrate the use of Microsoft's

    OLE (Object Linking and Embedding) technology, which allows Word, Excel, WordPro, and 123documents to appear inside the Notes client window, as shown in Figure 73.

    Lotus Notes and Domino 6 Programming Bible 4

    Reprinted for [email protected], IBM John Wiley & Sons (US), Wiley Publishing, Inc. (c) 2003, Copying Prohibited

    http://www.books24x7.com//viewer.asp?bkid=6059&destid=765#765http://www.books24x7.com//viewer.asp?bkid=6059&destid=765#765http://www.books24x7.com//viewer.asp?bkid=6059&destid=323#323
  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    7/8

    Figure 73: An OLE 123 spreadsheet in the SmartSuite Document LibraryThe most interesting portion of the Document Library templates is the workflow code, whichsupports serial and parallel review processes for documents, with facilities for notification ofreviewers and setting time limits for each reviewer. The code that manages the workflow is in theDocumentWorkflow subform, which uses the OLERoutines script library. The code is fairly welldocumented, so you should be able to follow it.

    The Document Library templates also support response and responsetoresponse forms, similarto the ones in the Discussion template. Although there are no new concepts demonstrated by this, itshows how easy it is to add a response hierarchy to any Notes and Domino application, adding

    value by allowing users to engage in discussions about the data the application manages.

    Summary

    This chapter examined some of the features of the Mail, Personal Address Book, Discussion, andDocument Library templates. You learned that

    The Mail template demonstrates reserved fields used for addressing mail, form propertiesused to send mail from the Notes client, and the MailOptions field used to send mail from aWebQuerySave agent.

    The Personal Address Book template demonstrates techniques for designingusercustomizable display formats, and is a good example of using tables to control thevisual appearance of data on a form. It also shows techniques for writing generic code that iseasy to extend.

    The Discussion template demonstrates response hierarchy and categorized views. It alsodemonstrates the use of Author Names fields to control document security, and use of theNotesNewsletter class in LotusScript.

    Lotus Notes and Domino 6 Programming Bible 5

    Reprinted for [email protected], IBM John Wiley & Sons (US), Wiley Publishing, Inc. (c) 2003, Copying Prohibited

  • 8/14/2019 9780764526114 Chapter 7 Standard Templates

    8/8

    The Document Library templates demonstrate techniques for using OLE to embed MicrosoftOffice and Lotus SmartSuite documents within a document in an NSF file. It alsodemonstrates techniques for programming serial and parallel workflow processes.

    The next part of the book, Part III, dives into the architecture of an application and covers suchtopics as pages, forms, views, folders, and so on.

    Lotus Notes and Domino 6 Programming Bible 6

    Reprinted for [email protected], IBM John Wiley & Sons (US), Wiley Publishing, Inc. (c) 2003, Copying Prohibited

    http://www.books24x7.com//viewer.asp?bkid=6059&destid=249#249http://www.books24x7.com//viewer.asp?bkid=6059&destid=249#249http://www.books24x7.com//viewer.asp?bkid=6059&destid=249#249http://www.books24x7.com//viewer.asp?bkid=6059&destid=249#249