dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18222
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7603: [mobile] check required fields and add identifiers and sttributes
------------------------------------------------------------
revno: 7603
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-07-13 16:18:09 +0700
message:
[mobile] check required fields and add identifiers and sttributes
modified:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java
dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java 2012-06-19 03:45:39 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java 2012-07-13 09:18:09 +0000
@@ -32,11 +32,8 @@
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-
import javax.servlet.http.HttpServletRequest;
-
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
@@ -49,6 +46,7 @@
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.util.ContextUtils;
@@ -115,6 +113,18 @@
this.util = util;
}
+ private ProgramStageDataElementService programStageDataElementService;
+
+ public ProgramStageDataElementService getProgramStageDataElementService()
+ {
+ return programStageDataElementService;
+ }
+
+ public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+ {
+ this.programStageDataElementService = programStageDataElementService;
+ }
+
// -------------------------------------------------------------------------
// Input Output
// -------------------------------------------------------------------------
@@ -161,24 +171,17 @@
return program;
}
- List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- public void setDataElements( List<DataElement> dataElements )
- {
- this.dataElements = dataElements;
- }
-
private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
public ArrayList<ProgramStageDataElement> getProgramStageDataElements()
{
return this.programStageDataElements;
}
+
+ public void setProgramStageDataElements( ArrayList<ProgramStageDataElement> programStageDataElements )
+ {
+ this.programStageDataElements = programStageDataElements;
+ }
static final Comparator<ProgramStageDataElement> OrderBySortOrder = new Comparator<ProgramStageDataElement>()
{
@@ -206,12 +209,6 @@
programStage = program.getProgramStages().iterator().next();
programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
-
- for ( ProgramStageDataElement each : programStageDataElements )
- {
- dataElements.add( each.getDataElement() );
- }
-
Collections.sort( programStageDataElements, OrderBySortOrder );
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
@@ -237,6 +234,9 @@
DataElement dataElement = dataElementService.getDataElement( dataElementId );
+ ProgramStageDataElement programStageDataElement = programStageDataElementService.get( programStage,
+ dataElement );
+
value = value.trim();
Boolean valueIsEmpty = (value == null || value.length() == 0);
@@ -251,6 +251,11 @@
}
prevDataValues.put( key, value );
}
+ else if ( valueIsEmpty && programStageDataElement.isCompulsory() )
+ {
+ typeViolations.put( key, "is_empty" );
+ prevDataValues.put( key, value );
+ }
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java 2012-07-13 09:18:09 +0000
@@ -28,15 +28,12 @@
package org.hisp.dhis.light.anonymous.action;
import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.hisp.dhis.dataelement.DataElement;
+import java.util.Collections;
+import java.util.Comparator;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
-
import com.opensymphony.xwork2.Action;
/**
@@ -89,12 +86,25 @@
return program;
}
- List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
+ private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
+
+ public ArrayList<ProgramStageDataElement> getProgramStageDataElements()
+ {
+ return this.programStageDataElements;
+ }
+
+ public void setProgramStageDataElements( ArrayList<ProgramStageDataElement> programStageDataElements )
+ {
+ this.programStageDataElements = programStageDataElements;
+ }
+
+ static final Comparator<ProgramStageDataElement> OrderBySortOrder = new Comparator<ProgramStageDataElement>()
+ {
+ public int compare( ProgramStageDataElement i1, ProgramStageDataElement i2 )
+ {
+ return i1.getSortOrder().compareTo( i2.getSortOrder() );
+ }
+ };
// -------------------------------------------------------------------------
// Implementation Action
@@ -109,17 +119,10 @@
programStage = program.getProgramStages().iterator().next();
- Set<ProgramStageDataElement> programStageDataElement = null;
-
- programStageDataElement = programStage.getProgramStageDataElements();
+ programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
+
+ Collections.sort( programStageDataElements, OrderBySortOrder );
- if( programStageDataElement != null )
- {
- for( ProgramStageDataElement each: programStageDataElement )
- {
- dataElements.add( each.getDataElement() );
- }
- }
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-07-12 10:33:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-07-13 09:18:09 +0000
@@ -356,7 +356,6 @@
else if ( patientIdentifierType.getType().equals( "number" ) && !FormUtils.isNumber( value ) )
{
this.validationMap.put( key, "is_invalid_number" );
- this.previousValues.put( key, value );
}
else
{
@@ -366,6 +365,7 @@
patientIdentifierSet.add( patientIdentifier );
patientIdentifier.setIdentifier( value.trim() );
}
+ this.previousValues.put( key, value );
}
}
}
@@ -387,13 +387,11 @@
&& !FormUtils.isInteger( value ) )
{
this.validationMap.put( key, "is_invalid_number" );
- this.previousValues.put( key, value );
}
else if ( patientAttribute.getValueType().equals( PatientAttribute.TYPE_DATE )
&& !FormUtils.isDate( value ) )
{
this.validationMap.put( key, "is_invalid_date" );
- this.previousValues.put( key, value );
}
else
{
@@ -412,6 +410,7 @@
patientAttributeValue.setValue( value.trim() );
patientAttributeValues.add( patientAttributeValue );
}
+ this.previousValues.put( key, value );
}
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-06-05 07:38:12 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java 2012-07-13 09:18:09 +0000
@@ -277,7 +277,6 @@
{
prevDataValues.put( "DE" + patientDataValue.getDataElement().getId(), patientDataValue.getValue() );
}
-
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-06-15 04:30:27 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2012-07-13 09:18:09 +0000
@@ -47,6 +47,8 @@
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageService;
import org.hisp.dhis.util.ContextUtils;
import com.opensymphony.xwork2.Action;
@@ -132,6 +134,18 @@
this.programStageService = programStageService;
}
+ private ProgramStageDataElementService programStageDataElementService;
+
+ public ProgramStageDataElementService getProgramStageDataElementService()
+ {
+ return programStageDataElementService;
+ }
+
+ public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+ {
+ this.programStageDataElementService = programStageDataElementService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -290,9 +304,11 @@
programStage = util.getProgramStage( programId, programStageId );
program = programStageService.getProgramStage( programStageId ).getProgram();
+ org.hisp.dhis.program.ProgramStage dhisProgramStage = programStageService.getProgramStage( programStageId );
+
patient = patientService.getPatient( patientId );
dataElements = programStage.getDataElements();
-
+
int defaultCategoryOptionId = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo().getId();
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
ServletActionContext.HTTP_REQUEST );
@@ -313,6 +329,8 @@
// validate types
org.hisp.dhis.dataelement.DataElement dataElement = dataElementService.getDataElement( dataElementId );
+ ProgramStageDataElement programStageDataElement = programStageDataElementService.get( dhisProgramStage,
+ dataElement );
value = value.trim();
Boolean valueIsEmpty = (value == null || value.length() == 0);
@@ -326,6 +344,11 @@
}
prevDataValues.put( key, value );
}
+ else if ( valueIsEmpty && programStageDataElement.isCompulsory() )
+ {
+ typeViolations.put( key, "is_empty" );
+ prevDataValues.put( key, value );
+ }
// build dataValue for activity value
DataValue dataValue = new DataValue();
@@ -357,7 +380,7 @@
return ERROR;
}
- if ( programStageService.getProgramStage( programStageId ).getIrregular() )
+ if ( dhisProgramStage.getIrregular() )
{
return REGISTER_NEXT_DUEDATE;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java 2012-07-13 09:18:09 +0000
@@ -31,9 +31,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.List;
-
-import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
@@ -124,13 +121,6 @@
return this.update;
}
- List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
private ArrayList<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
public ArrayList<ProgramStageDataElement> getProgramStageDataElements()
@@ -155,14 +145,6 @@
ProgramStage programStage = program.getProgramStages().iterator().next();
programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
Collections.sort( programStageDataElements, OrderBySortOrder );
-
- if ( programStageDataElements != null )
- {
- for ( ProgramStageDataElement each : programStageDataElements )
- {
- dataElements.add( each.getDataElement() );
- }
- }
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java 2012-07-13 09:18:09 +0000
@@ -53,6 +53,7 @@
import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.util.ContextUtils;
@@ -120,7 +121,7 @@
{
this.util = util;
}
-
+
private DataElementService dataElementService;
public void setDataElementService( DataElementService dataElementService )
@@ -128,6 +129,18 @@
this.dataElementService = dataElementService;
}
+ private ProgramStageDataElementService programStageDataElementService;
+
+ public ProgramStageDataElementService getProgramStageDataElementService()
+ {
+ return programStageDataElementService;
+ }
+
+ public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+ {
+ this.programStageDataElementService = programStageDataElementService;
+ }
+
// -------------------------------------------------------------------------
// Input Output
// -------------------------------------------------------------------------
@@ -138,25 +151,13 @@
{
return typeViolations;
}
-
+
private Map<String, String> prevDataValues = new HashMap<String, String>();
public Map<String, String> getPrevDataValues()
{
return prevDataValues;
}
-
- List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- public void setDataElements( List<DataElement> dataElements )
- {
- this.dataElements = dataElements;
- }
private Integer programId;
@@ -231,7 +232,7 @@
{
return this.instId;
}
-
+
private List<String> dynForm = new ArrayList<String>();
public void setDynForm( List<String> dynForm )
@@ -284,16 +285,11 @@
programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
Collections.sort( programStageDataElements, OrderBySortOrder );
-
- for ( ProgramStageDataElement each : programStageDataElements )
- {
- dataElements.add( each.getDataElement() );
- }
-
+
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
ServletActionContext.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
-
+
typeViolations.clear();
prevDataValues.clear();
@@ -301,8 +297,7 @@
// -------------------------------------------------------------------------
// Validation
// -------------------------------------------------------------------------
-
-
+
for ( String key : parameterMap.keySet() )
{
if ( key.startsWith( "DE" ) )
@@ -313,6 +308,9 @@
DataElement dataElement = dataElementService.getDataElement( dataElementId );
+ ProgramStageDataElement programStageDataElement = programStageDataElementService.get( programStage,
+ dataElement );
+
value = value.trim();
Boolean valueIsEmpty = (value == null || value.length() == 0);
@@ -327,9 +325,14 @@
}
prevDataValues.put( key, value );
}
+ else if ( valueIsEmpty && programStageDataElement.isCompulsory() )
+ {
+ typeViolations.put( key, "is_empty" );
+ prevDataValues.put( key, value );
+ }
}
}
-
+
if ( !typeViolations.isEmpty() )
{
return ERROR;
@@ -352,7 +355,6 @@
programStageInstance.setCompleted( false );
programStageInstanceService.addProgramStageInstance( programStageInstance );
-
for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
{
DataElement dataElement = programStageDataElement.getDataElement();
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-07-12 10:33:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-07-13 09:18:09 +0000
@@ -175,7 +175,8 @@
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="dataElementCategoryService"
ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
- <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
</bean>
<bean
@@ -371,7 +372,8 @@
<property name="organisationUnitService"
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
</bean>
<!-- Dashboard -->
@@ -464,6 +466,6 @@
<property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+ <property name="programStageDataElementService" ref="org.hisp.dhis.program.ProgramStageDataElementService" />
</bean>
-
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-07-13 09:18:09 +0000
@@ -96,4 +96,5 @@
date_of_birth_type=Date of Birth Type
approximated=Approximated
declared=Declared
-verified=Verified
\ No newline at end of file
+verified=Verified
+anomynous_program_list=Anomynous Program List
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm 2012-07-13 09:18:09 +0000
@@ -15,20 +15,28 @@
<input type="hidden" value="$programId" name="programId" />
<div class="header-box" align="center">
<p style="text-align: left;">
- #foreach( $dataElement in $dataElements)
+
+ #foreach( $programStageDataElement in $programStageDataElements)
+ #set($dataElement = $programStageDataElement.getDataElement())
+ #set( $key = "DE${dataElement.id}" )
+
#if( $dataElement.shortName )
#set( $dataElementName = $dataElement.shortName )
#else
#set( $dataElementName = $dataElement.name )
- #end
- #if (! $dataElement.getOptionSet())
- #set( $key = "DE${dataElement.id}" )
- <label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
- #if( $typeViolations.get( $key ) )
+ #end
+
+ <label>$encoder.htmlEncode( $dataElementName )
+ #if($dataElement.type=="date") [yyyy-MM-dd] #end
+ #if($programStageDataElement.isCompulsory())*#end
+ </label>
+
+ #if( $typeViolations.get( $key ) )
#set( $typeViolation = $typeViolations.get( $key ) )
<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
- #end
-
+ #end
+
+ #if (! $dataElement.getOptionSet())
#if($dataElement.type=="bool")
<select name="$key">
<option value="">$i18n.getString("please_select")</option>
@@ -40,15 +48,8 @@
#end
#elseif ($dataElement.getOptionSet())
#set( $options = $dataElement.getOptionSet().getOptions() )
- #set( $key = "DE${dataElement.id}" )
- <label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
- #if( $typeViolations.get( $key ) )
- #set( $typeViolation = $typeViolations.get( $key ) )
- <br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
- #end
<select type="text" name="$key" />
- #set( $selected=false )
- <option selected > $i18n.getString("select_option") </option>
+ <option selected > $i18n.getString("select_option") </option>
#foreach ($option in $options)
<option value="$option" #if($prevDataValues.get($key) == $option) selected #end> $option </option>
#end
@@ -69,6 +70,7 @@
<div id="footer">
<h2>$i18n.getString( "navigate_to" )</h2>
<ul>
+ <li><a href="anonymous.action">$i18n.getString("anomynous_program_list")</a></li>
<li><a href="feedback.action">$i18n.getString("feedback")</a></li>
<li><a href="../dhis-web-commons-security/logout.action">$i18n.getString("logout")</a></li>
<li style="padding-top: 5px;"><a href="../">$i18n.getString("desktop_version")</a></li>
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm 2012-07-13 09:18:09 +0000
@@ -24,20 +24,24 @@
<div class="header-box" align="center">
<p style="text-align: left;">
#foreach( $dataElement in $dataElements)
+ #set( $key = "DE${dataElement.id}" )
#if( $dataElement.shortName )
#set( $dataElementName = $dataElement.shortName )
#else
#set( $dataElementName = $dataElement.name )
#end
- #if (! $dataElement.getOptionSet())
- #set( $key = "DE${dataElement.id}" )
- <label>$encoder.htmlEncode( $dataElementName )
+
+ <label>$encoder.htmlEncode( $dataElementName )
+ #if($dataElement.isCompulsory())*#end
#if($dataElement.type=="date") [yyyy-MM-dd] #end
- </label>
- #if( $typeViolations.get( $key ) )
+ </label>
+
+ #if( $typeViolations.get( $key ) )
#set( $typeViolation = $typeViolations.get( $key ) )
<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
- #end
+ #end
+
+ #if (! $dataElement.getOptionSet())
#if($dataElement.type=="bool")
<select name="$key">
@@ -50,17 +54,7 @@
#end
#elseif ($dataElement.getOptionSet())
-
#set( $options = $dataElement.getOptionSet().getOptions() )
- #set( $key = "DE${dataElement.id}" )
- <label>$encoder.htmlEncode( $dataElementName )
- #if($dataElement.type=="date") [yyyy-MM-dd] #end
- </label>
- #if( $typeViolations.get( $key ) )
- #set( $typeViolation = $typeViolations.get( $key ) )
- <br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
- #end
-
<select type="text" name="$key" />
#set( $selected=false )
#foreach ($option in $options)
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm 2012-07-12 10:33:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/registration/beneficiaryRegistrationForm.vm 2012-07-13 09:18:09 +0000
@@ -85,15 +85,20 @@
<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( $key ))</span>
#end
#if($patientAttribute.getValueType() == "COMBO")
- <select type="text" name="$key" />
+ <select type="text" name="$key">
#foreach($option in $patientAttribute.getAttributeOptions())
<option value="$option.id"
- #if( $prevDataValues.get( $option.id ) == $option.getName() )
- selected
+ #if( $prevDataValues.get( $key ) == $option.id )
+ selected="selected"
#end
> $option.getName() </option>
#end
</select>
+ #elseif( $patientAttribute.getValueType() == "YES/NO" )
+ <select name="$key">
+ <option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
+ <option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
+ </select>
#else
<input type="text" name="$key" value="$!previousValues.get($key)" />
#end
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm 2012-07-11 09:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm 2012-07-13 09:18:09 +0000
@@ -4,20 +4,27 @@
<div class="header-box" align="center">
<p style="text-align: left;">
- #foreach( $dataElement in $dataElements)
+ #foreach( $programStageDataElement in $programStageDataElements)
+ #set($dataElement = $programStageDataElement.getDataElement())
+ #set( $key = "DE${dataElement.id}" )
+
#if( $dataElement.shortName )
#set( $dataElementName = $dataElement.shortName )
#else
#set( $dataElementName = $dataElement.name )
- #end
- #if (! $dataElement.getOptionSet())
- #set( $key = "DE${dataElement.id}" )
- <label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
- #if( $typeViolations.get( $key ) )
+ #end
+
+ <label>$encoder.htmlEncode( $dataElementName )
+ #if($dataElement.type=="date") [yyyy-MM-dd] #end
+ #if($programStageDataElement.isCompulsory())*#end
+ </label>
+
+ #if( $typeViolations.get( $key ) )
#set( $typeViolation = $typeViolations.get( $key ) )
<br /><span style="color: #990000;">$prevDataValues.get($key) $i18n.getString($typeViolation)</span>
- #end
-
+ #end
+
+ #if (! $dataElement.getOptionSet())
#if($dataElement.type=="bool")
<select name="$key">
<option value="">$i18n.getString("please_select")</option>
@@ -29,13 +36,6 @@
#end
#elseif ($dataElement.getOptionSet())
#set( $options = $dataElement.getOptionSet().getOptions() )
- #set( $key = "DE${dataElement.id}" )
- <label>$encoder.htmlEncode( $dataElementName ) #if($dataElement.type=="date") [yyyy-MM-dd] #end </label>
- #if( $typeViolations.get( $key ) )
- #set( $typeViolation = $typeViolations.get( $key ) )
- <br /><span style="color: #990000;"> $prevDataValues.get($key) $i18n.getString($typeViolation)</span>
- #end
-
<select type="text" name="$key" />
<option selected > $i18n.getString("select_option") </option>
#foreach ($option in $options)