← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17944: DI map and chart plugin fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17944 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-12 17:12:08 +0100
message:
  DI map and chart plugin fixes.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/images/legend_24.png
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.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-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm	2014-12-30 14:04:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm	2015-01-12 16:09:26 +0000
@@ -27,10 +27,10 @@
 
     <script type="text/javascript" src="../dhis-web-commons/javascripts/es5-shim.min.js?_rev=$!{buildRevision}"></script>
     <script type="text/javascript" src="../dhis-web-commons/javascripts/es5-sham.min.js?_rev=$!{buildRevision}"></script>
-    
+
     <script type="text/javascript" src="../dhis-web-commons/javascripts/ext/ext-all.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/javascripts/openlayers/OpenLayers.js"></script>
-    <script src="//maps.google.com/maps/api/js?sensor=false"></script>
+    <script src="//maps.google.com/maps/api/js"></script>
 
     <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.min.js?_rev=$!{buildRevision}"></script>
     <!--[if lte IE 8]><script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/placeholders.jquery.min.js?_rev=$!{buildRevision}"></script><![endif]-->
@@ -86,7 +86,7 @@
     <script type="text/javascript" src="../dhis-web-commons/i18nJavaScript.action?_rev=$!{buildRevision}"></script>
     <script type="text/javascript" src="../main.js?_rev=$!{buildRevision}"></script>
     <script type="text/javascript" src="../request.js?_rev=$!{buildRevision}"></script>
-    
+
     #foreach( $javascript in $javascripts )
     <script type="text/javascript" src="${javascript}?_rev=$!{buildRevision}"></script>
     #end
@@ -109,11 +109,11 @@
   #else
   #set( $logoBanner = "../dhis-web-commons/css/${stylesheetDirectory}/logo_banner.png" )
   #end
-  
+
   <body>
     #parse( "macros.vm" )
     <div id="header">
-      <img id="headerBanner" src="${logoBanner}" onclick="window.location.href='../${startModule}/index.action'" 
+      <img id="headerBanner" src="${logoBanner}" onclick="window.location.href='../${startModule}/index.action'"
       	style="cursor:pointer" title="$i18n.getString( 'view_home_page' )">
 
       <span id="headerText" onclick="window.location.href='../${startModule}/index.action'" style="cursor:pointer" title="$i18n.getString( 'view_home_page' )">
@@ -121,7 +121,7 @@
       </span>
 
       <div id="dhisDropDownMenu"></div>
-	  
+
       <span id="showLeftBar">
         <a href="javascript:dhis2.leftBar.showAnimated()" title="$i18n.getString( 'show_menu' )">
           <img src="../images/show_menu.png" width="16" height="16" alt="$i18n.getString( 'show_menu' )"/></a>
@@ -165,7 +165,7 @@
       dhis2.leftBar.extend();
     #end
     </script>
-    
+
     <div id="rightBar">
       <span id="hideRightBar"><a href="javascript:hideHelpContent()" title="$i18n.getString( 'close' )">
         <img id="hideRightBarImg" src="../images/hide.png" alt="$i18n.getString( 'close' )"/></a>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/images/legend_24.png'
Binary files dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/images/legend_24.png	2015-01-12 14:25:23 +0000 and dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/images/legend_24.png	2015-01-12 15:33:19 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2015-01-11 22:33:37 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2015-01-12 16:09:26 +0000
@@ -410,9 +410,9 @@
     $.getJSON( "../api/dashboards/" + id + "/?fields=:all,dashboardItems[:all]&" + dhis2.util.cacheBust(), function( data )
     {
 		$d = $( "#contentList" ).empty();
-	
+
 		updateSharing( data );
-	
+
 		if ( data.dashboardItems && data.dashboardItems.length )
 		{
 		    $.each( data.dashboardItems, function( index, dashboardItem )
@@ -422,97 +422,104 @@
 				    return true;
 				}
 				console.log(dashboardItem);
-		
+
 				if ( "chart" == dashboardItem.type )
 				{
 				    $d.append( $.tmpl( dhis2.db.tmpl.chartItem, { "itemId": dashboardItem.id, "id": dashboardItem.chart.id, "name": dashboardItem.chart.name,
 					"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share_interpretation, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) );
-		
+
 				    DHIS.getChart({
-					url: '..',
-					el: 'plugin-' + dashboardItem.id,
-					id: dashboardItem.chart.id,
-					width: contentWidth,
-					height: contentHeight,
-					dashboard: true,
-					skipMask: true,
-					domainAxisStyle: {
-					    labelRotation: 45,
-					    labelFont: '10px arial,sans-serif'
-					},
-					rangeAxisStyle: {
-					    labelFont: '9px arial,sans-serif'
-					},
-					legendStyle: {
-					    labelMaxLength: 10,
-					    titleFont: '15px arial,sans-serif'
-					},
-					seriesStyle: {
-					    labelFontSize: '9px arial,sans-serif'
-					}
+                        url: '..',
+                        el: 'plugin-' + dashboardItem.id,
+                        id: dashboardItem.chart.id,
+                        width: contentWidth,
+                        height: contentHeight,
+                        dashboard: true,
+                        crossDomain: false,
+                        skipMask: true,
+                        domainAxisStyle: {
+                            labelRotation: 45,
+                            labelFont: '10px arial,sans-serif'
+                        },
+                        rangeAxisStyle: {
+                            labelFont: '9px arial,sans-serif'
+                        },
+                        legendStyle: {
+                            labelMaxLength: 10,
+                            titleFont: '15px arial,sans-serif'
+                        },
+                        seriesStyle: {
+                            labelFontSize: '9px arial,sans-serif'
+                        }
 				    });
 				}
 				else if ( "eventChart" == dashboardItem.type )
 				{
 				    $d.append( $.tmpl( dhis2.db.tmpl.eventChartItem, { "itemId": dashboardItem.id, "id": dashboardItem.eventChart.id, "name": dashboardItem.eventChart.name,
 					"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share_interpretation, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) );
-		
+
 				    DHIS.getEventChart({
-					url: '..',
-					el: 'plugin-' + dashboardItem.id,
-					id: dashboardItem.eventChart.id,
-					width: contentWidth,
-					height: 290,
-					skipMask: true
+                        url: '..',
+                        el: 'plugin-' + dashboardItem.id,
+                        id: dashboardItem.eventChart.id,
+                        width: contentWidth,
+                        height: 290,
+                        dashboard: true,
+                        crossDomain: false,
+                        skipMask: true
 				    });
 				}
 				else if ( "map" == dashboardItem.type )
 				{
 				    $d.append( $.tmpl( dhis2.db.tmpl.mapItem, { "itemId": dashboardItem.id, "id": dashboardItem.map.id, "name": dashboardItem.map.name,
 					"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share_interpretation, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) );
-		
+
 				    DHIS.getMap({
-					url: '..',
-					el: 'plugin-' + dashboardItem.id,
-					id: dashboardItem.map.id,
-					width: contentWidth,
-					height: 290,
-					hideLegend: true,
-					dashboard: true,
-					crossDomain: false,
-					skipMask: true
+                        url: '..',
+                        el: 'plugin-' + dashboardItem.id,
+                        id: dashboardItem.map.id,
+                        width: contentWidth,
+                        height: 290,
+                        hideLegend: true,
+                        dashboard: true,
+                        crossDomain: false,
+                        skipMask: true
 				    });
 				}
 				else if ( "reportTable" == dashboardItem.type )
 				{
 				    $d.append( $.tmpl( dhis2.db.tmpl.reportTableItem, { "itemId": dashboardItem.id, "id": dashboardItem.reportTable.id, "name": dashboardItem.reportTable.name,
 					"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share_interpretation, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) );
-		
+
 				    DHIS.getTable({
-					url: '..',
-					el: 'plugin-' + dashboardItem.id,
-					id: dashboardItem.reportTable.id,
-					width: contentWidth,
-					height: 290,
-					skipMask: true,
-					displayDensity: 'compact',
-					fontSize: 'small'
+                        url: '..',
+                        el: 'plugin-' + dashboardItem.id,
+                        id: dashboardItem.reportTable.id,
+                        width: contentWidth,
+                        height: 290,
+                        dashboard: true,
+                        crossDomain: false,
+                        skipMask: true,
+                        displayDensity: 'compact',
+                        fontSize: 'small'
 				    });
 				}
 				else if ( "eventReport" == dashboardItem.type )
 				{
 				    $d.append( $.tmpl( dhis2.db.tmpl.reportTableItem, { "itemId": dashboardItem.id, "id": dashboardItem.reportTable.id, "name": dashboardItem.reportTable.name,
 					"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share_interpretation, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) );
-		
+
 				    DHIS.getEventReport({
-					url: '..',
-					el: 'plugin-' + dashboardItem.id,
-					id: dashboardItem.reportTable.id,
-					width: contentWidth - scrollbarWidth,
-					height: 290,
-					skipMask: true,
-					displayDensity: 'compact',
-					fontSize: 'small'
+                        url: '..',
+                        el: 'plugin-' + dashboardItem.id,
+                        id: dashboardItem.reportTable.id,
+                        width: contentWidth - scrollbarWidth,
+                        height: 290,
+                        dashboard: true,
+                        crossDomain: false,
+                        skipMask: true,
+                        displayDensity: 'compact',
+                        fontSize: 'small'
 				    });
 				}
 				else if ( "users" == dashboardItem.type )
@@ -536,14 +543,14 @@
 				    dhis2.db.renderMessagesItem( $d, dashboardItem.id );
 				}
 		    } );
-	
+
 		    dhis2.db.renderLastDropItem( $d );
 		}
 		else
 		{
 		    $d.append( $.tmpl( dhis2.db.tmpl.dashboardIntro, { "i18n_add": i18n_add_stuff_by_searching, "i18n_arrange": i18n_arrange_dashboard_by_dragging_and_dropping } ) );
 		}
-	
+
 		dhis2.db.dashboardReady( id );
     } );
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-01-06 14:19:20 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-01-12 15:50:34 +0000
@@ -3309,8 +3309,8 @@
 	applyCss = function() {
 
         // chart tips css
-        var css = '.dv-chart-tips { border-radius: 2px; padding: 0px 3px 1px; border: 2px solid #000; background-color: #000; } \n';
-        css += '.dv-chart-tips .x-tip-body { background-color: #000; font-size: 13px; font-weight: normal; color: #fff; -webkit-text-stroke: 0; } \n';
+        var css = '.dv-chart-tips { border-radius: 2px; padding: 2px 3px 0; border: 0 none; background-color: #222; } \n';
+        css += '.dv-chart-tips .x-tip-body { background-color: #222; font-size: 13px; font-weight: normal; color: #fff; -webkit-text-stroke: 0; } \n';
         css += '.dv-chart-tips .x-tip-body div { font-family: arial,sans-serif,ubuntu,consolas !important; } \n';
 
         // load mask css

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-01-12 14:25:23 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-01-12 16:09:26 +0000
@@ -1550,7 +1550,7 @@
                     if (window && !window.isVisible()) {
                         window.show();
                     }
-                    else {
+                    else if (!window) {
                         var layers = gis.util.map.getRenderedVectorLayers().reverse(),
                             xy = Ext.get(olmap.buttonControls[0].div).getAnchorXY(),
                             html = '<div id="legendWrapper">';
@@ -1563,33 +1563,28 @@
 
                         html += '</div>';
 
-                        if (window) {
-                            window.show();
-                        }
-                        else {
-                            window = Ext.create('Ext.window.Window', {
-                                title: 'Legend',
-                                cls: 'gis-plugin',
-                                bodyStyle: 'background-color: #fff; padding: 3px',
-                                width: 100,
-                                height: 100,
-                                html: html,
-                                preventHeader: true,
-                                shadow: false,
-                                listeners: {
-                                    show: function() {
-                                        var el = this.getEl(),
-                                            legendEl = el.first().first();
-
-                                        el.setStyle('opacity', 0.92);
-
-                                        this.setHeight(legendEl.getHeight() + 8);
-
-                                        this.setPosition(xy[0] - this.getWidth(), xy[1]);
-                                    }
+                        window = Ext.create('Ext.window.Window', {
+                            title: 'Legend',
+                            cls: 'gis-plugin',
+                            bodyStyle: 'background-color: #fff; padding: 3px',
+                            width: 100,
+                            height: 100,
+                            html: html,
+                            preventHeader: true,
+                            shadow: false,
+                            listeners: {
+                                show: function() {
+                                    var el = this.getEl(),
+                                        legendEl = el.first().first();
+
+                                    el.setStyle('opacity', 0.92);
+
+                                    this.setHeight(legendEl.getHeight() + 8);
+
+                                    this.setPosition(xy[0] - this.getWidth(), xy[1] - 1);
                                 }
-                            });
-                        }
+                            }
+                        });
                     }
                 });
 
@@ -6417,8 +6412,6 @@
 
                     // legends
                     if (view.legendSet) {
-                        var divStyle;
-
                         for (var i = 0; i < this.classification.bins.length; i++) {
                             child = document.createElement("div");
                             child.style.fontSize = style.fontSize;
@@ -6441,7 +6434,8 @@
                             child.style.clear = "left";
                             element.appendChild(child);
                         }
-                    } else {
+                    }
+                    else {
                         for (var i = 0; i < this.classification.bins.length; i++) {
                             child = document.createElement("div");
                             child.style.backgroundColor = this.colorInterpolation[i].toHexString();
@@ -6534,9 +6528,6 @@
                 init.systemInfo.dateFormat = Ext.isString(systemSettings.keyDateFormat) ? systemSettings.keyDateFormat.toLowerCase() : 'yyyy-mm-dd';
                 init.systemInfo.calendar = systemSettings.keyCalendar;
 
-                // optionSetsConfig
-
-
                 // user-account
                 userAccountConfig = {
                     url: init.contextPath + '/api/me/user-account.' + type,
@@ -6544,115 +6535,123 @@
                     success: function (r) {
                         init.userAccount = r.responseText ? Ext.decode(r.responseText) : r;
 
-                        Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/jQuery/jquery.min.js', function () {
-                            Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.util.js', function () {
-                                Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.js', function () {
-                                    Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js', function () {
-                                        Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js', function () {
-                                            Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js', function () {
-
-                                                // init
-                                                var defaultKeyUiLocale = 'en',
-                                                    defaultKeyAnalysisDisplayProperty = 'name',
-                                                    namePropertyUrl,
-                                                    contextPath,
-                                                    keyUiLocale,
-                                                    dateFormat,
-                                                    optionSetVersionConfig;
-
-                                                init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
-                                                init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
-
-                                                // local vars
-                                                contextPath = init.contextPath;
-                                                keyUiLocale = init.userAccount.settings.keyUiLocale;
-                                                keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
-                                                namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
-                                                dateFormat = init.systemInfo.dateFormat;
-
-                                                init.namePropertyUrl = namePropertyUrl;
-
-                                                // dhis2
-                                                dhis2.util.namespace('dhis2.gis');
-
-                                                dhis2.gis.store = dhis2.gis.store || new dhis2.storage.Store({
-                                                    name: 'dhis2',
-                                                    adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
-                                                    objectStores: ['optionSets']
+                        var onScriptReady = function() {
+                            var defaultKeyUiLocale = 'en',
+                                defaultKeyAnalysisDisplayProperty = 'name',
+                                namePropertyUrl,
+                                contextPath,
+                                keyUiLocale,
+                                dateFormat,
+                                optionSetVersionConfig;
+
+                            init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
+                            init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+
+                            // local vars
+                            contextPath = init.contextPath;
+                            keyUiLocale = init.userAccount.settings.keyUiLocale;
+                            keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
+                            namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+                            dateFormat = init.systemInfo.dateFormat;
+
+                            init.namePropertyUrl = namePropertyUrl;
+
+                            // dhis2
+                            dhis2.util.namespace('dhis2.gis');
+
+                            dhis2.gis.store = dhis2.gis.store || new dhis2.storage.Store({
+                                name: 'dhis2',
+                                adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
+                                objectStores: ['optionSets']
+                            });
+
+                            optionSetVersionConfig = {
+                                url: contextPath + '/api/optionSets.' + type + '?fields=id,version&paging=false',
+                                disableCaching: false,
+                                success: function (r) {
+                                    var optionSets = (r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets) || [],
+                                        store = dhis2.gis.store,
+                                        ids = [],
+                                        url = '',
+                                        callbacks = 0,
+                                        checkOptionSet,
+                                        updateStore,
+                                        optionSetConfig;
+
+                                    optionSetConfig = {
+                                        url: contextPath + '/api/optionSets.' + type + '?fields=id,name,version,options[code,name]&paging=false' + url,
+                                        disableCaching: false,
+                                        success: function (r) {
+                                            var sets = r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets;
+
+                                            store.setAll('optionSets', sets).done(fn);
+                                        }
+                                    };
+
+                                    updateStore = function () {
+                                        if (++callbacks === optionSets.length) {
+                                            if (!ids.length) {
+                                                fn();
+                                                return;
+                                            }
+
+                                            for (var i = 0; i < ids.length; i++) {
+                                                url += '&filter=id:eq:' + ids[i];
+                                            }
+
+                                            if (type === 'jsonp') {
+                                                Ext.data.JsonP.request(optionSetConfig);
+                                            } else {
+                                                Ext.Ajax.request(optionSetConfig);
+                                            }
+                                        }
+                                    };
+
+                                    registerOptionSet = function (optionSet) {
+                                        store.get('optionSets', optionSet.id).done(function (obj) {
+                                            if (!Ext.isObject(obj) || obj.version !== optionSet.version) {
+                                                ids.push(optionSet.id);
+                                            }
+
+                                            updateStore();
+                                        });
+                                    };
+
+                                    store.open().done(function () {
+                                        for (var i = 0; i < optionSets.length; i++) {
+                                            registerOptionSet(optionSets[i]);
+                                        }
+                                    });
+                                }
+                            };
+
+                            // option sets
+                            if (type === 'jsonp') {
+                                Ext.data.JsonP.request(optionSetVersionConfig);
+                            } else {
+                                Ext.Ajax.request(optionSetVersionConfig);
+                            }
+                        };
+
+                        // init
+                        if (config.dashboard) {
+                            onScriptReady();
+                        }
+                        else {
+                            Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/jQuery/jquery.min.js', function () {
+                                Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.util.js', function () {
+                                    Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.js', function () {
+                                        Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js', function () {
+                                            Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js', function () {
+                                                Ext.Loader.injectScriptElement(init.contextPath + '/dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js', function () {
+                                                    onScriptReady();
                                                 });
-
-                                                optionSetVersionConfig = {
-                                                    url: contextPath + '/api/optionSets.' + type + '?fields=id,version&paging=false',
-                                                    disableCaching: false,
-                                                    success: function (r) {
-                                                        var optionSets = (r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets) || [],
-                                                            store = dhis2.gis.store,
-                                                            ids = [],
-                                                            url = '',
-                                                            callbacks = 0,
-                                                            checkOptionSet,
-                                                            updateStore,
-                                                            optionSetConfig;
-
-                                                        optionSetConfig = {
-                                                            url: contextPath + '/api/optionSets.' + type + '?fields=id,name,version,options[code,name]&paging=false' + url,
-                                                            disableCaching: false,
-                                                            success: function (r) {
-                                                                var sets = r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets;
-
-                                                                store.setAll('optionSets', sets).done(fn);
-                                                            }
-                                                        };
-
-                                                        updateStore = function () {
-                                                            if (++callbacks === optionSets.length) {
-                                                                if (!ids.length) {
-                                                                    fn();
-                                                                    return;
-                                                                }
-
-                                                                for (var i = 0; i < ids.length; i++) {
-                                                                    url += '&filter=id:eq:' + ids[i];
-                                                                }
-
-                                                                if (type === 'jsonp') {
-                                                                    Ext.data.JsonP.request(optionSetConfig);
-                                                                } else {
-                                                                    Ext.Ajax.request(optionSetConfig);
-                                                                }
-                                                            }
-                                                        };
-
-                                                        registerOptionSet = function (optionSet) {
-                                                            store.get('optionSets', optionSet.id).done(function (obj) {
-                                                                if (!Ext.isObject(obj) || obj.version !== optionSet.version) {
-                                                                    ids.push(optionSet.id);
-                                                                }
-
-                                                                updateStore();
-                                                            });
-                                                        };
-
-                                                        store.open().done(function () {
-                                                            for (var i = 0; i < optionSets.length; i++) {
-                                                                registerOptionSet(optionSets[i]);
-                                                            }
-                                                        });
-                                                    }
-                                                };
-
-                                                // option sets
-                                                if (type === 'jsonp') {
-                                                    Ext.data.JsonP.request(optionSetVersionConfig);
-                                                } else {
-                                                    Ext.Ajax.request(optionSetVersionConfig);
-                                                }
                                             });
                                         });
                                     });
                                 });
                             });
-                        });
+                        }
                     }
                 };
 
@@ -7091,8 +7090,8 @@
             applyCss();
 
             init.plugin = true;
-	    init.el = config.el;
-	    init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
+            init.el = config.el;
+            init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
             init.crossDomain = Ext.isBoolean(config.crossDomain) ? config.crossDomain : true;
             init.skipMask = Ext.isBoolean(config.skipMask) ? config.skipMask : false;
             init.skipFade = Ext.isBoolean(config.skipFade) ? config.skipFade : false;