=== 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-08-27 12:58:08 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-08-27 14:03:43 +0000 @@ -81,8 +81,31 @@ $( "#ouwt_loader" ).hide(); } - - var version = localStorage[getTagId( "Version" )]; + + function update_required( remoteVersion, remoteRoots ) + { + var localVersion = localStorage[getTagId( "Version" )] ? localStorage[getTagId( "Version" )] : 0; + var localRoots = localStorage[getTagId( "Roots" )] ? localStorage[getTagId( "Roots" )] : []; + + if ( localVersion != remoteVersion ) + { + return true; + } + + localRoots.sort(); + remoteRoots.sort(); + + for ( var i in localRoots ) + { + if ( remoteRoots[i] == null || localRoots[i] != remoteRoots[i] ) + { + return true; + } + } + + return false; + } + var should_update = false; $.post( '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action', { @@ -92,11 +115,7 @@ if ( data.indexOf( "