dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34259
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17590: bug fix in synching orgunit loading, angular initialization and offline/online notification
------------------------------------------------------------
revno: 17590
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-11-26 12:12:10 +0100
message:
bug fix in synching orgunit loading, angular initialization and offline/online notification
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.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-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2014-11-19 19:47:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js 2014-11-26 11:12:10 +0000
@@ -28,6 +28,7 @@
dhis2.ou.store.open().done( function() {
selection.load();
$( "#orgUnitTree" ).one( "ouwtLoaded", function(event, ids, names) {
+ dhis2.availability.startAvailabilityCheck();
setSelectedOu(ids, names);
});
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-11-20 11:36:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-11-26 11:12:10 +0000
@@ -82,69 +82,62 @@
});
$('#loaderSpan').show();
-
- $('#orgUnitTree').one('ouwtLoaded', function()
- {
- downloadMetaData();
-
- });
-
- $(document).bind('dhis2.online', function(event, loggedIn)
- {
- if (loggedIn)
- {
- var OfflineStorageService = angular.element('body').injector().get('OfflineStorageService');
-
- OfflineStorageService.hasLocalData().then(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{
- if (dhis2.ec.emptyOrganisationUnits) {
- setHeaderMessage(i18n_no_orgunits);
- }
- else {
- setHeaderDelayMessage(i18n_online_notification);
- }
- }
- });
- }
- else
- {
- var form = [
- '<form style="display:inline;">',
- '<label for="username">Username</label>',
- '<input name="username" id="username" type="text" style="width: 70px; margin-left: 10px; margin-right: 10px" size="10"/>',
- '<label for="password">Password</label>',
- '<input name="password" id="password" type="password" style="width: 70px; margin-left: 10px; margin-right: 10px" size="10"/>',
- '<button id="login_button" type="button">Login</button>',
- '</form>'
- ].join('');
-
- setHeaderMessage(form);
- ajax_login();
- }
- });
-
- $(document).bind('dhis2.offline', function()
- {
- if (dhis2.ec.emptyOrganisationUnits) {
- setHeaderMessage(i18n_no_orgunits);
- }
- else {
- setHeaderMessage(i18n_offline_notification);
- }
- });
-
- dhis2.availability.startAvailabilityCheck();
-
-});
-
+
+});
+
+
+$(document).bind('dhis2.online', function(event, loggedIn)
+{
+ if (loggedIn)
+ {
+ var OfflineStorageService = angular.element('body').injector().get('OfflineStorageService');
+
+ OfflineStorageService.hasLocalData().then(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{
+ if (dhis2.ec.emptyOrganisationUnits) {
+ setHeaderMessage(i18n_no_orgunits);
+ }
+ else {
+ setHeaderDelayMessage(i18n_online_notification);
+ }
+ }
+ });
+ }
+ else
+ {
+ var form = [
+ '<form style="display:inline;">',
+ '<label for="username">Username</label>',
+ '<input name="username" id="username" type="text" style="width: 70px; margin-left: 10px; margin-right: 10px" size="10"/>',
+ '<label for="password">Password</label>',
+ '<input name="password" id="password" type="password" style="width: 70px; margin-left: 10px; margin-right: 10px" size="10"/>',
+ '<button id="login_button" type="button">Login</button>',
+ '</form>'
+ ].join('');
+
+ setHeaderMessage(form);
+ ajax_login();
+ }
+});
+
+$(document).bind('dhis2.offline', function()
+{
+ if (dhis2.ec.emptyOrganisationUnits) {
+ setHeaderMessage(i18n_no_orgunits);
+ }
+ else {
+ setHeaderMessage(i18n_offline_notification);
+ }
+});
+
function ajax_login()
{
$('#login_button').bind('click', function()