← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4524: Generate chart with patient-data-values.

 

------------------------------------------------------------
revno: 4524
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-06 09:47:21 +0700
message:
  Generate chart with patient-data-values.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChart.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/DefaultPatientChartService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/hibernate/
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/hibernate/HibernatePatientChartStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/hibernate/
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/hibernate/patientchart.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GeneratePatientChartAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GetPatientChartListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientChart.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientChartList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/AddPatientChartAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/DeletePatientChartAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/ShowAddPatientChartFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/UpdatePatientChartAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientChart.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientChartList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatientChart.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRelationshipAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowRelationshipListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.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
=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChart.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChart.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2004-2011, 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.patientchart;
+
+import java.io.Serializable;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.program.Program;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ PatientChart.java Sep 5, 2011 7:45:02 AM $
+ * 
+ */
+public class PatientChart
+    implements Serializable
+{
+    private static final long serialVersionUID = 8363053813064346240L;
+
+    public static final String TYPE_BAR = "bar";
+
+    public static final String TYPE_BAR3D = "bar3d";
+
+    public static final String TYPE_LINE = "line";
+
+    public static final String TYPE_LINE3D = "line3d";
+
+    public static final String SIZE_NORMAL = "normal";
+
+    public static final String SIZE_WIDE = "wide";
+
+    public static final String SIZE_TALL = "tall";
+
+    private Integer id;
+    
+    private String title;
+
+    private String type;
+
+    private String size;
+
+    private boolean regression;
+
+    private Program program;
+
+    private DataElement dataElement;
+
+    private transient I18nFormat format;
+
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
+    public PatientChart()
+    {
+
+    }
+
+    // -------------------------------------------------------------------------
+    // equals && hashcode
+    // -------------------------------------------------------------------------
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((title == null) ? 0 : title.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+            return true;
+        if ( obj == null )
+            return false;
+        if ( getClass() != obj.getClass() )
+            return false;
+        PatientChart other = (PatientChart) obj;
+        if ( title == null )
+        {
+            if ( other.title != null )
+                return false;
+        }
+        else if ( !title.equals( other.title ) )
+            return false;
+        return true;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters && Setters
+    // -------------------------------------------------------------------------
+
+    public boolean isType( String type )
+    {
+        return this.type != null && this.type.equals( type );
+    }
+
+    public boolean isSize( String size )
+    {
+        return this.size != null && this.size.equals( size );
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle( String title )
+    {
+        this.title = title;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public String getSize()
+    {
+        return size;
+    }
+
+    public void setSize( String size )
+    {
+        this.size = size;
+    }
+
+    public Program getProgram()
+    {
+        return program;
+    }
+
+    public void setProgram( Program program )
+    {
+        this.program = program;
+    }
+
+    public DataElement getDataElement()
+    {
+        return dataElement;
+    }
+
+    public void setDataElement( DataElement dataElement )
+    {
+        this.dataElement = dataElement;
+    }
+
+    public I18nFormat getFormat()
+    {
+        return format;
+    }
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    public boolean isRegression()
+    {
+        return regression;
+    }
+
+    public void setRegression( boolean regression )
+    {
+        this.regression = regression;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartService.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004-2011, 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.patientchart;
+
+import java.util.Collection;
+
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.program.Program;
+import org.jfree.chart.JFreeChart;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ PatientChartService.java Sep 5, 2011 8:59:04 AM $
+ * 
+ */
+public interface PatientChartService
+{
+    String ID = PatientChartService.class.getName();
+
+    int savePientChart( PatientChart patientChart );
+
+    void deletePatientChart( PatientChart patientChart );
+
+    void updatePatientChart( PatientChart patientChart );
+
+    PatientChart getPatientChart( int id );
+    
+    Collection<PatientChart> getPatientCharts ( Collection<Program> programs );
+    
+    Collection<PatientChart> getAllPatientCharts();
+
+    JFreeChart getJFreeChart( int id, I18nFormat format );
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004-2011, 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.patientchart;
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.program.Program;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ PatientChartStore.java Sep 5, 2011 8:06:43 AM $
+ * 
+ */
+public interface PatientChartStore extends GenericStore<PatientChart>
+{
+    String ID = PatientChartStore.class.getName();
+    
+    Collection<PatientChart> getPatientCharts ( Collection<Program> programs );
+}

=== added directory 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart'
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/DefaultPatientChartService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/DefaultPatientChartService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/DefaultPatientChartService.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2004-2009, 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.patientchart;
+
+import static org.hisp.dhis.chart.Chart.TYPE_BAR;
+import static org.hisp.dhis.chart.Chart.TYPE_BAR3D;
+import static org.hisp.dhis.chart.Chart.TYPE_LINE;
+import static org.hisp.dhis.chart.Chart.TYPE_LINE3D;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.math.stat.regression.SimpleRegression;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.program.Program;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.DatasetRenderingOrder;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.BarRenderer;
+import org.jfree.chart.renderer.category.BarRenderer3D;
+import org.jfree.chart.renderer.category.LineAndShapeRenderer;
+import org.jfree.chart.renderer.category.LineRenderer3D;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ DefaultPatientChartService.java Sep 4, 2011 7:13:19 PM $
+ * 
+ */
+@Transactional
+public class DefaultPatientChartService
+    implements PatientChartService
+{
+    private static final Font titleFont = new Font( "Tahoma", Font.BOLD, 14 );
+
+    private static final Color[] colors = { Color.decode( "#d54a4a" ), Color.decode( "#2e4e83" ),
+        Color.decode( "#75e077" ), Color.decode( "#e3e274" ), Color.decode( "#e58c6d" ), Color.decode( "#df6ff3" ),
+        Color.decode( "#88878e" ), Color.decode( "#6ff3e8" ), Color.decode( "#6fc3f3" ), Color.decode( "#aaf36f" ),
+        Color.decode( "#9d6ff3" ), Color.decode( "#474747" ) };
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartStore patientChartStore;
+
+    public void setPatientChartStore( PatientChartStore patientChartStore )
+    {
+        this.patientChartStore = patientChartStore;
+    }
+
+    private PatientDataValueService patientDataValueService;
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+
+    // -------------------------------------------------------------------------
+    // ChartService implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void deletePatientChart( PatientChart patientChart )
+    {
+        patientChartStore.delete( patientChart );
+    }
+
+    @Override
+    public Collection<PatientChart> getAllPatientCharts()
+    {
+        return patientChartStore.getAll();
+    }
+
+    @Override
+    public PatientChart getPatientChart( int id )
+    {
+        return patientChartStore.get( id );
+    }
+
+    @Override
+    public Collection<PatientChart> getPatientCharts( Collection<Program> programs )
+    {
+        return patientChartStore.getPatientCharts( programs );
+    }
+
+    @Override
+    public int savePientChart( PatientChart patientChart )
+    {
+        return patientChartStore.save( patientChart );
+    }
+
+    @Override
+    public void updatePatientChart( PatientChart patientChart )
+    {
+        patientChartStore.update( patientChart );
+    }
+
+    @Override
+    public JFreeChart getJFreeChart( int id, I18nFormat format )
+    {
+        PatientChart patientChart = getPatientChart( id );
+
+        patientChart.setFormat( format );
+
+        return getJFreeChart( patientChart );
+    }
+
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
+    private JFreeChart getJFreeChart( PatientChart patientChart )
+    {
+        final BarRenderer barRenderer = getBarRenderer();
+        final BarRenderer bar3dRenderer = getBar3DRenderer();
+        final LineAndShapeRenderer lineRenderer = getLineRenderer();
+        final LineRenderer3D line3dRenderer = getLineRenderer3D();
+
+        // ---------------------------------------------------------------------
+        // Plot
+        // ---------------------------------------------------------------------
+
+        CategoryPlot plot = null;
+
+        CategoryDataset[] dataSets = getCategoryDataSet( patientChart );
+
+        if ( patientChart.isType( TYPE_LINE ) )
+        {
+            plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), lineRenderer );
+        }
+        if ( patientChart.isType( TYPE_LINE3D ) )
+        {
+            plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), line3dRenderer );
+        }
+        else if ( patientChart.isType( TYPE_BAR3D ) )
+        {
+            plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), bar3dRenderer );
+        }
+        else if ( patientChart.isType( TYPE_BAR ) )
+        {
+            plot = new CategoryPlot( dataSets[0], new CategoryAxis(), new NumberAxis(), barRenderer );
+        }
+
+        if ( patientChart.isRegression() )
+        {
+            plot.setDataset( 1, dataSets[1] );
+            plot.setRenderer( 1, lineRenderer );
+        }
+
+        JFreeChart jFreeChart = new JFreeChart( patientChart.getTitle(), titleFont, plot, true );
+
+        // ---------------------------------------------------------------------
+        // Plot orientation
+        // ---------------------------------------------------------------------
+
+        plot.setOrientation( PlotOrientation.VERTICAL );
+        plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD );
+
+        // ---------------------------------------------------------------------
+        // Category label positions
+        // ---------------------------------------------------------------------
+
+        CategoryAxis xAxis = plot.getDomainAxis();
+        xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
+
+        // ---------------------------------------------------------------------
+        // Color & antialias
+        // ---------------------------------------------------------------------
+
+        jFreeChart.setBackgroundPaint( Color.WHITE );
+        jFreeChart.setAntiAlias( true );
+
+        return jFreeChart;
+    }
+
+    /**
+     * Returns a bar renderer.
+     */
+    private BarRenderer getBarRenderer()
+    {
+        BarRenderer renderer = new BarRenderer();
+
+        renderer.setMaximumBarWidth( 0.07 );
+
+        for ( int i = 0; i < colors.length; i++ )
+        {
+            renderer.setSeriesPaint( i, colors[i] );
+            renderer.setShadowVisible( false );
+        }
+
+        return renderer;
+    }
+
+    /**
+     * Returns a bar3d renderer.
+     */
+    private BarRenderer getBar3DRenderer()
+    {
+        BarRenderer3D renderer = new BarRenderer3D();
+
+        renderer.setMaximumBarWidth( 0.07 );
+
+        for ( int i = 0; i < colors.length; i++ )
+        {
+            renderer.setSeriesPaint( i, colors[i] );
+            renderer.setShadowVisible( false );
+        }
+
+        return renderer;
+    }
+
+    /**
+     * Returns a line and shape renderer.
+     */
+    private LineAndShapeRenderer getLineRenderer()
+    {
+        LineAndShapeRenderer renderer = new LineAndShapeRenderer();
+
+        for ( int i = 0; i < colors.length; i++ )
+        {
+            renderer.setSeriesPaint( i, colors[i] );
+        }
+
+        return renderer;
+    }
+
+    /**
+     * Returns a line3d renderer.
+     */
+    private LineRenderer3D getLineRenderer3D()
+    {
+        LineRenderer3D renderer = new LineRenderer3D();
+
+        for ( int i = 0; i < colors.length; i++ )
+        {
+            renderer.setSeriesPaint( i, colors[i] );
+        }
+
+        return renderer;
+    }
+
+    /**
+     * Returns a DefaultCategoryDataSet based on patient-data-values for the
+     * patient-chart.
+     */
+    private CategoryDataset[] getCategoryDataSet( PatientChart patientChart )
+    {
+        final DefaultCategoryDataset regularDataSet = new DefaultCategoryDataset();
+        final DefaultCategoryDataset regressionDataSet = new DefaultCategoryDataset();
+
+        if ( patientChart != null )
+        {           
+            Collection<PatientDataValue> patientDataValues = patientDataValueService.getPatientDataValues( patientChart
+                .getDataElement() );
+            
+            Iterator<PatientDataValue> iter = patientDataValues.iterator();
+
+            while ( iter.hasNext() )
+            {
+                if ( !iter.next().getProgramStageInstance().getProgramInstance().getProgram().equals(
+                    patientChart.getProgram() ) )
+                {
+                    iter.remove();
+                }
+            }
+
+            // ---------------------------------------------------------
+            // Regular dataset
+            // ---------------------------------------------------------
+
+            int columnIndex = 0;
+
+            for ( PatientDataValue patientDataValue : patientDataValues )
+            {
+                final SimpleRegression regression = new SimpleRegression();
+
+                regularDataSet.addValue( Double.parseDouble( patientDataValue.getValue() ), patientChart.getDataElement().getName(), patientChart.getFormat()
+                    .formatDate( patientDataValue.getProgramStageInstance().getExecutionDate() ) );
+
+                columnIndex++;
+
+                regression.addData( columnIndex, Double.parseDouble( patientDataValue.getValue() ) );
+            }
+        }
+
+        return new CategoryDataset[] { regularDataSet, regressionDataSet };
+    }
+}

=== added directory 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/hibernate'
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/hibernate/HibernatePatientChartStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/hibernate/HibernatePatientChartStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientchart/hibernate/HibernatePatientChartStore.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2004-2009, 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.patientchart.hibernate;
+
+import java.util.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartStore;
+import org.hisp.dhis.program.Program;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ HibernatePatientChartStore.java Sep 5, 2011 8:32:56 AM $
+ * 
+ */
+public class HibernatePatientChartStore
+    extends HibernateGenericStore<PatientChart>
+    implements PatientChartStore
+
+{
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public Collection<PatientChart> getPatientCharts ( Collection<Program> programs )
+    {
+        Criteria criteria = getCriteria();
+        criteria.add( Restrictions.in( "program", programs ) );
+        return criteria.list();
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2011-09-02 10:40:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2011-09-06 02:47:21 +0000
@@ -133,6 +133,11 @@
      <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    
+   <bean id="org.hisp.dhis.patientchart.PatientChartStore" class="org.hisp.dhis.patientchart.hibernate.HibernatePatientChartStore">
+		<property name="clazz" value="org.hisp.dhis.patientchart.PatientChart"/>
+		<property name="sessionFactory" ref="sessionFactory"/>
+   </bean>
+	
 	<!-- Service definitions -->
 	
 	<bean id="org.hisp.dhis.program.ProgramDataEntryService"
@@ -307,6 +312,11 @@
       ref="org.hisp.dhis.program.ProgramAttributeOptionStore"/>
    </bean>
    
+   <bean id="org.hisp.dhis.patientchart.PatientChartService" class="org.hisp.dhis.patientchart.DefaultPatientChartService">
+		<property name="patientChartStore" ref="org.hisp.dhis.patientchart.PatientChartStore"/>
+		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService"/>
+   </bean>
+	
 	<!-- Aggregation engine -->
 
 	<bean

=== added directory 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart'
=== added directory 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/hibernate'
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/hibernate/patientchart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/hibernate/patientchart.hbm.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientchart/hibernate/patientchart.hbm.xml	2011-09-06 02:47:21 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
+
+<hibernate-mapping>
+  <class name="org.hisp.dhis.patientchart.PatientChart" table="patientchart">
+
+    <id name="id" column="patientchartid">
+      <generator class="native" />
+    </id>
+
+    <property name="title" not-null="true" unique="true" />
+
+    <property name="type" />
+
+    <property name="size" />
+    
+    <property name="regression" />
+    
+    <many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid"
+      foreign-key="fk_patientchart_programid" />
+    
+    <many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
+      foreign-key="fk_patientchart_dataElementid" />
+    
+  </class>
+</hibernate-mapping>

=== added directory 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart'
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GeneratePatientChartAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GeneratePatientChartAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GeneratePatientChartAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2004-2009, 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.caseentry.action.patientchart;
+
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.patientchart.PatientChartService;
+import org.jfree.chart.JFreeChart;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ViewPatientChartAction.java Sep 5, 2011 2:55:44 PM $
+ * 
+ */
+public class GeneratePatientChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    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;
+    }
+
+    private int height;
+
+    public int getHeight()
+    {
+        return height;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private JFreeChart chart;
+
+    public JFreeChart getChart()
+    {
+        return chart;
+    }
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        width = 500;
+
+        height = 400;
+        
+        chart = patientChartService.getJFreeChart( id, format );
+     
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GetPatientChartListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GetPatientChartListAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patientchart/GetPatientChartListAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2004-2009, 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.caseentry.action.patientchart;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ GetPatientChartListAction.java Sep 5, 2011 9:11:31 AM $
+ * 
+ */
+public class GetPatientChartListAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    private PatientService patientService;
+
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private Integer patientId;
+
+    public void setPatientId( Integer patientId )
+    {
+        this.patientId = patientId;
+    }
+
+    private Collection<PatientChart> patientCharts;
+
+    public Collection<PatientChart> getPatientCharts()
+    {
+        return patientCharts;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Patient patient = patientService.getPatient( patientId );
+
+        patientCharts = patientChartService.getPatientCharts( patient.getPrograms() );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-07-25 06:49:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-09-06 02:47:21 +0000
@@ -268,5 +268,18 @@
     <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
     <property name="programValidationService" ref="org.hisp.dhis.program.ProgramValidationService" />
   </bean>
+  
+  <!--  Patient chart -->
+  
+  <bean id="org.hisp.dhis.caseentry.action.patientchart.GetPatientChartListAction" class="org.hisp.dhis.caseentry.action.patientchart.GetPatientChartListAction"
+    scope="prototype">
+    <property name="patientChartService" ref="org.hisp.dhis.patientchart.PatientChartService" />
+    <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+  </bean>
+  
+  <bean id="org.hisp.dhis.caseentry.action.patientchart.GeneratePatientChartAction" class="org.hisp.dhis.caseentry.action.patientchart.GeneratePatientChartAction"
+    scope="prototype">
+    <property name="patientChartService" ref="org.hisp.dhis.patientchart.PatientChartService" />
+  </bean>
 
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2011-09-01 04:57:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2011-09-06 02:47:21 +0000
@@ -313,4 +313,7 @@
 filter_by														= Filter by
 hierachy_orgunit												= Hierarchy Organisation Unit
 F 																= F
-M 																= M
\ No newline at end of file
+M 																= M
+view_patient_chart												= View Patient chart
+generate_patient_chart											= Generate patient chart
+patient_chart_management										= Patient Chart Management
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-07-25 06:49:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-09-06 02:47:21 +0000
@@ -239,5 +239,17 @@
       <param name="page">/dhis-web-caseentry/validationResult.vm</param>
     </action>
 
+	<!-- Patient chart -->
+	
+	<action name="patientChartList" class="org.hisp.dhis.caseentry.action.patientchart.GetPatientChartListAction">
+      <result name="success" type="velocity">/content.vm</result>
+      <param name="page">/dhis-web-caseentry/patientChartList.vm</param>
+      <param name="javascripts">javascript/patientChart.js</param>
+    </action>
+    
+    <action name="generatePatientChart" class="org.hisp.dhis.caseentry.action.patientchart.GeneratePatientChartAction">
+      <result name="success" type="chart"></result>
+    </action>
+    
   </package>
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-08-30 01:41:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-09-06 02:47:21 +0000
@@ -1131,4 +1131,20 @@
 		
         TOGGLE.init();
     }
-}
\ No newline at end of file
+}
+
+// -------------------------------------------------------------------------
+// Show Patient chart list
+// -------------------------------------------------------------------------
+
+function patientChartList( patientId )
+{
+    $( '#patientChartListDiv' ).load('patientChartList.action?patientId=' + patientId ).dialog( {
+        autoOpen : true,
+        modal : true,
+        height : 400,
+        width : 500,
+        resizable : false,
+        title : 'Viewing Chart'
+    } );
+}

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientChart.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientChart.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patientChart.js	2011-09-06 02:47:21 +0000
@@ -0,0 +1,20 @@
+
+// -----------------------------------------------------------------------------
+// View chart
+// -----------------------------------------------------------------------------
+
+function viewChart( url, size )
+{
+    var width = size === 'wide' ? 1000 : 700;
+    var height = size === 'tall' ? 800 : 500;
+
+    $( '#chartImage' ).attr( 'src', url );
+    $( '#chartView' ).dialog( {
+        autoOpen : true,
+        modal : true,
+        height : 450,
+        width : 600,
+        resizable : false,
+        title : 'Viewing Chart'
+    } );
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2011-09-01 04:50:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/listPatient.vm	2011-09-06 02:47:21 +0000
@@ -21,6 +21,7 @@
 		  #end
           <col width="20">  
 		  <col width="20">                        
+		  <col width="20"> 
 		  <tr>
 		  	<td></td>
 		  	<td></td>
@@ -28,6 +29,7 @@
 		  	<td></td>  		  	
 		  	<td></td>
 			<td></td>
+			<td></td>
           <tr>
             <th>$i18n.getString( "full_name" )</th>        
             <th>$i18n.getString( "gender" )</th>
@@ -36,7 +38,7 @@
 			#if($mapPatientOrgunit.size()!=0)
 				<th>$i18n.getString( "hierachy_orgunit" )</th>
 			#end			
-            <th colspan="2">$i18n.getString( "operations" )</th>
+            <th colspan="3">$i18n.getString( "operations" )</th>
           </tr>
           
           <tbody id="list">	
@@ -63,6 +65,9 @@
 				<td style="text-align:center"#alternate( $mark )>
                   <a href="javascript:showSelectedDataRecoding('$patient.id');" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>                  
                 </td>
+				<td style="text-align:center"#alternate( $mark )>
+                  <a href="javascript:patientChartList( '$patient.id' )" title="$i18n.getString( 'data_entry' )"><img src="../images/add_to_dashboard.png" alt="$i18n.getString( 'view_patient_chart' )"></a>                  
+                </td>
                 <td style="text-align:center"#alternate( $mark )>
                   <a href="javascript:showPatientDetails( $patient.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
                 </td>               				
@@ -98,5 +103,11 @@
     </td>
   </tr>
 </table>
-   
+
+<div id="patientChartListDiv"></div>
+
+<div id="chartView" style="display: none; padding: 0; margin: 0;'">
+	<img id="chartImage" src="" style="padding: 10px;"></img>
+</div>
+
 <span id="message"></span>

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientChartList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientChartList.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientChartList.vm	2011-09-06 02:47:21 +0000
@@ -0,0 +1,23 @@
+<h3>$i18n.getString( "patient_chart_management" )</h3>
+
+<table class="mainPageTable">
+	
+	<tr>            
+		<th>$i18n.getString( "name" )</th>
+		<th class="{sorter: false}" style="width:60px">$i18n.getString( "operations" )</th>
+	</tr>
+	
+	<tbody id="list">
+		#foreach( $patientChart in $patientCharts )
+			<tr id="tr${patientChart.id}">
+				<td>
+					$patientChart.title
+				</td>
+				<td>
+					<a href="javascript:viewChart( 'generatePatientChart.action?id=$patientChart.id', '$patientChart.size' )" title="$i18n.getString( 'generate_patient_chart' )"><img src="../images/add_to_dashboard.png" alt="$i18n.getString( 'generate_patient_chart' )"></a>
+				</td>
+			</tr>
+		#end
+
+	</tbody>
+</table>

=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/AddPatientChartAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/AddPatientChartAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/AddPatientChartAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient.action.patientchart;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ AddPatientChartAction.java Sep 5, 2011 9:11:29 AM $
+ * 
+ */
+public class AddPatientChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private String title;
+
+    private String type;
+
+    private String size;
+
+    private boolean regression;
+
+    private Integer programId;
+
+    private Integer dataElementId;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    public void setTitle( String title )
+    {
+        this.title = title;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public void setSize( String size )
+    {
+        this.size = size;
+    }
+
+    public void setRegression( boolean regression )
+    {
+        this.regression = regression;
+    }
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    public Integer getProgramId()
+    {
+        return programId;
+    }
+
+    public void setDataElementId( Integer dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        PatientChart patientChart = new PatientChart();
+
+        patientChart.setTitle( title );
+        patientChart.setType( type );
+        patientChart.setSize( size );
+        patientChart.setRegression( regression );
+
+        DataElement dataElement = dataElementService.getDataElement( dataElementId );
+        patientChart.setDataElement( dataElement );
+
+        Program program = programService.getProgram( programId );
+        patientChart.setProgram( program );
+
+        patientChartService.savePientChart( patientChart );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/DeletePatientChartAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/DeletePatientChartAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/DeletePatientChartAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient.action.patientchart;
+
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ DeletePatientChartAction.java Sep 5, 2011 9:14:20 AM $
+ * 
+ */
+public class DeletePatientChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        PatientChart patientChart = patientChartService.getPatientChart( id );
+
+        patientChartService.deletePatientChart( patientChart );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient.action.patientchart;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ DeletePatientChartAction.java Sep 5, 2011 9:18:20 AM $
+ * 
+ */
+public class GetPatientChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    private ProgramStageDataElementService programStageDataElementService;
+
+    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+    {
+        this.programStageDataElementService = programStageDataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private PatientChart patientChart;
+
+    private Collection<DataElement> dataElements = new HashSet<DataElement>();
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public PatientChart getPatientChart()
+    {
+        return patientChart;
+    }
+
+    public Collection<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        patientChart = patientChartService.getPatientChart( id );
+
+        Program program = patientChart.getProgram();
+
+        Set<ProgramStage> programStages = program.getProgramStages();
+
+        for ( ProgramStage programStage : programStages )
+        {
+            dataElements.addAll( programStageDataElementService.getListDataElement( programStage ) );
+        }
+
+        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartListAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/GetPatientChartListAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient.action.patientchart;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ GetPatientChartListAction.java Sep 5, 2011 9:08:23 AM $
+ * 
+ */
+public class GetPatientChartListAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    public Integer getProgramId()
+    {
+        return programId;
+    }
+
+    private Collection<PatientChart> patientCharts;
+
+    public Collection<PatientChart> getPatientCharts()
+    {
+        return patientCharts;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Program program = programService.getProgram( programId );
+        Collection<Program> programs = new ArrayList<Program>();
+        programs.add( program );
+
+        patientCharts = patientChartService.getPatientCharts( programs );
+
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/ShowAddPatientChartFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/ShowAddPatientChartFormAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/ShowAddPatientChartFormAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient.action.patientchart;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ShowAddPatientChartFormAction.java Sep 5, 2011 9:24:10 AM $
+ * 
+ */
+public class ShowAddPatientChartFormAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private ProgramStageDataElementService programStageDataElementService;
+
+    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+    {
+        this.programStageDataElementService = programStageDataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private Integer programId;
+
+    public void setProgramId( Integer programId )
+    {
+        this.programId = programId;
+    }
+
+    public Integer getProgramId()
+    {
+        return programId;
+    }
+
+    private Collection<DataElement> dataElements = new HashSet<DataElement>();
+
+    public Collection<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        Program program = programService.getProgram( programId );
+        
+        Set<ProgramStage> programStages = program.getProgramStages();
+            
+        for( ProgramStage programStage : programStages)
+        {
+            dataElements.addAll( programStageDataElementService.getListDataElement( programStage ) );
+        }
+
+        FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
+        
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/UpdatePatientChartAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/UpdatePatientChartAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientchart/UpdatePatientChartAction.java	2011-09-06 02:47:21 +0000
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2004-2009, 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.patient.action.patientchart;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.patientchart.PatientChart;
+import org.hisp.dhis.patientchart.PatientChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ UpdatePatientChartAction.java Sep 5, 2011 9:13:29 AM $
+ * 
+ */
+public class UpdatePatientChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private PatientChartService patientChartService;
+
+    public void setPatientChartService( PatientChartService patientChartService )
+    {
+        this.patientChartService = patientChartService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private String title;
+
+    private String type;
+
+    private String size;
+
+    private boolean regression;
+    
+    private Integer programId;
+
+    private Integer dataElementId;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+    
+    public void setTitle( String title )
+    {
+        this.title = title;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public void setSize( String size )
+    {
+        this.size = size;
+    }
+
+    public void setRegression( boolean regression )
+    {
+        this.regression = regression;
+    }
+
+    public Integer getProgramId()
+    {
+        return programId;
+    }
+
+    public void setDataElementId( Integer dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation Action
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        PatientChart patientChart = patientChartService.getPatientChart( id );
+
+        patientChart.setTitle( title );
+        patientChart.setType( type );
+        patientChart.setSize( size );
+        patientChart.setRegression( regression );
+
+        DataElement dataElement = dataElementService.getDataElement( dataElementId );
+        patientChart.setDataElement( dataElement );
+
+        programId = patientChart.getProgram().getId();
+        
+        patientChartService.updatePatientChart( patientChart );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRelationshipAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRelationshipAction.java	2011-05-13 09:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRelationshipAction.java	2011-09-06 02:47:21 +0000
@@ -29,7 +29,6 @@
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
-import org.hisp.dhis.patient.state.SelectedStateManager;
 import org.hisp.dhis.relationship.Relationship;
 import org.hisp.dhis.relationship.RelationshipService;
 import org.hisp.dhis.relationship.RelationshipType;
@@ -55,13 +54,6 @@
         this.patientService = patientService;
     }
 
-    private SelectedStateManager selectedStateManager;
-
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-
     private RelationshipTypeService relationshipTypeService;
 
     public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowRelationshipListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowRelationshipListAction.java	2011-09-01 09:17:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/ShowRelationshipListAction.java	2011-09-06 02:47:21 +0000
@@ -46,8 +46,6 @@
 public class ShowRelationshipListAction
     implements Action
 {
-    private static final String RELATIONSHIP_LIST = "relationshiplist";
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-09-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-09-06 02:47:21 +0000
@@ -98,7 +98,7 @@
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.relationship.SearchRelationshipPatientAction"
 		class="org.hisp.dhis.patient.action.relationship.SearchRelationshipPatientAction"
@@ -124,8 +124,6 @@
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 		<property name="relationshipService"
 			ref="org.hisp.dhis.relationship.RelationshipService" />
-		<property name="selectedStateManager"
-			ref="org.hisp.dhis.patient.state.SelectedStateManager" />
 	</bean>
 
 	<bean
@@ -530,9 +528,8 @@
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
-	
-	<bean
-		id="org.hisp.dhis.patient.action.patient.GetProgramInstanceAction"
+
+	<bean id="org.hisp.dhis.patient.action.patient.GetProgramInstanceAction"
 		class="org.hisp.dhis.patient.action.patient.GetProgramInstanceAction"
 		scope="prototype">
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
@@ -653,7 +650,7 @@
 		<property name="programAttributeService"
 			ref="org.hisp.dhis.program.ProgramAttributeService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.program.RemoveProgramAttributeOptionAction"
 		class="org.hisp.dhis.patient.action.program.RemoveProgramAttributeOptionAction"
@@ -878,7 +875,7 @@
 		<property name="patientAttributeGroupService"
 			ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.patientattributegroup.UpdatePatientAttributeGroupAction"
 		class="org.hisp.dhis.patient.action.patientattributegroup.UpdatePatientAttributeGroupAction"
@@ -1038,7 +1035,7 @@
 			<ref bean="org.hisp.dhis.patient.PatientAttributeService" />
 		</property>
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.patient.action.caseaggregation.ShowUpdateCaseAggregationConditionFormAction"
 		class="org.hisp.dhis.patient.action.caseaggregation.ShowUpdateCaseAggregationConditionFormAction"
@@ -1095,7 +1092,7 @@
 			<ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
 		</property>
 	</bean>
-	
+
 	<!-- Validation - PatientValidationCriteria -->
 
 	<bean
@@ -1305,8 +1302,63 @@
 			<ref bean="org.hisp.dhis.patient.PatientIdentifierService" />
 		</property>
 		<property name="patientAttributeValueService">
-			<ref bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+			<ref
+				bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
 		</property>
 	</bean>
 
+	<!-- Patient chart -->
+
+	<bean id="org.hisp.dhis.patient.action.patientchart.AddPatientChartAction"
+		class="org.hisp.dhis.patient.action.patientchart.AddPatientChartAction"
+		scope="prototype">
+		<property name="patientChartService"
+			ref="org.hisp.dhis.patientchart.PatientChartService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.patient.action.patientchart.DeletePatientChartAction"
+		class="org.hisp.dhis.patient.action.patientchart.DeletePatientChartAction"
+		scope="prototype">
+		<property name="patientChartService"
+			ref="org.hisp.dhis.patientchart.PatientChartService" />
+	</bean>
+
+	<bean id="org.hisp.dhis.patient.action.patientchart.GetPatientChartAction"
+		class="org.hisp.dhis.patient.action.patientchart.GetPatientChartAction"
+		scope="prototype">
+		<property name="patientChartService"
+			ref="org.hisp.dhis.patientchart.PatientChartService" />
+		<property name="programStageDataElementService"
+			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.patient.action.patientchart.GetPatientChartListAction"
+		class="org.hisp.dhis.patient.action.patientchart.GetPatientChartListAction"
+		scope="prototype">
+		<property name="patientChartService"
+			ref="org.hisp.dhis.patientchart.PatientChartService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.patient.action.patientchart.ShowAddPatientChartFormAction"
+		class="org.hisp.dhis.patient.action.patientchart.ShowAddPatientChartFormAction"
+		scope="prototype">
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="programStageDataElementService"
+			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+	</bean>
+
+	<bean id="org.hisp.dhis.patient.action.patientchart.UpdatePatientChartAction"
+		class="org.hisp.dhis.patient.action.patientchart.UpdatePatientChartAction"
+		scope="prototype">
+		<property name="patientChartService"
+			ref="org.hisp.dhis.patientchart.PatientChartService" />
+		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+	</bean>
+	
 </beans>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-09-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-09-06 02:47:21 +0000
@@ -483,4 +483,22 @@
 search_patients_by_attributes = Search beneficiaries by attributes
 delete_program_data_entry_confirm = Do you want to delete program data entry ? 
 F = F
-M = M
\ No newline at end of file
+M = M
+patient_chart_management = Patient Chart Management
+add_patient_chart = Add Patient Chart
+chart_type = Chart type
+chart_size = Chart size
+save = Save
+title = Title
+include_regression_line = Include regression line
+must_select_one_dataelement = Please select one dataelement
+value_x_dataelements = Value (X) - Data elements 
+bar_chart= Bar chart
+bar3d_chart= Bar 3D chart
+line_chart= Line chart
+line3d_chart= Line 3D chart
+chart_size= Chart size
+normal= Normal
+wide= Wide
+tall= Tall
+patient_chart_details = Patient chart details
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-09-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-09-06 02:47:21 +0000
@@ -4,10 +4,9 @@
 "http://struts.apache.org/dtds/struts-2.0.dtd";>
 <struts>
 
-	<include file="dhis-web-commons.xml" />
+  <include file="dhis-web-commons.xml" />
 
-	<package name="dhis-web-maintenance-patient" extends="dhis-web-commons"
-		namespace="/dhis-web-maintenance-patient">
+  <package name="dhis-web-maintenance-patient" extends="dhis-web-commons" namespace="/dhis-web-maintenance-patient">
 
 		<action name="index" class="org.hisp.dhis.patient.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -117,10 +116,11 @@
 		<action name="searchRelationshipPatient"
 			class="org.hisp.dhis.patient.action.relationship.SearchRelationshipPatientAction">
 			<result name="success" type="velocity-json">
-				/dhis-web-maintenance-patient/responseRelationshipPatients.vm</result>
+				/dhis-web-maintenance-patient/responseRelationshipPatients.vm
+			</result>
 			<param name="requiredAuthorities">F_RELATIONSHIP_ADD</param>
 		</action>
-		
+
 		<action name="saveRelationship"
 			class="org.hisp.dhis.patient.action.relationship.SaveRelationshipAction">
 			<result name="success" type="velocity-xml">
@@ -267,10 +267,11 @@
 				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_DELETE</param>
 		</action>
-		
+
 		<!-- Patient -->
 
-		<action name="patient" class="org.hisp.dhis.patient.action.patient.SelectAction">
+		<action name="patient"
+			class="org.hisp.dhis.patient.action.patient.SelectAction">
 			<interceptor-ref name="organisationUnitTreeStack" />
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/selectPatient.vm</param>
@@ -284,7 +285,7 @@
 				,javascript/relationshipPatient.js
 			</param>
 		</action>
-		
+
 		<action name="organisationUnitHasPatients"
 			class="org.hisp.dhis.patient.action.patient.VerifyOrganisationUnitHasParentAction">
 			<result name="success" type="velocity-json">
@@ -292,7 +293,7 @@
 			<result name="input" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 		</action>
-		
+
 		<action name="patientform"
 			class="org.hisp.dhis.patient.action.patient.SearchPatientFormAction">
 			<result name="success" type="velocity-json">
@@ -323,7 +324,7 @@
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/detailsPatient.vm</param>
 		</action>
-		
+
 		<action name="removePatient"
 			class="org.hisp.dhis.patient.action.patient.RemovePatientAction">
 			<result name="success" type="velocity-json">
@@ -362,7 +363,8 @@
 
 		<action name="updatePatient"
 			class="org.hisp.dhis.patient.action.patient.UpdatePatientAction">
-			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_PATIENT_UPDATE</param>
 		</action>
 
@@ -383,7 +385,8 @@
 			class="org.hisp.dhis.patient.action.patient.ShowAddRepresentativeAction">
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/underAgeForm.vm</param>
-			<param name="javascripts">javascript/underage.js, ../dhis-web-commons/javascripts/date.js</param>
+			<param name="javascripts">javascript/underage.js,
+				../dhis-web-commons/javascripts/date.js</param>
 			<param name="stylesheets">style/basic.css</param>
 		</action>
 
@@ -404,7 +407,7 @@
 			class="org.hisp.dhis.patient.action.patient.GetPatientsByNameAction">
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/resultSearchPatients.vm</param>
-			<param name="stylesheets">../dhis-web-commons/paging/paging.css</param>     
+			<param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
 		</action>
 
 		<action name="defineOrgunitRegistrationForm"
@@ -458,7 +461,7 @@
 			<param name="page">/dhis-web-maintenance-patient/programUnenrollmentSelectForm.vm</param>
 			<param name="requiredAuthorities">F_PATIENT_UPDATE</param>
 		</action>
-		
+
 		<action name="getProgramInstance"
 			class="org.hisp.dhis.patient.action.patient.GetProgramInstanceAction">
 			<result name="success" type="velocity-json">
@@ -644,7 +647,8 @@
 
 		<action name="defineProgramAssociations"
 			class="org.hisp.dhis.patient.action.program.DefineProgramAssociationsAction">
-			<result name="success" type="redirect">program.action</result>
+			<result name="success" type="redirect">program.action
+			</result>
 			<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
 		</action>
 
@@ -679,7 +683,8 @@
 
 		<action name="addProgramStage"
 			class="org.hisp.dhis.patient.action.programstage.AddProgramStageAction">
-			<result name="success" type="redirect">programStage.action?id=${id}</result>
+			<result name="success" type="redirect">programStage.action?id=${id}
+			</result>
 			<param name="requiredAuthorities">F_PROGRAMSTAGE_ADD</param>
 		</action>
 
@@ -694,7 +699,8 @@
 
 		<action name="updateProgramStage"
 			class="org.hisp.dhis.patient.action.programstage.UpdateProgramStageAction">
-			<result name="success" type="redirect">programStage.action?id=${programId}</result>
+			<result name="success" type="redirect">
+				programStage.action?id=${programId}</result>
 			<param name="requiredAuthorities">F_PROGRAMSTAGE_UPDATE</param>
 		</action>
 
@@ -728,7 +734,8 @@
 
 		<action name="saveProgramStageSortOder"
 			class="org.hisp.dhis.patient.action.programstage.SaveProgramStageSortOrderAction">
-			<result name="success" type="redirect">programStage.action?id=${id}</result>
+			<result name="success" type="redirect">programStage.action?id=${id}
+			</result>
 		</action>
 
 		<!-- Data Entry Form -->
@@ -805,7 +812,8 @@
 
 		<action name="addPatientAttributeGroup"
 			class="org.hisp.dhis.patient.action.patientattributegroup.AddPatientAttributeGroupAction">
-			<result name="success" type="redirect">patientAttributeGroup.action</result>
+			<result name="success" type="redirect">patientAttributeGroup.action
+			</result>
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_ADD</param>
 		</action>
 
@@ -845,7 +853,7 @@
 				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<action name="showSortPatientAttributeGroup"
 			class="org.hisp.dhis.patient.action.patientattributegroup.GetPatientAttributeGroupListAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -855,12 +863,13 @@
 			<param name="stylesheets">style/basic.css</param>
 			<param name="requiredAuthorities">F_PATIENTATTRIBUTE_ADD</param>
 		</action>
-		
+
 		<action name="savePatientAttributeGroupSortOrder"
 			class="org.hisp.dhis.patient.action.patientattributegroup.SavePatientAttributeGroupSortOrderAction">
-			<result name="success" type="redirect">patientAttributeGroup.action</result>
+			<result name="success" type="redirect">patientAttributeGroup.action
+			</result>
 		</action>
-		
+
 		<!-- Patient Identifier Type -->
 
 		<action name="showAddPatientIdentifierTypeForm" class="org.hisp.dhis.patient.action.NoAction">
@@ -1020,7 +1029,7 @@
 				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
-		
+
 		<!-- Validation - PatientValidationCriteria -->
 
 		<action name="validationCriteria"
@@ -1118,7 +1127,7 @@
 			<param name="javascripts">javascript/programValidation.js</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="showAddSingleProgramValidationForm"
 			class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1143,7 +1152,7 @@
 			<param name="javascripts">javascript/programValidation.js</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-		
+
 		<action name="showUpdateSingleProgramValidationForm"
 			class="org.hisp.dhis.patient.action.validation.GetProgramValidationAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1207,7 +1216,7 @@
 				/dhis-web-commons/ajax/xmlResponseError.vm</result>
 			<interceptor-ref name="fileUploadStack" />
 		</action>
-		
+
 		<action name="importPatient"
 			class="org.hisp.dhis.patient.action.patientimport.ImportPatientAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1219,5 +1228,57 @@
 			<interceptor-ref name="fileUploadStack" />
 		</action>
 
+		<!-- Patient chart -->
+
+		<action name="patientChartList"
+			class="org.hisp.dhis.patient.action.patientchart.GetPatientChartListAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-patient/patientChartList.vm</param>
+			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
+			<param name="javascripts">javascript/patientChart.js</param>
+		</action>
+
+		<action name="showAddPatientChart"
+			class="org.hisp.dhis.patient.action.patientchart.ShowAddPatientChartFormAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-patient/addPatientChartForm.vm</param>
+			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
+		</action>
+
+		<action name="addPatientChart"
+			class="org.hisp.dhis.patient.action.patientchart.AddPatientChartAction">
+			<result name="success" type="redirect">
+				patientChartList.action?programId=${programId}</result>
+			<param name="requiredAuthorities">F_PROGRAM_ADD</param>
+		</action>
+
+		<action name="showUpdatePatientChart"
+			class="org.hisp.dhis.patient.action.patientchart.GetPatientChartAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-patient/updatePatientChartForm.vm</param>
+			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
+		</action>
+
+		<action name="updatePatientChart"
+			class="org.hisp.dhis.patient.action.patientchart.UpdatePatientChartAction">
+			<result name="success" type="redirect">
+				patientChartList.action?programId=${programId}</result>
+			<param name="requiredAuthorities">F_PROGRAM_ADD</param>
+		</action>
+
+		<action name="removePatientChart"
+			class="org.hisp.dhis.patient.action.patientchart.DeletePatientChartAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<param name="requiredAuthorities">F_PROGRAM_ADD</param>
+		</action>
+
+		<action name="getPatientChart"
+			class="org.hisp.dhis.patient.action.patientchart.GetPatientChartAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-maintenance-patient/responsePatientChart.vm</result>
+			<param name="requiredAuthorities">F_PROGRAM_ADD</param>
+		</action>
+
 	</package>
 </struts>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm	2011-09-06 02:47:21 +0000
@@ -0,0 +1,87 @@
+<script type="text/javascript">
+	jQuery(document).ready(	function(){
+		validation( 'addPatientChartForm', function( form ){			
+			form.submit();
+		});				
+		
+		//checkValueIsExist( "name", "validateProgram.action");
+	});		
+
+    var i18n_must_select_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_one_dataelement" ), "'")';
+</script>
+
+<h3>$i18n.getString( "add_patient_chart" )</h3>
+
+<form id="addPatientChartForm" name="addPatientChartForm" method="post" action="addPatientChart.action">
+<input type='hidden' id='programId' name='programId' value='$programId'>
+
+<table>
+    <tr>
+        <th colspan="2">$i18n.getString( "patient_chart_details" )</th>
+    </tr>
+    <tr>
+        <td><label for="title">$i18n.getString( "title" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+        <td><input type="text" id="title" name="title" style="width:298px" class="{validate:{required:true,minlength:4}}"></td>
+    </tr>
+
+    <tr>
+    	<td><label for="type">$i18n.getString( "chart_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+    	<td>
+    		<select id="type" name="type" style="width:300px">
+    			<option value="bar">$i18n.getString( "bar_chart" )</option>
+    			<option value="bar3d">$i18n.getString( "bar3d_chart" )</option>
+    			<option value="line">$i18n.getString( "line_chart" )</option>
+    			<option value="line3d">$i18n.getString( "line3d_chart" )</option>
+		    </select>
+	    </td>
+    </tr>
+    <tr>
+        <td><label for="type">$i18n.getString( "chart_size" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+        <td>
+            <select id="size" name="size" style="width:300px">
+                <option value="normal"#if ( $!chart.size == "normal" ) selected#end>$i18n.getString( "normal" )</option>
+                <option value="wide"#if ( $!chart.size == "wide" ) selected#end>$i18n.getString( "wide" )</option>
+                <option value="tall"#if ( $!chart.size == "tall" ) selected#end>$i18n.getString( "tall" )</option>
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="regression">$i18n.getString( "include_regression_line" )</label></td>
+        <td><input type="checkbox" id="regression" name="regression" value="true" ></td>
+    </tr>
+    <tr>
+        <td colspan="2" style="height:15px"></td>
+    </tr>
+	
+	<!-- dataelements -->
+
+	<tr>
+        <td>$i18n.getString( "value_x_dataelements" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+        <td>
+            <select id="dataElementId" name="dataElementId" style="width:300px" class="{validate:{required:true}}">
+				<option value="">$i18n.getString('please_select')</option>
+                #foreach( $dataElement in $dataElements )
+                    <option value="$dataElement.id">$dataElement.name</option>
+                #end
+            </select>                  
+        </td>
+    </tr>
+    <tr>
+        <td colspan="2" style="height:15px"></td>
+    </tr>
+
+</table>
+
+<table>
+    <tr>        
+        <td colspan="2">
+            <input type="submit" value="$i18n.getString( 'save' )" style="width:120px" />
+            <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='patientChartList.action?programId=$programId'" style="width:120px" />
+        </td>
+    </tr>
+    
+</table>
+
+</form>
+
+<span id="message"></span>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientChart.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientChart.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientChart.js	2011-09-06 02:47:21 +0000
@@ -0,0 +1,24 @@
+
+function showPatientChartDetails( patientChartId )
+{
+	jQuery.postJSON( "getPatientChart.action", {
+			id:patientChartId 
+		}, function(json){
+			setInnerHTML( 'idField', json.id );
+			setInnerHTML( 'titleField', json.title );	
+			setInnerHTML( 'typeField', json.type );
+			setInnerHTML( 'sizeField', json.size );
+			setInnerHTML( 'regressionField', json.regression );
+			setInnerHTML( 'dataElementField', json.dataElement );
+			showDetails();
+		});
+}
+
+// -----------------------------------------------------------------------------
+// Remove Patient Identifier Type
+// -----------------------------------------------------------------------------
+
+function removePatientChart( patientChartId, name )
+{
+    removeItem( patientChartId, name, i18n_confirm_delete, 'removePatientChart.action' );
+}
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientChartList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientChartList.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientChartList.vm	2011-09-06 02:47:21 +0000
@@ -0,0 +1,62 @@
+<h3>$i18n.getString( "patient_chart_management" )</h3>
+
+<table class="mainPageTable">
+	<tr>
+		<td align="right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddPatientChart.action?programId=$programId'" style="width:70px"></td>
+	</tr>
+  <tr>
+    <td style="vertical-align:top">
+		
+		<table class="listTable" id="listTable">
+			  <col>          
+			  <col width="100">
+			<thead>			  
+			  <tr>            
+				<th>$i18n.getString( "name" )</th>
+				<th class="{sorter: false}">$i18n.getString( "operations" )</th>
+			  </tr>
+			</thead>
+			  <tbody id="list">
+				#foreach( $patientChart in $patientCharts )
+				  <tr id="tr${patientChart.id}">
+				  
+					<td>$encoder.htmlEncode( $patientChart.title )</td>                
+					
+					<td style="text-align:center">
+					  <a href="showUpdatePatientChart.action?id=$patientChart.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+					  <a href="javascript:removePatientChart( '$patientChart.id', '$encoder.jsEncode( $patientChart.title )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+					  <a href="javascript:showPatientChartDetails( $patientChart.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+					</td>
+					
+				  </tr>
+				#end
+
+			  </tbody>
+        </table>
+		</td>
+		<td style="width:20em; padding-left:2em; vertical-align:top">
+
+			<div id="detailsArea" style="display:none">
+				<div style="float:right">
+					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"></a>
+				</div>				
+				<p><label>$i18n.getString( "id" ):</label><br><span id="idField"></span></p>
+				<p><label>$i18n.getString( "title" ):</label><br><span id="titleField"></span></p>
+				<p><label>$i18n.getString( "type" ):</label><br><span id="typeField"></span></p>				
+				<p><label>$i18n.getString( "size" ):</label><br><span id="sizeField"></span></p>
+				<p><label>$i18n.getString( "regression" ):</label><br><span id="regressionField"></span></p>
+				<p><label>$i18n.getString( "dataElement" ):</label><br><span id="dataElementField"></span></p>
+			</div>
+
+		</td>
+	</tr>
+</table>
+
+<script type="text/javascript">
+	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_prorgam" ) , "'" )';
+	
+	jQuery(document).ready(function(){	
+		tableSorter( 'listTable' );
+	});
+	
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2011-07-28 02:46:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2011-09-06 02:47:21 +0000
@@ -9,7 +9,7 @@
 		
 		<table class="listTable" id="listTable">
 			  <col>          
-			  <col width="180">
+			  <col width="200">
 			<thead>			  
 			  <tr>            
 				<th>$i18n.getString( "name" )</th>
@@ -27,6 +27,7 @@
 					  <a href="programValidation.action?programId=$program.id" title="$i18n.getString( 'define_program_validation' )"><img src="../images/assign_b.png" alt="$i18n.getString( 'define_program_validation' )"></a>
 					  <a href="showUpdateProgramForm.action?id=$program.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
 					  <a href="programStage.action?id=$program.id" title="$i18n.getString( 'view_stage_management' )"><img src="../images/add_section.png" alt="$i18n.getString( 'view_stage_management' )"></a>
+					  <a href="patientChartList.action?programId=$program.id" title="$i18n.getString( 'patient_chart_management' )"><img src="../images/add_to_dashboard.png" alt="$i18n.getString( 'remove' )"></a>
 					  <a href="javascript:removeProgram( '$program.id', '$encoder.jsEncode( $program.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
 					  <a href="javascript:showProgramDetails( $program.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
 					</td>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatientChart.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatientChart.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatientChart.vm	2011-09-06 02:47:21 +0000
@@ -0,0 +1,8 @@
+{
+	"id":"$patientChart.id",
+	"title":"$!encoder.jsEncode( ${patientChart.title} )",
+	"type": "$!encoder.jsEncode( ${patientChart.type} )",
+	"size": "$patientChart.size",
+	"regression": "$patientChart.regression",
+	"dataElement": "$!encoder.jsEncode( ${patientChart.dataElement.name} )"
+}
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm	2011-09-06 02:47:21 +0000
@@ -0,0 +1,87 @@
+<script type="text/javascript">
+	jQuery(document).ready(	function(){
+		validation( 'updatePatientChartForm', function( form ){			
+			form.submit();
+		});				
+		
+		//checkValueIsExist( "name", "validateProgram.action");
+	});		
+
+    var i18n_must_select_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_one_dataelement" ), "'")';
+</script>
+
+<h3>$i18n.getString( "add_patient_chart" )</h3>
+
+<form id="updatePatientChartForm" name="addPatientChartForm" method="post" action="updatePatientChart.action">
+<input type='hidden' id='id' name='id' value='$patientChart.id'>
+
+<table>
+    <tr>
+        <th colspan="2">$i18n.getString( "patient_chart_details" )</th>
+    </tr>
+    <tr>
+        <td><label for="title">$i18n.getString( "title" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+        <td><input type="text" id="title" name="title" style="width:298px" value='$patientChart.title' class="{validate:{required:true,minlength:4}}"></td>
+    </tr>
+
+    <tr>
+    	<td><label for="type">$i18n.getString( "chart_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+    	<td>
+    		<select id="type" name="type" style="width:300px">
+    			<option value="bar" #if($patientChart.type=='bar') selected #end>$i18n.getString( "bar_chart" )</option>
+    			<option value="bar3d" #if($patientChart.type=='bar3d') selected #end>$i18n.getString( "bar3d_chart" )</option>
+    			<option value="line" #if($patientChart.type=='line') selected #end>$i18n.getString( "line_chart" )</option>
+    			<option value="line3d" #if($patientChart.type=='line3d') selected #end>$i18n.getString( "line3d_chart" )</option>
+		    </select>
+	    </td>
+    </tr>
+    <tr>
+        <td><label for="type">$i18n.getString( "chart_size" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+        <td>
+            <select id="size" name="size" style="width:300px">
+                <option value="normal" #if ( $!patientChart.size == "normal" ) selected #end>$i18n.getString( "normal" )</option>
+                <option value="wide" #if ( $!patientChart.size == "wide" ) selected #end>$i18n.getString( "wide" )</option>
+                <option value="tall" #if ( $!patientChart.size == "tall" ) selected #end>$i18n.getString( "tall" )</option>
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="regression">$i18n.getString( "include_regression_line" )</label></td>
+        <td><input type="checkbox" id="regression" name="regression" value="true" #if ( $!patientChart.regression == "true" ) checked #end></td>
+    </tr>
+    <tr>
+        <td colspan="2" style="height:15px"></td>
+    </tr>
+	
+	<!-- dataelements -->
+
+	<tr>
+        <td>$i18n.getString( "value_x_dataelements" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+        <td>
+            <select id="dataElementId" name="dataElementId" style="width:300px" class="{validate:{required:true}}">
+				<option value="">$i18n.getString('please_select')</option>
+                #foreach( $dataElement in $dataElements )
+                    <option value="$dataElement.id" #if( $!patientChart.dataElement.id == $dataElement.id ) selected #end>$dataElement.name</option>
+                #end
+            </select>                  
+        </td>
+    </tr>
+    <tr>
+        <td colspan="2" style="height:15px"></td>
+    </tr>
+
+</table>
+
+<table>
+    <tr>        
+        <td colspan="2">
+            <input type="submit" value="$i18n.getString( 'save' )" style="width:120px" />
+            <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='patientChartList.action?programId=$patientChart.program.id'" style="width:120px" />
+        </td>
+    </tr>
+    
+</table>
+
+</form>
+
+<span id="message"></span>