mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Configuration added for web-client to setup default dashlets shown in a user Dashboard on first login
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5979 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -193,6 +193,7 @@
|
||||
|
||||
<config evaluator="string-compare" condition="Dashboards">
|
||||
<!-- Dashboard layouts and available dashlets for the My Alfresco pages -->
|
||||
<!-- see http://wiki.alfresco.com/wiki/User_Configurable_Dashboards -->
|
||||
<dashboards>
|
||||
<layouts>
|
||||
<!-- the mandatory "default" layout - will be used for all users initially -->
|
||||
@@ -209,17 +210,18 @@
|
||||
label-id="layout_three_column_label" description-id="layout_three_column_desc"
|
||||
jsp="/jsp/dashboards/layouts/three-column.jsp" />
|
||||
</layouts>
|
||||
|
||||
<dashlets>
|
||||
<!-- this is the default dashlet shown in the default layout initially -->
|
||||
<!-- the default dashlet must have the id of 'getting-started' -->
|
||||
<dashlet id="getting-started" label-id="dashlet_gettingstarted_label"
|
||||
description-id="dashlet_gettingstarted_desc"
|
||||
jsp="/jsp/dashboards/dashlets/getting-started.jsp" allow-narrow="false" />
|
||||
<dashlet id="tasks-active" label-id="tasks_active_title" description-id="tasks_active_desc"
|
||||
jsp="/jsp/workflow/tasks-active-dashlet.jsp" allow-narrow="false" />
|
||||
<!-- this dashlet 'tasks-todo' is also shown by default for all users -->
|
||||
<dashlet id="tasks-todo" label-id="my_tasks_todo_title" description-id="my_tasks_todo_desc"
|
||||
jsp="/jsp/workflow/tasks-todo-dashlet.jsp" allow-narrow="false" />
|
||||
<dashlet id="tasks-active" label-id="tasks_active_title" description-id="tasks_active_desc"
|
||||
jsp="/jsp/workflow/tasks-active-dashlet.jsp" allow-narrow="false" />
|
||||
<dashlet id="pooled-tasks" label-id="pooled_tasks_title" description-id="pooled_tasks_desc"
|
||||
jsp="/jsp/workflow/pooled-tasks-todo-dashlet.jsp" allow-narrow="false" />
|
||||
<dashlet id="tasks-completed" label-id="my_tasks_completed_title" description-id="my_tasks_completed_desc"
|
||||
@@ -235,6 +237,15 @@
|
||||
<dashlet id="mywebforms-webscript" label="My Web Forms" description="My Web Forms WebScript"
|
||||
jsp="/jsp/dashboards/dashlets/mywebforms-webscript.jsp" />
|
||||
</dashlets>
|
||||
|
||||
<!-- configuration of the default dashlets to display when users login for the first time -->
|
||||
<!-- if this config is removed, then no dashlets will be shown by default -->
|
||||
<!-- overides of this config should redefine the entire list, not assume additions to it -->
|
||||
<default-dashlets>
|
||||
<dashlet id="getting-started" />
|
||||
<dashlet id="tasks-todo" />
|
||||
</default-dashlets>
|
||||
|
||||
<!-- set true allow the Guest user to configure the dashboard view - false by default -->
|
||||
<allow-guest-config>false</allow-guest-config>
|
||||
</dashboards>
|
||||
|
@@ -162,16 +162,17 @@ public class DashboardManager
|
||||
Page page = new Page("default", layout);
|
||||
Column defaultColumn = new Column();
|
||||
|
||||
// add the default dashlet(s) to the column
|
||||
DashletDefinition dashlet = config.getDashletDefinition(DASHLET_STARTEDDEFAULT);
|
||||
// add the default dashlet(s) to the column as specified in the config
|
||||
if (config.getDefaultDashlets() != null)
|
||||
{
|
||||
for (String id : config.getDefaultDashlets())
|
||||
{
|
||||
DashletDefinition dashlet = config.getDashletDefinition(id);
|
||||
if (dashlet != null)
|
||||
{
|
||||
defaultColumn.addDashlet(dashlet);
|
||||
}
|
||||
dashlet = config.getDashletDefinition(DASHLET_TASKSDEFAULT);
|
||||
if (dashlet != null)
|
||||
{
|
||||
defaultColumn.addDashlet(dashlet);
|
||||
}
|
||||
}
|
||||
|
||||
// add the column to the page and we are done
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.web.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -45,6 +46,7 @@ public class DashboardsConfigElement extends ConfigElementAdapter
|
||||
|
||||
private Map<String, LayoutDefinition> layoutDefs = new LinkedHashMap<String, LayoutDefinition>(4, 1.0f);
|
||||
private Map<String, DashletDefinition> dashletDefs = new LinkedHashMap<String, DashletDefinition>(8, 1.0f);
|
||||
private List<String> defaultDashlets = null;
|
||||
private boolean allowGuestConfig = false;
|
||||
|
||||
/**
|
||||
@@ -91,6 +93,18 @@ public class DashboardsConfigElement extends ConfigElementAdapter
|
||||
combinedElement.allowGuestConfig = newElement.allowGuestConfig;
|
||||
}
|
||||
|
||||
// the default-dashlets list is completely replaced if config is overriden
|
||||
if (newElement.defaultDashlets != null)
|
||||
{
|
||||
combinedElement.defaultDashlets =
|
||||
(List<String>)((ArrayList<String>)newElement.defaultDashlets).clone();
|
||||
}
|
||||
else if (this.defaultDashlets != null)
|
||||
{
|
||||
combinedElement.defaultDashlets =
|
||||
(List<String>)((ArrayList<String>)this.defaultDashlets).clone();
|
||||
}
|
||||
|
||||
return combinedElement;
|
||||
}
|
||||
|
||||
@@ -134,6 +148,20 @@ public class DashboardsConfigElement extends ConfigElementAdapter
|
||||
return this.dashletDefs.values();
|
||||
}
|
||||
|
||||
/*package*/ void addDefaultDashlet(String id)
|
||||
{
|
||||
if (this.defaultDashlets == null)
|
||||
{
|
||||
this.defaultDashlets = new ArrayList<String>(2);
|
||||
}
|
||||
this.defaultDashlets.add(id);
|
||||
}
|
||||
|
||||
public Collection<String> getDefaultDashlets()
|
||||
{
|
||||
return this.defaultDashlets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Structure class for the definition of a dashboard page layout
|
||||
*/
|
||||
|
@@ -46,6 +46,7 @@ public class DashboardsElementReader implements ConfigElementReader
|
||||
public static final String ELEMENT_DASHLETS = "dashlets";
|
||||
public static final String ELEMENT_DASHLET = "dashlet";
|
||||
public static final String ELEMENT_GUESTCONFIG = "allow-guest-config";
|
||||
public static final String ELEMENT_DEFAULTDASHLETS = "default-dashlets";
|
||||
public static final String ATTR_ID = "id";
|
||||
public static final String ATTR_COLUMNS = "columns";
|
||||
public static final String ATTR_COLUMNLENGTH = "column-length";
|
||||
@@ -95,6 +96,17 @@ public class DashboardsElementReader implements ConfigElementReader
|
||||
}
|
||||
}
|
||||
|
||||
Element defaultDashletsElement = element.element(ELEMENT_DEFAULTDASHLETS);
|
||||
if (defaultDashletsElement != null)
|
||||
{
|
||||
Iterator<Element> dashletsItr = defaultDashletsElement.elementIterator(ELEMENT_DASHLET);
|
||||
while (dashletsItr.hasNext())
|
||||
{
|
||||
String id = getMandatoryDashletAttributeValue(dashletsItr.next(), ATTR_ID);
|
||||
configElement.addDefaultDashlet(id);
|
||||
}
|
||||
}
|
||||
|
||||
Element guestConfigElement = element.element(ELEMENT_GUESTCONFIG);
|
||||
if (guestConfigElement != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user