← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3289: WIP: adjustable number of charts on dashboard. Functionality should be OK, probably need some ref...

 

------------------------------------------------------------
revno: 3289
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-04-05 20:10:58 +0200
message:
  WIP: adjustable number of charts on dashboard. Functionality should be OK, probably need some refactoring.
added:
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java
  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java
  dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2010-07-01 10:08:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2011-04-05 18:10:58 +0000
@@ -42,7 +42,9 @@
     String ID = UserSettingService.class.getName();
 
     final String AUTO_SAVE_DATA_ENTRY_FORM = "autoSaveDataEntryForm";
-    
+
+    public static final String KEY_DASHBOARD_CHARTS_TO_DISPLAY = "keyDashboardChartsToDisplay";
+
     /**
      * Saves the name/value pair as a user setting connected to the currently
      * logged in user.

=== added directory 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts'
=== added file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DashboardChartsToDisplayManager.java	2011-04-05 18:10:58 +0000
@@ -0,0 +1,48 @@
+package org.hisp.dhis.options.charts;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.List;
+
+/**
+ * @author mortenoh
+ */
+public interface DashboardChartsToDisplayManager
+{
+    static final String DASHBOARD_CHARTS_TO_DISPLAY_4 = "4";
+
+    static final String DASHBOARD_CHARTS_TO_DISPLAY_6 = "6";
+
+    static final String DASHBOARD_CHARTS_TO_DISPLAY_8 = "8";
+
+    public void setCurrentDashboardChartsToDisplay( String chartsToDisplay );
+
+    public String getCurrentDashboardChartsToDisplay();
+
+    public List<String> getDashboardChartsToDisplay();
+}

=== added file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/charts/DefaultDashboardChartsToDisplayManager.java	2011-04-05 18:10:58 +0000
@@ -0,0 +1,88 @@
+package org.hisp.dhis.options.charts;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.user.NoCurrentUserException;
+import org.hisp.dhis.user.UserSettingService;
+
+/**
+ * @author mortenoh
+ */
+public class DefaultDashboardChartsToDisplayManager
+    implements DashboardChartsToDisplayManager
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private UserSettingService userSettingService;
+
+    public void setUserSettingService( UserSettingService userSettingService )
+    {
+        this.userSettingService = userSettingService;
+    }
+
+    // -------------------------------------------------------------------------
+    // DashboardChartsToDisplayManager implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void setCurrentDashboardChartsToDisplay( String chartsToDisplay )
+    {
+        try
+        {
+            userSettingService.saveUserSetting( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY, chartsToDisplay );
+        }
+        catch ( NoCurrentUserException e )
+        {
+        }
+    }
+
+    @Override
+    public String getCurrentDashboardChartsToDisplay()
+    {
+        return (String) userSettingService.getUserSetting( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY,
+            DASHBOARD_CHARTS_TO_DISPLAY_4 );
+    }
+
+    @Override
+    public List<String> getDashboardChartsToDisplay()
+    {
+        List<String> list = new ArrayList<String>();
+
+        list.add( DASHBOARD_CHARTS_TO_DISPLAY_4 );
+        list.add( DASHBOARD_CHARTS_TO_DISPLAY_6 );
+        list.add( DASHBOARD_CHARTS_TO_DISPLAY_8 );
+
+        return list;
+    }
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml	2011-04-02 09:48:38 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/resources/META-INF/dhis/beans.xml	2011-04-05 18:10:58 +0000
@@ -218,5 +218,11 @@
   
   <bean id="org.hisp.dhis.options.help.HelpManager"
 	class="org.hisp.dhis.options.help.DefaultHelpManager"/>
+
+  <bean id="org.hisp.dhis.options.charts.DashboardChartsToDisplayManager"
+	class="org.hisp.dhis.options.charts.DefaultDashboardChartsToDisplayManager">
+	<property name="userSettingService"
+      ref="org.hisp.dhis.user.UserSettingService"/>
+  </bean>
   
 </beans>

=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/UserSettingInterceptor.java	2011-04-05 18:10:58 +0000
@@ -0,0 +1,83 @@
+package org.hisp.dhis.interceptor;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hisp.dhis.user.UserSettingService;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.Interceptor;
+
+/**
+ * @author mortenoh
+ */
+public class UserSettingInterceptor
+    implements Interceptor
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private UserSettingService userSettingService;
+
+    public void setUserSettingService( UserSettingService userSettingService )
+    {
+        this.userSettingService = userSettingService;
+    }
+
+    // -------------------------------------------------------------------------
+    // UserSettingInterceptor implementation
+    // -------------------------------------------------------------------------
+
+    private static final long serialVersionUID = -3123337448714959530L;
+
+    public void destroy()
+    {
+    }
+
+    public void init()
+    {
+    }
+
+    public String intercept( ActionInvocation invocation )
+        throws Exception
+    {
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        Integer chartsToDisplay = Integer.valueOf( (String) userSettingService.getUserSetting(
+            UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY, "4" ) );
+
+        map.put( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY, chartsToDisplay );
+
+        invocation.getStack().push( map );
+
+        return invocation.invoke();
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-04-01 19:47:09 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-04-05 18:10:58 +0000
@@ -478,6 +478,10 @@
 		<property name="databaseInfoProvider" ref="databaseInfoProvider" />
 	</bean>
 
+	<bean id="org.hisp.dhis.interceptor.UserSettingInterceptor" class="org.hisp.dhis.interceptor.UserSettingInterceptor">
+	    <property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
+	</bean>
+
 	<bean id="org.hisp.dhis.useraccount.action.GetCurrentUserAction" class="org.hisp.dhis.useraccount.action.GetCurrentUserAction" scope="prototype">
 		<property name="currentUserService">
 			<ref bean="org.hisp.dhis.user.CurrentUserService" />

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2011-03-29 21:28:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2011-04-05 18:10:58 +0000
@@ -54,6 +54,8 @@
 				class="org.hisp.dhis.interceptor.DisplayPropertyInterceptor" />
 			<interceptor name="systemSettingInterceptor"
 				class="org.hisp.dhis.interceptor.SystemSettingInterceptor" />
+			<interceptor name="userSettingInterceptor"
+				class="org.hisp.dhis.interceptor.UserSettingInterceptor" />
 			<interceptor name="styleInterceptor"
 				class="org.hisp.dhis.interceptor.StyleInterceptor" />
 			<interceptor name="contextInterceptor"
@@ -89,6 +91,7 @@
 				<interceptor-ref name="sortOrderInterceptor" />
 				<interceptor-ref name="displayPropertyInterceptor" />
 				<interceptor-ref name="systemSettingInterceptor" />
+				<interceptor-ref name="userSettingInterceptor" />
 				<interceptor-ref name="styleInterceptor" />
 				<interceptor-ref name="contextInterceptor"/>
 				<interceptor-ref name="portalParamsInterceptor" />

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-03-24 02:10:56 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-04-05 18:10:58 +0000
@@ -37,6 +37,7 @@
 import org.hisp.dhis.chart.ChartService;
 import org.hisp.dhis.chart.comparator.ChartTitleComparator;
 import org.hisp.dhis.dashboard.DashboardManager;
+import org.hisp.dhis.user.UserSettingService;
 
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
@@ -58,14 +59,14 @@
     {
         this.manager = manager;
     }
-    
+
     private ChartService chartService;
 
     public void setChartService( ChartService chartService )
     {
         this.chartService = chartService;
     }
-    
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -76,13 +77,25 @@
     {
         return providerNames;
     }
-    
+
     private List<Chart> charts;
 
     public List<Chart> getCharts()
     {
         return charts;
     }
+
+    private List<Object> chartAreas = new ArrayList<Object>();
+
+    public void setChartAreas( List<Object> chartAreas )
+    {
+        this.chartAreas = chartAreas;
+    }
+
+    public List<Object> getChartAreas()
+    {
+        return chartAreas;
+    }
     
     // -------------------------------------------------------------------------
     // Action implementation
@@ -91,15 +104,26 @@
     public String execute()
     {
         Map<String, Object> content = manager.getContent();
-        
+
         ActionContext.getContext().getActionInvocation().getStack().push( content );
-        
+
         providerNames = manager.getContentProviderNames();
-        
+
         charts = new ArrayList<Chart>( chartService.getAllCharts() );
-        
+
         Collections.sort( charts, new ChartTitleComparator() );
-        
+
+        Object keyDashboardChartsToDisplay = ActionContext.getContext().getActionInvocation().getStack()
+            .findString( UserSettingService.KEY_DASHBOARD_CHARTS_TO_DISPLAY );
+
+        Integer dashboardChartsCount = keyDashboardChartsToDisplay != null ? Integer
+            .valueOf( (String) keyDashboardChartsToDisplay ) : 4;
+
+        for ( int i = 1; i <= dashboardChartsCount; i++ )
+        {
+            chartAreas.add( content.get( "chartArea" + i ) );
+        }
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2011-04-05 18:10:58 +0000
@@ -33,7 +33,7 @@
         #end
         </ul>
     </div>
-    #if ( $chartId )        
+    #if ( $chartId )
         <img style="cursor:pointer" src="getChart.action?id=${chartId}" 
             onclick="viewChart( 'getChart.action?id=${chartId}&width=700&height=500' )">
     #else
@@ -56,21 +56,25 @@
         #dropDownButtonDiv( "dropDownC" "areaC" )
         #linkDropDownListDiv( "areaC" "dropDownC" $areaC )      
     </td>
-    <td style="width:20px"></td>
-    <td style="width:305px">        
-        #dropDownButtonDiv( "chartDropDownA" "chartAreaA" )
-        #chartDropDownListDiv( "chartAreaA" "chartDropDownA" $chartAreaA )
-        
-        #dropDownButtonDiv( "chartDropDownB" "chartAreaB" )
-        #chartDropDownListDiv( "chartAreaB" "chartDropDownB" $chartAreaB )        
-    </td>
-    <td style="width:20px"></td>
-    <td style="width:305px">        
-        #dropDownButtonDiv( "chartDropDownC" "chartAreaC" )
-        #chartDropDownListDiv( "chartAreaC" "chartDropDownC" $chartAreaC )
-        
-        #dropDownButtonDiv( "chartDropDownD" "chartAreaD" )
-        #chartDropDownListDiv( "chartAreaD" "chartDropDownD" $chartAreaD )        
-    </td>
+	<td>
+
+<table style="margin-left: 20px;">
+#set( $sizeHalf = $chartAreas.size() / 2 )
+
+#foreach( $chart in $chartAreas )
+#set( $count0 = $velocityCount - 1 )
+#set( $startHr = ($count0 % $sizeHalf) == 0 )
+#set( $endHr =  ($count0 % $sizeHalf) == ($sizeHalf - 1) )
+
+#if($startHr) <tr> #end
+	<td style="width:305px;">
+		#dropDownButtonDiv( "chartDropDown$velocityCount" "chartArea$velocityCount" )
+		#chartDropDownListDiv( "chartArea$velocityCount" "chartDropDown$velocityCount" $chart )
+	</td>
+#end
+#if($endHr) </tr> #end
+</table>
+
+	</td>
 </tr>
 </table>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetAvailableDashboardChartsToDisplayAction.java	2011-04-05 18:10:58 +0000
@@ -0,0 +1,70 @@
+package org.hisp.dhis.settings.action.user;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.List;
+
+import org.hisp.dhis.options.charts.DashboardChartsToDisplayManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetAvailableDashboardChartsToDisplayAction
+    implements Action
+{
+    private DashboardChartsToDisplayManager dashboardChartsToDisplayManager;
+
+    public void setDashboardChartsToDisplayManager( DashboardChartsToDisplayManager dashboardChartsToDisplayManager )
+    {
+        this.dashboardChartsToDisplayManager = dashboardChartsToDisplayManager;
+    }
+
+    private String currentDashboardChartsToDisplay;
+
+    public String getCurrentDashboardChartsToDisplay()
+    {
+        return currentDashboardChartsToDisplay;
+    }
+
+    private List<String> dashboardChartsToDisplay;
+
+    public List<String> getDashboardChartsToDisplay()
+    {
+        return dashboardChartsToDisplay;
+    }
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        dashboardChartsToDisplay = dashboardChartsToDisplayManager.getDashboardChartsToDisplay();
+
+        currentDashboardChartsToDisplay = dashboardChartsToDisplayManager.getCurrentDashboardChartsToDisplay();
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetCurrentDashboardChartsToDisplayAction.java	2011-04-05 18:10:58 +0000
@@ -0,0 +1,59 @@
+package org.hisp.dhis.settings.action.user;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.options.charts.DashboardChartsToDisplayManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class SetCurrentDashboardChartsToDisplayAction
+    implements Action
+{
+    private DashboardChartsToDisplayManager dashboardChartsToDisplayManager;
+
+    public void setDashboardChartsToDisplayManager( DashboardChartsToDisplayManager dashboardChartsToDisplayManager )
+    {
+        this.dashboardChartsToDisplayManager = dashboardChartsToDisplayManager;
+    }
+
+    private String currentDashboardChartsToDisplay;
+
+    public void setCurrentDashboardChartsToDisplay( String currentDashboardChartsToDisplay )
+    {
+        this.currentDashboardChartsToDisplay = currentDashboardChartsToDisplay;
+    }
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        dashboardChartsToDisplayManager.setCurrentDashboardChartsToDisplay( currentDashboardChartsToDisplay );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-04-05 18:10:58 +0000
@@ -63,6 +63,14 @@
     </property>
   </bean>
 
+  <bean id="org.hisp.dhis.settings.action.user.GetAvailableDashboardChartsToDisplayAction"
+    class="org.hisp.dhis.settings.action.user.GetAvailableDashboardChartsToDisplayAction" 
+    scope="prototype">
+    <property name="dashboardChartsToDisplayManager">
+      <ref bean="org.hisp.dhis.options.charts.DashboardChartsToDisplayManager"/>
+    </property>
+  </bean>
+
   <bean id="org.hisp.dhis.settings.action.user.GetAvailableDisplayPropertiesAction"
     class="org.hisp.dhis.settings.action.user.GetAvailableDisplayPropertiesAction" 
     scope="prototype">
@@ -114,6 +122,14 @@
     </property>
   </bean>
 
+  <bean id="org.hisp.dhis.settings.action.user.SetCurrentDashboardChartsToDisplayAction"
+    class="org.hisp.dhis.settings.action.user.SetCurrentDashboardChartsToDisplayAction" 
+    scope="prototype">
+    <property name="dashboardChartsToDisplayManager">
+      <ref bean="org.hisp.dhis.options.charts.DashboardChartsToDisplayManager"/>
+    </property>
+  </bean>
+
   <bean id="org.hisp.dhis.settings.action.user.SetCurrentDisplayPropertyAction"
     class="org.hisp.dhis.settings.action.user.SetCurrentDisplayPropertyAction"
     scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2011-04-04 17:23:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2011-04-05 18:10:58 +0000
@@ -5,6 +5,7 @@
 display_property = Display Property
 language = Interface Language
 sort_order = Sort Order
+dashboard_charts_to_display = Dashboard Charts to Display
 code = Code
 system_settings = System settings
 shortname = Short name

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2011-01-19 08:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2011-04-05 18:10:58 +0000
@@ -39,6 +39,10 @@
     </action>
 
     <action name="getAvailableSortOrders" class="org.hisp.dhis.settings.action.user.GetAvailableSortOrdersAction">
+      <result name="success" type="chain">getAvailableDashboardChartsToDisplay</result>
+    </action>
+
+    <action name="getAvailableDashboardChartsToDisplay" class="org.hisp.dhis.settings.action.user.GetAvailableDashboardChartsToDisplayAction">
       <result name="success" type="chain">getAvailableDisplayProperties</result>
     </action>
 
@@ -68,6 +72,10 @@
       <result name="success" type="redirect">userSettings.action</result>
     </action>
 
+    <action name="setCurrentDashboardChartsToDisplay" class="org.hisp.dhis.settings.action.user.SetCurrentDashboardChartsToDisplayAction">
+      <result name="success" type="redirect">userSettings.action</result>
+    </action>
+
     <action name="setCurrentDisplayProperty" class="org.hisp.dhis.settings.action.user.SetCurrentDisplayPropertyAction">
       <result name="success" type="redirect">userSettings.action</result>
     </action>    

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm	2011-03-18 14:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/userSettings.vm	2011-04-05 18:10:58 +0000
@@ -34,6 +34,12 @@
 		var style = list.options[list.selectedIndex].value;
 		window.location.href = "setCurrentStyle.action?currentStyle=" + style;
 	}
+
+	function dashboardChartsToDisplayChanged( list )
+	{
+		var listValue = list.options[list.selectedIndex].value;
+		window.location.href = "setCurrentDashboardChartsToDisplay.action?currentDashboardChartsToDisplay=" + listValue;
+	}
 </script>
 
 <form>
@@ -79,6 +85,14 @@
 #end
 </select>
 
+<h4>$i18n.getString( "dashboard_charts_to_display" )</h4>
+
+<select onchange="dashboardChartsToDisplayChanged( this )" style="min-width:250px">
+#foreach( $charts in $dashboardChartsToDisplay )
+	<option value="$charts" #if($charts == $currentDashboardChartsToDisplay) selected="selected"#end>$charts</option>
+#end
+</select>
+
 <h4>$i18n.getString( "auto_save_data_entry_form" )</h4>
 <input type="checkbox" #if($autoSave == 'true') checked #end onchange="autoSaveDataEntryForm(this.checked);"/>