← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8971: Remove dateType property of program-validaton-ru; e; cleanup code

 

------------------------------------------------------------
revno: 8971
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-12 14:04:25 +0700
message:
  Remove dateType property of program-validaton-ru;e; cleanup code
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateProgramValidationAction.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/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateSingleProgramValidationForm.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/ProgramValidation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java	2012-11-12 06:07:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java	2012-11-12 07:04:25 +0000
@@ -105,14 +105,6 @@
         this.program = program;
     }
 
-    public ProgramValidation( String description, ProgramExpression leftSide, ProgramExpression rightSide, Program program, Boolean dateType )
-    {
-        this.description = description;
-        this.leftSide = leftSide;
-        this.rightSide = rightSide;
-        this.program = program;
-   }
-
     // -------------------------------------------------------------------------
     // hashCode() and equals()
     // -------------------------------------------------------------------------
@@ -241,16 +233,6 @@
         this.program = program;
     }
 
-    public Boolean getDateType()
-    {
-        return dateType;
-    }
-
-    public void setDateType( Boolean dateType )
-    {
-        this.dateType = dateType;
-    }
-
     public Operator getOperator()
     {
         return operator;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java	2012-11-08 13:09:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java	2012-11-12 07:04:25 +0000
@@ -51,8 +51,6 @@
 
     Collection<ProgramValidation> getProgramValidation( Program program );
 
-    Collection<ProgramValidation> getProgramValidation( Program program, Boolean dateType );
-
     Collection<ProgramValidation> getProgramValidation( ProgramStage programStage );
 
     Collection<ProgramValidation> getProgramValidation( ProgramStageDataElement psdataElement );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java	2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java	2012-11-12 07:04:25 +0000
@@ -40,6 +40,4 @@
     String ID = ProgramValidation.class.getName();
 
     Collection<ProgramValidation> get( Program program );
-    
-    Collection<ProgramValidation> get( Program program, Boolean dateType );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-11-12 07:04:25 +0000
@@ -150,6 +150,7 @@
         
         executeSql( "ALTER TABLE programvalidation DROP COLUMN leftside" );
         executeSql( "ALTER TABLE programvalidation DROP COLUMN rightside" );
+        executeSql( "ALTER TABLE programvalidation DROP COLUMN dateType" );
 
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java	2012-11-12 06:07:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramValidationService.java	2012-11-12 07:04:25 +0000
@@ -53,7 +53,7 @@
 {
     private final String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "([a-zA-Z0-9\\- ]+["
         + SEPARATOR_ID + "[0-9]*]*)" + "\\]";
-    
+
     private ProgramValidationStore validationStore;
 
     private ProgramStageService programStageService;
@@ -123,26 +123,24 @@
     public ProgramValidationResult validate( ProgramValidation validation, ProgramStageInstance programStageInstance,
         I18nFormat format )
     {
-        if ( !validation.getDateType() )
+        String leftSideValue = expressionService.getProgramExpressionValue( validation.getLeftSide(),
+            programStageInstance, format );
+        String rightSideValue = expressionService.getProgramExpressionValue( validation.getRightSide(),
+            programStageInstance, format );
+        String operator = validation.getOperator().getMathematicalOperator();
+
+        if ( (leftSideValue != null && rightSideValue.equals( NOT_NULL_VALUE_IN_EXPRESSION ) && rightSideValue == null)
+            || ((leftSideValue != null && rightSideValue != null && !((operator.equals( "==" ) && leftSideValue
+                .compareTo( rightSideValue ) == 0)
+                || (operator.equals( "<" ) && leftSideValue.compareTo( rightSideValue ) < 0)
+                || (operator.equals( "<=" ) && (leftSideValue.compareTo( rightSideValue ) <= 0))
+                || (operator.equals( ">" ) && leftSideValue.compareTo( rightSideValue ) > 0)
+                || (operator.equals( ">=" ) && leftSideValue.compareTo( rightSideValue ) >= 0) || (operator
+                .equals( "!=" ) && leftSideValue.compareTo( rightSideValue ) == 0)))) )
         {
-            String leftSideValue = expressionService.getProgramExpressionValue( validation.getLeftSide(),
-                programStageInstance, format );
-            String rightSideValue = expressionService.getProgramExpressionValue( validation.getRightSide(),
-                programStageInstance, format );
-            String operator = validation.getOperator().getMathematicalOperator();
-            
-            if ( (leftSideValue != null && rightSideValue.equals( NOT_NULL_VALUE_IN_EXPRESSION ) && rightSideValue == null)
-                || ( (leftSideValue != null && rightSideValue != null 
-                    && !( (operator.equals( "==" ) && leftSideValue.compareTo( rightSideValue )==0 )
-                    || (operator.equals( "<" ) && leftSideValue.compareTo( rightSideValue ) < 0 )
-                    || (operator.equals( "<=" ) && (leftSideValue.compareTo( rightSideValue ) <= 0))
-                    || (operator.equals( ">" ) && leftSideValue.compareTo( rightSideValue ) > 0)
-                    || (operator.equals( ">=" ) && leftSideValue.compareTo( rightSideValue ) >= 0) 
-                    || (operator.equals( "!=" ) && leftSideValue.compareTo( rightSideValue ) ==0  ) ))))
-            {
-                return new ProgramValidationResult( programStageInstance, validation, leftSideValue, rightSideValue );
-            }
+            return new ProgramValidationResult( programStageInstance, validation, leftSideValue, rightSideValue );
         }
+
         return null;
     }
 
@@ -151,11 +149,6 @@
         return validationStore.get( program );
     }
 
-    public Collection<ProgramValidation> getProgramValidation( Program program, Boolean dateType )
-    {
-        return validationStore.get( program, dateType );
-    }
-
     public Collection<ProgramValidation> getProgramValidation( ProgramStageDataElement psdataElement )
     {
         Collection<ProgramValidation> programValidation = validationStore.get( psdataElement.getProgramStage()
@@ -190,7 +183,8 @@
         {
             ProgramValidation validation = iter.next();
 
-            String expression = validation.getLeftSide().getExpression() + " " + validation.getRightSide().getExpression();
+            String expression = validation.getLeftSide().getExpression() + " "
+                + validation.getRightSide().getExpression();
             Matcher matcher = pattern.matcher( expression );
 
             boolean flag = false;
@@ -219,11 +213,11 @@
 
         return programValidation;
     }
-    
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
-    
+
     private Collection<DataElement> getDataElementInExpression( ProgramValidation programValidation )
     {
         Collection<DataElement> dataElements = new HashSet<DataElement>();

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java	2012-01-13 02:14:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramValidationStore.java	2012-11-12 07:04:25 +0000
@@ -48,10 +48,4 @@
     {
         return getCriteria( Restrictions.eq( "program", program ) ).list();
     }
-
-    @SuppressWarnings( "unchecked" )
-    public Collection<ProgramValidation> get( Program program, Boolean dateType )
-    {
-        return getCriteria( Restrictions.eq( "program", program ), Restrictions.eq( "dateType", dateType ) ).list();
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramValidation.hbm.xml	2012-11-12 07:04:25 +0000
@@ -27,7 +27,5 @@
 		<many-to-one name="program" class="org.hisp.dhis.program.Program"
 			column="programid" not-null="true" foreign-key="fk_programvalidation_programid" />
 
-		<property name="dateType" />
-
 	</class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddProgramValidationAction.java	2012-11-12 07:04:25 +0000
@@ -107,13 +107,6 @@
         this.rightSideDescription = rightSideDescription;
     }
 
-    private Boolean dateType;
-
-    public void setDateType( Boolean dateType )
-    {
-        this.dateType = dateType;
-    }
-
     private Integer programId;
 
     public void setProgramId( Integer programId )
@@ -142,7 +135,6 @@
         validation.setOperator( Operator.valueOf( operator ) );
         validation.setLeftSide( leftExpression );
         validation.setRightSide( rightExpression );
-        validation.setDateType( dateType );
 
         Program program = programService.getProgram( programId );
         validation.setProgram( program );

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java	2012-02-11 13:58:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetDateDataElementsAction.java	1970-01-01 00:00:00 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2004-2012, 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.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageService;
-import org.hisp.dhis.program.ProgramValidation;
-import org.hisp.dhis.program.ProgramValidationService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- * 
- * @version $GetDateDataElementsAction.java Jan 12, 2012 10:30:44 PM$
- */
-public class GetDateDataElementsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private ProgramStageService programStageService;
-
-    public void setProgramStageService( ProgramStageService programStageService )
-    {
-        this.programStageService = programStageService;
-    }
-
-    private ProgramValidationService programValidationService;
-
-    public void setProgramValidationService( ProgramValidationService programValidationService )
-    {
-        this.programValidationService = programValidationService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input & Output
-    // -------------------------------------------------------------------------
-
-    private Integer psId;
-
-    public void setPsId( Integer psId )
-    {
-        this.psId = psId;
-    }
-
-    public Integer getPsId()
-    {
-        return psId;
-    }
-
-    private List<DataElement> dataElementList = new ArrayList<DataElement>();
-
-    public List<DataElement> getDataElementList()
-    {
-        return dataElementList;
-    }
-
-    private Map<Integer, ProgramValidation> validationMap = new HashMap<Integer, ProgramValidation>();
-
-    public Map<Integer, ProgramValidation> getValidationMap()
-    {
-        return validationMap;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        Collection<ProgramStageDataElement> psDataElements = programStageService.getProgramStage( psId ).getProgramStageDataElements();
-        
-        if ( psDataElements != null && !psDataElements.isEmpty() )
-        {           
-            Iterator<ProgramStageDataElement> iter = psDataElements.iterator();
-
-            while ( iter.hasNext() )
-            {
-                ProgramStageDataElement psDe = iter.next();
-
-                DataElement de = psDe.getDataElement();
-                
-                if ( de.getType().equals( DataElement.VALUE_TYPE_DATE ) )
-                {
-                    dataElementList.add( de );
-                    
-                    Collection<ProgramValidation> validation = programValidationService.getProgramValidation( psDe );
-                
-                    if( !validation.isEmpty() )
-                    {
-                        validationMap.put( de.getId(), validation.iterator().next() );
-                    }
-                    else
-                    {
-                        validationMap.put( de.getId(), null );
-                    }
-                }
-            }
-        }
-
-        return SUCCESS;
-    }
-
-}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java	2012-02-15 07:24:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/GetProgramValidationListAction.java	2012-11-12 07:04:25 +0000
@@ -49,8 +49,18 @@
 
     private ProgramValidationService programValidationService;
 
+    public void setProgramValidationService( ProgramValidationService programValidationService )
+    {
+        this.programValidationService = programValidationService;
+    }
+
     private ProgramService programService;
 
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
     // -------------------------------------------------------------------------
     // Input && Output
     // -------------------------------------------------------------------------
@@ -58,28 +68,18 @@
     private Integer programId;
 
     private Collection<ProgramValidation> validations;
-    
+
     private Program program;
-    
+
     // -------------------------------------------------------------------------
     // Getter && Setter
     // -------------------------------------------------------------------------
 
-    public void setProgramService( ProgramService programService )
-    {
-        this.programService = programService;
-    }
-
     public Collection<ProgramValidation> getValidations()
     {
         return validations;
     }
 
-    public void setProgramValidationService( ProgramValidationService programValidationService )
-    {
-        this.programValidationService = programValidationService;
-    }
-    
     public Program getProgram()
     {
         return program;
@@ -94,14 +94,13 @@
     // Implementation Action
     // -------------------------------------------------------------------------
 
-
     @Override
     public String execute()
         throws Exception
     {
         program = programService.getProgram( programId );
 
-        validations = programValidationService.getProgramValidation( program, false );
+        validations = programValidationService.getProgramValidation( 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/UpdateProgramValidationAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateProgramValidationAction.java	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateProgramValidationAction.java	2012-11-12 07:04:25 +0000
@@ -106,13 +106,6 @@
         this.rightSideDescription = rightSideDescription;
     }
 
-    private Boolean dateType;
-
-    public void setDateType( Boolean dateType )
-    {
-        this.dateType = dateType;
-    }
-
     private Program program;
 
     public Program getProgram()
@@ -149,8 +142,7 @@
         validation.setOperator( Operator.valueOf( operator ) );
         validation.setLeftSide( leftExpression );
         validation.setRightSide( rightExpression );
-        validation.setDateType( dateType );
-
+        
         programValidationService.updateProgramValidation( validation );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2012-11-12 07:04:25 +0000
@@ -892,17 +892,6 @@
 	</bean>
 
 	<bean
-		id="org.hisp.dhis.patient.action.validation.GetDateDataElementsAction"
-		class="org.hisp.dhis.patient.action.validation.GetDateDataElementsAction"
-		scope="prototype">
-		<property name="programStageService">
-			<ref bean="org.hisp.dhis.program.ProgramStageService" />
-		</property>
-		<property name="programValidationService"
-			ref="org.hisp.dhis.program.ProgramValidationService" />
-	</bean>
-	
-	<bean
 		id="org.hisp.dhis.patient.action.validation.GetProgramExpressionDescriptionAction"
 		class="org.hisp.dhis.patient.action.validation.GetProgramExpressionDescriptionAction"
 		scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2012-11-08 13:09:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2012-11-12 07:04:25 +0000
@@ -889,15 +889,6 @@
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
 
-		<action name="showAddMultiProgramValidationForm"
-			class="org.hisp.dhis.patient.action.program.GetProgramAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm</param>
-			<param name="javascripts">javascript/programValidation.js</param>
-			<param name="stylesheets">style/basic.css</param>
-			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
-		</action>
-
 		<action name="showAddSingleProgramValidationForm"
 			class="org.hisp.dhis.patient.action.program.GetProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -906,15 +897,7 @@
 			<param name="stylesheets">style/basic.css</param>
 			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
 		</action>
-
-		<action name="defineDateProgramValidationForm"
-			class="org.hisp.dhis.patient.action.program.GetProgramAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-maintenance-patient/addDateProgramValidationForm.vm</param>
-			<param name="javascripts">javascript/programValidation.js</param>
-			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
-		</action>
-
+		
 		<action name="addProgramValidation"
 			class="org.hisp.dhis.patient.action.validation.AddProgramValidationAction">
 			<result name="success" type="redirect">
@@ -965,28 +948,6 @@
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
-		<action name="getDateDataElements"
-			class="org.hisp.dhis.patient.action.validation.GetDateDataElementsAction">
-			<result name="success" type="velocity">/content.vm</result>
-			<param name="page">/dhis-web-maintenance-patient/dateProgramValidationForm.vm</param>
-		</action>
-
-		<action name="addDateProgramValidation"
-			class="org.hisp.dhis.patient.action.validation.AddProgramValidationAction">
-			<result name="success" type="velocity-json">
-				/dhis-web-commons/ajax/jsonResponseSuccess.vm
-			</result>
-			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
-		</action>
-
-		<action name="updateDateProgramValidation"
-			class="org.hisp.dhis.patient.action.validation.UpdateProgramValidationAction">
-			<result name="success" type="velocity-json">
-				/dhis-web-commons/ajax/jsonResponseSuccess.vm
-			</result>
-			<param name="requiredAuthorities">F_PROGRAM_VALIDATION</param>
-		</action>
-
 		<action name="getProgramExpressionDescription"
 			class="org.hisp.dhis.patient.action.validation.GetProgramExpressionDescriptionAction">
 			<result name="success" type="velocity">

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm	2012-10-30 03:46:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addDateProgramValidationForm.vm	1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-
-<h3>$i18n.getString( "validation_for_date_data_elements" )</h3>
-
-<h4>$program.name</h4>
-
-<form id='programValidationForm' name='programValidationForm' method='post' action='addProgramValidation.action'>
-
-<input type='hidden' id='programId' name='programId' value='$program.id'>
-<input type='hidden' id='dateType' name='dateType' value='true'>
-<table>
-	<tr>
-		<th colspan='3'>
-			<label>$i18n.getString('program_stage')</label>
-		</th>
-	</tr>
-	<tr>
-		<td colspan='3'>
-			<select style="width:630px" id='programStage' name='programStage' onchange="getDateDataElements();">
-				<option value=''>[$i18n.getString( "please_select" )]</option>
-				#foreach($stage in $program.programStages)
-				<option value='$stage.id'>$stage.name</option>
-				#end
-			</select>
-		</td>
-	</tr>
-	<tbody id='dataElementValidation'></tbody>
-	<tr>
-		<td colspan='3'>
-			#parse( "dhis-web-commons/loader/loader.vm" )
-		</td>
-	<tr>
-	<tr>
-		<td>
-			<input type='button' value="$i18n.getString( "cancel" )" style="width:10em" onclick="window.location.href='programValidation.action?programId=$program.id'">
-		</td>
-		<td></td>
-	</tr>
-</table>

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm	2012-11-07 04:33:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addMultiProgramValidationForm.vm	1970-01-01 00:00:00 +0000
@@ -1,139 +0,0 @@
-<h3>$i18n.getString( "add_multi_program_validation_rule" )</h3>
-
-<h4>$program.name</h4>
-
-<form id='programValidationForm' name='programValidationForm' method='post' action='addProgramValidation.action'>
-
-<input type='hidden' id='programId' name='programId' value='$program.id'>
-<input type='hidden' id='dateType' name='dateType' value='false'>
-<table>
-	
-	<thead>
-      <tr>
-        <th colspan="2">$i18n.getString( "program_validation_rule_details" )</th>
-      </tr>
-    </thead>
-    <tbody>
-	<tr>
-		<td>
-			<label>$i18n.getString('name') <em title="$i18n.getString( "required" )" class="required">*</em></label>
-		</td>
-	</tr>
-	<tr>
-		<td colspan='2'>			
-			<input type="text" id='description' name='description' style='width:640px' class="{validate:{required:true,minlength:4}}">
-		</td>
-	</tr>
-	<tr>
-		<th><label>$i18n.getString('left_side')</label></th>
-		<th><label>$i18n.getString('right_side')</label></th>
-	</tr>
-	<tr>
-		<td><label>$i18n.getString("program_stage")</label></td>
-		<td><label>$i18n.getString('program_stage')</label></td>
-	</tr>
-	<tr>
-		<td>
-			<select id='leftStage' name='leftStage' onchange="getLeftPrgramStageDataElements();" style='width:320px'>
-				<option value=''>[$i18n.getString( "please_select" )]</option>
-				#foreach($stage in $program.programStages)
-				<option value='$stage.id'>$stage.name</option>
-				#end
-			</select>
-		</td>
-		<td>
-			<select id='rightStage' name='rightStage' onchange="getRightPrgramStageDataElements();" style='width:320px'>
-				<option value=''>[$i18n.getString( "please_select" )]</option>
-				#foreach($stage in $program.programStages)
-				<option value='$stage.id'>$stage.name</option>
-					#end
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td><label>$i18n.getString("data_elements")</label></td>
-		<td><label>$i18n.getString('data_elements')</label></td>
-	</tr>
-	<tr>
-		<td>
-			<select id='leftSideDE' name='leftSideDE' size='7' ondblclick="insertDataElement(this, 'leftSide', 'leftStageDescription');" style='width:320px'>
-			</select>
-		</td>
-		<td>
-			<select id='rightSideDE' name='rightSideDE' size='7' ondblclick="insertDataElement(this, 'rightSide', 'rightStageDescription' );" style='width:320px'>
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			<input type='button' value="+" title="$i18n.getString( 'plus' )" onclick='insertOperator( "leftStageDescription", "leftSide", "+" );' class="small-button" >
-			&nbsp;&nbsp;
-			<input type='button' value="<" title="$i18n.getString( 'less_then' )" onclick='insertOperator( "leftStageDescription", "leftSide", "<" );' class="small-button" />
-			<input type='button' value="<=" title="$i18n.getString( 'less_then_or_equal_to' )" onclick='insertOperator( "leftStageDescription", "leftSide", "<=" );' class="small-button" />
-			<input type='button' value=">" title="$i18n.getString( 'greater_then' )" onclick='insertOperator( "leftStageDescription", "leftSide", ">" );' class="small-button" />
-			<input type='button' value=">=" title="$i18n.getString( 'greater_then_or_equal_to' )" onclick='insertOperator( "leftStageDescription", "leftSide", ">=" );' class="small-button" />
-			<input type='button' value="=" title="$i18n.getString( 'equals_to' )" onclick='insertOperator( "leftStageDescription", "leftSide", "==" );' class="small-button" />
-			<input type='button' value="!=" title="$i18n.getString( 'diff_from' )" onclick='insertOperator( "leftStageDescription", "leftSide", "!=" );' class="small-button"/>
-			<input type='button' value="!=NULL" title="$i18n.getString( 'not_null' )" onclick='insertOperator( "leftStageDescription", "leftSide", "=={NOT-NULL-VALUE}" );' class="nornal-button" />
-			&nbsp;&nbsp;
-			<input type='button' value="$i18n.getString( 'clear' )" title="$i18n.getString( 'clear' )" align='right'  onclick="clearValidation( 'leftSide', 'leftStageDescription' )" style="width:45px;" />
-		</td>
-		<td>
-			<input type='button' value="+" title="$i18n.getString( 'plus' )" onclick='insertOperator( "rightStageDescription", "rightSide", "+" );' class="small-button" />
-			&nbsp;&nbsp;
-			<input type='button' value="<" title="$i18n.getString( 'less_then' )" onclick='insertOperator( "rightStageDescription", "rightSide", "<" );' class="small-button" />
-			<input type='button' value="<=" title="$i18n.getString( 'less_then_or_equal_to' )" onclick='insertOperator( "rightStageDescription", "rightSide", "<=" );' class="small-button" />
-			<input type='button' value=">" title=="$i18n.getString( 'greater_then' )" onclick='insertOperator( "rightStageDescription", "rightSide", ">" );' class="small-button" />
-			<input type='button' value=">=" title=="$i18n.getString( 'greater_then_or_equal_to' )" onclick='insertOperator( "rightStageDescription", "rightSide", ">=" );' class="small-button" >
-			<input type='button' value="=" title=="$i18n.getString( 'equals_to' )" onclick='insertOperator( "rightStageDescription", "rightSide", "==" );' class="small-button" />
-			<input type='button' value="!=" title=="$i18n.getString( 'diff_from' )" onclick='insertOperator( "rightStageDescription", "rightSide", "!=" );' class="small-button" />
-			<input type='button' value="!=NULL" title="$i18n.getString( 'not_null' )" onclick='insertOperator( "leftStageDescription", "rightSide", "=={NOT-NULL-VALUE}" );' class="nornal-button" />
-			&nbsp;&nbsp;
-			<input type='button' value="$i18n.getString( 'clear' )" title="$i18n.getString( 'clear' )" onclick="clearValidation( 'rightSide', 'rightStageDescription' )" style="width:45px;" />
-		</td>
-	</tr>
-	<tr>	
-		<td>
-			<fieldset>
-				<legend>$i18n.getString("formula") <em title="$i18n.getString( "required" )" class="required">*</em></legend>
-				<textarea rows='5' id='leftSide' name='leftSide' class="{validate:{required:true,minlength:4}}" onkeyup="getValidationDescription('leftStageDescription', 'leftSide')" style='width:300px'></textarea>
-			</fieldset>
-		</td>
-		<td>
-			<fieldset>
-				<legend>$i18n.getString("formula") <em title="$i18n.getString( "required" )" class="required">*</em></legend>
-				<textarea rows='5' id='rightSide' name='rightSide' class="{validate:{required:true,minlength:4}}" onkeyup="getValidationDescription('rightStageDescription', 'rightSide')" style='width:300px'></textarea>
-			</fieldset>
-		</td>
-	</tr>
-	<tr>	
-		<td>
-			<fieldset>
-				<legend>$i18n.getString( "description" )</legend>
-				<div id='leftStageDescription' style='width:300px'></div>
-			</fieldset>
-		</td>
-		<td>
-			<fieldset>
-				<legend>$i18n.getString( "description" )</legend>
-				<div id='rightStageDescription' style='width:300px'></div>
-			</fieldset>
-		</td>
-	</tr>
-	<tr>
-		<td>&nbsp;</td>
-	</tr>
-	<tr>
-		<td>
-			<input type='submit' value="$i18n.getString( 'add' )" >
-			<input type='button' value="$i18n.getString( 'cancel' )" onclick="window.location.href='programValidation.action?programId=$program.id'">
-		</td>
-		<td></td>
-	</tr>
-	
-</table>
-
-<script>
-	getLeftPrgramStageDataElements();
-	getRightPrgramStageDataElements();
-</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addSingleProgramValidationForm.vm	2012-11-12 07:04:25 +0000
@@ -5,7 +5,6 @@
 <form id='programValidationForm' name='programValidationForm' method='post' action='addProgramValidation.action'>
 
 <input type='hidden' id='programId' name='programId' value='$program.id'>
-<input type='hidden' id='dateType' name='dateType' value='false'>
 <table>
 	<thead>
       <tr>
@@ -24,7 +23,7 @@
 	<tr>
 		<td><label>$encoder.htmlEncode( $i18n.getString( "operator" ) ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
-			<select id="operator" name="operator">
+			<select id="operator" name="operator" class="{validate:{required:true}}">
 				<option value="">[ $i18n.getString( "please_select" ) ]</option>
 				<option value="equal_to">$encoder.htmlEncode( $i18n.getString( "equal_to" ) )</option>
 				<option value="not_equal_to">$encoder.htmlEncode( $i18n.getString( "not_equal_to" ) )</option>
@@ -39,13 +38,13 @@
 		<td></td>
 		<td>
 			<input type="button" value="$i18n.getString( 'edit_left_side' )" onclick="editLeftExpression();">
-			<input type="hidden" id="leftSideDescription" name="leftSideDescription">
+			<input type="hidden" id="leftSideDescription" name="leftSideDescription" class="{validate:{required:true}}">
 			<input type="hidden" id="leftSideExpression" name="leftSideExpression">
 			<input type="hidden" id="leftSideTextualExpression" name="leftSideTextualExpression">
 			<input type="hidden" id="leftSideNullIfBlank" name="leftSideNullIfBlank">
 			
 			<input type="button" value="$i18n.getString( 'edit_right_side' )" onclick="editRightExpression();"></td>
-			<input type="hidden" id="rightSideDescription" name="rightSideDescription">
+			<input type="hidden" id="rightSideDescription" name="rightSideDescription" class="{validate:{required:true}}">
 			<input type="hidden" id="rightSideExpression" name="rightSideExpression">
 			<input type="hidden" id="rightSideTextualExpression" name="rightSideTextualExpression">
 			<input type="hidden" id="rightSideNullIfBlank" name="rightSideNullIfBlank">

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm	2012-09-25 09:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/dateProgramValidationForm.vm	1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-<table>
-#if( $dataElementList.size() > 0 )
-	<col width="30"/>
-    <col width="400"/>
-    <col width="280"/>
-	
-	<tr>
-		<th>$i18n.getString('#')</th>
-		<th>$i18n.getString('data_element')</th>
-		<th>$i18n.getString('condition')</th>
-	</tr>	
-
-	#set( $mark = false )
-	#set( $index = 0 )
-	#foreach( $dataElement in $dataElementList )
-		#set( $id= '[DE:' + $psId + '.' + $dataElement.id + ']')
-		#set( $validationId= $id + '.validation' )
-		#set( $index = $index + 1 )
-		<tr #alternate($mark) >
-			<td>$index</td>
-			<td>$dataElement.name</td>
-			<td> 
-				<select id="$dataElement.id" validationid="$!validationMap.get($dataElement.id).id" onchange="dateValidation('$id','$dataElement.id' ,'$dataElement.name' )" >
-					<option value=''>[$i18n.getString('please_select')] </option>
-					<option value='1'>$i18n.getString('before_current_date') </option>
-					<option value='3'>$i18n.getString('after_current_date') </option>
-					<option value='2'>$i18n.getString('before_or_equals_to_current_date') </option>
-					<option value='4'>$i18n.getString('after_or_equals_to_current_date') </option>
-					<option value='-1'>$i18n.getString('before_due_date') </option>
-					<option value='-3'>$i18n.getString('after_due_date') </option>
-					<option value='-2'>$i18n.getString('before_or_equals_to_due_date') </option>
-					<option value='-4'>$i18n.getString('after_or_equals_to_due_date') </option>
-					<option value='-5'>$i18n.getString('in_range_due_date')</option>
-				</select>
-				<span id="div$dataElement.id" style='display:none;'>
-					+/- <input type='text' id="days$dataElement.id" style="width:50px;" onchange="saveDateValidation('$id','$dataElement.id' ,'$dataElement.name' )">
-				<span>
-				
-				<script>
-					var dataElementId = '$dataElement.id';
-					var rightSide = "$!validationMap.get($dataElement.id).rightSide";
-					parseRightSide( dataElementId, rightSide );
-				</script>
-				
-			</td>
-		</tr>
-		#set ( $mark = !$mark)
-	#end
-#else
-	<tr>
-		<td colspan='2'>$i18n.getString('no_date_data_element_in_selected_program_stage')<td>
-	</tr>
-#end
-</table>
\ 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/javascript/programValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js	2012-11-12 07:04:25 +0000
@@ -43,7 +43,7 @@
 }
 
 //------------------------------------------------------------------------------
-// Get DataElements of Program-Stage into left-side
+// Load data-elements of each program-stage
 //------------------------------------------------------------------------------
 
 function getLeftPrgramStageDataElements()
@@ -64,10 +64,6 @@
 	});   
 }
 
-//------------------------------------------------------------------------------
-// Get DataElements of Program-Stage into right-side
-//------------------------------------------------------------------------------
-
 function getRightPrgramStageDataElements()
 {
 	clearListById( 'rightSideDE' );
@@ -87,123 +83,6 @@
 	
 }
 
-function getDateDataElements()
-{
-	hideById('dataElementValidation');
-	showLoader();
-	var programStageId = getFieldValue('programStage');
-	
-	if( programStageId == '')
-	{
-		hideById('loaderDiv');
-		hideById('dataElementValidation');
-		return;
-	}
-	
-	$( '#dataElementValidation' ).load( "getDateDataElements.action", 
-		{ 
-			psId:programStageId
-		},function( )
-		{	
-			hideById('loaderDiv');
-			showById('dataElementValidation');
-		});
-}
-
-function dateValidation( id, fieldId, dataElementName ) 
-{
-	var expression = $("#" + fieldId + ' option:selected').val();
-	var validationid = $("#" + fieldId ).attr('validationid');
-	
-	if( expression != -5)
-	{
-		hideById( 'div' + fieldId );
-		setFieldValue('days' + fieldId, '' );
-		saveDateValidation( id, fieldId, dataElementName );
-	}
-	else
-	{
-		byId( fieldId ).style.backgroundColor = COLOR_WHITE;
-		byId( 'days' + fieldId ).style.backgroundColor = COLOR_WHITE;
-		showById( 'div' + fieldId );
-	}
-	
-} 
-
-function saveDateValidation( id, fieldId, dataElementName )
-{
-	var expression = $("#" + fieldId + ' option:selected').val();
-	if( expression == -5 )
-	{
-		expression += "D" + getFieldValue( 'days' + fieldId );
-	}
-	var validationid = $("#" + fieldId ).attr('validationid');
-	
-	if( validationid == '' )
-	{
-		var description =  $('#programStage option:selected').text() + ' - ' + dataElementName;
-		jQuery.post( "addDateProgramValidation.action", {
-			description: description,
-			leftSide: id,
-			rightSide: expression,
-			programId: getFieldValue('programId'),
-			dateType: getFieldValue('dateType')
-		}, function( json )
-		{
-			byId( fieldId ).style.backgroundColor = COLOR_GREEN;
-			byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN;
-			$("#" + fieldId ).attr('validationid', json.message );
-		});
-	}
-	else
-	{
-		var rightSide = $("#" + fieldId + ' option:selected').val();
-		if( rightSide == '')
-		{
-			jQuery.post( "removeProgramValidation.action", {
-				id:validationid
-			}, function( json )
-			{
-				byId( fieldId ).style.backgroundColor = COLOR_GREEN;
-				byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN;
-				$("#" + fieldId ).attr('validationid', '' );
-			});
-		}
-		else
-		{
-			var description =  $('#programStage option:selected').text() + ' - ' + dataElementName;
-			jQuery.post( "updateDateProgramValidation.action", {
-				id:validationid,
-				description: description,
-				leftSide: id,
-				rightSide: expression,
-				programId: getFieldValue('programId')
-			}, function( json )
-			{
-				byId( fieldId ).style.backgroundColor = COLOR_GREEN;
-				byId( 'days' + fieldId ).style.backgroundColor = COLOR_GREEN;
-			});
-		}
-	}
-}
-
-function parseRightSide( dataElementId, rightSide )
-{
-	var index = rightSide.indexOf('D');
-	if( index < 0 )
-	{
-		$('#' + dataElementId ).val( rightSide );
-	}
-	else
-	{
-		var selectorValue = rightSide.substr( 0,index );
-		var daysValue = rightSide.substr( index + 1,rightSide.length);
-		$('#' + dataElementId).val(selectorValue);
-		$('#days' + dataElementId ).val(daysValue);
-		showById('div' + dataElementId );
-	}
-}
-
 //------------------------------------------------------------------------------
 // Show Left side form for designing
 //------------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm	2012-11-08 16:19:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm	2012-11-12 07:04:25 +0000
@@ -34,12 +34,6 @@
 			  </tr>
 
 			  <tbody id="list">
-				<!-- tr id="tr${validation.id}">
-					<td>$i18n.getString( "validation_for_date_data_elements" )</td>
-					<td>
-					  <a href="defineDateProgramValidationForm.action?id=$program.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>						
-					</td>
-				</tr -->
 				#foreach( $validation in $validations )
 				  <tr id="tr${validation.id}">
 					

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm	2012-11-07 04:33:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateMultiProgramValidationForm.vm	1970-01-01 00:00:00 +0000
@@ -1,142 +0,0 @@
-<h3>$i18n.getString( "edit_program_validation_rule" )</h3>
-
-<h4>$validation.program.name</h4>
-
-<form id='programValidationForm' name='programValidationForm' method='post' action='updateProgramValidation.action'>
-
-<input type='hidden' id='id' name='id' value='$validation.id'>
-<table>
-	
-	<thead>
-      <tr>
-        <th colspan='2'>$i18n.getString( "program_validation_rule_details" )</th>
-      </tr>
-    </thead>
-    <tbody>
-	
-	<tr>
-		<td>
-			<label>$i18n.getString('name') <em title="$i18n.getString( "required" )" class="required">*</em></label>
-		</td>
-	</tr>
-	<tr>
-		<td colspan='2'>			
-			<input type="text" id='description' style='width:640px' name='description' value='$validation.description' style='width:640px;' class="{validate:{required:true,minlength:4}}">
-		</td>
-	</tr>
-	<tr>
-		<td>&nbsp;</td>
-	</tr>
-	<tr>
-		<th><label>$i18n.getString('left_side')</label></th>
-		<th><label>$i18n.getString('right_side')</label></th>
-	</tr>
-	<tr>
-		<td><label>$i18n.getString("program_stage")</label></td>
-		<td><label>$i18n.getString('program_stage')</label></td>
-	</tr>
-	<tr>
-		<td>
-			<select id='leftStage' name='leftStage' onchange="getLeftPrgramStageDataElements();" style='width:320px;'>
-				<option value=''>[$i18n.getString( "please_select" )]</option>
-				#foreach($stage in $validation.program.programStages)
-				<option value='$stage.id'>$stage.name</option>
-				#end
-			</select>
-		</td>
-		<td>
-			<select id='rightStage' name='rightStage' onchange="getRightPrgramStageDataElements();" style='width:320px;'>
-				<option value=''>[$i18n.getString( "please_select" )]</option>
-				#foreach($stage in $validation.program.programStages)
-				<option value='$stage.id'>$stage.name</option>
-				#end
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td><label>$i18n.getString("data_elements")</label></td>
-		<td><label>$i18n.getString('data_elements')</label></td>
-	</tr>
-	<tr>
-		<td>
-			<select id='leftSideDE' name='leftSideDE' size='7' ondblclick="insertDataElement(this, 'leftSide');" style='width:320px;'>
-			</select>
-		</td>
-		<td>
-			<select id='rightSideDE' name='rightSideDE' size='7' ondblclick="insertDataElement(this, 'rightSide');" style='width:320px;'>
-			</select>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			<input type='button' value="+" title="$i18n.getString( 'plus' )" onclick='insertOperator( "leftStageDescription", "leftSide", "+" );' class="small-button" >
-			&nbsp;&nbsp;
-			<input type='button' value="<" title="$i18n.getString( 'less_then' )" onclick='insertOperator( "leftStageDescription", "leftSide", "<" );' class="small-button" />
-			<input type='button' value="<=" title="$i18n.getString( 'less_then_or_equal_to' )" onclick='insertOperator( "leftStageDescription", "leftSide", "<=" );' class="small-button" />
-			<input type='button' value=">" title="$i18n.getString( 'greater_then' )" onclick='insertOperator( "leftStageDescription", "leftSide", ">" );' class="small-button" />
-			<input type='button' value=">=" title="$i18n.getString( 'greater_then_or_equal_to' )" onclick='insertOperator( "leftStageDescription", "leftSide", ">=" );' class="small-button" />
-			<input type='button' value="=" title="$i18n.getString( 'equals_to' )" onclick='insertOperator( "leftStageDescription", "leftSide", "==" );' class="small-button" />
-			<input type='button' value="!=" title="$i18n.getString( 'diff_from' )" onclick='insertOperator( "leftStageDescription", "leftSide", "!=" );' class="small-button"/>
-			<input type='button' value="!=NULL" title="$i18n.getString( 'not_null' )" onclick='insertOperator( "leftStageDescription", "leftSide", "=={NOT-NULL-VALUE}" );' class="nornal-button" />
-			&nbsp;&nbsp;
-			<input type='button' value="$i18n.getString( 'clear' )" title="$i18n.getString( 'clear' )" align='right'  onclick="clearValidation( 'leftSide', 'leftStageDescription' )" style="width:45px;" />
-		</td>
-		<td>
-			<input type='button' value="+" title="$i18n.getString( 'plus' )" onclick='insertOperator( "rightStageDescription", "rightSide", "+" );' class="small-button" />
-			&nbsp;&nbsp;
-			<input type='button' value="<" title="$i18n.getString( 'less_then' )" onclick='insertOperator( "rightStageDescription", "rightSide", "<" );' class="small-button" />
-			<input type='button' value="<=" title="$i18n.getString( 'less_then_or_equal_to' )" onclick='insertOperator( "rightStageDescription", "rightSide", "<=" );' class="small-button" />
-			<input type='button' value=">" title=="$i18n.getString( 'greater_then' )" onclick='insertOperator( "rightStageDescription", "rightSide", ">" );' class="small-button" />
-			<input type='button' value=">=" title=="$i18n.getString( 'greater_then_or_equal_to' )" onclick='insertOperator( "rightStageDescription", "rightSide", ">=" );' class="small-button" >
-			<input type='button' value="=" title=="$i18n.getString( 'equals_to' )" onclick='insertOperator( "rightStageDescription", "rightSide", "==" );' class="small-button" />
-			<input type='button' value="!=" title=="$i18n.getString( 'diff_from' )" onclick='insertOperator( "rightStageDescription", "rightSide", "!=" );' class="small-button" />
-			<input type='button' value="!=NULL" title="$i18n.getString( 'not_null' )" onclick='insertOperator( "leftStageDescription", "rightSide", "=={NOT-NULL-VALUE}" );' class="nornal-button" />
-			&nbsp;&nbsp;
-			<input type='button' value="$i18n.getString( 'clear' )" title="$i18n.getString( 'clear' )" onclick="clearValidation( 'rightSide', 'rightStageDescription' )" style="width:45px;" />
-		</td>
-	</tr>
-	<tr>
-		<td>
-			<fieldset>
-				<legend>$i18n.getString("formula") <em title="$i18n.getString( "required" )" class="required">*</em></legend>
-				<textarea rows='5' id='leftSide' name='leftSide' onkeyup="getValidationDescription('leftStageDescription', 'leftSide')" style='width:320px;' class="{validate:{required:true,minlength:4}}">$validation.leftSide</textarea>
-			</fieldset>
-		</td>
-		<td>
-			<fieldset>
-				<legend>$i18n.getString("formula") <em title="$i18n.getString( "required" )" class="required">*</em></legend>
-				<textarea rows='5' id='rightSide' name='rightSide' onkeyup="getValidationDescription('rightStageDescription', 'rightSide')" style='width:300px;' class="{validate:{required:true,minlength:4}}">$validation.rightSide</textarea>
-			</fieldset>
-		</td>
-	</tr>
-	<tr>	
-		<td>
-			<fieldset>
-				<legend>$i18n.getString( "description" )</legend>
-				<div id='leftStageDescription' style='width:300px;'>$!leftDescription</div>
-			</fieldset>
-		</td>
-		<td>
-			<fieldset>
-				<legend>$i18n.getString( "description" )</legend>
-				<div id='rightStageDescription' style='width:300px;'>$!rightDescription</div>
-			</fieldset>
-		</td>
-	</tr>
-	<tr>
-		<td>&nbsp;</td>
-	</tr>
-	<tr>
-		<td>
-			<input type='submit' value="$i18n.getString( 'update' )">
-			<input type='button' value="$i18n.getString( 'cancel' )" onclick="window.location.href='programValidation.action?programId=$validation.program.id'">
-		</td>
-		<td></td>
-	</tr>
-	
-</table>
-
-<script>
-	getLeftPrgramStageDataElements();
-	getRightPrgramStageDataElements();
-</script>
\ 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/updateSingleProgramValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateSingleProgramValidationForm.vm	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateSingleProgramValidationForm.vm	2012-11-12 07:04:25 +0000
@@ -6,7 +6,6 @@
 
 <input type='hidden' id='id' name='id' value='$validation.id'>
 <input type='hidden' id='programId' name='programId' value='$validation.program.id'>
-<input type='hidden' id='dateType' name='dateType' value='$validation.dateType'>
 <table>
 	<thead>
       <tr>
@@ -41,13 +40,13 @@
 		<td>
 			<input type="button" value="$i18n.getString( 'edit_left_side' )" onclick="editLeftExpression();">
 			<input type="hidden" id="leftSideDescription" name="leftSideDescription" value="$!validation.leftSide.description">
-			<input type="hidden" id="leftSideExpression" name="leftSideExpression" value="$!validation.leftSide.expression">
+			<input type="hidden" id="leftSideExpression" name="leftSideExpression" value="$!validation.leftSide.expression" class="{validate:{required:true}}">
 			<input type="hidden" id="leftSideTextualExpression" name="leftSideTextualExpression" value="$!leftSideTextualExpression">
 			<input type="hidden" id="leftSideNullIfBlank" name="leftSideNullIfBlank" value="$!validation.leftSide.nullIfBlank">
 			
 			<input type="button" value="$i18n.getString( 'edit_right_side' )" onclick="editRightExpression();">
 			<input type="hidden" id="rightSideDescription" name="rightSideDescription" value="$!validation.rightSide.description">
-			<input type="hidden" id="rightSideExpression" name="rightSideExpression" value="$!validation.rightSide.expression">
+			<input type="hidden" id="rightSideExpression" name="rightSideExpression" value="$!validation.rightSide.expression" class="{validate:{required:true}}">
 			<input type="hidden" id="rightSideTextualExpression" name="rightSideTextualExpression" value="$!rightSideTextualExpression">
 			<input type="hidden" id="rightSideNullIfBlank" name="rightSideNullIfBlank" value="$!validation.rightSide.nullIfBlank">
 		</td>