Lui*_*hez 4 workflow alfresco alfresco-share
现在,出现一个消息框,其中包含失败的类名:
是否可以覆盖Alfresco中的默认行为?我们可以使用表单服务来呈现不同的消息吗?
除了zladuric答案,
你可以使用failureCallback方法来显示你想要的消息.但是很难为新的工作流形式搜索failureCallback方法,因为工作流形式如"开始工作流","任务编辑","任务详细信息"用于表单引擎.
例如,在" 开始工作流 "表单中,您可以添加我们自己的表单,successCallBack并在start-workflow.js中failureCallBack编写onBeforeFormRuntimeInit事件处理程序.
onBeforeFormRuntimeInit: function StartWorkflow_onBeforeFormRuntimeInit(layer, args)
{
var startWorkflowForm = Dom.get(this.generateId + "-form");
Event.addListener(startWorkflowForm, "submit", this._submitInvoked, this);
args[1].runtime.setAJAXSubmit(true,
{
successCallback:
{
fn: this.onFormSubmitSuccess,
scope: this
},
failureCallback:
{
fn: this.onFormSubmitFailure,
scope: this
}
});
}
onFormSubmitSuccess: function StartWorkflow_onFormSubmitSuccess(response)
{
this.navigateForward(true);
// Show your success message or do something.
}
onFormSubmitFailure: function StartWorkflow_onFormSubmitFailure(response)
{
var msgTitle = this.msg(this.options.failureMessageKey);
var msgBody = this.msg(this.options.failureMessageKey);
// example of showing processing response message
// you can write your own logic
if (response.json && response.json.message)
{
if(response.json.message.indexOf("ConcurrencyFailureException") != -1)
{
msgTitle = this.msg("message.concurrencyFailure");
msgBody = this.msg("message.startedAgain");
}
else
msgBody = response.json.message;
}
Alfresco.util.PopupManager.displayPrompt(
{
title: msgTitle,
text: msgBody
});
}
Run Code Online (Sandbox Code Playgroud)
因为Alfresco.component.StartWorkflow(在start-workflow.js中)扩展Alfresco.component.ShareFormManager(在alfresco.js中).您可以在start-workflow.js中覆盖onBeforeFormRuntimeInit事件.我希望你的帮助.