我需要通过添加一个移动操作来定制Alfresco datalist操作。我在下面的教程中重点介绍了这一点:https://github.com/share-extras/sdk-sample-datalist-action。
步骤:
1-我通过向datagrid.get.config.xml文件添加以下行来覆盖该文件(位置: C:\Alfresco\tomcat\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\data-lists)
2-我将我的OnActionMoveTo实现添加到了位于C:\Alfresco\tomcat\webapps\share\components\data-lists中的actions.js和OnActionMoveTo -min.js文件中,下面是OnActionMoveTo的实现:
/**
* Move single document or folder.
*
* @method onActionMoveTo
* @param p_items {object} Object literal representing the file or folder to be actioned
*/
onActionMoveTo: function DataListActions_onActionMoveTo(pp_items)
{
var p_items = YAHOO.lang.isArray(pp_items) ? pp_items : [pp_items];
console.log(p_items);
this._copyMoveTo("move", p_items);
},
/**
* Copy/Move To implementation.
*
* @method _copyMoveTo
* @param mode {String} Operation mode: copy|move
* @param p_items {object} Object literal representing the file or folder to be actioned
* @private
*/
_copyMoveTo: function DataListActions__copyMoveTo(mode, p_items)
{
// Check mode is an allowed one
if (!mode in
{
copy: true,
move: true
})
{
throw new Error("'" + mode + "' is not a valid Copy/Move to mode.");
}
if (!this.modules.copyMoveTo)
{
this.modules.copyMoveTo = new Alfresco.module.DoclibCopyMoveTo(this.id + "-copyMoveTo");
}
var DLGF = Alfresco.module.DoclibGlobalFolder;
var allowedViewModes =
[
DLGF.VIEW_MODE_RECENT_SITES,
DLGF.VIEW_MODE_FAVOURITE_SITES,
DLGF.VIEW_MODE_SITE,
DLGF.VIEW_MODE_SHARED
];
if (this.options.repositoryBrowsing === true)
{
//this block is not executed (verified by a console.log)
allowedViewModes.push(DLGF.VIEW_MODE_REPOSITORY);
}
allowedViewModes.push(DLGF.VIEW_MODE_USERHOME)
var zIndex = 0;
if (this.fullscreen !== undefined && ( this.fullscreen.isWindowOnly || Dom.hasClass(this.id, 'alf-fullscreen')))
{
zIndex = 1000;
}
this.modules.copyMoveTo.setOptions(
{
allowedViewModes: allowedViewModes,
mode: mode,
siteId: this.options.siteId,
containerId: this.options.containerId,
path: this.currentPath, // this is printed as undefined in the console.log
files: p_items,
rootNode: this.options.rootNode, // this is printed as undefined in the console.log
parentId: this.getParentNodeRef(p_items), // this is printed as undefined in the console.log
zIndex: zIndex
}).showDialog();
},当我单击datalist中的move链接时,将执行函数(OnActionMoveTo),但它没有显示用于移动项目的文件夹选取器。当我记录该函数时,我发现了以下内容:
path: this.currentPath, // this is printed as undefined in the console.log
files: p_items,
rootNode: this.options.rootNode, // this is printed as undefined in the console.log
parentId: this.getParentNodeRef(p_items), // this is printed as undefined in the console.log有人能帮我解决这个问题吗?
发布于 2015-05-20 14:06:28
似乎还缺少几个组件。
如果您查看sample-action.js文件中的代码,您将注意到有一个对存储库webscript的调用,其中包含在repo端进行更改的实际逻辑,这在您的示例中是缺失的。检出此部件:
webscript:
{
method: Alfresco.util.Ajax.POST,
name: "duplicate/node/" + destinationNodeRef.uri
},用于在点击移动动作时显示弹出窗口的逻辑应该是客户端javascript的一部分。
https://stackoverflow.com/questions/29578330
复制相似问题