← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17543: add new parameter to ouwt, setOfflineLevel(x), allows bypassing system setting for offline level

 

------------------------------------------------------------
revno: 17543
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-11-20 13:13:09 +0700
message:
  add new parameter to ouwt, setOfflineLevel(x), allows bypassing system setting for offline level
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java


--
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
=== 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	2014-11-17 21:59:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2014-11-20 06:13:09 +0000
@@ -83,6 +83,7 @@
     var autoSelectRoot = true;
     var realRoot = true;
     var includeChildren = false;
+    var offlineLevel;
 
     this.setListenerFunction = function( listenerFunction_, skipInitialCall ) {
         listenerFunction = listenerFunction_;
@@ -94,6 +95,10 @@
         }
     };
 
+    this.setOfflineLevel = function( level ) {
+        offlineLevel = level;
+    };
+
     this.setMultipleSelectionAllowed = function( allowed ) {
         multipleSelectionAllowed = allowed;
     };
@@ -269,7 +274,8 @@
         return $.ajax( {
             url: '../dhis-web-commons-ajax-json/getOrganisationUnitTree.action',
             data: {
-                versionOnly: versionOnly
+                versionOnly: versionOnly,
+                offlineLevel: offlineLevel
             },
             type: 'POST',
             dataType: format

=== 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	2014-11-16 11:32:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2014-11-20 06:13:09 +0000
@@ -155,6 +155,13 @@
         return realRoot;
     }
 
+    private Integer offlineLevel;
+
+    public void setOfflineLevel( Integer offlineLevel )
+    {
+        this.offlineLevel = offlineLevel;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -239,7 +246,8 @@
 
         if ( !versionOnly && !rootOrganisationUnits.isEmpty() )
         {
-            OrganisationUnitLevel offlineOrgUnitLevel = configurationService.getConfiguration().getOfflineOrganisationUnitLevel();
+            OrganisationUnitLevel offlineOrgUnitLevel = offlineLevel != null ? new OrganisationUnitLevel( offlineLevel, "<no-name>" )
+                : configurationService.getConfiguration().getOfflineOrganisationUnitLevel();
 
             List<OrganisationUnitLevel> orgUnitLevels = organisationUnitService.getOrganisationUnitLevels();