cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 4.2d Share: Customization of My Tasks

kizman77
Champ in-the-making
Champ in-the-making
Hi everyone,

I am trying to customize "My Tasks" in order to remove unnecessary fields (status, label) and to put something else to be a main (clickable) title of the task (For 'Send for Review and Approve' workflow it is not practical to use "description" as a title as it might be a long one.
I found that the piece of HTML for this component has been generated in the Share webapp: <share web app root>\share\components\workflow\task-list.js file. This .js file is imported in the share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\workflow\task-list.get.html.ftl file.

In order to customize this I have created a new jar file with the following folder structure:

alfresco\site-data\extensions\my-tasks-customisation.xml
alfresco\site-webscripts\mytasks\customisation\task-list.get.properties
alfresco\site-webscripts\mytasks\customisation\task-list.get.html.ftl
META-INF\components\workflow\task-list-custom.js (which is customised task-list.js to generate slightly different html in the "renderCellTaskInfo: function TL_renderCellTaskInfo(elCell, oRecord, oColumn, oData)" method).

Content of the my-tasks-customisation.xml:

<extension>
   <modules>
      <module>
         <id>My Tasks Customisation</id>
       <auto-deploy>true</auto-deploy>
         <version>1.0</version>
         <customizations>
            <customization>
               <targetPackageRoot>org.alfresco.components.workflow</targetPackageRoot>
               <sourcePackageRoot>mytasks.customisation</sourcePackageRoot>
           </customization>
         </customizations>
      </module>
   </modules>
</extension>


Content of task-list.get.html.ftl:

<@markup id="my-custom-js" target="js" action="replace" scope="global">
   <#– JavaScript Dependencies –>
   <@script src="${url.context}/res/components/workflow/workflow-actions.js" group="workflow"/>
   <@script src="${url.context}/res/components/workflow/task-list-custom.js" />
</@>


task-list.get.properties contains changed labels for some actions.

I copied the jar file to WEB-INF/lib and have deployed the module via the Share module deployment admin tool.

However, as a result I have the following:
The changes defined in the .properties file work as expected - when the module is deployed I see new labels, when it is not deployed I see the OOTB ones.
However, for the changes in the task list fields Share always reads it from my customised task-list-custom.js file regardless whether the module is deployed or not (I always see the list of tasks without the fields I have removed).

Any ideas?

Thanks.
4 REPLIES 4

govinda
Champ in-the-making
Champ in-the-making
You can customize my task by simply doing changes in client side java script my task files

kizman77
Champ in-the-making
Champ in-the-making
Thanks Govinda, but I wanted to avoid messing up directly with out-of-the-box files and use extension model instead.

I could have changed the .js file directly in its directory, but isn't that bad practice? It is better to always use extension points to be safe in case of patches and upgrades.

govinda
Champ in-the-making
Champ in-the-making
You can even extend the client side js files/methods as YUI follows prototype oriented approach. See the documentlist.js and how the views are extending the core Alfresco.DocumentList and Alfresco.DocumentListViewRenderer. The same is applicable to My Task as well

niketapatel
Star Contributor
Star Contributor
Hi Kizzman,

Your approach looks OK to extend OOB module.
If I understand correctly, You have issue with -  task-list.get.html.ftl. Your client side js task-list-custom.js is not getting picked up.

Initially, I was evaluating 4.2 Community and I believe, this dependency loading of target="js", target="css" yet not implemented!

I saw comment in this file - webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco-mm-galleryview\components\documentlibrary\documentlist.get.head.ftl

Comment: "TODO: move dependency loading to documentlist.get.html.ftl once target="js", target="css" complete on 4.0 line "

I am not sure for 4.2d but You can confirm it, If this is the case then you need to inject your js dependency in head.ftl

I checked 4.2Pr and its implemented in it - http://docs.alfresco.com/4.2/topic/com.alfresco.enterprise.doc/tasks/dev-extensions-share-tutorials-...

Hope it helps!