loading table of contents...

8.3.2. Displaying Custom Information in Studio

You can show additional information inside the moderation tab and user management window of CoreMedia Studio by extending the Studio web application (server side) and modifying the ElasticSocialStudioPlugin.exml (client side).

Server Side: REST JsonCustomizer

Provide a JsonCustomizer to the Studio web application that adds the additional information to the data that is transferred from the REST back-end to the Studio app for users:

@Named
public class MyCommunityUserJsonCustomizer implements JsonCustomizer<CommunityUser> {
  public void customize(CommunityUser communityUser, Map<String, Object> serializedObject) {
    serializedObject.put("additional", communityUser.getProperty("information", String.class));
  }
}
      

or for comments:

@Named
public class MyCommentJsonCustomizer implements JsonCustomizer<Comment> {
  public void customize(Comment comment, Map<String, Object> serializedObject) {
    serializedObject.put("additional", comment.getProperty("information", String.class));
  }
}
      

Client Side (1): Display Custom Properties

Three extension points are provided for displaying custom properties for comments or users.

  1. Extend the commentExtensionTabPanel to add components for comments that are displayed above the approve and reject buttons inside the moderation/archive tab (use activeContributionAdministration in the expression for the elasticPluginLabel in order to reference the active contribution administration, depending on whether the moderation or the archive tab is active):

    <ui:pluginRules>
      ...
      <ui:rules>
        ...
        <elastic:commentExtensionTabPanel>
          <plugins>
            <ui:addItemsPlugin>
              <ui:items>
              <panel title="additionalInformation" layout="form" autoHeight="true"  cls="elastic-extensionTab">
               <items>
                  <es:elasticPluginLabel fieldLabel="additional"
                      expression="activeContributionAdministration.displayed.additional"/>
                </items>
              </ui:items>
            </ui:addItemsPlugin>
          </plugins>
        </elastic:commentExtensionTabPanel>
        ...
      </ui:rules>
      ...
    </ui:pluginRules>

  2. Extend the userProfileExtensionTabPanel to add components for user profiles that are displayed above the approve and reject buttons inside the moderation tab:

    <ui:pluginRules>
      ...
      <ui:rules>
        ...
        <elastic:userProfileExtensionTabPanel>
          <plugins>
            <ui:addItemsPlugin>
              <ui:items>
                <panel title="additionalInformation" layout="form" autoHeight="true" cls="elastic-extensionTab">
                  <items>
                    <es:elasticPluginLabel fieldLabel="additional"
                        expression="contributionAdministration.displayed.additional"/>
                  </items>
                </panel>
               /ui:items>
            </ui:addItemsPlugin>
          </plugins>
        </elastic:userProfileExtensionTabPanel>
        ...
      </ui:rules>
      ...
    </ui:pluginRules>

  3. Extend the customUserInformationContainer to add components that are displayed below the user meta information panel inside the user management view:

    <ui:pluginRules>
      ...
      <ui:rules>
        ...
        <elastic:customUserInformationContainer>
          <plugins>
            <ui:addItemsPlugin>
              <ui:items>
                <container layout="form" autoHeight="true">
                  <items>
                    <es:elasticPluginLabel fieldLabel="additional"
                        expression="userAdministration.edited.additional"/>
                  </items>
                </container>
              </ui:items>
            </ui:addItemsPlugin>
          </plugins>
        </elastic:customUserInformationContainer>
        ...
      </ui:rules>
      ...
    </ui:pluginRules>

Client Side (2): Edit Custom Properties

For all three extensions points described above it is also possible to not just display but to edit/moderate custom properties. Instead of elasticPluginLabel just use elasticPluginPropertyField. This provides a text field for editing the property. Number or Boolean fields are not provided but can be constructed analogously. When you construct your own property field it is important to register the corresponding property as being moderated. This can either be done directly by your property field (c.f. ElasticPluginPropertyFieldBase) or you use the registerModeratedPropertiesPlugin for this purpose.