dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23739
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11555: (GIS) Added url param 'base' with possible options 'false', 'googleStreets', 'googleHybrid', 'ope...
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11555 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-01 16:06:20 +0300
message:
(GIS) Added url param 'base' with possible options 'false', 'googleStreets', 'googleHybrid', 'openStreetMap'
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
--
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 2013-07-22 15:03:42 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-08-01 12:56:35 +0000
@@ -593,6 +593,11 @@
this.numberField.disable();
this.layer.setVisibility(false);
},
+ enableItem: function() {
+ this.checkbox.setValue(true);
+ this.numberField.enable();
+ this.layer.setVisibility(true);
+ },
updateItem: function(value) {
this.numberField.setDisabled(!value);
this.layer.setVisibility(value);
@@ -935,6 +940,7 @@
renderTo: 'layerItems',
layout: 'fit',
cls: 'gis-container-inner',
+ layerItems: items,
items: {
cls: 'gis-container-inner',
items: items
@@ -4936,6 +4942,7 @@
eastRegion,
downloadButton,
interpretationButton,
+ layersPanel,
resizeButton,
viewport,
onRender,
@@ -5120,15 +5127,20 @@
preventHeader: true,
collapsible: true,
collapseMode: 'mini',
- items: [
- {
+ items: function() {
+ var a = [];
+
+ layersPanel = GIS.app.LayersPanel();
+
+ a.push({
title: GIS.i18n.layer_stack_transparency,
bodyStyle: 'padding: 4px 6px 3px',
- items: GIS.app.LayersPanel(),
+ items: layersPanel,
collapsible: true,
animCollapse: false
- },
- {
+ });
+
+ a.push({
title: GIS.i18n.thematic_layer_1_legend,
bodyStyle: 'padding: 4px 6px 6px; border: 0 none',
collapsible: true,
@@ -5139,8 +5151,9 @@
gis.layer.thematic1.legendPanel = this;
}
}
- },
- {
+ });
+
+ a.push({
title: GIS.i18n.thematic_layer_2_legend,
bodyStyle: 'padding: 4px 6px 6px; border: 0 none',
collapsible: true,
@@ -5151,8 +5164,9 @@
gis.layer.thematic2.legendPanel = this;
}
}
- },
- {
+ });
+
+ a.push({
title: GIS.i18n.thematic_layer_3_legend,
bodyStyle: 'padding: 4px 6px 6px; border: 0 none',
collapsible: true,
@@ -5163,8 +5177,9 @@
gis.layer.thematic3.legendPanel = this;
}
}
- },
- {
+ });
+
+ a.push({
title: GIS.i18n.thematic_layer_4_legend,
bodyStyle: 'padding: 4px 6px 6px; border: 0 none',
collapsible: true,
@@ -5175,8 +5190,9 @@
gis.layer.thematic4.legendPanel = this;
}
}
- },
- {
+ });
+
+ a.push({
title: GIS.i18n.facility_layer_legend,
bodyStyle: 'padding: 4px 6px 6px; border: 0 none',
collapsible: true,
@@ -5187,8 +5203,10 @@
gis.layer.facility.legendPanel = this;
}
}
- }
- ],
+ });
+
+ return a;
+ }(),
listeners: {
collapse: function() {
resizeButton.setText('<<<');
@@ -5237,7 +5255,8 @@
});
// Favorite
- var id = gis.util.url.getUrlParam('id');
+ var id = gis.util.url.getUrlParam('id'),
+ base = gis.util.url.getUrlParam('base');
if (id) {
gis.map = {
@@ -5245,6 +5264,41 @@
};
GIS.core.MapLoader(gis).load();
}
+
+ if (base.length) {
+
+ // hide base layer
+ if (base === 'false') {
+ for (var i = 0, item; i < layersPanel.layerItems.length; i++) {
+ item = layersPanel.layerItems[i];
+
+ if (item.layer.layerType === gis.conf.finals.layer.type_base && item.layer.visibility) {
+ item.disableItem();
+ }
+ }
+ }
+ else {
+ var isEnabled = false;
+
+ for (var i = 0, item; i < layersPanel.layerItems.length; i++) {
+ item = layersPanel.layerItems[i];
+
+ if (item.layer.layerType === gis.conf.finals.layer.type_base) {
+ if (base === item.layer.id) {
+ item.enableItem();
+ isEnabled = true;
+ }
+ else {
+ item.disableItem();
+ }
+ }
+ }
+
+ if (!isEnabled) {
+ layersPanel.layerItems[layersPanel.layerItems.length - 1].enableItem();
+ }
+ }
+ }
};
viewport = Ext.create('Ext.container.Viewport', {
@@ -5254,6 +5308,7 @@
centerRegion: centerRegion,
downloadButton: downloadButton,
interpretationButton: interpretationButton,
+ layersPanel: layersPanel,
items: [
centerRegion,
eastRegion
=== 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 2013-06-08 04:23:53 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2013-08-01 12:56:35 +0000
@@ -127,14 +127,11 @@
util.map = {};
util.map.getVisibleVectorLayers = function() {
- var layers = [],
- layer;
+ var layers = [];
- for (var i = 0; i < gis.olmap.layers.length; i++) {
+ for (var i = 0, layer; i < gis.olmap.layers.length; i++) {
layer = gis.olmap.layers[i];
- if (layer.layerType === conf.finals.layer.type_vector &&
- layer.visibility &&
- layer.features.length) {
+ if (layer.layerType === conf.finals.layer.type_vector && layer.visibility && layer.features.length) {
layers.push(layer);
}
}
@@ -1795,7 +1792,8 @@
layers.push(gis.layer.googleStreets, gis.layer.googleHybrid);
}
- layers.push(gis.layer.openStreetMap,
+ layers.push(
+ gis.layer.openStreetMap,
gis.layer.thematic4,
gis.layer.thematic3,
gis.layer.thematic2,