← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4420: give success/failed notice on upload to server

 

------------------------------------------------------------
revno: 4420
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-08-23 15:51:02 +0200
message:
  give success/failed notice on upload to server
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  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/select.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/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-08-20 12:10:52 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-08-23 13:51:02 +0000
@@ -133,5 +133,7 @@
 offline_notification				= You are offline, data will be stored locally
 need_to_sync_notification			= There is data stored locally, please upload to server
 sync_now							= Upload
+sync_success						= Upload to server was successful
+sync_failed							= Upload to server failed, please try again later
 uploading_data_notification			= Uploading locally stored data to the server
 ajax_login_failed					= Login failed, check your username and password and try again
\ No newline at end of file

=== 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	2011-08-22 08:02:59 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-23 13:51:02 +0000
@@ -193,8 +193,18 @@
 
                 if ( array.length < 1 )
                 {
-                    setHeaderDelayMessage( i18n_online_notification );
+                    setHeaderDelayMessage( i18n_sync_success );
                 }
+            },
+            error: function( jqXHR, textStatus, errorThrown )
+            {
+                var message = i18n_sync_failed
+                    + ' <button id="sync_button" type="button">' + i18n_sync_now
+                    + '</button>';
+
+                setHeaderMessage( message );
+
+                $( '#sync_button' ).bind( 'click', uploadLocalData );
             }
         } );
     };
@@ -232,8 +242,18 @@
                 }
                 else
                 {
-                    setHeaderDelayMessage( i18n_online_notification );
+                    setHeaderDelayMessage( i18n_sync_success );
                 }
+            },
+            error: function( jqXHR, textStatus, errorThrown )
+            {
+                var message = i18n_sync_failed
+                    + ' <button id="sync_button" type="button">' + i18n_sync_now
+                    + '</button>';
+
+                setHeaderMessage( message );
+    
+                $( '#sync_button' ).bind( 'click', uploadLocalData );
             }
         } );
     } )( dataValuesArray );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2011-08-19 08:39:08 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2011-08-23 13:51:02 +0000
@@ -27,9 +27,10 @@
 var i18n_offline_notification = '$encoder.jsEscape( $i18n.getString( "offline_notification" ) , "'")';
 var i18n_need_to_sync_notification = '$encoder.jsEscape( $i18n.getString( "need_to_sync_notification" ) , "'")';
 var i18n_sync_now = '$encoder.jsEscape( $i18n.getString( "sync_now" ) , "'")';
+var i18n_sync_success = '$encoder.jsEscape( $i18n.getString( "sync_success" ) , "'")';
+var i18n_sync_failed = '$encoder.jsEscape( $i18n.getString( "sync_failed" ) , "'")';
 var i18n_uploading_data_notification = '$encoder.jsEscape( $i18n.getString( "uploading_data_notification" ) , "'")';
 var i18n_ajax_login_failed = '$encoder.jsEscape( $i18n.getString( "ajax_login_failed" ) , "'")';
-
 </script>
 
 <h3>$i18n.getString( "data_entry" ) #openHelp( "dataEntry" )</h3>