Continued from Part 1 : How to show your organization tree structure as separate profile types in Connections Profiles (part 1)

Connections Profiles

Since we’re not using any new fields, extension attributes are not required, and the configuration is pretty simple.

Profile Type

Add a new profiletype, by creating a new “type” block in the file profile-types.xml (/profile-types.xml).

You can just copy the default type, and add the id to indicate it’s type. In the sample below, I’ve removed fields that are not applicable for the Organization type.

<type>  
    <parentId>snx:person</parentId>  
    **<id>organization</id>**  
    <property>  
        <ref>secretaryUid</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>bldgId</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>floor</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>officeName</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
    <prope<rty>  
        <ref>blogUrl</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>description</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
        <richText>true</richText>  
    </property>  
    <property>  
        <ref>profileLinks</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>timezone</ref>  
        <updatability>readwrite</updatability>  
        <hidden>false</hidden>  
    </property>  
  
    <property>  
        <ref>orgId</ref>  
        <updatability>read</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>workLocationCode</ref>  
        <updatability>read</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>countryCode</ref>  
        <updatability>read</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>email</ref>  
        <updatability>read</updatability>  
        <hidden>false</hidden>  
    </property>  
    <property>  
        <ref>displayName</ref>  
        <updatability>read</updatability>  
        <hidden>false</hidden>  
    </property>  
</type>  

Save the file, and sync the nodes.

Profile Policy

The profile policy controls what functionality is available on what type of profiles.

The file to edit is profiles-policy.xml
(on your deploymentmanager , /profiles-policy.xml)

Just add a profileType with type organization to the features you wish to behave differently for the new organization type. You can copy the configuration from the comments in the file, to activate it.
In this example, I disable the board, status updates, colleagues, people managed and following.

<features>  
<feature name="profile.board">  
<profileType type="default" enabled="true">  
    <acl name="profile.board.write.message" scope="colleagues_and_self" />  
<acl name="profile.board.write.comment" scope="colleagues_and_self" />  
</profileType>                  
<profileType type="organization" enabled="false"><acl name="profile.board.write.message" scope="colleagues_and_self" /><acl name="profile.board.write.comment" scope="colleagues_and_self" /></profileType>  
</feature>  
  
<feature name="profile.status">  
<profileType type="default" enabled="true">  
<acl name="profile.status.update" scope="self" />  
</profileType>  
<profileType type="organization" enabled="false"><acl name="profile.status.update" scope="self" /></profileType>  
</feature>  
  
<feature name="profile.photo">  
<profileType type="default" enabled="true">  
<acl name="profile.photo.update" scope="self" />  
</profileType>  
<profileType type="organization" enabled="true"><acl name="profile.photo.update" scope="none" /></profileType>  
</feature>  
  
<feature name="profile.pronunciation">  
<profileType type="default" enabled="true">  
<acl name="profile.pronunciation.update" scope="self" />  
</profileType>  
<profileType type="organization" enabled="true"><acl name="profile.pronunciation.update" scope="self" />  
</profileType>  
</feature>  
      
<feature name="profile.colleague">  
<profileType type="default" enabled="true">  
    <acl name="profile.colleague.connect" scope="person_not_self" />  
</profileType>  
<profileType type="organization" enabled="false"><acl name="profile.colleague.connect" scope="none" /></profileType>              
</feature>  
  
<feature name="profile.reportTo">  
<profileType type="default" enabled="true">  
</profileType>  
<profileType type="manager" enabled="false">  
</profileType>  
<profileType type="organization" enabled="true"></profileType>  
</feature>  
      
<feature name="profile.peopleManaged">  
<profileType type="default" enabled="true">  
</profileType>  
<profileType type="organization" enabled="false"></profileType>  
</feature>  
  
<feature name="profile.tag">  
<profileType type="default" enabled="true">  
    <acl name="profile.tag.add" scope="person_and_self" />  
</profileType>  
<profileType type="organization" enabled="true"><acl name="profile.tag.add" scope="person_and_self" /></profileType>  
</feature>  
  
<feature name="profile.following">  
<profileType type="default" enabled="true">  
    <acl name="profile.following.add" scope="person_not_self" />  
</profileType>  
<profileType type="contractor" enabled="true">  
    <acl name="profile.following.add" scope="colleagues_not_self" />  
</profileType>  
<profileType type="organization" enabled="false"><acl name="profile.following.add" scope="none" /></profileType>  
</feature>  
</features>  

Remember to sync the nodes after editing this file.

Templates

The Freemarker templates are used to define the user interface for Profile views, edits, Business Cards and Search results within Profiles. You can check this site for more information : http://freemarker.org/docs/index.html.

The templates are located in the /profiles/templates directory on the Deployment Manager. As always, after editing, do a full sync of your nodes to update the Connections nodes. In particular, businessCardInfo.ftl, profileDetails.ftl and searchResults.ftl may require changing. It’s probably not necessary to edit profileEdit.ftl, since the Edit page will never be visible for the profileType organization.

If you don’t want to restart Profiles every time you made a change, you can enable template reloading (do not do this on a production system : eg. for Connections 4.5 : http://infolib.lotus.com/resources/connections/4.5.0/doc/accessible/admin/en_us/acc_p4.html#t_admin_profiles_template_reload

This is an example of an <#if> construct that allows you to show or hide fields based on the profileType. In this example, I hide the email field for the organization profileType. Note that this is slightly different from the “hideIfEmpty” attribute, that you can use by default - in this case it will not render the html at all for organization types, while for the default type, the line will be hidden if it does not contain a value.

<#if !(profile\["profileType"\])?contains("organization")>   
<@util.renderProperty ref="email" nlsKey="label.email" hideIfEmpty=true ; ref, dataId, dataKey, nlsKey, nlsBundle>  
  
    <@util.renderValue ref=ref renderAs="email"/>  
    <br/>  
</@util.renderProperty>  
</#if>  

If you want to see what the fields are that you can use, you can (temporarily) use this little snippet in your templates :

<#assign allkeys = profile?keys>  
<#list allkeys as akey>${akey}</br></#list>  

Remember to sync the nodes after making changes !

Widget configuration

To change the look and feel of the Profile page, we can further limit what widgets will be displayed:

Default profile display:

Image:How to show your Organization tree structure as separate Profile types in Connections Profiles (part 2)

The areas indicated in red , will be disabled for the Organization profile type, as you see in the picture below.
Organization type display:

Image:How to show your Organization tree structure as separate Profile types in Connections Profiles (part 2)

The tabs shown in this profile, are different from the default profile, as you can see. No background tab, no status updates tab.

The configuration file to change is /widgets-config.xml

To modify what widgets to show and to change what tabs are shown, create a new layout resourceSubType. Copy it from the “default” one, and remove the lines you don’t need.

<layout resourceSubType="default">  
    <page pageId="profilesView">  
     <widgetInstance uiLocation="col2" defIdRef="multiWidget" instanceId="tabsWidget1"/>  
    <widgetInstance uiLocation="tabsWidget1" defIdRef="Updates"/>  
     <widgetInstance uiLocation="tabsWidget1" defIdRef="contactInfo"/>  
     <widgetInstance uiLocation="tabsWidget1" defIdRef="backgroundInfo"/>  
     <!--<widgetInstance uiLocation="tabsWidget1" defIdRef="multiFeedReader"/>-->                  
     <widgetInstance uiLocation="col1" defIdRef="socialTags"/>  
     <widgetInstance uiLocation="col1" defIdRef="sand_thingsInCommon"/><widgetInstance uiLocation="col3" defIdRef="sand_socialPath"/>  
     <widgetInstance uiLocation="col3" defIdRef="reportStructure"/>  
     <widgetInstance uiLocation="col3" defIdRef="friends"/><widgetInstance uiLocation="col3" defIdRef="linkRoll"/>  
    </page>  
    <page pageId="searchResultView">  
     <widgetInstance uiLocation="col1" defIdRef="commonTags"/>  
    </page>  
    <page pageId="searchView">  
     <widgetInstance uiLocation="col1" defIdRef="sand_DYK"/>  
     <widgetInstance uiLocation="col1" defIdRef="commonTags"/>  
     <!--  
     <widgetInstance uiLocation="col3" defIdRef="sand_recomItems"/>  
     -->  
    </page>  
    <page pageId="networkView">  
     <widgetInstance uiLocation="col1" defIdRef="sand_DYK"/>  
    </page>  
    <page pageId="editProfileView">  
     <widgetInstance uiLocation="col1" defIdRef="socialTags"/>  
     <!--  
     <widgetInstance uiLocation="col1" defIdRef="sand_thingsInCommon"/>  
     -->  
     <widgetInstance uiLocation="col3" defIdRef="sand_socialPath"/>  
     <widgetInstance uiLocation="col3" defIdRef="reportStructure"/>  
     <widgetInstance uiLocation="col3" defIdRef="friends"/>  
     <widgetInstance uiLocation="col3" defIdRef="linkRoll"/>  
    </page>  
  </layout>  
<!-- organization profile type -->  
<layout resourceSubType="organization">  
    <page pageId="profilesView">  
     <widgetInstance uiLocation="col2" defIdRef="multiWidget" instanceId="tabsWidget1"/>  
     <widgetInstance uiLocation="tabsWidget1" defIdRef="contactInfo"/>  
         <widgetInstance uiLocation="col1" defIdRef="socialTags"/>  
     <widgetInstance uiLocation="col3" defIdRef="reportStructure"/>                 
    </page>  
    <page pageId="searchResultView">  
     <widgetInstance uiLocation="col1" defIdRef="commonTags"/>  
    </page>  
    <page pageId="searchView">  
     <widgetInstance uiLocation="col1" defIdRef="sand_DYK"/>  
     <widgetInstance uiLocation="col1" defIdRef="commonTags"/>  
     <!--  
     <widgetInstance uiLocation="col3" defIdRef="sand_recomItems"/>  
     -->  
    </page>  
    <page pageId="networkView">  
     <widgetInstance uiLocation="col1" defIdRef="sand_DYK"/>  
    </page>  
    <page pageId="editProfileView">  
     <widgetInstance uiLocation="col1" defIdRef="socialTags"/>  
     <widgetInstance uiLocation="col3" defIdRef="reportStructure"/>  
     <widgetInstance uiLocation="col3" defIdRef="friends"/>  
     <widgetInstance uiLocation="col3" defIdRef="linkRoll"/>  
    </page>  
  </layout>  
<!-- end organization -->  

The items in comments are removed for the resourceSubType “organization”.

To activate the changes, you need to sync the nodes, and restarting the Common application will be sufficient (if you enabled customization debugging).

Open points

Now this approach is not without it’s problems. Organizations are definitely not a profiletype as it was designed - the profiletypes and data stored in Connections Profiles are all actual users by design ! So this does mean there are some things to fix if you would deploy this in real life :

  • some functions need to be disabled (eg. mail) in the user interface. It would automatically not be there if the organization is not assigned an email address - but this causes other problems ….
  • TDI customization : it would be the goal to include links to the organization from the user’s profile to the Organization document
  • TDI customization : you’d want some snippet of XML or HTML code stored somewhere to be imported into the Profile, with the description of the Organization.
  • naming : some naming is not “correct” if the profile is an organization. Eg. in the report-to widget, there’s mention of People Managed, which should read “Departments below” or something.
  • tags : it would be good if during the creation of the Organizations, tags are added automatically. The tags would be very helpful in the Full Text results, where at the moment, there is not a lot of data shown.