cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove item under my activities dashlet

miraclesuki
Champ in-the-making
Champ in-the-making
[img]http://i.imgur.com/WtV0W.png[/img]

In Alfresco Share, I would like to know is there any way to delete, hidden or disable the items under the my activities dashlet?
let say, I only want to keep "My activities", others are set to invisible.

How to do it? and what file I need to change?

Thanks for help.

Mandy
17 REPLIES 17

afaust
Legendary Innovator
Legendary Innovator
Hello,

in the Share application (within the Tomcat server folder structure) there is a my-activities.get.config.xml which defines the available filter types. If you were to copy that to tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/ and remove all filter types except "mine", then those options will no longer show up in the UI (after a restart or refresh of web scripts).
Now there is another possibility to change this without overriding the complete configuration file, but this requires a some know-how in Share development / Surf extensibility modules.

Regards
Axel

Hello Axel,

So I have been able to filter out all of the filter types except for "mine". The issue I'm running into is that there is not a way to automatically remove the filtered part so that other people's activities stop showing up. Where would I even begin to make this change? I've asked several times in the past and I'm hoping that I can atleast get pointed in the right direction.

afaust
Legendary Innovator
Legendary Innovator

I really do not understand what you are referring to right now... if you have removed all filter types execpt "mine" then there should be no way other peoples activities show up. What to you mean by "automatically remove the filtered part"?

On a site activities widget before you make a modification you can see members of the site and what they are doing. After making the modification those same activities show up on the widget. Now this can be old notifications on the feed. The only way to filter those off the widget is to have the user click on "Everyone's activites" and then select their own. What I want to be able to do (if possible) is eliminate the step where a user must do that in order for the filter to work properly.

douglascrp
World-Class Innovator
World-Class Innovator

I am not sure if I understood your problem, but it seems the problem is that the widget is initialized with the "all" option selected by default, as you can see in the source code here share/activities.js at master · Alfresco/share · GitHub 

The webscript config has all the options defined, I think you have already noticed: share/site-activities.get.config.xml at master · Alfresco/share · GitHub 

I believe all you need to do is to initialize the dashlet widged with the value "mine" for the user-filter.

Thank you Douglas for replying....So I have been able to modify the activities feed, but with a little hickup. Changing the activities.js and the activities-min.js and modifying the following:

activities.js on line 157 and 158

<code>

this.widgets.user.set("label", this.msg("filter.mine"));
this.widgets.user.value = "mine";

</code>

activities-min.js basically the same edit searching for "all" and replacing it with "mine"

So that is hard coding the install files which I really don't want to do. I want to be able to have the appropriate method of modifying the install files. I just don't know how to get started on the SDK for this modification.

Then creating the xml file which is here:

/opt/alfresco51/tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/my-activities.get.config.xml. That filters just the "mine" part.

I have tried to only modify the above mentioned to try and find which one needs to be changed while the others are left alone. It doesn't work without all three components being modified. Which is fine!

I guess really my question going forward is I want to be able to correctly modify the files, but when I try and do that in the SDK I get stuck and not really sure what is the best approach to do this. I really just need a nudge on what to do and I can go from there.

One thing that I have done is created a jar file and placed in the /tomcat/shared/lib folder the contents of the jar are the two above mentioned files with the modifications. I just created the file path of

/share/components/dashlets/the two js files

Is that a solution or is there something better?

afaust
Legendary Innovator
Legendary Innovator

My approach for this kind of JS file adaption is to always add a custom JS file as a dependency (customisation via Surf extension module) that then augments / modifies the prototype of the YUI component. Usually I replace one of the init functions of the component with a closure that simply calls the default function and does some pre/post processing around it. That way I can set the different widget states and don't have to modify original files.

I currently don't have an example in my open source modules of a prototype modification (last time I used this was for my old employer), but I used a similar approach to enhance edit-site / create-site dialogs.

afaust
Legendary Innovator
Legendary Innovator

Oh - and please forget that tomcat/shared/lib exists. It is no place to put any Alfresco addon / extension, even with JAR packaging. It will work as long as you only have static resources, but if the addon includes one Java class that needs to use / extend / implement a class from Alfresco or any of the included libraries, it will fail due to classloading issues.

Thank you for the response, but I think you have further confused me. Ok so going forward /tomcat/shared/lib doesn't exist. I should be putting any jar packaging in the /modules/share or the modules/platform depending on what I'm doing.

So if I understand both you and douglas so far.....

I need to create a jar package that I put into modules/share and the content of the jar I'm still trying to figure out. I may be missing something, but what I understand the jar file content should be basically a file path with the two files I want to override.

share/src/main/webapp/components/dashlets/activities.js and the activities-min.js

Is this correct?