+

Search Tips   |   Advanced Search


Customize the person menu through the theme

You can use the theme to add custom items to the person menu in any portlet that uses the AJAX person tag.

  1. In the profile_root\installedApps\cell name\wps.ear\wps.war\themes\html\theme name directory, locate the file that you want to modify (for example, head.jspf or default.jsp).

  2. Open the file in a text editor.

  3. To add a menu item to the Person menu, add XML code to the bottom of the file, just before </body></html> tags. The sample code below adds a menu item called Test Action.

    <div class="com.ibm.portal.action" style="display:none;">
     <span class="action-id">test.action1</span>
     <span class="action-impl">/javascript/TestAction.js</span>
     <span class="action-context">person</span>
     <span class="action-label">Test Action</span>
     <span class="action-description">This is a test for extending Person menu</span>
     <span class="action-showif">TestAction.showif</span>
     <span class="action-url">javascript:TestAction.execute(@@@ARGS@@@)</span>
     <span class="action-order">0</span>
    </div>
    

  4. Save the changes to the file.

  5. Create a JavaScriptâ„¢ file that executes the action you want to occur when the associated menu item is selected. The sample code below generates an alert when the menu item Test Action is selected.

    var TestAction = {
      showif: function(person) {
        return true;
      },
      execute: function(person) {
        alert("TestAction executed for: " + person.fn);
      }}
    

    Paste the JavaScript file (TestAction.js) in the following directory: PortalServer_root\ui\wp.tagging.liveobject\semTagEar\Live_Object_Framework.ear\liveobjects.war\javascript.

  6. In the profile_root\installedApps\cell name\wps.ear\wps.war\themes\html\theme name directory, open Default.jsp, and then update the file's timestamp by making a change, removing the change, and then saving the file.

    If you added the menu item to default.jsp, you have already updated the file's timestamp and can skip this step.

  7. To verify that the new menu item was added to the person menu, open a portlet such as the People Finder that supports people awareness and then open the person menu for a selected user. Verify that the menu displays the item that you added (for example Test Action) and that the item performs the expected action.


Parent topic:

Collaborative Services API