dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20775
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9650: Fix bug to display username-data element in anonymous program entry form
------------------------------------------------------------
revno: 9650
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-01-29 21:45:08 +0700
message:
Fix bug to display username-data element in anonymous program entry form
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
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/patientreport/PatientAggregateReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java 2013-01-22 06:42:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java 2013-01-29 14:45:08 +0000
@@ -70,6 +70,9 @@
public static final int POSITION_ROW_DATA_COLUMN_ORGUNIT = 10; // PIVOT FROM
// 7
+ public static final String AGGREGATE_TYPE_SUM = "sum";
+ public static final String AGGREGATE_TYPE_AVG = "avg";
+
public static final String SEPARATE_FILTER = "_";
private ProgramStage programStage;
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-01-26 07:07:27 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-01-29 14:45:08 +0000
@@ -722,7 +722,7 @@
{
periodName = startDate + " -> " + endDate;
}
-
+
sql += " ( SELECT " + aggregateType + "(*) ";
sql += "FROM programstageinstance psi_1 ";
sql += " JOIN patientdatavalue pdv_1 ";
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-01-29 14:13:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-01-29 14:45:08 +0000
@@ -128,6 +128,10 @@
element.replaceWith( searchTextBox );
autocompletedFilterField( container + " [id=searchText]" , jQuery(this_).val() );
}
+ else if( valueType== 'username' )
+ {
+ autocompletedUsernameField(jQuery(this).attr('id'));
+ }
else{
element.replaceWith( searchTextBox );
}
@@ -195,6 +199,94 @@
});
}
+function autocompletedUsernameField( idField )
+{
+ var input = jQuery( "#" + idField );
+ input.parent().width( input.width() + 200 );
+ var dataElementId = input.attr('id').split('-')[1];
+
+ input.autocomplete({
+ delay: 0,
+ minLength: 0,
+ source: function( request, response ){
+ $.ajax({
+ url: "getUsernameList.action?query=" + input.val(),
+ dataType: "json",
+ cache: true,
+ success: function(data) {
+ response($.map(data.usernames, function(item) {
+ return {
+ label: item.u,
+ id: item.u
+ };
+ }));
+ }
+ });
+ },
+ minLength: 0,
+ select: function( event, ui ) {
+ var fieldValue = ui.item.value;
+
+ if ( !dhis2.trigger.invoke( "caseentry-value-selected", [dataElementId, fieldValue] ) ) {
+ input.val( "" );
+ return false;
+ }
+
+ input.val( fieldValue );
+ if ( !unSave ) {
+ saveVal( dataElementId );
+ }
+ input.autocomplete( "close" );
+ },
+ change: function( event, ui ) {
+ if ( !ui.item ) {
+ var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
+ valid = false;
+ if ( !valid ) {
+ $( this ).val( "" );
+ if(!unSave)
+ saveVal( dataElementId );
+ input.data( "autocomplete" ).term = "";
+ return false;
+ }
+ }
+ }
+ })
+ .addClass( "ui-widget" );
+
+ input.data( "autocomplete" )._renderItem = function( ul, item ) {
+ return $( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( "<a>" + item.label + "</a>" )
+ .appendTo( ul );
+ };
+
+ var wrapper = this.wrapper = $( "<span style='width:200px'>" )
+ .addClass( "ui-combobox" )
+ .insertAfter( input );
+
+ var button = $( "<a style='width:20px; margin-bottom:-5px;height:20px;'>" )
+ .attr( "tabIndex", -1 )
+ .attr( "title", i18n_show_all_items )
+ .appendTo( wrapper )
+ .button({
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ },
+ text: false
+ })
+ .addClass('small-button')
+ .click(function() {
+ if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
+ input.autocomplete( "close" );
+ return;
+ }
+ $( this ).blur();
+ input.autocomplete( "search", "" );
+ input.focus();
+ });
+}
+
function removeAllAttributeOption()
{
jQuery( '#advancedSearchTB tbody tr' ).each( function( i, item )
=== 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 2013-01-24 04:15:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-01-29 14:45:08 +0000
@@ -164,12 +164,12 @@
else if ( dataElementType == "username" )
{
var displayName = dataElementName;
- htmlCode = "<input type=\"checkbox\" title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" title=\"" + displayName + "\ username=\"true\" ">";
+ htmlCode = "<input title=\"" + titleValue + "\" value=\"[" + displayName + "]\" name=\"entryfield\" id=\"" + id + "\" username=\"true\" />";
}
else
{
var displayName = dataElementName;
- htmlCode += "<input title=\"" + titleValue + "\" value=\"[" + displayName + "]\" name=\"entryfield\" id=\"" + id + "\" />";
+ htmlCode = "<input title=\"" + titleValue + "\" value=\"[" + displayName + "]\" name=\"entryfield\" id=\"" + id + "\" />";
}
if( checkExisted( id ) )