← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9861: bug fixes with anonymous program meta-data loading

 

------------------------------------------------------------
revno: 9861
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-21 14:08:28 +0700
message:
  bug fixes with anonymous program meta-data loading
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js


--
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-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-02-19 09:57:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-02-21 07:08:28 +0000
@@ -1,5 +1,5 @@
 CACHE MANIFEST
-# 2.11-SNAPSHOT V3
+# 2.11-SNAPSHOT V5
 NETWORK:
 *
 CACHE:
@@ -29,6 +29,8 @@
 ../dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js
 ../dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js
 ../dhis-web-commons/javascripts/jQuery/jquery.cookie.js
+../dhis-web-commons/javascripts/jQuery/jquery.validate.js
+../dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js
 ../main.js
 ../dhis-web-commons/ouwt/ouwt.js
 ../dhis-web-commons/fonts/LiberationSans-Regular-webfont.eot
@@ -54,6 +56,7 @@
 ../images/ajax-loader-bar.gif
 
 # jquery-ui 1.9.1
+../dhis-web-commons/javascripts/jQuery/ui/jquery-ui-1.9.1.custom.min.js
 ../dhis-web-commons/javascripts/jQuery/ui/css/redmond/jquery-ui-1.9.1.custom.css
 ../dhis-web-commons/javascripts/jQuery/ui/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png
 ../dhis-web-commons/javascripts/jQuery/ui/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-02-20 08:03:09 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-02-21 07:08:28 +0000
@@ -6,25 +6,26 @@
         cache: false
     } );
 
-    jQuery.getJSON( "getProgramMetaData.action", {}, function ( data ) {
-        DAO.programs = new dhis2.storage.Store( {name: 'programs'}, function ( store ) {
-            var keys = _.keys( data.metaData.programs );
-            var objs = _.values( data.metaData.programs );
-
-            store.addAll( keys, objs, function ( store ) {
-            } );
-        } );
-
+    // initialize the stores, and then try and add the data
+    DAO.programs = new dhis2.storage.Store( {name: 'programs'}, function ( store ) {
         DAO.programAssociations = new dhis2.storage.Store( {name: 'programAssociations'}, function ( store ) {
-            var keys = _.keys( data.metaData.programAssociations );
-            var objs = _.values( data.metaData.programAssociations );
-
-            store.addAll( keys, objs, function ( store ) {
-                // wait until the stores have been populated until the listener is set
+            jQuery.getJSON( "getProgramMetaData.action", {}, function ( data ) {
+                var keys = _.keys( data.metaData.programs );
+                var objs = _.values( data.metaData.programs );
+
+                DAO.programs.addAll( keys, objs, function ( store ) {
+                    var keys = _.keys( data.metaData.programAssociations );
+                    var objs = _.values( data.metaData.programAssociations );
+
+                    DAO.programAssociations.addAll( keys, objs, function ( store ) {
+                        selection.setListenerFunction( organisationUnitSelected );
+                    } );
+                } );
+            } ).fail(function() {
                 selection.setListenerFunction( organisationUnitSelected );
-            } );
-        } );
-    } );
+            });
+        });
+    });
 } );
 
 function organisationUnitSelected( orgUnits, orgUnitNames )