------------------------------------------------------------
revno: 2385
committer: Tran Chau <tran.hispviet...@gmail.com>
branch nick: dhis2
timestamp: Thu 2010-12-16 11:38:17 +0700
message:
  Add number property for IndicatorType.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java
  
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/addIndicatorTypeForm.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
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.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/indicator/IndicatorType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java	2010-05-12 12:01:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java	2010-12-16 04:38:17 +0000
@@ -38,6 +38,8 @@
 {
     private int factor;
 
+    private Boolean number;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -46,10 +48,11 @@
     {
     }
 
-    public IndicatorType( String name, int factor )
+    public IndicatorType( String name, int factor, Boolean number )
     {
         this.name = name;
         this.factor = factor;
+        this.number = number;
     }
 
     // -------------------------------------------------------------------------
@@ -104,4 +107,14 @@
     {
         this.factor = factor;
     }
+
+    public Boolean getNumber()
+    {
+        return number != null && number;
+    }
+
+    public void setNumber( Boolean number )
+    {
+        this.number = number;
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2010-12-06 10:23:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2010-12-16 04:38:17 +0000
@@ -205,6 +205,8 @@
 
         executeSql( "ALTER TABLE aggregatedindicatorvalue DROP COLUMN modified ");
         
+        executeSql( "UPDATE indicatortype SET indicatornumber=false WHERE indicatornumber is null" );
+        
         log.info( "Tables updated" );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml	2010-12-16 04:38:17 +0000
@@ -17,6 +17,8 @@
     </property>
 
     <property name="factor" column="indicatorfactor" not-null="true"/>
+    
+     <property name="number" column="indicatornumber"/>
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorServiceTest.java	2010-12-16 04:38:17 +0000
@@ -80,8 +80,8 @@
     public void testAddIndicatorType()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         int idA = indicatorService.addIndicatorType( typeA );
         int idB = indicatorService.addIndicatorType( typeB );
@@ -99,7 +99,7 @@
     public void testUpdateIndicatorType()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
         int idA = indicatorService.addIndicatorType( typeA );
         typeA = indicatorService.getIndicatorType( idA );
         assertEquals( typeA.getName(), "IndicatorTypeA" );
@@ -115,8 +115,8 @@
     public void testGetAndDeleteIndicatorType()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         int idA = indicatorService.addIndicatorType( typeA );
         int idB = indicatorService.addIndicatorType( typeB );
@@ -139,8 +139,8 @@
     public void testGetAllIndicatorTypes()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         indicatorService.addIndicatorType( typeA );
         indicatorService.addIndicatorType( typeB );
@@ -156,8 +156,8 @@
     public void testGetIndicatorTypeByName()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         int idA = indicatorService.addIndicatorType( typeA );
         int idB = indicatorService.addIndicatorType( typeB );
@@ -292,7 +292,7 @@
     @Test
     public void testGetGroupsContainingIndicator() throws Exception
     {
-        IndicatorType indicatorType = new IndicatorType( "indicatorTypeName", 100 );
+        IndicatorType indicatorType = new IndicatorType( "indicatorTypeName", 100, false );
         indicatorService.addIndicatorType( indicatorType );
 
         Indicator indicator1 = createIndicator( 'A', indicatorType );
@@ -348,7 +348,7 @@
     public void testAddIndicator()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
         
         indicatorService.addIndicatorType( type );
         
@@ -371,7 +371,7 @@
     public void testUpdateIndicator()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorService.addIndicatorType( type );
         
@@ -391,7 +391,7 @@
     public void testGetAndDeleteIndicator()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorService.addIndicatorType( type );
         
@@ -419,7 +419,7 @@
     public void testGetIndicatorByUUID()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
         indicatorService.addIndicatorType( type );
         
         Indicator indicatorA = createIndicator( 'A', type );        
@@ -437,7 +437,7 @@
     public void testGetAllIndicators()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorService.addIndicatorType( type );
         
@@ -458,7 +458,7 @@
     public void testGetIndicatorByName()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorService.addIndicatorType( type );
         
@@ -483,7 +483,7 @@
     public void testGetIndicatorByAlternativeName()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorService.addIndicatorType( type );
         
@@ -508,7 +508,7 @@
     public void testGetIndicatorByShortName()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorService.addIndicatorType( type );
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java	2010-12-16 04:38:17 +0000
@@ -88,9 +88,9 @@
     public void testAddIndicatorType()
         throws Exception
     {        
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
-        IndicatorType typeC = new IndicatorType( "IndicatorTypeA", 100 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
+        IndicatorType typeC = new IndicatorType( "IndicatorTypeA", 100, false );
         
         int idA = indicatorTypeStore.save( typeA );
         int idB = indicatorTypeStore.save( typeB );
@@ -117,7 +117,7 @@
     public void testUpdateIndicatorType()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
         int idA = indicatorTypeStore.save( typeA );
         typeA = indicatorTypeStore.get( idA );
         assertEquals( typeA.getName(), "IndicatorTypeA" );
@@ -133,8 +133,8 @@
     public void testGetAndDeleteIndicatorType()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         int idA = indicatorTypeStore.save( typeA );
         int idB = indicatorTypeStore.save( typeB );
@@ -157,8 +157,8 @@
     public void testGetAllIndicatorTypes()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         indicatorTypeStore.save( typeA );
         indicatorTypeStore.save( typeB );
@@ -174,8 +174,8 @@
     public void testGetIndicatorTypeByName()
         throws Exception
     {
-        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100 );
-        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1 );
+        IndicatorType typeA = new IndicatorType( "IndicatorTypeA", 100, false );
+        IndicatorType typeB = new IndicatorType( "IndicatorTypeB", 1, false );
         
         int idA = indicatorTypeStore.save( typeA );
         int idB = indicatorTypeStore.save( typeB );
@@ -200,7 +200,7 @@
     public void testAddIndicator()
         throws Exception
     {        
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
         
         indicatorTypeStore.save( type );
         
@@ -233,7 +233,7 @@
     public void testUpdateIndicator()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         
@@ -253,7 +253,7 @@
     public void testGetAndDeleteIndicator()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         
@@ -283,7 +283,7 @@
     {
         String uuid = UUIdUtils.getUUId();
         
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
         indicatorTypeStore.save( type );
         
         Indicator indicatorA = createIndicator( 'A', type );
@@ -301,7 +301,7 @@
     public void testGetAllIndicators()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         
@@ -322,7 +322,7 @@
     public void testGetIndicatorByName()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         
@@ -347,7 +347,7 @@
     public void testGetIndicatorByAlternativeName()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         
@@ -372,7 +372,7 @@
     public void testGetIndicatorByShortName()
         throws Exception
     {
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         
@@ -401,7 +401,7 @@
         
         indicatorService.addIndicatorGroupSet( groupSetA );
         
-        IndicatorType type = new IndicatorType( "IndicatorType", 100 );
+        IndicatorType type = new IndicatorType( "IndicatorType", 100, false );
 
         indicatorTypeStore.save( type );
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/AddIndicatorTypeAction.java	2010-12-16 04:38:17 +0000
@@ -34,7 +34,8 @@
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: AddIndicatorTypeAction.java 3305 2007-05-14 18:55:52Z larshelg $
+ * @version $Id: AddIndicatorTypeAction.java 3305 2007-05-14 18:55:52Z larshelg
+ *          $
  */
 public class AddIndicatorTypeAction
     extends ActionSupport
@@ -49,7 +50,7 @@
     {
         this.indicatorService = indicatorService;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -68,14 +69,21 @@
         this.factor = factor;
     }
 
+    private Boolean number;
+
+    public void setNumber( Boolean number )
+    {
+        this.number = number;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        IndicatorType indicatorType = new IndicatorType( name, factor );
-        
+        IndicatorType indicatorType = new IndicatorType( name, factor, number );
+
         indicatorService.addIndicatorType( indicatorType );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/UpdateIndicatorTypeAction.java	2010-12-16 04:38:17 +0000
@@ -34,7 +34,8 @@
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: UpdateIndicatorTypeAction.java 3305 2007-05-14 18:55:52Z larshelg $
+ * @version $Id: UpdateIndicatorTypeAction.java 3305 2007-05-14 18:55:52Z
+ *          larshelg $
  */
 public class UpdateIndicatorTypeAction
     extends ActionSupport
@@ -49,7 +50,7 @@
     {
         this.indicatorService = indicatorService;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -75,6 +76,13 @@
         this.factor = factor;
     }
 
+    private Boolean number;
+
+    public void setNumber( Boolean number )
+    {
+        this.number = number;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -82,10 +90,11 @@
     public String execute()
     {
         IndicatorType indicatorType = indicatorService.getIndicatorType( id );
-        
+
         indicatorType.setName( name );
         indicatorType.setFactor( factor );
-        
+        indicatorType.setNumber( number );
+
         indicatorService.updateIndicatorType( indicatorType );
 
         return SUCCESS;

=== 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	2010-09-20 10:52:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm	2010-12-16 04:38:17 +0000
@@ -1,6 +1,15 @@
 <script>
 	jQuery(document).ready(	function(){
-		validation( 'addIndicatorForm', function( form ){ form.submit()} );	
+		validation( 'addIndicatorForm', 
+			function( form )
+			{ 
+				form.submit()
+			}, function(){
+				setFieldValue( 'denominator', "1" );
+				setFieldValue( 'denominatorDescription', "" );
+				setRadioValue( 'denominatorAggregationOperator', "sum" );
+			}
+		);	
 		checkValueIsExist( "name", "validateIndicator.action" );
 		checkValueIsExist( "shortName", "validateIndicator.action" );
 		checkValueIsExist( "alternativeName", "validateIndicator.action" );
@@ -58,9 +67,10 @@
 	<tr>
 		<td><label for="indicatorTypeId">$i18n.getString( "indicator_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select id="indicatorTypeId" name="indicatorTypeId" style="min-width:20em">				
+			<select id="indicatorTypeId" name="indicatorTypeId" style="min-width:20em" onchange='indicatorTypeChanged();'>				
+				<option value="">[ $i18n.getString('select') ]</option>
 			#foreach( $indicatorType in $indicatorTypes )
-				<option value="$indicatorType.id">$encoder.htmlEncode( $indicatorType.name )</option>
+				<option value="$indicatorType.id" number="$indicatorType.number">$encoder.htmlEncode( $indicatorType.name )</option>
 			#end
 			</select>
 		</td>
@@ -79,7 +89,7 @@
 	<tr>
 		<td></td>
 		<td>
-			<input type="button" value="$i18n.getString( 'edit_denominator' )" onclick="indicatorDenominatorForm()" style="width:20em"/>
+			<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}}"/>
 		</td>
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm	2010-09-20 10:52:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm	2010-12-16 04:38:17 +0000
@@ -25,6 +25,14 @@
 		<td><input type="text" id="factor" name="factor" style="width:20em" maxlength="10" class="{validate:{required:true,number:true,min:1}}"/></td>
 	</tr>
 	<tr>
+		<td><label for="number">$i18n.getString( "number" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><select id="number" name="number" style="width:20em" maxlength="10">
+				<option value='true'>$i18n.getString('yes')</option>
+				<option value='false' selected>$i18n.getString('no')</option>
+			</select>
+		</td>
+	</tr>
+	<tr>
 		<td></td>
 		<td><input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicatorType.action'" style="width:10em"/></td>
 	</tr>

=== 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	2010-11-27 07:46:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js	2010-12-16 04:38:17 +0000
@@ -1,3 +1,10 @@
+
+function indicatorTypeChanged()
+{
+	var type  = byId('indicatorTypeId').options[byId('indicatorTypeId').selectedIndex].getAttribute('number');
+	byId('denominatorButton').disabled = eval(type);
+}
+
 // -----------------------------------------------------------------------------
 // Change indicator group and data dictionary
 // -----------------------------------------------------------------------------

=== 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	2010-09-20 10:52:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm	2010-12-16 04:38:17 +0000
@@ -1,6 +1,13 @@
 <script>
 	jQuery(document).ready(	function(){
-		validation( 'updateIndicatorForm', function( form ){ form.submit()} );	
+		validation( 'updateIndicatorForm', 
+			function( form ){ form.submit()} , 
+			function()
+			{
+				setFieldValue( 'denominator', "1" );
+				setFieldValue( 'denominatorDescription', "" );
+				setRadioValue( 'denominatorAggregationOperator', "sum" );
+			});	
 		checkValueIsExist( "name", "validateIndicator.action", {id:getFieldValue('id')});
 		checkValueIsExist( "shortName", "validateIndicator.action" , {id:getFieldValue('id')});
 		checkValueIsExist( "alternativeName", "validateIndicator.action" , {id:getFieldValue('id')});
@@ -58,9 +65,9 @@
 	<tr>
 		<td><label for="indicatorTypeId">$i18n.getString( "indicator_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select id="indicatorTypeId" name="indicatorTypeId" style="min-width:20em">			
+			<select id="indicatorTypeId" name="indicatorTypeId" style="min-width:20em" onchange='indicatorTypeChanged();'>			
 			#foreach( $indicatorType in $indicatorTypes )
-				<option value="$indicatorType.id"#if( $indicator.indicatorType.id == $indicatorType.id ) selected="selected"#end>$encoder.htmlEncode( $indicatorType.name )</option>
+				<option value="$indicatorType.id" number="$indicatorType.number" #if( $indicator.indicatorType.id == $indicatorType.id ) selected="selected"#end>$encoder.htmlEncode( $indicatorType.name )</option>
 			#end
 			</select>
 		</td>
@@ -79,7 +86,7 @@
 	<tr>
 		<td></td>
 		<td>
-			<input type="button" value="$i18n.getString( 'edit_denominator' )" onclick="indicatorDenominatorForm()" style="width:20em"/>
+			<input type="button" 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" class="{validate:{required:true}}"/>
 		</td>
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm	2010-09-20 10:52:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm	2010-12-16 04:38:17 +0000
@@ -29,6 +29,14 @@
 		<td><input type="text" id="factor" name="factor" value="$indicatorType.factor" style="width:20em" maxlength="10" class="{validate:{required:true,number:true,min:1}}"/></td>
 	</tr>
 	<tr>
+		<td><label for="number">$i18n.getString( "number" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><select id="number" name="number" style="width:20em" maxlength="10">
+				<option value='true' #if($indicatorType.number=='true') selected #end>$i18n.getString('yes')</option>
+				<option value='false' #if($indicatorType.number=='false') selected #end>$i18n.getString('no')</option>
+			</select>
+		</td>
+	</tr>
+	<tr>
 		<td></td>
 		<td><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicatorType.action'" style="width:10em"/></td>
 	</tr>

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to