← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11504: Impl new dashboard. Supports multiple dashboards per user. Lets you insert dashboard items direct...

 

------------------------------------------------------------
revno: 11504
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-07-24 17:58:43 +0200
message:
  Impl new dashboard. Supports multiple dashboards per user. Lets you insert dashboard items directly from search field. Supports maps in dashboard.
removed:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ClearAreaAction.java
  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/RemoveDocumentAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveMapViewAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportTableAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SetAreaItemAction.java
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js
  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/style/dashboard.css


--
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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css	2013-07-18 10:20:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css	2013-07-24 15:58:43 +0000
@@ -681,7 +681,7 @@
 {
   padding: 6px 12px;
   height: 25px;
-  border: 1px solid #aaa;
+  border: 1px solid #bbb;
   border-radius: 3px;
   margin-right: 4px;
   font-family: LiberationSansBold, arial;

=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ClearAreaAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ClearAreaAction.java	2012-10-03 14:32:11 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ClearAreaAction.java	1970-01-01 00:00:00 +0000
@@ -1,78 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dashboard.DashboardManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class ClearAreaAction
-    implements Action
-{
-    private static final Log log = LogFactory.getLog( ClearAreaAction.class );
-    
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DashboardManager manager;
-    
-    public void setManager( DashboardManager manager )
-    {
-        this.manager = manager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private String area;
-
-    public void setArea( String area )
-    {
-        this.area = area;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        manager.clearArea( area );
-        
-        log.info( "Cleared area '" + area + "'" );
-        
-        return SUCCESS;
-    }
-}

=== removed 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	2013-05-21 11:39:31 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	1970-01-01 00:00:00 +0000
@@ -1,171 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.chart.Chart;
-import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.dashboard.DashboardManager;
-import org.hisp.dhis.hibernate.exception.ReadAccessDeniedException;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-
-import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ActionContext;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class ProvideContentAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DashboardManager manager;
-
-    public void setManager( DashboardManager manager )
-    {
-        this.manager = manager;
-    }
-
-    private ChartService chartService;
-
-    public void setChartService( ChartService chartService )
-    {
-        this.chartService = chartService;
-    }
-    
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Integer noCharts;
-
-    public void setNoCharts( Integer noCharts )
-    {
-        this.noCharts = noCharts;
-    }
-
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private Collection<String> providerNames;
-
-    public Collection<String> getProviderNames()
-    {
-        return providerNames;
-    }
-
-    private List<Chart> charts;
-
-    public List<Chart> getCharts()
-    {
-        return charts;
-    }
-
-    private List<Chart> chartAreas = new ArrayList<Chart>();
-
-    public List<Chart> getChartAreas()
-    {
-        return chartAreas;
-    }
-    
-    private OrganisationUnit organisationUnit;
-
-    public OrganisationUnit getOrganisationUnit()
-    {
-        return organisationUnit;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    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, IdentifiableObjectNameComparator.INSTANCE );
-
-        noCharts = noCharts == null ? 6 : noCharts;
-
-        for ( int i = 1; i <= noCharts; i++ )
-        {
-            Object id = content.get( DashboardManager.CHART_AREA_PREFIX + i );
-
-            Chart chart = null;
-            
-            if ( id != null )
-            {
-                try
-                {
-                    chart = chartService.getChart( Integer.valueOf( String.valueOf( id ) ) );
-                }
-                catch ( ReadAccessDeniedException ex )
-                {
-                    // Chart has been made private, do nothing and continue
-                }
-            }
-            
-            chartAreas.add( chart );
-        }
-        
-        User user = currentUserService.getCurrentUser();
-
-        if ( user != null )
-        {
-            organisationUnit = user.getOrganisationUnit();
-        }
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveDocumentAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveDocumentAction.java	2013-07-22 17:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveDocumentAction.java	1970-01-01 00:00:00 +0000
@@ -1,101 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.dashboard.DashboardContent;
-import org.hisp.dhis.dashboard.DashboardManager;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.document.DocumentService;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class RemoveDocumentAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    
-    private CurrentUserService currentUserService;
-    
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    @Autowired
-    private DashboardManager dashboardManager;
-    
-    private DocumentService documentService;
-
-    public void setDocumentService( DocumentService documentService )
-    {
-        this.documentService = documentService;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Integer id;
-
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        User user = currentUserService.getCurrentUser();
-        
-        if ( user != null )
-        {
-            DashboardContent content = dashboardManager.getDashboardContent( user );
-            
-            Document document = documentService.getDocument( id );
-            
-            if ( content.getDocuments().remove( document ) )
-            {
-                dashboardManager.saveDashboardContent( content );
-            }
-        }
-        
-        return SUCCESS;
-    }
-}
-

=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveMapViewAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveMapViewAction.java	2013-07-22 17:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveMapViewAction.java	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.dashboard.DashboardContent;
-import org.hisp.dhis.dashboard.DashboardManager;
-import org.hisp.dhis.mapping.Map;
-import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class RemoveMapViewAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    
-    private CurrentUserService currentUserService;
-    
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    @Autowired
-    private DashboardManager dashboardManager;
-    
-    private MappingService mappingService;
-
-    public void setMappingService( MappingService mappingService )
-    {
-        this.mappingService = mappingService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Integer id;
-
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        User user = currentUserService.getCurrentUser();
-        
-        if ( user != null )
-        {
-            DashboardContent content = dashboardManager.getDashboardContent( user );
-            
-            Map map = mappingService.getMap( id );
-            
-            if ( content.getMaps().remove( map ) )
-            {
-                dashboardManager.saveDashboardContent( content );
-            }
-        }
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportAction.java	2013-07-22 17:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportAction.java	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.dashboard.DashboardContent;
-import org.hisp.dhis.dashboard.DashboardManager;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.report.ReportService;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class RemoveReportAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    @Autowired
-    private DashboardManager dashboardManager;
-    
-    private ReportService reportService;
-
-    public void setReportService( ReportService reportService )
-    {
-        this.reportService = reportService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Integer id;
-
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        User user = currentUserService.getCurrentUser();
-        
-        if ( user != null )
-        {
-            DashboardContent content = dashboardManager.getDashboardContent( user );
-            
-            Report report = reportService.getReport( id );
-            
-            if ( content.getReports().remove( report ) )
-            {
-                dashboardManager.saveDashboardContent( content );
-            }            
-        }
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportTableAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportTableAction.java	2013-07-22 17:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/RemoveReportTableAction.java	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.dashboard.DashboardContent;
-import org.hisp.dhis.dashboard.DashboardManager;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.reporttable.ReportTableService;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class RemoveReportTableAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    @Autowired
-    private DashboardManager dashboardManager;
-    
-    private ReportTableService reportTableService;
-
-    public void setReportTableService( ReportTableService reportTableService )
-    {
-        this.reportTableService = reportTableService;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Integer id;
-
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {    
-        User user = currentUserService.getCurrentUser();
-        
-        if ( user != null )
-        {
-            DashboardContent content = dashboardManager.getDashboardContent( user );
-            
-            ReportTable table = reportTableService.getReportTable( id );
-            
-            if ( content.getReportTables().remove( table ) )
-            {
-                dashboardManager.saveDashboardContent( content );
-            }            
-        }
-        
-        return SUCCESS;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SetAreaItemAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SetAreaItemAction.java	2012-10-03 14:32:11 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/SetAreaItemAction.java	1970-01-01 00:00:00 +0000
@@ -1,85 +0,0 @@
-package org.hisp.dhis.dashboard.action;
-
-/*
- * Copyright (c) 2004-2012, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dashboard.DashboardManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class SetAreaItemAction
-    implements Action
-{
-    private static final Log log = LogFactory.getLog( SetAreaItemAction.class );
-    
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DashboardManager manager;
-    
-    public void setManager( DashboardManager manager )
-    {
-        this.manager = manager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private String area;
-
-    public void setArea( String area )
-    {
-        this.area = area;
-    }
-
-    private String item;
-
-    public void setItem( String item )
-    {
-        this.item = item;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        manager.setAreaItem( area, item );
-        
-        log.info( "Sat item '" + item + "' on area '" + area + "'" );
-        
-        return SUCCESS;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2013-07-22 17:46:51 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2013-07-24 15:58:43 +0000
@@ -9,47 +9,6 @@
     <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
 	<property name="interpretationService" ref="org.hisp.dhis.interpretation.InterpretationService" />	
   </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.ProvideContentAction" class="org.hisp.dhis.dashboard.action.ProvideContentAction"
-    scope="prototype">
-    <property name="manager" ref="org.hisp.dhis.dashboard.DashboardManager" />
-    <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.SetAreaItemAction" class="org.hisp.dhis.dashboard.action.SetAreaItemAction"
-    scope="prototype">
-    <property name="manager" ref="org.hisp.dhis.dashboard.DashboardManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.ClearAreaAction" class="org.hisp.dhis.dashboard.action.ClearAreaAction"
-    scope="prototype">
-    <property name="manager" ref="org.hisp.dhis.dashboard.DashboardManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.RemoveReportAction" class="org.hisp.dhis.dashboard.action.RemoveReportAction"
-    scope="prototype">
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-    <property name="reportService" ref="org.hisp.dhis.report.ReportService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.RemoveDocumentAction" class="org.hisp.dhis.dashboard.action.RemoveDocumentAction"
-    scope="prototype">
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-    <property name="documentService" ref="org.hisp.dhis.document.DocumentService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.RemoveReportTableAction" class="org.hisp.dhis.dashboard.action.RemoveReportTableAction"
-    scope="prototype">
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-    <property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
-  </bean>
-
-  <bean id="org.hisp.dhis.dashboard.action.RemoveMapViewAction" class="org.hisp.dhis.dashboard.action.RemoveMapViewAction"
-    scope="prototype">
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
-  </bean>
   
   <!-- Message -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2013-07-03 17:47:01 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2013-07-24 15:58:43 +0000
@@ -67,7 +67,7 @@
 data_visualizer=Data visualizer
 report_table=Report table
 data_set_report=Data set report
-search_for_users_charts_maps_reports=Search for users, charts, maps and reports
+search_for_users_charts_maps_reports=Search for users, charts, maps, reports and resources
 no_hits=No hits, try again
 profile=Profile
 works_as=Works as
@@ -104,4 +104,6 @@
 no_of_Users=Number of users
 user_group=User Group
 groups=Groups
-search=Search
\ No newline at end of file
+search=Search
+rename_current_dashboard=Rename current dashboard
+delete_current_dashboard=Delete current dashboard
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml	2013-07-22 15:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml	2013-07-24 15:58:43 +0000
@@ -19,44 +19,6 @@
       <param name="javascripts">javascript/dashboard.js</param>
     </action>
 
-    <action name="provideContent"
-      class="org.hisp.dhis.dashboard.action.ProvideContentAction">
-      <result name="success" type="velocity">/dhis-web-dashboard-integration/dashboard.vm
-      </result>
-    </action>
-
-    <action name="setAreaItem" class="org.hisp.dhis.dashboard.action.SetAreaItemAction">
-      <result name="success" type="velocity-xml">/dhis-web-dashboard-integration/responseSuccess.vm
-      </result>
-      <param name="onExceptionReturn">plainTextError</param>
-    </action>
-
-    <action name="clearArea" class="org.hisp.dhis.dashboard.action.ClearAreaAction">
-      <result name="success" type="velocity-xml">/dhis-web-dashboard-integration/responseSuccess.vm
-      </result>
-      <param name="onExceptionReturn">plainTextError</param>
-    </action>
-
-    <action name="removeReport"
-      class="org.hisp.dhis.dashboard.action.RemoveReportAction">
-      <result name="success" type="redirect">index.action</result>
-    </action>
-
-    <action name="removeDocument"
-      class="org.hisp.dhis.dashboard.action.RemoveDocumentAction">
-      <result name="success" type="redirect">index.action</result>
-    </action>
-
-    <action name="removeReportTable"
-      class="org.hisp.dhis.dashboard.action.RemoveReportTableAction">
-      <result name="success" type="redirect">index.action</result>
-    </action>
-
-    <action name="removeMap"
-      class="org.hisp.dhis.dashboard.action.RemoveMapViewAction">
-      <result name="success" type="redirect">index.action</result>
-    </action>
-
     <!-- Message -->
 
     <action name="message"

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2012-12-11 21:17:31 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2013-07-24 15:58:43 +0000
@@ -13,8 +13,8 @@
     <a href="javascript:hideDropDown()">$i18n.getString( "close" )</a>
     <a href="javascript:clearArea( '${areaDivId}' )">$i18n.getString( "clear" )</a>
     #if( $chart )
-    <a href="javascript:viewChart( '../api/charts/${chart.uid}/data#if( $chart.hasUserOrgUnit() )?ou=${organisationUnit.uid}#end', '${encoder.htmlEncode( $chart.name )}' )">$i18n.getString( "view_full_size" )</a>
-    <a href="javascript:viewShareForm( '${chart.uid}', '${encoder.htmlEncode( $chart.name )}' )">$i18n.getString( "share" )</a>
+    <a href="javascript:dhis2.db.viewChart( '../api/charts/${chart.uid}/data#if( $chart.hasUserOrgUnit() )?ou=${organisationUnit.uid}#end', '${encoder.htmlEncode( $chart.name )}' )">$i18n.getString( "view_full_size" )</a>
+    <a href="javascript:dhis2.db.viewShareForm( '${chart.uid}', '${encoder.htmlEncode( $chart.name )}' )">$i18n.getString( "share" )</a>
     #end
 </div>
 #end
@@ -49,8 +49,8 @@
         </ul>
     </div>
     #if ( $chart )
-        <img style="cursor:pointer" src="../api/charts/${chart.uid}/data?width=310&height=310#if( $chart.hasUserOrgUnit() )&ou=${organisationUnit.uid}#end" 
-            onclick="explore( '${chart.uid}' )" title="$i18n.getString( 'click_to_explore' )">
+        <img style="cursor:pointer" src="../api/charts/${chart.uid}/data?width=405&height=300#if( $chart.hasUserOrgUnit() )&ou=${organisationUnit.uid}#end" 
+            onclick="dhis2.db.explore( '${chart.uid}' )" title="$i18n.getString( 'click_to_explore' )">
     #else
         <div class="labelText">
         	$i18n.getString( 'this_is_a_chart_area' )<br><br>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-07-22 21:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-07-24 15:58:43 +0000
@@ -1,9 +1,15 @@
 
+dhis2.util.namespace( 'dhis2.db' );
+
+dhis2.db.current;
+dhis2.db.currentShareType;
+dhis2.db.currentShareId;
+
 $( document ).ready( function()
 {
 	$( "#interpretationArea" ).autogrow();
 	
-	$( document ).click( hideSearch );
+	$( document ).click( dhis2.db.hideSearch );
 
 	$( "#searchField" ).focus( function() {
 		$( "#searchDiv" ).css( "border-color", "#999" );
@@ -12,207 +18,464 @@
 	} );
 
 	$( "#searchField" ).focus();
-	$( "#searchField" ).keyup( search );
-	
-	var viewportWidth = parseInt( $( window ).width() );
-	var linkWidth = parseInt( 334 );
-	var chartWidth = parseInt( 325 );
-	
-	if ( viewportWidth == undefined )
-	{
-		viewportWidth = parseInt( 1366 );
-	}
-	
-	var noCharts = 2 * Math.floor( ( viewportWidth - linkWidth + 4 ) / chartWidth ); 
-		
-	$( "#contentDiv" ).load( "provideContent.action?noCharts=" + noCharts + "&_dc=" + getRandomNumber() );
+	$( "#searchField" ).keyup( dhis2.db.search );
+	
+	dhis2.db.renderDashboardListLoadFirst();
 } );
 
-function setAreaItem( area, item )
-{
-    $.get( "setAreaItem.action", {
-        'area' : area,
-        'item' : item
-    }, function()
-    {
-        window.location.href = "index.action";
-    } );
-}
-
-function clearArea( area )
-{
-    $.get( "clearArea.action", {
-        'area' : area
-    }, function()
-    {
-        window.location.href = "index.action";
-    } );
-}
-
-function viewChart( url, name )
-{
-    var width = 820;
-    var height = 520;
-    var title = i18n_viewing + " " + name;
-
-    $( "#chartImage" ).attr( "src", url );
-    $( "#chartView" ).dialog( {
-        autoOpen : true,
-        modal : true,
-        height : height + 65,
-        width : width + 25,
-        resizable : false,
-        title : title
-    } );
-}
-
-function explore( uid )
-{
-	window.location.href = "../dhis-web-visualizer/app/index.html?id=" + uid;
-}
-
-function viewShareForm( uid, name )
-{	
-	$( "#interpretationChartId" ).val( uid );
-	
-	var title = i18n_share_your_interpretation_of + " " + name;
-	
-	$( "#shareForm" ).dialog( {
-		modal: true,
-		width: 550,
-		resizable: false,
-		title: title
-	} );
-}
-
-function shareInterpretation()
-{
-    var chartId = $( "#interpretationChartId" ).val();
-    var text = $( "#interpretationArea" ).val();
-    
-    if ( text.length && $.trim( text ).length )
-    {
-    	text = $.trim( text );
-    	
-	    var url = "../api/interpretations/chart/" + chartId;
-	    
-	    // TODO url += ( ou && ou.length ) ? "?ou=" + ou : "";
-	    
-	    $.ajax( url, {
-	    	type: "POST",
-	    	contentType: "text/html",
-	    	data: text,
-	    	success: function() {
-	    		$( "#shareForm" ).dialog( "close" );
-	    		$( "#interpretationArea" ).val( "" );
-	    		setHeaderDelayMessage( i18n_interpretation_was_shared );
-	    	}    	
-	    } );
-    }
-}
-
-function showShareHelp()
-{
-	$( "#shareHelpForm" ).dialog( {
-		modal: true,
-		width: 380,
-		resizable: false,
-		title: "Share your data interpretations"
-	} );
-}
-
-function search()
+//------------------------------------------------------------------------------
+// Dashboard
+//------------------------------------------------------------------------------
+
+dhis2.db.tmpl = {
+	openAddLink: "<li><a href='javascript:dhis2.db.openAddDashboardForm()'>Add new</a></li><li>" +
+	             "<a href='javascript:dhis2.db.openManageDashboardForm()'>Manage</a></li>",
+	
+	dashboardLink: "<li id='dashboard-${id}'><a href='javascript:dhis2.db.renderDashboard( \"${id}\" )'>${name}</a></li>",
+	
+	moduleIntro: "<li><div class='dasboardIntro'>Click Add new to get started</div></li>",
+	
+	dashboardIntro: "<li><div class='dasboardIntro'>Add stuff by searching from the search field above</div></li>",
+	
+	hitHeader: "<li class='hitHeader'>${title}</li>",
+	
+	hitItem: "<li><a class='viewLink' href='${link}'><img src='../images/${img}.png'>${name}</a>" +
+	         "<a class='addLink' href='javascript:dhis2.db.addItemContent( \"${type}\", \"${id}\" )'>Add</a></li>",
+		         
+	chartItem: "<li><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>Remove</a>" +
+	           "<a href='javascript:dhis2.db.viewImage( \"../api/charts/${id}/data?width=820&height=550\", \"${name}\" )'>View full size</a>" +
+	           "<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"chart\", \"${name}\" )'>Share</a></div>" +
+	           "<div class='item'><img src='../api/charts/${id}/data?width=405&height=295' onclick='dhis2.db.exploreChart( \"${id}\" )' title='Click to explore'></div></li>",
+	           
+	mapItem: "<li><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>Remove</a>" +
+	         "<a href='javascript:dhis2.db.viewImage( \"../api/maps/${id}/data?width=690\", \"${name}\" )'>View full size</a>" +
+	         "<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"map\", \"${name}\" )'>Share</a></div>" +
+		     "<div class='item'><img src='../api/maps/${id}/data?width=405' onclick='dhis2.db.exploreMap( \"${id}\" )' title='Click to explore'></div></li>"
+};
+
+dhis2.db.openAddDashboardForm = function()
+{
+	$( "#addDashboardForm" ).dialog( {
+		autoOpen: true,
+		modal: true,
+		width: 405,
+		height: 100,
+		resizable: false,
+		title: "Add new dashboard"
+	} );
+}
+
+dhis2.db.openManageDashboardForm = function()
+{
+	if ( undefined !== dhis2.db.current )
+	{
+		$.getJSON( "../api/dashboards/" + dhis2.db.current, function( data )
+		{
+			var name = data.name;
+			$( "#dashboardRename" ).val( name );
+
+			$( "#manageDashboardForm" ).dialog( {
+				autoOpen: true,
+				modal: true,
+				width: 405,
+				height: 275,
+				resizable: false,
+				title: name
+			} );
+		} );
+	}
+}
+
+dhis2.db.addDashboard = function()
+{
+	var item = '{"name": "' + $( "#dashboardName" ).val() + '"}';
+	
+	$.ajax( {
+		type: "post",
+		url: "../api/dashboards",
+		data: item,
+		contentType: "application/json",
+		success: function( data, text, xhr ) {
+			$( "#addDashboardForm" ).dialog( "destroy" );
+			$( "#dashboardName" ).val( "" );
+			dhis2.db.renderDashboardListLoadFirst();
+		}
+	} );
+}
+
+dhis2.db.renameDashboard = function()
+{
+	var name = $( "#dashboardRename" ).val();
+	
+	if ( undefined !== dhis2.db.current && undefined !== name && name.trim().length > 0 )
+	{
+		var data = "{ \"name\": \"" + name + "\"}";
+		
+		$.ajax( {
+	    	type: "put",
+	    	url: "../api/dashboards/" + dhis2.db.current,
+	    	contentType: "application/json",
+	    	data: data,
+	    	success: function() {
+	    		$( "#manageDashboardForm" ).dialog( "destroy" );
+	    		$( "#dashboardRename" ).val( "" );
+	    		dhis2.db.renderDashboardListLoadFirst();
+	    	}
+	    } );
+	}
+}
+
+dhis2.db.removeDashboard = function()
+{
+	if ( undefined !== dhis2.db.current )
+	{
+		$.ajax( {
+			type: "delete",
+			url: "../api/dashboards/" + dhis2.db.current,
+	    	success: function() {
+	    		$( "#manageDashboardForm" ).dialog( "destroy" );
+	    		dhis2.db.renderDashboardListLoadFirst();
+	    	}
+		} );
+	}
+}
+
+dhis2.db.renderDashboardListLoadFirst = function()
+{
+	var $l = $( "#dashboardList" );
+	
+	$l.empty().append( dhis2.db.tmpl.openAddLink );
+	
+	$.getJSON( "../api/dashboards.json?paging=false&links=false", function( data )
+	{
+		if ( undefined !== data.dashboards )
+		{
+			var first;
+			
+			$.each( data.dashboards, function( index, dashboard )
+			{
+				$l.append( $.tmpl( dhis2.db.tmpl.dashboardLink, { "id": dashboard.id, "name": dashboard.name } ) );
+	
+				if ( index == 0 )
+				{
+					first = dashboard.id;
+				}
+			} );
+
+			if ( undefined == dhis2.db.current )
+			{
+				dhis2.db.current = first;
+			}
+			
+			dhis2.db.renderDashboard( dhis2.db.current );
+		}
+		else
+		{
+			dhis2.db.clearDashboard();
+			$( "#contentList" ).append( $.tmpl( dhis2.db.tmpl.moduleIntro ) );			
+		}
+	} );
+}
+
+dhis2.db.clearDashboard = function()
+{
+	$d = $( "#contentList" ).empty();
+}
+
+dhis2.db.renderDashboard = function( id )
+{
+	$( "#dashboard-" + dhis2.db.current ).removeClass( "currentDashboard" );
+	
+	dhis2.db.current = id;
+	
+	$( "#dashboard-" + dhis2.db.current ).addClass( "currentDashboard" );
+	
+	$d = $( "#contentList" ).empty();
+	
+	$.getJSON( "../api/dashboards/" + id, function( data )
+	{
+		if ( undefined !== data.items )
+		{
+			$.each( data.items, function( index, item )
+			{
+				if ( "chart" == item.type )
+				{
+					$d.append( $.tmpl( dhis2.db.tmpl.chartItem, { "itemId": item.id, "id": item.chart.id, "name": item.chart.name } ) )
+				}
+				else if ( "map" == item.type )
+				{
+					$d.append( $.tmpl( dhis2.db.tmpl.mapItem, { "itemId": item.id, "id": item.map.id, "name": item.map.name } ) )
+				}
+				else if ( "users" == item.type )
+				{
+					dhis2.db.renderLinkItem( $d, item.id, item.users, "Users" );
+				}
+				else if ( "reportTables" == item.type )
+				{
+					dhis2.db.renderLinkItem( $d, item.id, item.reportTables, "Pivot tables" );
+				}
+				else if ( "reports" == item.type )
+				{
+					dhis2.db.renderLinkItem( $d, item.id, item.reports, "Reports" );
+				}
+				else if ( "resources" == item.type )
+				{
+					dhis2.db.renderLinkItem( $d, item.id, item.resources, "Resources" );
+				}
+			} );
+		}
+		else
+		{
+			$d.append( $.tmpl( dhis2.db.tmpl.dashboardIntro ) );
+		}
+	} );
+}
+
+dhis2.db.renderLinkItem = function( $d, itemId, contents, title )
+{
+	var html = 
+		"<li><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"" + itemId + "\" )'>Remove</a></div>" +
+		"<div class='item'><ul class='itemList'><li class='itemTitle'>" + title + "</li>";
+	
+	$.each( contents, function( index, content )
+	{
+		html += 
+			"<li><a href=''>" + content.name + "</a><a class='removeItemLink' href='javascript:dhis2.db.removeItemContent( \"" + itemId + "\", \"" + content.id + "\" )' title='Remove'>" + 
+			"<img src='../images/hide.png'></a></li>";
+	} );
+	
+	html += "</ul></div></li>";
+	
+	$d.append( html );
+}
+
+dhis2.db.addItemContent = function( type, id )
+{
+	if ( undefined !== dhis2.db.current )
+	{
+		$.ajax( {
+	    	type: "post",
+	    	url: "../api/dashboards/" + dhis2.db.current + "/items/content",
+	    	data: {
+	    		type: type,
+	    		id: id
+	    	},
+	    	success: function() {
+	    		dhis2.db.renderDashboard( dhis2.db.current );
+	    	}
+	    } );
+	}
+}
+
+dhis2.db.removeItem = function( id )
+{
+	$.ajax( {
+    	type: "delete",
+    	url: "../api/dashboards/" + dhis2.db.current + "/items/" + id,
+    	success: function() {
+    		dhis2.db.renderDashboard( dhis2.db.current );
+    	}
+    } );
+}
+
+dhis2.db.removeItemContent = function( itemId, contentId )
+{
+	$.ajax( {
+    	type: "delete",
+    	url: "../api/dashboards/" + dhis2.db.current + "/items/" + itemId + "/content/" + contentId,
+    	success: function() {
+    		dhis2.db.renderDashboard( dhis2.db.current );
+    	}
+    } );
+}
+
+//------------------------------------------------------------------------------
+// Search
+//------------------------------------------------------------------------------
+
+dhis2.db.search = function()
 {
 	var query = $.trim( $( "#searchField" ).val() );
 	
 	if ( query.length == 0 )
 	{
-		hideSearch();
+		dhis2.db.hideSearch();
 		return false;
 	}
 	
 	var hits = $.get( "../api/dashboards/q/" + query, function( data ) {
-		$( "#hitDiv" ).show().html( getSearchResultList( data ) );		
+		var $h = $( "#hitDiv" );
+		dhis2.db.renderSearch( data, $h );
+		$h.show();
 	} );		
 }
 
-function getSearchResultList( data )
+dhis2.db.renderSearch = function( data, $h )
 {
-	var html = "<ul>";
+	$h.empty().append( "<ul>" );
 	
 	if ( data.searchCount > 0 )
 	{
 		if ( data.userCount > 0 )
 		{
-			html += "<li class='hitHeader'>Users</li>";			
+			$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Users" } ) );
+			
 			for ( var i in data.users )
 			{
 				var o = data.users[i];
-				html += "<li><a href='profile.action?id=" + o.id + "'><img src='../images/user_small.png'>" + o.name + "</a></li>";
+				$h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "profile.action?id=" + o.id, "img": "user_small", "name": o.name, "type": "users", "id": o.id } ) );
 			}
 		}
 		
 		if ( data.chartCount > 0 )
 		{
-			html += "<li class='hitHeader'>Charts</li>";
+			$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Charts" } ) );
+			
 			for ( var i in data.charts )
 			{
 				var o = data.charts[i];
-				html += "<li><a href='../dhis-web-visualizer/app/index.html?id=" + o.id + "'><img src='../images/chart_small.png'>" + o.name + "</a></li>";
+				$h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-visualizer/app/index.html?id=" + o.id, "img": "chart_small", "name": o.name, "type": "chart", "id": o.id } ) );
 			}
 		}
 		
 		if ( data.mapCount > 0 )
 		{
-			html += "<li class='hitHeader'>Maps</li>";
+			$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Maps" } ) );
+			
 			for ( var i in data.maps )
 			{
 				var o = data.maps[i];
-				html += "<li><a href='../dhis-web-mapping/app/index.html?id=" + o.id + "'><img src='../images/map_small.png'>" + o.name + "</a></li>";
+				$h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-mapping/app/index.html?id=" + o.id, "img": "map_small", "name": o.name, "type": "map", "id": o.id } ) );
 			}
 		}
 		
 		if ( data.reportTableCount > 0 )
 		{
-			html += "<li class='hitHeader'>Pivot tables</li>";
+			$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Pivot tables" } ) );
+			
 			for ( var i in data.reportTables )
 			{
 				var o = data.reportTables[i];
-				html += "<li><a href='../dhis-web-pivot/app/index.html?id=" + o.id + "'><img src='../images/table_small.png'>" + o.name + "</a></li>";
+				$h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-pivot/app/index.html?id=" + o.id, "img": "table_small", "name": o.name, "type": "reportTables", "id": o.id } ) );
 			}
 		}
 		
 		if ( data.reportCount > 0 )
 		{
-			html += "<li class='hitHeader'>Standard reports</li>";
+			$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Standard reports" } ) );
+			
 			for ( var i in data.reports )
 			{
 				var o = data.reports[i];
-				html += "<li><a href='../dhis-web-reporting/getReportParams.action?uid=" + o.id + "&mode=report'><img src='../images/standard_report_small.png'>" + o.name + "</a></li>";
+				$h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../dhis-web-reporting/getReportParams.action?uid=" + o.id, "img": "standard_report_small", "name": o.name, "type": "reports", "id": o.id } ) );
 			}
 		}
 		
 		if ( data.resourceCount > 0 )
 		{
-			html += "<li class='hitHeader'>Resources</li>";
+			$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "Resources" } ) );
+			
 			for ( var i in data.resources )
 			{
 				var o = data.resources[i];
-				html += "<li><a href='../api/documents/" + o.id + "/data'><img src='../images/document_small.png'>" + o.name + "</a></li>";
+				$h.append( $.tmpl( dhis2.db.tmpl.hitItem, { "link": "../api/documents/" + o.id, "img": "document_small", "name": o.name, "type": "resources", "id": o.id } ) );
 			}
 		}
 	}
 	else
 	{
-		html += "<li class='hitHeader'>No results found</li>";
+		$h.append( $.tmpl( dhis2.db.tmpl.hitHeader, { "title": "No results found" } ) );
 	}
-	
-	html += "</ul>";
-	
-	return html;
 }
 
-function hideSearch()
+dhis2.db.hideSearch = function()
 {
 	$( "#hitDiv" ).hide();
 }
+
+//------------------------------------------------------------------------------
+// Share
+//------------------------------------------------------------------------------
+
+dhis2.db.viewShareForm = function( id, type, name )
+{	
+	dhis2.db.currentShareId = id;
+	dhis2.db.currentShareType = type;
+	
+	var title = i18n_share_your_interpretation_of + " " + name;
+	
+	$( "#shareForm" ).dialog( {
+		modal: true,
+		width: 550,
+		resizable: false,
+		title: title
+	} );
+}
+
+dhis2.db.shareInterpretation = function()
+{
+  var text = $( "#interpretationArea" ).val();
+  
+  if ( text.length && $.trim( text ).length )
+  {
+  	text = $.trim( text );
+  	
+	    var url = "../api/interpretations/" + dhis2.db.currentShareType + "/" + dhis2.db.currentShareId;
+	    
+	    // TODO url += ( ou && ou.length ) ? "?ou=" + ou : "";
+	    
+	    $.ajax( {
+	    	type: "post",
+	    	url: url,
+	    	contentType: "text/html",
+	    	data: text,
+	    	success: function() {
+	    		$( "#shareForm" ).dialog( "close" );
+	    		$( "#interpretationArea" ).val( "" );
+	    		setHeaderDelayMessage( i18n_interpretation_was_shared );
+	    	}    	
+	    } );
+  }
+}
+
+dhis2.db.showShareHelp = function()
+{
+	$( "#shareHelpForm" ).dialog( {
+		modal: true,
+		width: 380,
+		resizable: false,
+		title: "Share your data interpretations"
+	} );
+}
+
+//------------------------------------------------------------------------------
+// Chart
+//------------------------------------------------------------------------------
+
+dhis2.db.viewImage = function( url, name )
+{
+  var width = 820;
+  var height = 550;
+  var title = i18n_viewing + " " + name;
+
+  $( "#chartImage" ).attr( "src", url );
+  $( "#chartView" ).dialog( {
+      autoOpen : true,
+      modal : true,
+      height : height + 65,
+      width : width + 25,
+      resizable : false,
+      title : title
+  } );
+}
+
+dhis2.db.exploreChart = function( uid )
+{
+	window.location.href = "../dhis-web-visualizer/app/index.html?id=" + uid;
+}
+
+dhis2.db.exploreMap = function( uid )
+{
+	window.location.href = "../dhis-web-mapping/app/index.html?id=" + uid;
+}
+

=== 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	2013-07-03 17:47:01 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2013-07-24 15:58:43 +0000
@@ -10,7 +10,7 @@
 &nbsp;&#8226;&nbsp; <a href="showSendFeedback.action">$i18n.getString( "write_feedback" )</a>
 #if( $messageCount > 0 )&nbsp;&#8226;&nbsp; <a class="alert" href="message.action">$messageCount #if( $messageCount > 1 )$i18n.getString( "unread_messages" )#else$i18n.getString( "unread_message" )#end</a> #end
 &nbsp;&#8226;&nbsp; #if( $interpretationCount > 0 )<a class="alert" href="interpretation.action">$interpretationCount #if( $interpretationCount > 1 )$i18n.getString( "new_interpretations" )#else$i18n.getString( "new_interpretation" )#end</a> 
-#else<span id="shareHelpLink" onclick="showShareHelp()">$i18n.getString( "share_interpretation" )</span>#end
+#else<span id="shareHelpLink" onclick="dhis2.db.showShareHelp()">$i18n.getString( "share_interpretation" )</span>#end
 </h3>
 
 <div id="dashboardMenu" class="horizontalMenu">
@@ -22,12 +22,20 @@
 	</ul>
 </div>
 
+<div id="dashboardListContainer" class="horizontalMenu">
+    <div id="dashboardListWrapper">
+        <ul id="dashboardList"></ul>
+    </div>
+</div>
+
 <div id="searchDiv"><input type="text" id="searchField" autocomplete="off" placeholder="$i18n.getString( 'search_for_users_charts_maps_reports' )"></div>
 <div id="hitDiv"></div>
 
-<div id="searchButton"><a class="blueButtonLink" href="javascript:search()">$i18n.getString( "search" )</a></div>
+<div id="searchButton"><a class="blueButtonLink" href="javascript:dhis2.db.search()">$i18n.getString( "search" )</a></div>
 
-<div id="contentDiv"></div>
+<div id="contentDiv">
+    <ul id="contentList" class="horizontalMenu"></ul>
+</div>
 
 <div id="chartView">
 	<img id="chartImage" src="" style="padding: 10px;"></img>
@@ -35,8 +43,7 @@
 
 <div id="shareForm">
 	<textarea id="interpretationArea" class="interpretationArea" placeholder="$i18n.getString( 'write_your_interpretation' )"></textarea>
-	<input type="button" class="interpretationButton" value="$i18n.getString( 'share' )" onclick="shareInterpretation()">
-	<input type="hidden" id="interpretationChartId">
+	<input type="button" class="interpretationButton" value="$i18n.getString( 'share' )" onclick="dhis2.db.shareInterpretation()">
 </div>
 
 <div id="shareHelpForm">
@@ -46,4 +53,18 @@
 		<li>$i18n.getString( "from" ) <a href="../dhis-web-mapping/app/">$i18n.getString( "gis" )</a>, $i18n.getString( "load_favorite_click_share" )</li>
 		<li>$i18n.getString( "from" ) <a href="../dhis-web-reporting/showDataSetReportForm.action">$i18n.getString( "data_set_report" )</a>, $i18n.getString( "generate_data_set_report_click_share" )</li>
 	</ul>
-</div>
\ No newline at end of file
+</div>
+
+<div id="addDashboardForm">
+	<label style="margin-right: 10px">$i18n.getString( "name" )</label><input type="text" id="dashboardName" style="width: 240px; padding: 5px; margin-right: 10px;">
+    <a class="greyButtonLink" href="javascript:dhis2.db.addDashboard()" style="margin-top: 1px">$i18n.getString( 'create' )</a>
+</div>
+
+<div id="manageDashboardForm" class="page">
+	<h4>$i18n.getString( "rename_current_dashboard" )</h4>
+	<div><label style="margin-right: 10px">$i18n.getString( "name" )</label><input type="text" id="dashboardRename" style="width: 230px; padding: 5px; margin-right: 10px;">
+    <a class="greyButtonLink" href="javascript:dhis2.db.renameDashboard()" style="margin-top: 1px">$i18n.getString( "rename" )</a></div>
+	<h4>$i18n.getString( "delete_current_dashboard" )</h4>
+	<div><a class="greyButtonLink" href="javascript:dhis2.db.removeDashboard()">$i18n.getString( "delete" )</a></div>
+</div>
+

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2013-07-22 15:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2013-07-24 15:58:43 +0000
@@ -18,7 +18,12 @@
 #contentDiv
 {
   position: relative;
-  top: 46px;
+  top: 95px;
+}
+
+#contentList
+{
+  list-style-type: none;
 }
 
 .removeIcon
@@ -42,17 +47,6 @@
   position: absolute;
 }
 
-.chartArea
-{
-  border: 1px solid #d0d0d0;
-  padding: 1px;
-  height: 310px;
-  width: 310px;
-  overflow: hidden;
-  margin-bottom: 15px;
-  border-radius: 3px;
-}
-
 .chartArea div
 {
   position: absolute;
@@ -77,6 +71,43 @@
   margin-top: 6px;
 }
 
+#dashboardListContainer
+{
+  position: absolute;
+  left: 20px;
+  right: 20px;
+  margin-top: 45px;
+}
+
+#dashboardListWrapper
+{
+  position: relative;
+  width: auto;
+  height: 29px;
+  background-color: #fafafa;
+  border: 1px solid #d0d0d0;
+  border-radius: 3px;
+  padding: 0;
+}
+
+#dashboardList li
+{
+  border-right: 1px solid #d0d0d0;
+  padding: 7px 14px 6px 14px;
+}
+
+.dasboardIntro
+{
+  padding: 30px 140px;
+  font-size: 28px;
+  color: #bbb;
+}
+
+.currentDashboard
+{
+  background-color: #eee;
+} 
+
 .horizontalMenu ul
 {
   list-style-type: none;
@@ -88,6 +119,51 @@
   float: left;
 }
 
+.item
+{
+  border: 1px solid #d0d0d0;
+  width: 405px;
+  height: 310px;
+  padding: 6px;
+  margin: 0 19px 19px 0;
+  border-radius: 3px;
+  cursor: pointer;
+}
+
+.itemHeader
+{
+  margin: 0 0 2px 2px;
+}
+
+.itemHeader a
+{
+  margin-right: 6px;
+}
+
+.itemList
+{
+  display: inline;
+}
+
+.itemList li
+{
+  float: none;
+  padding: 8px 10px;
+  border-bottom: 1px solid #ddd;
+}
+
+.itemTitle
+{
+  font-family: 'LiberationSansBold';
+  color: #336C8B;
+}
+
+.removeItemLink
+{
+  float: right;
+  display: inline-block;
+}
+
 #searchDiv
 {
   position: absolute;
@@ -135,22 +211,30 @@
   box-shadow: #ccc 0px 1px 2px 0px;
 }
 
-#hitDiv ul
-{
+#hitDiv li
+{ 
   list-style-type: none;
 }
 
-#hitDiv a
-{
-  display: block;
-  padding: 7px 6px 7px 12px;
-}
-
 #hitDiv img
 {
   margin-right: 7px;
 }
 
+#hitDiv .viewLink
+{
+  display: inline-block;
+  padding: 7px 5px 7px 12px;
+  width: 412px;
+}
+
+#hitDiv .addLink
+{
+  float: right;
+  display: inline-block;
+  padding: 9px 15px 7px 15px;
+}
+
 .hitHeader
 {
   padding: 5px 6px 5px 33px;
@@ -199,6 +283,16 @@
   cursor: pointer;
 }
 
+#addDashboardForm
+{
+  display: none;
+}
+
+#manageDashboardForm
+{
+  display: none;
+}
+
 #chartView
 {
   display: none;