dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08326
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1993: Added Indicator Wise Graphical Analysis
------------------------------------------------------------
revno: 1993
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-11-03 15:20:21 +0530
message:
Added Indicator Wise Graphical Analysis
added:
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGAIndicator.vm
modified:
local/in/dhis-web-dashboard/pom.xml
local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java
local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
local/in/dhis-web-dashboard/src/main/resources/struts.xml
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js
local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menu.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 'local/in/dhis-web-dashboard/pom.xml'
--- local/in/dhis-web-dashboard/pom.xml 2010-08-20 09:13:09 +0000
+++ local/in/dhis-web-dashboard/pom.xml 2010-11-03 09:50:21 +0000
@@ -83,7 +83,11 @@
<artifactId>dhis-in-service-configuration</artifactId>
<version>${version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-in-service-reports</artifactId>
+ <version>${version}</version>
+ </dependency>
<!-- Other -->
<!--
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/IndicatorwiseGAFormAction.java 2010-11-03 09:50:21 +0000
@@ -0,0 +1,246 @@
+/*
+ * 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.
+ */
+package org.hisp.dhis.dashboard.ga.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
+import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.period.DailyPeriodType;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.OnChangePeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.hisp.dhis.period.SixMonthlyPeriodType;
+import org.hisp.dhis.period.TwoYearlyPeriodType;
+import org.hisp.dhis.period.WeeklyPeriodType;
+import org.hisp.dhis.period.YearlyPeriodType;
+import org.hisp.dhis.period.comparator.PeriodComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version ndicatorwiseGAFormAction.java Nov 3, 2010 11:33:12 AM
+ */
+public class IndicatorwiseGAFormAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private IndicatorService indicatorService ;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<Indicator> indicators;
+
+ public List<Indicator> getIndicators()
+ {
+ return indicators;
+ }
+
+ private List<IndicatorGroup> indicatorGroups;
+
+ public List<IndicatorGroup> getIndicatorGroups()
+ {
+ return indicatorGroups;
+ }
+
+ private List<PeriodType> periodTypes;
+
+ public List<PeriodType> getPeriodTypes()
+ {
+ return periodTypes;
+ }
+
+ private List<Period> monthlyPeriods;
+
+ public List<Period> getMonthlyPeriods()
+ {
+ return monthlyPeriods;
+ }
+
+ private List<String> periodNameList;
+
+ public List<String> getPeriodNameList()
+ {
+ return periodNameList;
+ }
+
+ private SimpleDateFormat simpleDateFormat;
+
+ public SimpleDateFormat getSimpleDateFormat()
+ {
+ return simpleDateFormat;
+ }
+
+ private String monthlyPeriodTypeName;
+
+ public String getMonthlyPeriodTypeName()
+ {
+ return monthlyPeriodTypeName;
+ }
+
+ private String quarterlyPeriodTypeName;
+
+ public String getQuarterlyPeriodTypeName()
+ {
+ return quarterlyPeriodTypeName;
+ }
+
+ private String sixMonthPeriodTypeName;
+
+ public String getSixMonthPeriodTypeName()
+ {
+ return sixMonthPeriodTypeName;
+ }
+
+ private String yearlyPeriodTypeName;
+
+ public String getYearlyPeriodTypeName()
+ {
+ return yearlyPeriodTypeName;
+ }
+
+ private List<Period> yearlyPeriods;
+
+ public List<Period> getYearlyPeriods()
+ {
+ return yearlyPeriods;
+ }
+
+ private List<OrganisationUnitGroup> orgUnitGroups;
+
+ public List<OrganisationUnitGroup> getOrgUnitGroups()
+ {
+ return orgUnitGroups;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+
+ public String execute() throws Exception
+ {
+
+ /* DataElements and Groups */
+ indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators());
+ indicatorGroups = new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups()) ;
+ Collections.sort( indicators, new IndicatorNameComparator() );
+ Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() );
+
+ /* Periods Type */
+ periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
+
+ Iterator<PeriodType> ptIterator = periodTypes.iterator();
+ while ( ptIterator.hasNext() )
+ {
+ String pTName = ptIterator.next().getName();
+ if ( pTName.equalsIgnoreCase( DailyPeriodType.NAME ) || pTName.equalsIgnoreCase( TwoYearlyPeriodType.NAME )
+ || pTName.equalsIgnoreCase( OnChangePeriodType.NAME )
+ || pTName.equalsIgnoreCase( WeeklyPeriodType.NAME ) )
+ {
+ ptIterator.remove();
+ }
+ }
+
+
+ monthlyPeriods = new ArrayList<Period>( periodService.getPeriodsByPeriodType( new MonthlyPeriodType() ) );
+ periodNameList = new ArrayList<String>();
+ Collections.sort( monthlyPeriods, new PeriodComparator() );
+ simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+ monthlyPeriodTypeName = MonthlyPeriodType.NAME;
+ quarterlyPeriodTypeName = QuarterlyPeriodType.NAME;
+ sixMonthPeriodTypeName = SixMonthlyPeriodType.NAME;
+ yearlyPeriodTypeName = YearlyPeriodType.NAME;
+
+ yearlyPeriods = new ArrayList<Period>( periodService.getPeriodsByPeriodType( new YearlyPeriodType() ) );
+ Iterator<Period> periodIterator = yearlyPeriods.iterator();
+ while( periodIterator.hasNext() )
+ {
+ Period p1 = periodIterator.next();
+
+ if ( p1.getStartDate().compareTo( new Date() ) > 0 )
+ {
+ periodIterator.remove( );
+ }
+
+ }
+ Collections.sort( yearlyPeriods, new PeriodComparator() );
+ simpleDateFormat = new SimpleDateFormat( "yyyy" );
+ //System.out.println( monthlyPeriodTypeName );
+ int year;
+ for ( Period p1 : yearlyPeriods )
+ {
+ year = Integer.parseInt( simpleDateFormat.format( p1.getStartDate() ) ) + 1;
+ periodNameList.add( simpleDateFormat.format( p1.getStartDate() ) + "-" + year );
+ }
+
+ /* Organisationunit Group */
+
+ orgUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
+
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ga/action/charts/GenerateChartIndicatorAction.java 2010-11-03 09:50:21 +0000
@@ -0,0 +1,560 @@
+/*
+ * 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.
+ */
+package org.hisp.dhis.dashboard.ga.action.charts;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.amplecode.quick.StatementManager;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.dashboard.util.DashBoardService;
+import org.hisp.dhis.dashboard.util.IndicatorChartResult;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.hisp.dhis.period.SixMonthlyPeriodType;
+import org.hisp.dhis.period.YearlyPeriodType;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GenerateChartIdicatorAction.java Nov 3, 2010 12:41:31 PM
+ */
+public class GenerateChartIndicatorAction
+implements Action
+{
+
+private final String PERIODWISE = "period";
+
+private final String CHILDREN = "children";
+
+private final String SELECTED = "random";
+
+IndicatorChartResult indicatorChartResult = new IndicatorChartResult() ;
+
+
+// -------------------------------------------------------------------------
+// Dependencies
+// -------------------------------------------------------------------------
+
+
+ private StatementManager statementManager;
+
+
+ public void setStatementManager( StatementManager statementManager )
+ {
+ this.statementManager = statementManager;
+ }
+
+ private DashBoardService dashBoardService;
+
+ public void setDashBoardService( DashBoardService dashBoardService )
+ {
+ this.dashBoardService = dashBoardService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ private AggregationService aggregationService;
+
+ public void setAggregationService( AggregationService aggregationService )
+ {
+ this.aggregationService = aggregationService;
+ }
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ // -------------------------------------------------------------------------
+ // Comparator
+ // -------------------------------------------------------------------------
+ /*
+ private Comparator<Indicator> indicatorComparator;
+
+ public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
+ {
+ this.indicatorComparator = indicatorComparator;
+ }
+ */
+ //--------------------------------------------------------------------------
+ // Parameters
+ //--------------------------------------------------------------------------
+ private HttpSession session;
+
+ public HttpSession getSession()
+ {
+ return session;
+ }
+
+
+ private List<Object> selectedServiceList;
+
+ public List<Object> getSelectedServiceList()
+ {
+ return selectedServiceList;
+ }
+
+ private List<OrganisationUnit> selOUList;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private List<String> selectedIndicators;
+
+ public void setSelectedIndicators( List<String> selectedIndicators )
+ {
+ this.selectedIndicators = selectedIndicators;
+ }
+
+
+
+ private String ougGroupSetCB;
+
+ public void setOugGroupSetCB( String ougGroupSetCB )
+ {
+ this.ougGroupSetCB = ougGroupSetCB;
+ }
+
+ public String getOugGroupSetCB()
+ {
+ return ougGroupSetCB;
+ }
+
+
+
+ private List<String> orgUnitListCB;
+
+ public void setOrgUnitListCB( List<String> orgUnitListCB )
+ {
+ this.orgUnitListCB = orgUnitListCB;
+ }
+
+ private String categoryLB;
+
+ public String getCategoryLB()
+ {
+ return categoryLB;
+ }
+
+ public void setCategoryLB( String categoryLB )
+ {
+ this.categoryLB = categoryLB;
+ }
+
+ private String selectedButton;
+
+ public String getSelectedButton()
+ {
+ return selectedButton;
+ }
+
+ public void setSelectedButton( String selectedButton )
+ {
+ this.selectedButton = selectedButton;
+ }
+
+ private String aggDataCB;
+
+ public void setAggDataCB( String aggDataCB )
+ {
+ this.aggDataCB = aggDataCB;
+ }
+
+ private String periodTypeLB;
+
+ public void setPeriodTypeLB( String periodTypeLB )
+ {
+ this.periodTypeLB = periodTypeLB;
+ }
+
+ private List<String> yearLB;
+
+ public void setYearLB( List<String> yearLB )
+ {
+ this.yearLB = yearLB;
+ }
+
+ private List<String> periodLB;
+
+ public void setPeriodLB( List<String> periodLB )
+ {
+ this.periodLB = periodLB;
+ }
+
+ private List<String> periodNames;
+
+ private List<Date> selStartPeriodList;
+
+ private List<Date> selEndPeriodList;
+
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+ @SuppressWarnings( "unchecked" )
+ public String execute()
+ throws Exception
+ {
+
+ statementManager.initialise();
+
+ selOUList = new ArrayList<OrganisationUnit>();
+ System.out.println( "selected orgUnit size : " + orgUnitListCB.size() );
+
+ System.out.println( "selected Year size : " + yearLB.size() );
+
+ System.out.println( "selected Period size : " + periodLB.size() );
+
+ System.out.println( "selected dataelements : " + selectedIndicators );
+
+ System.out.println( "selected dataelements size : " + selectedIndicators.size() );
+
+ // int flag = 0;
+ // selOUList = new ArrayList<OrganisationUnit>();
+ selStartPeriodList = new ArrayList<Date>();
+ selEndPeriodList = new ArrayList<Date>();
+
+ // ouChildCountMap = new HashMap<OrganisationUnit, Integer>();
+
+ String monthOrder[] = { "04", "05", "06", "07", "08", "09", "10", "11", "12", "01", "02", "03" };
+ int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 };
+
+ /* Period Info */
+
+ String startD = "";
+ String endD = "";
+
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+
+ periodNames = new ArrayList<String>();
+
+ for ( String year : yearLB )
+ {
+ int selYear = Integer.parseInt( year.split( "-" )[0] );
+
+ if ( periodTypeLB.equalsIgnoreCase( YearlyPeriodType.NAME ) )
+ {
+
+ startD = "" + selYear + "-04-01";
+ endD = "" + (selYear + 1) + "-03-31";
+
+ selStartPeriodList.add( format.parseDate( startD ) );
+ selEndPeriodList.add( format.parseDate( endD ) );
+
+ periodNames.add( "" + selYear + "-" + (selYear + 1) );
+
+ continue;
+
+ }
+
+ for ( String periodStr : periodLB )
+ {
+ int period = Integer.parseInt( periodStr );
+
+ if ( periodTypeLB.equalsIgnoreCase( MonthlyPeriodType.NAME ) )
+ {
+ simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
+
+ if ( period >= 9 )
+ {
+ startD = "" + (selYear + 1) + "-" + monthOrder[period] + "-01";
+ endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + monthDays[period];
+
+ if ( (selYear + 1) % 4 == 0 && period == 10 )
+ {
+ endD = "" + (selYear + 1) + "-" + monthOrder[period] + "-" + (monthDays[period] + 1);
+ }
+ }
+ else
+ {
+ startD = "" + selYear + "-" + monthOrder[period] + "-01";
+ endD = "" + selYear + "-" + monthOrder[period] + "-" + monthDays[period];
+ }
+
+ selStartPeriodList.add( format.parseDate( startD ) );
+ selEndPeriodList.add( format.parseDate( endD ) );
+ periodNames.add( simpleDateFormat.format( format.parseDate( startD ) ) );
+ }
+ else if ( periodTypeLB.equalsIgnoreCase( QuarterlyPeriodType.NAME ) )
+ {
+ if ( period == 0 )
+ {
+ startD = "" + selYear + "-04-01";
+ endD = "" + selYear + "-06-30";
+ periodNames.add( selYear + "-Q1" );
+ }
+ else if ( period == 1 )
+ {
+ startD = "" + selYear + "-07-01";
+ endD = "" + selYear + "-09-30";
+ periodNames.add( selYear + "-Q2" );
+ }
+ else if ( period == 2 )
+ {
+ startD = "" + selYear + "-10-01";
+ endD = "" + selYear + "-12-31";
+ periodNames.add( selYear + "-Q3" );
+ }
+ else
+ {
+ startD = "" + (selYear + 1) + "-01-01";
+ endD = "" + (selYear + 1) + "-03-31";
+ periodNames.add( (selYear) + "-Q4" );
+ }
+ selStartPeriodList.add( format.parseDate( startD ) );
+ selEndPeriodList.add( format.parseDate( endD ) );
+ }
+ else if ( periodTypeLB.equalsIgnoreCase( SixMonthlyPeriodType.NAME ) )
+ {
+ if ( period == 0 )
+ {
+ startD = "" + selYear + "-04-01";
+ endD = "" + selYear + "-09-30";
+ periodNames.add( selYear + "-HY1" );
+ }
+ else
+ {
+ startD = "" + selYear + "-10-01";
+ endD = "" + (selYear + 1) + "-03-31";
+ periodNames.add( selYear + "-HY2" );
+ }
+ selStartPeriodList.add( format.parseDate( startD ) );
+ selEndPeriodList.add( format.parseDate( endD ) );
+ }
+
+ System.out.println( startD + " : " + endD );
+ }
+
+ }
+
+ List<Indicator> indicatorList = new ArrayList<Indicator>();
+ Iterator deIterator = selectedIndicators.iterator();
+ while ( deIterator.hasNext() )
+ {
+ String indicatorId = (String) deIterator.next();
+
+ Indicator indicator = indicatorService.getIndicator( indicatorId );
+
+ indicatorList.add( indicator );
+
+ }
+
+ selectedServiceList = new ArrayList<Object>( indicatorList );
+
+ // OrgUnit Information
+
+ for ( String ouStr : orgUnitListCB )
+ {
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( ouStr ) );
+ selOUList.add( orgUnit );
+ }
+
+ // calling individual Function
+ if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB == null )
+ {
+
+ System.out.println( "Inside PeriodWise Chart Data" );
+ System.out.println( "\n\nsize of OrgUnit List : " + selOUList.size()+ " , size of Indicator List : " + indicatorList.size() );
+
+ indicatorChartResult = generateChartDataPeriodWise( selStartPeriodList,selEndPeriodList, periodNames, indicatorList, selOUList.iterator().next() );
+
+
+
+ }
+ else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB == null )
+ {
+ // System.out.println( "Report Generation Start Time is : \t" + new
+ // Date() );
+ System.out.println( "Inside ChildWise Chart Data" );
+ // generateChartDataWithChildWise();
+
+ }
+ else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB == null )
+ {
+ // System.out.println( "Report Generation Start Time is : \t" + new
+ // Date() );
+
+ System.out.println( "Inside SelectedOrgUnit Chart Data" );
+ // generateChartDataSelectedOrgUnitWise();
+
+ }
+
+ else if ( categoryLB.equalsIgnoreCase( PERIODWISE ) && ougGroupSetCB != null )
+ {
+ // System.out.println( "Report Generation Start Time is : \t" + new
+ // Date() );
+ System.out.println( "Inside ChildWise With OrgGroup Chart Data" );
+ // generateChartDataOrgGroupPeriodWise();
+
+ }
+
+ else if ( categoryLB.equalsIgnoreCase( CHILDREN ) && ougGroupSetCB != null )
+ {
+ // System.out.println( "Report Generation Start Time is : \t" + new
+ // Date() );
+ System.out.println( "Inside ChildWise With OrgGroup Chart Data" );
+ // generateChartDataOrgGroupChildWise();
+
+ }
+
+ else if ( categoryLB.equalsIgnoreCase( SELECTED ) && ougGroupSetCB != null )
+ {
+ // System.out.println( "Report Generation Start Time is : \t" + new
+ // Date() );
+
+ System.out.println( "Inside SelectedOrgUnit With OrgGroup Chart Data" );
+ // generateChartDataSelectedOrgUnitGroupWise();
+
+ }
+ ActionContext ctx = ActionContext.getContext();
+ HttpServletRequest req = (HttpServletRequest) ctx.get( ServletActionContext.HTTP_REQUEST );
+
+ session = req.getSession();
+
+
+ session.setAttribute( "data1", indicatorChartResult.getData() );
+ session.setAttribute( "series1", indicatorChartResult.getSeries()) ;
+ session.setAttribute( "categories1", indicatorChartResult.getCategories()) ;
+ session.setAttribute( "chartTitle", indicatorChartResult.getChartTitle()) ;
+ session.setAttribute( "xAxisTitle", indicatorChartResult.getXAxis_Title()) ;
+ session.setAttribute( "yAxisTitle", indicatorChartResult.getYAxis_Title()) ;
+
+ statementManager.destroy();
+ return SUCCESS;
+
+ // execute end
+ }
+
+
+ public IndicatorChartResult generateChartDataPeriodWise( List<Date> selStartPeriodList,List<Date> selEndPeriodList, List<String> periodNames, List<Indicator> indicatorList,OrganisationUnit orgUnit )
+ throws Exception
+ {
+
+ System.out.println("inside function defination");
+ IndicatorChartResult indicatorChartResult ;
+
+ String[] series = new String[indicatorList.size()];
+ String[] categories = new String[selStartPeriodList.size()];
+ Double[][] data = new Double[indicatorList.size()][selStartPeriodList.size()];
+ String chartTitle = "OrganisationUnit : " + orgUnit.getShortName();
+ String xAxis_Title = "Time Line";
+ String yAxis_Title = "Value";
+
+
+ int serviceCount = 0;
+ for ( Indicator indicator: indicatorList)
+ {
+ int periodCount = 0;
+ for ( Date startDate : selStartPeriodList )
+ {
+ Date endDate = selEndPeriodList.get( periodCount );
+
+ categories[periodCount] = periodNames.get( periodCount );
+
+ Double aggIndicatorValue = 0.0;
+ if ( aggDataCB != null )
+ {
+
+ aggIndicatorValue = aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate, orgUnit );
+ if(aggIndicatorValue == null ) aggIndicatorValue = 0.0;
+
+ }
+ else
+ {
+ PeriodType periodType = periodService.getPeriodTypeByName( periodTypeLB );
+ Collection<Period> periods = periodService.getPeriodsBetweenDates( periodType, startDate, endDate );
+
+ for ( Period period : periods )
+ {
+ aggIndicatorValue = dashBoardService.getIndividualIndicatorValue(indicator, orgUnit, period );
+
+ }
+ }
+ data[serviceCount][periodCount] = aggIndicatorValue;
+ periodCount++;
+ }
+ serviceCount++;
+ }
+ indicatorChartResult = new IndicatorChartResult( series,categories,data,chartTitle,xAxis_Title,yAxis_Title);
+
+ return indicatorChartResult;
+
+}
+
+
+
+}
\ No newline at end of file
=== modified file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java 2010-10-28 09:17:13 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/DashBoardService.java 2010-11-03 09:50:21 +0000
@@ -39,9 +39,11 @@
import java.util.UUID;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.reports.ReportService;
public class DashBoardService
{
@@ -55,6 +57,13 @@
{
this.periodService = periodService;
}
+
+ private ReportService reportservice ;
+
+ public void setReportservice( ReportService reportservice )
+ {
+ this.reportservice = reportservice;
+ }
/*
private DBConnection dbConnection;
@@ -713,5 +722,49 @@
return periodNameList;
}
+
+ public double getIndividualIndicatorValue( Indicator indicator, OrganisationUnit orgunit, Period period )
+ {
+
+ String numeratorExp = indicator.getNumerator();
+ String denominatorExp = indicator.getDenominator();
+ int indicatorFactor = indicator.getIndicatorType().getFactor();
+ String reportModelTB = null;
+ String numeratorVal = reportservice.getIndividualResultDataValue( numeratorExp, period.getStartDate(), period.getEndDate(), orgunit, reportModelTB );
+ String denominatorVal = reportservice.getIndividualResultDataValue( denominatorExp, period.getStartDate(), period.getEndDate(), orgunit, reportModelTB );
+
+ double numeratorValue;
+ try
+ {
+ numeratorValue = Double.parseDouble( numeratorVal );
+ }
+ catch ( Exception e )
+ {
+ numeratorValue = 0.0;
+ }
+
+ double denominatorValue;
+ try
+ {
+ denominatorValue = Double.parseDouble( denominatorVal );
+ }
+ catch ( Exception e )
+ {
+ denominatorValue = 1.0;
+ }
+
+ double aggregatedValue;
+ try
+ {
+ aggregatedValue = ( numeratorValue / denominatorValue ) * indicatorFactor;
+ }
+ catch ( Exception e )
+ {
+ System.out.println( "Exception while calculating Indicator value for Indicaotr " + indicator.getName() );
+ aggregatedValue = 0.0;
+ }
+
+ return aggregatedValue;
+ }
} // class end
=== added file 'local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/util/IndicatorChartResult.java 2010-11-03 09:50:21 +0000
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+package org.hisp.dhis.dashboard.util;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version IndicatorChartResult.java Nov 3, 2010 12:53:28 PM
+ */
+public class IndicatorChartResult
+{
+
+ //-------------------------------------------------------------------------
+ // Constructor
+ //-------------------------------------------------------------------------
+
+ public IndicatorChartResult()
+ {
+
+ }
+
+ public IndicatorChartResult( String[] series, String[] categories, Double data[][],String chartTitle,String xAxis_Title,String yAxis_Title )
+ {
+ this.series = series;
+ this.categories = categories;
+ this.data = data;
+ this.chartTitle = chartTitle;
+ this.xAxis_Title = xAxis_Title;
+ this.yAxis_Title = yAxis_Title;
+ //this.xseriesList = xseriesList;
+ //this.yseriesList = yseriesList;
+ }
+
+
+
+
+
+ //---------------------------------------------------------------
+ // Getters and Setters
+ //---------------------------------------------------------------
+
+
+ private String[] series;
+
+ public String[] getSeries()
+ {
+ return series;
+ }
+
+ public void setSeries( String[] series )
+ {
+ this.series = series;
+ }
+
+ private String[] categories;
+
+ public String[] getCategories()
+ {
+ return categories;
+ }
+
+ public void setCategories( String[] categories )
+ {
+ this.categories = categories;
+ }
+
+ Double data[][];
+
+ public Double[][] getData()
+ {
+ return data;
+ }
+
+ public void setData( Double[][] data )
+ {
+ this.data = data;
+ }
+
+ private String chartTitle;
+
+ public String getChartTitle()
+ {
+ return chartTitle;
+ }
+
+ public void setChartTitle( String chartTitle )
+ {
+ this.chartTitle = chartTitle;
+ }
+
+ private String xAxis_Title;
+
+ public String getXAxis_Title()
+ {
+ return xAxis_Title;
+ }
+
+ public void setXAxis_Title( String axis_Title )
+ {
+ xAxis_Title = axis_Title;
+ }
+ private String yAxis_Title;
+
+ public String getYAxis_Title()
+ {
+ return yAxis_Title;
+ }
+
+ public void setYAxis_Title( String axis_Title )
+ {
+ yAxis_Title = axis_Title;
+ }
+
+
+
+
+}
+
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/META-INF/dhis/beans.xml 2010-11-03 09:50:21 +0000
@@ -76,7 +76,50 @@
<property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
</property>
</bean>
-<!-- -->
+
+ <!-- Graphical Analyser Indicator Result -->
+ <bean id="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartIndicatorAction"
+ class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartIndicatorAction"
+ scope="prototype">
+
+ <property name="statementManager" ref="statementManager"/>
+ <property name="dashBoardService" ref="org.hisp.dhis.dashboard.util.DashBoardService">
+ </property>
+ <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService">
+ </property>
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+ </property>
+ <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService">
+ </property>
+ <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService">
+ </property>
+<!-- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService">
+ </property>-->
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService">
+ </property>
+ </bean>
+
+
+<!-- Graphical Analyser DataElements End -->
+
+<!-- Graphical Analyser Indicators Start-->
+
+ <bean id="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction"
+ class="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction"
+ scope="prototype">
+ <property name="indicatorService">
+ <ref bean="org.hisp.dhis.indicator.IndicatorService"/>
+ </property>
+ <property name="periodService">
+ <ref bean="org.hisp.dhis.period.PeriodService"/>
+ </property>
+ <property name="organisationUnitGroupService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+ </property>
+
+ </bean>
+
+<!-- Graphical Analyser Indicators End-->
<!-- Graphical Analyser -->
@@ -768,6 +811,8 @@
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
</property>
+ <property name="reportservice" ref="org.hisp.dhis.reports.ReportService">
+ </property>
</bean>
<!-- DashBoard Utilities DataElementChartResult-->
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2010-10-28 09:17:13 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2010-11-03 09:50:21 +0000
@@ -34,6 +34,10 @@
period = Period
ga_orgUnitGroups = OrgUnitGroups
ga_aggregated_data = Aggregated Data
+indicator_wise = Indicator Wise
+indicator_wise_graphical_analyser = Indicator Wise Graphical Analyser
+ga_available_indicatorList = Available Indicator List
+ga_selected_IndicatorList = Selected Indicator List
#------Annual Analysis------------------------#
aa_annual_analyser = Annual Analyser
=== modified file 'local/in/dhis-web-dashboard/src/main/resources/struts.xml'
--- local/in/dhis-web-dashboard/src/main/resources/struts.xml 2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/resources/struts.xml 2010-11-03 09:50:21 +0000
@@ -60,9 +60,33 @@
<param name="bufferSize">1024</param>
</result>
</action>
-
-
-<!-- -->
+<!-- GraphicalAnalyser DataElements end -->
+
+<!-- GraphicalAnalyser Indicators -->
+ <action name="graphicalAnalyserIndicator"
+ class="org.hisp.dhis.dashboard.ga.action.IndicatorwiseGAFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm</param>
+ <param name="menu">/dhis-web-dashboard/menuWithTreeForGAIndicator.vm</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/db.js,javascript/ga.js,javascript/hashtable.js,javascript/date.js,javascript/gadataelement.js</param>
+ <param name="stylesheets">css/StylesForTags.css</param>
+ <interceptor-ref name="organisationUnitTreeStack"/>
+ </action>
+
+ <action name="generateChartIndicator"
+ class="org.hisp.dhis.dashboard.ga.action.charts.GenerateChartIndicatorAction">
+ <result name="success" type="velocity">/popup.vm</result>
+ <param name="page">/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm</param>
+ <!--<result name="success" type="velocity">/dhis-web-dashboard/graphicalAnalysisDataElementResult.vm</result>-->
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/lists/lists.js,javascript/ga.js,javascript/hashtable.js,javascript/gadataelement.js</param>
+ <param name="stylesheets">css/StylesForTags.css</param>
+ <interceptor-ref name="organisationUnitTreeStack"/>
+ </action>
+
+
+
+<!-- GraphicalAnalyser Indicators end -->
+
<!-- GraphicalAnalyser Module Stuff -->
<action name="graphicalAnalyser"
=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorFront.vm 2010-11-03 09:50:21 +0000
@@ -0,0 +1,179 @@
+<script>
+ // Global Variables
+ var selriRadioButton = "indicatorsRadio";
+ var selCategory = "";
+ var selFacility = "";
+
+
+
+ // Global Variables
+ var monthlyPeriodTypeName = '$monthlyPeriodTypeName';
+ var quarterlyPeriodTypeName = '$quarterlyPeriodTypeName';
+ var sixmonthPeriodTypeName = '$sixMonthPeriodTypeName';
+ var yearlyPeriodTypeName = '$yearlyPeriodTypeName';
+
+ // var maxOrgUnitLevels = $maxOrgUnitLevels;
+ var orgUnitIds="NONE";
+ var currentOrgUnitId;
+ var currentOrgUnitName;
+
+ var monthNames = new Array("Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar");
+ var quarterNames = new Array("Q1","Q2","Q3","Q4");
+ var halfYearNames = new Array("HY1","HY2");
+
+
+ var orgUnitGroupIds = new Array();
+ var orgUnitGroupNames = new Array();
+
+ #set( $count1 = 0 );
+ #foreach( $orgUnitGroup in $orgUnitGroups )
+ orgUnitGroupIds[$count1] = $orgUnitGroup.id;
+ orgUnitGroupNames[$count1] = '$orgUnitGroup.name';
+ #set( $count1 = $count1 + 1 );
+ #end
+
+
+</script>
+
+<h1>$i18n.getString( "indicator_wise_graphical_analyser" )</h1>
+<hr />
+<form id="ChartGenerationForm" name="ChartGenerationForm" action="generateChartIndicator.action" method="post" onSubmit="return formValidationsIndicator()" >
+ <table style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" border=0>
+
+ <tr>
+ <td class="NormalB"> </td>
+ <td class="NormalB"> </td>
+ <td class="NormalB"> </td>
+ </tr>
+ <tr>
+ <td class="NormalB"> </td>
+ <td class="NormalB"> </td>
+ <td class="NormalB"> </td>
+ </tr>
+ <tr>
+ <td class="NormalB">$i18n.getString( "ga_filter_by_indicatorgroup" )<br>
+ <select id="indicatorGroupId" name="indicatorGroupId" style="width:325px" onChange="getIndicators()" >
+ <option value="$ALL">[ Select IndicatorGroup / All ]</option>
+ #foreach ( $group in $indicatorGroups )
+ <option value="$group.id" title="$group.name">$group.name</option>
+ #end
+ </select>
+ </td>
+ <td class="NormalB"> </td>
+
+
+ </td>
+ </tr>
+ <tr>
+ <td class="NormalB"> </td>
+ <td class="NormalB"> </td>
+ <td class="NormalB"> </td>
+ </tr>
+ <tr>
+ <td class="NormalB">$i18n.getString( "ga_available_indicatorList" )<br>
+ <select multiple size="7" id="availableIndicators" name="availableIndicators" style="width:325px; height:100px" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">
+ #foreach ( $element in $indicators )
+ <option value="$element.id" title="$element.name">$element.name</option>
+ #end
+ </select>
+ </td>
+ <td class="NormalB" align="center"><br />
+ <input type="button" value=">" style="width:40px" onClick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">
+ <br>
+ <input type="button" value="<" style="width:40px" onClick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )">
+ <br>
+ <input type="button" value=">>" style="width:40px" onClick="moveAllById( 'availableIndicators', 'selectedIndicators' )">
+ <br>
+ <input type="button" value="<<" style="width:40px" onClick="moveAllById( 'selectedIndicators', 'availableIndicators' )">
+ </td>
+ <td class="NormalB"> $i18n.getString( "ga_selected_IndicatorList" )<br />
+ <select multiple size="7" id="selectedIndicators" name="selectedIndicators" style="width:325px; height:100px" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )">
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="NormalB"> <br/></td>
+ <td class="NormalB"> <br/></td>
+ <td class="NormalB"> <br/></td>
+ </tr>
+
+ <tr>
+ <td class="NormalB"><br><input type="checkbox" id="aggDataCB" name="aggDataCB" checked="true" >$i18n.getString( "ga_aggregated_data" )</td>
+ <td class="NormalB"> </td>
+ <td class="NormalB"><br>
+ <table>
+ <tr>
+ <td class="NormalB"> $i18n.getString( "ga_viewby" )<br>
+ <select id="categoryLB" name="categoryLB" onChange="categoryChangeFunction1(event)">
+ <option value="period">Period Wise</option>
+ <option value="children">Children</option>
+ <option value="random">Selected</option>
+ </select>
+ <br />
+ <br />
+ </td>
+ <td> </td>
+ <td align="left" class="NormalB"> $i18n.getString( "periodType" )<br>
+ <select id="periodTypeLB" name="periodTypeLB" onchange="getPeriods()" style="width: 150px;">
+ #foreach ( $periodType in $periodTypes )
+ <option value="$periodType.name" #if($periodType.name==$monthlyPeriodTypeName) selected #end>$periodType.name</option>
+ #end
+ </select>
+ <br />
+ <br />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="NormalB"><br>
+ <table>
+ <td class="NormalB">$i18n.getString( "ga_orgunit" )<br>
+ <select name="orgUnitListCB" id="orgUnitListCB" multiple size="7" style="width: 150px;" ondblclick="remOUFunction()"> >
+ </select>
+ </td>
+ <td class="NormalB"><input type="checkbox" id="ougGroupSetCB" name="ougGroupSetCB" onChange="getOrgUnitGroupsDataElements()" disabled="true">$i18n.getString( "ga_orgUnitGroups" )<br>
+ <select name="orgUnitGroupList" id="orgUnitGroupList" multiple size="7" onChange="selectSingleOptionOrgUnitGroup()" style="width: 150px;" disabled="true">
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td class="NormalB" align="center"></td>
+ <td class="NormalB" align="center"><br>
+ <table>
+ <tr>
+ <td class="NormalB"> $i18n.getString( "year" )<br>
+ <select id="yearLB" name="yearLB" size="5" multiple style="width: 150px;">
+ #foreach($periodName in $periodNameList)
+ <option value="$periodName">$periodName</option>
+ #end
+ </select>
+ <br />
+ <br />
+ </td>
+ <td> </td>
+ <td class="NormalB"> $i18n.getString( "period" )<br>
+ <select id="periodLB" name="periodLB" size="5" multiple style="width: 150px;">
+ </select>
+ <br />
+ <br />
+ </td>
+ </tr>
+ <tr>
+ <td><input type="submit" name="ViewChart" value="$i18n.getString( 'ga_viewchart' )" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#000000" onClick="javascript:selButtonFunction('ViewChart')">
+ </td>
+ <td> </td>
+ <td align="right"><input type="submit" name="ViewSummary" value="$i18n.getString( 'ga_viewsummary' )" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#000000" onClick="javascript:selButtonFunction('ViewSummary')">
+ </td>
+ </tr>
+ <input type="hidden" name="selectedButton" id="selectedButton">
+ </table></td>
+ </tr>
+ </table>
+</form>
+<script>
+ getPeriods();
+</script>
\ No newline at end of file
=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/graphicalAnalysisIndicatorResult.vm 2010-11-03 09:50:21 +0000
@@ -0,0 +1,231 @@
+<script>
+
+ function drillDownResult(evt, selVal )
+ {
+ evt.target.href = "drillDownResult.action?selectedValues="+selVal;
+ }
+
+// Chart Display Option change start
+
+ function chartTypeOptionChange(evt)
+ {
+
+
+ var chartTypeOptionList = document.getElementById("chartTypeOption");
+ var chartTypeOptionValue = chartTypeOptionList.options[ chartTypeOptionList.selectedIndex ].value;
+
+ // var tempICount = $selectedServiceList.size();
+
+ // alert(chartTypeOptionValue);
+
+ var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+ var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+
+ // alert(chartDisplayOptionValue);
+
+ iframeForChart.location.href = "generateChart1.action?currentChart="+chartTypeOptionValue+"&chartDisplayOption="+chartDisplayOptionValue;
+
+ }
+
+// Chart Display Option change for sorting
+
+ function chartDisplayOptionChange(evt)
+ {
+
+ var chartTypeOptionList = document.getElementById("chartTypeOption");
+ var chartTypeOptionValue = chartTypeOptionList.options[ chartTypeOptionList.selectedIndex ].value;
+
+ var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+ var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+
+ // iframeForChart.location.href = "generateChart1.action?currentChart="+chartNamesToView[chartType][indexForChart]+"&chartDisplayOption="+chartDisplayOptionValue;
+
+ iframeForChart.location.href = "generateChart1.action?currentChart="+chartTypeOptionValue+"&chartDisplayOption="+chartDisplayOptionValue;
+
+ getSortedList(chartDisplayOptionValue);
+ }
+
+function getSortedListForSummary()
+{
+ var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+ var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+
+ getSortedList(chartDisplayOptionValue);
+}
+
+function getSortedList(chartDisplayOptionValue)
+{
+ //var url = "getSortedData.action?chartDisplayOption=" + chartDisplayOptionValue;
+
+ var request = new Request();
+ request.setResponseTypeXML( 'messages' );
+ request.setCallbackSuccess( getSortedListReceived );
+ //request.send( url );
+
+ var requestString = "getSortedData.action";
+ var params = "chartDisplayOption=" + chartDisplayOptionValue;
+ request.sendAsPost( params );
+ request.send( requestString );
+}
+
+function getSortedListReceived(xmlObject)
+{
+ var messages = xmlObject.getElementsByTagName("message");
+ document.getElementById("headingInfoId").innerHTML = "";
+ document.getElementById("testId").value = "";
+
+ for ( var i = 0; i < messages.length; i++ )
+ {
+ var hinfo = messages[ i ].firstChild.nodeValue;
+ //document.getElementById("headingInfoId").innerHTML += hinfo;
+ document.getElementById("testId").value += hinfo;
+ }
+
+ document.getElementById("headingInfoId").innerHTML = document.getElementById("testId").value;
+}
+
+//fucction for selected Button is ViewChart
+
+function exportToExcelFunction1( summaryOption )
+ {
+ //alert("inside Viw Summary:" + summaryOption );
+ var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+ var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+
+ document.getElementById("exportExcelAnchor1").href="exportDataElementsToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
+
+ }
+
+function exportDataStatusResultToWorkBook()
+ {
+ document.getElementById('htmlCode').value = document.getElementById('formResult').innerHTML;
+
+ return true;
+ }
+
+//fucction for selected Button is ViewSummary
+
+function exportToExcelFunction2( summaryOption )
+ {
+ // alert("inside Viw Summary" + summaryOption );
+ var chartDisplayOptionList = document.getElementById("chartDisplayOption");
+ var chartDisplayOptionValue = chartDisplayOptionList.options[ chartDisplayOptionList.selectedIndex ].value;
+
+ document.getElementById("exportExcelAnchor2").href="exportDataElementsToExcel.action?viewSummary="+summaryOption+"&chartDisplayOption="+chartDisplayOptionValue;
+
+ }
+
+</script>
+<div align="right" class="NormalB">
+ <table>
+ <tr>
+ <td class="NormalB">
+ #if($selectedButton.equals("ViewSummary"))
+
+ <td class="NormalB"><a id="exportExcelAnchor2" name="exportExcelAnchor2" href="#" onclick="javascript:exportToExcelFunction2('yes')" target="_blank">Export To WorkBook</a></td>
+ <td class="NormalB">
+ <select id="chartDisplayOption" name="chartDisplayOption" onchange="getSortedListForSummary()">
+ <option value="none">Select Sort Type</option>
+ <option value="ascend">Ascending</option>
+ <option value="desend">Desending</option>
+ <option value="alphabet">Alphabetical</option>
+ </select>
+
+ <br><br>
+ </td>
+ </tr>
+ #else
+ <tr>
+ <td class="NormalB"><a id="exportExcelAnchor1" name="exportExcelAnchor1" href="#" onclick="javascript:exportToExcelFunction1('no')" target="_blank">Export To Excel</a></td>
+ <td class="NormalB"> <!--<font face="Arial, Helvetica, sans-serif" color="#000000">-->
+ <select id="chartTypeOption" name="chartTypeOption" onchange="chartTypeOptionChange(event)">
+ <option value="Vertical3DBarChart">Vertical 3D BarChart</option>
+ <option value="Horizontal3DBarChart">Horizontal 3D BarChart</option>
+ <option value="LineChart">Line Chart</option>
+ <option value="LineAndBarChart">Line And BarChart</option>
+ <option value="AreaChart" >Area Chart</option>
+ </select>
+
+ <select id="chartDisplayOption" name="chartDisplayOption" onchange="chartDisplayOptionChange(event)">
+ <option value="none">Select Sort Type</option>
+ <option value="ascend">Ascending</option>
+ <option value="desend">Desending</option>
+ <option value="alphabet">Alphabetical</option>
+ </select>
+ </td>
+ </tr>
+ #end
+</table>
+</div>
+
+<div id="formResult">
+<!--
+ <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: dotted" bordercolor="#111111" width="100%">
+ <tr>
+ <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1" rowspan="2">Service Name</td>
+ #foreach($xaxisvalue in $xseriesList)
+ <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" colspan="3">$xaxisvalue</td>
+ #end
+ </tr>
+ <tr>
+ #foreach($xaxisvalue in $xseriesList)
+ <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" >Num</td>
+ <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" >Den</td>
+ <td class="TableHeadingCellStyles" align="center" style="border-style: dotted; border-width: 1" >Val</td>
+ #end
+ </tr>
+ #set($count1 = 0)
+ #foreach($onedataList in $dataList)
+ #set($oneNumList = $numList.get($count1))
+ #set($oneDenList = $denList.get($count1))
+ <tr>
+ <td class="TableHeadingCellStyles" style="border-style: dotted; border-width: 1">$yseriesList.get($count1)</td>
+ #set($count2 = 0)
+ #foreach($data in $onedataList)
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$oneNumList.get($count2)</td>
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$oneDenList.get($count2)</td>
+ <td class="TableDataCellStyles" align="center" style="border-style: dotted; border-width: 1">$data</td>
+ #set($count2 = $count2 + 1)
+ #end
+ #set($count1 = $count1 + 1)
+ </tr>
+ #end
+ </table>
+</div>
+-->
+<!-- #if($selectedButton.equals("ViewSummary"))
+ <br><br>
+ #else-->
+ <br>
+ <div align="center">
+ <iframe name="iframeForChart" id="iframeForChart" src="generateChart.action?currentChart=Vertical3DBarChart" width="850px" height="550px" scrolling=auto frameborder="0"></iframe>
+ </div>
+ <br>
+ #end
+</div>
+<!--
+ <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: dotted" bordercolor="#111111" width="100%">
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Indicator Names</font></td>
+ <td class="TableHeadingCellStyles" width="30%" colspan="2" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Formula</font></td>
+ <!-- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Numerator DataElements</font></td>
+ <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><font color="maroon">Denominator DataElements</font></td> -->
+ </tr>-->
+<!-- #set($count1 = 0)
+ #foreach($service in $selectedServiceList)
+ <tr>
+ <td class="TableHeadingCellStyles" width="30%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$service.getName()</td>
+ <td class="TableHeadingCellStyles" width="25%" align="center" style="border-left-style:dotted; border-left-width:1; border-right-width:0; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"><u>$service.getNumeratorDescription()</u><br>$service.getDenominatorDescription()</td>
+ <td class="TableHeadingCellStyles" width="5%" align="left" style="border-left-style:dotted; border-left-width:0; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1"> X $service.getIndicatorType().getFactor()</td>
+ <!-- <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$numeratorDEList.get($count1)</td>
+ <td class="TableHeadingCellStyles" width="20%" style="border-left-style:dotted; border-left-width:1; border-right-width:1; border-top-style:dotted; border-top-width:1; border-bottom-style:dotted; border-bottom-width:1">$denominatorDEList.get($count1)</td> -->
+ </tr> -->
+ <!-- #set($count1 = $count1 + 1) -->
+ #end
+ </table>
+
+<!--
+ <textarea id="testId" rows="10" cols="70" style="display:none"> </textarea> -->
+ </form>
+>
+
\ No newline at end of file
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-11-02 11:35:05 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/gadataelement.js 2010-11-03 09:50:21 +0000
@@ -320,5 +320,100 @@
window.open('','chartWindowDataElement','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes');
return true;
}
-// formValidations Function End
-
+// formValidations Function DataElements End
+
+
+//Graphical Analysis Form Indicators
+function formValidationsIndicator()
+{
+
+ //var selectedServices = document.getElementById("selectedServices");
+
+ var selOUListLength = document.ChartGenerationForm.orgUnitListCB.options.length;//alert(selOUListLength);
+ var selIndicatorsListSize = document.ChartGenerationForm.selectedIndicators.options.length;//alert(selDEListSize);
+
+ var orgUnitListCB = document.getElementById("orgUnitListCB");
+ var selectedIndicators = document.getElementById("selectedIndicators");
+
+ var orgUnitGroupCB = document.getElementById("orgUnitGroupList");
+
+ var selOUGroupListLength = document.ChartGenerationForm.orgUnitGroupList.options.length;
+
+ var selyearLB = document.getElementById("yearLB");
+ var selperiodLB = document.getElementById("periodLB");
+
+ var periodTypeList = document.getElementById( "periodTypeLB" );
+ var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value;//alert(periodTypeId);
+
+ var k = 0;
+
+ if( selIndicatorsListSize <= 0 )
+ {
+ alert( "Please Select Indicator(s)" );
+ return false;
+ }
+
+ else if( selOUListLength <= 0 )
+ {
+ alert( "Please Select OrganisationUnit" );
+ return false;
+ }
+
+ else if(document.getElementById( 'ougGroupSetCB' ).checked && orgUnitGroupCB.selectedIndex < 0 )
+ {
+ alert( "Please select OrgUnitGroup" );
+ return false;
+ /*if( orgUnitGroupCB.selectedIndex < 0 )
+ {
+ alert( "Please select OrgUnitGroup" );
+
+ }*/
+ }
+ else if( periodTypeId == yearlyPeriodTypeName )
+ {
+ if( selyearLB.selectedIndex < 0 )
+ {
+ alert("Please select Year(s)");
+ return false;
+ }
+ }
+ else
+ {
+ if( selyearLB.selectedIndex < 0 )
+ {
+ alert("Please select Year(s)");
+ return false;
+ }
+ if( selperiodLB.selectedIndex < 0 )
+ {
+ alert("Please select Period(s)");
+ return false;
+ }
+ }
+
+ if( selIndicatorsListSize > 0 )
+ {
+ for(k=0;k<document.ChartGenerationForm.selectedIndicators.options.length;k++)
+ {
+ document.ChartGenerationForm.selectedIndicators.options[k].selected = true;
+ }
+ }
+
+ if( selOUListLength > 0 )
+ {
+ for(k = 0; k < orgUnitListCB.options.length; k++)
+ {
+ orgUnitListCB.options[k].selected = true;
+ }
+ }
+/*
+ var sWidth = 1000;
+ var sHeight = 1000;
+ var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
+ var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
+
+ window.open('','chartWindowDataElement','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes');
+*/
+ return true;
+}
+// formValidations Function Indicators End
=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menu.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menu.vm 2010-10-28 09:17:13 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menu.vm 2010-11-03 09:50:21 +0000
@@ -6,6 +6,7 @@
<li><a href="graphicalAnalyser.action">Regular</a></li>
<li><a href="annualAnalyser.action">Annual</a></li>
<li><a href="graphicalAnalyserDataElement.action">$i18n.getString( "dataelements_wise" )</a></li>
+ <li><a href="graphicalAnalyserIndicator.action">$i18n.getString( "indicator_wise" )</a></li>
<!-- <li><a href="surveyAnalyser.action">Survey</a></li>
<li><a href="motionChartForm.action">MotionChart</a></li> -->
</ul>
=== added file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGAIndicator.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGAIndicator.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/menuWithTreeForGAIndicator.vm 2010-11-03 09:50:21 +0000
@@ -0,0 +1,37 @@
+<h2>$i18n.getString( "dashboard" )DashBoard</h2>
+ <ul>
+ <li>$i18n.getString( "graphical_analysis" )</li>
+ <ul>
+ <li>$i18n.getString( "indicator_wise" )</li>
+ </ul>
+ </ul>
+<div style=" float:right; font-size:6pt; cursor:pointer; margin-top:-20px; ">
+ <a href="index.action">
+ <img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
+</div>
+#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+
+<!-- The script that registeres selctions in the orgunit tree -->
+<script type="text/javascript">
+
+selection.setListenerFunction( orgUnitHasBeenSelected );
+
+function orgUnitHasBeenSelected( orgUnitIds )
+{
+ /*
+ if(document.getElementById( 'ougSetCB' ).checked)
+ {
+ return;
+ }
+*/
+ if(orgUnitIds == null || orgUnitIds == "" )
+ {
+ return;
+ }
+ if(orgUnitIds != null)
+ {
+ getOUDeatilsForGADataElements(orgUnitIds);
+ }
+}
+
+</script>