Good morning all,
I am sorry if I will not be so clear, but I will really try, and I will appreciate very much If someone could help me.
I am having some problem to manipulate the packageitems.ftl. In my project I should modify a button to do another action, but I can not find where I should do the modifications, let me try to be more clear. Here is the packageitems.ftl:
<#include "/org/alfresco/components/form/controls/association.ftl" />
<#macro setPackageItemOptions field>
<#local documentLinkResolver>function(item){ return Alfresco.util.siteURL("document-details?nodeRef=" + item.nodeRef, { site: item.site }); }</#local>
<#local allowAddAction = false>
<#local allowRemoveAllAction = false>
<#local allowRemoveAction = false>
<#local actions = []>
<#if form.data['prop_bpm_packageActionGroup']?? && form.data['prop_bpm_packageActionGroup']?is_string && form.data['prop_bpm_packageActionGroup']?length > 0>
<#local allowAddAction = true>
</#if>
<#if form.data['prop_bpm_packageItemActionGroup']?? && form.data['prop_bpm_packageItemActionGroup']?is_string && form.data['prop_bpm_packageItemActionGroup']?length > 0>
<#local packageItemActionGroup = form.data['prop_bpm_packageItemActionGroup']>
<#local viewMoreAction = { "name": "view_more_actions", "label": "form.control.object-picker.workflow.view_more_actions", "link": documentLinkResolver }>
<#if packageItemActionGroup == "read_package_item_actions" || packageItemActionGroup == "edit_package_item_actions">
<#local actions = actions + [viewMoreAction]>
<#elseif packageItemActionGroup == "remove_package_item_actions" || packageItemActionGroup == "start_package_item_actions" || packageItemActionGroup == "edit_and_remove_package_item_actions">
<#local actions = actions + [viewMoreAction]>
<#local allowRemoveAllAction = true>
<#local allowRemoveAction = true>
<#elseif packageItemActionGroup >
<#else>
<#local actions = actions + [viewMoreAction]>
</#if>
</#if>
<#– Additional item actions –>
<script type="text/javascript">//<![CDATA[
(function()
{
<#– Modify the properties on the object finder created by association control–>
var picker = Alfresco.util.ComponentManager.get("${controlId}");
picker.setOptions(
{
showLinkToTarget: true,
targetLinkTemplate: ${documentLinkResolver},
<#if form.mode == "create" && form.destination?? && form.destination?length > 0>
startLocation: "${form.destination?js_string}",
</#if>
itemType: "cm:content",
displayMode: "${field.control.params.displayMode!"list"}",
listItemActions: [
<#list actions as action>
{
name: "${action.name}",
<#if action.link??>
link: ${action.link},
<#elseif action.event>
event: "${action.event}",
</#if>
label: "${action.label}"
}<#if action_has_next>,</#if>
</#list>],
allowRemoveAction: ${allowRemoveAction?string},
allowRemoveAllAction: ${allowRemoveAllAction?string},
allowSelectAction: ${allowAddAction?string},
selectActionLabel: "${field.control.params.selectActionLabel!msg("button.add")}"
});
})();
//]]></script>
</#macro>
<@setPackageItemOptions field />
I saw that the variable "allowSelectAction" is also in the object-finder.js. Thus, I tried to modify the part below:
if (this.options.allowSelectAction)
{
var addButtonEl = document.createElement("button");
itemGroupActionsContainerEl.appendChild(addButtonEl);
this.widgets.addButton = Alfresco.util.createYUIButton(this, null, this.onAddButtonClick,
{
label: this.options.selectActionLabel,
disabled: true
}, addButtonEl);
}
I have created a function called onModifierEnLigneButtonClick, to replace "this.onAddButtonClick", but did not work. Apparently, this object-finder.js is nothing to do with the packegeitens.ftl. Actually, I am not sure about this, but I erased all the code and all the system continues to work like always.
Thanks in advance,
Rodrigo Araujo