Wednesday, February 3, 2010

कस्तोमिसेद औथोरिंग टूल्स

Inline Editing

So now I have tested the inline editing jsp done by David De Vos.Simply brilliant!
Really offers you the ability to offer easier editing to content authors.

Attached Mr David De Vos's Code - Let me know if you have any hassles.

<%
%>
<%@page session="false" contentType="text/html" %>
<%@page import="com.ibm.workplace.wcm.api.*"%>
<%@page import="com.ibm.workplace.wcm.api.exceptions.*"%>
<%@taglib uri="/WEB-INF/tld/wcm.tld" prefix="wcm" %>

<%
// PURPOSE
// An example of a custom 'New' Authoring Tools link which allows the action to be targeted at
// a specific server as well as passing in the current site area and authoring template.
// In WCM 6.1, this JSP can be further customised to set the values of various fields, see
// the InfoCenter topic on Remote Actions for what is possible

// USAGE INSTRUCTIONS
// 1. Set the value of 's_authoringServerNameAndPort' to match the name and port of your authoring server
// NOTE: You will need to have single-sign working between the current server and the authoring otherwise the user
// will need to login
// 2. [Optional] Customise the HTML produced for the 'New' link on line 111
// 3. Add this JSP to the following locations on all authoring nodes and any rendering nodes that use Inline Editing
// \installedApps\WCM_Authoring_UI_1k9qukya.ear\1k9qukya.war\jsp\html
// \installedApps\WCM_Local_ng_Portlet_PA_dm010y1.ear\dm010y1.war\jsp\html
// \installedApps\\wcm.ear\ilwwcm.war\jsp\html (only required for servlet rendering)
// 4. Add a JSP Component that references this JSP
// 5. In your Authoring tools component, set the 'New action design' to a Component tag that references the library
// component created in step 4

// AUTHOR
// David de Vos
%>

<%!
// The name and port of your authoring server
String s_authoringServerNameAndPort = "[Auth server plus port ID]";
%>


<%
// Retrieve current users workspace
Workspace workspace = (Workspace) pageContext.getAttribute(Workspace.WCM_WORKSPACE_KEY);

// Retrieve the current Rendering Context
RenderingContext renderingContext = (RenderingContext) pageContext.getRequest().getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);

if ((workspace != null) && (renderingContext != null))
{
// Get current authoring template
DocumentId currentAuthoringTemplateId = null;
Content currentContent = renderingContext.getContent();
if (currentContent != null)
{
currentAuthoringTemplateId = currentContent.getAuthoringTemplateID();
}

// Get current site area
DocumentId currentSiteAreaId = null;
String fullPath = renderingContext.getPath();
if (fullPath != null)
{
String siteAreaPath = java.net.URLDecoder.decode(fullPath);
// If Content name is in path, then strip it out (won't be if current URL was to a site area)
if (currentContent != null)
{
int index = siteAreaPath.lastIndexOf(currentContent.getName());
if (index > 0)
{
siteAreaPath = siteAreaPath.substring(0, index-1);
}
}
DocumentIdIterator parentSiteAreaIdIterator = workspace.findByPath(siteAreaPath, Workspace.WORKFLOWSTATUS_PUBLISHED | Workspace.WORKFLOWSTATUS_EXPIRED);
if (parentSiteAreaIdIterator.hasNext())
{
currentSiteAreaId = parentSiteAreaIdIterator.nextId();
}
}

// Build 'New' link URL
StringBuffer newLinkURL = new StringBuffer();
newLinkURL.append("http://").append(s_authoringServerNameAndPort).append("/wps/wcmAuthoring");
newLinkURL.append("?wcmAuthoringAction=new&type=com.ibm.workplace.wcm.api.WCM_Content");
if (currentAuthoringTemplateId != null)
{
// Include the current authoring template if known
newLinkURL.append("&atid=").append(currentAuthoringTemplateId);
}
if (currentSiteAreaId != null)
{
// Include the current site area if known
newLinkURL.append("&pid=").append(currentSiteAreaId);
}

// Render the Link..
%>
New
<%
}
%>


Yours in Websphere

Jerome Slinger

2 comments:

  1. Do not see the code. Would love to check it out.

    Bill
    quantuminc1@yahoo.com

    ReplyDelete
  2. I see it now. Could not see it in IE but could in Firefox.

    ReplyDelete