=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Pager.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Pager.java 2011-12-19 22:11:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Pager.java 2011-12-20 08:33:04 +0000 @@ -92,12 +92,22 @@ return total; } + /** + * How many items per page. + * + * @return Number of items per page. + */ @JsonProperty public int getPageSize() { return pageSize; } + /** + * How many pages in total + * + * @return Total number of pages + */ @JsonProperty public int getPageCount() { @@ -113,6 +123,11 @@ return pageCount; } + /** + * Return the current offset to start at. + * + * @return Offset to start at + */ public int getOffset() { return (page * pageSize) - pageSize; === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-12-19 10:08:19 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-12-20 08:33:04 +0000 @@ -20,7 +20,7 @@ var selection = new Selection(); var subtree = new Subtree(); -$( document ).ready( function() +$( document ).ready( function () { selection.load(); } ); @@ -37,40 +37,40 @@ var rootUnselectAllowed = false; var autoSelectRoot = true; - this.setListenerFunction = function( listenerFunction_, skipInitialCall ) + this.setListenerFunction = function ( listenerFunction_, skipInitialCall ) { listenerFunction = listenerFunction_; if ( !skipInitialCall ) { - $( "#orgUnitTree" ).one( "ouwtLoaded", function() + $( "#orgUnitTree" ).one( "ouwtLoaded", function () { selection.responseReceived(); } ); } }; - this.setMultipleSelectionAllowed = function( allowed ) + this.setMultipleSelectionAllowed = function ( allowed ) { multipleSelectionAllowed = allowed; }; - this.setUnselectAllowed = function( allowed ) + this.setUnselectAllowed = function ( allowed ) { unselectAllowed = allowed; }; - this.setRootUnselectAllowed = function( allowed ) + this.setRootUnselectAllowed = function ( allowed ) { rootUnselectAllowed = allowed; }; - this.setAutoSelectRoot = function( autoSelect ) + this.setAutoSelectRoot = function ( autoSelect ) { autoSelectRoot = autoSelect; }; - this.load = function() + this.load = function () { function sync_and_reload() { @@ -78,7 +78,7 @@ if ( sessionStorage[getTagId( "Selected" )] == null && roots.length > 0 ) { - if( autoSelectRoot ) + if ( autoSelectRoot ) { if ( multipleSelectionAllowed ) { @@ -126,46 +126,47 @@ var should_update = false; $.post( '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action', { - "versionOnly" : true - }, function( data, textStatus, jqXHR ) - { - if ( data.indexOf( " a" ).addClass( "selected" ); }; - expandTreeAtOrgUnits = function( ous ) + expandTreeAtOrgUnits = function ( ous ) { - $.each( ous, function( i, item ) + $.each( ous, function ( i, item ) { expandTreeAtOrgUnit( item ); } ); }; - expandTreeAtOrgUnit = function( ou ) + expandTreeAtOrgUnit = function ( ou ) { if ( organisationUnits[ou] == null ) { @@ -560,14 +576,14 @@ $rootsTag.append( createTreeElementTag( expand ) ); } - $.each( array, function( i, item ) + $.each( array, function ( i, item ) { var expand = organisationUnits[item]; processExpand( expand ); } ); }; - this.reloadTree = function() + this.reloadTree = function () { var $treeTag = $( "#orgUnitTree" ); $treeTag.children().eq( 0 ).remove(); @@ -586,7 +602,7 @@ }; // force reload - this.refreshTree = function() + this.refreshTree = function () { localStorage.removeItem( getTagId( "Version" ) ); selection.load(); @@ -599,6 +615,7 @@ setVisible( child, false ); setToggle( $parentTag, false ); } + ; function processExpand( parent ) @@ -616,13 +633,14 @@ setToggle( $parentTag, true ); } } + ; function createChildren( parentTag, parent ) { var $childrenTag = $( "