dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34534
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17701: app for clearing dhis2 related browser cache
------------------------------------------------------------
revno: 17701
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-12-15 15:00:36 +0100
message:
app for clearing dhis2 related browser cache
added:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_ar.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_fr.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/img/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/img/icons/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/index.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/manifest.webapp
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/controllers.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/directives.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/filters.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/services.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/styles/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/styles/style.css
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/views/
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/views/modal.html
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/dhis-web-cache-cleaner.png
modified:
dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-apps/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-apps/index.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js
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-event-capture/scripts/services.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.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-services/dhis-service-core/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties 2014-12-07 12:20:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties 2014-12-15 14:00:36 +0000
@@ -55,6 +55,7 @@
dhis-web-event-reports=Event Reports
dhis-web-event-visualizer=Event Visualizer
dhis-web-tracker-capture=Tracker Capture
+dhis-web-cache-cleaner=Cache Cleaner
dhis-web-reporting=Reports
dhis-web-light=Mobile (Light)
dhis-web-mobile=Mobile (Smartphone)
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-apps/src/main/resources/struts.xml 2014-12-03 17:48:48 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/resources/struts.xml 2014-12-15 14:00:36 +0000
@@ -63,4 +63,10 @@
</action>
</package>
+ <package name="dhis-web-cache-cleaner" extends="dhis-web-commons" namespace="/dhis-web-cache-cleaner">
+ <action name="index" class="org.hisp.dhis.commons.action.NoAction">
+ <result name="success" type="redirect">index.html</result>
+ </action>
+ </package>
+
</struts>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-apps/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-apps/index.html 2014-08-27 12:44:38 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-apps/index.html 2014-12-15 14:00:36 +0000
@@ -10,6 +10,7 @@
<li><a href="../dhis-web-event-visualizer/index.html">dhis-web-event-visualizer</a></li>
<li><a href="../dhis-web-event-capture/index.html">dhis-web-event-capture</a></li>
<li><a href="../dhis-web-tracker-capture/index.html">dhis-web-tracker-capture</a></li>
+ <li><a href="../dhis-web-cache-cleaner/index.html">dhis-web-cache-cleaner</a></li>
</ul>
</body>
</html>
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner'
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n'
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app.properties 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app.properties 2014-12-15 14:00:36 +0000
@@ -0,0 +1,24 @@
+home=Home
+dhis2=DHIS2
+dhis2_home=DHIS2 Home
+profile=Profile
+applications=Apps
+more_applications=More apps
+search_apps=Search apps
+settings=Settings
+account=Account
+log_out=Log out
+about_dhis2=About DHIS 2
+local_storage=Local Storage
+indexed_db=IndexedDB
+clearing_dhis2_browser_cache=DHIS2 related browser cache cleaner
+clears_local_cache=This clears selected items from your browser cache
+proceed_cleaning=Are your sure you want to proceed with the cleaning?
+cache_empty=Browser cache is empty. Nothing to clear.
+clearing_cache=Clearing cache
+proceed=Proceed
+cancel=Cancel
+clear=Clear
+
+
+
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_ar.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_ar.properties 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_ar.properties 2014-12-15 14:00:36 +0000
@@ -0,0 +1,11 @@
+home=\u0627\u0644\u0635\u0641\u062d\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629
+dhis2=DHIS2
+dhis2_home=DHIS2 \u0627\u0644\u0635\u0641\u062d\u0629 \u0627\u0644\u0631\u0626\u064a\u0633\u064a\u0629 \u0644\u0640
+profile=\u0627\u0644\u0645\u0644\u0641 \u0627\u0644\u0634\u062e\u0635\u064a
+applications=\u062a\u0637\u0628\u064a\u0642\u0627\u062a
+more_applications=\u062a\u0637\u0628\u064a\u0642\u0627\u062a \u0627\u0643\u062b\u0631
+search_apps=\u0627\u0628\u062d\u062b \u0639\u0646 \u062a\u0637\u0628\u064a\u0642\u0627\u062a
+settings=\u0627\u0644\u0636\u0628\u0637
+account=\u062d\u0633\u0627\u0628
+log_out=\u062a\u0633\u062c\u064a\u0644 \u062e\u0631\u0648\u062c
+about_dhis2=\u062d\u0648\u0644 DHIS 2
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_fr.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_fr.properties 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/i18n/i18n_app_fr.properties 2014-12-15 14:00:36 +0000
@@ -0,0 +1,3 @@
+home=Accueil
+dhis2=DHIS 2
+dhis2_home=Accueil DHIS 2
\ No newline at end of file
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/img'
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/img/icons'
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/index.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/index.html 2014-12-15 14:00:36 +0000
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html ng-app="cacheCleaner">
+ <head>
+ <title>Cache Cleaner</title>
+
+ <meta name="description" content="DHIS 2">
+ <meta name="keywords" content="DHIS 2">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui.min.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.plugin.min.js"></script>
+
+ <script type="text/javascript" src="../dhis-web-commons/bootstrap/js/bootstrap.min.js"></script>
+ <link type="text/css" rel="stylesheet" href="../dhis-web-commons/bootstrap/css/bootstrap.min.css">
+
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-resource.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-route.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-cookies.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/angular-animate.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/ui-bootstrap-tpls-0.10.0-draggable-modal.js"></script>
+
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/moment/moment-with-langs.min.js"></script>
+
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/underscore.min.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/commons.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/commons.ajax.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/lists.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/periodType.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/date.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/json2.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/validationRules.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.array.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.select.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.comparator.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.availability.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.trigger.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.sharing.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.validation.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.ls.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>
+
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/dhis2/services.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/dhis2/controllers.js"></script>
+
+ <script type="text/javascript" src="scripts/app.js"></script>
+ <script type="text/javascript" src="scripts/services.js"></script>
+ <script type="text/javascript" src="scripts/directives.js"></script>
+ <script type="text/javascript" src="scripts/controllers.js"></script>
+ <script type="text/javascript" src="scripts/filters.js"></script>
+
+ <!-- Menu scripts -->
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.translate.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.menu.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js"></script>
+
+ <link type="text/css" rel="stylesheet" href="../dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
+ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/light_blue/light_blue.css"/>
+ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/widgets.css"/>
+ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css">
+
+ <link type="text/css" rel="stylesheet" href="styles/style.css">
+
+ </head>
+
+ <body>
+ <div id="header" ng-controller="HeaderController">
+ <div class="container-heading">
+ <img ng-click="home()" id="headerBanner" src="../dhis-web-commons/css/light_blue/logo_banner.png" style="cursor:pointer" title="{{'dhis2_home'| translate}}">
+ </div>
+ <div id="headerMessage" class="bold"></div>
+
+ <div d2-menu></div>
+
+ </div>
+
+ <div id="leftBar"></div>
+ <div class="page" id="mainPage" ng-controller="MainController">
+
+ <!-- top bar begins -->
+ <div class="row top-bar">
+ <div class="col-sm-12">
+ {{'clearing_dhis2_browser_cache'| translate}}
+ </div>
+ </div>
+ <!-- top bar ends -->
+
+
+ <div class="row col-sm-4" ng-if="lsCacheExists || idxCacheExists">
+ <h3 ng-if="lsCacheExists">{{'local_storage'| translate}}</h3>
+ <table class="table table-bordered table-striped" ng-if="lsCacheExists">
+ <tr ng-repeat="lsKey in lsKeys">
+ <td>
+ {{lsKey.id}}
+ </td>
+ <td>
+ <input type="checkbox" ng-model="lsKey.remove">
+ </td>
+ </tr>
+ </table>
+
+ <h3 ng-if="idxCacheExists">{{'indexed_db'| translate}}</h3>
+ <table class="table table-bordered table-striped" ng-if="idxCacheExists">
+ <tr ng-repeat="dbKey in dbKeys">
+ <td>
+ {{dbKey.id}}
+ </td>
+ <td>
+ <input type="checkbox" ng-model="dbKey.remove">
+ </td>
+ </tr>
+ </table>
+
+ <!--<span class="alert alert-warning">{{'clears_local_cache'| translate}}</span>-->
+ <a href ng-click="clearCache()" class="btn btn-danger">{{'clear'| translate}}</a>
+ </div>
+
+ <div class="row col-sm-4" ng-if="!lsCacheExists && !idxCacheExists">
+ <div class="alert alert-info">{{'cache_empty'| translate}}</div>
+ </div>
+
+ </div>
+
+ </body>
+</html>
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/manifest.webapp'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/manifest.webapp 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/manifest.webapp 2014-12-15 14:00:36 +0000
@@ -0,0 +1,21 @@
+{
+ "version": "0.1",
+ "name": "Cache Cleaner,
+ "description": "DHIS2 Cache Cleaner App",
+ "launch_path": "index.html",
+ "icons": {
+ "16": "/img/icons/mortar-16.png",
+ "48": "/img/icons/mortar-48.png",
+ "128": "/img/icons/mortar-128.png"
+ },
+ "developer": {
+ "name": "HISP",
+ "url": "http://dhis2.org"
+ },
+ "default_locale": "en",
+ "activities": {
+ "dhis": {
+ "href": ".."
+ }
+ }
+}
\ No newline at end of file
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts'
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/app.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/app.js 2014-12-15 14:00:36 +0000
@@ -0,0 +1,24 @@
+'use strict';
+
+/* App Module */
+
+var cacheCleaner = angular.module('cacheCleaner',
+ ['ui.bootstrap',
+ 'ngRoute',
+ 'ngCookies',
+ 'cacheCleanerDirectives',
+ 'cacheCleanerControllers',
+ 'cacheCleanerServices',
+ 'cacheCleanerFilters',
+ 'd2Services',
+ 'd2Controllers',
+ 'angularLocalStorage',
+ 'pascalprecht.translate',
+ 'd2Menu'])
+
+.value('DHIS2URL', '..')
+
+.config(function($translateProvider) {
+ $translateProvider.preferredLanguage('en');
+ $translateProvider.useLoader('i18nLoader');
+});
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/controllers.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/controllers.js 2014-12-15 14:00:36 +0000
@@ -0,0 +1,73 @@
+'use strict';
+
+/* Controllers */
+var cacheCleanerControllers = angular.module('cacheCleanerControllers', [])
+
+//Controller for settings page
+.controller('MainController', function($scope, storage, $window, idbStorageService, ModalService) {
+
+ var getItemsToClear = function(){
+
+ $scope.lsCacheExists = false;
+ $scope.idxCacheExists = false;
+
+ $scope.lsKeys = [], $scope.dbKeys = [];
+
+ var reservedLocalStorageKeys = ['key', 'getItem', 'setItem', 'removeItem', 'clear', 'length'];
+
+ for(var key in $window.localStorage){
+ if(reservedLocalStorageKeys.indexOf(key) === -1)
+ {
+ $scope.lsKeys.push({id: key, remove: false});
+ $scope.lsCacheExists = true;
+ }
+ }
+
+ var idxDBs = ['dhis2ou', 'dhis2', 'dhis2tc', 'dhis2ec'];
+ angular.forEach(idxDBs, function(db){
+ idbStorageService.dbExists(db).then(function(res){
+ if( res ){
+ $scope.dbKeys.push({id: db, remove: false});
+ $scope.idxCacheExists = true;
+ }
+ });
+ });
+ };
+
+ getItemsToClear();
+
+ $scope.clearCache = function(){
+
+ var modalOptions = {
+ closeButtonText: 'cancel',
+ actionButtonText: 'proceed',
+ headerText: 'clearing_cache',
+ bodyText: 'proceed_cleaning'
+ };
+
+ ModalService.showModal({}, modalOptions).then(function(){
+ angular.forEach($scope.lsKeys, function(lsKey){
+ if(lsKey.remove){
+ storage.remove(lsKey.id);
+ console.log('removed from local storage: ', lsKey.id);
+ }
+ });
+
+ angular.forEach($scope.dbKeys, function(dbKey){
+ if(dbKey.remove){
+ idbStorageService.deleteDb(dbKey.id).then(function(res){
+ if(res){
+ console.log('removed from local indexeddb: ', dbKey.id);
+ }
+ else{
+ console.log('failed to remove from local indexeddb: ', dbKey.id);
+ }
+
+ });
+ }
+ });
+
+ getItemsToClear();
+ });
+ };
+});
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/directives.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/directives.js 2014-12-15 14:00:36 +0000
@@ -0,0 +1,5 @@
+'use strict';
+
+/* Directives */
+
+var cacheCleanerDirectives = angular.module('cacheCleanerDirectives', []);
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/filters.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/filters.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/filters.js 2014-12-15 14:00:36 +0000
@@ -0,0 +1,5 @@
+'use strict';
+
+/* Filters */
+
+var cacheCleanerFilters = angular.module('cacheCleanerFilters', []);
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/services.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/scripts/services.js 2014-12-15 14:00:36 +0000
@@ -0,0 +1,100 @@
+'use strict';
+
+/* Services */
+
+var cacheCleanerServices = angular.module('cacheCleanerServices', ['ngResource']);
+
+/*Orgunit service for local db */
+cacheCleanerServices.service('idbStorageService', function ($window, $q) {
+
+ var indexedDB = $window.indexedDB;
+
+ var db = null;
+
+ var open = function (dbName) {
+ var deferred = $q.defer();
+
+ var request = indexedDB.open(dbName);
+
+ request.onsuccess = function (e) {
+ db = e.target.result;
+ deferred.resolve();
+ };
+
+ request.onerror = function () {
+ deferred.reject();
+ };
+
+ return deferred.promise;
+ };
+
+ var dbExists = function(dbName){
+
+ var deferred = $q.defer();
+
+ var request = indexedDB.open(dbName);
+
+ var existed = true;
+
+ request.onsuccess = function (e) {
+ request.result.close();
+
+ if(!existed){
+ indexedDB.deleteDatabase(dbName);
+ }
+
+ deferred.resolve( existed );
+ };
+
+ request.onerror = function () {
+ deferred.reject();
+ };
+
+ request.onupgradeneeded = function () {
+ existed = false;
+ };
+
+ return deferred.promise;
+ };
+
+ var getObjectStores = function(dbName){
+
+ var deferred = $q.defer();
+
+ var request = indexedDB.open(dbName);
+
+ request.onsuccess = function (e) {
+ var db = e.target.result;
+ deferred.resolve( db.objectStoreNames );
+ };
+
+ request.onerror = function () {
+ deferred.reject();
+ };
+ return deferred.promise;
+ };
+
+ var deleteDb = function(dbName){
+
+ var deferred = $q.defer();
+
+ var request = indexedDB.deleteDatabase(dbName);
+
+ request.onsuccess = function (e) {
+ deferred.resolve( true );
+ };
+
+ request.onerror = function (e) {
+ console.log('Error in deleting db: ', e);
+ deferred.resolve( false );
+ };
+ return deferred.promise;
+ };
+
+ return {
+ open: open,
+ deleteDb: deleteDb,
+ dbExists: dbExists,
+ getObjectStores: getObjectStores
+ };
+});
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/styles'
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/styles/style.css 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/styles/style.css 2014-12-15 14:00:36 +0000
@@ -0,0 +1,157 @@
+/*----------------------------------------------------------------------------*/
+/* Table
+/*----------------------------------------------------------------------------*/
+
+table
+{
+ font-size: 13px;
+ line-height: 24px;
+ table-layout: fixed;
+ margin-bottom: 10px;
+}
+
+/*----------------------------------------------------------------------------*/
+/* App specific
+/*----------------------------------------------------------------------------*/
+
+.container-heading {
+ color: white;
+}
+
+.container-default-form {
+ width: 50%;
+}
+
+.container-1-1 {
+ width: 100%;
+ float: left;
+ margin-top: 150px;
+ margin-left: 150px;
+ height: 100%;
+ min-height: 100%;
+}
+
+.right {
+ float: right !important;
+ padding-bottom: 20px;
+ margin-bottom: 20px;
+}
+
+.black {
+ color: black;
+}
+
+.bold {
+ font-weight: bold;
+}
+
+.white {
+ color: white;
+}
+
+.nav, .pagination, .carousel, .panel-title a {
+ cursor: pointer;
+}
+
+input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+input[type=date]::-webkit-inner-spin-button, input[type=date]::-webkit-outer-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+.max-column-width {
+ max-width:200px !important;
+ word-wrap:break-word;
+}
+
+.table-borderless>thead>tr>th,
+.table-borderless>tbody>tr>th,
+.table-borderless>tfoot>tr>th,
+.table-borderless>thead>tr>td,
+.table-borderless>tbody>tr>td,
+.table-borderless>tfoot>tr>td {
+ border-top: none;
+ white-space:nowrap;
+}
+
+.dhis2-table>thead>tr>th,
+.dhis2-table>tbody>tr>th,
+.dhis2-table>tfoot>tr>th,
+.dhis2-table>thead>tr>td,
+.dhis2-table>tbody>tr>td,
+.dhis2-table>tfoot>tr>td {
+ border-top: none;
+ background-color: #ebf0f6;
+}
+
+.dhis2-table-striped-border tr th {
+ border: 1px solid #cad5e5;
+}
+
+.dhis2-table-striped-border tr td {
+ border: 1px solid #cad5e5;
+}
+
+.dhis2-table-striped-border > tbody > tr:nth-child(odd)> td, .dhis2-table-striped > tbody > tr:nth-child(odd)> th {
+ background-color: #ebf0f6
+}
+
+.listTable th {
+ height: 30px;
+}
+
+.dhis2-table-striped>thead>tr,
+.dhis2-table-striped>tbody>tr,
+.dhis2-table-striped>tfoot>tr,
+.dhis2-table-striped>thead>tr,
+.dhis2-table-striped>tbody>tr,
+.dhis2-table-striped>tfoot>tr {
+ border-bottom: 1px solid #cad5e5;
+ white-space:nowrap;
+}
+
+.dhis2-table-striped > tbody > tr:nth-child(odd)> td, .dhis2-table-striped > tbody > tr:nth-child(odd)> th {
+ background-color: #ebf0f6
+}
+
+.dhis2-list-table-striped {
+ width: 100%;
+ padding-bottom: 6px;
+}
+
+.dhis2-list-table-striped>thead>tr,
+.dhis2-list-table-striped>tbody>tr,
+.dhis2-list-table-striped>tfoot>tr,
+.dhis2-list-table-striped>thead>tr,
+.dhis2-list-table-striped>tbody>tr,
+.dhis2-list-table-striped>tfoot>tr {
+ border: none;
+}
+
+.dhis2-list-table-striped > tbody > tr:nth-child(odd)> td, .dhis2-table-striped > tbody > tr:nth-child(odd)> th {
+ background-color: #ebf0f6
+}
+
+.dhis2-table-hover > tbody > tr:hover > td, .table-hover > tbody > tr:hover > th {
+ background-color: #dfe9f4;
+}
+
+.top-bar {
+ font-size: 16pt;
+ font-weight: normal;
+ color: #585D61;
+}
+
+.horizontal-spacing{
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+.trim {
+ margin-bottom: 5px;
+ margin-top: 5px;
+}
\ No newline at end of file
=== added directory 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/views'
=== added file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/views/modal.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/views/modal.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-cache-cleaner/views/modal.html 2014-12-15 14:00:36 +0000
@@ -0,0 +1,10 @@
+<div class="modal-header">
+ <h3>{{modalOptions.headerText | translate}}</h3>
+</div>
+<div class="modal-body">
+ <p>{{modalOptions.bodyText | translate}}</p>
+</div>
+<div class="modal-footer">
+ <button class="btn btn-default" data-ng-click="modalOptions.close()">{{modalOptions.closeButtonText | translate}}</button>
+ <button class="btn btn-primary" data-ng-click="modalOptions.ok();">{{modalOptions.actionButtonText | translate}}</button>
+</div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2014-12-09 23:24:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/index.html 2014-12-15 14:00:36 +0000
@@ -61,6 +61,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.appcache.js"></script>
<script type="text/javascript" src="../dhis-web-commons/ouwt/ouwt.js"></script>
+ <script type="text/javascript" src="scripts/event-capture.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angularLocalStorage.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/angular-translate.min.js"></script>
@@ -68,8 +69,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/dhis2/filters.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/dhis2/services.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/dhis2/controllers.js"></script>
-
- <script type="text/javascript" src="scripts/event-capture.js"></script>
+
<script type="text/javascript" src="scripts/app.js"></script>
<script type="text/javascript" src="scripts/services.js"></script>
<script type="text/javascript" src="scripts/directives.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 2014-12-08 15:06:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/app.js 2014-12-15 14:00:36 +0000
@@ -9,6 +9,7 @@
'eventCaptureDirectives',
'eventCaptureControllers',
'eventCaptureServices',
+ 'eventCaptureFilters',
'd2Filters',
'd2Directives',
'd2Services',
=== 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 2014-12-09 23:24:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-12-15 14:00:36 +0000
@@ -15,7 +15,6 @@
ProgramStageFactory,
DHIS2EventFactory,
DHIS2EventService,
- GeoJsonFactory,
ContextMenuSelectedItem,
DateUtils,
CalendarService,
@@ -59,10 +58,6 @@
}
});
- GeoJsonFactory.getAll().then(function(geoJsons){
- $scope.geoJsons = geoJsons;
- });
-
//load programs associated with the selected org unit.
$scope.loadPrograms = function() {
=== 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 2014-12-09 23:24:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-12-15 14:00:36 +0000
@@ -4,7 +4,6 @@
// whether current user has any organisation units
dhis2.ec.emptyOrganisationUnits = false;
-var EC_STORE_NAME = "dhis2ec";
var i18n_no_orgunits = 'No organisation unit attached to current user, no data entry possible';
var i18n_offline_notification = 'You are offline, data will be stored locally';
var i18n_online_notification = 'You are online';
@@ -18,8 +17,6 @@
var EVENT_VALUES = 'EVENT_VALUES';
-//var ecDAO = {};
-
dhis2.ec.store = null;
dhis2.ec.memoryOnly = $('html').hasClass('ie7') || $('html').hasClass('ie8');
var adapters = [];
@@ -30,10 +27,12 @@
}
dhis2.ec.store = new dhis2.storage.Store({
- name: EC_STORE_NAME,
- objectStores: [
+ name: 'dhis2ec',
+ adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
+ objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events']
+ /*objectStores: [
{
- name: 'ecPrograms',
+ name: 'programs',
adapters: adapters
},
{
@@ -52,7 +51,7 @@
name: 'events',
adapters: adapters
}
- ]
+ ]*/
});
(function($) {
@@ -88,9 +87,9 @@
{
if (loggedIn)
{
- var OfflineStorageService = angular.element('body').injector().get('OfflineStorageService');
+ var OfflineECStorageService = angular.element('body').injector().get('OfflineECStorageService');
- OfflineStorageService.hasLocalData().then(function(localData){
+ OfflineECStorageService.hasLocalData().then(function(localData){
if(localData){
var message = i18n_need_to_sync_notification
+ ' <button id="sync_button" type="button">' + i18n_sync_now + '</button>';
@@ -326,7 +325,7 @@
build = build.then(function() {
var d = $.Deferred();
var p = d.promise();
- dhis2.ec.store.get('ecPrograms', program.id).done(function(obj) {
+ dhis2.ec.store.get('programs', program.id).done(function(obj) {
if(!obj || obj.version !== program.version) {
promise = promise.then( getProgram( program.id ) );
}
@@ -357,7 +356,7 @@
{
return function() {
return $.ajax( {
- url: '../api/programs.json?filter=id:eq:' + id +'&fields=id,name,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,organisationUnits[id,name],programStages[id,name,version]',
+ url: '../api/programs.json?filter=id:eq:' + id +'&fields=id,name,type,version,dataEntryMethod,dateOfEnrollmentDescription,dateOfIncidentDescription,displayIncidentDate,ignoreOverdueEvents,organisationUnits[id,name],programStages[id,name,version]',
type: 'GET'
}).done( function( response ){
@@ -377,7 +376,7 @@
program.userRoles = ur;
- dhis2.ec.store.set( 'ecPrograms', program );
+ dhis2.ec.store.set( 'programs', program );
});
});
@@ -511,10 +510,10 @@
function uploadLocalData()
{
- var OfflineStorageService = angular.element('body').injector().get('OfflineStorageService');
+ var OfflineECStorageService = angular.element('body').injector().get('OfflineECStorageService');
setHeaderWaitMessage(i18n_uploading_data_notification);
- OfflineStorageService.uploadLocalData().then(function(){
+ OfflineECStorageService.uploadLocalData().then(function(){
dhis2.ec.store.removeAll( 'events' );
log( 'Successfully uploaded local events' );
setHeaderDelayMessage( i18n_sync_success );
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-12-08 15:06:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-12-15 14:00:36 +0000
@@ -4,23 +4,23 @@
var eventCaptureServices = angular.module('eventCaptureServices', ['ngResource'])
-.factory('StorageService', function(){
+.factory('ECStorageService', function(){
var store = new dhis2.storage.Store({
name: 'dhis2ec',
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
- objectStores: ['ecPrograms', 'programStages', 'geoJsons', 'optionSets', 'events']
+ objectStores: ['programs', 'programStages', 'geoJsons', 'optionSets', 'events']
});
return{
currentStore: store
};
})
-.factory('OfflineStorageService', function($http, $q, $rootScope, StorageService){
+.factory('OfflineECStorageService', function($http, $q, $rootScope, ECStorageService){
return {
hasLocalData: function() {
var def = $q.defer();
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.getKeys('events').done(function(events){
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.getKeys('events').done(function(events){
$rootScope.$apply(function(){
def.resolve( events.length > 0 );
});
@@ -30,8 +30,8 @@
},
getLocalData: function(){
var def = $q.defer();
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.getAll('events').done(function(events){
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.getAll('events').done(function(events){
$rootScope.$apply(function(){
def.resolve({events: events});
});
@@ -58,8 +58,94 @@
};
})
+/* Factory to fetch optionSets */
+.factory('OptionSetService', function($q, $rootScope, ECStorageService) {
+ return {
+ getAll: function(){
+
+ var def = $q.defer();
+
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.getAll('optionSets').done(function(optionSets){
+ $rootScope.$apply(function(){
+ def.resolve(optionSets);
+ });
+ });
+ });
+
+ return def.promise;
+ },
+ get: function(uid){
+
+ var def = $q.defer();
+
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.get('optionSets', uid).done(function(optionSet){
+ $rootScope.$apply(function(){
+ def.resolve(optionSet);
+ });
+ });
+ });
+ return def.promise;
+ },
+ getCode: function(options, key){
+ if(options){
+ for(var i=0; i<options.length; i++){
+ if( key === options[i].name){
+ return options[i].code;
+ }
+ }
+ }
+ return key;
+ },
+ getName: function(options, key){
+ if(options){
+ for(var i=0; i<options.length; i++){
+ if( key === options[i].code){
+ return options[i].name;
+ }
+ }
+ }
+ return key;
+ }
+ };
+})
+
+/* Factory to fetch geojsons */
+.factory('GeoJsonFactory', function($q, $rootScope, ECStorageService) {
+ return {
+ getAll: function(){
+
+ var def = $q.defer();
+
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.getAll('geoJsons').done(function(geoJsons){
+ $rootScope.$apply(function(){
+ def.resolve(geoJsons);
+ });
+ });
+ });
+
+ return def.promise;
+ },
+ get: function(level){
+
+ var def = $q.defer();
+
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.get('geoJsons', level).done(function(geoJson){
+ $rootScope.$apply(function(){
+ def.resolve(geoJson);
+ });
+ });
+ });
+ return def.promise;
+ }
+ };
+})
+
/* Factory to fetch programs */
-.factory('ProgramFactory', function($q, $rootScope, StorageService) {
+.factory('ProgramFactory', function($q, $rootScope, ECStorageService) {
return {
@@ -67,8 +153,14 @@
var def = $q.defer();
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.getAll('ecPrograms').done(function(programs){
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.getAll('programs').done(function(prs){
+ var programs = [];
+ angular.forEach(prs, function(pr){
+ if(pr.type === 3){
+ programs.push(pr);
+ }
+ });
$rootScope.$apply(function(){
def.resolve(programs);
});
@@ -80,15 +172,15 @@
})
/* Factory to fetch programStages */
-.factory('ProgramStageFactory', function($q, $rootScope, StorageService) {
+.factory('ProgramStageFactory', function($q, $rootScope, ECStorageService) {
return {
get: function(uid){
var def = $q.defer();
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.get('programStages', uid).done(function(pst){
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.get('programStages', uid).done(function(pst){
$rootScope.$apply(function(){
def.resolve(pst);
});
@@ -100,7 +192,7 @@
})
/* factory for handling events */
-.factory('DHIS2EventFactory', function($http, $q, StorageService, $rootScope) {
+.factory('DHIS2EventFactory', function($http, $q, ECStorageService, $rootScope) {
return {
getByStage: function(orgUnit, programStage, pager){
@@ -112,8 +204,8 @@
return response.data;
}, function(){
var def = $q.defer();
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.getAll('events').done(function(evs){
+ ECStorageService.currentStore.open().done(function(){
+ ECStorageService.currentStore.getAll('events').done(function(evs){
var result = {events: [], pager: {pageSize: '', page: 1, toolBarDisplay: 5, pageCount: 1}};
angular.forEach(evs, function(ev){
if(ev.programStage === programStage && ev.orgUnit === orgUnit){
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.js 2014-12-09 23:24:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/services.js 2014-12-15 14:00:36 +0000
@@ -1,92 +1,6 @@
/* Pagination service */
var d2Services = angular.module('d2Services', ['ngResource'])
-/* Factory to fetch geojsons */
-.factory('GeoJsonFactory', function($q, $rootScope, StorageService) {
- return {
- getAll: function(){
-
- var def = $q.defer();
-
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.getAll('geoJsons').done(function(geoJsons){
- $rootScope.$apply(function(){
- def.resolve(geoJsons);
- });
- });
- });
-
- return def.promise;
- },
- get: function(level){
-
- var def = $q.defer();
-
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.get('geoJsons', level).done(function(geoJson){
- $rootScope.$apply(function(){
- def.resolve(geoJson);
- });
- });
- });
- return def.promise;
- }
- };
-})
-
-/* Factory to fetch optionSets */
-.factory('OptionSetService', function($q, $rootScope, StorageService) {
- return {
- getAll: function(){
-
- var def = $q.defer();
-
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.getAll('optionSets').done(function(optionSets){
- $rootScope.$apply(function(){
- def.resolve(optionSets);
- });
- });
- });
-
- return def.promise;
- },
- get: function(uid){
-
- var def = $q.defer();
-
- StorageService.currentStore.open().done(function(){
- StorageService.currentStore.get('optionSets', uid).done(function(optionSet){
- $rootScope.$apply(function(){
- def.resolve(optionSet);
- });
- });
- });
- return def.promise;
- },
- getCode: function(options, key){
- if(options){
- for(var i=0; i<options.length; i++){
- if( key === options[i].name){
- return options[i].code;
- }
- }
- }
- return key;
- },
- getName: function(options, key){
- if(options){
- for(var i=0; i<options.length; i++){
- if( key === options[i].code){
- return options[i].name;
- }
- }
- }
- return key;
- }
- };
-})
-
/* Factory for loading translation strings */
.factory('i18nLoader', function ($q, $http, storage, DialogService) {
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/dhis-web-cache-cleaner.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/dhis-web-cache-cleaner.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/dhis-web-cache-cleaner.png 2014-12-15 14:00:36 +0000 differ