dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19581
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8599: mobile: lots of minor changes to the way dvs upload is handled
------------------------------------------------------------
revno: 8599
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-10-19 14:24:40 +0200
message:
mobile: lots of minor changes to the way dvs upload is handled
modified:
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.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-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-10-18 10:45:26 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-10-19 12:24:40 +0000
@@ -189,13 +189,10 @@
fm.saveDataValueSet( dataValueSet );
$.mobile.hidePageLoadingMsg();
-
- console.log(dataValueSet);
}
jQuery(document).bind('pagechange', function (event, data) {
var pageId = data.toPage.attr('id');
- console.log(pageId);
if( pageId == 'organisation-units-page' ) {
loadOrganisationUnitsPage();
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-10-19 10:45:58 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-10-19 12:24:40 +0000
@@ -14,19 +14,28 @@
$.ajax({
url: '../api/currentUser/dashboard',
- dataType: 'json',
+ dataType: 'json'
}).success(function(data) {
if( data.unreadMessageConversation > 0 ) {
$('#messages a').append("<span class='ui-li-count'>" + data.unreadMessageConversation + "</span>");
}
- fm.initialize();
- fm.uploadDataValueSets();
+ fm.initialize({
+ success: function() {
+ fm.uploadDataValueSets({
+ success: function() {
+ },
+ done: function() {
+ $.mobile.hidePageLoadingMsg();
+ }
+ });
+ }
+ });
}).error(function() {
$('#messages a').append("<span class='ui-li-count'>Offline</span>")
+ $.mobile.hidePageLoadingMsg();
}).complete(function() {
$('section[data-role="content"] ul').listview('refresh');
- $.mobile.hidePageLoadingMsg();
});
});
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js 2012-10-18 12:53:32 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js 2012-10-19 12:24:40 +0000
@@ -41,10 +41,21 @@
}).success(function ( data ) {
localStorage['organisationUnits'] = JSON.stringify(data.organisationUnits);
localStorage['forms'] = JSON.stringify(data.forms);
+
+ if(args.success) {
+ args.success.call(data);
+ }
}).error(function () {
// offline ? reuse meta-data already present
console.log("unable to load meta-data");
+
+ if(args.error) {
+ args.error.call();
+ }
}).complete(function() {
+ if(args.complete) {
+ args.complete.call();
+ }
});
};
@@ -108,7 +119,7 @@
});
};
-dhis2.storage.FormManager.prototype.uploadDataValueSets = function() {
+dhis2.storage.FormManager.prototype.uploadDataValueSets = function( args ) {
var dataValueSets = this.dataValueSets();
_.each(dataValueSets, function( dataValueSet, idx ) {
@@ -120,6 +131,10 @@
async: false
}).success(function() {
delete dataValueSets[idx];
+
+ if( args.success ) {
+ args.success.call();
+ }
}).error(function() {
});
});
@@ -128,6 +143,10 @@
dataValueSets = _.filter(dataValueSets, function(dv) { return dv !== undefined; });
localStorage['dataValueSets'] = JSON.stringify( dataValueSets );
+
+ if( args.done) {
+ args.done.call();
+ }
};
// global storage manager instance