Hi,
We have a requirement to use TinyMCE Widget in place of Edit LIve Widget .
Is there a programmatic way to achieve this? Can someone suggest something.
Regards,
Neha
Why do you want programmatic approach? Are there many CTDs with Edit live?
Since, you need to modify the CTDs only, it is good idea to change the CTDs manually rather doing programmatically.
Lokesh
From: eLink Entry: Discussion Group - Web Experience Management [mailto:v7webcontentmanagement@elinkkc.opentext.com]Sent: Wednesday, August 13, 2014 6:14 PMTo: eLink RecipientSubject: How to Update all CTD's to use TinyMCE Widget in place of Edit Live
How to Update all CTD's to use TinyMCE Widget in place of Edit Live
Posted byneha4.c@tcs.com (Chaturvedi, Neha) On 08/13/2014 08:39 AM
[To post a comment, use the normal reply function]
Forum:
Discussion Group - Web Experience Management
Content Server:
Knowledge Center
Yes, there are about 35 CTD's , That is why I was thinking to achieve this programmatically
I assume that you can execute some code against the VCM from within your IDE.
The class looks like this
public class MCEWidgetSetter {
//Set here the name of the content type containing the TinyMCE widget whyich you use as a template
static String templateContentTypeName = "myCT";
//Set here the name of the attribute of the above CTD containing the TinyMCE widget which you use as a template for replacement.
static String templateAttributeName = "myAttribute";
public static void main(String[] args) throws Throwable {
ContentType templateContentType = (ContentType)ContentType.findByName(templateContentTypeName);
if(templateContentType != null) {
AttributeDefinitionData templateAdd = templateContentType.getData().getAttributeDefinition(templateAttributeName);
if(templateAdd != null) {
String widgetName = templateAdd.getWidgetName();
String tinyMCEWidgetName = WCMTinyMCEWidget.class.getSimpleName();
if(widgetName.equals(tinyMCEWidgetName)) {
String tinyMCEWidgetData = templateAdd.getWidgetData();
IPagingList ipl = ContentType.findAll();
List<ContentType> ctList= ipl.asList();
for(ContentType ct: ctList) {
System.out.println("Processing content type " + ct.getName());
AttributeDefinitionData[] addArray = ct.getData().getAllAttributeDefinitions();
for(AttributeDefinitionData add: addArray) {
boolean doCommit = false;
if(add.getWidgetName().equals(WCMEditLiveWidget.class.getSimpleName())) {
System.out.println("Setting TinyMCE widget for attribute " + add.getName());
add.setWidgetName(tinyMCEWidgetName);
add.setWidgetData(tinyMCEWidgetData);
doCommit = true;
}
if(doCommit) {
ct.commit();
System.out.println("Saved changes for content type " + ct.getData().getName());
} else {
System.out.println("The attribute " + templateAdd.getName() + " doesn't contain a TinyMCE widget.");
Be aware that unless I haven’t tested it,this code should work. If it doesn’t I will not be responsible for anything, nor I engage in any commitment for assisting you until you are satisfied.
What you might wish to do is to launch it once commenting out the //ct.commit().
Then by looking at the log you can see which changes will be done and if you want to skip some CTS it is enough that you add “if” condition on the ct while processing…
Ciao
Mario
Sorry, there is a mistake in my previous code. Please use this
From: eLink Entry: Discussion Group - Web Experience Management [mailto:v7webcontentmanagement@elinkkc.opentext.com] Sent: giovedì 14 agosto 2014 15:12To: eLink RecipientSubject: RE RE How to Update all CTD's to use TinyMCE Widget in place of Edit Live
RE RE How to Update all CTD's to use TinyMCE Widget in place of Edit Live
Posted bymdanna@opentext.com (D'Anna, Mario) On 08/14/2014 09:10 AM
Topic:
hey Thanks for the code, but as I am new to this, I cant figure out how do i run this from my IDE.
I came across few posts regarding loging in to the VCM server, so that I am able to do, but accesing the repository is an issue, can you help guid me how do i configure my IDE (sts 3.2.0) to be able to run this code .
Or point me to a KB in your knowledge.
Would really appreciate your help! Thanks
Also which jar contains "WCMTinyMCEWidget" etc.?
For now I am running this code against my preview server(outside any template context), and facing the below error on trying to commit my changes to the CTD
I am using LoginMgr as a way to authenticate against the VCM, but as it seems this is not enough to get the authorizationOps object for that CTD. Any thought?
Root cause of ServletException. com.vignette.as.client.exception.AuthorizationException: 08/21/2014 07:34:58:395, Error 9 (CreateError), Message 026-130-0002: Error in retrieving Authorization Ops Object. at com.vignette.as.server.pluggable.AuthzImpl.isAuthorized(AuthzImpl.java:221) at com.vignette.as.server.logic.auth.AuthorizationOpsLogic.isAuthorized(AuthorizationOpsLogic.java:256) at com.vignette.as.server.logic.common.AuthorizationHelper.verifyAuthorization(AuthorizationHelper.java:354) at com.vignette.as.server.logic.common.AuthorizationHelper.verifyAuthorization(AuthorizationHelper.java:314) at com.vignette.as.server.logic.cm.ContentTypeOpsLogic.commit(ContentTypeOpsLogic.java:230) at com.vignette.as.client.javabean.ManagedObject.commitImpl(ManagedObject.java:1447) at com.vignette.as.client.javabean.ManagedObject.commit(ManagedObject.java:1400) at com.vignette.as.client.javabean.ObjectType.commit(ObjectType.java:587) at jsp_servlet._common.__hello._jspService(__hello.java:191) at weblogic.servlet.jsp.JspBase.service(JspBase.java:34) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3363) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
eLink : How to Update all CTD's to use TinyMCE Widget in place of Edit Live 2How to Update all CTD's to use TinyMCE Widget in place of Edit Live 2 Posted by neha4.c@tcs.com (Chaturvedi, Neha) On 08/21/2014 08:43 AM For now I am running this code against my preview server(outside any template context), and facing the below error on trying to commit my changes to the CTDI am using LoginMgr as a way to authenticate against the VCM, but as it seems this is not enough to get the authorizationOps object for that CTD. Any thought? Root cause of ServletException.com.vignette.as.client.exception.AuthorizationException: 08/21/2014 07:34:58:395, Error 9 (CreateError), Message 026-130-0002: Error in retrieving Authorization Ops Object. at com.vignette.as.server.pluggable.AuthzImpl.isAuthorized(AuthzImpl.java:221) at com.vignette.as.server.logic.auth.AuthorizationOpsLogic.isAuthorized(AuthorizationOpsLogic.java:256) at com.vignette.as.server.logic.common.AuthorizationHelper.verifyAuthorization(AuthorizationHelper.java:354) at com.vignette.as.server.logic.common.AuthorizationHelper.verifyAuthorization(AuthorizationHelper.java:314) at com.vignette.as.server.logic.cm.ContentTypeOpsLogic.commit(ContentTypeOpsLogic.java:230) at com.vignette.as.client.javabean.ManagedObject.commitImpl(ManagedObject.java:1447) at com.vignette.as.client.javabean.ManagedObject.commit(ManagedObject.java:1400) at com.vignette.as.client.javabean.ObjectType.commit(ObjectType.java:587) at jsp_servlet._common.__hello._jspService(__hello.java:191) at weblogic.servlet.jsp.JspBase.service(JspBase.java:34) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3363) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) at weblogic.work.ExecuteThread.run(ExecuteThread.java:254) [To post a comment, use the normal reply function]Topic: How to Update all CTD's to use TinyMCE Widget in place of Edit LiveForum: Discussion Group - Web Experience ManagementContent Server: Knowledge Center
Yes, I have started changing them by hand, but I still need guidance on how to do it programmatically.
Can you help? Point me to a KB or list down the majore steps for that.
Plss.