dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22655
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10954: support for yes-only dataelement type in aggregate reporting (rendered as checkbox)
------------------------------------------------------------
revno: 10954
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-23 17:40:52 +0700
message:
support for yes-only dataelement type in aggregate reporting (rendered as checkbox)
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java
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/javascript/entry.js
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/multiOrgSectionForm.vm
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.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-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 += "<option value=\"false\">" + i18n.getString( "no" ) + "</option>";
appendCode += "</select>";
}
+ 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 @@
<option value="false">$i18n.getString( "no" )</option>
</select>
<img name="commentlink" id="${commentId}"></td>
+ #elseif( $dataElement.type == 'trueOnly' )
+ <td><input name="entrytrueonly" id="${dataEntryId}" maxlength="255" type="checkbox"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex"></td>
#else
#if( $dataElement.optionSet )
<td><input name="entryoptionset" id="${dataEntryId}" maxlength="255" type="text"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex"></td>
=== 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 @@
<option value="true">$i18n.getString( "yes" )</option>
<option value="false">$i18n.getString( "no" )</option>
</select></td>
+ #elseif( $dataElement.type == 'trueOnly' )
+ <td><input name="entrytrueonly" id="$dataEntryId" type="checkbox" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
#else
#if( $dataElement.optionSet )
<td><input name="entryoptionset" id="$dataEntryId" type="text" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
=== 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 @@
<option value="true">$i18n.getString( "yes" )</option>
<option value="false">$i18n.getString( "no" )</option>
</select><img name="commentlink" id="${commentId}"></td>
+ #elseif( $dataElement.type == 'trueOnly' )
+ <td><input name="entrytrueonly" id="${dataEntryId}" type="checkbox" tabindex="${tabIndex}"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
#else
#if( $dataElement.optionSet )
<td><input name="entryoptionset" id="${dataEntryId}" type="text" tabindex="${tabIndex}"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>