Untitled Document
Table of contents | Next | Previous
Personalizing your authoring tools
When you manage any creative process, it is important to consider productivity.
As we said previously, Web content management systems are basically
coordination systems where many different content contributors join efforts to
build a Web site by using a set of tools.
As in any other building tasks, if you provide your content authors with the
right tools, they will do things faster and better. Lotus Web Content
Management provides a lot of extension points that allow site designers to
provide a customized authoring experience with wizards and shortcuts for the
most frequent tasks.
In this section, we discuss the following topics:
Inline editing
Lotus Web Content Manager enables site designers to add direct access to some
authoring functions inside the rendered Web pages to perform the following
tasks:
- Create new content items
- Perform inline editing of the content item displayed in a Web page
- Delete the content item displayed in a Web page
- Approve or reject the current content being previewed
These options are visible only to approvers who open a draft content item
from a URL sent by an e-mail workflow action used in a workflow stage.
Inline editing is enabled by using “authoring tools” components, which are
regular components that can be part of presentation templates, menu element
designs, and navigator element designs.
To increase productivity, River Bend designers added an authoring tool
component to every presentation template. Thus, when an author accesses an
existing content item, a quick menu is displayed (as shown in the following
figure) for the author to edit and create new content.

The author only needs to click Edit to access to the current content item in
edit mode as shown in the following figure.

The Authoring tool component creation is a simple process. Therefore, the River
Bend designers only need to specify the design they want for the action buttons
as shown in the following figure.


Several options, such as the authoring template or the site area for new
content, are available for the different authoring tools.
Remote actions
Lotus Web Content Management provides a simple method to access directly a lot
of the authoring environment actions by using a URL pattern. Consider the
following examples of remote action uses:
- Creating content by using a basic form
- Displaying a list of content searched by using an API and providing
direct links for open, edit, approve, decline, or delete actions
- Giving the users direct access to the most useful views in the authoring
portlet based on their role
You can find a list of all available remote actions in the WebSphere Portal
information center at the following address:
http://publib.boulder.ibm.com/infocenter/wpexpdoc/v6r1m0/topic/com.ibm.wp.exp.do
c/wcm/wcm_dev_remoteactions.html
Launch JSP
The Lotus Web Content Management authoring portlet enables you to configure an
alternative launch page to the default user interface. A custom launch page can
either be a JSP or HTML file that must be stored in
was_profile_root/installedApps/cellname/PA_WCM_Authoring_UI.ear/ilwwcm-authoring
.war/jsp/html.
By combining API calls and remote actions in launch JSPs, you can create
shortcuts for views and functions with the authoring portlet user interface.
Example: River Bend's authors page
River Bend wants to help its authors to be productive by reducing the
navigation that they need to do to perform simple tasks. To do this, designers
found that the better solution was to create a launch JSP that provides direct
access to the following tasks:
- Creating a shortcut to create a content element using any of the
authoring templates available for the user
- Listing all the drafts created by the current user with contextual links
for opening, editing, or submitting for approval
- Listing all the content pending for approval with contextual links for
opening, approving, or declining it
- Listing all the published content with contextual links for opening it
- Opening the Lotus Web Content Management main view

To develop this custom page, River Bend designers followed these steps:
1. They created a empty file, called
customLaunchPage.jsp , and placed it under the authoring portlet deployment
folder/jsp/html.
2. They edited the new JSP and added the following
sections:
Section 1: Page imports, common Java objects initialization and one
JavaScript function with which users can collapse and expand the page
sections.
<%@page import="com.ibm.workplace.wcm.api.*,
com.ibm.workplace.wcm.api.exceptions.*" %>
<% Repository repository = WCM_API.getRepository();
Workspace workspace = repository.getWorkspace(request.getUserPrincipal());
// Set current document Library
workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary("RiverBend
"));
%>
<script>
function display(id) {
status=document.getElementById(id).style.display;
if (status=="none") {
status=document.getElementById(id).style.display = "block";
} else {
status=document.getElementById(id).style.display = "none";
}
}
</script>
<h3>Select a task:</h3>
Section 2: Quick content creation form
First a JavaScript function is created to help compose direct action URLs for
content creation. Then an API call retrieve is available for authoring
templates for the current user to compose a select list with them.
<h4><a href="javascript:display('create')">Create
Content</a></h4>
<div id="create" style="display:block">
<script>
function createContent(){
atid=document.getElementById('atid').value;
contentName=document.getElementById('contentName').value;
document.location.href='?wcmAuthoringAction=new&type=com.ibm.workplace.wcm.a
pi.WCM_Content&atid='
+ atid + '&wcmfield.content.name=' + contentName;
}
</script>
Authoring template:
<select name="atid" id="atid">
<%
// Get all the authoring templates
DocumentIdIterator authoringTemplates =
workspace.findByType(DocumentTypes.AuthoringTemplate);
while (authoringTemplates.hasNext()){
DocumentId authId = (DocumentId) authoringTemplates.next();
out.println("<option value='" + authId.getId() +
"'>"+authId.getName()+"</option>");
}
%>
</select>
New item name: <input type="text"
name="contentName" id="contentName"/>
<input type="button" onClick="createContent()"
value="Create"/>
</div>
Section 3: My Drafts
An API call retrieves the workflow stage called “Draft” from the River Bend
library. This stage is used together with the current user name to perform a
search on all the library content where the user has the author role. Direct
actions are composed for open, edit, and approve.
<h4><a href="javascript:display('drafts')">My
Drafts</a></h4>
<div id="drafts" style="display:block">
<table >
<%
// Get draft workflow stage
DocumentIdIterator draftIt =
workspace.findByName(DocumentTypes.WorkflowStage,"Draft");
DocumentId draftSt = null;
if (draftIt.hasNext()){
draftSt = (DocumentId) draftIt.next();
}
if (draftIt!=null) {
// Get all the content in this stage
DocumentId[] arraySt=new DocumentId[1];
arraySt[0]=draftSt;
String[] arrayUsers=new String[1];
arrayUsers[0]=request.getUserPrincipal().getName();
DocumentIdIterator drafts =
workspace.findContentByWorkflowStage(arraySt,arrayUsers,Workspace.ROLE_AUTHOR);
boolean found=false;
while (drafts.hasNext()) {
found=true;
DocumentId draft = (DocumentId) drafts.next();
out.println("<tr>");
out.println("<td>" + draft.getName() +
"</td><td><a
href='?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_Content/&
quot; + draft.getId() + "'>Open</a></td>");
out.println("<td><a
href='?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Content/&
quot; + draft.getId() + "'>Edit</a></td>");
out.println("<td><a
href='?wcmAuthoringAction=approve&docid=com.ibm.workplace.wcm.api.WCM_Conten
t/" + draft.getId() + "'>Approve</a></td>");
out.println("</tr>");
}
if (!found) {
out.println("There are no drafts currently available");
}
}
%>
</table>
</div>
Section 4: Content pending for approval
The Content pending for approval section is built in the same way as Section
3. An additional workflow stage (approval) is added to the search query, and
the content is filtered by using ROLE_APPROVER.
<h4><a href="javascript:display('approval')">View Content
Requiring My Approval</a></h4>
<div id="approval" style="display:block">
<table >
<%
// Get approval workflow stage
DocumentIdIterator approvalIt =
workspace.findByName(DocumentTypes.WorkflowStage,"Approval");
DocumentId approvalSt=null;
if (approvalIt.hasNext()){
approvalSt = (DocumentId) approvalIt.next();
}
if (draftSt!=null && approvalSt!=null){
// Get all the content in this stage
DocumentId[] arraySt=new DocumentId[2];
arraySt[0]=draftSt;
arraySt[1]=approvalSt;
String[] arrayUsers=new String[1];
arrayUsers[0]=request.getUserPrincipal().getName();
DocumentIdIterator approvedDocs =
workspace.findContentByWorkflowStage(arraySt,arrayUsers,Workspace.ROLE_APPROVER)
;
boolean found=false;
while (approvedDocs.hasNext()) {
found=true;
DocumentId approved = (DocumentId) approvedDocs.next();
out.println("<tr>");
out.println("<td>" + approved.getName() +
"</td>");
out.println("<td><a
href='?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_Content/&
quot; +
approved.getId() + "'>Open</a></td>");
out.println("<td><a
href='?wcmAuthoringAction=approve&docid=com.ibm.workplace.wcm.api.WCM_Conten
t/" +
approved.getId() + "'>Approve</a></td>");
out.println("<td><a
href='?wcmAuthoringAction=decline&docid=com.ibm.workplace.wcm.api.WCM_Conten
t/" +
approved.getId() + "'>Decline</a></td>");
out.println("</tr>");
}
if (!found) {
out.println("There are no documents pending for approval");
}
} else {
out.println("Draft or Approval stages couldn't be found");
}
%>
</table>
</div>
Section 5: My Published content
The My published content section is built by using the same steps as in the
two previous examples.
<h4><a href="javascript:display('published')">My
Published Content</a></h4>
<div id="published" style="display:block">
<table >
<%
// Get published workflow stage
DocumentIdIterator publishedIt =
workspace.findByName(DocumentTypes.WorkflowStage,"Published");
if (publishedIt.hasNext()){
DocumentId publishedSt = (DocumentId) publishedIt.next();
// Get all the content in this stage
DocumentId[] arraySt=new DocumentId[1];
arraySt[0]=publishedSt;
String[] arrayUsers=new String[1];
arrayUsers[0]=request.getUserPrincipal().getName();
DocumentIdIterator publishedDocs =
workspace.findContentByWorkflowStage(arraySt,arrayUsers,Workspace.ROLE_AUTHOR);
boolean found=false;
while (publishedDocs.hasNext()) {
found=true;
DocumentId published = (DocumentId) publishedDocs.next();
out.println("<tr><td>" + published.getName() +
"</td><td><a
href='?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_Content/&
quot; + published.getId() +
"'>Open</a></td></tr>");
}
if (!found) {
out.println("There are no published documents");
}
}
%>
</table>
</div>
Section 6: Open main view
The Open main view section provides access to the default authoring user
portlet interface.
<h4><a href="?wcmAuthoringAction=openmainview">Open main
view</a></h4>
Custom content elements
A "custom JSP" field is available on some element types when added to an
authoring template. You can use this field to reference a JSP file to use
instead of the element's default view in the user interface.
You can write JSP to control the look and feel of an element and to restrict
the values that can be entered into an element. You can also write JSP to
create sophisticated UI components such as auto-completion boxes and pop-ups.
You can find a complete set of examples in the "Customizing elements using JSP"
topic in the WebSpherer Portal information center at the following address:
http://publib.boulder.ibm.com/infocenter/wpexpdoc/v6r1m0/topic/com.ibm.wp.exp.do
c/wcm/wcm_dev_custom_jsp.html
The JSP page must be stored in the WAR file directory for the Authoring
portlet, which is was_profile_root/installedApps/ cellname
/PA_WCM_Authoring_UI.ear/ilwwcm-authoring.war/jsp/html. In this directory name,
cellname is unique to your installation. The JSP page might also need to be
stored in the client WAR directory of the servlet or portlet that calls the
JSP, such as when using the authoring tool element, or if using the Lotus Web
Content Management API. For example, if displaying custom fields in content
that is opened by using the edit button on an authoring tool, you also need to
save the custom field JSP in the WAR file directory for the local rendering
portlet.
Rich-text editors
Web Content Management supports replacement of the out-of-the-box rich text
editor with many third-party editors. At a minimum, for an editor to work
within the Web content authoring portlet, it must support the setting and
getting of its current HTML value via JavaScript.
Refer to the "Examples of replacing the out of the box rich text editor in Web
Content Management" wiki article at the following address for specific
examples:
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/replacing-the-out-of-the-box-rich-
text-editor-in-web-content-management