dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36642
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18743: tracker and event capture apps now repsect user roles
------------------------------------------------------------
revno: 18743
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-03-30 12:40:41 +0200
message:
tracker and event capture apps now repsect user roles
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
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-tracker-capture/components/dashboard/dashboard-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.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/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-03-28 09:24:30 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-03-30 10:40:41 +0000
@@ -149,8 +149,6 @@
section.open = true;
});
- $scope.customForm = CustomFormService.getForProgramStage($scope.selectedProgramStage);
-
$scope.prStDes = [];
$scope.eventGridColumns = [];
$scope.filterTypes = {};
@@ -195,13 +193,14 @@
$scope.filterText[prStDe.dataElement.id]= {};
}
});
+
+ $scope.customForm = CustomFormService.getForProgramStage($scope.selectedProgramStage, $scope.prStDes);
if($scope.selectedProgramStage.captureCoordinates){
$scope.newDhis2Event.coordinate = {};
}
$scope.newDhis2Event.eventDate = '';
-
ErrorMessageService.setErrorMessages(errorMessages);
ProgramValidationService.getByProgram($scope.selectedProgram.id).then(function(pvs){
=== 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 2015-03-28 09:24:30 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2015-03-30 10:40:41 +0000
@@ -191,9 +191,7 @@
function getCalendarSetting()
{
- var SessionStorageService = angular.element('body').injector().get('SessionStorageService');
-
- if( SessionStorageService.get('CALENDAR_SETTING') ){
+ if(localStorage['CALENDAR_SETTING']){
return;
}
@@ -203,7 +201,7 @@
url: '../api/systemSettings?key=keyCalendar&key=keyDateFormat',
type: 'GET'
}).done(function(response) {
- SessionStorageService.set('CALENDAR_SETTING', response);
+ localStorage['CALENDAR_SETTING'] = JSON.stringify(response);
def.resolve();
}).fail(function(){
def.resolve();
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js 2015-03-30 10:40:41 +0000
@@ -185,14 +185,13 @@
$scope.programStageNames = [];
//get programs valid for the selected ou and tei
- angular.forEach(programs, function(program){
- $scope.programNames[program.id] = {id: program.id, name: program.name};
- angular.forEach(program.programStages, function(stage){
- $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name};
- });
- if(program.organisationUnits.hasOwnProperty($scope.selectedOrgUnit.id) &&
- program.trackedEntity.id === $scope.selectedTei.trackedEntity){
+ angular.forEach(programs, function(program){
+ if( program.trackedEntity.id === $scope.selectedTei.trackedEntity ){
$scope.programs.push(program);
+ $scope.programNames[program.id] = {id: program.id, name: program.name};
+ angular.forEach(program.programStages, function(stage){
+ $scope.programStageNames[stage.id] = {id: stage.id, name: stage.name};
+ });
if($scope.selectedProgramId && program.id === $scope.selectedProgramId || selectedEnrollment && selectedEnrollment.program === program.id){
$scope.selectedProgram = program;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2015-03-30 10:40:41 +0000
@@ -235,7 +235,7 @@
section.open = true;
});
- $scope.customForm = CustomFormService.getForProgramStage($scope.currentStage);
+ $scope.customForm = CustomFormService.getForProgramStage($scope.currentStage, $scope.prStDes);
$scope.displayCustomForm = $scope.customForm ? true:false;
$scope.currentEventOriginal = angular.copy($scope.currentEvent);
@@ -247,28 +247,32 @@
angular.forEach(event.dataValues, function(dataValue){
- var val = dataValue.value;
- var de = $scope.prStDes[dataValue.dataElement].dataElement;
- if(de){
- if(val && de.type === 'string' && de.optionSet && $scope.optionSets[de.optionSet.id].options ){
- val = OptionSetService.getName($scope.optionSets[de.optionSet.id].options, val);
- }
- if(val && de.type === 'date'){
- val = DateUtils.formatFromApiToUser(val);
- }
- if(de.type === 'trueOnly'){
- if(val === 'true'){
- val = true;
- }
- else{
- val = '';
- }
- }
- }
- event[dataValue.dataElement] = val;
- if(dataValue.providedElsewhere){
- event.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere;
+ var prStDe = $scope.prStDes[dataValue.dataElement];
+
+ if( prStDe ){
+ var val = dataValue.value;
+ if(prStDe.dataElement){
+ if(val && prStDe.dataElement.type === 'string' && prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id].options ){
+ val = OptionSetService.getName($scope.optionSets[prStDe.dataElement.optionSet.id].options, val);
+ }
+ if(val && prStDe.dataElement.type === 'date'){
+ val = DateUtils.formatFromApiToUser(val);
+ }
+ if(prStDe.dataElement.type === 'trueOnly'){
+ if(val === 'true'){
+ val = true;
+ }
+ else{
+ val = '';
+ }
+ }
+ }
+ event[dataValue.dataElement] = val;
+ if(dataValue.providedElsewhere){
+ event.providedElsewhere[dataValue.dataElement] = dataValue.providedElsewhere;
+ }
}
+
});
if(stage.captureCoordinates){
@@ -276,12 +280,13 @@
longitude: event.coordinate.longitude ? event.coordinate.longitude : ''};
}
- event.allowProvidedElsewhereExists = false;
- angular.forEach(stage.programStageDataElements, function(prStDe){
- if(prStDe.allowProvidedElsewhere){
- event.allowProvidedElsewhereExists = true;
+ event.allowProvidedElsewhereExists = false;
+ for(var i=0; i<stage.programStageDataElements.length; i++){
+ if(stage.programStageDataElements[i].allowProvidedElsewhere){
+ event.allowProvidedElsewhereExists = true;
+ break;
}
- });
+ }
return event;
};
@@ -847,4 +852,4 @@
$scope.cancel = function(){
$modalInstance.close();
};
-});
\ No newline at end of file
+});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-03-30 10:40:41 +0000
@@ -516,7 +516,7 @@
CurrentSelection,
OptionSetService,
DateUtils,
- storage) {
+ SessionStorageService) {
$scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
$scope.enrollment = {enrollmentDate: '', incidentDate: ''};
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/overdue-events-controller.js 2015-03-30 10:40:41 +0000
@@ -13,8 +13,7 @@
AttributesFactory,
ProgramFactory,
CurrentSelection,
- OptionSetService,
- SessionStorageService) {
+ OptionSetService) {
$scope.today = DateUtils.getToday();
$scope.selectedOuMode = 'SELECTED';
@@ -57,7 +56,6 @@
$scope.reportStarted = false;
$scope.selectedProgram = null;
if( angular.isObject($scope.selectedOrgUnit)){
- SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
$scope.loadPrograms($scope.selectedOrgUnit);
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-statistics-controller.js 2015-03-30 10:40:41 +0000
@@ -5,8 +5,7 @@
DateUtils,
EnrollmentService,
ProgramFactory,
- DHIS2EventFactory,
- SessionStorageService) {
+ DHIS2EventFactory) {
$scope.today = DateUtils.getToday();
$scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];
@@ -22,8 +21,7 @@
//watch for selection of org unit from tree
$scope.$watch('selectedOrgUnit', function() {
$scope.selectedProgram = null;
- if( angular.isObject($scope.selectedOrgUnit)){
- SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
+ if( angular.isObject($scope.selectedOrgUnit)){
$scope.loadPrograms($scope.selectedOrgUnit);
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-summary-controller.js 2015-03-30 10:40:41 +0000
@@ -11,8 +11,7 @@
ProgramFactory,
CurrentSelection,
OptionSetService,
- DHIS2EventFactory,
- SessionStorageService) {
+ DHIS2EventFactory) {
$scope.today = DateUtils.getToday();
$scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];
@@ -35,7 +34,6 @@
$scope.$watch('selectedOrgUnit', function() {
$scope.selectedProgram = null;
if( angular.isObject($scope.selectedOrgUnit)){
- SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
$scope.loadPrograms($scope.selectedOrgUnit);
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-03-27 14:31:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/upcoming-events-controller.js 2015-03-30 10:40:41 +0000
@@ -11,8 +11,7 @@
AttributesFactory,
ProgramFactory,
CurrentSelection,
- OptionSetService,
- SessionStorageService) {
+ OptionSetService) {
$scope.today = DateUtils.getToday();
$scope.selectedOuMode = 'SELECTED';
@@ -53,7 +52,6 @@
$scope.$watch('selectedOrgUnit', function() {
$scope.selectedProgram = null;
if( angular.isObject($scope.selectedOrgUnit)){
- SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
$scope.loadPrograms($scope.selectedOrgUnit);
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-03-28 09:24:30 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js 2015-03-30 10:40:41 +0000
@@ -182,9 +182,7 @@
function getCalendarSetting()
{
- var SessionStorageService = angular.element('body').injector().get('SessionStorageService');
-
- if( SessionStorageService.get('CALENDAR_SETTING') ){
+ if(localStorage['CALENDAR_SETTING']){
return;
}
@@ -194,7 +192,7 @@
url: '../api/systemSettings?key=keyCalendar&key=keyDateFormat',
type: 'GET'
}).done(function(response) {
- SessionStorageService.set('CALENDAR_SETTING', response);
+ localStorage['CALENDAR_SETTING'] = JSON.stringify(response);
def.resolve();
}).fail(function(){
def.resolve();
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-03-28 09:24:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-03-30 10:40:41 +0000
@@ -103,13 +103,13 @@
})
/* service for getting calendar setting */
-.service('CalendarService', function(storage, $rootScope, SessionStorageService){
+.service('CalendarService', function(storage, $rootScope){
return {
getSetting: function() {
var dhis2CalendarFormat = {keyDateFormat: 'yyyy-MM-dd', keyCalendar: 'gregorian', momentFormat: 'YYYY-MM-DD'};
- var storedFormat = SessionStorageService.get('CALENDAR_SETTING');
+ var storedFormat = storage.get('CALENDAR_SETTING');
if(angular.isObject(storedFormat) && storedFormat.keyDateFormat && storedFormat.keyCalendar){
if(storedFormat.keyCalendar === 'iso8601'){
storedFormat.keyCalendar = 'gregorian';
@@ -191,17 +191,11 @@
.service('CustomFormService', function(){
return {
- getForProgramStage: function(programStage){
+ getForProgramStage: function(programStage, programStageDataElements){
var htmlCode = programStage.dataEntryForm ? programStage.dataEntryForm.htmlCode : null;
if(htmlCode){
-
- var programStageDataElements = [];
-
- angular.forEach(programStage.programStageDataElements, function(prStDe){
- programStageDataElements[prStDe.dataElement.id] = prStDe;
- });
var inputRegex = /<input.*?\/>/g,
match,
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2015-01-14 04:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2015-03-30 10:40:41 +0000
@@ -11,6 +11,8 @@
$( '#submit' ).attr( 'disabled', 'disabled' );
sessionStorage.removeItem( 'ouSelected' );
+ sessionStorage.removeItem( 'USER_PROFILE' );
+ sessionStorage.removeItem( 'USER_ROLES' );
} );
var locale = localStorage[login.localeKey];