← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7502: Add TrueOnly type for data element. Only save true value and isplayed in dataentry form as checkbox.

 

------------------------------------------------------------
revno: 7502
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-07-04 02:37:02 +0100
message:
  Add TrueOnly type for data element. Only save true value and isplayed in dataentry form as checkbox.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js


--
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/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2012-06-01 11:35:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2012-07-04 01:37:02 +0000
@@ -86,6 +86,8 @@
 
     public static final String VALUE_TYPE_NEGATIVE_INT = "negativeNumber";
 
+    public static final String VALUE_TYPE_TRUE_ONLY = "trueOnly";
+    
     public static final String VALUE_TYPE_BOOL = "bool";
 
     public static final String VALUE_TYPE_DATE = "date";

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-07-03 03:30:21 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-07-04 01:37:02 +0000
@@ -114,6 +114,9 @@
 
         result = populateCustomDataEntryForDate( result, dataValues, disabled, i18n, programStage,
             programStageInstance, mapDataValue );
+       
+        result = populateCustomDataEntryForTrueOnly( result, dataValues, disabled, i18n, programStage,
+            programStageInstance, mapDataValue );
 
         result = populateCustomDataEntryForBoolean( result, dataValues, disabled, i18n, programStage,
             programStageInstance, mapDataValue );
@@ -128,6 +131,8 @@
         String result = populateCustomDataEntryForDate( htmlCode );
 
         result = populateCustomDataEntryForBoolean( result );
+        
+        result = populateCustomDataEntryForTrueOnly( htmlCode );
 
         result = populateCustomDataEntryForTextBox( result );
 
@@ -266,6 +271,73 @@
 
         return (sb.toString().isEmpty()) ? htmlCode : sb.toString();
     }
+    
+    private String populateCustomDataEntryForTrueOnly( String htmlCode )
+    {
+        // ---------------------------------------------------------------------
+        // Metadata code to add to HTML before outputting
+        // ---------------------------------------------------------------------
+
+        StringBuffer sb = new StringBuffer();
+
+        // ---------------------------------------------------------------------
+        // Pattern to match data elements in the HTML code
+        // ---------------------------------------------------------------------
+
+        Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode );
+
+        // ---------------------------------------------------------------------
+        // Iterate through all matching data element fields
+        // ---------------------------------------------------------------------
+
+        while ( inputMatcher.find() )
+        {
+            String inputHTML = inputMatcher.group();
+            inputHTML = inputHTML.replace( ">", "" );
+
+            // -----------------------------------------------------------------
+            // Get HTML input field code
+            // -----------------------------------------------------------------
+
+            String dataElementCode = inputMatcher.group( 1 );
+
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
+
+            if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
+            {
+                // -------------------------------------------------------------
+                // Get data element ID of data element
+                // -------------------------------------------------------------
+
+                int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
+                DataElement dataElement = dataElementService.getDataElement( dataElementId );
+
+                if ( dataElement != null && !DataElement.VALUE_TYPE_TRUE_ONLY.equals( dataElement.getType() ) )
+                {
+                    continue;
+                }
+
+                String displayValue = (dataElement == null) ? " value=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" "
+                    : " value=\"[ " + dataElement.getName() + " ]\" ";
+                inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, displayValue )
+                    : inputHTML + " " + displayValue;
+
+                String displayTitle = (dataElement == null) ? " title=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" "
+                    : " title=\"" + dataElement.getId() + "." + dataElement.getName() + "-"
+                        + dataElement.getDetailedNumberType() + "\" ";
+                inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, displayTitle )
+                    : inputHTML + " " + displayTitle;
+
+                inputHTML = inputHTML + ">";
+
+                inputMatcher.appendReplacement( sb, inputHTML );
+            }
+        }
+
+        inputMatcher.appendTail( sb );
+
+        return (sb.toString().isEmpty()) ? htmlCode : sb.toString();
+    }
 
     private String populateCustomDataEntryForDate( String htmlCode )
     {
@@ -546,7 +618,213 @@
 
         return sb.toString();
     }
-
+    
+    private String populateCustomDataEntryForTrueOnly( String dataEntryFormCode,
+        Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
+        ProgramStageInstance programStageInstance, Map<Integer, Collection<PatientDataValue>> mapDataValue )
+    {
+        // ---------------------------------------------------------------------
+        // Inline Javascript to add to HTML before outputting
+        // ---------------------------------------------------------------------
+
+        final String jsCodeForInputs = " $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE'}\" onchange=\"saveVal( $DATAELEMENTID )\" onkeypress=\"return keyPress(event, this)\" style=\" text-align:center;\"  ";
+       
+        StringBuffer sb = new StringBuffer();
+
+        // ---------------------------------------------------------------------
+        // Pattern to match data elements in the HTML code
+        // ---------------------------------------------------------------------
+
+        Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
+        Matcher dataElementMatcher = INPUT_PATTERN.matcher( dataEntryFormCode );
+
+        // ---------------------------------------------------------------------
+        // Iterate through all matching data element fields
+        // ---------------------------------------------------------------------
+
+        Map<Integer, DataElement> dataElementMap = getDataElementMap( programStage );
+
+        while ( dataElementMatcher.find() )
+        {
+            // -----------------------------------------------------------------
+            // Get HTML input field code
+            // -----------------------------------------------------------------
+
+            String compulsory = "null";
+            boolean allowProvidedElsewhere = false;
+            String dataElementCode = dataElementMatcher.group( 1 );
+
+            Matcher identifierMatcher = IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
+
+            if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
+            {
+                // -------------------------------------------------------------
+                // Get data element ID of data element
+                // -------------------------------------------------------------
+
+                int programStageId = Integer.parseInt( identifierMatcher.group( 1 ) );
+
+                int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
+
+                DataElement dataElement = null;
+
+                String programStageName = programStage.getName();
+
+                if ( programStageId != programStage.getId() )
+                {
+                    dataElement = dataElementService.getDataElement( dataElementId );
+
+                    ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
+                    programStageName = otherProgramStage != null ? otherProgramStage.getName() : "N/A";
+                }
+                else
+                {
+                    dataElement = dataElementMap.get( dataElementId );
+                    if ( dataElement == null )
+                    {
+                        return i18n.getString( "some_data_element_not_exist" );
+                    }
+
+                    ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
+
+                    compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
+                    allowProvidedElsewhere = psde.getAllowProvidedElsewhere();
+                }
+
+                if ( dataElement == null )
+                {
+                    continue;
+                }
+
+                if ( !DataElement.VALUE_TYPE_TRUE_ONLY.equals( dataElement.getType() ) )
+                {
+                    continue;
+                }
+
+                // -------------------------------------------------------------
+                // Find type of data element
+                // -------------------------------------------------------------
+
+                String dataElementType = dataElement.getDetailedNumberType();
+
+                // -------------------------------------------------------------
+                // Find existing value of data element in data set
+                // -------------------------------------------------------------
+
+                PatientDataValue patientDataValue = null;
+
+                String dataElementValue = EMPTY;
+
+                if ( programStageId != programStage.getId() )
+                {
+                    Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
+
+                    if ( patientDataValues == null )
+                    {
+                        ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
+                        ProgramStageInstance otherProgramStageInstance = programStageInstanceService
+                            .getProgramStageInstance( programStageInstance.getProgramInstance(), otherProgramStage );
+                        patientDataValues = patientDataValueService.getPatientDataValues( otherProgramStageInstance );
+                        mapDataValue.put( programStageId, patientDataValues );
+                    }
+
+                    patientDataValue = getValue( patientDataValues, dataElementId );
+
+                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
+                }
+                else
+                {
+                    patientDataValue = getValue( dataValues, dataElementId );
+
+                    dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
+                }
+
+                // -------------------------------------------------------------
+                // Insert title information - Data element id, name, type, min,
+                // max
+                // -------------------------------------------------------------
+
+                if ( dataElementCode.contains( "title=\"\"" ) )
+                {
+                    dataElementCode = dataElementCode.replace( "title=\"\"", "title=\"" + dataElement.getId() + "."
+                        + dataElement.getName() + " (" + dataElementType + ")\" " );
+                }
+                else
+                {
+                    dataElementCode += "title=\"" + dataElement.getId() + "." + dataElement.getName() + " ("
+                        + dataElementType + ")\" ";
+                }
+
+                // -------------------------------------------------------------
+                // Insert value of data element in output code
+                // -------------------------------------------------------------
+
+                String appendCode = dataElementCode;
+                String checked = "";
+                
+                if(Boolean.getBoolean( dataElementValue))
+                {
+                    checked = "checked";
+                }
+
+                if ( appendCode.contains( "value=\"\"" ) )
+                {
+                    appendCode = appendCode.replace( "value=\"\"", checked );
+                }
+                else
+                {
+                    appendCode += "value=\"" + checked + "\"";
+                }
+
+                appendCode += jsCodeForInputs;
+
+                appendCode += " />";
+
+                // -----------------------------------------------------------
+                // Check if this dataElement is from another programStage then
+                // disable
+                // If programStagsInstance is completed then disabled it
+                // -----------------------------------------------------------
+
+                disabled = "";
+
+                if ( programStageId != programStage.getId() )
+                {
+                    disabled = "disabled=\"\"";
+                }
+
+                else if ( !programStageInstance.isCompleted() && allowProvidedElsewhere )
+                {
+                    // -----------------------------------------------------------
+                    // Add ProvidedByOtherFacility checkbox
+                    // -----------------------------------------------------------
+
+                    appendCode = addProvidedElsewherCheckbox( appendCode, patientDataValue, programStage );
+                }
+
+                // -----------------------------------------------------------
+                // 
+                // -----------------------------------------------------------
+
+                appendCode = appendCode.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
+                appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
+                appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
+                appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
+                appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
+                appendCode = appendCode.replace( "$DISABLED", disabled );
+                appendCode = appendCode.replace( "$COMPULSORY", compulsory );
+                appendCode = appendCode.replace( "$SAVEMODE", "false" );
+                appendCode = appendCode.replaceAll( "\\$", "\\\\\\$" );
+
+                dataElementMatcher.appendReplacement( sb, appendCode );
+            }
+        }
+
+        dataElementMatcher.appendTail( sb );
+
+        return sb.toString();
+    }
+    
     private String populateCustomDataEntryForTextBox( String dataEntryFormCode,
         Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
         ProgramStageInstance programStageInstance, Map<Integer, Collection<PatientDataValue>> mapDataValue )
@@ -615,7 +893,6 @@
                     }
 
                     ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
-
                     compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
                     allowProvidedElsewhere = psde.getAllowProvidedElsewhere();
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-07-03 03:30:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-07-04 01:37:02 +0000
@@ -73,7 +73,9 @@
 							<option value="">[$i18n.getString( "select_value" )]</option>
 							<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
 							<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
-						</select> 
+						</select>
+					#elseif( $programStageDataElement.dataElement.type == "trueOnly" )
+						<input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
 					#elseif( $programStageDataElement.dataElement.type == "date" )
 						<input name="entryfield" style='width: 250px;' type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
 						<script type="text/javascript">

=== 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	2012-07-03 04:12:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-07-04 01:37:02 +0000
@@ -224,6 +224,13 @@
     	
     }
     
+	var value = fieldValue;
+	if ( type == 'trueOnly' ){
+		if( field.checked ) 
+			fieldValue = "true";
+		else 
+			fieldValue="";
+	}
 	var valueSaver = new ValueSaver( dataElementId, fieldValue, type, SUCCESS_COLOR );
     valueSaver.save();
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-06-27 08:00:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-07-04 01:37:02 +0000
@@ -318,6 +318,7 @@
 yes_no=Yes/No
 bool=Yes/No
 none=None
+yes_only = Yes Only
 
 #-- User account --------------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm	2012-06-10 20:12:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm	2012-07-04 01:37:02 +0000
@@ -72,9 +72,10 @@
 		<td>
 			<select id="valueType" style="min-width:246px; margin: 0;"  onchange="changeValueType( this.value )">
 				<option value="int" selected="selected" onclick="enable('numberType');">$i18n.getString( "number" )</option>
-				<option value="string"onclick="disable('numberType');">$i18n.getString( "text" )</option>
-				<option value="bool"onclick="disable('numberType');">$i18n.getString( "yes_no" )</option>
-				<option value="date"onclick="disable('numberType');">$i18n.getString( "date" )</option>
+				<option value="string" onclick="disable('numberType');">$i18n.getString( "text" )</option>
+				<option value="bool" onclick="disable('numberType');">$i18n.getString( "yes_no" )</option>
+				<option value="trueOnly" onclick="disable('numberType');">$i18n.getString( "yes_only" )</option>
+				<option value="date" onclick="disable('numberType');">$i18n.getString( "date" )</option>
 			</select>
 			<input type="hidden" id="submitValueType" name="valueType"/>
 		</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm	2012-01-19 14:20:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm	2012-07-04 01:37:02 +0000
@@ -8,6 +8,7 @@
 	var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
 	var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
 	var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
+	var i18n_yes_only = '$encoder.jsEscape( $i18n.getString( "yes_only" ) , "'")';
 	var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
 	var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
 	var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js	2011-10-07 04:26:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js	2012-07-04 01:37:02 +0000
@@ -66,6 +66,7 @@
 		var typeMap = {
 			'int' : i18n_number,
 			'bool' : i18n_yes_no,
+			'trueOnly' : i18n_yes_only,
 			'string' : i18n_text,
 			'date' : i18n_date
 		};

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm	2012-06-10 20:12:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm	2012-07-04 01:37:02 +0000
@@ -84,6 +84,7 @@
 			<select id="valueType" name="valueType" style="min-width:246px; margin: 0;">
 				<option value="int" #if( $dataElement.type == 'int' ) selected="selected" #end  onclick="enable('numberType');">$i18n.getString( "number" )</option>
 				<option value="string" #if( $dataElement.type == 'string' ) selected="selected" #end  onclick="disable('numberType');">$i18n.getString( "text" )</option>
+				<option value="trueOnly" #if( $dataElement.type == 'trueOnly' ) selected="selected" #end  onclick="disable('numberType');">$i18n.getString( "yes_only" )</option>
 				<option value="bool" #if( $dataElement.type == 'bool' ) selected="selected" #end  onclick="disable('numberType');">$i18n.getString( "yes_no" )</option>
 				<option value="date" #if( $dataElement.type == 'date' ) selected="selected" #end  onclick="disable('numberType');">$i18n.getString( "date" )</option>
 			</select>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2012-03-13 09:47:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2012-07-04 01:37:02 +0000
@@ -156,6 +156,12 @@
 		var displayName = dataElementName;
 		htmlCode = "<input title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
 	} 
+	else if ( dataElementType == "trueOnly" )
+	{
+		var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
+		var displayName = dataElementName;
+		htmlCode = "<input type=\"checkbox\" title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" title=\"" + displayName + "\">";
+	} 
 	else if ( dataElementType == "date" )
 	{
 		var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";