Monday, July 6, 2015

Webcenter Portal Content Presenter Display Template

Content Presenter Taskflows are incorporating the content from content server in the webcenter portal and webcenter portal framework applications.

Using Site Studio connection with JDeveloper (Details) , we can create the Site Studio Files. Initially, we will analyse the page requirements and we ill create the Asset Modelling Document. Based on this, we will create the Element Definition, Region Definition and Contributor Data File in Content Server. Contributor Data File will have the content to be displayed in the portal.

We need a content presenter display template in order to render the site studio file in the Portal Pages.

A Content Presenter Display Template is a jsff (JSF Page Fragment) file. Oracle webcenter portal and portal framework application provides many pre-built content presenter display template to render the content in various formats.

The content types can map to the site studio region definitions. When we map this into content presenter display templates, we need to know the Region Definition of the CDF files and the property names to map the content property with jsff elements or components.

Follow the below steps to create the content presenter display template.

1. Create the WebCenter Portal Framework application.
2. Create a new jsff page.
3. Add the below code in the jsff file.

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:dt="http://xmlns.oracle.com/webcenter/content/templates"
version="2.1">
<dt:contentTemplateDef var="node">
    <af:panelGroupLayout id="pgl1">
      <af:outputText value="#{node.propertyMap['CATEGORY_TWOCL_ABTUS_RD:TEASERDESC'].asTextHtml}" id="ot1"/>
      <af:outputText value="#{node.propertyMap['CATEGORY_TWOCL_ABTUS_RD:IMAGE'].value}" id="ot3"/>
    </af:panelGroupLayout>
  </dt:contentTemplateDef>
</jsp:root>


In the above code,

CATEGORY_TWOCL_ABTUS_RD - is the Element Definition for the CDF file.

Region Definition Code:-

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<regionDefinition xmlns="http://www.oracle.com/sitestudio/Element/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/sitestudio/Element/ http://www.oracle.com/sitestudio/ss_element_definition.xsd">
    <elements>
        <elementReference location="IMAGE_ED" name="IMAGE">
            <property name="label" value="CATEGORY_TWOCL_ABTUS_RD"/>
            <property name="description" value=""/>
        </elementReference>
        <elementReference location="TEASER_DESC_ED" name="TEASERDESC">
            <property name="label" value="TEASER_DESC_ED"/>
            <property name="description" value=""/>
        </elementReference>
        <elementReference location=URLLIST_ED" name="URLLIST">
            <property name="label" value="URLLIST_ED"/>
            <property name="description" value=""/>
        </elementReference>
    </elements>
    <property name="description" value=""/>
    <dataProperty name="metadata"></dataProperty>
    <complexProperty name="switchregioncontent">
        <property name="createnewxml" value="true"/>
        <property name="createnewnative" value="false"/>
        <property name="choosemanaged" value="true"/>
        <property name="chooselocal" value="false"/>
        <property name="choosenone" value="false"/>
        <valueList name="createnewnativedoctypes"/>
        <complexProperty name="choosemanagedquerytext">
            <property name="corecontentonly" value="false"/>
            <dataProperty name="querytext">((xWebsiteObjectType &lt;matches&gt; `Data File`) &lt;and&gt; (xRegionDefinition &lt;matches&gt; `CATEGORY_TWOCL_ABTUS_RD`)) &lt;or&gt; (xWebsiteObjectType &lt;matches&gt; `Native Document`)</dataProperty>
        </complexProperty>
        <dataProperty name="defaultmetadata"></dataProperty>
    </complexProperty>
</regionDefinition>


We will create the CDF file based on this Region Definition. below are the code for Contributor Data File.

<?xml version="1.0" encoding="UTF-8"?>
<wcm:root version="8.0.0.0" xmlns:wcm="http://www.stellent.com/wcm-data/ns/8.0.0">
<wcm:element name="IMAGE">&lt;img src="[!--$wcmUrl('resource','ABOUTUSSAMPLEIMAGE')--]" alt="ABOUTUSSAMPLEIMAGE.jpg" /&gt;</wcm:element>
<wcm:element name="TEASERDESC">Teaser Description</wcm:element>
<wcm:list name="URLLIST">

<wcm:row>
    <wcm:element name="URLTEXT">URL1</wcm:element>
    <wcm:element name="URLLINK">URL1</wcm:element>
</wcm:row>

<wcm:row>
    <wcm:element name="URLTEXT">URL2</wcm:element>
    <wcm:element name="URLLINK">URL2</wcm:element>
</wcm:row>
   
<wcm:row>
    <wcm:element name="URLTEXT">URL3</wcm:element>
    <wcm:element name="URLLINK">URL3</wcm:element>
</wcm:row>
   
<wcm:row>
    <wcm:element name="URLTEXT">URL4</wcm:element>
    <wcm:element name="URLLINK">URL4</wcm:element>
</wcm:row>

</wcm:list>

</wcm:root>


The above CDF file will be created in the content server. This CDF file can be inserted in the portal pages during design time or runtime. For that, we need a ucm connection.

Once we add the contributor data file, we need to select the content presenter display template. For that we need to add this jsff file as portal resource.

Right click on the jsff file and select 'Create Portal Resource'.

Select the Display Name and View ID. This View ID is required to set the content presenter display template in the design time.

Once the content presenter display template is added, we need to login to the portal application or portal framework application and go to the shared assets. We need to make visible this content presenter display template for the portal application in the administration window.

After that select the content presenter display template to view the content in the portal pages.


No comments:

Post a Comment