← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18710: replaced external angular storage plugin with own storage service

 

------------------------------------------------------------
revno: 18710
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-27 15:31:13 +0100
message:
  replaced external angular storage plugin with own storage service
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-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/enrollment/enrollment-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-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/tei-report-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/components/selected/selected-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.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-04 11:34:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-03-27 14:31:13 +0000
@@ -1,3 +1,5 @@
+/* global angular */
+
 'use strict';
 
 /* Controllers */
@@ -11,7 +13,7 @@
                 $translate,
                 $anchorScroll,
                 orderByFilter,
-                storage,
+                SessionStorageService,
                 Paginator,
                 OptionSetService,
                 ProgramValidationService,
@@ -58,16 +60,16 @@
     $scope.note = {};
     $scope.today = DateUtils.getToday();
     
-    var userAccount = storage.get('USER_PROFILE');
-    var storedBy = userAccount ? userAccount.userName : '';    
+    var userProfile = SessionStorageService.get('USER_PROFILE');
+    var storedBy = userProfile && userProfile.username ? userProfile.username : '';
+    
     $scope.noteExists = false;
-    storage.remove('SELECTED_OU');
         
     //watch for selection of org unit from tree
     $scope.$watch('selectedOrgUnit', function() {
         
         if(angular.isObject($scope.selectedOrgUnit)){
-            storage.set('SELECTED_OU', $scope.selectedOrgUnit);
+            SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
             
             //get ouLevels
             ECStorageService.currentStore.open().done(function(){

=== 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-11 15:02:58 +0000
+++ 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
@@ -1,3 +1,5 @@
+/* global trackerCapture, angular */
+
 //Controller for dashboard
 trackerCapture.controller('DashboardController',
         function($rootScope,
@@ -8,7 +10,7 @@
                 $filter,
                 TCStorageService,
                 orderByFilter,
-                storage,
+                SessionStorageService,
                 TEIService, 
                 TEService,
                 OptionSetService,
@@ -20,7 +22,7 @@
     //selections
     $scope.selectedTeiId = ($location.search()).tei; 
     $scope.selectedProgramId = ($location.search()).program; 
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
     
     $scope.sortedTeiIds = CurrentSelection.getSortedTeiIds();    
     

=== 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 12:43:44 +0000
+++ 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
@@ -7,7 +7,6 @@
                 DateUtils,
                 EventUtils,
                 orderByFilter,
-                storage,
                 SessionStorageService,
                 ProgramStageFactory,
                 DHIS2EventFactory,
@@ -59,7 +58,7 @@
         $scope.prStDes = [];
         
         var selections = CurrentSelection.get();          
-        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
         $scope.selectedEntity = selections.tei;      
         $scope.selectedProgram = selections.pr;        
         $scope.selectedEnrollment = selections.selectedEnrollment;   

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-03-26 12:26:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/enrollment/enrollment-controller.js	2015-03-27 14:31:13 +0000
@@ -6,13 +6,13 @@
                 $location,
                 $timeout,
                 DateUtils,
-                storage,
+                SessionStorageService,
                 CurrentSelection,
                 EnrollmentService,
                 ModalService) {
     
     $scope.today = DateUtils.getToday();
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');    
+    $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');    
     
     //listen for the selected items
     var selections = {};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-03-26 13:07:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-03-27 14:31:13 +0000
@@ -17,7 +17,7 @@
                 EventUtils,
                 RegistrationService,
                 DateUtils,
-                storage) {
+                SessionStorageService) {
     
     $scope.today = DateUtils.getToday();
     $scope.trackedEntityForm = null;
@@ -50,7 +50,7 @@
         });
     }
     
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
     $scope.selectedEnrollment = {dateOfEnrollment: '', dateOfIncident: ''};   
             
     $scope.trackedEntities = {available: []};

=== 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-26 14:59:40 +0000
+++ 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
@@ -179,7 +179,7 @@
             TEIGridService,
             DialogService,
             Paginator,
-            storage,
+            SessionStorageService,
             $modalInstance, 
             relationshipTypes,
             selectedProgram,
@@ -216,7 +216,7 @@
     };
     
     //Selection
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
     $scope.optionSets = selections.optionSets;
     $scope.selectedTeiForDisplay = angular.copy($scope.selectedTei);
     
@@ -517,7 +517,7 @@
                 OptionSetService,
                 DateUtils,
                 storage) {
-    $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+    $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
     $scope.enrollment = {enrollmentDate: '', incidentDate: ''};    
     
     var selections = CurrentSelection.get();

=== 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-11 15:02:58 +0000
+++ 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
@@ -1,3 +1,5 @@
+/* global angular, trackerCapture */
+
 trackerCapture.controller('OverdueEventsController',
          function($scope,
                 $modal,
@@ -12,7 +14,7 @@
                 ProgramFactory,
                 CurrentSelection,
                 OptionSetService,
-                storage) {    
+                SessionStorageService) {    
     $scope.today = DateUtils.getToday();
     
     $scope.selectedOuMode = 'SELECTED';
@@ -55,7 +57,7 @@
         $scope.reportStarted = false;
         $scope.selectedProgram = null;
         if( angular.isObject($scope.selectedOrgUnit)){            
-            storage.set('SELECTED_OU', $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-06 15:15:45 +0000
+++ 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
@@ -1,10 +1,12 @@
+/* global trackerCapture, angular */
+
 trackerCapture.controller('ProgramStatisticsController',
          function($scope,
                 DateUtils,                
                 EnrollmentService,
                 ProgramFactory,
                 DHIS2EventFactory,
-                storage) {
+                SessionStorageService) {
     $scope.today = DateUtils.getToday();
     
     $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
@@ -21,7 +23,7 @@
     $scope.$watch('selectedOrgUnit', function() {      
         $scope.selectedProgram = null;
         if( angular.isObject($scope.selectedOrgUnit)){            
-            storage.set('SELECTED_OU', $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-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-11 15:02:58 +0000
+++ 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
@@ -1,3 +1,5 @@
+/* global trackerCapture, angular */
+
 trackerCapture.controller('ProgramSummaryController',
         function($scope,
                 $modal,
@@ -10,7 +12,7 @@
                 CurrentSelection,
                 OptionSetService,
                 DHIS2EventFactory,
-                storage) {    
+                SessionStorageService) {    
     $scope.today = DateUtils.getToday();
     
     $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
@@ -33,7 +35,7 @@
     $scope.$watch('selectedOrgUnit', function() {      
         $scope.selectedProgram = null;
         if( angular.isObject($scope.selectedOrgUnit)){            
-            storage.set('SELECTED_OU', $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/tei-report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-03-19 10:18:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-03-27 14:31:13 +0000
@@ -4,7 +4,7 @@
 trackerCapture.controller('TeiReportController',
         function($scope,
                 CurrentSelection,
-                storage,
+                SessionStorageService,
                 DateUtils,
                 EventUtils,
                 TEIService,
@@ -17,7 +17,7 @@
     $scope.$on('dashboardWidgets', function(event, args) {
         $scope.showProgramReportDetailsDiv = false;
         var selections = CurrentSelection.get();        
-        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
         $scope.selectedTei = selections.tei;  
         $scope.selectedEntity = selections.te;
         $scope.selectedProgram = selections.pr;

=== 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-11 15:02:58 +0000
+++ 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
@@ -12,7 +12,7 @@
                 ProgramFactory,
                 CurrentSelection,
                 OptionSetService,
-                storage) {
+                SessionStorageService) {
     $scope.today = DateUtils.getToday();
     
     $scope.selectedOuMode = 'SELECTED';
@@ -53,7 +53,7 @@
     $scope.$watch('selectedOrgUnit', function() {      
         $scope.selectedProgram = null;
         if( angular.isObject($scope.selectedOrgUnit)){            
-            storage.set('SELECTED_OU', $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/selected/selected-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/selected/selected-controller.js	2014-12-08 15:56:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/selected/selected-controller.js	2015-03-27 14:31:13 +0000
@@ -1,6 +1,6 @@
 trackerCapture.controller('SelectedInfoController',
         function($scope,                
-                storage,
+                SessionStorageService,
                 CurrentSelection) {
     //listen for the selected items
     $scope.$on('selectedItems', function(event, args) {
@@ -9,7 +9,7 @@
         $scope.selectedEntity = selections.tei; 
         $scope.selectedProgram = selections.pr; 
         
-        $scope.selectedOrgUnit = storage.get('SELECTED_OU');
+        $scope.selectedOrgUnit = SessionStorageService.get('SELECTED_OU');
         $scope.selections = [];
         
         $scope.selections.push({title: 'registering_unit', value: $scope.selectedOrgUnit ? $scope.selectedOrgUnit.name : 'not_selected'});

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-03-25 16:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-03-27 14:31:13 +0000
@@ -15,7 +15,7 @@
                 $filter,
                 $timeout,
                 Paginator,
-                storage,
+                SessionStorageService,
                 DateUtils,
                 OptionSetService,
                 OrgUnitFactory,
@@ -62,7 +62,7 @@
 
         if( angular.isObject($scope.selectedOrgUnit)){   
             
-            storage.set('SELECTED_OU', $scope.selectedOrgUnit);
+            SessionStorageService.set('SELECTED_OU', $scope.selectedOrgUnit);
             
             $scope.trackedEntityList = [];