← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14319: PT, optimized requests + GIS, layer opacity.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 14319 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-03-20 15:17:59 +0100
message:
  PT, optimized requests + GIS, layer opacity.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.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-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-03-19 18:42:01 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-03-20 13:11:51 +0000
@@ -176,7 +176,7 @@
 						}
 					}
 
-					if (layout.opacity === 1) {
+					if (layout.opacity === gis.conf.layout.layer.opacity) {
 						delete layout.opacity;
 					}
 
@@ -692,7 +692,7 @@
 			text: null,
 			height: 22,
 			value: false,
-			opacity: 1,
+			opacity: gis.conf.layout.layer.opacity,
 			getValue: function() {
 				return this.checkbox.getValue();
 			},

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-03-14 13:27:22 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-03-20 13:11:51 +0000
@@ -143,7 +143,7 @@
 		});
 		layers.openStreetMap.id = 'openStreetMap';
 
-		layers.event = GIS.core.VectorLayer(gis, 'event', GIS.i18n.event_layer, {opacity: 1});
+		layers.event = GIS.core.VectorLayer(gis, 'event', GIS.i18n.event_layer, {opacity: gis.conf.layout.layer.opacity});
 		layers.event.core = new mapfish.GeoStat.Event(gis.olmap, {
 			layer: layers.event,
 			gis: gis
@@ -155,7 +155,7 @@
 			gis: gis
 		});
 
-		layers.boundary = GIS.core.VectorLayer(gis, 'boundary', GIS.i18n.boundary_layer, {opacity: 1});
+		layers.boundary = GIS.core.VectorLayer(gis, 'boundary', GIS.i18n.boundary_layer, {opacity: gis.conf.layout.layer.opacity});
 		layers.boundary.core = new mapfish.GeoStat.Boundary(gis.olmap, {
 			layer: layers.boundary,
 			gis: gis
@@ -164,7 +164,7 @@
 		for (var i = 0, number; i < layerNumbers.length; i++) {
 			number = layerNumbers[i];
 
-			layers['thematic' + number] = GIS.core.VectorLayer(gis, 'thematic' + number, GIS.i18n.thematic_layer + ' ' + number, {opacity: 1});
+			layers['thematic' + number] = GIS.core.VectorLayer(gis, 'thematic' + number, GIS.i18n.thematic_layer + ' ' + number, {opacity: gis.conf.layout.layer.opacity});
 			layers['thematic' + number].layerCategory = gis.conf.finals.layer.category_thematic,
 			layers['thematic' + number].core = new mapfish.GeoStat['Thematic' + number](gis.olmap, {
 				layer: layers['thematic' + number],
@@ -2229,6 +2229,9 @@
 				},
 				grid: {
 					row_height: 27
+				},
+				layer: {
+					opacity: 0.8
 				}
 			};
 
@@ -2563,7 +2566,7 @@
 
 				// radiusHigh: integer (15)
 
-				// opacity: integer (1) - 0-1
+				// opacity: integer (0.8) - 0-1
 
 				// legendSet: object
 
@@ -2708,7 +2711,7 @@
 					layout.colorHigh = Ext.isString(config.colorHigh) && !Ext.isEmpty(config.colorHigh) ? config.colorHigh : '00ff00';
 					layout.radiusLow = Ext.isNumber(config.radiusLow) && !Ext.isEmpty(config.radiusLow) ? config.radiusLow : 5;
 					layout.radiusHigh = Ext.isNumber(config.radiusHigh) && !Ext.isEmpty(config.radiusHigh) ? config.radiusHigh : 15;
-					layout.opacity = Ext.isNumber(config.opacity) && !Ext.isEmpty(config.opacity) ? config.opacity : 1;
+					layout.opacity = Ext.isNumber(config.opacity) && !Ext.isEmpty(config.opacity) ? config.opacity : gis.conf.layout.layer.opacity;
 					layout.areaRadius = config.areaRadius;
                     layout.hidden = !!config.hidden;
 

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-03-20 11:50:35 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-03-20 14:16:25 +0000
@@ -1034,7 +1034,7 @@
 							this.currentValue = this.getValue();
 
 							var value = this.getValue(),
-								url = value ? ns.core.init.contextPath + '/api/reportTables/query/' + value + '.json?viewClass=sharing&links=false' : null,
+								url = value ? ns.core.init.contextPath + '/api/reportTables/filtered.json?viewClass=sharing&include=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
 								store = ns.app.stores.reportTable;
 
 							store.page = 1;
@@ -2480,7 +2480,6 @@
             },
             loadPage: function(uid, filter, append) {
                 var store = this,
-                    filterPath = filter ? '/query/' + filter : '',
                     path;
 
                 uid = (Ext.isString(uid) || Ext.isNumber(uid)) ? uid : indicatorGroup.getValue();
@@ -2496,10 +2495,10 @@
                 }
 
 				if (Ext.isString(uid)) {
-					path = '/indicatorGroups/' + uid + '/members' + filterPath + '.json';
+					path = '/indicators/filtered.json?include=id,name&filter=indicatorGroups.id:eq:' + uid + (filter ? '&filter=name:like:' + filter : '');
 				}
 				else if (uid === 0) {
-					path = '/indicators' + filterPath + '.json';
+					path = '/indicators/filtered.json?include=id,name' + (filter ? '&filter=name:like:' + filter : '');
 				}
 
 				if (!path) {
@@ -2512,8 +2511,6 @@
                 Ext.Ajax.request({
                     url: ns.core.init.contextPath + '/api' + path,
                     params: {
-                        viewClass: 'basic',
-                        links: 'false',
                         page: store.nextPage,
                         pageSize: 50
                     },
@@ -2522,7 +2519,7 @@
                     },
                     success: function(r) {
                         var response = Ext.decode(r.responseText),
-                            data = response.indicators || [],
+                            data = response.objects || [],
                             pager = response.pager;
 
                         store.loadStore(data, pager, append);
@@ -2616,7 +2613,6 @@
             },
             loadTotalsPage: function(uid, filter, append) {
                 var store = this,
-                    filterPath = filter ? '/query/' + filter : '',
                     path;
 
                 if (store.nextPage === store.lastPage) {
@@ -2624,10 +2620,10 @@
                 }
 
 				if (Ext.isString(uid)) {
-					path = '/dataElementGroups/' + uid + '/members' + filterPath + '.json';
+					path = '/dataElements/filtered.json?include=id,name&filter=dataElementGroups.id:eq:' + uid + (filter ? '&filter=name:like:' + filter : '');
 				}
 				else if (uid === 0) {
-					path = '/dataElements' + filterPath + '.json?domainType=aggregate';
+					path = '/dataElements/filtered.json?include=id,name' + (filter ? '&filter=name:like:' + filter : '');
 				}
 
 				if (!path) {
@@ -2650,7 +2646,7 @@
                     },
                     success: function(r) {
                         var response = Ext.decode(r.responseText),
-                            data = response.dataElements || [],
+                            data = response.objects || [],
                             pager = response.pager;
 
                         store.loadStore(data, pager, append);
@@ -2659,7 +2655,6 @@
             },
 			loadDetailsPage: function(uid, filter, append) {
                 var store = this,
-                    filterPath = filter ? '/query/' + filter : '',
                     path;
 
                 if (store.nextPage === store.lastPage) {
@@ -2667,10 +2662,10 @@
                 }
 
 				if (Ext.isString(uid)) {
-					path = '/dataElementGroups/' + uid + '/operands' + filterPath + '.json';
+					path = '/dataElementGroups/' + uid + '/operands' + (filter ? '/query/' + filter : '') + '.json';
 				}
 				else if (uid === 0) {
-					path = '/generatedDataElementOperands' + filterPath + '.json';
+					path = '/generatedDataElementOperands/filtered.json?include=id,name' + (filter ? '&filter=name:like:' + filter : '');
 				}
 
 				if (!path) {
@@ -2683,8 +2678,6 @@
                 Ext.Ajax.request({
                     url: ns.core.init.contextPath + '/api' + path,
                     params: {
-                        viewClass: 'basic',
-                        links: 'false',
                         page: store.nextPage,
                         pageSize: 50
                     },
@@ -2693,7 +2686,7 @@
                     },
                     success: function(r) {
                         var response = Ext.decode(r.responseText),
-							data = response.dataElementOperands || [],
+							data = response.objects || response.dataElementOperands || [],
                             pager = response.pager;
 
 						//for (var i = 0; i < data.length; i++) {
@@ -2731,10 +2724,10 @@
 			fields: ['id', 'name', 'index'],
 			proxy: {
 				type: 'ajax',
-				url: ns.core.init.contextPath + '/api/dataElementGroups.json?paging=false&links=false',
+				url: ns.core.init.contextPath + '/api/dataElementGroups/filtered.json?include=id,name&paging=false',
 				reader: {
 					type: 'json',
-					root: 'dataElementGroups'
+					root: 'objects'
 				}
 			},
 			listeners: {
@@ -2758,11 +2751,14 @@
 			fields: ['id', 'name'],
 			proxy: {
 				type: 'ajax',
-				url: ns.core.init.contextPath + '/api/dataSets.json?paging=false&links=false',
+				url: ns.core.init.contextPath + '/api/dataSets/filtered.json?include=id,name',
 				reader: {
 					type: 'json',
-					root: 'dataSets'
-				}
+					root: 'objects'
+				},
+				pageParam: false,
+				startParam: false,
+				limitParam: false
 			},
 			storage: {},
 			sortStore: function() {
@@ -2818,13 +2814,15 @@
 				type: 'ajax',
 				reader: {
 					type: 'json',
-					root: 'reportTables'
-				}
+					root: 'objects'
+				},
+				startParam: false,
+				limitParam: false
 			},
 			isLoaded: false,
 			pageSize: 10,
 			page: 1,
-			defaultUrl: ns.core.init.contextPath + '/api/reportTables.json?viewClass=sharing&links=false',
+			defaultUrl: ns.core.init.contextPath + '/api/reportTables/filtered.json?viewClass=sharing&include=id,name,access',
 			loadStore: function(url) {
 				this.proxy.url = url || this.defaultUrl;
 
@@ -2865,11 +2863,14 @@
 			fields: ['id', 'name'],
 			proxy: {
 				type: 'ajax',
-				url: ns.core.init.contextPath + '/api/organisationUnitGroups.json?paging=false&links=false',
+				url: ns.core.init.contextPath + '/api/organisationUnitGroups/filtered.json?include=id,name&paging=false',
 				reader: {
 					type: 'json',
-					root: 'organisationUnitGroups'
-				}
+					root: 'objects'
+				},
+				pageParam: false,
+				startParam: false,
+				limitParam: false
 			}
 		});
 		ns.app.stores.organisationUnitGroup = organisationUnitGroupStore;
@@ -2935,8 +2936,10 @@
             fieldStyle: 'height:22px; border-right:0 none',
             style: 'height:22px',
             onTriggerClick: function() {
-                this.reset();
-                this.onKeyUp();
+				if (this.getValue()) {
+					this.reset();
+					this.onKeyUp();
+				}
             },
             onKeyUp: function() {
                 var value = indicatorGroup.getValue(),
@@ -3169,8 +3172,10 @@
             fieldStyle: 'height:22px; border-right:0 none',
             style: 'height:22px',
             onTriggerClick: function() {
-                this.reset();
-                this.onKeyUp();
+				if (this.getValue()) {
+					this.reset();
+					this.onKeyUp();
+				}
             },
             onKeyUp: function() {
                 var value = dataElementGroup.getValue(),