| Date tip published: | 07/07/2008 |
| Description: | Notes 8.0.1 added the ability to put a Notes view in the Notes 8 sidebar as a widget. Widgets can then be deployed across your organization using a desktop policy and a Widget catalog. One use of this is in the TLCC user courses. A list of all the lessons in the course can be deployed in the sidebar to allow for easy access to a particular lesson. One issue with standard Notes views is that they require the user to double-click a document to open it. This may not be intuitive in the sidebar. This tip will cover a solution to allow the user to single-click a document in the sidebar and will also describe how to create the Widget and deploy it in the Widget catalog for use by all your users. |
To learn more about composite applications and widgets use the following links:
Notes Domino 8.5 Application Development 2
Notes Domino 8 Application Development Update
Put a Notes View into the Notes 8 Sidebar
With the introduction of Widgets in the Notes 8.0.1 Standard client, it is now easy to display content in the Notes client sidebar. One way TLCC has used this feature is to list the lessons from the TLCC user course in the sidebar so they are always available to users. This lets the users easily see the topics from the course and quickly navigate to a topic they might want to learn more about. Below is an image of one of TLCC's user courses available in the Notes sidebar.
A student can click on any lesson title in the sidebar to open the lesson and display its contents in a Notes window tab.
Designing the View
It is best to have a view dedicated to the sidebar use. This allows the view to be optimized for use in the sidebar. This section details changes made to the view used by TLCC in their user courses. The changes are:
- Optimize the view for the sidebar (small text)
- Create a Postopen event
- Create a Onselect event
- Create a Frameset with one frame
- Create a Queryopendocument event
Screen real estate in the sidebar is at a premium. The view column's text properties was changed to 8 pt fonts. The column headings were also changed to 8 pt and were set to bold.
When users double-click on a document in the view it will open as a new tab in the Notes client. Each document opened will create a new tab. Since users may not associate applications in the side bar with a "typical" Notes view, they may not expect that a double-click is required to open a document. They may not also want multiple windows to open as they browser the documents in the sidebar. To change this default behavior requires changes to the design of the view. The Onselect event of the view is modified so when users single-click on a document in the view the document will open in a frameset. This will also prevent multiple tabs being opened as the user views different documents.
When the view first opens in the sidebar (or Notes client), a document is selected. To prevent this from automatically opening a document everytime the view opens in the sidebar a flag is set in the PostOpen event of the view. This flag is then used in the Onselect event of the view to determine if the view has just opened or if the user subsequently selected a document in the view. The PostOpen event is shown below:
Below is the code from the Onselect event of the view. This is explained in further detail in the code walk-thru after the image.
The code listing from the Onselect event of the view is below. Line 2 checks to see if the flag set in the Postopen event is true (first time in the view) or not. If true, the flag is set to false and then the Exit Sub method is called so the rest of the code does not execute.
Subsequent selections (single-click) of a document by the user will cause the code from line 6 onward to execute. Line 7 gets the UNID of the selected document. Lines 6 to 13 get the current database and declare variables. Line 14 gets the NotesDocument object that corresponds to whatever document the user selected. If the user clicked on a category, then the NotesDocument (doc in this case) will not point to a document and is "nothing". Line 15 tests to see if doc is nothing. If the user actually clicked on a document in the view then line 16 will open a frameset. Line 17 sets a target frame and line 18 opens the document in read mode.
| 1. | Sub Onselect(Source As Notesuiview) |
| 2. | If flag Then |
| 3. |     flag = False |
| 4. |     Exit Sub |
| 5. | End If |
| 6. | Dim docid As String |
| 7. | docid = source.CaretNoteID |
| 8. | Dim uiws As New NotesUIWorkspace |
| 9. | Dim db As NotesDatabase |
| 10. | Dim uidb As NotesUIDatabase |
| 11. | Set uidb = uiws.CurrentDatabase |
| 12. | Set db=uidb.database |
| 13. | Dim doc As NotesDocument |
| 14. | Set doc = db.GetDocumentByID(docid) |
| 15. | If Not doc Is Nothing Then |
| 16. |     Call uiws.OpenFrameSet("OpenFormFromSideBar") |
| 17. |     Call uiws.SetTargetFrame("Main") |
| 18. |     Call uiws.EditDocument(False, doc, True,"",False,False) |
| 19. | End If |
| 20. | End Sub |
The "OpenFormFromSideBar" frameset is simply a frameset with one frame. A frameset is used to prevent multiple tabs being opened as the user clicks on different documents. The one frame in this frameset was called "Main" in this example.
The next step is to prevent the user from double-clicking on a document to open it. This is done in the Queryopendocument event. Simply set continue to false to prevent the document be being opened via traditional methods (like double-clicking.)
The final step is to hide the view from the users. Put parentheses around the view's name so it is hidden.
Creating a Widget from the View
The next step is to create a Widget from the view.
- Open up the database that holds the view you just created.
- Hold down the SHIFT and CTRL keys at the same time and select View | Go To... from the menu. This opens up the list of all views, including hidden views.
- Choose the view you created for the sidebar, in this case the (SideBarView), from the list and click [OK].

- The (SideBarView) will now open in the Notes client.
- Click on the Configure a Widget icon in the toolbar.

- Choose to "Open a Notes view, document, or frameset" and then append the text, "?openview&hidenavigator" to the end of the Notes URL as indicated below. Click [Next] to continue.

- Change the Component name (Note this is the title that should appear in the Sidebar, however there is a bug in Notes 8.0.1. The name of the database and the title of the view will be used as the title bar in the sidebar. This is to be fixed in 8.0.2 per IBM.). Choose to 'Display as a sidebar panel' and click [Next] to continue.

- On the last screen click [Finish].
- The Widget will now open in your sidebar. Test it out before publishing.
Publishing the Widget to the Widget Catalog
After you test out the view in the sidebar, the next step is to publish the widget to the Widget Catalog. This will allow other users to use this widget in their Notes client. A Widget Catalog should reside on your Domino servers. Ideally, there should be one replica of the Widget Catalog across your organization. Users can only use one Widget Catalog at a time. The location and name of the Widget Catalog is set in the user preferences (File - Preferences - Widgets). A Widget Catalog can be created from the Widget Catalog template (toolbox.ntf).
If you desire to automatically push this widget to a group of users then use a desktop policy to specify that all widgets in a particular category are to be installed on the users' desktops. The installation of the widget(s) will happen the next time they start Notes.
- Right click on the Widget in your My Widgets panel and choose the option to Publish to Catalog.

- The Widget will be added to your catalog. Open the Widget catalog by choosing Catalog | Browse from the My Widgets menu.

- You will see the Widget you just created listed in the view. Edit this widget and assign it to one or more categories. In the image below the "Required" category was used, but you can choose any name and can add a new category by using the New keyword option.

- The next step is to create or modify a Desktop Settings document to assign the appropriate Widget settings for the users who will be taking this course. This step will need to be done in collaboration with your Domino administrator. Below is an image showing the settings that should be set:

Widget catalog server is the name of the server that hold the widget catalog.
Widget catalog application name is the filename of the Widget catalog.
Widget catalog categories to install is the name of the category. All widgets in this category are automatically installed when the users next start their Notes 8 client.
- Modify the Policy documents to distribute the Widget settings (set in Desktop Settings document) to the appropriate user community.
For more information on TLCC's Notes 8 user courses go to:
http://www.tlcc.com/users
For more information on TLCC's Sametime courses go to:
http://www.tlcc.com/sametime8usercourses |