← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1936: Bug fix in sections and associated data entry.

 

------------------------------------------------------------
revno: 1936
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-08-19 09:52:44 +0200
message:
  Bug fix in sections and associated data entry.
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/dataElement.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/dataElement.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/multiDimensionalDataElement.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionDataElement.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-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java	2010-07-21 10:31:21 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java	2010-08-19 07:52:44 +0000
@@ -322,6 +322,14 @@
     {
         this.displayMode = displayMode;
     }
+    
+    private Integer defaultOptionComboId;
+    
+    public Integer getDefaultOptionComboId() 
+    {
+		return defaultOptionComboId;
+	}	
+
 
     // -------------------------------------------------------------------------
     // Action implementation
@@ -399,6 +407,8 @@
                     true );
             }
         }
+        
+        defaultOptionComboId = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
 
         for ( DataElementCategoryCombo categoryCombo : orderedCategoryCombos )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/dataElement.vm	2009-11-07 14:09:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/dataElement.vm	2010-08-19 07:52:44 +0000
@@ -90,7 +90,7 @@
                     #end  
                         #if($coun>0)   
                             <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean($dataElement.id,$optionComboId, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end>
-                            <option value="" </option>                
+                            <option value="">[$i18n.getString( "please_select" )] </option>               
                                 #foreach($customValue in $customValues)
                                     #if($dataElement.id == $customValue.dataElement.id && $dataValue.optionCombo.id == $customValue.optionCombo.id)
                                 <option value="$customValue.customValue" #if( $dataValue.value == $customValue.customValue ) selected="selected" #end>$customValue.customValue</option>   

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/dataElement.vm	2010-08-05 12:30:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/dataElement.vm	2010-08-19 07:52:44 +0000
@@ -31,14 +31,15 @@
 		#set( $mark = 0 )
 	#else
 		#set( $mark = 1 )
-	#end
-	#set( $optionComboId = 1 )   
+	#end	
+	
+	#set( $optionComboId = $defaultOptionComboId )
 	#set( $dataValue = false )	
-	#set( $dataValue = $dataValueMap.get( "$dataElement.id:$optionComboId" ) )
+	#set( $dataValue = $dataValueMap.get( "$dataElement.id:$defaultOptionComboId" ) )
 	#set( $calculatedValue = false )
 	#set( $calculatedValue = $calculatedValueMap.get( $dataElement ) )
 	#set( $minMax = false )
-	#set( $minMax = $minMaxMap.get( "$dataElement.id:$optionComboId" ) )
+	#set( $minMax = $minMaxMap.get( "$dataElement.id:$defaultOptionComboId" ) )
 	#set( $calculated = false )
 	#set( $calculated = ($calculatedDataElementIds.contains($dataElement.id)) )
 	<tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
@@ -68,7 +69,7 @@
 		##min value
 		<td>
 		#if( $dataElement.type == "int" )
-			<div id="value[$dataElement.id:$optionComboId].min" style="text-align:center">$!minMax.min</div>
+			<div id="value[$dataElement.id:$defaultOptionComboId].min" style="text-align:center">$!minMax.min</div>
 		#end
 		</td>
 		
@@ -76,12 +77,12 @@
 		<td>
 		      
 		    #set( $greyedField = "false" )		         
-            #set( $greyedField = $greyedFields.get( "$dataElement.id:$optionComboId" ) )  	
+            #set( $greyedField = $greyedFields.get( "$dataElement.id:$defaultOptionComboId" ) )  	
 		   
-		    #set( $dataEntryId = "value[$dataElement.id].value:value[$optionComboId].value" )
+		    #set( $dataEntryId = "value[$dataElement.id].value:value[$defaultOptionComboId].value" )
 		    ##Data Entry
 			#if( $dataElement.type == "bool" )
-			 <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean( $dataElement.id, $optionComboId, this )" #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $greyedField == "true" ) disabled="disabled"#end>
+			 <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean( $dataElement.id, $defaultOptionComboId, this )" #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $greyedField == "true" ) disabled="disabled"#end>
 				<option value="">[$i18n.getString( "no_value" )]</option>
 				<option value="true" #if( $datavalue && $dataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
 				<option value="false" #if( $datavalue && $dataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
@@ -107,8 +108,8 @@
                         #end
                     #end  
                         #if($coun>0)   
-                            <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean( $dataElement.id, $optionComboId, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end #if( $greyedField == "true" ) disabled="disabled"#end>
-                            <option value="" </option>                
+                            <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean( $dataElement.id, $defaultOptionComboId, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end #if( $greyedField == "true" ) disabled="disabled"#end>
+                            <option value="">[$i18n.getString( "please_select" )] </option>                
                                 #foreach($customValue in $customValues)
                                     #if($dataElement.id == $customValue.dataElement.id && $dataValue.optionCombo.id == $customValue.optionCombo.id)
                                 <option value="$customValue.customValue" #if( $dataValue.value == $customValue.customValue ) selected="selected" #end>$customValue.customValue</option>   
@@ -117,7 +118,7 @@
                             </select>
                         #else
                         #set( $zeroValueSaveMode = true )
-                               <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, $optionComboId, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionComboId, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end #if( $greyedField == "true" ) disabled="disabled"#end>                                
+                               <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, $defaultOptionComboId, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $defaultOptionComboId, true  )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end #if( $greyedField == "true" ) disabled="disabled"#end>                                
                         #end    
                 #end           
 
@@ -131,7 +132,7 @@
 			     <input name="entryfield" id="$dataEntryId" class="calculated" type="text" value="#if($dataValue) $!encoder.htmlEncode( $dataValue.value ) #elseif( $calculatedValue )$!encoder.htmlEncode( $calculatedValue ) #end" disabled="disabled" onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" #if( $greyedField == "true" ) disabled="disabled"#end>
 			    #else 
                     #if ( $dataElement.type != "string")
-			         <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, $optionComboId, '$encoder.jsEncode( $dataElement.name )' )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $greyedField == "true" ) disabled="disabled"#end>
+			         <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, $defaultOptionComboId, '$encoder.jsEncode( $dataElement.name )' )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $greyedField == "true" ) disabled="disabled"#end>
                     #end
                 #end
 		  #end
@@ -140,7 +141,7 @@
 		##max value
 		<td>
 		#if( $dataElement.type == "int" )
-			<div id="value[$dataElement.id:$optionComboId].max" style="text-align:center">$!minMax.max</div>
+			<div id="value[$dataElement.id:$defaultOptionComboId].max" style="text-align:center">$!minMax.max</div>
 		#end
 		</td>
 		

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/multiDimensionalDataElement.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/multiDimensionalDataElement.vm	2010-08-05 12:30:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/section/multiDimensionalDataElement.vm	2010-08-19 07:52:44 +0000
@@ -89,7 +89,7 @@
                             #end  
                             #if($coun>0)   
                                 <select name="entryselect" id="$dataEntryId" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean($dataElement.id,$optionCombo.id, this )"  #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end #if( $greyedField == "true" ) disabled="disabled"#end>
-                                    <option value="" </option>                
+                                    <option value="">[$i18n.getString( "please_select" )] </option>                
                                     #foreach($customValue in $customValues)
                                         #if($dataElement.id == $customValue.dataElement.id && $optionCombo.id == $customValue.optionCombo.id)
                                             <option value="$customValue.customValue" #if( $dataValue.value == $customValue.customValue ) selected="selected" #end>$customValue.customValue</option>   

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java	2010-07-07 10:56:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GreySectionAction.java	2010-08-19 07:52:44 +0000
@@ -154,12 +154,19 @@
     {
         return greyedFields;
     }
+    
+    private Integer defaultOptionComboId;
+    
+    public Integer getDefaultOptionComboId() 
+    {
+		return defaultOptionComboId;
+	}	
 
     // -------------------------------------------------------------------------
     // Action implementation
-    // -------------------------------------------------------------------------
+    // -------------------------------------------------------------------------    
 
-    public String execute()
+	public String execute()
         throws Exception
     {
         section = sectionService.getSection( sectionId.intValue() );
@@ -210,6 +217,11 @@
                 }
             }
         }       
+        
+        else
+        {
+        	defaultOptionComboId = categoryService.getDefaultDataElementCategoryOptionCombo().getId();
+        }       
 
         for ( DataElementOperand operand : section.getGreyedFields() )
         {            

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionDataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionDataElement.vm	2010-07-12 15:24:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionDataElement.vm	2010-08-19 07:52:44 +0000
@@ -35,11 +35,10 @@
            </td>
            
            ##entry
-           <td style="text-align:center">
-           	
-           	#set( $optionComboId = 1 )   
+           <td style="text-align:center"> 	
+           	  
            	#set( $greyedField = "false" )       	
-           	#set( $greyedField = $greyedFields.get( "$dataElement.id:$optionComboId" ) )  
+           	#set( $greyedField = $greyedFields.get( "$dataElement.id:$defaultOptionComboId" ) )  
            	         	           	
            	#if( $greyedField == "true" )           		           	            	
            		<input name="entryfieldTxt" id="[$dataElement.id].txt" type="text" disabled="disabled">