------------------------------------------------------------
revno: 12611
committer: Lars Helge Ă˜verland <[email protected]>
branch nick: dhis2
timestamp: Sun 2013-10-13 20:58:45 +0200
message:
  Validation rule. On view update screen, require to clear expression before 
allowing to change rule type, because the data element period type requirements 
are different for each of the types.
modified:
  
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java
  
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm
  
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/expression.js
  
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRule.js
  
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java	2013-10-13 17:40:38 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java	2013-10-13 18:58:45 +0000
@@ -103,13 +103,6 @@
         this.importance = importance;
     }
 
-    private String ruleType;
-
-    public void setRuleType( String ruleType )
-    {
-        this.ruleType = ruleType;
-    }
-
     private String operator;
 
     public void setOperator( String operator )
@@ -212,7 +205,6 @@
         validationRule.setName( name );
         validationRule.setDescription( description );
         validationRule.setImportance( importance );
-        validationRule.setRuleType( ruleType );
         validationRule.setOperator( Operator.valueOf( operator ) );
 
         validationRule.getLeftSide().setExpression( leftSideExpression );

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm	2013-10-08 19:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm	2013-10-13 18:58:45 +0000
@@ -26,7 +26,7 @@
 	<tr>
 		<td><label for="ruleType">$i18n.getString( "rule_type" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
-			<select type="text" id="ruleType" name="ruleType" onchange="changeRuleType( this.value )">
+			<select type="text" id="ruleType" name="ruleType" onchange="changeRuleType()">
 				<option value="validation" selected="selected">$i18n.getString( "validation" )</option>
 				<option value="monitoring">$i18n.getString( "monitoring" )</option>
 			</select>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/expression.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/expression.js	2012-09-22 19:55:04 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/expression.js	2013-10-13 18:58:45 +0000
@@ -168,20 +168,18 @@
 // Set Null Expression
 // -----------------------------------------------------------------------------
 
-function setNullExpression()
+function clearRuleExpression()
 {
-    // set left-expression
     var description = $( "#leftSideDescription" ).val();
-    $( "#leftSideExpression" ).val( '' );
-    $( "#leftSideTextualExpression" ).val( '' );
-    saveExpression( 'left', description, '', '' );
+    $( "#leftSideExpression" ).val( "" );
+    $( "#leftSideTextualExpression" ).val( "" );
+    saveExpression( "left", description, "", "" );
 
-    // set right-expression
     description = $( "#rightSideDescription" ).val();
-    $( "#rightSideExpression" ).val( '' );
-    $( "#rightSideTextualExpression" ).val( '' );
-    saveExpression( 'right', description, '', '' );
+    $( "#rightSideExpression" ).val( "" );
+    $( "#rightSideTextualExpression" ).val( "" );
+    saveExpression( "right", description, "", "" );
 
-    // Show periodType combo
-    enable( 'periodTypeName' );
+	enable( "ruleType" );
+	enable( "periodTypeName" );
 }

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRule.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRule.js	2013-10-08 17:20:57 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRule.js	2013-10-13 18:58:45 +0000
@@ -1,6 +1,8 @@
-function changeRuleType( ruleType )
+function changeRuleType()
 {
-	if (ruleType == 'validation')
+	var ruleType = $( '#ruleType' ).val();
+	
+	if ( ruleType == 'validation' )
 	{
 		hideById( 'organisationUnitLevelTR');
 		hideById( 'sequentialSampleCountTR');

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleForm.vm	2013-10-13 17:40:38 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleForm.vm	2013-10-13 18:58:45 +0000
@@ -36,13 +36,14 @@
 	<tr>
 		<td><label for="ruleType">$i18n.getString( "rule_type" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
-			<select type="text" id="ruleType" name="ruleType" onchange="changeRuleType( this.value )">
+			<select type="text" id="ruleType" name="ruleType" onchange="changeRuleType()" disabled="disabled">
 				<option value="validation" #if( $validationRule.ruleType == 'validation' ) selected #end>$encoder.htmlEncode( $i18n.getString( "validation" ) )</option>
 				<option value="monitoring" #if( $validationRule.ruleType == 'monitoring' ) selected #end>$encoder.htmlEncode( $i18n.getString( "monitoring" ) )</option>
 			</select>
+			<img title="$i18n.getString( 'clear_expression' )" onclick="clearRuleExpression()" src="../images/edit-clear.png" style="width: 20px; cursor:pointer;" />
 		</td>
 	</tr>
-	<tr id="organisationUnitLevelTR" #if( $!validationRule.ruleType != 'monitoring' ) style='display:none;' #end>
+	<tr id="organisationUnitLevelTR" #if( $!validationRule.ruleType != 'monitoring' ) style="display:none;" #end>
 		<td><label for="organisationUnitLevel">$i18n.getString( "organisation_unit_level" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
 			<select type="text" id="organisationUnitLevel" name="organisationUnitLevel">
@@ -53,13 +54,13 @@
 		</td>
 	</tr>
 	<tr>
-		<td><label for="periodType">$i18n.getString( "period_type" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td><select type="text" id="periodTypeName" name="periodTypeName" disabled>
-					#foreach ( $periodType in $periodTypes )
-             		 <option value="$periodType.name" #if( $validationRule.periodType.name.equals($periodType.name ) ) selected #end>$encoder.htmlEncode( $i18n.getString( $periodType.name ) )</option>
-            		#end						
+		<td><label for="periodType">$i18n.getString( "period_type" )</label></td>
+		<td><select type="text" id="periodTypeName" name="periodTypeName" disabled="disabled">
+				#foreach ( $periodType in $periodTypes )
+             	<option value="$periodType.name" #if( $validationRule.periodType.name.equals($periodType.name ) ) selected #end>$encoder.htmlEncode( $i18n.getString( $periodType.name ) )</option>
+            	#end						
 			</select>
-			<img title="$i18n.getString('clear_expression')" onclick='setNullExpression();' src='../images/edit-clear.png' style='width: 20px;cursor:pointer' />
+			<img title="$i18n.getString( 'clear_expression' )" onclick="clearRuleExpression()" src="../images/edit-clear.png" style="width: 20px; cursor:pointer;" />
 		</td>
 	</tr>
 	<tr id="sequentialSampleCountTR"  #if( $!validationRule.ruleType != 'monitoring' ) style='display:none;' #end>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to