我做了一个定制动作。我可以在纪录片库中看到这个动作,但我无法在分面搜索结果页面上看到它。
<action id="custom-action" type="javascript" label="actions.custom.action">
<param name="function">onCustomActionlick</param>
</action>所以我进入了aikau-1.0.8.1.jar\META-INF\js\aikau\1.0.8.1\alfresco\renderers\_ActionsMixin.js文件。
我看到我们做了一个测试,以确定这个文件中是否允许操作:
if (this.filterActions === false || AlfArray.arrayContains(this.allowedActions, action.id))在firebug中,我看到我的see操作不在allowedActions对象中。我的问题是为什么?
我认为所有用户都可以在没有权限的情况下进行操作。我说得对吗?
我能做些什么来让这个动作在分面搜索结果页面上显示出来?
提前谢谢你。
发布于 2015-09-13 07:40:22
您需要编写一个扩展模块,如下所述:https://forums.alfresco.com/comment/159331#comment-159331。
在MERGED_ACTIONS代码中,您需要获取JavaScript的小部件id,并将customAction添加到allowdActions数组中,并在CustomActions中定义它。
这是Aikau代码的链接,可能它已经更新了更新的Alfresco版本。因此,您需要在扩展模块中扩展它。您可能只需在模块中使用org\alfresco\share\pages\faceted-search作为您的<sourcePackageRoot>。
widgets: [{
id: "MERGED_ACTIONS",
name: "alfresco/renderers/Actions",
config: {
filterActions: true,
mergeActions: true,
allowedActions: ["folder-manage-rules", "folder-download", "folder-view-details", "CUSTOM3"],
customActions: [{
id: "CUSTOM3",
label: "Custom Action 3",
icon: "document-delete",
index: "10",
publishTopic: "DELETE_ACTION_TOPIC",
type: "javascript"
}],
widgetsForActions: [{
name: "alfresco/renderers/actions/ManageAspects"
}]
}
}]发布于 2016-03-07 13:58:47
文档库(至少到Al新鲜is共享5.1之前)是用YUI构建的,而搜索页面是使用Aikau构建的。在编写本报告时,搜索页面和文档库之间还没有对等的操作处理,添加操作的过程非常不同。
为了让您的自定义操作在分面搜索页面中显示,您需要做几件事:
发布于 2016-06-28 07:53:19
我从我们的最新博客中套用了我们已经使用过的方法。
我们的用例是,我们使用标准配置xml在文档库视图中使用了现有的操作,我们不想重新创建。
第一步是创建共享扩展模块,在web-extensions/site-data/extensions/example.xml中添加Javascript控制器
<extension>
<modules>
<module>
<id>Example Service</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.share.pages.faceted-search</targetPackageRoot>
<sourcePackageRoot>com.parashift.example</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>这将加载一些额外的javascript,允许您调整小部件配置。
在web-extension/site-webscripts/com/parashift/example/faceted-search.get.js中创建一个文件(或在sourcePackageRoot中使用的任何包名),添加一个名为faceted-search.get.js的文件,其内容如下:
var searchResultPage = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_SEARCH_RESULT");
if(searchResultPage != null) {
searchResultPage.config = {
enableContextMenu : false,
mergeActions : true,
additionalDocumentAndFolderActions : ["example-action"]
}
}
model.jsonModel.widgets.push({
id: "EXAMPLE_LISTENER",
name: "parashift/action/example"
});这将:
example-action添加到搜索结果中的操作列表中。这应该已经是在某些共享-config.xml文件中配置的操作。为侦听器小部件添加一个文件:META-INF/parashift/action/example.js
define(["dojo/_base/declare",
"dijit/_WidgetBase",
"alfresco/core/Core"
],
function(declare, _Widget, Core) {
return declare([_Widget, Core], {
postCreate: function () {
this.alfSubscribe("ALF_SINGLE_DOCUMENT_ACTION_REQUEST", lang.hitch(this, this._onPayloadReceive));
},
_onPayloadReceive: function (payload) {
if(payload.action.id == "example-action") {
this.alfLog("log", "Received action, handling accordingly");
.......
}
}
});
});此代码将侦听ALF_SINGLE_DOCUMENT_ACTION_REQUEST并执行_onPayloadReceive函数。在这个函数中,我们过滤到example-action并执行任何自定义代码。
payload变量将包括document和action对象。使用Debug日志记录,您可以看到它们的形状。
这大致相当于旧的YUI方法:
YAHOO.Bubbling.fire("registerAction", {
actionName: "onExampleAction",
fn: function(file) {
console.log("Received action, handling accordingly");
....
}
});https://stackoverflow.com/questions/32455151
复制相似问题