Authors:
Vinodh R Mahendrakumar -
vinmahen@in.ibm.com
Josephine Joyce -
jojustin@in.ibm.com
Customizing the WCM Authoring Templates for Portal
Introduction:
In Lotus Web Content Management (WCM) one of the key requirements is to offer a simple and easy to use authoring interface which can provide better user experience which also helps to save time and effort.
This article talks about a few ways to customize the Authoring Template (AT) to provide better comfort and guidance to content authors.
Hiding Sections:
WCM provides a feature to customize the look and feel of a particular field. This will be exploited to hide the fields. The steps for hiding certain sections in a WCM Authoring Template are discussed.
As depicted in Figure 1, WCM provides out-of-the-box functionality to hide entire sections.
Figure 1: Hiding Sections
Certain elements within a section can also be hidden as shown in Figure 2.
Figure 2: Hiding Fields
The section below describes the steps to hide the following fields within the Workflow Section. As seen in Figure 1, there is no out-of-the-box feature available to hide the following fields:
- Document Status
- Select Workflow Button
- Next Workflow Stage
- Joint Approval
- ACTIONS
Using the Manage Elements button, add an element of type Text or Short Text to the Authoring Template, name it as Text.
Figure 3: Manage Elements
Now go to the Default content settings in the Authoring Template, expand Content section, and click on Text Properties Image to open up the form as shown below.
The path to the custom JSP which hides the fields mentioned above is specified here.
Figure 4: Default Content Settings
The sample JSP can be found in the attachments section.
Place the JSP inside < >/installedApps/<>/PA_WCM_Authoring_UI.ear/ilwwcm-authoring.war/
Example :
C:\ibm\WebSphere\wp_profile\installedApps\lotus\PA_WCM_Authoring_UI.ear\ilwwcm-authoring.war\jsp\html
The JSP page may also need to be stored in the client war directory of the servlet or portlet that calls the JSP, example:
Or
Before including the JSP, when a new content is created using this AT, it would look like the following, assuming that none of the fields inside workflow section were hidden:
Figure 5: Preview of the content before including the JSPs
Once the JSP is included in the content items, it looks as shown below:
Figure 6: Preview of the content after including the JSPs
Auto-populating Information in Content Entry Form
This section talks about populating user information using PUMA ( Management Architecture) SPI.
A better end user experience could be provided if certain fields in the content entry form, such as,
Name or
email, can be pre-populated based on the current authenticated user.
PUMA SPI allows getting details about the current logged-in user which can be populated into appropriate fields as per the requirement. The steps describe how to populate Name and Email fields automatically based on the current user.
Using the Manage Elements button add elements of type Text or Short Text to the Authoring Template. These will hold the name and email of the content author.
Figure 7: Manage Elements
Now go to Default content settings in the Authoring Template, expand Content section and click on Name Properties Image to open up the form as shown below.
The path to the custom JSP which populates this field is specified here.
Figure 8: Default Content Settings
Place the name.jsp inside < >/installedApps/< >/PA_WCM_Authoring_UI.ear\ilwwcm-authoring.war
Example:
C:\ibm\WebSphere\wp_profile\installedApps\lotus\PA_WCM_Authoring_UI.ear\ilwwcm-authoring.war\jsp\html.
The JSP page may also need to be stored in the client war directory of the servlet or portlet that calls the JSP.
Example:
Or
Repeat the above procedure for the
Email field.
The code snippet below (Listing 2) shows how the field is displayed to the end user. It also helps registering a javascript function to be executed during submit action. Listing 3 displays the JavaScript function - populateName - which copies the value onto a hidden field storing the user name.
Listing 1
Listing 2
CustomItemBean customItem =
(CustomItemBean) request.getAttribute("CustomItemBean");
customItem.setSubmitFunctionName("populateName");
In Listing 3, the name of the current logged in user is obtained from PUMA SPI.
Listing 3
Map map=null;
if(home!=null){
PumaProfile pp = home.getProfile(request);
if(pp!=null){
List attribNames = new ArrayList();
attribNames.add("cn");
map = pp.getAttributes(pp.getCurrentUser(),attribNames);
Figure 9: Preview of the content before including the JSPs
Content which previously appeared like the one shown above, looks like the following once the custom JSP is used.
Figure 10: Preview of the content after including the JSPs.
Attachments:
WCM_AT_Customization_Portal.zip
This attachment can be downloaded from Lotus Greenhouse. If you do not have a Lotus Greenhouse ID, you may receive one immediately via the registration page.