Add third-party links using JavaScript 

Add third-party links to the Profiles business card using JavaScriptâ„¢. These links display at the top of the business card next to the application links.


About this task

In addition to defining services in the LotusConnections-config.xml file, you can include additional services in the Profiles business card using JavaScript. Your code can add a service either using a widget from another vendor or if your vendor-acquired application includes the business card as part of the application. These services do not have to be defined in the LotusConnections-config.xml configuration file.

To extend the Profiles business card using JavaScript...


Procedure

  1. Include the following reference to the semanticTagService.js file in your code:

      <script type="text/javascript" src="/profiles/ibm_semanticTagServlet/javascript/semanticTagService.js"></script>

      Notes:

      1. The business card uses Dojo. If Dojo is already included in your application, add the ?inclDojo=false URL parameter to the JavaScript include as follows, otherwise the business card will not work.

          <script type="text/javascript" src="/profiles/ibm_semanticTagServlet/javascript/semanticTagService.js?inclDojo=false"></script>

          If you use the ?inclDojo=false setting, ensure that you include the Javelin JavaScript after you include Dojo on your web page.

      2. The business card can be loaded with or without CSS. If you already have the IBM Connections CSS files loaded in your application and do not want to include the CSS again, add the loadCssFiles=false parameter to the JavaScript include like this:

          <script type="text/javascript" src="/profiles/ibm_semanticTagServlet/javascript/semanticTagService.js?loadCssFiles=false"></script>

      3. The business card cannot be run from the file system using a static HTML file due to browser security issues. Your HTML file must be placed on a web server. This server does not need to be in the same domain as Profiles. If you need to show the Javelin card running on a file system for demonstration purposes, you can include a non-Dojo version of the Javelin card using the following reference:

          <script type="text/javascript" src="/profiles/ibm_semanticTagServlet/javascript/semanticTagService201.js"></script>

          This version of the Javelin card is not officially supported and has numerous bugs, but it serves to demonstrate the card being surfaced from a static HTML file. In a production environment, always use the following version for your integration:

          <script type="text/javascript" src="/profiles/ibm_semanticTagServlet/javascript/semanticTagService.js"></script>

  2. Invoke SemTagPerson.services.push from your JavaScript code to add an additional service, and define the following parameters:

      Table 1. Third-party service parameters
      Parameter Description
      name Used internally by the framework to identify the service. This value must be unique.

      This parameter takes a string value.

      url_pattern Equivalent to the person_card_service_url_pattern attribute in the XML configuration document.

      This parameter takes a string value.

      js_eval Equivalent to the person_card_service_name_js_eval attribute in the XML configuration document.

      This parameter takes a string value.

      You can add a resource string as the value for this attribute. The resource string must include "generalrs." before the resource bundle key. See Add custom strings for widgets and other specified scenarios for information about how to add resource strings to the business card.

      In previous releases, it was possible to use JavaScript to resolve the service label by using the js_eval parameter. By default, this backwards-compatibility is not broken unless the allowJsonpJavelin property is set to false. When allowJsonpJavelin property is set to false, the js_eval parameter is treated as a string. If you do not want to use strings located in the default resource bundle, use the label attribute instead.

      location The location and url_pattern are combined into one URL before the link is displayed.
      label Used instead of js_eval to denote a string that is used to provide a label for the custom service link.


      The following parameters inside the url_pattern are placeholders. When the business card is rendered, the parameters are replaced by the real value at runtime.

      Table 2. URL pattern parameters

      Parameter Description
      email The profile user's email address.
      userid The profile user's user ID.
      uid The profile user's UID.
      displayName The profile user's full name.
      workPhoneNumber The profile user's work telephone number.

      For example:

      <script type="text/javascript" src="/profiles/ibm_semanticTagServlet/javascript/semanticTagService.js"></script>
      <script>
       
      SemTagPerson.services.push({name: 'googleService',
      url_pattern: '/search?hl=en&q={displayName}&btnG=Google+Search',
      label: 'Google Me',
      location: 'http://www.google.com'});
       
      SemTagPerson.services.push({name: 'quickrService',
      url_pattern: '/QuickrEntry?email={email}',
      js_eval: 'generalrs.label_personcard_quickrlink',
      location: 'http://quickrdomino.example.com/servlet'});
       
      </script>


Parent topic

Customize the Profiles business card


Related tasks


Add custom strings for widgets and other specified scenarios


   

 

});