← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3582: Fix small bug: Always show 1 in indicator denominator.

 

------------------------------------------------------------
revno: 3582
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-12 10:24:00 +0700
message:
  Fix small bug: Always show 1 in indicator denominator.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.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-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2011-02-14 04:01:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2011-05-12 03:24:00 +0000
@@ -350,4 +350,5 @@
 negativeNumber									= Negative Number
 view_1											= View 1
 view_2											= View 2
-store_zero_data_values							= Store Zero Data Value
\ No newline at end of file
+store_zero_data_values							= Store Zero Data Value
+warning_choose_indicator_type_as_number			= Indicator is created with indicator type as number has denominator as 1.

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm	2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm	2011-05-12 03:24:00 +0000
@@ -74,8 +74,9 @@
 		<td></td>
 		<td>
 			<input type="button" id="denominatorButton" name="denominatorButton" value="$i18n.getString( 'edit_denominator' )" onclick="indicatorDenominatorForm()" style="width:20em"/>
-			<input type="hidden" id="denominator" name="denominator" class="{validate:{required:true}}" value="1"/>
+			<input type="hidden" id="denominator" name="denominator" class="{validate:{required:true}}"/>
 		</td>
+		<td><span id='warning'></span></td>
 	</tr>
 	<tr>
 		<td height="20px"></td>
@@ -90,3 +91,8 @@
 </form>
 
 #parse( "/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm" )
+
+<script>
+	var i18n_warning_choose_indicator_type_as_number = '$encoder.jsEscape( $i18n.getString( "warning_choose_indicator_type_as_number" ) , "'")';
+</script>
+

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js	2011-04-11 13:46:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js	2011-05-12 03:24:00 +0000
@@ -1,8 +1,26 @@
 
 function indicatorTypeChanged()
 {
-	var type  = byId('indicatorTypeId').options[byId('indicatorTypeId').selectedIndex].getAttribute('number');
+	var type = byId('indicatorTypeId').options[byId('indicatorTypeId').selectedIndex].getAttribute('number');
 	byId('denominatorButton').disabled = eval(type);
+	if( eval(type) )
+	{
+		setFieldValue('denominator','1');
+		setInnerHTML('warning', "<i style='color:red'>" + i18n_warning_choose_indicator_type_as_number + "</i>")
+	}
+	else
+	{
+		if(getFieldValue('denominatorFormula') == undefined )
+		{
+			setFieldValue('denominator','');
+		}
+		else
+		{
+			setFieldValue('denominator',getFieldValue('denominatorFormula'));
+		}
+		
+		setInnerHTML('warning',"");
+	}	
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm	2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm	2011-05-12 03:24:00 +0000
@@ -73,7 +73,9 @@
 		<td>
 			<input type="button" id="denominatorButton" name="denominatorButton" value="$i18n.getString( 'edit_denominator' )" onclick="indicatorDenominatorForm()" style="width:20em"  #if($!indicator.indicatorType.number=='true') disabled #end/>
 			<input type="hidden" id="denominator" name="denominator" value="$!indicator.denominator"/>
+			<input type="hidden" id="denominatorFormula" name="denominatorFormula" value="$!indicator.denominator"/>
 		</td>
+		<td><span id='warning'></span></td>
 	</tr>
 	<tr>
 		<td height="20px"></td>
@@ -87,3 +89,7 @@
 </form>
 
 #parse( "/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm" )
+
+<script>
+	var i18n_warning_choose_indicator_type_as_number = '$encoder.jsEscape( $i18n.getString( "warning_choose_indicator_type_as_number" ) , "'")';
+</script>
\ No newline at end of file