cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with packageitems.ftl

rodrigoa
Champ in-the-making
Champ in-the-making
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 &gt; 0>
      <#local allowAddAction = true>
   </#if>

   <#if form.data['prop_bpm_packageItemActionGroup']?? && form.data['prop_bpm_packageItemActionGroup']?is_string && form.data['prop_bpm_packageItemActionGroup']?length &gt; 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 &gt; 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
3 REPLIES 3

rodrigoa
Champ in-the-making
Champ in-the-making
Problem solved.

Thanks to everyone who tried to help.

Rodrigo Araujo

pablog_
Champ in-the-making
Champ in-the-making
Hi Rodrigo I'm trying to do like this. I want to add an Edit on line link into packageItems.ftl. Could you tell me how fix this problem?
Thank you so much!

evoci
Champ in-the-making
Champ in-the-making
Dear Rodrigo,
In a workflow, we need to add an action button to packageItems in order to set a document with 'Publishable' aspect. It's the custom action created already and we can set it to documents from the share interface.
Now we need to set the aspect to documents in packageItems showing as a button together to buttons such as 'Download', View more action' etc..
Would you suggest us how you've resolved your problem.
Looking forward to hearing from you.
Thanks in advance.
Elio.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.