dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16405
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6238: Using web api for displaying charts in dashboard
------------------------------------------------------------
revno: 6238
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-03-09 18:36:22 +0100
message:
Using web api for displaying charts in dashboard
removed:
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/GetChartAction.java
modified:
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/struts.xml
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.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
=== removed file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/GetChartAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/GetChartAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/GetChartAction.java 1970-01-01 00:00:00 +0000
@@ -1,120 +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.chart.ChartService;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.jfree.chart.JFreeChart;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class GetChartAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private ChartService chartService;
-
- public void setChartService( ChartService chartService )
- {
- this.chartService = chartService;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private int width;
-
- public int getWidth()
- {
- return width;
- }
-
- public void setWidth( int width )
- {
- this.width = width;
- }
-
- private int height;
-
- public int getHeight()
- {
- return height;
- }
-
- public void setHeight( int height )
- {
- this.height = height;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private JFreeChart chart;
-
- public JFreeChart getChart()
- {
- return chart;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- if ( id != null )
- {
- chart = chartService.getJFreeChart( id, format );
- }
-
- 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 2012-02-14 20:27:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml 2012-03-09 17:36:22 +0000
@@ -23,11 +23,6 @@
<property name="manager" ref="org.hisp.dhis.dashboard.DashboardManager" />
</bean>
- <bean id="org.hisp.dhis.dashboard.action.GetChartAction" class="org.hisp.dhis.dashboard.action.GetChartAction"
- scope="prototype">
- <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
- </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" />
=== 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 2012-02-15 17:10:29 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml 2012-03-09 17:36:22 +0000
@@ -18,13 +18,6 @@
<param name="javascripts">javascript/dropdown.js</param>
</action>
- <action name="getChart" class="org.hisp.dhis.dashboard.action.GetChartAction">
- <result name="success" type="chart">
- <param name="width">310</param>
- <param name="height">310</param>
- </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>
=== 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 2012-03-05 10:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm 2012-03-09 17:36:22 +0000
@@ -45,7 +45,7 @@
</ul>
</div>
#if ( $chart )
- <img style="cursor:pointer" src="getChart.action?id=${chart.id}" onclick="viewChart( 'getChart.action?id=${chart.id}&width=700&height=500' )">
+ <img style="cursor:pointer" src="../api/charts/${chart.uid}/data?width=310&height=310" onclick="viewChart( '../api/charts/${chart.uid}/data' )">
#else
<div class="labelText">$i18n.getString( 'this_is_a_chart_area' )</div>
#end