← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10626: minor fixes

 

------------------------------------------------------------
revno: 10626
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-18 22:32:46 +0700
message:
  minor fixes
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java
  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/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java	2013-04-18 15:23:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/UploadAnonymousEventAction.java	2013-04-18 15:32:46 +0000
@@ -139,8 +139,6 @@
 
         Boolean completed = (Boolean) executionDate.get( "completed" );
 
-        System.err.println( "Completed: " + completed );
-
         ProgramStageInstance programStageInstance = saveExecutionDate( programId, organisationUnitId, date, completed );
 
         Map<String, Object> values = (Map<String, Object>) input.get( "values" );

=== 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-04-18 15:23:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-18 15:32:46 +0000
@@ -78,10 +78,12 @@
 
 var haveLocalData = false;
 
-function checkOfflineData() {
+function checkOfflineData(callback) {
     DAO.offlineData.fetchAll( function ( store, arr ) {
         haveLocalData = arr.length > 0;
         $( document ).trigger('dhis2.anonymous.checkOfflineData');
+
+        if(callback && typeof callback == 'function') callback(haveLocalData);
     } );
 }
 
@@ -156,21 +158,23 @@
 
     $( document ).bind( 'dhis2.online', function ( event, loggedIn ) {
         if ( loggedIn ) {
-            if ( haveLocalData ) {
-                var message = i18n_need_to_sync_notification
-   	            	+ ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>';
-
-   	            setHeaderMessage( message );
-
-   	            $( '#sync_button' ).bind( 'click', uploadLocalData );
-            } else {
-                setHeaderDelayMessage( i18n_online_notification );
-            }
-
-            enableFiltering();
-            searchEvents( eval( getFieldValue( 'listAll' ) ) );
-            $('#commentInput').removeAttr('disabled');
-            $('#validateBtn').removeAttr('disabled');
+            checkOfflineData(function(localData) {
+                if ( localData ) {
+                    var message = i18n_need_to_sync_notification
+       	            	+ ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>';
+
+       	            setHeaderMessage( message );
+
+       	            $( '#sync_button' ).bind( 'click', uploadLocalData );
+                } else {
+                    setHeaderDelayMessage( i18n_online_notification );
+                }
+
+                enableFiltering();
+                searchEvents( eval( getFieldValue( 'listAll' ) ) );
+                $('#commentInput').removeAttr('disabled');
+                $('#validateBtn').removeAttr('disabled');
+            });
         }
         else {
             var form = [