我想从Alfresco网站上的网站链接小面板启动工作流程。使用Firebug检查POST会给我一个有效的URL,但它只显示没有任何UI的表单:
http://localhost:8081/share/service/components/form?htmlid=template_x002e_start-workflow_x002e_start-workflow_x0023_default-startWorkflowForm-alf-id1&itemKind=workflow&itemId=activiti%24orpWorkflow&mode=create&submitType=json&showCaption=true&formUI=true&showCancelButton=true&destination=
答案 0 :(得分:2)
当您从下拉列表中选择工作流程时,它将根据所选工作流程生成网址并将您重定向到该工作流程。
实施例。对于ParallelGroupReview工作流URL是。
http://localhost:8080/share/service/components/form?htmlid=template_x002e_start-workflow_x002e_start-workflow_x0023_default-startWorkflowForm-alf-id1&itemKind=workflow&itemId=activiti%24activitiParallelGroupReview&mode=create&submitType=json&showCaption=true&formUI=true&showCancelButton=true&destination=
现在,如果您直接在浏览器中使用此URL,您将能够看到相同的表单,但页眉和页脚部分将丢失,因为这些全局组件将无法在共享上下文之外使用。
如果你看到start-workflow.ftl,你将能够看到插入的页眉和页脚组件,它们负责UI的其余部分。
<#include "include/alfresco-template.ftl" />
<@templateHeader />
<@templateBody>
<@markup id="alf-hd">
<div id="alf-hd">
<@region scope="global" id="share-header" chromeless="true"/>
</div>
</@>
<@markup id="bd">
<div id="bd">
<div class="share-form">
<@region id="start-workflow" scope="template"/>
</div>
</div>
</@>
</@>
<@templateFooter>
<@markup id="al-ft">
<div id="alf-ft">
<@region id="footer" scope="global"/>
</div>
</@>
</@>
您可以重复使用相同的组件,以确保正确初始化页眉和页脚。
答案 1 :(得分:2)
我创建了一个扩展模块,它具有以下目标:
<targetPackageRoot>org.alfresco.components.workflow</targetPackageRoot>
我在扩展 start-workflow.get.html.ftl 中添加了以下内容:
<@markup id="start-workflow-js" target="js" action="after">
<@script src="${url.context}/res/components/workflow/initiate-workflow.js" group="workflow"/>
</@>
扩展我自己的默认 start-workflow.js 。
您需要更改以下方法:
答案 2 :(得分:1)
您可以为Share进行一些自定义。
例如,如果您需要打开任何业务流程的开始表单,可以在弹出窗口中找到其索引,并在URL中添加一个附加参数(例如,openFormParam
)。
在start-workflow.js
:
onReady: function StartWorkflow_onReady() {
// skipped ...
// get the additional parameter from the URL here
// var openFormParam = ...
if(openFormParam !== null) {
var p_aArgs = [];
var index = {index: 0}; // for the first workflow in the popup
p_aArgs.push(0, index);
this.onWorkflowSelectChange(null, p_aArgs);
}
return Alfresco.component.StartWorkflow.superclass.onReady.call(this);
},
// OOTB
onWorkflowSelectChange: function StartWorkflow_onWorkflowSelectChange(p_sType, p_aArgs) {
var i = p_aArgs[1].index;
if (i >= 0) {
// Update label of workflow menu button
var workflowDefinition = this.options.workflowDefinitions[i];
this.widgets.workflowDefinitionMenuButton.set("label", workflowDefinition.title + " " + Alfresco.constants.MENU_ARROW_SYMBOL);
this.widgets.workflowDefinitionMenuButton.set("title", workflowDefinition.description);
// Load the form for the specific workflow
Alfresco.util.Ajax.request({
url: Alfresco.constants.URL_SERVICECONTEXT + "components/form",
dataObj: {
htmlid: this.id + "-startWorkflowForm-" + Alfresco.util.generateDomId(),
itemKind: "workflow",
itemId: workflowDefinition.name,
mode: "create",
submitType: "json",
showCaption: true,
formUI: true,
showCancelButton: true,
destination: this.options.destination
},
successCallback: {
fn: this.onWorkflowFormLoaded,
scope: this
},
failureMessage: this.msg("message.failure"),
scope: this,
execScripts: true
});
}
},