如何在露天工作流程表单上添加自定义操作以重命名文档名称

编程入门 行业动态 更新时间:2024-10-13 16:21:21
本文介绍了如何在露天工作流程表单上添加自定义操作以重命名文档名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在露天共享中的工作流程表单上添加文档名称重命名操作。 有什么方法可以做到这一点。

I want to add document name rename action on workflow form in alfresco share. Is there any way to do this.

请提供所需的步骤和可能的示例代码段。

Please provide the required steps and sample code snipet if possible.

请回答,这是以前做过的。

Please reply is somebady did this before.

预先感谢。

推荐答案

您需要做的第一件事是为您为其截屏的工作流任务表单定义表单配置。您可以在share-config-custom.xml中对其进行定义。表单配置应如下所示。

The first thing which you need to do is to define the form configuration for the workflow task form for which you have taken the screenshot.You can define it inside the share-config-custom.xml. Form configuration should be something like below.

<config evaluator="task-type" condition="**NAME OF YOUR TASK**"> <forms> <form> <field-visibility> <!-- **FIELDS WHICH YOU WANT TO MAKE VISIBLE** --> <show id="wf:requiredApprovePercent" /> <show id="bpm:workflowDueDate" /> <show id="bpm:workflowPriority" /> <show id="packageItems" /> <show id="bpm:sendEMailNotifications" /> <show id="bpm:comment" /> </field-visibility> <appearance> <!-- **FIELDS WHICH FOR WHICH YOU WANT TO CUSTOMIZE TEMPLATE** --> <field id="bpm:workflowPriority" label-id="workflow.field.priority"> <control template="/org/alfresco/components/form/controls/workflow/priority.ftl" /> </field> <field id="bpm:sendEMailNotifications"> <control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" /> </field> <field id="bpm:comment" label-id="workflow.fieldment"> <control template="/org/alfresco/components/form/controls/textarea.ftl" /> </field> </appearance> </form> </forms> </config>

定义后,您需要自定义packageItems字段的模板并为该字段创建新的字段模板您可以从现有模板 org\alfresco\components\form\controls\workflow\packageitems.ftl中引用。

Once you define this you need to customize the template for the packageItems field and create a new field template for it.You can take a reference from existing template "org\alfresco\components\form\controls\workflow\packageitems.ftl"

在ftl上方模板中还包含一个名为association.ftl的ftl库。您需要创建一个新的association.ftl并将其包含在此文件中。

Above ftl template include one more ftl library, named as association.ftl.You need to create a new association.ftl and include it inside this file.

您需要在其中进行更改

现在您需要创建一个JavaScript文件来扩展object-finder.js。如何扩展该文件非常

Now you need to create one javascript file which should extend object-finder.js.How to extend that file is very well explained in below link.

> alfrescoblog/2014/05/28/alfresco-share-custom-object-finder-js/

创建扩展文件后,其内容应类似于以下内容。 ll需要根据需要自定义以下功能。您需要添加用于添加铅笔图标并处理onclick事件的代码。

Once you create the extended file , it should have content similar to below.You still need to customize below function as per your requirement.You need to add the coded for adding pencil icon and handling onclick event for it.

(function() { var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event; var $html = Alfresco.util.encodeHTML, $hasEventInterest = Alfresco.util.hasEventInterest, $combine = Alfresco.utilbinePaths; Alfresco.PackageItemsObjectFinder = function Alfresco_PackageItemsObjectFinder( htmlId, currentValueHtmlId) { Alfresco.PackageItemsObjectFinder.superclass.constructor.call(this, htmlId, currentValueHtmlId); // Re-register with our own name this.name = "Alfresco.PackageItemsObjectFinder"; Alfresco.util.ComponentManager.reregister(this); return this; }; YAHOO.extend(Alfresco.PackageItemsObjectFinder, Alfresco.ObjectFinder, { fnRenderCellListItemName: function ObjectFinder_fnRenderCellListItemName() { var scope = this; return function ObjectFinder_fnRenderCellListItemName(elCell, oRecord, oColumn, oData) { var item = oRecord.getData(), titles = item.title ? $html(item.title) : scope.msg("label.none"), modifiedOn = item.modified ? Alfresco.util.formatDate(Alfresco.util.fromISO8601(item.modified)) : null, title = $html(item.name); if (scope.options.showLinkToTarget && scope.options.targetLinkTemplate !== null) { var link; if (YAHOO.lang.isFunction(scope.options.targetLinkTemplate)) { link = scope.options.targetLinkTemplate.call(scope, oRecord.getData()); } else { //Discard template, build link from scratch var linkTemplate = (item.site) ? Alfresco.constants.URL_PAGECONTEXT + "site/{site}/document-details?nodeRef={nodeRef}" : Alfresco.constants.URL_PAGECONTEXT + "document-details?nodeRef={nodeRef}"; link = YAHOO.lang.substitute(linkTemplate, { nodeRef : item.nodeRef, site : item.site }); } title = '<a href="' + link + '">' + $html(item.displayName?item.displayName:item.name) + '</a>'; } var template = '<h3 class="name">' + title + '</h3>'; template += '<div class="description">' + "Title" + ': ' + titles + '</div>'; template += '<div class="viewmode-label">' + scope.msg("form.control.object-picker.modified-on") + ': ' + (modifiedOn ? modifiedOn : scope.msg("label.none")) + '</div>'; elCell.innerHTML = template; }; } });

})();

一次您可以对此进行扩展,而不需要在关联ftl文件中提供此扩展类的引用。

Once you extend this, than you need give the reference of this extended class in the association ftl file.

关联文件的更改如下所示。

The change in assiciation file will be something like below.

var ${picker} = new Alfresco.PackageItemsObjectFinder("${controlId}", "${fieldHtmlId}")

而不是

var ${picker} = new Alfresco.ObjectFinder("${controlId}", "${fieldHtmlId}")

更多推荐

如何在露天工作流程表单上添加自定义操作以重命名文档名称

本文发布于:2023-11-28 13:38:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642627.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   表单   露天   工作流程   重命名

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!