← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13379: Put validation criteria in program management; remove this function on left menu.

 

------------------------------------------------------------
revno: 13379
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-12-22 06:14:17 +0700
message:
  Put validation criteria in program management; remove this function on left menu.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.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/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.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/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
  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/menu.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/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/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java	2013-12-21 23:14:17 +0000
@@ -219,13 +219,9 @@
                 if ( !value.isEmpty() )
                 {
                     // Compare property value with compare value
-System.out.println("\n\n value : " + value );
-System.out.println("\n\n criteria.getValue() : " + criteria.getValue() );
-System.out.println("\n\n operator : " + value.compareTo( criteria.getValue() ) );
                     int i = value.compareTo( criteria.getValue() );
 
                     // Return validation criteria if criteria is not met
-
                     if ( i != criteria.getOperator() )
                     {
                         return criteria;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java	2013-12-21 23:14:17 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.validation.ValidationCriteria;
 import org.hisp.dhis.validation.ValidationCriteriaService;
 
@@ -46,6 +48,8 @@
 
     private ValidationCriteriaService validationCriteriaService;
 
+    private ProgramService programService;
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -60,6 +64,8 @@
 
     private String value;
 
+    private int programId;
+
     // -------------------------------------------------------------------------
     // Setters
     // -------------------------------------------------------------------------
@@ -69,6 +75,21 @@
         this.validationCriteriaService = validationCriteriaService;
     }
 
+    public void setProgramId( int programId )
+    {
+        this.programId = programId;
+    }
+
+    public int getProgramId()
+    {
+        return programId;
+    }
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     public void setName( String name )
     {
         this.name = name;
@@ -112,6 +133,10 @@
 
         validationCriteriaService.saveValidationCriteria( criteria );
 
+        Program program = programService.getProgram( programId );
+        program.getPatientValidationCriteria().add( criteria );
+        programService.updateProgram( program );
+
         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	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetValidationCriteriaAction.java	2013-12-21 23:14:17 +0000
@@ -33,9 +33,9 @@
 import java.util.List;
 
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.validation.ValidationCriteria;
 import org.hisp.dhis.validation.ValidationCriteriaService;
 
@@ -59,11 +59,11 @@
         this.validationCriteriaService = validationCriteriaService;
     }
 
-    private PatientAttributeService patientAttributeService;
+    private ProgramService programService;
 
-    public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+    public void setProgramService( ProgramService programService )
     {
-        this.patientAttributeService = patientAttributeService;
+        this.programService = programService;
     }
 
     // -------------------------------------------------------------------------
@@ -72,11 +72,13 @@
 
     private int id;
 
+    private int programId;
+
     private List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
 
     private ValidationCriteria validationCriteria;
 
-    private I18nFormat format;
+    private Program program;
 
     // -------------------------------------------------------------------------
     // Getter && Setter
@@ -87,14 +89,9 @@
         this.id = id;
     }
 
-    public I18nFormat getFormat()
-    {
-        return format;
-    }
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
+    public void setProgramId( int programId )
+    {
+        this.programId = programId;
     }
 
     public ValidationCriteria getValidationCriteria()
@@ -107,6 +104,11 @@
         return patientAttributes;
     }
 
+    public Program getProgram()
+    {
+        return program;
+    }
+
     // -------------------------------------------------------------------------
     // Action Implementation
     // -------------------------------------------------------------------------
@@ -117,7 +119,9 @@
     {
         validationCriteria = validationCriteriaService.getValidationCriteria( id );
 
-        patientAttributes = new ArrayList<PatientAttribute>( patientAttributeService.getAllPatientAttributes() );
+        program = programService.getProgram( programId );
+
+        patientAttributes = new ArrayList<PatientAttribute>( program.getPatientAttributes() );
 
         Collections.sort( patientAttributes, IdentifiableObjectNameComparator.INSTANCE );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java	2013-12-21 23:14:17 +0000
@@ -57,6 +57,8 @@
     // Input
     // -------------------------------------------------------------------------
 
+    private int programId;
+
     private int id;
 
     private String name;
@@ -78,6 +80,16 @@
         this.name = name;
     }
 
+    public int getProgramId()
+    {
+        return programId;
+    }
+
+    public void setProgramId( int programId )
+    {
+        this.programId = programId;
+    }
+
     public void setId( int id )
     {
         this.id = id;

=== 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	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2013-12-21 23:14:17 +0000
@@ -918,6 +918,9 @@
     <property name="validationCriteriaService">
       <ref bean="org.hisp.dhis.validation.ValidationCriteriaService" />
     </property>
+    <property name="programService">
+      <ref bean="org.hisp.dhis.program.ProgramService" />
+    </property>
   </bean>
 
   <bean
@@ -951,8 +954,8 @@
     <property name="validationCriteriaService">
       <ref bean="org.hisp.dhis.validation.ValidationCriteriaService" />
     </property>
-    <property name="patientAttributeService">
-      <ref bean="org.hisp.dhis.patient.PatientAttributeService" />
+    <property name="programService">
+      <ref bean="org.hisp.dhis.program.ProgramService" />
     </property>
   </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	2013-12-18 08:01:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-12-21 23:14:17 +0000
@@ -107,7 +107,6 @@
 intro_relationship_type=Create, modify and view relationship types. A relationship is typically wife and husband or mother and child.
 intro_program=Create, modify and view programs. A program has program stages and defines which actions should be taken at each stage.
 intro_person_aggregation_query_builder=Set up aggregation rules for the process of aggregating person data to statistical data.
-intro_validation_criteria=Create, modify and view validation criteria. A criteria is used for validation of person data.
 intro_schedule_automated_message_reminder=Set reminders to be automatically sent to enrolled persons before scheduled appointments and after missed visits.
 intro_program_attribute=Create, modify and view program attributes. A program can have any number of attributes.
 intro_configuration=Set the Excel XML template file used for automatically importing person data.
@@ -482,4 +481,5 @@
 select_at_least_one_scope=Select at least one scope for local id
 scheduling_of_events = Scheduling of events
 show_advanced_options = Show advanced options
-tracker_associate = Tracker associate
\ No newline at end of file
+tracker_associate = Tracker associate
+view_validation_criteria = View validation criteria
\ 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	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2013-12-21 23:14:17 +0000
@@ -917,14 +917,14 @@
 		<!-- Validation - PatientValidationCriteria -->
 
 		<action name="validationCriteria"
-			class="org.hisp.dhis.patient.action.validation.GetValidationCriteriaListAction">
+			class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/validationCriteria.vm</param>
 			<param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
 			<param name="javascripts">javascript/validationcriteria.js</param>
 		</action>
 
-		<action name="showAddValidationCriteriaForm" class="org.hisp.dhis.patient.action.patientattribute.GetPatientAttributeListAction">
+		<action name="showAddValidationCriteriaForm" class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/addValidationCriteria.vm</param>
 			<param name="javascripts">javascript/validationcriteria.js</param>
@@ -933,7 +933,7 @@
 
 		<action name="addValidationCriteria"
 			class="org.hisp.dhis.patient.action.validation.AddValidationCriteriaAction">
-			<result name="success" type="redirect">validationCriteria.action
+			<result name="success" type="redirect">validationCriteria.action?id=${programId}
 			</result>
 			<param name="requiredAuthorities">F_VALIDATIONCRITERIA_ADD</param>
 		</action>
@@ -955,7 +955,7 @@
 
 		<action name="updateValidationCriteria"
 			class="org.hisp.dhis.patient.action.validation.UpdateValidationCriteriaAction">
-			<result name="success" type="redirect">validationCriteria.action
+			<result name="success" type="redirect">validationCriteria.action?id=${programId}
 			</result>
 			<param name="requiredAuthorities">F_VALIDATIONCRITERIA_ADD</param>
 		</action>

=== 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	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2013-12-21 23:14:17 +0000
@@ -4,7 +4,10 @@
 </script>
 
 <h3>$i18n.getString( "create_validation_criteria" )</h3>
+<h5>$program.displayName</h5>
+
 <form id="validationCriteriaForm" action="addValidationCriteria.action" method="post" class="inputForm">
+<input type='hidden' id='programId' name='programId' value='$program.id' />
 <table>
 	<tr><th colspan="3">$i18n.getString('validation_criteria_details')</th></tr>
     <tr>
@@ -23,7 +26,7 @@
 				<td>
 					<select id='property' name='property' style='width:16em' onChange="showDivValue();">
 						<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
-						#foreach($patientAttribute in $patientAttributes)
+						#foreach($patientAttribute in $program.patientAttributes)
 							#set($opt="")
 							#foreach($option in $patientAttribute.attributeOptions)
 								#set($opt=$opt + ';' + $option.name )
@@ -50,7 +53,7 @@
 		<td>&nbsp;</td>
 		<td colspan="2">
 			<input type="submit" value="$i18n.getString('save')" style="width:10em"/>
-			<input name="button" type="button" style="width:10em" onclick="javascript:window.location.href= 'validationCriteria.action'" value="$i18n.getString('cancel')"/>
+			<input name="button" type="button" style="width:10em" onclick="javascript:window.location.href= 'validationCriteria.action?id=$program.id'" value="$i18n.getString('cancel')"/>
 		</td>
     </tr>
   </table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm	2013-09-27 11:13:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm	2013-12-21 23:14:17 +0000
@@ -9,7 +9,6 @@
     #introListImgItem( "patientRegistrationForm.action" "patient_registration_form" "pivottable" )
     #introListImgItem( "program.action" "program" "program" )
     #introListImgItem( "caseAggregation.action" "patient_aggregation_query_builder" "caseaggregationmapping" )
-	#introListImgItem( "validationCriteria.action" "validation_criteria" "validationrule" )
 	
 	#if( $auth.hasAccess( "dhis-web-maintenance-patient", "viewScheduleTasks" ) )
 		#introListImgItem( "viewScheduleTasks.action" "schedule_automated_message_reminder" "scheduling" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-12-17 01:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2013-12-21 23:14:17 +0000
@@ -33,6 +33,10 @@
   location.href = 'defineProgramAssociationsForm.action?id=' + context.id;
 }
 
+function validationCriteria( context ) {
+  location.href = 'validationCriteria.action?id=' + context.id;
+}
+
 function showProgramDetails( context ) {
   jQuery.getJSON("getProgram.action", {
     id: context.id

=== 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	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js	2013-12-21 23:14:17 +0000
@@ -10,7 +10,7 @@
 }
 
 function showUpdateValidationCriteriaForm( context ) {
-  location.href = 'showUpdateValidationCriteriaForm.action?id=' + context.id;
+  location.href = 'showUpdateValidationCriteriaForm.action?id=' + context.id + '&programId=' + getFieldValue('programId');
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm	2013-09-27 11:13:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/menu.vm	2013-12-21 23:14:17 +0000
@@ -12,7 +12,6 @@
 <ul>
 	<li><a href="program.action">$i18n.getString( "program" )</a></li>
 	<li><a href="caseAggregation.action">$i18n.getString( "patient_aggregation_query_builder" )</a></li>
-	<li><a href="validationCriteria.action">$i18n.getString( "validation_criteria" )</a></li>
 </ul>
 
 #if( $auth.hasAccess( "dhis-web-maintenance-patient", "viewScheduleTasks" ) 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2013-12-17 01:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2013-12-21 23:14:17 +0000
@@ -8,6 +8,7 @@
     <li data-enabled="canUpdate"><a data-target-fn="showProgramUserRoleForm"><i class="fa fa-plus"></i>&nbsp;&nbsp;$i18n.getString( "assign_program_to_userroles" )</a></li>
     <li data-enabled="canUpdate"><a data-target-fn="showUpdateProgramForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
     <li data-enabled="canUpdate"><a data-target-fn="programStageManagement"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "view_program_stages" )</a></li>
+    <li data-enabled="canUpdate"><a data-target-fn="validationCriteria"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "view_validation_criteria" )</a></li>
     <li data-enabled="canUpdate"><a data-target-fn="programValidationManagement"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "program_validation_rule_management" )</a></li>
     <li data-enabled="canManageForm"><a data-target-fn="programIndicatorManagementForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "program_indicator_management_form" )</a></li>
     <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>

=== 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	2013-12-20 22:53:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2013-12-21 23:14:17 +0000
@@ -1,10 +1,12 @@
 <script type="text/javascript" src="javascript/updateValidationCriteria.js"></script>																
 
 <h3>$i18n.getString( "edit_validation_criteria" )</h3>
+<h5>$program.displayName</h5>
 
 <form id="validationCriteriaForm" action="updateValidationCriteria.action" method="post" class="inputForm">
+	<input type='hidden' id='programId' name='programId' value='$program.id' />
+	<input type='hidden' id='id' name='id' value='$validationCriteria.id'/>
 	<table>
-		<input type='hidden' id='id' name='id' value='$validationCriteria.id'/>
 		<tr>
 			<th colspan="3">$i18n.getString('validation_criteria_details')</th>
 		</tr>
@@ -25,7 +27,7 @@
 							<select id='property' name='property' style='width:16em' onChange="showDivValue();">
 								<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 								#set($attribute = '')
-								#foreach($patientAttribute in $patientAttributes)
+								#foreach($patientAttribute in $program.patientAttributes)
 									#set($opt="")
 									#foreach($option in $patientAttribute.attributeOptions)
 										#set($opt=$opt + ';' + $option.name )
@@ -49,7 +51,7 @@
 									#end
 								</select>
 							#else
-								<input id='value' name='value' class="{validate:{required:true}}" style="width:200px;"/>
+								<input id='value' name='value' class="{validate:{required:true}}" style="width:200px;" value='$validationCriteria.value' />
 							#end
 						</td>
 					</tr>
@@ -60,7 +62,7 @@
 			<td>&nbsp;</td>
 			<td colspan="2">
 				<input type="submit" value="$i18n.getString('save')" style="width:10em">
-				<input name="button" type="button" style="width:10em" onClick="javascript: window.location.href = 'validationCriteria.action'" value="$i18n.getString('cancel')">
+				<input name="button" type="button" style="width:10em" onClick="javascript: window.location.href = 'validationCriteria.action?id=$program.id'" value="$i18n.getString('cancel')">
 			</td>
 		</tr>
 	</table>

=== 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	2013-12-17 01:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm	2013-12-21 23:14:17 +0000
@@ -1,4 +1,5 @@
 <h3>$i18n.getString( "validation_criteria_management" ) #openHelp( "validation_criteria" )</h3>
+<h5>$program.displayName</h5>
 
 <div id="contextMenu" class="contextMenu" style="width: 210px;">
   <ul id="contextMenuItems" class="contextMenuItems">
@@ -11,6 +12,7 @@
 </div>
 
 <table class="mainPageTable">
+	<input type='hidden' id='programId' name='programId' value='$program.id' />
 	<tr>
 		<td style="vertical-align:top">
 			<table width="100%">
@@ -20,7 +22,8 @@
 					</td>
 					
 					<td style="text-align:right" >			
-						<input style="text-align:right" type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddValidationCriteriaForm.action'" style="width:70px">
+						<input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddValidationCriteriaForm.action?id=$program.id'" style="width:100px">
+						<br><input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='program.action'" style="width:100px">
 					</td>
 				</tr>
 			</table>
@@ -31,7 +34,7 @@
 				</tr>
 				</thead>
 				<tbody id="list">
-				#foreach($criteria in $criterias)
+				#foreach($criteria in $program.patientValidationCriteria)
 				<tr id="tr${criteria.id}" data-id="$!criteria.id" data-uid="$!criteria.uid" data-type="ValidationCriteria" data-name="$encoder.htmlEncode( $!criteria.displayName )"
 				    data-can-manage="$security.canManage( $criteria )"
 				    data-can-update="$security.canUpdate( $criteria )"