dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18786
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7962: Add section entry form for patient module.
------------------------------------------------------------
revno: 7962
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-08-24 17:09:45 +0700
message:
Add section entry form for patient module.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageSectionService.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/customDataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/RemoveProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSectionSortOrderAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/ShowAddProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/ValidateProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageSectionForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/sections.png
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStageSection.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonProgramStageSection.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageSection.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageSectionSortOder.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageSectionForm.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java
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/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.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/programStageList.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2012-05-23 16:19:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2012-08-24 10:09:45 +0000
@@ -38,6 +38,12 @@
public class ProgramStage
extends BaseIdentifiableObject
{
+ public static final String TYPE_DEFAULT = "default";
+
+ public static final String TYPE_SECTION = "section";
+
+ public static final String TYPE_CUSTOM = "custom";
+
/**
* Determines if a de-serialized file is compatible with this class.
*/
@@ -55,8 +61,10 @@
private Set<ProgramStageDataElement> programStageDataElements = new HashSet<ProgramStageDataElement>();
+ private Set<ProgramStageSection> programStageSections = new HashSet<ProgramStageSection>();
+
private DataEntryForm dataEntryForm;
-
+
private Integer standardInterval;
// -------------------------------------------------------------------------
@@ -116,7 +124,7 @@
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
-
+
public DataEntryForm getDataEntryForm()
{
return dataEntryForm;
@@ -132,6 +140,16 @@
return description;
}
+ public Set<ProgramStageSection> getProgramStageSections()
+ {
+ return programStageSections;
+ }
+
+ public void setProgramStageSections( Set<ProgramStageSection> programStageSections )
+ {
+ this.programStageSections = programStageSections;
+ }
+
public Integer getStandardInterval()
{
return standardInterval;
@@ -197,4 +215,18 @@
this.programStageDataElements = programStageDataElements;
}
+ public String getDataEntryType()
+ {
+ if ( dataEntryForm != null )
+ {
+ return TYPE_CUSTOM;
+ }
+
+ if ( programStageSections.size() > 0 )
+ {
+ return TYPE_SECTION;
+ }
+
+ return TYPE_DEFAULT;
+ }
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,140 @@
+/*
+ * 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.program;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.Dxf2Namespace;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version ProgramStageSection.java 11:07:27 AM Aug 22, 2012 $
+ */
+@XmlRootElement( name = "ProgramStageSection", namespace = Dxf2Namespace.NAMESPACE )
+@XmlAccessorType( value = XmlAccessType.NONE )
+public class ProgramStageSection
+ extends BaseIdentifiableObject
+{
+ private static final long serialVersionUID = 3141607927546197116L;
+
+ private List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+
+ private int sortOrder;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public ProgramStageSection()
+ {
+
+ }
+
+ public ProgramStageSection( String name, List<ProgramStageDataElement> programStageDataElements )
+ {
+ this.name = name;
+ this.programStageDataElements = programStageDataElements;
+ }
+
+ public ProgramStageSection( String name, List<ProgramStageDataElement> programStageDataElements, int sortOrder )
+ {
+ this.name = name;
+ this.programStageDataElements = programStageDataElements;
+ this.sortOrder = sortOrder;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode, equals and toString
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals( Object object )
+ {
+ if ( this == object )
+ {
+ return true;
+ }
+
+ if ( object == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != object.getClass() )
+ {
+ return false;
+ }
+
+ final ProgramStageSection other = (ProgramStageSection) object;
+
+ return name.equals( other.getName() );
+ }
+
+ @Override
+ public String toString()
+ {
+ return "[" + name + "]";
+ }
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public void setSortOrder( int sortOrder )
+ {
+ this.sortOrder = sortOrder;
+ }
+
+ public int getSortOrder()
+ {
+ return sortOrder;
+ }
+
+ public List<ProgramStageDataElement> getProgramStageDataElements()
+ {
+ return programStageDataElements;
+ }
+
+ public void setProgramStageDataElements( List<ProgramStageDataElement> programStageDataElements )
+ {
+ this.programStageDataElements = programStageDataElements;
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,56 @@
+/*
+ * 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.program;
+
+import java.util.Collection;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version ProgramStageSectionService.java 11:12:41 AM Aug 22, 2012 $
+ */
+public interface ProgramStageSectionService
+{
+ String ID = ProgramStageSection.class.getName();
+
+ // -------------------------------------------------------------------------
+ // ProgramStageSection
+ // -------------------------------------------------------------------------
+
+ int saveProgramStageSection( ProgramStageSection programStageSection );
+
+ void deleteProgramStageSection( ProgramStageSection programStageSection );
+
+ void updateProgramStageSection( ProgramStageSection programStageSection );
+
+ ProgramStageSection getProgramStageSection( int id );
+
+ ProgramStageSection getProgramStageSectionByName( String name );
+
+ Collection<ProgramStageSection> getAllProgramStageSections();
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageSectionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageSectionService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageSectionService.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,96 @@
+/*
+ * 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.program;
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version DefaultProgramStageSectionService.java 11:19:35 AM Aug 22, 2012 $
+ */
+@Transactional
+public class DefaultProgramStageSectionService
+ implements ProgramStageSectionService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private GenericIdentifiableObjectStore<ProgramStageSection> programStageSectionStore;
+
+ public void setProgramStageSectionStore(
+ GenericIdentifiableObjectStore<ProgramStageSection> programStageSectionStore )
+ {
+ this.programStageSectionStore = programStageSectionStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // ProgramStageSection implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int saveProgramStageSection( ProgramStageSection programStageSection )
+ {
+ return programStageSectionStore.save( programStageSection );
+ }
+
+ @Override
+ public void deleteProgramStageSection( ProgramStageSection programStageSection )
+ {
+ programStageSectionStore.delete( programStageSection );
+ }
+
+ @Override
+ public void updateProgramStageSection( ProgramStageSection programStageSection )
+ {
+ programStageSectionStore.update( programStageSection );
+ }
+
+ @Override
+ public ProgramStageSection getProgramStageSection( int id )
+ {
+ return programStageSectionStore.get( id );
+ }
+
+ @Override
+ public ProgramStageSection getProgramStageSectionByName( String name )
+ {
+ return programStageSectionStore.getByName( name );
+ }
+
+ @Override
+ public Collection<ProgramStageSection> getAllProgramStageSections()
+ {
+ return programStageSectionStore.getAll();
+ }
+
+}
=== 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 2012-08-17 06:42:32 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-08-24 10:09:45 +0000
@@ -50,6 +50,11 @@
<property name="clazz" value="org.hisp.dhis.program.ProgramStage" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
+
+ <bean id="org.hisp.dhis.program.ProgramStageSectionStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+ <property name="clazz" value="org.hisp.dhis.program.ProgramStageSection" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
<bean id="org.hisp.dhis.program.ProgramStore" class="org.hisp.dhis.program.hibernate.HibernateProgramStore">
<property name="clazz" value="org.hisp.dhis.program.Program" />
@@ -212,6 +217,10 @@
<property name="programStageStore" ref="org.hisp.dhis.program.ProgramStageStore" />
</bean>
+ <bean id="org.hisp.dhis.program.ProgramStageSectionService" class="org.hisp.dhis.program.DefaultProgramStageSectionService">
+ <property name="programStageSectionStore" ref="org.hisp.dhis.program.ProgramStageSectionStore" />
+ </bean>
+
<bean id="org.hisp.dhis.program.ProgramService" class="org.hisp.dhis.program.DefaultProgramService">
<property name="programStore" ref="org.hisp.dhis.program.ProgramStore" />
</bean>
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml 2012-05-23 16:19:55 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStage.hbm.xml 2012-08-24 10:09:45 +0000
@@ -34,5 +34,10 @@
<property name="standardInterval" />
+ <set name="programStageSections" order-by="sortOrder" cascade="all">
+ <key column="programStageid" />
+ <one-to-many class="org.hisp.dhis.program.ProgramStageSection" />
+ </set>
+
</class>
</hibernate-mapping>
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramStageSection.hbm.xml 2012-08-24 10:09:45 +0000
@@ -0,0 +1,29 @@
+<?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"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.program.ProgramStageSection" table="programstagesection">
+
+ <id name="id" column="programstagesectionid">
+ <generator class="native" />
+ </id>
+
+ &identifiableProperties;
+
+ <list name="programStageDataElements" table="programstagesection_dataelement">
+ <key column="programstagesectionid" />
+ <list-index column="sort_order" base="1" />
+ <many-to-many class="org.hisp.dhis.program.ProgramStageDataElement">
+ <column name="programstageid"/>
+ <column name="dataelementid" />
+ </many-to-many>
+ </list>
+
+ <property name="sortOrder" column="sortorder" not-null="true" />
+
+ </class>
+</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-07-10 01:41:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-08-24 10:09:45 +0000
@@ -31,8 +31,10 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.hisp.dhis.caseentry.state.SelectedStateManager;
import org.hisp.dhis.dataentryform.DataEntryForm;
@@ -42,9 +44,11 @@
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramDataEntryService;
+import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.program.ProgramStageSection;
import org.hisp.dhis.program.comparator.ProgramStageDataElementSortOrderComparator;
import com.opensymphony.xwork2.Action;
@@ -89,6 +93,10 @@
private Program program;
+ private ProgramStage programStage;
+
+ private Set<ProgramStageSection> sections = new HashSet<ProgramStageSection>();
+
// -------------------------------------------------------------------------
// Getters && Setters
// -------------------------------------------------------------------------
@@ -103,11 +111,21 @@
this.programStageInstanceId = programStageInstanceId;
}
+ public Set<ProgramStageSection> getSections()
+ {
+ return sections;
+ }
+
public Program getProgram()
{
return program;
}
+ public ProgramStage getProgramStage()
+ {
+ return programStage;
+ }
+
public void setSelectedStateManager( SelectedStateManager selectedStateManager )
{
this.selectedStateManager = selectedStateManager;
@@ -165,13 +183,15 @@
// ---------------------------------------------------------------------
// Get program-stage-instance
// ---------------------------------------------------------------------
-
+
if ( programStageInstanceId != null )
- {
+ {
programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
-
+
program = programStageInstance.getProgramStage().getProgram();
-
+
+ programStage = programStageInstance.getProgramStage();
+
selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
// ---------------------------------------------------------------------
@@ -200,13 +220,18 @@
DataEntryForm dataEntryForm = programStageInstance.getProgramStage().getDataEntryForm();
- if ( dataEntryForm != null )
+ if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_CUSTOM ) )
{
- Boolean disabled = ( program.getDisplayProvidedOtherFacility()==null)? true : !program.getDisplayProvidedOtherFacility();
- customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry( dataEntryForm
- .getHtmlCode(), patientDataValues, disabled.toString(), i18n,
+ Boolean disabled = (program.getDisplayProvidedOtherFacility() == null) ? true : !program
+ .getDisplayProvidedOtherFacility();
+ customDataEntryFormCode = programDataEntryService.prepareDataEntryFormForEntry(
+ dataEntryForm.getHtmlCode(), patientDataValues, disabled.toString(), i18n,
programStageInstance.getProgramStage(), programStageInstance, organisationUnit );
}
+ else if ( programStage.getDataEntryType().equals( ProgramStage.TYPE_SECTION ) )
+ {
+ sections = programStage.getProgramStageSections();
+ }
}
return SUCCESS;
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/customDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/customDataEntryForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/customDataEntryForm.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,3 @@
+<div id="customEntryScreenContainer">
+ $customDataEntryFormCode
+</div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-08-02 13:10:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-08-24 10:09:45 +0000
@@ -30,114 +30,11 @@
<div id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>
#if( $customDataEntryFormCode )
- <div id="customEntryScreenContainer">
- $customDataEntryFormCode
- </div>
+ #parse( "/dhis-web-caseentry/customDataEntryForm.vm" )
+ #elseif( $sections )
+ #parse( "/dhis-web-caseentry/sectionDataEntryForm.vm" )
#else
- <table id="defaultEntryScreenContainer" class='entryScreen formSection'>
- <colgroup>
- <col id="deCol">
- <col id="entryCol">
- <col width="18%" />
- </colgroup>
-
- <tr>
- <th>$i18n.getString( "data_element" )</th>
- <th>$i18n.getString( "entry" )</th>
- #if( $!programStageInstance.programStage.program.isRegistration() == 'true')
- <th>$i18n.getString( "provided_elsewhere" )</th>
- #end
- </tr>
- #set( $dataElementRowCount = 0 )
- #set( $mark = true )
- #set( $tabIndex = 1 )
- #foreach( $programStageDataElement in $programStageDataElements )
- #set( $dataElementRowCount = $dataElementRowCount + 1 )
- #set( $mark = !$mark )
- #set( $patientDataValue = false )
- #set( $key = $programStageDataElement.dataElement.id )
- #set( $patientDataValue = $patientDataValueMap.get( $key ) )
- <tr #alternate( $mark )>
- ##data element name
- <td class='text-column' align='center'>
- <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
- $encoder.htmlEncode( $programStageDataElement.dataElement.formNameFallback )
- #if ( $programStageDataElement.compulsory )
- <em title="$i18n.getString( "required" )" class="required">*</em>
- #end
- </span>
- ##type
- <span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>
- </td>
- ##entry
- <td class='input-column'>
- #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
- #if( $!programStageDataElement.dataElement.optionSet )
- #set( $hasOptionSet = 'true')
- #else
- #set( $hasOptionSet = 'false')
- #end
- #if( $programStageDataElement.dataElement.textType == "longText" )
- <textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
- #elseif( $programStageDataElement.dataElement.type == "bool" )
- <select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
- <option value="">[$i18n.getString( "select_value" )]</option>
- <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
- <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
- </select>
- #elseif( $programStageDataElement.dataElement.type == "trueOnly" )
- <input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
- #elseif( $programStageDataElement.dataElement.type == "date" )
- <input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
- <script type="text/javascript">
- datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
- </script>
- #elseif($hasOptionSet=='true')
- <input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
- #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
- #if( $type=='number' )
- class="{validate:{number:true}}"
- #elseif( $type=='positiveNumber' )
- class="{validate:{positive_integer:true}}"
- #elseif( $type=='negativeNumber' )
- class="{validate:{negative_integer:true}}"
- #elseif( $type=='int' )
- class="{validate:{integer:true}}"
- #end />
- #else
- <input name="entryfield" dataElementId='$programStageDataElement.dataElement.id'
- data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
- id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )"
- onchange="saveVal( $programStageDataElement.dataElement.id )"
- onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
-
- #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
- #if( $type=='number' )
- class="{validate:{number:true}}"
- #elseif( $type=='positiveNumber' )
- class="{validate:{positive_integer:true}}"
- #elseif( $type=='negativeNumber' )
- class="{validate:{negative_integer:true}}"
- #elseif( $type=='int' )
- class="{validate:{integer:true}}"
- #end
- />
- #end
- </td>
- #if( $!programStageInstance.programStage.program.isRegistration() == 'true' )
- <td style='width:20px;' align='center'>
- #set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
- #if( $programStageDataElement.allowProvidedElsewhere == 'true')
- <div id='span_$id' class='provided-elsewhere'>
- <input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
- </div>
- #end
- </td>
- #end
- </tr>
- #set( $tabIndex = $tabIndex + 1 )
- #end
- </table>
+ #parse( "/dhis-web-caseentry/defaultDataEntryForm.vm" )
#end
</div>
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,104 @@
+<table id="defaultEntryScreenContainer" class='entryScreen formSection'>
+ <colgroup>
+ <col id="deCol">
+ <col id="entryCol">
+ <col width="18%" />
+ </colgroup>
+
+ <tr>
+ <th>$i18n.getString( "data_element" )</th>
+ <th>$i18n.getString( "entry" )</th>
+ #if( $!programStageInstance.programStage.program.isRegistration() == 'true')
+ <th>$i18n.getString( "provided_elsewhere" )</th>
+ #end
+ </tr>
+#set( $dataElementRowCount = 0 )
+#set( $mark = true )
+#set( $tabIndex = 1 )
+#foreach( $programStageDataElement in $programStageDataElements )
+ #set( $dataElementRowCount = $dataElementRowCount + 1 )
+ #set( $mark = !$mark )
+ #set( $patientDataValue = false )
+ #set( $key = $programStageDataElement.dataElement.id )
+ #set( $patientDataValue = $patientDataValueMap.get( $key ) )
+ <tr #alternate( $mark )>
+ ##data element name
+ <td class='text-column' align='center'>
+ <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
+ $encoder.htmlEncode( $programStageDataElement.dataElement.formNameFallback )
+ #if ( $programStageDataElement.compulsory )
+ <em title="$i18n.getString( "required" )" class="required">*</em>
+ #end
+ </span>
+ ##type
+ <span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>
+ </td>
+ ##entry
+ <td class='input-column'>
+ #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+ #if( $!programStageDataElement.dataElement.optionSet )
+ #set( $hasOptionSet = 'true')
+ #else
+ #set( $hasOptionSet = 'false')
+ #end
+ #if( $programStageDataElement.dataElement.textType == "longText" )
+ <textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
+ #elseif( $programStageDataElement.dataElement.type == "bool" )
+ <select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "select_value" )]</option>
+ <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $programStageDataElement.dataElement.type == "trueOnly" )
+ <input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+ #elseif( $programStageDataElement.dataElement.type == "date" )
+ <input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+ <script type="text/javascript">
+ datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
+ </script>
+ #elseif($hasOptionSet=='true')
+ <input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+ #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
+ #if( $type=='number' )
+ class="{validate:{number:true}}"
+ #elseif( $type=='positiveNumber' )
+ class="{validate:{positive_integer:true}}"
+ #elseif( $type=='negativeNumber' )
+ class="{validate:{negative_integer:true}}"
+ #elseif( $type=='int' )
+ class="{validate:{integer:true}}"
+ #end />
+ #else
+ <input name="entryfield" dataElementId='$programStageDataElement.dataElement.id'
+ data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+ id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )"
+ onchange="saveVal( $programStageDataElement.dataElement.id )"
+ onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+
+ #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
+ #if( $type=='number' )
+ class="{validate:{number:true}}"
+ #elseif( $type=='positiveNumber' )
+ class="{validate:{positive_integer:true}}"
+ #elseif( $type=='negativeNumber' )
+ class="{validate:{negative_integer:true}}"
+ #elseif( $type=='int' )
+ class="{validate:{integer:true}}"
+ #end
+ />
+ #end
+ </td>
+ #if( $!programStageInstance.programStage.program.isRegistration() == 'true' )
+ <td style='width:20px;' align='center'>
+ #set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
+ #if( $programStageDataElement.allowProvidedElsewhere == 'true')
+ <div id='span_$id' class='provided-elsewhere'>
+ <input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
+ </div>
+ #end
+ </td>
+ #end
+ </tr>
+ #set( $tabIndex = $tabIndex + 1 )
+#end
+</table>
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,121 @@
+#foreach( $section in $sections )
+ <table class="formSection" width='60%'>
+ <tr>
+ <td class='entryScreen'>
+ <div class="cent" style='cursor:pointer;' ondblclick="jQuery('#div_$section.id').toggle();"><h3>$encoder.htmlEncode( $section.name )</h3></div>
+ </td>
+ </tr>
+ <tr>
+ <td width='100%'>
+ <div id='div_$section.id' class='entryScreen'>
+ <table width='100%'>
+ <colgroup>
+ <col id="deCol">
+ <col id="entryCol">
+ #if( $!programStageInstance.programStage.program.isRegistration() == 'true')
+ <col width="18%" />
+ #end
+ </colgroup>
+
+ <tr>
+ <th>$i18n.getString( "data_element" )</th>
+ <th>$i18n.getString( "entry" )</th>
+ #if( $!programStageInstance.programStage.program.isRegistration() == 'true')
+ <th>$i18n.getString( "provided_elsewhere" )</th>
+ #end
+ </tr>
+ #set( $dataElementRowCount = 0 )
+ #set( $mark = true )
+ #set( $tabIndex = 1 )
+ #foreach( $programStageDataElement in $section.programStageDataElements )
+ #set( $dataElementRowCount = $dataElementRowCount + 1 )
+ #set( $mark = !$mark )
+ #set( $patientDataValue = false )
+ #set( $key = $programStageDataElement.dataElement.id )
+ #set( $patientDataValue = $patientDataValueMap.get( $key ) )
+ <tr #alternate( $mark )>
+ ##data element name
+ <td class='text-column' align='center'>
+ <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
+ $encoder.htmlEncode( $programStageDataElement.dataElement.formNameFallback )
+ #if ( $programStageDataElement.compulsory )
+ <em title="$i18n.getString( "required" )" class="required">*</em>
+ #end
+ </span>
+ ##type
+ <span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>
+ </td>
+ ##entry
+ <td class='input-column'>
+ #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+ #if( $!programStageDataElement.dataElement.optionSet )
+ #set( $hasOptionSet = 'true')
+ #else
+ #set( $hasOptionSet = 'false')
+ #end
+ #if( $programStageDataElement.dataElement.textType == "longText" )
+ <textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
+ #elseif( $programStageDataElement.dataElement.type == "bool" )
+ <select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "select_value" )]</option>
+ <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $programStageDataElement.dataElement.type == "trueOnly" )
+ <input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+ #elseif( $programStageDataElement.dataElement.type == "date" )
+ <input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+ <script type="text/javascript">
+ datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
+ </script>
+ #elseif($hasOptionSet=='true')
+ <input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+ #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
+ #if( $type=='number' )
+ class="{validate:{number:true}}"
+ #elseif( $type=='positiveNumber' )
+ class="{validate:{positive_integer:true}}"
+ #elseif( $type=='negativeNumber' )
+ class="{validate:{negative_integer:true}}"
+ #elseif( $type=='int' )
+ class="{validate:{integer:true}}"
+ #end />
+ #else
+ <input name="entryfield" dataElementId='$programStageDataElement.dataElement.id'
+ data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+ id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )"
+ onchange="saveVal( $programStageDataElement.dataElement.id )"
+ onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
+
+ #set( $type=$programStageDataElement.dataElement.getDetailedNumberType())
+ #if( $type=='number' )
+ class="{validate:{number:true}}"
+ #elseif( $type=='positiveNumber' )
+ class="{validate:{positive_integer:true}}"
+ #elseif( $type=='negativeNumber' )
+ class="{validate:{negative_integer:true}}"
+ #elseif( $type=='int' )
+ class="{validate:{integer:true}}"
+ #end
+ />
+ #end
+ </td>
+ #if( $!programStageInstance.programStage.program.isRegistration() == 'true' )
+ <td style='width:20px;' align='center'>
+ #set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
+ #if( $programStageDataElement.allowProvidedElsewhere == 'true')
+ <div id='span_$id' class='provided-elsewhere'>
+ <input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
+ </div>
+ #end
+ </td>
+ #end
+ </tr>
+ #set( $tabIndex = $tabIndex + 1 )
+ #end
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+#end
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2012-06-04 16:20:41 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2012-08-24 10:09:45 +0000
@@ -117,7 +117,7 @@
{
return this.customDataEntryFormCode;
}
-
+
private DataEntryForm dataEntryForm;
public DataEntryForm getDataEntryForm()
@@ -311,8 +311,8 @@
for ( DataElementOperand operand : section.getGreyedFields() )
{
- greyedFields.put( operand.getDataElement().getId() + ":" +
- operand.getCategoryOptionCombo().getId(), true );
+ greyedFields.put( operand.getDataElement().getId() + ":" + operand.getCategoryOptionCombo().getId(),
+ true );
}
}
}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/AddProgramStageSectionAction.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/programstage/AddProgramStageSectionAction.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,149 @@
+/*
+ * 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.programstage;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version AddProgramStageSectionAction.java 11:29:40 AM Aug 22, 2012 $
+ */
+public class AddProgramStageSectionAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private ProgramStageDataElementService programStageDataElementService;
+
+ public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+ {
+ this.programStageDataElementService = programStageDataElementService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer programStageId;
+
+ public Integer getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private List<Integer> dataElementIds;
+
+ public void setDataElementIds( List<Integer> dataElementIds )
+ {
+ this.dataElementIds = dataElementIds;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ // ---------------------------------------------------------------------
+ // Section
+ // ---------------------------------------------------------------------
+
+ List<ProgramStageDataElement> psDataElements = new ArrayList<ProgramStageDataElement>();
+ for ( Integer id : dataElementIds )
+ {
+ DataElement dataElement = dataElementService.getDataElement( id );
+ ProgramStageDataElement psDataElement = programStageDataElementService.get( programStage, dataElement );
+ psDataElements.add( psDataElement );
+ }
+
+ ProgramStageSection section = new ProgramStageSection( name, psDataElements, programStage
+ .getProgramStageSections().size() );
+
+ // ---------------------------------------------------------------------
+ // Update program stage
+ // ---------------------------------------------------------------------
+
+ Set<ProgramStageSection> sections = programStage.getProgramStageSections();
+ if ( sections == null )
+ {
+ sections = new HashSet<ProgramStageSection>();
+ }
+ sections.add( section );
+
+ programStage.setProgramStageSections( sections );
+ programStageService.updateProgramStage( programStage );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/GetProgramStageSectionAction.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/programstage/GetProgramStageSectionAction.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,127 @@
+/*
+ * 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.programstage;
+
+import java.util.Collection;
+
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version GetProgramStageSectionAction.java 11:29:40 AM Aug 22, 2012 $
+ */
+public class GetProgramStageSectionAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private Integer programStageId;
+
+ public Integer getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ private ProgramStageSection section;
+
+ public ProgramStageSection getSection()
+ {
+ return section;
+ }
+
+ private Collection<ProgramStageDataElement> availableDataElements;
+
+ public Collection<ProgramStageDataElement> getAvailableDataElements()
+ {
+ return availableDataElements;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ section = programStageSectionService.getProgramStageSection( id );
+
+ if ( programStageId != null )
+ {
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ availableDataElements = programStage.getProgramStageDataElements();
+
+ for ( ProgramStageSection section : programStage.getProgramStageSections() )
+ {
+ availableDataElements.removeAll( section.getProgramStageDataElements() );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/RemoveProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/RemoveProgramStageSectionAction.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/programstage/RemoveProgramStageSectionAction.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,99 @@
+/*
+ * 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.programstage;
+
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version AddProgramStageSectionAction.java 11:29:40 AM Aug 22, 2012 $
+ */
+public class RemoveProgramStageSectionAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer programStageId;
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ ProgramStageSection section = programStageSectionService.getProgramStageSection( id );
+
+ programStage.getProgramStageSections().remove( section );
+
+ programStageService.updateProgramStage( programStage );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSectionSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/SaveProgramStageSectionSortOrderAction.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/programstage/SaveProgramStageSectionSortOrderAction.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,95 @@
+/*
+ * 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.programstage;
+
+import java.util.List;
+
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+public class SaveProgramStageSectionSortOrderAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ public Integer getId()
+ {
+ return id;
+ }
+
+ private List<Integer> sectionIds;
+
+ public void setSectionIds( List<Integer> sectionIds )
+ {
+ this.sectionIds = sectionIds;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ int index = 0;
+ for( Integer sectionId : sectionIds )
+ {
+ ProgramStageSection section = programStageSectionService.getProgramStageSection( sectionId );
+ section.setSortOrder( index++ );
+ programStageSectionService.updateProgramStageSection( section );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/ShowAddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/ShowAddProgramStageSectionAction.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/programstage/ShowAddProgramStageSectionAction.java 2012-08-24 10:09:45 +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.programstage;
+
+import java.util.Collection;
+
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version ShowAddProgramStageSectionAction.java 11:29:40 AM Aug 22, 2012 $
+ */
+public class ShowAddProgramStageSectionAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer programStageId;
+
+ public Integer getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ private ProgramStageSection section;
+
+ public ProgramStageSection getSection()
+ {
+ return section;
+ }
+
+ private Collection<ProgramStageDataElement> availableDataElements;
+
+ public Collection<ProgramStageDataElement> getAvailableDataElements()
+ {
+ return availableDataElements;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ availableDataElements = programStage.getProgramStageDataElements();
+
+ for ( ProgramStageSection section : programStage.getProgramStageSections() )
+ {
+ availableDataElements.removeAll( section.getProgramStageDataElements() );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/UpdateProgramStageSectionAction.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/programstage/UpdateProgramStageSectionAction.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,152 @@
+/*
+ * 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.programstage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version UpdateProgramStageSectionAction.java 11:29:40 AM Aug 22, 2012 $
+ */
+public class UpdateProgramStageSectionAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private ProgramStageDataElementService programStageDataElementService;
+
+ public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+ {
+ this.programStageDataElementService = programStageDataElementService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer programStageId;
+
+ public Integer getProgramStageId()
+ {
+ return programStageId;
+ }
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private List<Integer> dataElementIds;
+
+ public void setDataElementIds( List<Integer> dataElementIds )
+ {
+ this.dataElementIds = dataElementIds;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ // ---------------------------------------------------------------------
+ // Section
+ // ---------------------------------------------------------------------
+
+ ProgramStageSection section = programStageSectionService.getProgramStageSection( id );
+
+ List<ProgramStageDataElement> psDataElements = new ArrayList<ProgramStageDataElement>();
+ for ( Integer id : dataElementIds )
+ {
+ DataElement dataElement = dataElementService.getDataElement( id );
+ ProgramStageDataElement psDataElement = programStageDataElementService.get( programStage, dataElement );
+ psDataElements.add( psDataElement );
+ }
+
+ section.setName( name );
+ section.setProgramStageDataElements( psDataElements );
+
+ programStageSectionService.updateProgramStageSection( section );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/ValidateProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programstage/ValidateProgramStageSectionAction.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/programstage/ValidateProgramStageSectionAction.java 2012-08-24 10:09:45 +0000
@@ -0,0 +1,112 @@
+package org.hisp.dhis.patient.action.programstage;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.program.ProgramStageSection;
+import org.hisp.dhis.program.ProgramStageSectionService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version ValidateProgramStageSectionAction.java 08:20:59 AM Aug 23, 2012 $
+ */
+
+public class ValidateProgramStageSectionAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private ProgramStageSectionService programStageSectionService;
+
+ public void setProgramStageSectionService( ProgramStageSectionService programStageSectionService )
+ {
+ this.programStageSectionService = programStageSectionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ ProgramStageSection match = programStageSectionService.getProgramStageSectionByName( name );
+
+ if ( match != null && (id == null || match.getId() != id.intValue()) )
+ {
+ message = i18n.getString( "duplicate_names" );
+
+ return ERROR;
+ }
+
+ // ---------------------------------------------------------------------
+ // Validation success
+ // ---------------------------------------------------------------------
+
+ message = i18n.getString( "everything_is_ok" );
+
+ return SUCCESS;
+ }
+}
=== 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 2012-07-30 10:10:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-08-24 10:09:45 +0000
@@ -278,7 +278,51 @@
scope="prototype">
<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
</bean>
+
+ <!-- Program Stage Section -->
+ <bean id="org.hisp.dhis.patient.action.programstage.AddProgramStageSectionAction"
+ class="org.hisp.dhis.patient.action.programstage.AddProgramStageSectionAction" scope="prototype">
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.programstage.UpdateProgramStageSectionAction"
+ class="org.hisp.dhis.patient.action.programstage.UpdateProgramStageSectionAction" scope="prototype">
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.programstage.RemoveProgramStageSectionAction"
+ class="org.hisp.dhis.patient.action.programstage.RemoveProgramStageSectionAction" scope="prototype">
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.programstage.GetProgramStageSectionAction"
+ class="org.hisp.dhis.patient.action.programstage.GetProgramStageSectionAction" scope="prototype">
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.programstage.ShowAddProgramStageSectionAction"
+ class="org.hisp.dhis.patient.action.programstage.ShowAddProgramStageSectionAction" scope="prototype">
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.programstage.ValidateProgramStageSectionAction"
+ class="org.hisp.dhis.patient.action.programstage.ValidateProgramStageSectionAction" scope="prototype">
+ <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.patient.action.programstage.SaveProgramStageSectionSortOrderAction"
+ class="org.hisp.dhis.patient.action.programstage.SaveProgramStageSectionSortOrderAction" scope="prototype">
+ <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+ </bean>
+
<!-- Data Entry Form -->
<bean
=== 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 2012-08-09 02:00:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-08-24 10:09:45 +0000
@@ -255,4 +255,10 @@
show_incident_date = Show incident date
display_date_of_incident = Display date of incident
patient_attribute_group_sort_order = Person attribute group sort order
-visit_selected_program_stage_x_th_time = Visit selected program stage x(th) time
\ No newline at end of file
+visit_selected_program_stage_x_th_time = Visit selected program stage x(th) time
+program_stage_section = Program stage section
+create_new_program_stage_section = Create new program stage section
+update_program_stage_section = Update program stage section
+section_management = Section management
+sort_order = Sort order
+program_stage_section_sort_order = Program stage section sort order
\ 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 2012-07-30 10:10:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-08-24 10:09:45 +0000
@@ -345,7 +345,92 @@
<param name="page">/dhis-web-maintenance-patient/programStageList.vm</param>
<param name="javascripts">javascript/programStage.js</param>
</action>
+
+ <action name="validateProgramStageSection"
+ class="org.hisp.dhis.patient.action.programstage.ValidateProgramStageSectionAction">
+ <result name="success" type="velocity-json">
+ ../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ ../dhis-web-commons/ajax/jsonResponseError.vm</result>
+ </action>
+
+ <!-- Program stage section -->
+
+ <action name="programStageSectionList"
+ class="org.hisp.dhis.patient.action.programstage.GetProgramStageAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">
+ /dhis-web-maintenance-patient/programStageSection.vm</param>
+ <param name="javascripts">javascript/commons.js,javascript/programStageSection.js</param>
+ <param name="stylesheets">style/basic.css</param>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_MANAGEMENT</param>
+ </action>
+
+ <action name="showAddProgramStageSectionForm"
+ class="org.hisp.dhis.patient.action.programstage.ShowAddProgramStageSectionAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">
+ /dhis-web-maintenance-patient/addProgramStageSectionForm.vm</param>
+ <param name="javascripts">javascript/commons.js,javascript/programStageSection.js</param>
+ <param name="stylesheets">style/basic.css</param>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_ADD</param>
+ </action>
+
+ <action name="addProgramStageSection"
+ class="org.hisp.dhis.patient.action.programstage.AddProgramStageSectionAction">
+ <result name="success" type="redirect">programStageSectionList.action?id=${programStageId}
+ </result>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_ADD</param>
+ </action>
+
+ <action name="showUpdateProgramStageSectionForm"
+ class="org.hisp.dhis.patient.action.programstage.GetProgramStageSectionAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">
+ /dhis-web-maintenance-patient/updateProgramStageSectionForm.vm</param>
+ <param name="javascripts">javascript/commons.js,javascript/programStageSection.js</param>
+ <param name="stylesheets">style/basic.css</param>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_UPDATE</param>
+ </action>
+
+ <action name="updateProgramStageSection"
+ class="org.hisp.dhis.patient.action.programstage.UpdateProgramStageSectionAction">
+ <result name="success" type="redirect">programStageSectionList.action?id=${programStageId}
+ </result>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_UPDATE</param>
+ </action>
+ <action name="getProgramStageSection"
+ class="org.hisp.dhis.patient.action.programstage.GetProgramStageSectionAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-patient/jsonProgramStageSection.vm</result>
+ </action>
+
+ <action name="removeProgramStageSection"
+ class="org.hisp.dhis.patient.action.programstage.RemoveProgramStageSectionAction">
+ <result name="success" type="velocity-json">
+ ../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ ../dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_DELETE</param>
+ </action>
+
+ <action name="showProgramStageSectionSortedOderForm"
+ class="org.hisp.dhis.patient.action.programstage.GetProgramStageAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">
+ /dhis-web-maintenance-patient/programStageSectionSortOder.vm</param>
+ <param name="javascripts">javascript/commons.js,javascript/programStageSection.js</param>
+ <param name="stylesheets">style/basic.css</param>
+ <param name="requiredAuthorities">F_PROGRAMSTAGE_SECTION_MANAGEMENT</param>
+ </action>
+
+ <action name="saveProgramStageSectionSortOrder"
+ class="org.hisp.dhis.patient.action.programstage.SaveProgramStageSectionSortOrderAction">
+ <result name="success" type="redirect">programStageSectionList.action?id=${id}</result>
+ </action>
+
+
<!-- Data Entry Form -->
<action name="viewDataEntryForm"
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageSectionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageSectionForm.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/addProgramStageSectionForm.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,78 @@
+<script>
+jQuery( document ).ready( function()
+{
+ validation( 'programStageSectionForm', function(form){
+ form.submit();
+ });
+ checkValueIsExist( "name", "validateProgramStageSection.action");
+ byId('name').focus();
+});
+</script>
+
+<h3>$i18n.getString( "create_new_program_stage_section" )</h3>
+
+<form id="programStageSectionForm" name="programStageSectionForm" onsubmit="selectAllById('dataElementIds');" action="addProgramStageSection.action" method="post">
+ <input type="hidden" id="programStageId" name="programStageId" value="$programStageId"/>
+
+<table>
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "program_stage_details" )</th></tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" class="{validate:{required:true,rangelength:[2,160]}}"/></td>
+ </tr>
+ </tbody>
+</table>
+
+<table id="programStageMembersArea">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_data_elements" )</th>
+ <th></th>
+ <th>$i18n.getString( "selected_data_elements" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>
+ <select size="15" id="availableList" name='availableList' multiple="multiple" ondblclick="moveSelectedById( 'availableList', 'dataElementIds' );">
+ #foreach( $psPataElement in $availableDataElements )
+ <option value='$psPataElement.dataElement.id'>$psPataElement.dataElement.name</option>
+ #end
+ </select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" class='filterButton' onclick="moveSelectedById( 'availableList', 'dataElementIds' );"/><br/>
+ <input type="button" value="<" class='filterButton' onclick="moveSelectedById( 'dataElementIds', 'availableList' );"/><br/>
+ <input type="button" value=">>" class='filterButton' onclick="moveAllById( 'availableList', 'dataElementIds' );"/><br/>
+ <input type="button" value="<<" class='filterButton' onclick="moveAllById( 'dataElementIds', 'availableList' );"/>
+ </td>
+
+ <td>
+ <select size="15" id="dataElementIds" name='dataElementIds' multiple="multiple" ondblclick="moveSelectedById( 'dataElementIds', 'availableList' );"></select>
+ </td>
+
+ <td>
+ <a href="javascript:moveUpSelectedOption('dataElementIds')"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption('dataElementIds')"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStageSectionList.action?id=$programStageId'" />
+</p>
+
+</form>
+
+<script type="text/javascript">
+ var i18n_invalid_min_max_days = '$encoder.jsEscape( $i18n.getString( "invalid_min_max_days" ) , "'")';
+ var i18n_value_must_positive = '$encoder.jsEscape( $i18n.getString( "value_must_positive" ) , "'")';
+ var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+ var i18n_compulsory_checkbox_title = '$encoder.jsEscape( $i18n.getString( "compulsory_checkbox_title" ) , "'")';
+</script>
\ 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/images/sections.png'
Binary files dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/sections.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/sections.png 2012-08-24 10:09:45 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStageSection.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStageSection.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/programStageSection.js 2012-08-24 10:09:45 +0000
@@ -0,0 +1,41 @@
+
+function programStageSectionList( programStageId )
+{
+ window.location.href = "programStage.action?id=" + programId;
+}
+
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showSectionDetails( sectionId )
+{
+ jQuery.getJSON( 'getProgramStageSection.action', { id: sectionId }, function ( json ) {
+ setInnerHTML( 'nameField', json.programStageSection.name );
+ setInnerHTML( 'dataElementCountField', json.programStageSection.dataElementCount );
+ showDetails();
+ });
+}
+
+function removePatientAttribute( programStageId, sectionId, name )
+{
+ var result = window.confirm( i18n_confirm_delete );
+ if ( result )
+ {
+ jQuery.getJSON( "removeProgramStageSection.action",
+ {
+ programStageId:programStageId,
+ id:sectionId
+ },
+ function( json )
+ {
+ jQuery( "tr#tr" + sectionId ).remove();
+ jQuery( "table.listTable tbody tr" ).removeClass( "listRow listAlternateRow" );
+ jQuery( "table.listTable tbody tr:odd" ).addClass( "listAlternateRow" );
+ jQuery( "table.listTable tbody tr:even" ).addClass( "listRow" );
+ jQuery( "table.listTable tbody" ).trigger("update");
+
+ showSuccessMessage( i18n_delete_success );
+ });
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonProgramStageSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonProgramStageSection.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/jsonProgramStageSection.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,7 @@
+{ "programStageSection":
+ {
+ "id": "$!{section.id}",
+ "name": "$!encoder.jsonEncode( ${section.name} )",
+ "dataElementCount": "$!{section.programStageDataElements.size()}"
+ }
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm 2012-06-13 04:13:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm 2012-08-24 10:09:45 +0000
@@ -4,7 +4,7 @@
<table class="listTable" id="listTable">
<col>
<col>
- <col width="120">
+ <col width="150">
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
@@ -26,6 +26,7 @@
<a href="javascript:removeItem( '$association.id', '$encoder.jsEncode( $association.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
#end
<a href="javascript:showProgramStageDetails( $association.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ <a href="programStageSectionList.action?id=$association.id" title="$i18n.getString( 'section_management' )"><img src="images/sections.png" alt="$i18n.getString( 'section_management' )"></a>
<a href="viewDataEntryForm.action?programStageId=$association.id" title="$i18n.getString( "design_data_entry_form" )"><img src="../images/edit_layout.png" alt="$i18n.getString( 'design_data_entry_form' )"></a>
</td>
</tr>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageSection.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/programStageSection.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,58 @@
+<h3>$i18n.getString( "program_stage_section" ) $i18n.getString( "for" ) $programStage.name</h3>
+
+<input type='hidden' id='id' name='id' value='$programStage.id'>
+
+<table class="mainPageTable">
+ <tr>
+ <td align="right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddProgramStageSectionForm.action?programStageId=$programStage.id'" style="width:150px"><br>
+ <input type="button" value="$i18n.getString( 'sort_order' )" onclick="window.location.href='showProgramStageSectionSortedOderForm.action?id=$programStage.id'" style="width:150px"><br>
+ <input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='programStage.action?id=$programStage.program.id'" style="width:150px">
+ </td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top">
+ <table class="listTable" id="listTable">
+ <col>
+ <col width="150">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th>$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $section in $programStage.programStageSections )
+ <tr id="tr${section.id}" #alternate( $mark )>
+ <td onclick="showProgramStageDetails( $section.id )">$encoder.htmlEncode( $section.name )</td>
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="showUpdateProgramStageSectionForm.action?programStageId=$programStage.id&id=$section.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <a href="javascript:removePatientAttribute( '$programStage.id', '$section.id', '$encoder.jsEncode( $section.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:showSectionDetails( $section.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+ </tr>
+ #set( $mark = !$mark )
+ #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 class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
+
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_prorgam_stage" ) , "'" )';
+ var i18n_delete_success = '$encoder.jsEscape( $i18n.getString( "delete_success" ) , "'" )';
+</script>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageSectionSortOder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageSectionSortOder.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/programStageSectionSortOder.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,28 @@
+<h3>$i18n.getString( "program_stage_section_sort_order" ) $i18n.getString( "for" ) $programStage.name</h3>
+
+<form id="programStageSectionSortOrderForm" name="programStageSectionSortOrderForm" onsubmit="selectAllById('sectionIds');" action="saveProgramStageSectionSortOrder.action" method="post">
+
+<input type='hidden' id='id' name='id' value='$programStage.id'>
+
+<table>
+ <tr>
+ <td>
+ <select id='sectionIds' name='sectionIds'multiple style='width:400px;height:200px'>
+ #foreach( $section in $programStage.programStageSections )
+ <option value='$section.id'>$section.name</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption('sectionIds')"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption('sectionIds')"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" value="$i18n.getString( 'save' )" >
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStageSectionList.action?id=$programStage.id'" />
+ </td>
+ </tr>
+</table>
+</form>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageSectionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageSectionForm.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/updateProgramStageSectionForm.vm 2012-08-24 10:09:45 +0000
@@ -0,0 +1,84 @@
+<script>
+jQuery( document ).ready( function()
+{
+ validation( 'programStageSectionForm', function(form){
+ form.submit();
+ });
+
+ checkValueIsExist( "name", "validateProgramStageSection.action", {id:getFieldValue('id')});
+ byId('name').focus();
+});
+</script>
+
+<h3>$i18n.getString( "update_program_stage_section" )</h3>
+
+<form id="programStageSectionForm" name="programStageSectionForm" onsubmit="selectAllById('dataElementIds');" action="updateProgramStageSection.action" method="post">
+ <input type="hidden" id="programStageId" name="programStageId" value="$programStageId"/>
+ <input type="hidden" id="id" name="id" value="$section.id"/>
+
+<table>
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "program_stage_details" )</th></tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" class="{validate:{required:true,rangelength:[2,160]}}" value='$section.name'/></td>
+ </tr>
+ </tbody>
+</table>
+
+<table id="programStageMembersArea">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_data_elements" )</th>
+ <th></th>
+ <th>$i18n.getString( "selected_data_elements" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td>
+ <select size="15" id="availableList" name='availableList' multiple="multiple" ondblclick="moveSelectedById( 'availableList', 'dataElementIds' );">
+ #foreach( $psDataElement in $availableDataElements )
+ <option value='$psDataElement.dataElement.id'>$psDataElement.dataElement.name</option>
+ #end
+ </select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" class='filterButton' onclick="moveSelectedById( 'availableList', 'dataElementIds' );"/><br/>
+ <input type="button" value="<" class='filterButton' onclick="moveSelectedById( 'dataElementIds', 'availableList' );"/><br/>
+ <input type="button" value=">>" class='filterButton' onclick="moveAllById( 'availableList', 'dataElementIds' );"/><br/>
+ <input type="button" value="<<" class='filterButton' onclick="moveAllById( 'dataElementIds', 'availableList' );"/>
+ </td>
+
+ <td>
+ <select size="15" id="dataElementIds" name='dataElementIds' multiple="multiple" ondblclick="moveSelectedById( 'dataElementIds', 'availableList' );">
+ #foreach( $psDataElement in $section.programStageDataElements )
+ <option value='$psDataElement.dataElement.id'>$psDataElement.dataElement.name</option>
+ #end
+ </select>
+ </td>
+
+ <td>
+ <a href="javascript:moveUpSelectedOption('dataElementIds')"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption('dataElementIds')"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<p>
+ <input type="submit" value="$i18n.getString( 'update' )"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStageSectionList.action?id=$programStageId'" />
+</p>
+
+</form>
+
+<script type="text/javascript">
+ var i18n_invalid_min_max_days = '$encoder.jsEscape( $i18n.getString( "invalid_min_max_days" ) , "'")';
+ var i18n_value_must_positive = '$encoder.jsEscape( $i18n.getString( "value_must_positive" ) , "'")';
+ var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+ var i18n_compulsory_checkbox_title = '$encoder.jsEscape( $i18n.getString( "compulsory_checkbox_title" ) , "'")';
+</script>
\ No newline at end of file