Thursday, September 20, 2012

Creating announcement in webcenter page style and associating the forum id dynamically based on the custom attributes


When you create generic content in Webcenter spaces by adding content in the page Style. Users might want to customize different parameters. For instance in my previous blog we created an announcement in a page style. If users want to use the same style for different spaces and want to show announcements related to that particular space. We will try to achieve this by adding custom attribute in the space. These custom attributes will be unique for each space

got to space –> manage all settings.
go to Custom attributes tab.
Click on add attribute.

image

Give a name and value and click add.
image

image


Now to use it in the page style as in my previous blog
In the Page definition where we can change our code to get  the parent id value from our custom attribute.
<executables>
   <page viewId="#{WCAppContext.application.siteTemplatesManager.currentSiteTemplateViewId}" id="shellTemplateBinding" Refresh="ifNeeded"/>
<taskFlow id="announcementminiview1" taskFlowId="/oracle/webcenter/collab/announcement/view/taskflows/mini-view-definition.xml#announcement-mini-view" activation="deferred" xmlns="
http://xmlns.oracle.com/adf/controller/binding">
<parameters>
         <parameter id="parentId" value="#{spaceContext.currentSpace.metadata.customAttributes['MyforumId']}"/>
         <parameter id="expandedAnnouncements" value="5"/>
         <parameter id="hideToolbar" value="#{!WCSecurityContext.userInScopedRole['Moderator']}"/>
</parameters>  
</taskFlow>
</executables>


To access custom atribute use with the name of the custom attribute to get this value
#{spaceContext.currentSpace.metadata.customAttributes['MyforumId']}

No comments:

Post a Comment