=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2013-05-21 07:08:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2013-05-23 10:40:52 +0000
@@ -321,6 +321,10 @@
appendCode += "";
appendCode += "";
}
+ else if ( dataElement.getType().equals( DataElement.VALUE_TYPE_TRUE_ONLY ) )
+ {
+ appendCode += " name=\"entrytrueonly\" type=\"checkbox\" tabindex=\"" + i++ + "\"" + TAG_CLOSE;
+ }
else if ( dataElement.getOptionSet() != null )
{
appendCode += " name=\"entryoptionset\" tabindex=\"" + i++ + "\"" + TAG_CLOSE;
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2013-05-21 06:54:08 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2013-05-23 10:40:52 +0000
@@ -47,6 +47,8 @@
+ #elseif( $dataElement.type == 'trueOnly' )
+
|
#else
#if( $dataElement.optionSet )
|
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-05-21 06:03:05 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2013-05-23 10:40:52 +0000
@@ -238,6 +238,21 @@
valueSaver.save();
}
+function saveTrueOnly( dataElementId, optionComboId, fieldId )
+{
+ fieldId = '#' + fieldId;
+
+ var value = $( fieldId ).attr('checked');
+
+ $( fieldId ).css( 'background-color', COLOR_YELLOW );
+
+ var periodId = $( '#selectedPeriodId' ).val();
+
+ var valueSaver = new ValueSaver( dataElementId, optionComboId,
+ currentOrganisationUnitId, periodId, value, fieldId, COLOR_GREEN );
+ valueSaver.save();
+}
+
/**
* Supportive method.
*/
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-05-23 02:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-05-23 10:40:52 +0000
@@ -413,6 +413,28 @@
$( this ).css( 'width', '90%' );
} );
+ $( '[name="entrytrueonly"]' ).each( function( i )
+ {
+ var id = $( this ).attr( 'id' );
+ var split = splitFieldId( id );
+
+ var dataElementId = split.dataElementId;
+ var optionComboId = split.optionComboId;
+
+ $( this ).unbind( 'focus' );
+ $( this ).unbind( 'change' );
+
+ $( this ).focus( valueFocus );
+ $( this ).blur( valueBlur );
+
+ $( this ).change( function()
+ {
+ saveTrueOnly( dataElementId, optionComboId, id );
+ } );
+
+ $( this ).css( 'width', '90%' );
+ } );
+
$( '[name="entryoptionset"]' ).each( function( i )
{
var id = $( this ).attr( 'id' );
@@ -1101,12 +1123,14 @@
$( '[name="entryfield"]' ).val( '' );
$( '[name="entryselect"]' ).val( '' );
+ $( '[name="entrytrueonly"]' ).removeAttr('checked');
$( '[name="entryoptionset"]' ).val( '' );
$( '[name="dyninput"]' ).val( '' );
$( '[name="dynselect"]' ).val( '' );
$( '[name="entryfield"]' ).css( 'background-color', COLOR_WHITE );
$( '[name="entryselect"]' ).css( 'background-color', COLOR_WHITE );
+ $( '[name="entrytrueonly"]' ).css( 'background-color', COLOR_WHITE );
$( '[name="entryoptionset"]' ).css( 'background-color', COLOR_WHITE );
$( '[name="dyninput"]' ).css( 'background-color', COLOR_WHITE );
@@ -1159,8 +1183,12 @@
if ( $( fieldId ).length > 0 ) // Insert for fixed input fields
{
- $( fieldId ).val( value.val );
- }
+ if ( $( fieldId ).attr( 'name' ) == 'entrytrueonly' ) {
+ $( fieldId ).attr('checked', true);
+ } else {
+ $( fieldId ).val( value.val );
+ }
+ }
else // Insert for potential dynamic input fields
{
var split = splitFieldId( value.id );
@@ -1184,7 +1212,7 @@
}
var dynamicInputId = '#' + code + '-' + optionComboId + '-dyninput';
-
+
if ( $( dynamicInputId ).length == 0 )
{
log( 'Could not find find dynamic input element for option combo: ' + optionComboId );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm 2013-05-21 06:54:08 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multiOrgSectionForm.vm 2013-05-23 10:40:52 +0000
@@ -86,6 +86,8 @@
+ #elseif( $dataElement.type == 'trueOnly' )
+ |
#else
#if( $dataElement.optionSet )
|
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2013-05-21 06:54:08 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm 2013-05-23 10:40:52 +0000
@@ -66,6 +66,8 @@
+ #elseif( $dataElement.type == 'trueOnly' )
+ |
#else
#if( $dataElement.optionSet )
|