← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7450: wip, implemented partial offline loading of OU tree (ouwt). Does _not_ currently support online l...

 

------------------------------------------------------------
revno: 7450
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-28 12:21:53 +0300
message:
  wip, implemented partial offline loading of OU tree (ouwt). Does _not_ currently support online loading of children, so only partial tree will be shown, with no posibility to expand to its online children.
removed:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/FunctionUtils.java
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitByLevelComparator.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CollectionUtils.java
modified:
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm


--
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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitByLevelComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitByLevelComparator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitByLevelComparator.java	2012-06-28 09:21:53 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.organisationunit.comparator;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+import java.util.Comparator;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class OrganisationUnitByLevelComparator
+    implements Comparator<OrganisationUnit>
+{
+    @Override
+    public int compare( OrganisationUnit o1, OrganisationUnit o2 )
+    {
+        return o1.getLevel() - o2.getLevel();
+    }
+}

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2012-06-27 05:24:21 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2012-06-28 09:21:53 +0000
@@ -45,11 +45,10 @@
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.importexport.ImportStrategy;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.system.util.FunctionUtils;
+import org.hisp.dhis.system.util.CollectionUtils;
 import org.hisp.dhis.system.util.ReflectionUtils;
 import org.hisp.dhis.system.util.functional.Function1;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -243,7 +242,7 @@
         {
             if ( attributeValues.size() > 0 )
             {
-                FunctionUtils.forEach( attributeValues, new Function1<AttributeValue>()
+                CollectionUtils.forEach( attributeValues, new Function1<AttributeValue>()
                 {
                     @Override
                     public void apply( AttributeValue attributeValue )
@@ -284,7 +283,7 @@
         {
             Set<DataElementOperand> dataElementOperands = extractDataElementOperands( object, fieldName );
 
-            FunctionUtils.forEach( dataElementOperands, new Function1<DataElementOperand>()
+            CollectionUtils.forEach( dataElementOperands, new Function1<DataElementOperand>()
             {
                 @Override
                 public void apply( DataElementOperand dataElementOperand )
@@ -300,7 +299,7 @@
             {
                 Set<AttributeValue> attributeValues = extractAttributeValues( object );
 
-                FunctionUtils.forEach( attributeValues, new Function1<AttributeValue>()
+                CollectionUtils.forEach( attributeValues, new Function1<AttributeValue>()
                 {
                     @Override
                     public void apply( AttributeValue attributeValue )
@@ -624,7 +623,7 @@
         final Map<Field, Object> fieldMap = new HashMap<Field, Object>();
         final Collection<Field> fieldCollection = ReflectionUtils.collectFields( object.getClass(), idObjects );
 
-        FunctionUtils.forEach( fieldCollection, new Function1<Field>()
+        CollectionUtils.forEach( fieldCollection, new Function1<Field>()
         {
             @Override
             public void apply( Field field )
@@ -669,7 +668,7 @@
         final Map<Field, Collection<Object>> collectionFields = new HashMap<Field, Collection<Object>>();
         final Collection<Field> fieldCollection = ReflectionUtils.collectFields( object.getClass(), idObjectCollectionsWithScanned );
 
-        FunctionUtils.forEach( fieldCollection, new Function1<Field>()
+        CollectionUtils.forEach( fieldCollection, new Function1<Field>()
         {
             @Override
             public void apply( Field field )
@@ -695,7 +694,7 @@
             Collection<Object> collection = collectionFields.get( field );
             final Collection<Object> objects = ReflectionUtils.newCollectionInstance( field.getType() );
 
-            FunctionUtils.forEach( collection, new Function1<Object>()
+            CollectionUtils.forEach( collection, new Function1<Object>()
             {
                 @Override
                 public void apply( Object object )

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java	2012-06-27 05:24:21 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/OrganisationUnitUtils.java	2012-06-28 09:21:53 +0000
@@ -28,9 +28,11 @@
  */
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.system.util.functional.Predicate;
 
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 /**

=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CollectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CollectionUtils.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/CollectionUtils.java	2012-06-28 09:21:53 +0000
@@ -0,0 +1,68 @@
+package org.hisp.dhis.system.util;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.system.util.functional.Function1;
+import org.hisp.dhis.system.util.functional.Predicate;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class CollectionUtils
+{
+    public static <T> void forEach( Collection<T> collection, Function1<T> function )
+    {
+        for ( T object : collection )
+        {
+            if ( object == null )
+            {
+                continue;
+            }
+
+            function.apply( object );
+        }
+    }
+
+    public static <T> void filter( Collection<T> collection, Predicate<T> predicate )
+    {
+        Iterator<T> iterator = collection.iterator();
+
+        while ( iterator.hasNext() )
+        {
+            T object = iterator.next();
+
+            if ( !predicate.evaluate( object ) )
+            {
+                iterator.remove();
+            }
+        }
+    }
+}

=== removed file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/FunctionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/FunctionUtils.java	2012-06-25 20:14:42 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/FunctionUtils.java	1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-package org.hisp.dhis.system.util;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.system.util.functional.Function1;
-
-import java.util.Collection;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class FunctionUtils
-{
-    public static <T> void forEach( Collection<T> collection, Function1<T> function )
-    {
-        for ( T object : collection )
-        {
-            if(object == null)
-            {
-                continue;
-            }
-
-            function.apply( object );
-        }
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm	2011-08-27 13:23:03 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm	2012-06-28 09:21:53 +0000
@@ -4,7 +4,7 @@
 #if( ! $versionOnly )
 ,"organisationUnits": {
 #foreach( $unit in $organisationUnits )
-"${unit.id}":{"id":${unit.id},"n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":${unit.parent.id},#end"c":[#foreach( $child in $unit.sortedChildren )${child.id}#if( $velocityCount < $unit.children.size() ),#end#end]}
+"${unit.id}":{"id":${unit.id},"n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":${unit.parent.id},#end"c":[#foreach( $child in $unit.sortedChildren )${child.id}#if( $velocityCount < $unit.children.size() ),#end#end]}
 #if( $velocityCount < $organisationUnits.size() ),#end#end
 }#end
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2012-06-14 06:23:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2012-06-28 09:21:53 +0000
@@ -29,8 +29,12 @@
 
 import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.configuration.ConfigurationService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.system.util.CollectionUtils;
+import org.hisp.dhis.system.util.functional.Predicate;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.version.Version;
@@ -69,6 +73,13 @@
         this.versionService = versionService;
     }
 
+    private ConfigurationService configurationService;
+
+    public void setConfigurationService( ConfigurationService configurationService )
+    {
+        this.configurationService = configurationService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -126,10 +137,8 @@
         {
             if ( user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
             {
-                userOrganisationUnits = new ArrayList<OrganisationUnit>(
-                    organisationUnitService.getRootOrganisationUnits() );
-                rootOrganisationUnits = new ArrayList<OrganisationUnit>(
-                    organisationUnitService.getRootOrganisationUnits() );
+                userOrganisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getRootOrganisationUnits() );
+                rootOrganisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getRootOrganisationUnits() );
             }
             else
             {
@@ -144,6 +153,33 @@
             {
                 organisationUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( unit.getId() ) );
             }
+
+            OrganisationUnitLevel offlineOrganisationUnitLevel = configurationService.getConfiguration().getOfflineOrganisationUnitLevel();
+
+            if ( offlineOrganisationUnitLevel == null )
+            {
+                int size = organisationUnitService.getOrganisationUnitLevels().size();
+                offlineOrganisationUnitLevel = organisationUnitService.getOrganisationUnitLevel( size );
+            }
+
+            int minLevel = rootOrganisationUnits.get( 0 ).getLevel();
+            int total = minLevel + offlineOrganisationUnitLevel.getLevel() - 1;
+
+            if ( total > offlineOrganisationUnitLevel.getLevel() )
+            {
+                total = offlineOrganisationUnitLevel.getLevel();
+            }
+
+            final int finalTotal = total;
+
+            CollectionUtils.filter( organisationUnits, new Predicate<OrganisationUnit>()
+            {
+                @Override
+                public boolean evaluate( OrganisationUnit organisationUnit )
+                {
+                    return organisationUnit.getLevel() <= finalTotal;
+                }
+            } );
         }
 
         Collections.sort( rootOrganisationUnits, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2012-06-05 22:03:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2012-06-28 09:21:53 +0000
@@ -516,6 +516,7 @@
     <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     <property name="versionService" ref="org.hisp.dhis.version.VersionService" />
+    <property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService" />
   </bean>
 
   <bean id="org.hisp.dhis.commons.action.GetPeriodAction" class="org.hisp.dhis.commons.action.GetPeriodAction"

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2012-06-05 14:53:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2012-06-28 09:21:53 +0000
@@ -754,9 +754,7 @@
     </action>
 
     <action name="getOrganisationUnitTree" class="org.hisp.dhis.commons.action.GetOrganisationUnitTreeAction">
-      <result name="success" type="velocity-json">
-        /dhis-web-commons/ajax/jsonOrganisationUnitTree.vm
-      </result>
+      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm</result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java	2012-06-27 16:54:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java	2012-06-28 09:21:53 +0000
@@ -205,12 +205,12 @@
             configuration.setCompletenessRecipients( userGroupService.getUserGroup( completenessRecipients ) );
         }
 
-        System.err.println( "Setting offline1: " + offlineOrganisationUnitLevel );
-
         if ( offlineOrganisationUnitLevel != null )
         {
-            System.err.println( "Setting offline2: " + offlineOrganisationUnitLevel );
             configuration.setOfflineOrganisationUnitLevel( organisationUnitService.getOrganisationUnitLevel( offlineOrganisationUnitLevel ) );
+
+            // if the level is changed, we need to make sure that the version is also changed.
+            organisationUnitService.updateVersion();
         }
 
         if ( infrastructuralDataElements != null )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2012-06-27 16:54:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2012-06-28 09:21:53 +0000
@@ -103,4 +103,4 @@
 no_cache=No cache
 cache_until_6am_tomorrow=Cache until 6 AM tomorrow
 cache_for_two_weeks=Cache for two weeks
-offline_orgunit_level=Offline Organisation Unit Level
+max_levels_to_offline=Maximum Organisation Unit Levels to Offline

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2012-06-27 16:54:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2012-06-28 09:21:53 +0000
@@ -79,13 +79,16 @@
 </select>
 </p>
 
-<!-- offline_orgunit_level -->
-<h4>$i18n.getString( "offline_orgunit_level" )</h4>
+<!-- max_levels_to_offline -->
+<h4>$i18n.getString( "max_levels_to_offline" )</h4>
 
 <p>
 <select id="offlineOrganisationUnitLevel" name="offlineOrganisationUnitLevel" style="width:30em">
+    #set( $level = 1)
+
 	#foreach ( $organisationUnitLevel in $organisationUnitLevels )
-    <option value="$organisationUnitLevel.id" #if( $organisationUnitLevel.id == $!offlineOrganisationUnitLevel.id)selected="selected"#end>$encoder.htmlEncode( $organisationUnitLevel.name )</option>
+    <option value="$organisationUnitLevel.id" #if( $organisationUnitLevel.id == $!offlineOrganisationUnitLevel.id)selected="selected"#end>Level $level</option>
+    #set( $level = $level + 1)
 	#end
 </select>
 </p>