Remove MyActivities Dashlet

cancel
Showing results for 
Search instead for 
Did you mean: 
Lvit
Member II

Remove MyActivities Dashlet

Hi,

i need to disable MyActivities dashlet from Dashboard of all users.

How i can do this? Thanks.

1 Reply
abhinavmishra14
Moderator
Moderator

Re: Remove MyActivities Dashlet

Try below given steps and see if that works. Not tested 

Extend the "my-activities.get.js" component and disable the dashlet.

1- Create surf extension:

<extension>
    <modules>
        <module>
            <id>Dashlets extension</id>
            <version>1.0</version>
            <auto-deploy>true</auto-deploy>
            <customizations>                
                <!-- Disable my activities for all users -->				
		<customization>
		      <targetPackageRoot>org.alfresco.components.dashlets</targetPackageRoot>
		      <sourcePackageRoot>com.demo.components.dashlets</sourcePackageRoot>
		</customization>
				
            </customizations>
        </module>
    </modules>
</extension>

2- Create a file named "my-activities.get.js" under <shareModule>\src\main\resources\alfresco\web-extension\site-webscripts\com\demo\components\dashlets 

3- Add the following content in the file:

//Hide the dashlet for all users always
model.showDashlet = false;

Seems like "showDashlet" flag is not provided in 'my-activities.get.html.ftl' so we have to override and enable it.

4- Create a file named "my-activities.get.html.ftl" under <shareModule>\src\main\resources\alfresco\web-extension\site-webscripts\com\demo\components\dashlets and add the following:

<@markup id="custom-myact-html" target="html" action="replace">
   <@uniqueIdDiv>
     <#-- Added the flag to show/hide the dashlet -->
     <#if showDashlet>
      <#assign id = args.htmlid>
      <div class="dashlet activities">
         <div class="title">${msg("header")}</div>
         <div class="toolbar flat-button">
            <div class="hidden">
               <span class="align-left yui-button yui-menu-button" id="${id}-user">
                  <span class="first-child">
                     <button type="button" tabindex="0"></button>
                  </span>
               </span>
               <select id="${id}-user-menu">
               <#list filterTypes as filter>
                  <option value="${filter.type?html}">${msg("filter." + filter.label)}</option>
               </#list>
               </select>
               <span class="align-left yui-button yui-menu-button" id="${id}-activities">
                  <span class="first-child">
                     <button type="button" tabindex="0"></button>
                  </span>
               </span>
               <select id="${id}-activities-menu">
               <#list filterActivities as filter>
                  <option value="${filter.type?html}">${msg("filter." + filter.label)}</option>
               </#list>
               </select>
               <span class="align-left yui-button yui-menu-button" id="${id}-range">
                  <span class="first-child">
                     <button type="button" tabindex="0"></button>
                  </span>
               </span>
               <select id="${id}-range-menu">
               <#list filterRanges as filter>
                  <option value="${filter.type?html}">${msg("filter." + filter.label)}</option>
               </#list>
               </select>
               <div class="clear"></div>
            </div>
         </div>
         <div id="${id}-activityList" class="body scrollableList" <#if args.height??>style="height: ${args.height?html}px;"</#if>></div>
      </div>
      
      <#-- Empty results list template -->
      <div id="${id}-empty" style="display: none">
         <div class="empty"><h3>${msg("empty.title")}</h3><span>${msg("empty.description")}</span></div>
      </div>
      
     </#if>
   </@>
</@>

 

Documentation :

https://docs.alfresco.com/content-services/6.0/develop/share-ext-points/surf-dashlets/

https://docs.alfresco.com/content-services/6.0/develop/share-ext-points/surf-extension-modules/

https://docs.alfresco.com/content-services/6.0/develop/share-ext-points/modify-ootb-code/

 

 

~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)