Quantcast
Channel: Alfresco Forums - Web Scripts
Viewing all 105 articles
Browse latest View live

Problem of sending email within try block

$
0
0

I wrote a javascript to invoke after a document is created in a folder (through the rule). In this script, I tried to send an email.
I put "mail.execute(document)" in the try block, so that it can catch the exception when sending an email (like connection issue to SMTP server, or email address error etc).

After an error happens when sending the mail, the catch statements get hit as expected. However looks like the script still returns error so that I got the error message of "Exception from executeScript - redirecting to status template error: Transaction silently rolled back because it has been marked as rollback-only". The document is still created after this error message though.

On the other hand, if I inject some other exception (such as null object access) into the try block, the exception is catched and no error message returned when creating a document.

What's the problem in catching the excepting when sending the mail?

The javascript code is like below (I removed some unrelated codes)

var mail = actions.create("mail");

mail.parameters.html = "html";

mail.parameters.to = "b@example.com";

mail.parameters.template = search.findNode("workspace://SpacesStore/87d845a1-1639-4de8-b14a-b7c0add7d559");
mail.parameters.subject = "Title";
mail.parameters.from = "a@example.com";

try
{
mail.execute(document); // if comment this line but un-comment next two lines, the exception can be catch
// and every thing fine after the script completes.
//var a=null;
//a.set("abc");
logger.warn ("Email sent.");
} catch (err)
{
logger.warn ("Mail sent failed. Errormsg: " + err.message);
}


Problems on StartUP

$
0
0

Hi guys, i got some problems on startUp Alfresco, i got this:

Aug 27, 2015 5:00:25 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'onPremiseSyncPullTrigger' defined in file [/usr/local/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/enterprise/sync-service-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'enabled' of bean class [org.alfresco.util.CronTriggerBean]: Bean property 'enabled' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'enabled' of bean class [org.alfresco.util.CronTriggerBean]: Bean property 'enabled' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
... 38 more

This bean 'onPremiseSyncPullTrigger' is not in my solution, anyone knows this cause ?

Thank you guys!

Obtain a file through webscript

$
0
0

Hi all

I have created a webscript in the Web Script Extensions in my alfresco 3.0 community, so introducing the login, password and the node ref of the document, the web script should return the document in a pop up window of the browser

the code of my script is

var scontent="@\\{http\\://www.alfresco.org/model/content/1.0\\}content.mimetype:application/pdf + ";var qnodeid="@sys\\:node-uuid:"+args.nId;var strq=scontent+qnodeid; 
var content=search.luceneSearch(strq); 
 
// Mostrar error al no encontrar el ficheroif(content.length!=1){
   status.code=404;
   status.message="File not found.";
   status.redirect=true;}
model.fichero= content[0];
model.ticket= session.getTicket();//model.nFact = args.nFact;//model.cPro = args.cPro;
model.nId= args.nId;
model.strq= strq;

It uses to work fine, but today we have realized that for some documents that exists in the repository with node ref the webscript returns the 404 error message. Even making sure that the noderef id of the document we include in the url call it is fine and it is the one that is stored in Alfresco, the webscript returns this error.

Any ideas why please?

Thanks a lot!!

3.0

If this post was helpful, please click Yes on the Post Rating -->

custom webscript giving 500 Internal Error

$
0
0

Hi,

I am integrating my application with alfresco using external authentication. now there is a need for adding logged in user to a group in alfresco and for that i have written webscript as below:

AddUserToGroup.get.desc.xml

<webscript>
 
 
 
<shortname>AddUserToGroup</shortname>
 
 
 
<description>AddUserToGroup</description>
 
 
 
<url>/auth/AddUserToGroup/{user}</url>
 
 
 
<format default="html">argument</format>
 
 
 
<authentication>user</authentication>
 
 
 
<transaction>none</transaction>
 
 
 
</webscript>

AddUserToGroup.get.js

var paramvalue=url.extension;var user = people.getPerson(paramvalue); 
 
 
var group = people.getGroup("GROUP_test"); 
 
 
 
 
 
 
if(user ==undefined) 
 
 
{ 
 
 
	status.code=404; 
 
 
	status.message="User not found"; 
 
 
	status.redirect=true; 
 
 
} 
 
 
elseif(group ==undefined) 
 
 
{ 
 
 
	status.code=404; 
 
 
	status.message="Group not found"; 
 
 
	status.redirect=true; 
 
 
} 
 
 
else 
 
 
{ 
 
 
	people.addAuthority(group,user); 
 
 
}

AddUserToGroup.get.html.ftl

<html>
 
 
 
<head>
 
 
 
<title>Groups</title>
 
 
 
</head>
 
 
 
<body>
 
 
 
User assigned to group
 
 
 
</body>
 
 
 
</html>

I am accessing the above webscript as
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://localhost:8080/alfresco/wcservice/auth/AddUserToGroup/test");
method.setRequestHeader("SSO_Remote_User", test);

int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
System.out.println(statusCode);
return;
}
}

but this is giving me error as 500 - Internal Error
Access Denied. You do not have the appropriate permissions to perform this operation.

I have set authentication = user then it is giving me access denied exception.

Please help me with this.

Regards,
Nancy

WebSockets

$
0
0

Hi,
I'm researching possibility of implementing client notifications for Alfresco. I've already found working implementation of Server Sent Events. It's simple and i like it, but there is one problem: Internet Explorer doesn't support SSE. And IE support is our business requirement. So i started digging about integrating Websockets with Alfresco Web Scripts and found literally nothing. Is it possible to use Websockets with Web Scripts without making some really bad architectural decisions? Thanks.

widgetUtils

$
0
0

I am using widget Utils in 5.0.d to reach rows in a list (preloaded by setting currentData) and change visibility using alfVisible(). I have seen many examples, specifically widgetUtils.findObject(model.jsonModel.widgets... ,"id","SUBCAT_ROW" ); The list should have many rows with this id and I need to examine fields to determine if the row should be visible or not. I think I am looking for an array of widgets to be returned from widgetUtils.find... but I can't seem to find documentation for widgetUtils anywhere, only a wide range of examples. It may help to know that the specific case is: If a checkbox is cleared, only rows with chidren[1..nchildren-1] that have at least one cell with an entry are to be visible. I looked at rules but could not see how to use them in this case.

5.0.d

calling custom webscript giving 404 error

$
0
0

Hi,

I have written one custom webscript which sets the permission on a folder and i am calling this webscript in my java class on a folder on which i have to set permission giving me 404 error. But that folder is there in repository.

Can anyone help me what is the error?

Thanks
Nancy

Creating a site dashboard

$
0
0

I've created a web-script module extension and have verified that it works correctly. What it does is takes the dashboard.xml and related page.component-X-Y.type~id~dashboard.xml files from one site, deletes all dashboard related files on another site then copies the source files to the new site that had them deleted.

pseudo-code

var siteDashboard = getDashboard("site1-shortname");
var siteDashboard = renameShortNames("site1-shortname","short2-shortname");
 
deleteDashboard("site2-shortname");
createDashboard("site2-shortname", siteDashboard);

renameShortNames just renames the site id inside the dashboard files to the new site's id.

This all works, I've tested and verified it. My problem is that when I go to http://alfrescosite.com/alfresco/s/remoteadm/get/s/sitestore/alfresco/site-data/pages/site/site2-shortname/dashboard.xml it shows me the new dashboard layout from site1-shortname which is the correct behavior but when I go to the actual site's dashboard within Alfresco share it shows the old site2-shortname dashboard. The only way I can get the new dashboard to show is by restarting the Alfresco/Tomcat service. I've even tried looking at the dashboard with a different browser just in case it was a local caching issue but it's not.

Any ideas on how to make the dashboards refresh to the new layout without having to restart the Alfresco/Tomcat service every time?

5.0.d

Problems on StartUP

$
0
0

Hi guys, i got some problems on startUp Alfresco, i got this:

Aug 27, 2015 5:00:25 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'onPremiseSyncPullTrigger' defined in file [/usr/local/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/enterprise/sync-service-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'enabled' of bean class [org.alfresco.util.CronTriggerBean]: Bean property 'enabled' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'enabled' of bean class [org.alfresco.util.CronTriggerBean]: Bean property 'enabled' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
... 38 more

This bean 'onPremiseSyncPullTrigger' is not in my solution, anyone knows this cause ?

Thank you guys!

Obtain a file through webscript

$
0
0

Hi all

I have created a webscript in the Web Script Extensions in my alfresco 3.0 community, so introducing the login, password and the node ref of the document, the web script should return the document in a pop up window of the browser

the code of my script is

var scontent="@\\{http\\://www.alfresco.org/model/content/1.0\\}content.mimetype:application/pdf + ";var qnodeid="@sys\\:node-uuid:"+args.nId;var strq=scontent+qnodeid; var content=search.luceneSearch(strq);  // Mostrar error al no encontrar el ficheroif(content.length!=1){
   status.code=404;
   status.message="File not found.";
   status.redirect=true;}
model.fichero= content[0];
model.ticket= session.getTicket();//model.nFact = args.nFact;//model.cPro = args.cPro;
model.nId= args.nId;
model.strq= strq;

It uses to work fine, but today we have realized that for some documents that exists in the repository with node ref the webscript returns the 404 error message. Even making sure that the noderef id of the document we include in the url call it is fine and it is the one that is stored in Alfresco, the webscript returns this error.

Any ideas why please?

Thanks a lot!!

3.0

If this post was helpful, please click Yes on the Post Rating -->

custom webscript giving 500 Internal Error

$
0
0

Hi,

I am integrating my application with alfresco using external authentication. now there is a need for adding logged in user to a group in alfresco and for that i have written webscript as below:

AddUserToGroup.get.desc.xml

<webscript>
 
 
 
<shortname>AddUserToGroup</shortname>
 
 
 
<description>AddUserToGroup</description>
 
 
 
<url>/auth/AddUserToGroup/{user}</url>
 
 
 
<format default="html">argument</format>
 
 
 
<authentication>user</authentication>
 
 
 
<transaction>none</transaction>
 
 
 
</webscript>

AddUserToGroup.get.js

var paramvalue=url.extension;var user = people.getPerson(paramvalue);   var group = people.getGroup("GROUP_test");       if(user ==undefined)   {   
	status.code=404;   
	status.message="User not found";   
	status.redirect=true;   }   elseif(group ==undefined)   {   
	status.code=404;   
	status.message="Group not found";   
	status.redirect=true;   }   else   {   
	people.addAuthority(group,user);   }

AddUserToGroup.get.html.ftl

<html>
 
 
 
<head>
 
 
 
<title>Groups</title>
 
 
 
</head>
 
 
 
<body>
 
 
 
User assigned to group
 
 
 
</body>
 
 
 
</html>

I am accessing the above webscript as
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://localhost:8080/alfresco/wcservice/auth/AddUserToGroup/test");
method.setRequestHeader("SSO_Remote_User", test);

int statusCode = client.executeMethod(method);

if (statusCode != HttpStatus.SC_OK) {
System.out.println(statusCode);
return;
}
}

but this is giving me error as 500 - Internal Error
Access Denied. You do not have the appropriate permissions to perform this operation.

I have set authentication = user then it is giving me access denied exception.

Please help me with this.

Regards,
Nancy

WebSockets

$
0
0

Hi,
I'm researching possibility of implementing client notifications for Alfresco. I've already found working implementation of Server Sent Events. It's simple and i like it, but there is one problem: Internet Explorer doesn't support SSE. And IE support is our business requirement. So i started digging about integrating Websockets with Alfresco Web Scripts and found literally nothing. Is it possible to use Websockets with Web Scripts without making some really bad architectural decisions? Thanks.

widgetUtils

$
0
0

I am using widget Utils in 5.0.d to reach rows in a list (preloaded by setting currentData) and change visibility using alfVisible(). I have seen many examples, specifically widgetUtils.findObject(model.jsonModel.widgets... ,"id","SUBCAT_ROW" ); The list should have many rows with this id and I need to examine fields to determine if the row should be visible or not. I think I am looking for an array of widgets to be returned from widgetUtils.find... but I can't seem to find documentation for widgetUtils anywhere, only a wide range of examples. It may help to know that the specific case is: If a checkbox is cleared, only rows with chidren[1..nchildren-1] that have at least one cell with an entry are to be visible. I looked at rules but could not see how to use them in this case.

5.0.d

calling custom webscript giving 404 error

$
0
0

Hi,

I have written one custom webscript which sets the permission on a folder and i am calling this webscript in my java class on a folder on which i have to set permission giving me 404 error. But that folder is there in repository.

Can anyone help me what is the error?

Thanks
Nancy

Creating a site dashboard

$
0
0

I've created a web-script module extension and have verified that it works correctly. What it does is takes the dashboard.xml and related page.component-X-Y.type~id~dashboard.xml files from one site, deletes all dashboard related files on another site then copies the source files to the new site that had them deleted.

pseudo-code

var siteDashboard = getDashboard("site1-shortname");
var siteDashboard = renameShortNames("site1-shortname","short2-shortname");
 
deleteDashboard("site2-shortname");
createDashboard("site2-shortname", siteDashboard);

renameShortNames just renames the site id inside the dashboard files to the new site's id.

This all works, I've tested and verified it. My problem is that when I go to http://alfrescosite.com/alfresco/s/remoteadm/get/s/sitestore/alfresco/site-data/pages/site/site2-shortname/dashboard.xml it shows me the new dashboard layout from site1-shortname which is the correct behavior but when I go to the actual site's dashboard within Alfresco share it shows the old site2-shortname dashboard. The only way I can get the new dashboard to show is by restarting the Alfresco/Tomcat service. I've even tried looking at the dashboard with a different browser just in case it was a local caching issue but it's not.

Any ideas on how to make the dashboards refresh to the new layout without having to restart the Alfresco/Tomcat service every time?

5.0.d

Loss of properties on upload

$
0
0

Hi,
Have created a form to upload a document similar to tutorial in wiki using Community 5.0.1.d.

When I modify the destination for the uploaded form from the default of companyhome, the document loses the properties of title and description:

TUTORIAL // create document in company home from uploaded file
upload = companyhome.createFile(file.filename) ;
upload.properties.content.guessMimetype(file.filename);
upload.properties.content.write(file.content);
upload.properties.title = title;
upload.properties.description = description;
upload.save();
// setup model for response template
model.upload = upload;

MY VERSION // create document in company home from uploaded file
upload = companyhome.childByNamePath("/Guest Home/Supplier Assessments (BO-13)").createFile(file.filename) ;
upload.properties.title = title;
upload.properties.description = description;
upload.properties.content.guessMimetype(file.filename);
upload.properties.content.write(file.content);
upload.save();
// setup model for response template
model.upload = upload;

Using the .childByNamePath command gets the file uploaded tothe proper destination in share, but the document does not retain the above two properties.

Can anyone explain this and offer a workaround?

Thank you in advance,
Frank

5.0.d

create new groups and then add subgroups into it

$
0
0

Hi,

I want to create new groups and then add subgroups into it . Is there any existing javascript running which i can extend and write my code to create groups. I want this functionality to run automatically ie under some already existing java scripts. Please help to accomplish this task.

regards

Raghav Bhardwaj

5.0.d

Welcome to the Alfresco Web Scripts forum

$
0
0

Welcome to the Alfresco Web Scripts forum

This forum is dedicated to topics relating to Web Scripts in Alfresco. The development of new Web Scripts, the APIs related to them and example Web Scripts can all be discussed and posted here.

Your first stop for documentation is here:
http://wiki.alfresco.com/wiki/Web_Scripts

The JavaScript and FreeMarker API docs are here:
http://wiki.alfresco.com/wiki/JavaScript_API
http://wiki.alfresco.com/wiki/Template_Guide

Thanks!

Kevin

UI Team Manager and Technical Lead
http://twitter.com/kevinroast - Find me on Twitter!
http://wiki.alfresco.com - Alfresco Wiki docs and Community downloads
http://www.kevs3d.co.uk/dev - My personal HTML5 projects

How to use the existing comment web scripts to post?

$
0
0

Hello,

I have a problem to understand how to use especially the POST Web script (because of the use of comment.lib.js)
I need to understand how it works to implement a Aikau service which allows users to add comments everithings from a dialog form.

I am inspired by https://github.com/Alfresco/Aikau/blob/master/tutorial/chapters/Tutorial7.md

In comparison with the POST web script of groups :
1 - github) url : /api/rootgroups/{shortName}
1 - me) url : /api/node/{store_type}/{store_id}/{id}/comments (I have not seen an other comment webscript to POST a comment)

2 - github) in the model we can see displayName = json.get("displayName") and model.group= groups.createRootGroup(shortName, displayName);
2 - me) the model send us to comment.lib.js , so I gone on C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\repository\comments\comment.lib.ftl, but I seen nothing about adding or updating comments!!!

3 - github) in the custom service we have to write something like :

this.serviceXhr({
url: AlfConstants.PROXY_URI+"api/rootgroups/"+ payload.shortName,
method:"POST",
data:{
displayName: payload.displayName
}
});

3 - me) i am not here ><

Thank you for future help!

5.0.d

Access Node History Content

$
0
0

Hi All,

I am writing a web-script where I need to copy content from node history and make new version from it.

For example I have node which has version history as 1, 1.1, 1.2, 2.0, 2.1. Now I want to create new version 3.0 using content of version 1.0. I tried using versionHistory but after update when i see content in share it shows as undefined. Below is the code snippet which I am using, please provide your valuable suggestion.

var resultNode = search.findNode("workspace://SpacesStore/"+"6e5dabc3-fe8a-4c5e-b470-5c2484720e45");
var versionHistory = resultNode.versionHistory;
var majorVersion =1.0;
var sourceVersion;
for(i =0; i < versionHistory.length; i++){
var version = versionHistory[i];
if(version.label== majorVersion){
sourceVersion = version;
break;
}
}
var historyNode = search.findNode(sourceVersion.nodeRef);
var workingCopy = resultNode.checkout();
workingCopy.content= sourceVersion.content;
workingCopy.checkin("Major Version",true);

Let me know if you want me to add more information here.

5.0

Viewing all 105 articles
Browse latest View live