我需要通过添加移动操作来自定义Alfresco datalist操作。我专注于以下tutoriel来实现这一点:
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-I我将OnActionMoveTo实现添加到位于C:\ Alfresco \ tomcat \ webapps \ share \ components \ data-lists中的文件actions.js和actions-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中的移动链接时,会执行函数(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
有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
似乎仍然缺少一些组件。
如果您查看sample-action.js文件中的代码,您会注意到存储库webscript的调用将包含在repo端进行更改的实际逻辑,这在您的情况下是缺失的。 查看此部分:
webscript:
{
method: Alfresco.util.Ajax.POST,
name: "duplicate/node/" + destinationNodeRef.uri
},
单击移动操作时显示弹出窗口的逻辑应该是客户端javascript的一部分。