← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12822: Disallow compulsory pair operator for Surveillance validation rules

 

------------------------------------------------------------
revno: 12822
committer: dhis2-c <dhis2@xxxxxxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2013-10-28 11:49:09 -0400
message:
  Disallow compulsory pair operator for Surveillance validation rules
modified:
  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/general.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
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.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/webapp/dhis-web-validationrule/addValidationRuleForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm	2013-10-16 13:41:01 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleForm.vm	2013-10-28 15:49:09 +0000
@@ -75,14 +75,14 @@
 		<td><label for="operatorId">$i18n.getString( "operator" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
 			<select id="operator" name="operator">
-				<option value="">[ $i18n.getString( "select_operator" ) ]</option>
+				<option value="" id="select_operator">[ $i18n.getString( "select_operator" ) ]</option>
 				<option value="equal_to">$i18n.getString( "equal_to" )</option>
 				<option value="not_equal_to">$i18n.getString( "not_equal_to" )</option>
 				<option value="greater_than">$i18n.getString( "greater_than" )</option>
 				<option value="greater_than_or_equal_to">$i18n.getString( "greater_than_or_equal_to" )</option>
 				<option value="less_than">$i18n.getString( "less_than" )</option>
 				<option value="less_than_or_equal_to">$i18n.getString( "less_than_or_equal_to" )</option>
-                <option value="compulsory_pair">$i18n.getString( "compulsory_pair" )</option>
+                <option value="compulsory_pair" id="compulsory_pair">$i18n.getString( "compulsory_pair" )</option>
 			</select>
 		</td>
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js	2013-10-16 12:39:47 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js	2013-10-28 15:49:09 +0000
@@ -115,6 +115,10 @@
     {
         return i18n_less_than_or_equal_to;
     }
+    else if ( operator == "compulsory_pair" )
+    {
+        return i18n_compulsory_pair;
+    }
     
     return null;
 }

=== 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-13 19:01:22 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRule.js	2013-10-28 15:49:09 +0000
@@ -4,18 +4,28 @@
 	
 	if ( ruleType == 'validation' )
 	{
-		hideById( 'organisationUnitLevelTR');
-		hideById( 'sequentialSampleCountTR');
-		hideById( 'annualSampleCountTR');
-		hideById( 'highOutliersTR');
-		hideById( 'lowOutliersTR');
+		hideById( 'organisationUnitLevelTR' );
+		hideById( 'sequentialSampleCountTR' );
+		hideById( 'annualSampleCountTR' );
+		hideById( 'highOutliersTR' );
+		hideById( 'lowOutliersTR' );
+
+		showById( 'compulsory_pair' );
 	} 
 	else
 	{
-		showById( 'organisationUnitLevelTR');
-		showById( 'sequentialSampleCountTR');
-		showById( 'annualSampleCountTR');
-		showById( 'highOutliersTR');
-		showById( 'lowOutliersTR');
+		showById( 'organisationUnitLevelTR' );
+		showById( 'sequentialSampleCountTR' );
+		showById( 'annualSampleCountTR' );
+		showById( 'highOutliersTR' );
+		showById( 'lowOutliersTR' );
+
+		var op = document.getElementById( 'operator' );
+		if ( 'compulsory_pair' == op.value )
+		{
+			showById( 'select_operator' );
+			op.selectedIndex = 0;
+		}
+		hideById( 'compulsory_pair' );
     }
 }

=== 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-23 12:41:10 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/updateValidationRuleForm.vm	2013-10-28 15:49:09 +0000
@@ -63,19 +63,19 @@
 			<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 != 'surveillance' ) style='display:none;' #end>
+	<tr id="sequentialSampleCountTR">
 		<td><label for="sequentialSampleCount">$i18n.getString( "sequential_sample_count" )</label></td>
 		<td><input type="text" id="sequentialSampleCount" name="sequentialSampleCount" value="$!validationRule.sequentialSampleCount"></td>
 	</tr>
-	<tr id="annualSampleCountTR" #if( $!validationRule.ruleType != 'surveillance' ) style='display:none;' #end">
+	<tr id="annualSampleCountTR">
 		<td><label for="annualSampleCount">$i18n.getString( "annual_sample_count" )</label></td>
 		<td><input type="text" id="annualSampleCount" name="annualSampleCount" value="$!validationRule.annualSampleCount"></td>
 	</tr>
-	<tr id="highOutliersTR" #if( $!validationRule.ruleType != 'surveillance' ) style='display:none;' #end>
+	<tr id="highOutliersTR">
 		<td><label for="highOutliers">$i18n.getString( "high_outliers" )</label></td>
 		<td><input type="text" id="highOutliers" name="highOutliers" value="$!validationRule.highOutliers"></td>
 	</tr>
-	<tr id="lowOutliersTR" #if( $!validationRule.ruleType != 'surveillance' ) style='display:none;' #end>
+	<tr id="lowOutliersTR">
 		<td><label for="lowOutliers">$i18n.getString( "low_outliers" )</label></td>
 		<td><input type="text" id="lowOutliers" name="lowOutliers" value="$!validationRule.lowOutliers"></td>
 	</tr>
@@ -83,13 +83,14 @@
 		<td><label for="operatorId">$i18n.getString( "operator" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td>
 			<select id="operator" name="operator">
+                <option value="" id="select_operator" style='display:none;'>[ $i18n.getString( "select_operator" ) ]</option>
 				<option value="equal_to" #if ( $validationRule.operator == 'equal_to' )selected="selected"#end>$i18n.getString( "equal_to" )</option>
 				<option value="not_equal_to" #if ( $validationRule.operator == 'not_equal_to' )selected="selected"#end>$i18n.getString( "not_equal_to" )</option>
 				<option value="greater_than" #if ( $validationRule.operator == 'greater_than' )selected="selected"#end>$i18n.getString( "greater_than" )</option>
 				<option value="greater_than_or_equal_to" #if ( $validationRule.operator == 'greater_than_or_equal_to' )selected="selected"#end>$i18n.getString( "greater_than_or_equal_to" )</option>
 				<option value="less_than" #if ( $validationRule.operator == 'less_than' )selected="selected"#end>$i18n.getString( "less_than" )</option>
 				<option value="less_than_or_equal_to" #if ( $validationRule.operator == 'less_than_or_equal_to' )selected="selected"#end>$i18n.getString( "less_than_or_equal_to" )</option>
-                <option value="compulsory_pair" #if ( $validationRule.operator == 'compulsory_pair' )selected="selected"#end>$i18n.getString( "compulsory_pair" )</option>
+                <option value="compulsory_pair" id="compulsory_pair" #if ( $validationRule.operator == 'compulsory_pair' )selected="selected"#end>$i18n.getString( "compulsory_pair" )</option>
 			</select>
 		</td>
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm	2013-10-16 12:39:47 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/validationRule.vm	2013-10-28 15:49:09 +0000
@@ -26,21 +26,24 @@
 		exportPdfByType( type, params );
 	}
 	
-	var i18n_high = '$encoder.jsEscape( $i18n.getString( "high" ) , "'")';
-	var i18n_medium = '$encoder.jsEscape( $i18n.getString( "medium" ) , "'")';
-	var i18n_low = '$encoder.jsEscape( $i18n.getString( "low" ) , "'")';
-	
-	var i18n_validation = '$encoder.jsEscape( $i18n.getString( "validation" ) , "'")';
-	var i18n_surveillance = '$encoder.jsEscape( $i18n.getString( "surveillance" ) , "'")';
-	
-	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_validation_rule" ) , "'")';
-	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
-	var i18n_equal_to = '$encoder.jsEscape( $i18n.getString( "equal_to" ) , "'")';
-	var i18n_not_equal_to = '$encoder.jsEscape( $i18n.getString( "not_equal_to" ) , "'")';
-	var i18n_greater_than = '$encoder.jsEscape( $i18n.getString( "greater_than" ) , "'")';
-	var i18n_greater_than_or_equal_to = '$encoder.jsEscape( $i18n.getString( "greater_than_or_equal_to" ) , "'")';
-	var i18n_less_than = '$encoder.jsEscape( $i18n.getString( "less_than" ) , "'")';
-	var i18n_less_than_or_equal_to = '$encoder.jsEscape( $i18n.getString( "less_than_or_equal_to" ) , "'")';
+	var i18n_high = '$i18n.getString( "high" )';
+	var i18n_medium = '$i18n.getString( "medium" )';
+	var i18n_low = '$i18n.getString( "low" )';
+	
+	var i18n_validation = '$i18n.getString( "validation" )';
+	var i18n_surveillance = '$i18n.getString( "surveillance" )';
+	
+	var i18n_confirm_delete = '$i18n.getString( "confirm_delete_validation_rule" )';
+
+	var i18n_none = '$i18n.getString( "none" )';
+
+	var i18n_equal_to = '$i18n.getString( "equal_to" )';
+	var i18n_not_equal_to = '$i18n.getString( "not_equal_to" )';
+	var i18n_greater_than = '$i18n.getString( "greater_than" )';
+	var i18n_greater_than_or_equal_to = '$i18n.getString( "greater_than_or_equal_to" )';
+	var i18n_less_than = '$i18n.getString( "less_than" )';
+	var i18n_less_than_or_equal_to = '$i18n.getString( "less_than_or_equal_to" )';
+	var i18n_compulsory_pair = '$i18n.getString( "compulsory_pair" )';
 </script>
 
 <h3>$encoder.htmlEncode( $i18n.getString( "validation_rule_management" ) ) #openHelp( "validationRule" )</h3>