← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18197: minor fix for multi-ou, properly update dataset list after metadata is loaded

 

------------------------------------------------------------
revno: 18197
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-02-09 15:49:33 +0700
message:
  minor fix for multi-ou, properly update dataset list after metadata is loaded
modified:
  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/menu.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
=== 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	2015-01-08 13:16:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2015-02-09 08:49:33 +0000
@@ -219,13 +219,26 @@
     {
         console.log( 'Ouwt loaded' );
                 
-        $.when( dhis2.de.loadMetaData(), dhis2.de.loadDataSetAssociations() ).done( function() {
+        $.when( dhis2.de.getMultiOrgUnitSetting(), dhis2.de.loadMetaData(), dhis2.de.loadDataSetAssociations() ).done( function() {
         	dhis2.de.setMetaDataLoaded();
         	organisationUnitSelected( ids, names );
         } );
     } );
 } );
 
+dhis2.de.getMultiOrgUnitSetting = function()
+{
+  return $.ajax({
+    url: '../api/systemSettings/multiOrganisationUnitForms',
+    dataType: 'json',
+    async: false,
+    type: 'GET',
+    success: function( data ) {
+      selection.setIncludeChildren(data);
+    }
+  });
+};
+
 dhis2.de.ajaxLogin = function()
 {
     $( '#login_button' ).bind( 'click', function()
@@ -299,7 +312,7 @@
 	} );
 	
 	return def.promise();
-}
+};
 
 dhis2.de.setMetaDataLoaded = function()
 {
@@ -308,7 +321,7 @@
     console.log( 'Meta-data loaded' );
 
     updateForms();
-}
+};
 
 dhis2.de.discardLocalData = function() {
     if( confirm( i18n_remove_local_data ) ) {
@@ -2157,6 +2170,7 @@
         .done( function() {
         	dhis2.availability.startAvailabilityCheck();
         	console.log( 'Started availability check' );
+          selection.responseReceived();
         } );
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm	2013-12-21 19:13:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm	2015-02-09 08:49:33 +0000
@@ -1,23 +1,11 @@
 <script type="text/javascript">
-jQuery(document).ready(function() {
-    selection.setListenerFunction( organisationUnitSelected );
-
-    $.ajax({
-       url: '../api/systemSettings/multiOrganisationUnitForms',
-       dataType: 'json',
-       async: false,
-       type: 'get',
-       success: function(data) {
-           selection.setIncludeChildren( data );
-       }
-    });
-});
+  selection.setListenerFunction(organisationUnitSelected);
 </script>
 
 <style type="text/css">
-#leftBarContents div#orgUnitTree {
-	height: 430px;
-}
+  #leftBarContents div#orgUnitTree {
+    height : 430px;
+  }
 </style>
 
 <br>