Customize person menu actions

 

+

Search Tips   |   Advanced Search

 

We can add custom menu items to the Person menu provided by the person tag.

We can add items to the menu in any portlet that uses the person tag, whether the portlet is provided with IBM WebSphere Portal or is a custom portlet.

To add a custom menu item, you will create a new Java class that implements:

    com.ibm.workplace.people.portal.workspace.PersonMenuItem 

The lwp.peoplePortalAPI.jar file contains the necessary interface.

Perform the following steps:

  1. Create a new Java class that implements com.ibm.workplace.people.portal.workspace.PersonMenuItem, found on the WebSphere Portal server in the following location:

    portal_server_root/shared/app/lotusworkplacelib/lwp.peoplePortalAPI.jar

  2. In the new class, implement the following method:

        public MenuData getMenuData(PageContext pageContext, Member id);
    

    The Member object represents the person who is being displayed in the tag.

  3. The Member object is populated with the following WMM attributes:

    • ibm-primary-email
    • displayName

  4. The MemberDN and the WMMID can be retrieved from the MemberIdentifier object.

  5. Returning null causes no menu item to be added.

  6. MenuData (if returned) contains a display label and a URI to execute when the menuitem is clicked.

    The method needs to return the following class, which already exists in lwp.peoplePortalAPI.jar:

        com.ibm.wkplc.people.tag.MenuData 

    The constructor for this class is:

        public MenuData(String mURI, String mDisplayName) 
        {
         this(mURI, mDisplayName, false);
        }
    

    The mURI argument is the URI that will be launched when the menu item is selected.

    The mDisplayName argument is the label that will appear for the menu item.

    Compile the new class and package it as a.jar file. At a minimum, the.jar files required on the classpath to compile the menuitem are wmm.jar and j2ee.jar, found in the following directory:

    app_server_root/lib

    ...and lwp.peoplePortalAPI.jar, found in the following directory...

    portal_server_root/shared/app/lotusworkplacelib/

  7. Copy the.jar file you created to the following directory:

    portal_server_root/shared/app/lotusworkplacelib

  8. Locate the CSEnvironment.properties file in the following directory:

    portal_server_root/shared/app/config

  9. Edit the file and search for the key "CS_SERVER_PERSONTAG.menuclasses," which is a comma-separated list of menuitem class names.

    The following example shows the default value of that key...

    CS_SERVER_PERSONTAG.menuclasses=
    com.ibm.wkplc.people.tag.menuitems.ClassicChatPersonMenuItem,
    com.ibm.wkplc.people.tag.menuitems.PortalMailPersonMenuItem,
    com.ibm.wkplc.people.tag.menuitems.PortalShowProfileMenuItem,
    com.ibm.wkplc.people.tag.menuitems.PortalFindDocsMenuItem,
    com.ibm.wkplc.people.tag.menuitems.ClassicAddToContactListMenuItem,
    com.ibm.wkplc.people.tag.menuitems.ViewPersonRecordMenuItem,
    com.ibm.wkplc.people.tag.menuitems.ViewOrganizationViewMenuItem,
    com.ibm.wkplc.people.tag.menuitems.SampleMenuItem

    If you copy and paste the example of the key value, remove the line breaks before pasting.

  10. Restart the portal server.

 

Parent Topic

Collaborative Services API

 

Related tasks

Adding the person tag to a portlet
Logging for Collaborative Services

 

Related reference

Collaborative Services samples
Collaborative Services API