Re: [share-extras-devel] issue with share extension module development in alfresco 4.2 community

142 views
Skip to first unread message

Will Abson

unread,
Jun 27, 2013, 11:06:46 AM6/27/13
to share-ext...@googlegroups.com
Hi Mittal,

Firstly, I should point that this is not a general support forum for Share development, it is more specific to the Share Extras add-ons, so you may find that you get more help by posting on the Alfresco forums or on stackoverflow.

That said, your issue is that you are mixing up your web script JS with client-side JavaScript. Alfresco.util.Node is a client-side helper class and is therefore available to client-side JS running in the web browser, but not to your web script code which runs on the server.

If you are look at the source of alfresco-util.js, which you are including, you will see that there is a helper class there called AlfrescoUtil. I would suggest that you want to use the function AlfrescoUtil.getNodeDetails() from that class, but check the source to see which parameters are required. It seems to me you can pass in a nodeRef, plus an optional site name, plus some options if you wish.

Cheers,
Will


On 27 June 2013 13:06, mittal patoliya <mitpa...@gmail.com> wrote:
I have developed share-extension module to hide the "favorites" and "share" links which is displayed on the document detail page.My condition is when certain aspect is applied I want to hide those links.

For that I am trying to override the node-header.get.js file as that is the webscript responsible for rendering node-header
Now, I am not able to find out how to check certain aspect is applied on node or not.

Here is my code

<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">
for (var i=0; i<model.widgets.length; i++)
{
if (model.widgets[i].id == "NodeHeader")
{
if(model.widgets[i].options.nodeRef!=null)
{
var jsNode = new Alfresco.util.Node(model.widgets[i].options.nodeRef);
if(model.widgets[i].options.node.hasAspect("custom:testAspect")){
model.widgets[i].options.showFavourite = false;
model.widgets[i].options.showLikes = false;
}
}
}

}

But I am getting error as follow

Error Message: 05270002 Failed to execute script 'classpath*:webscripts/custom/nodeheader/hidelikesync/node-header.get.js': 05270001 ReferenceError: "Alfresco" is not defined. (jar:file:/C:/Alfresco/Alfresco42/tomcat/webapps/share/WEB-INF/lib/customshare.jar!/webscripts/custom/nodeheader/hidelikesync/node-header.get.js#1555)

--
You received this message because you are subscribed to the Google Groups "Share Extras Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to share-extras-de...@googlegroups.com.
To post to this group, send email to share-ext...@googlegroups.com.
Visit this group at http://groups.google.com/group/share-extras-devel.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

mittal patoliya

unread,
Jun 29, 2013, 1:29:41 PM6/29/13
to share-ext...@googlegroups.com
Ohh Yes,
Will Apologies, Actually It was intended for the Alfresco Technical Discussion group.
Its just bit of urgent so I had posted it here along with forums and,stackoverflow 

Mittal
To unsubscribe from this group and stop receiving emails from it, send an email to share-extras-devel+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages