← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16309: Fixed bug related to option-set in dhis-web-caseentry.

 

------------------------------------------------------------
revno: 16309
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-08-04 22:58:47 +0700
message:
  Fixed bug related to option-set in dhis-web-caseentry.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptionSet.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.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-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm	2014-07-27 15:02:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm	2014-08-04 15:58:47 +0000
@@ -31,7 +31,7 @@
 				<select  id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default"  $mandatory )' >
 					 <option value="">[$i18n.getString( "please_select" )]</option>
 				#foreach ($option in $attribute.optionSet.options )
-					<option value="$option" #if($value==$option) selected #end >$option</option>
+					<option value="$option.code" #if($value=="$option.code") selected #end >$encoder.htmlEncode($option.name)</option>
 				#end
 				</select>
 			#elseif( $attribute.valueType == "users" )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm	2014-06-21 09:02:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm	2014-08-04 15:58:47 +0000
@@ -76,7 +76,7 @@
 							<td>
 							<input id='$id' class='$id' name="$id" type='radio' options='no' optionset='$programStageDataElement.dataElement.optionSet.uid'
 								data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
-								#if( $dataValue.value == $option) checked #end
+								#if( $dataValue.value == "$option.code") checked #end
 								onclick="saveRadio( '$programStageDataElement.dataElement.uid', '' )" tabindex="$tabIndex" />$i18n.getString("non_value")
 						</td>
 					#set($index=1)
@@ -88,8 +88,8 @@
 						<td>
 						<input id='$id' class='$id' name="$id" type='radio' options='no' optionset='$programStageDataElement.dataElement.optionSet.uid'
 							data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" 
-						#if( $dataValue.value == $option) checked #end value="$encoder.htmlEncode($option)"
-						onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$encoder.htmlEncode($option)
+						#if( $dataValue.value == "$option.code") checked #end value="$encoder.htmlEncode($option.name)"
+						onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option.code' )" tabindex="$tabIndex" />$encoder.htmlEncode($option.name)
 						</td>
 						#set($index=$index + 1)
 					#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2014-07-17 07:09:15 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2014-08-04 15:58:47 +0000
@@ -1031,8 +1031,8 @@
         success: function ( data ) {
             success( $.map( data.options, function ( item ) {
                 return {
-                    label: item.o,
-                    id: item.o
+                    label: item.n,
+                    id: item.c
                 };
             } ) );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptionSet.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptionSet.vm	2013-08-06 06:39:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptionSet.vm	2014-08-04 15:58:47 +0000
@@ -2,6 +2,6 @@
     "uid": "$encoder.jsonEncode( $optionSet.uid )",
     "name": "$encoder.jsonEncode( $optionSet.displayName )",
     "version": $optionSet.version,
-    "options": [#foreach( $option in $optionSet.options )"$encoder.jsonEncode( $option )"#if( $velocityCount < $optionSet.options.size() ),#end #end]
+    "options": [#foreach( $option in $optionSet.options )"$encoder.jsonEncode( $option.name )"#if( $velocityCount < $optionSet.options.size() ),#end #end]
    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm	2014-07-29 07:52:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonOptions.vm	2014-08-04 15:58:47 +0000
@@ -1,2 +1,2 @@
-{ "options": [#foreach( $option in $options ){"o":"$option.name"}#if( $velocityCount < $options.size() ),#end #end]
+{ "options": [#foreach( $option in $options ){"c":"$option.code","n":"$option.name"}#if( $velocityCount < $options.size() ),#end #end]
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2014-07-12 12:00:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2014-08-04 15:58:47 +0000
@@ -85,7 +85,7 @@
 									<select  id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$mandatory}}" >
 										 <option value="">[$i18n.getString( "please_select" )]</option>
 										#foreach ($option in $attribute.optionSet.options )
-											<option value="$option" #if($attributeValue == $option) selected="selected" #end>$option</option>
+											<option value="$option.code" #if($attributeValue == "$option.code") selected="selected" #end>$encoder.htmlEncode($option.name)</option>
 										#end
 									</select>
 								#elseif( $attribute.valueType == "users" )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm	2014-06-21 09:02:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm	2014-08-04 15:58:47 +0000
@@ -88,8 +88,8 @@
 												<td>
 													<input id='$id' name="$id" type='radio' options='no' optionset="$programStageDataElement.dataElement.optionSet.uid"
 														data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" 
-														#if( $dataValue.value == $option) checked #end
-														onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$i18n.getString("non_value")
+														#if( $dataValue.value == "$option.code") checked #end
+														onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option.code' )" tabindex="$tabIndex" />$i18n.getString("non_value")
 											</td>
 										#set($index=1)
 										#foreach($option in $programStageDataElement.dataElement.optionSet.options)
@@ -100,8 +100,8 @@
 											<td>
 											<input id='$id' name="$id" type='radio' options='no'
 											data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" 
-											#if( $dataValue.value == $option) checked #end
-											onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$encoder.htmlEncode($option)
+											#if( $dataValue.value == "$option.code") checked #end
+											onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option.code' )" tabindex="$tabIndex" />$encoder.htmlEncode($option.name)
 											</td>
 											#set($index=$index + 1)
 										#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2014-04-26 13:20:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleDataEntryForm.vm	2014-08-04 15:58:47 +0000
@@ -127,7 +127,7 @@
 															<td>
 													<input id='$id' class='$id' name="$id" options='no' type='radio' optionset='$programStageDataElement.dataElement.optionSet.uid'
 														data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
-														#if( $dataValue.value == $option) checked #end
+														#if( $dataValue.value == "$option.code") checked #end
 														onclick="saveRadio( '$programStageDataElement.dataElement.uid', '' )" tabindex="$tabIndex" />$i18n.getString("non_value")
 														</td>
 													#set($index=1)
@@ -139,8 +139,8 @@
 														<td>
 														<input id='$id' class='$id' name="$id" type='radio' options='no' optionset='$programStageDataElement.dataElement.optionSet.uid'
 															data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" 
-														#if( $dataValue.value == $option) checked #end value="$encoder.htmlEncode($option)"
-														onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$encoder.htmlEncode($option)
+														#if( $dataValue.value == "$option.code") checked #end value="$encoder.htmlEncode($option.name)"
+														onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option.code' )" tabindex="$tabIndex" />$encoder.htmlEncode($option.name)
 														</td>
 														#set($index=$index + 1)
 													#end
@@ -261,7 +261,7 @@
 							<td>
 					<input id='$id' class='$id' name="$id" options='no' type='radio' optionset='$programStageDataElement.dataElement.optionSet.uid'
 						data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }"
-						#if( $dataValue.value == $option) checked #end
+						#if( $dataValue.value == "$option.code") checked #end
 						onclick="saveRadio( '$programStageDataElement.dataElement.uid', '' )" tabindex="$tabIndex" />$i18n.getString("non_value")
 						</td>
 					#set($index=1)
@@ -273,8 +273,8 @@
 						<td>
 						<input id='$id' class='$id' name="$id" type='radio' options='no' optionset='$programStageDataElement.dataElement.optionSet.uid'
 							data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" 
-						#if( $dataValue.value == $option) checked #end value="$encoder.htmlEncode($option)"
-						onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option' )" tabindex="$tabIndex" />$encoder.htmlEncode($option)
+						#if( $dataValue.value == "$option.code") checked #end value="$encoder.htmlEncode($option.name)"
+						onclick="saveRadio( '$programStageDataElement.dataElement.uid', '$option.code' )" tabindex="$tabIndex" />$encoder.htmlEncode($option.name)
 						</td>
 						#set($index=$index + 1)
 					#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm	2014-06-21 09:56:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm	2014-08-04 15:58:47 +0000
@@ -72,7 +72,7 @@
 								 <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory }}" >
 										 <option value="">[$i18n.getString( "please_select" )]</option>
 										 #foreach ($option in $attribute.optionSet.options )
-												 <option value="$option" #if("$value"=="$option") selected #end>$option</option>
+												 <option value="$option.code" #if("$value"=="$option.code") selected #end>$encoder.htmlEncode($option.name)</option>
 										 #end
 								 </select>	
 							#elseif( $attribute.valueType == "users" )
@@ -139,7 +139,7 @@
 						<select  id="attr$attribute.id"  name="attr$attribute.id" inherit="$!attribute.inherit" class=' #validate( "default"  $mandatory  )' >
 							 <option value="">[$i18n.getString( "please_select" )]</option>
 						#foreach ($option in $attribute.optionSet.options )
-							<option value="$option" #if($attributeValue == $option) selected="selected" #end>$option</option>
+							<option value="$option.code" #if($attributeValue == "$option.code") selected="selected" #end>$encoder.htmlEncode($option.name)</option>
 						#end
 						</select>
 					#elseif( $attribute.valueType == "users" )