=== 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 2014-07-01 09:03:58 +0000 +++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2014-07-01 10:59:57 +0000 @@ -176,6 +176,7 @@ _.template(tmpl, { 'form': form, 'valueMap': valueMap, + optionSets: fm.optionSets(), periodName: Selected.periodName, orgUnitName: Selected.orgUnitName }) @@ -376,7 +377,15 @@ <% if( field.type == 'TEXT' ) { %> - + <% if( field.optionSet ) { %> + + <% } else { %> + + <% } %> <% } else if( field.type == 'LONG_TEXT' ) { %> <% } else if( field.type == 'DATE' ) { %> === 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 2014-07-01 10:10:50 +0000 +++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/dhis-web-mobile-resources/js/dhis2.storage.js 2014-07-01 10:59:57 +0000 @@ -37,13 +37,14 @@ dhis2.storage.FormManager.prototype.getMetaData = function () { return $.ajax({ - url : '../api/currentUser/assignedDataSets', + url : '../api/currentUser/assignedDataSets?optionSets=true', dataType : 'json', cache : false }).success(function ( data ) { // clear out old localStorage, some phones doesn't like it when you overwrite old keys localStorage.removeItem('mobileOrganisationUnits'); localStorage.removeItem('mobileForms'); + localStorage.removeItem('mobileOptionSets'); if( data.organisationUnits ) { localStorage.setItem('mobileOrganisationUnits', JSON.stringify(data.organisationUnits)); @@ -56,6 +57,12 @@ } else { localStorage.setItem('mobileForms', JSON.stringify({})); } + + if( data.optionSets ) { + localStorage.setItem('mobileOptionSets', JSON.stringify(data.optionSets)); + } else { + localStorage.setItem('mobileOptionSets', JSON.stringify({})); + } }); }; @@ -83,6 +90,22 @@ return this.organisationUnit(id).dataSets; }; +dhis2.storage.FormManager.prototype.optionSets = function() { + if( this._optionSets === undefined ) { + var optionSets = localStorage.getItem('mobileOptionSets'); + + if( optionSets != null && optionSets != "null" ) { + this._optionSets = JSON.parse(optionSets); + } + } + + return this._optionSets; +}; + +dhis2.storage.FormManager.prototype.optionSet = function( id ) { + return this.optionSets()[id]; +}; + dhis2.storage.FormManager.prototype.forms = function () { if( this._forms === undefined ) { var form = localStorage.getItem('mobileForms');