-->

Alfresco的:直接链接到工作流程(Alfresco: linking directly to

2019-10-23 16:07发布

我想从该网站上我的露天站点链接dashlet启动工作流。 用Firebug检查POST给了我一个可行的URL,但它只显示形式,无任何用户界面:

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=
  1. 这可能吗? 如果是这样,我怎么能格式化链接,包括UI?
  2. 如果不是,是那里专为启动工作流定制有dashlets?

Answer 1:

当您从下拉列表中选择工作流程会根据选择的工作流程产生的URL和重定向你这一点。

防爆。 对于ParallelGroupReview工作流程网址为。

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=

现在,如果你直接在浏览器中使用这个网址,你将能够看到相同的形式,但页眉和页脚部分将丢失,因为这些全球组件将不会共享方面的即时拍摄之外。

如果你看到启动workflow.ftl,你将能够看到被插入页眉和页脚组件,这些组件负责用户界面的其余部分。

<#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>
   </@>
</@>

您可以重复使用相同的组件只需要确保页眉和页脚正确初始化。



Answer 2:

我创建它具有以下目标的扩展模块:

<targetPackageRoot>org.alfresco.components.workflow</targetPackageRoot>

我包含在我的扩展启动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"/>
</@>

延长我自己的默认启动workflow.js。

你需要更改下面的方法:

  • onReady:所以它读取从URL您的参数去了解启动和大火workflowdefinition onWorkflowSelectChange
  • onWorkflowSelectChange:所以它会读取workflowdefintion加载形式


Answer 3:

您可以为分享一点点定制。

例如,如果你需要打开任何业务流程的启动形式,你可以在弹出的找到它的指数和一个额外的参数添加到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
        });
    }
},


文章来源: Alfresco: linking directly to workflow