dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19789
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8776: mobile: minor changes, redirect to index if there is not meta-data.
------------------------------------------------------------
revno: 8776
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-30 16:56:17 +0100
message:
mobile: minor changes, redirect to index if there is not meta-data.
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/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-30 14:02:06 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-10-30 15:56:17 +0000
@@ -241,6 +241,11 @@
$(document).bind( 'pagechange', function (event, data) {
var pageId = data.toPage.attr('id');
+ if( fm.needMetaData() )
+ {
+ location.href = 'index';
+ }
+
var pageLoaders = {
'organisation-units-page': loadOrganisationUnitsPage,
'data-sets-page': loadDataSetsPage,
@@ -252,8 +257,8 @@
pageLoaders[pageId].call();
} else {
$.mobile.loading( 'show', {
- text: 'Tried changing to invalid page',
- textonly: true
+ html: '<h1>Tried changing to invalid page</h1>',
+ textVisible: true
});
}
});
=== 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-24 15:15:23 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js 2012-10-30 15:56:17 +0000
@@ -44,9 +44,15 @@
});
};
+dhis2.storage.FormManager.prototype.needMetaData = function () {
+ return this.organisationUnits() === undefined || this.forms() === undefined;
+};
+
dhis2.storage.FormManager.prototype.organisationUnits = function () {
if ( this._organisationUnits === undefined ) {
- this._organisationUnits = JSON.parse(localStorage['organisationUnits']);
+ if( localStorage['organisationUnits'] ) {
+ this._organisationUnits = JSON.parse(localStorage['organisationUnits']);
+ }
}
return this._organisationUnits;
@@ -63,7 +69,9 @@
dhis2.storage.FormManager.prototype.forms = function () {
if( this._forms === undefined ) {
- this._forms = JSON.parse( localStorage['forms'] );
+ if( localStorage['forms'] ) {
+ this._forms = JSON.parse( localStorage['forms'] );
+ }
}
return this._forms;