cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove Task from the header

samnaction
Champ in-the-making
Champ in-the-making
I need to remove Task from header menu. I managed to remove My workflow from dashlet but how to remove Task from the header.
3 REPLIES 3

kavilash23
Champ on-the-rise
Champ on-the-rise
Hello,

You need to override the share-header.get.js through an extension module by adding the following code.

function findAndRemoveIn(obj, arrContext, arrIdx, id) {
var idx, max, key;
if (obj !== undefined && obj !== null) {
if (Object.prototype.toString.apply(obj) === "[object Object]") {
if (obj.hasOwnProperty("id") && obj.id === id) {
if (arrContext !== null && arrIdx !== null)
{ arrContext.splice(arrIdx, 1); }

else
{ logger .debug("Unexpected match outside of array structure: " + jsonUtils.toJSONString(obj)); }

} else {
for (key in obj) {
if (obj.hasOwnProperty(key))
{ findAndRemoveIn(obj[key], null, null, id); }

}
}
} else if (Object.prototype.toString.apply(obj) === "[object Array]") {
for (idx = 0, max = obj.length; idx < max; idx++)
{ findAndRemoveIn(obj[idx], obj, idx, id); }

}
}
}

var widget, widgetsToRemove = ["HEADER_TASKS"], idx, max;
for (idx = 0, max = widgetsToRemove.length; idx < max; idx++)
{ findAndRemoveIn(model.jsonModel.widgets, null, null, widgetsToRemove[idx]); }

Can you tell me in which file i need to add this. How to override through extension module

kavilash23
Champ on-the-rise
Champ on-the-rise
create an xml file in $ALFRESCO_HOME\tomcat\shared\classes\alfresco\web-extension\site-data\extensions and put in the following
<extension>
  <modules>
    <module>
      <id>Customise Share Menu</id>
      <version>1.0</version>
      <auto-deploy>true</auto-deploy>    
      <customizations>
        <customization>
          <targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
          <sourcePackageRoot>yourfolder</sourcePackageRoot>
        </customization>
      </customizations>
    </module>
  </modules>
</extension>

Then create the js file named share-header.get.js with the code given previously in $ALFRESCO_HOME\tomcat\shared\classes\alfresco\web-extension\site-webscripts\yourfolder

Restart alfresco  and you are done!