=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2011-03-17 20:59:33 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2011-04-11 16:43:51 +0000 @@ -288,8 +288,7 @@ final String sqlUpdateFalse = "UPDATE organisationunit SET hasPatients=false WHERE organisationunitid not in ( " + ids +" );"; jdbcTemplate.execute( sqlUpdateFalse ); - } - + } @SuppressWarnings("unchecked") public Collection get( Boolean hasPatients ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2011-03-31 01:49:21 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2011-04-11 16:43:51 +0000 @@ -8,20 +8,17 @@ { var url = 'loadPeriods.action?dataSetId=' + dataSetId; - var listStartPeriod = document.getElementById( 'sDateLB' ); - var listEndPeriod = document.getElementById( 'eDateLB' ); - - clearList( listStartPeriod ); - clearList( listEndPeriod ); + clearListById( 'sDateLB' ); + clearListById( 'eDateLB' ); - addOptionToList( listStartPeriod, '', '[' + i18n_please_select + ']' ); - addOptionToList( listEndPeriod, '', '[' + i18n_please_select + ']' ); + addOptionById( 'sDateLB', '', '[' + i18n_please_select + ']' ); + addOptionById( 'eDateLB', '', '[' + i18n_please_select + ']' ); $.getJSON( url, function( json ) { for ( i in json.periods ) { - addOptionToList( listStartPeriod, i, json.periods[i].name ); - addOptionToList( listEndPeriod, i, json.periods[i].name ); + addOptionById( 'sDateLB', i, json.periods[i].name ); + addOptionById( 'eDateLB', i, json.periods[i].name ); } enable('previousPeriodForStartBtn'); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-04-11 09:51:38 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-04-11 16:43:51 +0000 @@ -454,9 +454,12 @@ function getRadioValue( radioName ) { result = null; - jQuery.each( jQuery( "input[type=radio][name=" + radioName + "]") , function(i, item ){ - - if( item.checked ) result = item.value; + jQuery.each( jQuery( "input[type=radio][name=" + radioName + "]") , function( i, item ) + { + if ( item.checked ) + { + result = item.value; + } }); return result; @@ -470,9 +473,12 @@ */ function setRadioValue( radioName, value ) { - jQuery.each( jQuery( "input[type=radio][name=" + radioName + "]") , function(i, item ){ - - if( item.value == value ) item.checked = true; + jQuery.each( jQuery( "input[type=radio][name=" + radioName + "]") , function( i, item ) + { + if ( item.value == value ) + { + item.checked = true; + } }); } @@ -686,7 +692,7 @@ { var node = byId( id ); - if ( ! node ) + if ( !node ) { return; } @@ -704,7 +710,7 @@ { var node = byId( id ); - if ( ! node ) + if ( !node ) { return; } @@ -715,21 +721,6 @@ } /** - * Toggles visibility of document element. - */ -function showHideDiv( elementId ) -{ - if ( document.getElementById( elementId ).style.display == "none" ) - { - document.getElementById( elementId ).style.display = "block"; - } - else - { - document.getElementById( elementId ).style.display = "none"; - } -} - -/** * Returns a query string with all element values in the select list and the * specified param. */ @@ -747,14 +738,7 @@ } /** - * Creates an option and adds it to the list. - * - * @param list - * the list. - * @param optionValue - * the option value. - * @param optionText - * the option text. + * @deprecated Use addOptionById */ function addOptionToList( list, optionValue, optionText ) { @@ -916,8 +900,7 @@ buttonImageOnly: true, constrainInput: true, yearRange: '-100:+100' - }); - + }); } /** @@ -943,9 +926,13 @@ yearRange: '-100:+100' }); - if( today == undefined ) today = false; + if ( today == undefined ) + { + today = false; + } - if( today ){ + if( today ) + { s = jQuery("#" + id ); if( s.val()=='' ) s.val( getCurrentDate() ); } @@ -1054,8 +1041,7 @@ } // MOZILLA/NETSCAPE support else if ( inputArea.selectionStart || inputArea.selectionStart == '0' ) - { - + { var startPos = inputArea.selectionStart; var endPos = inputArea.selectionEnd; === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js 2011-03-28 13:52:32 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js 2011-04-11 16:43:51 +0000 @@ -159,11 +159,7 @@ } /** - * Adds an option to a select list. - * - * @param listId the id of the list. - * @param text the text of the option. - * @param value the value of the option. + * @deprecated Use addOptionById */ function addOption( listId, text, value ) { var list = document.getElementById( listId ); @@ -172,6 +168,18 @@ } /** + * Adds an option to the list. + * + * @param listId the id of the select list + * @param optionValue the value of option + * @param optionText the text of the option + */ +function addOptionById( listId, optionValue, optionText ) +{ + $( '#' + listId ).append( '' ); +} + +/** * Removes the selected option from a select list. * @param listId the id of the list. */ === 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 2011-04-11 08:11:01 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-04-11 16:43:51 +0000 @@ -41,18 +41,16 @@ var url = 'loadDataSets.action'; - var list = document.getElementById( 'selectedDataSetId' ); - - clearList( list ); + clearListById( 'selectedDataSetId' ); $.getJSON( url, function( json ) { $( '#selectedOrganisationUnit' ).val( json.organisationUnit.name ); $( '#currentOrganisationUnit' ).html( json.organisationUnit.name ); - addOptionToList( list, '-1', '[ ' + i18n_select_data_set + ' ]' ); + addOptionById( 'selectedDataSetId', '-1', '[ ' + i18n_select_data_set + ' ]' ); for ( i in json.dataSets ) { - addOptionToList( list, json.dataSets[i].id, json.dataSets[i].name ); + addOptionById( 'selectedDataSetId', json.dataSets[i].id, json.dataSets[i].name ); } if ( json.dataSetValid && dataSetId != null ) { @@ -91,15 +89,13 @@ var url = 'loadNextPreviousPeriods.action?next=' + next + '&previous=' + previous; - var list = document.getElementById( 'selectedPeriodIndex' ); - - clearList( list ); + clearListById( 'selectedPeriodIndex' ); $.getJSON( url, function( json ) { - addOptionToList( list, '-1', '[ ' + i18n_select_period + ' ]' ); + addOptionById( 'selectedPeriodIndex', '-1', '[ ' + i18n_select_period + ' ]' ); for ( i in json.periods ) { - addOptionToList( list, i, json.periods[i].name ); + addOptionById( 'selectedPeriodIndex', i, json.periods[i].name ); } enableNextPrevButtons(); @@ -135,17 +131,15 @@ { var url = 'loadPeriods.action?dataSetId=' + dataSetId; - var list = document.getElementById( 'selectedPeriodIndex' ); - - clearList( list ); + clearListById( 'selectedPeriodIndex' ); $.getJSON( url, function( json ) { significantZeros = json.significantZeros; - addOptionToList( list, '-1', '[ ' + i18n_select_period + ' ]' ); + addOptionById( 'selectedPeriodIndex', '-1', '[ ' + i18n_select_period + ' ]' ); for ( i in json.periods ) { - addOptionToList( list, i, json.periods[i].name ); + addOptionById( 'selectedPeriodIndex', i, json.periods[i].name ); } if ( json.periodValid && periodIndex != null ) { === modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/detailedExport.js' --- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/detailedExport.js 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/detailedExport.js 2011-04-11 16:43:51 +0000 @@ -16,15 +16,13 @@ }, function( json ) { - var list = document.getElementById( "availableDataElements" ); - - clearList( list ); + clearListById( "availableDataElements" ); var objects = json.dataElements; for ( var i=0; i