=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance' (properties changed: +x to -x) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-03-16 07:50:14 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-03-21 05:07:15 +0000 @@ -252,4 +252,5 @@ aggregation_query_builder=Aggregation Query Builder patient_org_unit_registration=Beneficiary Org Unit Registration dataset= Dataset -filter_by_data_set = Filter by dataset \ No newline at end of file +filter_by_data_set = Filter by dataset +show_all_item = Show All Items \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-03-16 07:50:14 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-03-21 05:07:15 +0000 @@ -667,6 +667,7 @@ /main.vm /dhis-web-maintenance-patient/addCaseAggregation.vm javascript/commons.js,javascript/caseaggregation.js + style/basic.css /main.vm /dhis-web-maintenance-patient/updateCaseAggregation.vm javascript/commons.js,javascript/caseaggregation.js + style/basic.css - + - #foreach( $dataSet in $dataSets) @@ -33,8 +33,10 @@ - + + @@ -73,7 +75,7 @@ - #foreach( $program in $programs ) @@ -89,7 +91,7 @@ - @@ -100,7 +102,7 @@ - + @@ -268,9 +270,9 @@ - - - + + + @@ -284,4 +286,5 @@ var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )'; var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )'; + var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_item" ) , "'" )'; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2012-03-19 07:56:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2012-03-21 05:07:15 +0000 @@ -7,8 +7,10 @@ { var dataSets = document.getElementById( 'dataSets' ); var dataSetId = dataSets.options[ dataSets.selectedIndex ].value; + clearList( byId('aggregationDataElementId')); + if( dataSetId == "" ){ - clearList( byId('aggregationDataElementId')); + disabled( 'dataElementsButton' ); return; } @@ -17,7 +19,7 @@ id:dataSetId }, function( json ) { - var de = document.getElementById( 'aggregationDataElementId' ); + var de = byId( 'aggregationDataElementId' ); clearList( de ); for ( i in json.dataElements ) @@ -32,6 +34,92 @@ de.add(option, null); } + + autoCompletedField( '' ); + }); +} + +function autoCompletedField( id ) +{ + var select = jQuery( "#aggregationDataElementId" ); + $( "#dataElementsButton" ).unbind('click'); + enable( 'dataElementsButton' ); + hideById( id ); + + var input = jQuery( "#aggregationDataElementInput" ) + .insertAfter( select ) + .val( "" ) + .autocomplete({ + delay: 0, + minLength: 0, + source: function( request, response ) { + var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); + response( select.children( "option" ).map(function() { + var text = $( this ).text(); + if ( this.value && ( !request.term || matcher.test(text) ) ) + return { + label: text, + value: text, + option: this + }; + }) ); + }, + select: function( event, ui ) { + ui.item.option.selected = true; + }, + change: function( event, ui ) { + if ( !ui.item ) { + var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ), + valid = false; + select.children( "option" ).each(function() { + if ( $( this ).text().match( matcher ) ) { + this.selected = valid = true; + return false; + } + }); + if ( !valid ) { + // remove invalid value, as it didn't match anything + $( this ).val( "" ); + select.val( "" ); + input.data( "autocomplete" ).term = ""; + return false; + } + } + } + }) + .addClass( "ui-widget ui-widget-content ui-corner-left" ); + + input.data( "autocomplete" )._renderItem = function( ul, item ) { + return $( "
  • " ) + .data( "item.autocomplete", item ) + .append( "" + item.label + "" ) + .appendTo( ul ); + }; + + showById('dataElementsButton'); + var button = $( "#dataElementsButton" ) + .attr( "title", i18n_show_all_items ) + .button({ + icons: { + primary: "ui-icon-triangle-1-s" + }, + text: false + }) + .removeClass( "ui-corner-all" ) + .addClass( "ui-corner-right ui-button-icon" ) + .click(function() { + // close if already visible + if ( input.autocomplete( "widget" ).is( ":visible" ) ) { + input.autocomplete( "close" ); + return; + } + + // work around a bug (likely same cause as #5265) + $( this ).blur(); + + // pass empty string as value to search for, displaying all results + input.autocomplete( "search", "" ); + input.focus(); }); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css 2012-03-15 09:28:38 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css 2012-03-21 05:07:15 +0000 @@ -74,4 +74,17 @@ .dataElementDiv table { width:100%; +} + +.small-button { + font-size: .8em !important; +} + +.ui-autocomplete { height: 100px; overflow-y: scroll; overflow-x: hidden; } + + +input.autocompleted-field +{ + width:25em; + text-align:center; } \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2012-03-19 09:35:42 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2012-03-21 05:07:15 +0000 @@ -16,13 +16,13 @@ - + - #foreach( $dataSet in $dataSets) @@ -34,9 +34,10 @@ - + @@ -75,7 +76,7 @@ - #foreach( $program in $programs ) @@ -91,7 +92,7 @@ - @@ -102,7 +103,7 @@ - + @@ -195,7 +196,7 @@
    - #foreach( $program in $programs ) @@ -270,9 +271,9 @@
    - - - + + +
    @@ -288,4 +289,5 @@ var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )'; var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )'; + var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_item" ) , "'" )';