=== 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: '

Tried changing to invalid page

', + 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;