Gadget actions and OpenSearch

This topic contains more advanced material about contributing gadget actions to Notes menus.

Gadget actions

A gadget can contribute actions to the Notes client. These actions can be contributed by the context menu and the top-level menu. A gadget may contribute actions to specific objects, such as mail messages, contacts, and attachments, and may display in the context menu when selecting and right-clicking those objects.
Gadget menus
When run, the action opens the parent gadget and runs some JavaScript, which may or may not act on the current selection. The action can specify both the gadget view in which it should open (for example, profile, default, or canvas), and the view target, which is the type of Notes view in which the gadget should be opened (for example, tabbed page, sidebar, floating window, or dialog box). If no view is specified, the action runs in the default (or current, if open) view of the gadget, and if no view target is specified, the action runs in a floating window.
Note: If multiple instances of the same gadget are open, the action runs in all of those views. If any instance of the gadget is open, the action runs in that instance, no new instance is opened, and the view target is ignored.
Code examples
  • This action binds to any opensocialPerson object, which in the Notes context means, for example, a sender in your Inbox, or a contact:
    <action id="os.test.person" dataType="opensocial.Person" label="Person Action" tooltip="Person Action" />
  • This action binds to an opensocialPerson object and opens in the profile view inside the gadget:
    <action id="os.test.person.blue" dataType="opensocial.Person" label="Profile Person Action" tooltip="Blue Person Action" view="profile" />
  • This action binds to an opensocialPerson object, opens in the canvas view inside the gadget, and opens the gadget in a new tab:
    <action id="os.test.person.blue.tab" dataType="opensocial.Person" label="Tab Person Action" tooltip="Blue Tab Person Action" view="canvas" viewTarget="TAB" />

OpenSearch

Gadgets that implement the opensearch feature contribute the search engine described in the feature to the Notes Search Center. For example, a gadget containing the following feature declaration contributes the CNN.com search to the Notes Search Center. The user can then search the CNN website from inside the Notes client.

Feature declaration
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="CNN Search">
	<Optional feature="opensearch">
	<Param name="opensearch-description"><![CDATA[<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" >
<ShortName>CNN.com</ShortName>
<Description>CNN.com Search</Description>
<InputEncoding>UTF-8</InputEncoding>
<SearchForm>http://search.cnn.com/</SearchForm>
<Url type="text/html" method="get" template="http://www.cnn.com/search/?query={searchTerms}">
</Url>
</OpenSearchDescription>
]]></Param>
	</Optional>
</ModulePrefs>
<Content type="html"><![CDATA[
Hello, world!
]]></Content>
</Module>

Example CNN search contributed to Notes Search Center