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

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

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

如果可能,请提供所需的步骤和示例代码片段.

请回复,之前有人做过这个.

提前致谢.

解决方案

您需要做的第一件事是为您截取屏幕截图的工作流任务表单定义表单配置.您可以在共享配置-custom.xml.表单配置应如下所示.

<表格><表格><视野范围><!-- **您想要显示的字段** --><show id="wf:requiredApprovePercent"/><show id="bpm:workflowDueDate"/><show id="bpm:workflowPriority"/><show id="packageItems"/><show id="bpm:sendEMailNotifications"/><show id="bpm:comment"/></现场可见性><外观><!-- **您想要自定义模板的字段** --><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></外观></表单></表格></config>

定义后,您需要为 packageItems 字段自定义模板并为其创建新的字段模板.您可以参考现有模板orgalfrescocomponentsformcontrolsworkflowpackageitems.ftl"

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

您还需要对该文件进行更改.让我们稍后再谈.

现在您需要创建一个 javascript 文件来扩展 object-finder.js.如何扩展该文件在下面的链接中有很好的解释.

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

一旦你创建了扩展文件,它应该有类似下面的内容.你仍然需要根据你的要求自定义下面的功能.你需要添加用于添加铅笔图标和处理onclick事件的代码.

(function() {var Dom = YAHOO.util.Dom,事件 = YAHOO.util.Event;var $html = Alfresco.util.encodeHTML,$hasEventInterest = Alfresco.util.hasEventInterest,$combine = Alfresco.utilbinePaths;Alfresco.PackageItemsObjectFinder = 函数 Alfresco_PackageItemsObjectFinder(htmlId, currentValueHtmlId) {Alfresco.PackageItemsObjectFinder.superclass.constructor.call(this,htmlId, currentValueHtmlId);//用我们自己的名字重新注册this.name = "Alfresco.PackageItemsObjectFinder";Alfresco.util.ComponentManager.reregister(this);返回这个;};YAHOO.extend(Alfresco.PackageItemsObjectFinder,Alfresco.ObjectFinder,{fnRenderCellListItemName: 函数 ObjectFinder_fnRenderCellListItemName(){var 作用域 = this;返回函数 ObjectFinder_fnRenderCellListItemName(elCell, oRecord, oColumn, oData){var item = oRecord.getData(),标题 = item.title ?$html(item.title) : scope.msg("label.none"),modifiedOn = item.modified ?Alfresco.util.formatDate(Alfresco.util.fromISO8601(item.modified)) : null,标题 = $html(item.name);if (scope.options.showLinkToTarget && scope.options.targetLinkTemplate !== null){变量链接;如果 (YAHOO.lang.isFunction(scope.options.targetLinkTemplate)){链接 = scope.options.targetLinkTemplate.call(scope, oRecord.getData());}别的{//丢弃模板,从头构建链接var linkTemplate = (item.site) ?Alfresco.constants.URL_PAGECONTEXT + "site/{site}/document-details?nodeRef={nodeRef}" : Alfresco.constants.URL_PAGECONTEXT + "document-details?nodeRef={nodeRef}";链接 = YAHOO.lang.substitute(linkTemplate,{nodeRef : item.nodeRef,站点 : item.site});}标题 = ''+ $html(item.displayName?item.displayName:item.name) + '</a>';}var 模板 = '<h3 class="name">'+ 标题 + '</h3>';模板 += '

'+ "标题" + ':' + 标题 + '</div>';模板 += '

'+ scope.msg("form.control.object-picker.modified-on") + ': ' + (modifiedOn ? modifiedOn : scope.msg("label.none")) + '</div>';elCell.innerHTML = 模板;};}});

})();

一旦你扩展了它,你就需要在关联 ftl 文件中给出这个扩展类的引用.

关联文件中的更改将如下所示.

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

代替

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

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.

Thanks in advance.

解决方案

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>

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 "orgalfrescocomponentsformcontrolsworkflowpackageitems.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.

You need to make change in that file as well.Let's come to that later.

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/

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; }; } });

})();

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}")

Instead of

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

更多推荐

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

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

发布评论

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

>www.elefans.com

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