← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1874: Mirror fix.

 

------------------------------------------------------------
revno: 1874
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-05-18 10:42:26 +0700
message:
  Mirror fix.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/DefineProgramListForValidationCriteriaAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramListForValidationCriteriaAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programsForValidationCriteriaAssociations.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseValidationCriteria.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.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/addValidationCriteria.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.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/ProgramService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2009-10-29 16:22:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java	2010-05-18 03:42:26 +0000
@@ -30,6 +30,7 @@
 import java.util.Collection;
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.validation.ValidationCriteria;
 
 /**
  * @author Abyot Asalefew
@@ -52,4 +53,6 @@
     Collection<Program> getAllPrograms();
 
     Collection<Program> getPrograms( OrganisationUnit organisationUnit );
+    
+    Collection<Program> getPrograms( ValidationCriteria validationCriteria );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2009-11-07 21:25:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2010-05-18 03:42:26 +0000
@@ -33,6 +33,7 @@
 
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.validation.ValidationCriteria;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -81,8 +82,8 @@
     public Program getProgram( int id )
     {
         return programStore.get( id );
-    }   
-    
+    }
+
     public Program getProgramByName( String name )
     {
         return programStore.getByName( name );
@@ -91,16 +92,31 @@
     public Collection<Program> getPrograms( OrganisationUnit organisationUnit )
     {
         Set<Program> programs = new HashSet<Program>();
-        
-        for( Program program : getAllPrograms() )
-        {
-            if( program.getOrganisationUnits().contains( organisationUnit ) )
-            {
-                programs.add( program );                
-            }
-        }
-        
-        return programs;
-    }    
-    
+
+        for ( Program program : getAllPrograms() )
+        {
+            if ( program.getOrganisationUnits().contains( organisationUnit ) )
+            {
+                programs.add( program );
+            }
+        }
+
+        return programs;
+    }
+
+    public Collection<Program> getPrograms( ValidationCriteria validationCriteria )
+    {
+        Set<Program> programs = new HashSet<Program>();
+        
+        for ( Program program : getAllPrograms() )
+        {
+            if ( program.getPatientValidationCriteria().contains( validationCriteria ) )
+            {
+                programs.add( program );
+            }
+        }
+
+        return programs;
+    }
+
 }

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/DefineProgramListForValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/DefineProgramListForValidationCriteriaAction.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/validation/DefineProgramListForValidationCriteriaAction.java	2010-05-18 03:42:26 +0000
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.validation.ValidationCriteria;
+import org.hisp.dhis.validation.ValidationCriteriaService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version DefineProgramListForValidationCriteriaAction.java May 17, 2010
+ */
+public class DefineProgramListForValidationCriteriaAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ValidationCriteriaService validationCriteriaService;
+
+    private ProgramService programService;
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+    private Integer criteriaId;
+
+    private Integer[] programIds;
+
+    // -------------------------------------------------------------------------
+    // Setters
+    // -------------------------------------------------------------------------
+
+    public void setValidationCriteriaService( ValidationCriteriaService validationCriteriaService )
+    {
+        this.validationCriteriaService = validationCriteriaService;
+    }
+
+    public void setProgramIds( Integer[] programIds )
+    {
+        this.programIds = programIds;
+    }
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    public void setCriteriaId( Integer criteriaId )
+    {
+        this.criteriaId = criteriaId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        ValidationCriteria validationCriteria = validationCriteriaService.getValidationCriteria( criteriaId );
+
+        Set<Program> selectedProgram = new HashSet<Program>();
+
+        if ( programIds != null )
+        {
+            for ( Integer id : programIds )
+            {
+                Program program = programService.getProgram( id );
+
+                program.getPatientValidationCriteria().add( validationCriteria );
+
+                selectedProgram.add( program );
+
+                programService.updateProgram( program );
+
+            }
+        }
+
+        Set<Program> removePrograms = new HashSet<Program>( programService.getAllPrograms() );
+        removePrograms.removeAll( selectedProgram );
+
+        for ( Program program : removePrograms )
+        {
+            program.getPatientValidationCriteria().remove( validationCriteria );
+
+            programService.updateProgram( program );
+        }
+
+        return SUCCESS;
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramListForValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramListForValidationCriteriaAction.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/validation/GetProgramListForValidationCriteriaAction.java	2010-05-18 03:42:26 +0000
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.validation;
+
+import java.util.Collection;
+
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.validation.ValidationCriteria;
+import org.hisp.dhis.validation.ValidationCriteriaService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version GetProgramListForValidationCriteriaAction.java May 17, 2010
+ */
+public class GetProgramListForValidationCriteriaAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ValidationCriteriaService validationCriteriaService;
+
+    private ProgramService programService;
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+    private Integer criteriaId;
+
+    private Collection<Program> selectedPrograms;
+
+    private Collection<Program> availablePrograms;
+
+    private ValidationCriteria validationCriteria;
+
+    // -------------------------------------------------------------------------
+    // Setters
+    // -------------------------------------------------------------------------
+
+    public void setValidationCriteriaService( ValidationCriteriaService validationCriteriaService )
+    {
+        this.validationCriteriaService = validationCriteriaService;
+    }
+
+    public Collection<Program> getSelectedPrograms()
+    {
+        return selectedPrograms;
+    }
+
+    public ValidationCriteria getValidationCriteria()
+    {
+        return validationCriteria;
+    }
+
+    public Collection<Program> getAvailablePrograms()
+    {
+        return availablePrograms;
+    }
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    public void setCriteriaId( Integer criteriaId )
+    {
+        this.criteriaId = criteriaId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        validationCriteria = validationCriteriaService.getValidationCriteria( criteriaId );
+
+        selectedPrograms = programService.getPrograms( validationCriteria );
+
+        availablePrograms = programService.getAllPrograms();
+        availablePrograms.removeAll( selectedPrograms );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.java	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.java	2010-05-18 03:42:26 +0000
@@ -75,6 +75,11 @@
         return format;
     }
 
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     public ValidationCriteria getValidationCriteria()
     {
         return validationCriteria;

=== 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	2010-05-17 14:19:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-05-18 03:42:26 +0000
@@ -1102,6 +1102,30 @@
 	</bean>
 	
 	<bean
+		id="org.hisp.dhis.patient.action.validation.GetProgramListForValidationCriteriaAction"
+		class="org.hisp.dhis.patient.action.validation.GetProgramListForValidationCriteriaAction"
+		scope="prototype">
+		<property name="validationCriteriaService">
+			<ref bean="org.hisp.dhis.validation.ValidationCriteriaService" /> 
+		</property>
+		<property name="programService">
+			<ref bean="org.hisp.dhis.program.ProgramService" /> 
+		</property>
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.patient.action.validation.DefineProgramListForValidationCriteriaAction"
+		class="org.hisp.dhis.patient.action.validation.DefineProgramListForValidationCriteriaAction"
+		scope="prototype">
+		<property name="validationCriteriaService">
+			<ref bean="org.hisp.dhis.validation.ValidationCriteriaService" /> 
+		</property>
+		<property name="programService">
+			<ref bean="org.hisp.dhis.program.ProgramService" /> 
+		</property>
+	</bean>
+	
+	<bean
 		id="org.hisp.dhis.patient.action.validation.GetValidationCriteriaAction"
 		class="org.hisp.dhis.patient.action.validation.GetValidationCriteriaAction"
 		scope="prototype">

=== 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	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2010-05-18 03:42:26 +0000
@@ -386,6 +386,8 @@
 confirm_delete_validation_criteria = Are you sure you want to delete validation criteria ?
 operator_less_then = <
 operator_equal_to = = 
+assign_program = Assign programs
+define_programs_associations = Define Programs Associations
 operator_greater_then = >
 filter_by_name = Filter by name
 validation_criteria_management = Validation Criteria Management
@@ -406,4 +408,10 @@
 fill_fields_in_programstage_dataelement_validation = Please fill data into all fields in Programstage - Dataelement Validation
 define_validationDE_associations = Define Validation DataElement Associations 
 add_validationDE_associations = Add Validation DataElement Associations
-intro_validation_criteria = Create, modify, remove for validation criteria
\ No newline at end of file
+intro_validation_criteria = Create, modify, remove for validation criteria
+birthDate = Date of Birth
+birthDateEstimated = Estimated
+bloodGroup = Blood group
+integerValueOfAge = Age
+available_program = Available programs
+selected_program = Selected programs
\ 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	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2010-05-18 03:42:26 +0000
@@ -1170,6 +1170,24 @@
 				/dhis-web-maintenance-patient/responseInput.vm</result>
 		</action>
 		
+		<action name="showProgramsForValidationCriteriaForm"
+			class="org.hisp.dhis.patient.action.validation.GetProgramListForValidationCriteriaAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-patient/programsForValidationCriteriaAssociations.vm</param>
+			<param name="javascripts">
+				../dhis-web-commons/oust/oust.js
+				,javascript/associations.js
+				,javascript/program.js</param>
+			<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
+		</action>
+		
+		<action name="defineProgramsForValidationCriteria"
+			class="org.hisp.dhis.patient.action.validation.DefineProgramListForValidationCriteriaAction">
+			<result name="success" type="redirect">
+				validationCriteria.action</result>
+			<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
+		</action>
+		
 		<!-- Validation - ProgramStageDataElementValidation -->
 		
 		<action name="programStageDEValidation"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2010-05-18 03:42:26 +0000
@@ -60,7 +60,7 @@
 		
 		<!-- gender -->
 		<div id="genderDiv" style="display:none">
-			<select id='genderValue' name='genderValue' onclick="fillValue(this.value);" style="width: 8em">
+			<select id='genderValue' name='genderValue' onChange="fillValue(this.value);" style="width: 8em">
 				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 				<option value="M" >$i18n.getString( "male" )</option>
 				<option value="F">$i18n.getString( "female" )</option>
@@ -87,7 +87,8 @@
 		
 		<!-- birthDateEstimated -->
 		<div id="birthDateEstimatedDiv" style="display:none ">
-			<select id='birthDateEstimatedValue' name='birthDateEstimatedValue' onclick="fillValue(this.value);" style="width: 8em">
+			<select id='birthDateEstimatedValue' name='birthDateEstimatedValue' onChange="fillValue(this.value);" style="width: 8em">
+				<option value="">[$i18n.getString( "please_select" )]</option>
 				<option value="true">$i18n.getString( "yes" )</option>
 				<option value="false" selected="selected">$i18n.getString( "no" )</option>
 			</select>
@@ -95,7 +96,8 @@
 		
 		<!-- bloodGroup -->
 		<div id="bloodGroupDiv" style="display:none ">
-			<select id="bloodGroupValue" name="bloodGroupValue" onclick="fillValue(this.value);" style="width: 8em">
+			<select id="bloodGroupValue" name="bloodGroupValue" onChange="fillValue(this.value);" style="width: 8em">
+				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 				<option value="A+">A+</option>
 				<option value="A-">A-</option>
 				<option value="AB+">AB+</option>
@@ -116,23 +118,3 @@
 
 </form>    
 <span id="message"></span>
-<script language="javascript">
-	function showDivValue(){
-		var divName = byId('property').value;
-		if(divName != ''){
-			 byId('genderDiv').style.display = 'none';
-			 byId('integerValueOfAgeDiv').style.display = 'none';
-			 byId('birthDateDiv').style.display = 'none';
-			 byId('birthDateEstimatedDiv').style.display = 'none';
-			 byId('bloodGroupDiv').style.display = 'none';
-			
-			 divName += "Div";
-			 var div = byId(divName);
-			 div.style.display = 'block';
-		 }
-	}
-	
-	function fillValue( value ){
-		byId('value').value = value;
-	}
-</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js	2010-05-05 10:14:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js	2010-05-18 03:42:26 +0000
@@ -39,3 +39,71 @@
 {
 	removeItem( id, name, i18n_confirm_delete, 'removeValidationCriteria.action' );
 }
+
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showValidationCriteriaDetails( criteriaId )
+{
+    var request = new Request();
+    request.setResponseTypeXML( 'dataElement' );
+    request.setCallbackSuccess( validationCriteriaReceived );
+    request.send( 'getValidationCriteria.action?id=' + criteriaId );
+}
+
+function validationCriteriaReceived( validationCriteria )
+{
+    setFieldValue( 'nameField', getElementValue( validationCriteria, 'name' ) );
+    setFieldValue( 'descriptionField', getElementValue( validationCriteria, 'description' ) );
+	
+	var property = getElementValue( validationCriteria, 'property' )
+	var operator = getElementValue( validationCriteria, 'operator' )
+	var	value = getElementValue( validationCriteria, 'value' )
+	
+	// get operator
+	if(operator == 0 ){
+		operator = '=';
+	}else if(operator == -1 ){
+		operator = '<';
+	}else {
+		operator = '>';
+	}
+	
+	setFieldValue('criteriaField', property + " " + operator + " " + value );
+    showDetails();
+}
+
+// ----------------------------------------------------------------------------------------
+// Show div to Add or Update Validation-Criteria
+// ----------------------------------------------------------------------------------------
+function showDivValue(){
+	var propertyName = byId('property').value;
+	hideDiv();
+	if(propertyName != ''){
+		 var div = byId(propertyName + 'Div');
+		 div.style.display = 'block';
+		 
+		 if(propertyName == 'gender' || 
+			propertyName == 'birthDateEstimated' || 
+			propertyName == 'bloodGroup'){
+				
+			byId('operator').selectedIndex = 1;
+			disable('operator');
+		 }else{
+			enable('operator');
+		 }
+	 }
+}
+
+function hideDiv(){
+	hideById('genderDiv');
+	hideById('integerValueOfAgeDiv');
+	hideById('birthDateDiv');
+	hideById('birthDateEstimatedDiv');
+	hideById('bloodGroupDiv');		
+}
+
+function fillValue( value ){
+	byId('value').value = value;
+}
\ 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/programsForValidationCriteriaAssociations.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programsForValidationCriteriaAssociations.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/programsForValidationCriteriaAssociations.vm	2010-05-18 03:42:26 +0000
@@ -0,0 +1,50 @@
+
+<h3>$i18n.getString( "define_programs_associations" ) </h3>
+
+<form action='defineProgramsForValidationCriteria.action' method='post' onsubmit="selectAllById('programIds');">
+<table>
+<input type='hidden' id='criteriaId' name='criteriaId' value="$validationCriteria.id">
+<tr>
+  <th colspan="3">$i18n.getString('program')</th>
+</tr>
+<tr>
+  <td><label>$i18n.getString('available_program')</label></td>
+  <td>&nbsp;</td>
+  <td><label>$i18n.getString('selected_program')</label></td>
+</tr>
+<tr>
+	<td>
+		<select multiple id='avalableProgramIds' name='avalableProgramIds' size="8" style="width:30em " ondblclick="moveSelectedById('avalableProgramIds', 'programIds');">
+			#foreach($p in $availablePrograms)
+			<option value='$p.id'>$p.name</option>
+			#end
+		</select>
+	</td>
+	<td width="42" align='center'>
+		<input type="button" value="&gt;" onclick="moveSelectedById('avalableProgramIds', 'programIds');" style="width:42px">
+		<input type="button" value="&lt;" onclick="moveSelectedById('programIds', 'avalableProgramIds');" style="width:42px"><br>
+		<input type="button" value="&gt;&gt;" onclick="moveAllById('avalableProgramIds', 'programIds');" style="width:42px"><br>
+		<input type="button" value="&lt;&lt;" onclick="moveAllById('programIds', 'avalableProgramIds');" style="width:42px">
+	</td>
+	<td>
+		<select multiple id='programIds' name='programIds' size="8" style="width:30em " ondblClick="moveSelectedById('programIds', 'avalableProgramIds');">
+			#foreach($p in $selectedPrograms)
+			<option value='$p.id'>$p.name</option>
+			#end
+		</select>
+	</td>
+</tr>
+
+<tr>
+    <td>
+		<input type="submit"value="$i18n.getString('save')" style="width:10em">
+        <input type="button" onClick="window.location.href = 'validationCriteria.action';" value="$i18n.getString('cancel')" style="width:10em">
+	</td>
+	<td></td>
+	<td></td>
+</tr>
+</table>
+
+<script>
+	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient" ) , "'" )';
+</script>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseValidationCriteria.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/responseValidationCriteria.vm	2010-05-18 03:42:26 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<validationCriteria>
+  <id>$validationCriteria.id</id>  
+  <name>$encoder.xmlEncode( $validationCriteria.name )</name>
+  <description>$encoder.xmlEncode($validationCriteria.description )</description>
+  <property>$i18n.getString($validationCriteria.property)</property>
+  <operator>$validationCriteria.operator</operator>
+  #if($validationCriteria.property == 'birthDate')
+	<value>$format.formatDate($validationCriteria.value)</value>
+  #else
+	<value>$validationCriteria.value</value>
+  #end
+</validationCriteria>
\ 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/updateValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2010-05-18 03:42:26 +0000
@@ -46,7 +46,7 @@
 		   <option value="birthDateEstimated" #if("$validationCriteria.property" == "birthDateEstimated") selected #end>$i18n.getString( "estimated" )</option>
 		   <option value="bloodGroup" #if("$validationCriteria.property" == "bloodGroup") selected #end>$i18n.getString( "blood_group" )</option>
       </select>
-        <select id='select' name='operator' style='width: 3.5em'>
+        <select id='operator' name='operator' style='width: 3.5em'>
           <option value='-1' #if( "$validationCriteria.operator"=='-1') selected #end>$i18n.getString('operator_less_then')</option>
           <option value='0'  #if( "$validationCriteria.operator"=='0') selected #end>$i18n.getString('operator_equal_to')</option>
           <option value='1'  #if( "$validationCriteria.operator"=='1') selected #end>$i18n.getString('operator_greater_then')</option>
@@ -55,7 +55,8 @@
 	  <td><input type='hidden' id='value' name='value' style='width: 8em' value="$validationCriteria.value" class="{validate:{required:true,rangelength:[1,160]}}">
 	  <!-- gender -->
 		<div id="genderDiv" style="display:none">
-			<select id='genderValue' name='genderValue' onclick="fillValue(this.value);" style="width: 8em">
+			<select id='genderValue' name='genderValue' onChange="fillValue(this.value);" style="width: 8em">
+				<option value="">[$i18n.getString( "please_select" )]</option>
 				<option value="M" >$i18n.getString( "male" )</option>
 				<option value="F">$i18n.getString( "female" )</option>
 			</select>
@@ -81,7 +82,8 @@
 		
 		<!-- birthDateEstimated -->
 		<div id="birthDateEstimatedDiv" style="display:none ">
-			<select id='birthDateEstimatedValue' name='birthDateEstimatedValue' onclick="fillValue(this.value);" style="width: 8em">
+			<select id='birthDateEstimatedValue' name='birthDateEstimatedValue' onChange="fillValue(this.value);" style="width: 8em">
+				<option value="">[$i18n.getString( "please_select" )]</option>
 				<option value="true">$i18n.getString( "yes" )</option>
 				<option value="false">$i18n.getString( "no" )</option>
 			</select>
@@ -89,7 +91,8 @@
 		
 		<!-- bloodGroup -->
 		<div id="bloodGroupDiv" style="display:none ">
-			<select id="bloodGroupValue" name="bloodGroupValue" onclick="fillValue(this.value);" style="width: 8em">
+			<select id="bloodGroupValue" name="bloodGroupValue" onChange="fillValue(this.value);" style="width: 8em">
+				<option value="">[$i18n.getString( "please_select" )]</option>
 				<option value="A+">A+</option>
 				<option value="A-">A-</option>
 				<option value="AB+">AB+</option>
@@ -124,28 +127,13 @@
 		month = ( month < 10 ) ? ( '0' + month ) : month;
 		var date = '$validationCriteria.value.getDate()';
 		date = ( date < 10 ) ? ( '0' + date ) : date;
+		
 		byId(name + "Value").value = year + '-' + month + '-' + date;
 		byId('value').value = byId(name + "Value").value;
 	}else{
 		byId(name + "Value").value = '$validationCriteria.value';
 	}
-			 
-	function showDivValue(){
-		var divName = byId('property').value;
-		if(divName != ''){
-			 byId('genderDiv').style.display = 'none';
-			 byId('integerValueOfAgeDiv').style.display = 'none';
-			 byId('birthDateDiv').style.display = 'none';
-			 byId('birthDateEstimatedDiv').style.display = 'none';
-			 byId('bloodGroupDiv').style.display = 'none';
-			
-			 divName += "Div";
-			 var div = byId(divName);
-			 div.style.display = 'block';
-		 }
-	}
-	
-	function fillValue( value ){
-		byId('value').value = value;
-	}
+	
+	showDivValue();
+	
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm	2010-05-14 02:25:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm	2010-05-18 03:42:26 +0000
@@ -1,35 +1,63 @@
 <h3>$i18n.getString( "validation_criteria" )</h3>
 
-<table width=100%>
+<table class="mainPageTable">
 	<tr>
-		<td>
-			$i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:300px"/>
+		<td style="vertical-align:top">
+
+			<table class="listTable">
+				<col>
+				<col width="20">
+				
+				<thead>
+				<tr>
+					<td>
+						$i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:250px"/>
+					</td>
+					<td >			
+						<input type="button" value="$i18n.getString( "add" )" onclick="window.location.href='showAddValidationCriteriaForm.action'" style="width:10em">
+					</td>
+				</tr>
+				<tr>
+				  <th>$i18n.getString('name')</th>
+				  <th style="width:8em ">$i18n.getString('operator')</th>
+				</tr>
+				</thead>	
+				
+				<tbody id="list">
+				#foreach($criteria in $criterias)
+				<tr id="tr${criteria.id}">
+				  <td>$criteria.name</td>
+				  <td>
+					<a href="showProgramsForValidationCriteriaForm.action?criteriaId=$criteria.id" title="$i18n.getString( "define_associations" )"><img src="images/criteria.gif" alt="$i18n.getString( 'assign_program' )"></a>
+					<a href="showUpdateValidationCriteriaForm.action?id=$criteria.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+					<a href="javascript:removeCriteria( '$criteria.id', '$encoder.jsEncode( $criteria.getName() )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+					<a href="javascript:showValidationCriteriaDetails( '$criteria.id' )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+				  </td>
+				</tr>
+				#end
+				</tbody>
+			</table>
 		</td>
-		<td align='right'>			
-			<input type="button" value="$i18n.getString( "add" )" onclick="window.location.href='showAddValidationCriteriaForm.action'" style="width:10em">
+		<td style="width:20em; padding-left:2em; vertical-align:top">
+			<div id="detailsArea" style="display:none;">
+				<div style="float:right">
+					<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
+				</div>				
+				<p><label>$i18n.getString( "name" ):</label><br><span id='nameField'></span></p>
+				<p><label>$i18n.getString( "description" ):</label><br><span id='descriptionField'></span></p>
+				<p><label>$i18n.getString( "criteria" ):</label><br><span id='criteriaField'></span></p>
+			</div>
+
+			<div id="warningArea" style="display:none;"> 
+				<div style="float:right">
+					<a href="javascript:hideWarning()" title="$i18n.getString( "hide_warning" )"><img src="../images/close.png" alt="$i18n.getString( "hide_warning" )"></a>
+				</div>
+				<p><span id="warningField"></span></p>
+			</div>
 		</td>
 	</tr>
+		
 </table>
-
-<table width="100%" border="0" class="listTable">
-	<thead>
-    <tr>
-      <th>$i18n.getString('name')</th>
-      <th style="width:5em ">$i18n.getString('operator')</th>
-    </tr>
-	</thead>	
-	<tbody id="list">
-	#foreach($criteria in $criterias)
-    <tr id="tr${criteria.id}">
-      <td>$criteria.name</td>
-      <td>                  
-	  	<a href="showUpdateValidationCriteriaForm.action?id=$criteria.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
-        <a href="javascript:removeCriteria( '$criteria.id', '$encoder.jsEncode( $criteria.getName() )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
-	  </td>
-    </tr>
-	#end
-	</tbody>
-  </table>
   
 <span id="message"></span>