08-20-2015 05:29 PM
08-21-2015 03:56 AM
08-25-2015 07:36 PM
08-27-2015 11:26 PM
var CustomActivities = CustomActivities || {};
(function(){
var PREFERENCES_ACTIVITIES = "org.alfresco.share.activities",
PREF_FILTER = ".filter",
PREF_RANGE = ".range",
PREF_ACTIVITIES = ".activities";
var Dom = YAHOO.util.Dom;
var $html = Alfresco.util.encodeHTML;
var $userProfile = Alfresco.util.userProfileLink;
CustomActivities.Activities = function CustomActivities_constructor(htmlId) {
CustomActivities.Activities.superclass.constructor.call(this, htmlId);
return this;
};
YAHOO.extend(CustomActivities.Activities, Alfresco.dashlet.Activities, {
onReady: function CustomActivities_onReady() {
var me = this;
// Create dropdown filter widgets
this.widgets.range = Alfresco.util.createYUIButton(this, "range", this.onDateFilterChanged,
{
type: "menu",
menu: "range-menu",
lazyloadmenu: false
});
this.widgets.user = Alfresco.util.createYUIButton(this, "user", this.onExclusionFilterChanged,
{
type: "menu",
menu: "user-menu",
lazyloadmenu: false
});
this.widgets.activities = Alfresco.util.createYUIButton(this, "activities", this.onActivitiesFilterChanged,
{
type: "menu",
menu: "activities-menu",
lazyloadmenu: false
});
// The activity list container
this.activityList = Dom.get(this.id + "-activityList");
// Load preferences to override default filter and range
this.widgets.range.set("label", this.msg("filter.7days"));
this.widgets.range.value = "7";
// Sirve para que el botón por defecto sea "Mis Actividades"
// this.widgets.user.set("label", this.msg("filter.all"));
this.widgets.user.set("label", this.msg("filter.mine"));
this.widgets.user.value = "mine";
this.widgets.activities.set("label", this.msg("filter.allItems") + " " + Alfresco.constants.MENU_ARROW_SYMBOL);
this.widgets.activities.value = "";
var prefs = this.services.preferences.get();
var activitiesPreference = Alfresco.util.findValueByDotNotation(prefs, this.buildPreferences(PREF_ACTIVITIES), "");
if (activitiesPreference !== null)
{
this.widgets.activities.value = activitiesPreference;
// set the correct menu label
var menuItems = this.widgets.activities.getMenu().getItems();
for (index in menuItems)
{
if (menuItems.hasOwnProperty(index))
{
if (menuItems[index].value === activitiesPreference)
{
this.widgets.activities.set("label", menuItems[index].cfg.getProperty("text") + " " + Alfresco.constants.MENU_ARROW_SYMBOL);
break;
}
}
}
}
var rangePreference = Alfresco.util.findValueByDotNotation(prefs, this.buildPreferences(PREF_RANGE), "7");
if (rangePreference !== null)
{
this.widgets.range.value = rangePreference;
// set the correct menu label
var menuItems = this.widgets.range.getMenu().getItems();
for (index in menuItems)
{
if (menuItems.hasOwnProperty(index))
{
if (menuItems[index].value === rangePreference)
{
this.widgets.range.set("label", menuItems[index].cfg.getProperty("text") + " " + Alfresco.constants.MENU_ARROW_SYMBOL);
break;
}
}
}
}
// var filterPreference = Alfresco.util.findValueByDotNotation(prefs, this.buildPreferences(PREF_FILTER), "all");
// if (filterPreference !== null)
// {
// this.widgets.user.value = filterPreference;
// // set the correct menu label
// var menuItems = this.widgets.user.getMenu().getItems();
// for (index in menuItems)
// {
// if (menuItems.hasOwnProperty(index))
// {
// if (menuItems[index].value === filterPreference)
// {
// this.widgets.user.set("label", menuItems[index].cfg.getProperty("text") + " " + Alfresco.constants.MENU_ARROW_SYMBOL);
// break;
// }
// }
// }
// }
// Display the toolbar now that we have selected the filter
Dom.removeClass(Selector.query(".toolbar div", this.id, true), "hidden");
// Populate the activity list
this.populateActivityList(this.widgets.range.value, this.widgets.user.value, this.widgets.activities.value);
}
});
})();
model.widgets[0].name = "CustomActivities.Activities";
<@markup id="mis-actividades-por-defecto-js" action="after" target="js" scope="global">
<@script type="text/javascript" src="${url.context}/res/customizations/components/dashlets/custom-activities.js" group="dashlets"/>
</@markup>
<@markup id="mis-actividades-por-defecto-html" action="replace" target="html" scope="global">
<@uniqueIdDiv>
<#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>
</@>
</@markup>
08-28-2015 02:53 AM
/amp-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/my-activities.get.config.xml
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.