cancel
Showing results for 
Search instead for 
Did you mean: 

Change default options in Dashlets.

oblivian
Champ in-the-making
Champ in-the-making
System: Ubuntu 9.04 & Alfresco 3.2 Community. (Partner repository install).

Hello,

Is it possible and if so where can I change the defalt options for dashlets?
I.e. I want the Site Activities to default to "All activities" and "Last 28 days".

Please advice,

Regards,

Oblivian
4 REPLIES 4

jpfi
Champ in-the-making
Champ in-the-making
Hi,

change this in in site-webscripts/org/alfresco/components/dashlets/site-activities.get.html.ftl:
old:
<script type="text/javascript">//<![CDATA[
   new Alfresco.Activities("${args.htmlid}").setOptions(
   {
      siteId: "${page.url.templateArgs.site!""}",
      mode: "site"
   }).setMessages(
      ${messages}
   );
//]]></script>

to new
<script type="text/javascript">//<![CDATA[
   new Alfresco.Activities("${args.htmlid}").setOptions(
   {
      siteId: "${page.url.templateArgs.site!""}",
      mode: "site",
      activeFilter: "28"
   }).setMessages(
      ${messages}
   );
//]]></script>

cheers, jan

rcis
Champ in-the-making
Champ in-the-making
Hi Jan,

I tried using this method to adjust both the my-activities.get.html.ftl and site-activities.get.html.ftl without any success (the addition I made is in bold).
I did some snooping around and found that the if I modify the <ALFRESCO_HOME>\tomcat\webapps\share\components\dashlets\activities-min.js script and look for activeFilter:"today" and replace it with activeFilter:"7days" then it works.
It seems that the ftl files have no effect in changing the default Activity feed options, could someone check this out as its not ideal having to modify the js file.

<script type="text/javascript">//<![CDATA[
   new Alfresco.Activities("${args.htmlid}").setOptions(
   {
      siteId: "${page.url.templateArgs.site!""}",
      mode:"site",activeFilter:"7days"
   }).setMessages(
      ${messages}
   );
   new Alfresco.widget.DashletResizer("${args.htmlid}", "${instance.object.id}");
//]]></script>

mike54
Champ in-the-making
Champ in-the-making
So, did you manage to change your defaults?
I'm interested in that as well, but I would prefer to change some config XML instead of script that will be replaced with next upgrade…

Has anyone other suggestions here?

Thanks,
Mike

mikeh
Star Contributor
Star Contributor
Unfortunately, the code's not yet there to pick-up setting the activeFilter via the Freemarker template.

If you'd like this functionality, you need to update the activities.js client-side JavaScript file as follows (note, this is in the onReady() function):

         // Dropdown filter
         this.widgets.range = new YAHOO.widget.Button(this.id + "-range",
         {
            type: "split",
            menu: this.id + "-range-menu",
            lazyloadmenu: false
         });
         this.widgets.range.on("click", this.onDateFilterClicked, this, true);
         this.widgets.range.getMenu().subscribe("click", function (p_sType, p_aArgs)
         {
            var menuItem = p_aArgs[1];
            if (menuItem)
            {
               me.widgets.range.set("label", menuItem.cfg.getProperty("text"));
               me.onDateFilterChanged.call(me, p_aArgs[1]);
            }
         });

         this.widgets.range.value = this.options.activeFilter;

         // Loop through and find the menuItem corresponding to the default filter
         var menu = this.widgets.range.getMenu(),
            menuItems = menu.getItems(),
            menuItem,
            i, ii;

         for (i = 0, ii = menuItems.length; i < ii; i++)
         {
            menuItem = menuItems[i];
            if (menuItem.value == this.options.activeFilter)
            {
               menu.clickEvent.fire(
               {
                  type: "click"
               }, menuItem);
               break;
            }
         }

I'm interested in that as well, but I would prefer to change some config XML instead of script that will be replaced with next upgrade…
We haven't got as much of the basic customization into config as we'd like yet, so this isn't going to be possible. To avoid the upgrade issues you should be putting Share webscript overrides into the web-extensions folders anyway. There will be more information about this following the European and US meet-ups over the coming weeks.

Thanks,
Mike