Alfresco对象在Alfresco共享的扩展模块中不可用

编程入门 行业动态 更新时间:2024-10-25 02:24:17
本文介绍了Alfresco对象在Alfresco共享的扩展模块中不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用alfresco share扩展模块覆盖组件\node-details的javascript控制器node-header.js

I am trying to override the javascript controller node-header.js of components\node-details with the extension module of alfresco share

这是我的node- header.get.js

This is my node-header.get.js

<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(jsNode.hasAspect("custom:intranetFile")){ model.widgets[i].options.showFavourite = false; model.widgets[i].options.showLikes = false; } } } }

I出现此错误

错误消息:05270002无法执行脚本'classpath *:webscripts / custom / nodeheader / hidelikesync / node-header.get.js': 05270001 ReferenceError:未定义 Alfresco。 (jar:file:/ C:/Alfresco/Alfresco42/tomcat/webapps/share/WEB-INF/lib/customshare.jar!/webscripts/custom/nodeheader/hidelikesync/node-header.get.js# 1555)

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)

此行中存在错误

var jsNode = new Alfresco.util.Node(model.widgets[i].options.nodeRef);

由于Alfresco对象不可用,我该如何获取?

as Alfresco object is not available how can I get it?

推荐答案

基于我的share-extras-devel nofollow> answer 列表:

Based on my answer yesterday on the share-extras-devel list:

您的问题是您正在将Web脚本JS与客户端JavaScript混合使用。 Alfresco.util.Node 是客户端帮助程序类,因此可用于在网络浏览器中运行的客户端JS,但不适用于在以下位置运行的Web脚本代码

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.

如果您查看包含的 alfresco-util.js 的源代码,会看到那里有一个帮助器类,但它称为 AlfrescoUtil 。

If you look at the source of alfresco-util.js, which you are including, you will see that there is a helper class there but it is called AlfrescoUtil.

要获取有关此给定值的一些信息节点,我建议您使用该类的静态方法 AlfrescoUtil.getNodeDetails(),例如

To get some information on this given node I would suggest that you want to use the static method AlfrescoUtil.getNodeDetails() from that class, e.g.

var jsNode = AlfrescoUtil.getNodeDetails(model.widgets[i].options.nodeRef);

jsNode 对象的结构为根据doclist-v2网络脚本返回的JSON,因此您应该能够在 aspects array属性中检查自定义方面的存在。

The structure of the jsNode object will be as per the JSON returned by the doclist-v2 webscripts, so you should be able to check for the presence of your custom aspect in the aspects array property.

如果检查 alfresco-util.js 的来源,您会看到也支持其他参数getNodeDetails()。在我看来,您还可以输入可选的网站名称,如果需要的话,还可以添加一些选项。

If you check the source of alfresco-util.js you will see that additional parameters are also supported by getNodeDetails(). It seems to me you can also pass in an optional site name, plus some options if you wish.

更多推荐

Alfresco对象在Alfresco共享的扩展模块中不可用

本文发布于:2023-11-28 09:32:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641860.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   模块   对象   Alfresco

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!