dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08306
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1983: (GIS) Improved code + image export bug fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 1983 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-11-01 18:32:56 +0100
message:
(GIS) Improved code + image export bug fixed.
removed:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js
added:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.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/mapping/index.html'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2010-10-21 15:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2010-10-29 13:02:44 +0000
@@ -87,8 +87,7 @@
<!-- DHIS -->
<script type="text/javascript" src="i18nJavaScript.action"></script>
- <script type="text/javascript" src="script/config.js"></script>
- <script type="text/javascript" src="script/util.js"></script>
+ <script type="text/javascript" src="script/globals.js"></script>
<script type="text/javascript" src="script/index.js"></script>
</body>
=== removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js 2010-10-29 11:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
-var GLOBALS = {};
-
-GLOBALS.conf = {
-
-// Ajax requests
-
- path_mapping: '../',
- path_commons: '../../dhis-web-commons-ajax-json/',
- path_geoserver: '../../../geoserver/',
- type: '.action',
-
- ows: 'ows?service=WMS&request=GetCapabilities',
- wfs: 'wfs?request=GetFeature&typename=',
- output: '&outputformat=json&version=1.0.0',
-
-// Help strings
-
- thematicMap: 'gisThematicMap',
- thematicMap2: 'gisThematicMap2',
- mapRegistration: 'gisMap',
- organisationUnitAssignment: 'gisMapOrganisationUnitRelation',
- overlayRegistration: 'gisOverlay',
- administration: 'gisAdministration',
- favorites: 'gisFavoriteMapView',
- legendSets: 'gisLegendSet',
- pdfprint: 'gisPdfPrint',
-
-// Layout
-
- north_height: 0, // viewport north
- west_width: 270, // viewport west
- gridpanel_width: 270 - 15,
- multiselect_width: 210,
- combo_width: 150,
- combo_width_fieldset: 112,
- combo_list_width_fieldset: 112 + 17,
- combo_number_width: 65,
-
- emptytext: '',
- labelseparator: '',
-
-// Styles
-
- assigned_row_color: '#90ee90',
- unassigned_row_color: '#ffffff',
-
-// DHIS variables
-
- map_source_type_database: 'database',
- map_source_type_geojson: 'geojson',
- map_source_type_shapefile: 'shapefile',
- map_legend_type_automatic: 'automatic',
- map_legend_type_predefined: 'predefined',
- map_layer_type_baselayer: 'baselayer',
- map_layer_type_overlay: 'overlay',
- map_value_type_indicator: 'indicator',
- map_value_type_dataelement: 'dataelement',
- map_date_type_fixed: 'fixed',
- map_date_type_start_end: 'start-end',
- map_selection_type_parent: 'parent',
- map_selection_type_level: 'level',
-
-// MapFish
-
- classify_with_bounds: 1,
- classify_by_equal_intervals: 2,
- classify_by_quantils: 3,
-
-// MapFish print module
-
- layerOverrides: {"World": {overview: true}, Countries: {format: 'image/svg+xml'}},
- printConfigUrl: '../../pdf/info.json'
-};
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-10-29 14:27:36 +0000
@@ -0,0 +1,339 @@
+var GLOBALS = {};
+
+GLOBALS.conf = {
+
+// Ajax requests
+
+ path_mapping: '../',
+ path_commons: '../../dhis-web-commons-ajax-json/',
+ path_geoserver: '../../../geoserver/',
+ type: '.action',
+
+ ows: 'ows?service=WMS&request=GetCapabilities',
+ wfs: 'wfs?request=GetFeature&typename=',
+ output: '&outputformat=json&version=1.0.0',
+
+// Help strings
+
+ thematicMap: 'gisThematicMap',
+ thematicMap2: 'gisThematicMap2',
+ mapRegistration: 'gisMap',
+ organisationUnitAssignment: 'gisMapOrganisationUnitRelation',
+ overlayRegistration: 'gisOverlay',
+ administration: 'gisAdministration',
+ favorites: 'gisFavoriteMapView',
+ legendSets: 'gisLegendSet',
+ pdfprint: 'gisPdfPrint',
+
+// Layout
+
+ north_height: 0, // viewport north
+ west_width: 270, // viewport west
+ gridpanel_width: 270 - 15,
+ multiselect_width: 210,
+ combo_width: 150,
+ combo_width_fieldset: 112,
+ combo_list_width_fieldset: 112 + 17,
+ combo_number_width: 65,
+
+ emptytext: '',
+ labelseparator: '',
+
+// Styles
+
+ assigned_row_color: '#90ee90',
+ unassigned_row_color: '#ffffff',
+
+// DHIS variables
+
+ map_source_type_database: 'database',
+ map_source_type_geojson: 'geojson',
+ map_source_type_shapefile: 'shapefile',
+ map_legend_type_automatic: 'automatic',
+ map_legend_type_predefined: 'predefined',
+ map_layer_type_baselayer: 'baselayer',
+ map_layer_type_overlay: 'overlay',
+ map_value_type_indicator: 'indicator',
+ map_value_type_dataelement: 'dataelement',
+ map_date_type_fixed: 'fixed',
+ map_date_type_start_end: 'start-end',
+ map_selection_type_parent: 'parent',
+ map_selection_type_level: 'level',
+
+// MapFish
+
+ classify_with_bounds: 1,
+ classify_by_equal_intervals: 2,
+ classify_by_quantils: 3
+};
+
+GLOBALS.util = {
+
+ /* Detect mapview parameter in URL */
+ getUrlParam: function(strParam) {
+ var output = '';
+ var strHref = window.location.href;
+ if (strHref.indexOf('?') > -1 ) {
+ var strQueryString = strHref.substr(strHref.indexOf('?')).toLowerCase();
+ var aQueryString = strQueryString.split('&');
+ for (var iParam = 0; iParam < aQueryString.length; iParam++) {
+ if (aQueryString[iParam].indexOf(strParam.toLowerCase() + '=') > -1) {
+ var aParam = aQueryString[iParam].split('=');
+ output =aParam[1];
+ break;
+ }
+ }
+ }
+ return unescape(output);
+ },
+
+ /* Get all properties in an object */
+ getKeys: function(obj) {
+ var temp = [];
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ temp.push(k);
+ }
+ }
+ return temp;
+ },
+
+ /* Input validation */
+ validateInputNameLength: function(name) {
+ return (name.length <= 25);
+ },
+
+ /* Decide multiselect height based on screen resolution */
+ getMultiSelectHeight: function() {
+ var h = screen.height;
+ return h <= 800 ? 220 :
+ h <= 1050 ? 310 :
+ h <= 1200 ? 470 : 900;
+ },
+
+ getGridPanelHeight: function() {
+ var h = screen.height;
+ return h <= 800 ? 180 :
+ h <= 1050 ? 480 :
+ h <= 1200 ? 600 : 900;
+ },
+
+ /* Make map view numbers numeric */
+ getNumericMapView: function(mapView) {
+ mapView.id = parseFloat(mapView.id);
+ mapView.indicatorGroupId = parseFloat(mapView.indicatorGroupId);
+ mapView.indicatorId = parseFloat(mapView.indicatorId);
+ mapView.periodId = parseFloat(mapView.periodId);
+ mapView.method = parseFloat(mapView.method);
+ mapView.classes = parseFloat(mapView.classes);
+ mapView.mapLegendSetId = parseFloat(mapView.mapLegendSetId);
+ mapView.longitude = parseFloat(mapView.longitude);
+ mapView.latitude = parseFloat(mapView.latitude);
+ mapView.zoom = parseFloat(mapView.zoom);
+ return mapView;
+ },
+
+ /* Get number of decimals */
+ getNumberOfDecimals: function(x,dec_sep) {
+ var tmp = new String();
+ tmp = x;
+ return tmp.indexOf(dec_sep) > -1 ? tmp.length-tmp.indexOf(dec_sep) - 1 : 0;
+ },
+
+ /* Feature labels */
+ labels: {
+ getActivatedOpenLayersStyleMap: function() {
+ return new OpenLayers.StyleMap({
+ 'default' : new OpenLayers.Style(
+ OpenLayers.Util.applyDefaults({
+ 'fillOpacity': 1,
+ 'strokeColor': '#222222',
+ 'strokeWidth': 1,
+ 'label': '${labelString}',
+ 'fontFamily': 'arial,lucida sans unicode',
+ 'fontWeight': 'bold',
+ 'fontSize': 14
+ },
+ OpenLayers.Feature.Vector.style['default'])
+ ),
+ 'select': new OpenLayers.Style({
+ 'strokeColor': '#000000',
+ 'strokeWidth': 2,
+ 'cursor': 'pointer'
+ })
+ });
+ },
+ getDeactivatedOpenLayersStyleMap: function() {
+ return new OpenLayers.StyleMap({
+ 'default': new OpenLayers.Style(
+ OpenLayers.Util.applyDefaults({
+ 'fillOpacity': 1,
+ 'strokeColor': '#222222',
+ 'strokeWidth': 1
+ },
+ OpenLayers.Feature.Vector.style['default'])
+ ),
+ 'select': new OpenLayers.Style({
+ 'strokeColor': '#000000',
+ 'strokeWidth': 2,
+ 'cursor': 'pointer'
+ })
+ });
+ }
+ },
+
+ toggleFeatureLabels: function(widget) {
+ function activateLabels(scope) {
+ widget.layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
+ widget.labels = true;
+ }
+ function deactivateLabels(scope) {
+ widget.layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
+ widget.labels = false;
+ }
+
+ if (widget.labels) {
+ deactivateLabels(this);
+ }
+ else {
+ activateLabels(this);
+ }
+
+ widget.applyValues();
+ },
+
+ toggleFeatureLabelsAssignment: function() {
+ function activateLabels(scope) {
+ mapping.layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
+ mapping.labels = true;
+ }
+ function deactivateLabels(scope) {
+ mapping.layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
+ mapping.labels = false;
+ }
+
+ if (mapping.labels) {
+ deactivateLabels(this);
+ }
+ else {
+ activateLabels(this);
+ }
+
+ mapping.classify(false, true);
+ },
+
+ /* Sort values */
+ sortByValue: function(a,b) {
+ return b.value-a.value;
+ },
+
+ /* Create JSON for map export */
+ getExportDataValueJSON: function(mapValues) {
+ var json = '{';
+ json += '"datavalues": ';
+ json += '[';
+ mapValues.sort(this.sortByValue);
+ for (var i = 0; i < mapValues.length; i++) {
+ json += '{';
+ json += '"organisation": "' + mapValues[i].orgUnitId + '",';
+ json += '"value": "' + mapValues[i].value + '" ';
+ json += i < mapValues.length - 1 ? '},' : '}';
+ }
+ json += ']';
+ json += '}';
+ return json;
+ },
+
+ getLegendsJSON: function() {
+ var widget = GLOBALS.vars.activePanel == GLOBALS.conf.thematicMap ? choropleth : proportionalSymbol;
+ var json = '{';
+ json += '"legends":';
+ json += '[';
+ for(var i = 0; i < widget.imageLegend.length; i++) {
+ json += '{';
+ json += '"label": "' + widget.imageLegend[i].label + '",';
+ json += '"color": "' + widget.imageLegend[i].color + '" ';
+ json += i < widget.imageLegend.length-1 ? '},' : '}';
+ }
+ json += ']';
+ json += '}';
+ return json;
+ }
+};
+
+GLOBALS.vars = {
+
+ map: null,
+
+ mapSourceType: {
+ value: null,
+ setDatabase: function() {
+ this.value = GLOBALS.conf.map_source_type_database;
+ },
+ setGeojson: function() {
+ this.value = GLOBALS.conf.map_source_type_geojson;
+ },
+ setShapefile: function() {
+ this.value = GLOBALS.conf.map_source_type_shapefile;
+ },
+ isDatabase: function() {
+ return this.value == GLOBALS.conf.map_source_type_database;
+ },
+ isGeojson: function() {
+ return this.value == GLOBALS.conf.map_source_type_geojson;
+ },
+ isShapefile: function() {
+ return this.value == GLOBALS.conf.map_source_type_shapefile;
+ }
+ },
+
+ mapDateType: {
+ value: null,
+ setFixed: function() {
+ this.value = GLOBALS.conf.map_date_type_fixed;
+ },
+ setStartEnd: function() {
+ this.value = GLOBALS.conf.map_date_type_start_end;
+ },
+ isFixed: function() {
+ return this.value == GLOBALS.conf.map_date_type_fixed;
+ },
+ isStartEnd: function() {
+ return this.value == GLOBALS.conf.map_date_type_start_end;
+ }
+ },
+
+ parameter: null,
+
+ activePanel: {
+ value: null,
+ setPolygon: function() {
+ this.value = GLOBALS.conf.thematicMap;
+ },
+ setPoint: function() {
+ this.value = GLOBALS.conf.thematicMap2;
+ },
+ setAssignment: function() {
+ this.value = GLOBALS.conf.organisationUnitAssignment;
+ },
+ isPolygon: function() {
+ return this.value == GLOBALS.conf.thematicMap;
+ },
+ isPoint: function() {
+ return this.value == GLOBALS.conf.thematicMap2;
+ },
+ isAssignment: function() {
+ return this.value == GLOBALS.conf.organisationUnitAssignment;
+ }
+ },
+
+ mask: null,
+
+ exportValues: null,
+
+ topLevelUnit: null,
+
+ locateFeatureWindow: null,
+
+ selectFeatureWindow: null
+};
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-10-29 11:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-10-29 15:44:14 +0000
@@ -1,40 +1,15 @@
-/* OpenLayers map */
-var MAP;
-/* Geojson, shapefile or database */
-var MAPSOURCE;
-/* Fixed periods or from-to dates */
-var MAPDATETYPE;
-/* Active mapview id parameter from URL */
-var PARAMETER;
-/* Current expanded accordion panel */
-var ACTIVEPANEL;
-/* Mask */
-var MASK;
-/* Legend colors for export */
-var COLORINTERPOLATION;
-/* Export values */
-var EXPORTVALUES;
-/* Global chart for show/hide */
-var CHART;
-/* Top level organisation unit */
-var TOPLEVELUNIT;
-/* Locate feature window */
-var lfw;
-/* Feature popup */
-var selectFeaturePopup;
-
-Ext.onReady( function() {
+Ext.onReady( function() {
Ext.BLANK_IMAGE_URL = '../resources/ext-ux/theme/gray-extend/gray-extend/s.gif';
- /* Ext 3.2.0 override */
+ /* Ext 3.2.0 overrides */
Ext.override(Ext.form.Field,{showField:function(){this.show();this.container.up('div.x-form-item').setDisplayed(true);},hideField:function(){this.hide();this.container.up('div.x-form-item').setDisplayed(false);}});
/* Disallow right clicks */
document.body.oncontextmenu = function(){return false;};
/* Activate tooltip */
Ext.QuickTips.init();
- MAP = new OpenLayers.Map({controls:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]});
- MASK = new Ext.LoadMask(Ext.getBody(),{msg:i18n_loading,msgCls:'x-mask-loading2'});
- PARAMETER = GLOBALS.util.getUrlParam('view') !== '' ? {id: GLOBALS.util.getUrlParam('view')} : false;
+ GLOBALS.vars.map = new OpenLayers.Map({controls:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]});
+ GLOBALS.vars.mask = new Ext.LoadMask(Ext.getBody(),{msg:i18n_loading,msgCls:'x-mask-loading2'});
+ GLOBALS.vars.parameter = GLOBALS.util.getUrlParam('view') !== '' ? {id: GLOBALS.util.getUrlParam('view')} : false;
/* Base layers */
function addBaseLayersToMap() {
@@ -51,17 +26,17 @@
{layers: 'basic'}
);
- MAP.addLayers([baseLayer]);
- MAP.layers[0].setVisibility(false);
+ GLOBALS.vars.map.addLayers([baseLayer]);
+ GLOBALS.vars.map.layers[0].setVisibility(false);
var mapLayers = Ext.util.JSON.decode(r.responseText).mapLayers;
if (mapLayers.length > 0) {
for (var i = 0; i < mapLayers.length; i++) {
- MAP.addLayers([
+ GLOBALS.vars.map.addLayers([
new OpenLayers.Layer.WMS(mapLayers[i].name, mapLayers[i].mapSource, {layers: mapLayers[i].layer})
]);
- MAP.layers[MAP.layers.length-1].setVisibility(false);
+ GLOBALS.vars.map.layers[GLOBALS.vars.map.layers.length-1].setVisibility(false);
}
}
}
@@ -72,15 +47,15 @@
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'getMapView' + GLOBALS.conf.type,
method: 'GET',
- params: {id: PARAMETER.id || 0},
+ params: {id: GLOBALS.vars.parameter.id || 0},
success: function(r) {
var mv = Ext.util.JSON.decode(r.responseText).mapView[0];
- if (PARAMETER) {
+ if (GLOBALS.vars.parameter) {
if (!mv.id) {
- PARAMETER = false;
+ GLOBALS.vars.parameter = false;
}
else {
- PARAMETER.mapView = mv;
+ GLOBALS.vars.parameter.mapView = mv;
}
}
@@ -89,13 +64,13 @@
method: 'GET',
success: function(r) {
var us = Ext.util.JSON.decode(r.responseText);
- MAPSOURCE = PARAMETER ? PARAMETER.mapView.mapSourceType : us.mapSource;
- MAPDATETYPE = PARAMETER ? PARAMETER.mapView.mapDateType : us.mapDateType;
+ GLOBALS.vars.mapSourceType.value = GLOBALS.vars.parameter ? GLOBALS.vars.parameter.mapView.mapSourceType : us.mapSource;
+ GLOBALS.vars.mapDateType.value = GLOBALS.vars.parameter ? GLOBALS.vars.parameter.mapView.mapDateType : us.mapDateType;
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'setMapUserSettings' + GLOBALS.conf.type,
method: 'POST',
- params: {mapSourceType: MAPSOURCE, mapDateType: MAPDATETYPE},
+ params: {mapSourceType: GLOBALS.vars.mapSourceType.value, mapDateType: GLOBALS.vars.mapDateType.value},
success: function() {
/* Section: stores */
@@ -422,13 +397,13 @@
var formValues;
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
if (!choropleth.validateForm(true)) {
return;
}
formValues = choropleth.getFormValues();
}
- else if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ else if (GLOBALS.vars.activePanel.isPoint()) {
if (!proportionalSymbol.validateForm(true)) {
return;
}
@@ -667,14 +642,14 @@
text: i18n_export_image,
handler: function() {
var vcb, dcb, mcb, lcb, period;
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
vcb = Ext.getCmp('mapvaluetype_cb').getValue() == GLOBALS.conf.map_value_type_indicator ? Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
- dcb = MAPDATETYPE == GLOBALS.conf.map_date_type_fixed ? Ext.getCmp('period_cb').getValue() : Ext.getCmp('startdate_df').getValue() && Ext.getCmp('startdate_df').getValue() ? true : false;
- period = MAPDATETYPE == GLOBALS.conf.map_date_type_fixed ? Ext.getCmp('period_cb').getRawValue() : new Date(Ext.getCmp('startdate_df').getRawValue()).format('Y M j') + ' - ' + new Date(Ext.getCmp('enddate_df').getRawValue()).format('Y M j');
- mcb = MAPSOURCE == GLOBALS.conf.map_source_type_database ? Ext.getCmp('map_tf').getValue() : Ext.getCmp('map_cb').getValue();
+ dcb = GLOBALS.vars.mapDateType.isFixed() ? Ext.getCmp('period_cb').getValue() : Ext.getCmp('startdate_df').getValue() && Ext.getCmp('startdate_df').getValue() ? true : false;
+ period = GLOBALS.vars.mapDateType.isFixed() ? Ext.getCmp('period_cb').getRawValue() : new Date(Ext.getCmp('startdate_df').getRawValue()).format('Y M j') + ' - ' + new Date(Ext.getCmp('enddate_df').getRawValue()).format('Y M j');
+ mcb = GLOBALS.vars.mapSourceType.isDatabase() ? Ext.getCmp('map_tf').getValue() : Ext.getCmp('map_cb').getValue();
lcb = Ext.getCmp('maplegendtype_cb').getValue() == GLOBALS.conf.map_legend_type_automatic ? true : Ext.getCmp('maplegendset_cb').getValue() ? true : false;
}
- else if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ else if (GLOBALS.vars.activePanel.isPoint()) {
Ext.message.msg(false, 'Please use <span class="x-msg-hl">polygon layer</span> for printing');
return;
}
@@ -772,18 +747,18 @@
text: i18n_export_excel,
handler: function() {
var indicatorOrDataElement, period, mapOrOrganisationUnit;
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
indicatorOrDataElement = Ext.getCmp('mapvaluetype_cb').getValue() == GLOBALS.conf.map_value_type_indicator ?
Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
period = Ext.getCmp('period_cb').getValue();
- mapOrOrganisationUnit = MAPSOURCE == GLOBALS.conf.map_source_type_database ?
+ mapOrOrganisationUnit = GLOBALS.vars.mapSourceType.isDatabase() ?
Ext.getCmp('map_tf').getValue() : Ext.getCmp('map_cb').getValue();
}
- else if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ else if (GLOBALS.vars.activePanel.isPoint()) {
indicatorOrDataElement = Ext.getCmp('mapvaluetype_cb2').getValue() == GLOBALS.conf.map_value_type_indicator ?
Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue();
period = Ext.getCmp('period_cb2').getValue();
- mapOrOrganisationUnit = MAPSOURCE == GLOBALS.conf.map_source_type_database ?
+ mapOrOrganisationUnit = GLOBALS.vars.mapSourceType.isDatabase() ?
Ext.getCmp('map_tf2').getValue() : Ext.getCmp('map_cb2').getValue();
}
@@ -809,7 +784,7 @@
document.getElementById('periodField').value = period;
document.getElementById('indicatorField').value = indicator;
document.getElementById('legendsField').value = GLOBALS.util.getLegendsJSON();
- document.getElementById('dataValuesField').value = EXPORTVALUES;
+ document.getElementById('dataValuesField').value = GLOBALS.vars.exportValues;
exportForm.submit();
}
@@ -1560,7 +1535,7 @@
fn: function() {
var mlp = Ext.getCmp('maplayerpathwms_tf').getValue();
- if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile && mlp) {
+ if (GLOBALS.vars.mapSourceType.isShapefile() && mlp) {
Ext.Ajax.request({
url: GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + mlp + GLOBALS.conf.output,
method: 'POST',
@@ -1747,11 +1722,11 @@
var url;
var params = {};
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson) {
+ if (GLOBALS.vars.mapSourceType.isGeojson()) {
url = GLOBALS.conf.path_mapping + 'getGeoJsonFromFile' + GLOBALS.conf.type;
params.name = cb.getValue();
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ else if (GLOBALS.vars.mapSourceType.isShapefile()) {
url = GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + mlp + GLOBALS.conf.output;
}
@@ -1891,7 +1866,7 @@
listeners: {
expand: {
fn: function() {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ if (GLOBALS.vars.mapSourceType.isShapefile()) {
mapLayerPathComboBox.hide();
mapLayerPathWMSTextField.show();
}
@@ -1900,12 +1875,12 @@
mapLayerPathWMSTextField.hide();
}
- ACTIVEPANEL = GLOBALS.conf.mapRegistration;
+ GLOBALS.vars.activePanel.value = GLOBALS.conf.mapRegistration;
}
},
collapse: {
fn: function() {
- ACTIVEPANEL = false;
+ GLOBALS.vars.activePanel.value = null;
}
}
}
@@ -2040,7 +2015,7 @@
}
});
- MAP.getLayersByName(mln)[0].destroy();
+ GLOBALS.vars.map.getLayersByName(mln)[0].destroy();
}
});
@@ -2087,7 +2062,7 @@
return;
}
- var ms = MAPSOURCE == GLOBALS.conf.map_source_type_shapefile ? mlwmso : mlmsf;
+ var ms = GLOBALS.vars.mapSourceType.isShapefile() ? mlwmso : mlmsf;
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'addOrUpdateMapLayer' + GLOBALS.conf.type,
@@ -2097,10 +2072,10 @@
Ext.message.msg(true, 'The overlay <span class="x-msg-hl">' + mln + '</span> '+i18n_was_registered);
GLOBALS.stores.overlay.load();
- var mapurl = MAPSOURCE == GLOBALS.conf.map_source_type_shapefile ?
+ var mapurl = GLOBALS.vars.mapSourceType.isShapefile() ?
GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + mlwmso + GLOBALS.conf.output : GLOBALS.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + mlmsf;
- MAP.addLayer(
+ GLOBALS.vars.map.addLayer(
new OpenLayers.Layer.Vector(mln, {
'visibility': false,
'styleMap': new OpenLayers.StyleMap({
@@ -2181,11 +2156,11 @@
listeners: {
show: {
fn: function() {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson || MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isGeojson() || GLOBALS.vars.mapSourceType.isDatabase()) {
mapLayerMapSourceFileComboBox.show();
mapLayerPathWMSOverlayTextField.hide();
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ else if (GLOBALS.vars.mapSourceType.isShapefile()) {
mapLayerMapSourceFileComboBox.hide();
mapLayerPathWMSOverlayTextField.show();
}
@@ -2225,10 +2200,10 @@
var names = GLOBALS.stores.baseLayer.collect('name');
for (var i = 0; i < names.length; i++) {
- MAP.getLayersByName(names[i])[0].setVisibility(false);
+ GLOBALS.vars.map.getLayersByName(names[i])[0].setVisibility(false);
}
- MAP.getLayersByName(mln)[0].destroy(false);
+ GLOBALS.vars.map.getLayersByName(mln)[0].destroy(false);
}});
}
});
@@ -2275,7 +2250,7 @@
success: function(r) {
Ext.message.msg(true, 'The base layer <span class="x-msg-hl">' + mlbn + '</span> ' + i18n_was_registered);
GLOBALS.stores.baseLayer.load();
- MAP.addLayers([
+ GLOBALS.vars.map.addLayers([
new OpenLayers.Layer.WMS(
mlbn,
mlbu,
@@ -2373,7 +2348,7 @@
minListWidth: GLOBALS.conf.combo_width_fieldset,
mode: 'local',
triggerAction: 'all',
- value: MAPSOURCE,
+ value: GLOBALS.vars.mapSourceType.value,
store: new Ext.data.ArrayStore({
fields: ['id', 'text'],
data: [
@@ -2385,13 +2360,13 @@
listeners: {
'select': {
fn: function(cb) {
- if (MAPSOURCE != cb.getValue()) {
- MAPSOURCE = cb.getValue();
+ if (GLOBALS.vars.mapSourceType.value != cb.getValue()) {
+ GLOBALS.vars.mapSourceType.value = cb.getValue();
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'setMapUserSettings' + GLOBALS.conf.type,
method: 'POST',
- params: {mapSourceType: MAPSOURCE, mapDateType: MAPDATETYPE},
+ params: {mapSourceType: GLOBALS.vars.mapSourceType.value, mapDateType: GLOBALS.vars.mapDateType.value},
success: function(r) {
GLOBALS.stores.map.load();
GLOBALS.stores.mapView.load();
@@ -2401,7 +2376,7 @@
Ext.getCmp('map_cb2').clearValue();
Ext.getCmp('mapview_cb').clearValue();
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
Ext.getCmp('register_chb').disable();
mapping.hide();
shapefilePanel.hide();
@@ -2414,18 +2389,18 @@
shapefilePanel.show();
}
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_start_end) {
- MAPDATETYPE = GLOBALS.conf.map_date_type_fixed;
- Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
+ if (GLOBALS.vars.mapDateType.isStartEnd()) {
+ GLOBALS.vars.mapDateType.setFixed();
+ Ext.getCmp('mapdatetype_cb').setValue(GLOBALS.vars.mapDateType.value);
choropleth.prepareMapViewDateType();
proportionalSymbol.prepareMapViewDateType();
}
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson) {
+ if (GLOBALS.vars.mapSourceType.isGeojson()) {
mapLayerMapSourceFileComboBox.show();
mapLayerPathWMSOverlayTextField.hide();
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ else if (GLOBALS.vars.mapSourceType.isShapefile()) {
mapLayerMapSourceFileComboBox.hide();
mapLayerPathWMSOverlayTextField.show();
}
@@ -2434,10 +2409,10 @@
choropleth.prepareMapViewMap();
proportionalSymbol.prepareMapViewMap();
- if (MAP.layers.length > 2) {
- for (var i = 0; i < MAP.layers.length; i++) {
- if (MAP.layers[i].isOverlay) {
- MAP.removeLayer(MAP.layers[i]);
+ if (GLOBALS.vars.map.layers.length > 2) {
+ for (var i = 0; i < GLOBALS.vars.map.layers.length; i++) {
+ if (GLOBALS.vars.map.layers[i].isOverlay) {
+ GLOBALS.vars.map.removeLayer(GLOBALS.vars.map.layers[i]);
}
}
}
@@ -2508,18 +2483,18 @@
listeners: {
'select': {
fn: function(cb) {
- if (cb.getValue() != MAPDATETYPE) {
- if (cb.getValue() == GLOBALS.conf.map_date_type_start_end && MAPSOURCE != GLOBALS.conf.map_source_type_database) {
+ if (cb.getValue() != GLOBALS.vars.mapDateType.value) {
+ if (cb.getValue() == GLOBALS.conf.map_date_type_start_end && GLOBALS.vars.mapSourceType.value != GLOBALS.conf.map_source_type_database) {
cb.setValue(GLOBALS.conf.map_date_type_fixed);
Ext.message.msg(false, 'Start-end dates require map source <span class="x-msg-hl">' + GLOBALS.conf.map_source_type_database + '</span>');
return;
}
- MAPDATETYPE = cb.getValue();
+ GLOBALS.vars.mapDateType.value = cb.getValue();
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'setMapUserSettings' + GLOBALS.conf.type,
method: 'POST',
- params: {mapSourceType: MAPSOURCE, mapDateType: MAPDATETYPE},
+ params: {mapSourceType: GLOBALS.vars.mapSourceType.value, mapDateType: GLOBALS.vars.mapDateType.value},
success: function() {
Ext.message.msg(true, '<span class="x-msg-hl">' + cb.getRawValue() + '</span> '+i18n_saved_as_date_type);
choropleth.prepareMapViewDateType();
@@ -2537,19 +2512,19 @@
listeners: {
expand: {
fn: function() {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson) {
+ if (GLOBALS.vars.mapSourceType.isGeojson()) {
Ext.getCmp('register_chb').enable();
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ else if (GLOBALS.vars.mapSourceType.isDatabase()) {
Ext.getCmp('register_chb').disable();
}
- ACTIVEPANEL = GLOBALS.conf.administration;
+ GLOBALS.vars.activePanel.value = GLOBALS.conf.administration;
}
},
collapse: {
fn: function() {
- ACTIVEPANEL = false;
+ GLOBALS.vars.activePanel.value = null;
}
}
}
@@ -2588,7 +2563,7 @@
})
});
- MAP.addLayers([choroplethLayer, proportionalSymbolLayer]);
+ GLOBALS.vars.map.addLayers([choroplethLayer, proportionalSymbolLayer]);
function addOverlaysToMap() {
Ext.Ajax.request({
@@ -2599,7 +2574,7 @@
var mapLayers = Ext.util.JSON.decode(r.responseText).mapLayers;
for (var i = 0; i < mapLayers.length; i++) {
- var mapurl = MAPSOURCE == GLOBALS.conf.map_source_type_shapefile ? GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + mapLayers[i].mapSource + GLOBALS.conf.output : GLOBALS.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + mapLayers[i].mapSource;
+ var mapurl = GLOBALS.vars.mapSourceType.isShapefile() ? GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + mapLayers[i].mapSource + GLOBALS.conf.output : GLOBALS.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + mapLayers[i].mapSource;
var fillColor = mapLayers[i].fillColor;
var fillOpacity = parseFloat(mapLayers[i].fillOpacity);
var strokeColor = mapLayers[i].strokeColor;
@@ -2623,17 +2598,17 @@
});
treeLayer.events.register('loadstart', null, function() {
- MASK.msg = i18n_loading;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_loading;
+ GLOBALS.vars.mask.show();
});
treeLayer.events.register('loadend', null, function() {
- MASK.hide();
+ GLOBALS.vars.mask.hide();
});
treeLayer.isOverlay = true;
- MAP.addLayer(treeLayer);
+ GLOBALS.vars.map.addLayer(treeLayer);
}
}
});
@@ -2859,14 +2834,14 @@
listeners: {
'close': {
fn: function() {
- lfw = false;
+ GLOBALS.vars.locateFeatureWindow = false;
layer.redraw();
}
}
}
});
- lfw = locateFeatureWindow;
+ GLOBALS.vars.locateFeatureWindow = locateFeatureWindow;
var vectorLayerOptionsWindow = new Ext.Window({
id: 'vectorlayeroptions_w',
@@ -2906,10 +2881,10 @@
fn: function() {
if (layer.features.length > 0) {
if (layer.name == 'Polygon layer') {
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
GLOBALS.util.toggleFeatureLabels(choropleth);
}
- else if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment) {
+ else if (GLOBALS.vars.activePanel.isAssignment()) {
GLOBALS.util.toggleFeatureLabelsAssignment();
}
else {
@@ -2917,7 +2892,7 @@
}
}
else if (layer.name == 'Point layer') {
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ if (GLOBALS.vars.activePanel.isPoint()) {
GLOBALS.util.toggleFeatureLabels(proportionalSymbol);
}
else {
@@ -3029,13 +3004,13 @@
'click': {
fn: function(n) {
if (n.parentNode.attributes.text == 'Base layers') {
- showWMSLayerOptions(MAP.getLayersByName(n.attributes.layer.name)[0]);
+ showWMSLayerOptions(GLOBALS.vars.map.getLayersByName(n.attributes.layer.name)[0]);
}
else if (n.parentNode.attributes.text == 'Overlays') {
- showVectorLayerOptions(MAP.getLayersByName(n.attributes.layer.name)[0]);
+ showVectorLayerOptions(GLOBALS.vars.map.getLayersByName(n.attributes.layer.name)[0]);
}
else if (n.isLeaf()) {
- showVectorLayerOptions(MAP.getLayersByName(n.attributes.layer)[0]);
+ showVectorLayerOptions(GLOBALS.vars.map.getLayersByName(n.attributes.layer)[0]);
}
}
}
@@ -3075,7 +3050,7 @@
/* Section: widgets */
choropleth = new mapfish.widgets.geostat.Choropleth({
id: 'choropleth',
- map: MAP,
+ map: GLOBALS.vars.map,
layer: choroplethLayer,
title: '<span class="panel-title">' + i18n_polygon_layer + '</span>',
url: 'init',
@@ -3085,9 +3060,9 @@
listeners: {
expand: {
fn: function() {
- if (ACTIVEPANEL != GLOBALS.conf.thematicMap) {
- ACTIVEPANEL = GLOBALS.conf.thematicMap;
- this.layer.setVisibility(false);
+ if (GLOBALS.vars.activePanel.value != GLOBALS.conf.thematicMap) {
+ GLOBALS.vars.activePanel.setPolygon();
+ this.layer.setVisibility(true);
if (this.legend.type == GLOBALS.conf.map_legend_type_predefined) {
this.applyPredefinedLegend();
@@ -3103,7 +3078,7 @@
proportionalSymbol = new mapfish.widgets.geostat.Symbol({
id: 'proportionalsymbol',
- map: MAP,
+ map: GLOBALS.vars.map,
layer: proportionalSymbolLayer,
title: '<span class="panel-title">' + i18n_point_layer + '</span>',
url: 'init',
@@ -3113,8 +3088,8 @@
listeners: {
expand: {
fn: function() {
- if (ACTIVEPANEL != GLOBALS.conf.thematicMap2) {
- ACTIVEPANEL = GLOBALS.conf.thematicMap2;
+ if (GLOBALS.vars.activePanel.value != GLOBALS.conf.thematicMap2) {
+ GLOBALS.vars.activePanel.setPoint();
this.layer.setVisibility(false);
if (this.legend.type == GLOBALS.conf.map_legend_type_predefined) {
@@ -3131,7 +3106,7 @@
mapping = new mapfish.widgets.geostat.Mapping({
id: 'mapping',
- map: MAP,
+ map: GLOBALS.vars.map,
layer: choroplethLayer,
title: '<span class="panel-title">' + i18n_assign_organisation_units_to_map + '</span>',
url: 'init',
@@ -3141,7 +3116,7 @@
listeners: {
expand: {
fn: function() {
- ACTIVEPANEL = GLOBALS.conf.organisationUnitAssignment;
+ GLOBALS.vars.activePanel.setAssignment();
this.layer.setVisibility(false);
proportionalSymbol.layer.setVisibility(false);
this.classify(false, true);
@@ -3160,7 +3135,7 @@
iconCls: 'icon-zoomin',
tooltip: i18n_zoom_in,
handler:function() {
- MAP.zoomIn();
+ GLOBALS.vars.map.zoomIn();
}
});
@@ -3168,7 +3143,7 @@
iconCls: 'icon-zoomout',
tooltip: i18n_zoom_out,
handler:function() {
- MAP.zoomOut();
+ GLOBALS.vars.map.zoomOut();
}
});
@@ -3176,17 +3151,17 @@
iconCls: 'icon-zoommin',
tooltip: i18n_zoom_to_visible_extent,
handler: function() {
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
if (choropleth.layer.getDataExtent()) {
- MAP.zoomToExtent(choropleth.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(choropleth.layer.getDataExtent());
}
else {
Ext.message.msg(false, 'Vector layer is empty');
}
}
- else if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ else if (GLOBALS.vars.activePanel.isPoint()) {
if (proportionalSymbol.layer.getDataExtent()) {
- MAP.zoomToExtent(proportionalSymbol.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(proportionalSymbol.layer.getDataExtent());
}
else {
Ext.message.msg(false, 'Vector layer is empty');
@@ -3248,29 +3223,6 @@
}
});
- var pdfButton = new Ext.Button({
- iconCls: 'icon-pdf',
- tooltip: 'Export map as PDF',
- handler: function() {
- var active = ACTIVEPANEL;
- var printMultiPagePanel = Ext.getCmp('printMultiPage_p');
- if (printMultiPagePanel.hidden) {
- printMultiPagePanel.show();
- printMultiPagePanel.expand();
- }
- else {
- printMultiPagePanel.collapse();
- printMultiPagePanel.hide();
- if (active == GLOBALS.conf.thematicMap) {
- choropleth.expand();
- }
- else if (active == GLOBALS.conf.organisationUnitAssignment) {
- mapping.expand();
- }
- }
- }
- });
-
var predefinedMapLegendSetButton = new Ext.Button({
iconCls: 'icon-predefinedlegendset',
tooltip: i18n_create_predefined_legend_sets,
@@ -3448,7 +3400,7 @@
id: 'center',
height: 1000,
width: 800,
- map: MAP,
+ map: GLOBALS.vars.map,
title: '',
zoom: 3,
tbar: mapToolbar
@@ -3459,16 +3411,16 @@
shapefilePanel.hide();
mapping.hide();
// Ext.getCmp('printMultiPage_p').hide();
- ACTIVEPANEL = GLOBALS.conf.thematicMap;
+ GLOBALS.vars.activePanel.setPolygon();
- MAP.addControl(new OpenLayers.Control.MousePosition({
+ GLOBALS.vars.map.addControl(new OpenLayers.Control.MousePosition({
displayClass: 'void',
div: $('mouseposition'),
prefix: '<span style="color:#666;">x: </span>',
separator: '<br/><span style="color:#666;">y: </span>'
}));
- MAP.addControl(new OpenLayers.Control.OverviewMap({
+ GLOBALS.vars.map.addControl(new OpenLayers.Control.OverviewMap({
div: $('overviewmap'),
size: new OpenLayers.Size(188, 97),
minRectSize: 0,
@@ -3481,7 +3433,7 @@
]
}));
- MAP.addControl(new OpenLayers.Control.ZoomBox());
+ GLOBALS.vars.map.addControl(new OpenLayers.Control.ZoomBox());
function toggleSelectFeatures(e) {
if (GLOBALS.stores.overlay.find('name', e.layer.name) !== -1) {
@@ -3489,12 +3441,12 @@
var visibleOverlays = false;
for (var i = 0; i < names.length; i++) {
- if (MAP.getLayersByName(names[i])[0].visibility) {
+ if (GLOBALS.vars.map.getLayersByName(names[i])[0].visibility) {
visibleOverlays = true;
}
}
- var widget = ACTIVEPANEL == GLOBALS.conf.thematicMap ? choropleth : proportionalSymbol;
+ var widget = GLOBALS.vars.activePanel.isPolygon() ? choropleth : proportionalSymbol;
if (visibleOverlays) {
widget.selectFeatures.deactivate();
@@ -3505,7 +3457,7 @@
}
}
- MAP.events.on({
+ GLOBALS.vars.map.events.on({
changelayer: function(e) {
if (e.layer.name != 'Polygon layer' && e.layer.name != 'Point layer') {
if (e.property == 'visibility') {
@@ -3522,8 +3474,8 @@
}
});
- Ext.getCmp('mapsource_cb').setValue(MAPSOURCE);
- Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
+ Ext.getCmp('mapsource_cb').setValue(GLOBALS.vars.mapSourceType.value);
+ Ext.getCmp('mapdatetype_cb').setValue(GLOBALS.vars.mapDateType.value);
choropleth.prepareMapViewValueType();
proportionalSymbol.prepareMapViewValueType();
=== removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js 2010-10-14 11:58:33 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js 1970-01-01 00:00:00 +0000
@@ -1,193 +0,0 @@
-GLOBALS.util = {
-
- /* Detect mapview parameter in URL */
- getUrlParam: function(strParam) {
- var output = '';
- var strHref = window.location.href;
- if (strHref.indexOf('?') > -1 ) {
- var strQueryString = strHref.substr(strHref.indexOf('?')).toLowerCase();
- var aQueryString = strQueryString.split('&');
- for (var iParam = 0; iParam < aQueryString.length; iParam++) {
- if (aQueryString[iParam].indexOf(strParam.toLowerCase() + '=') > -1) {
- var aParam = aQueryString[iParam].split('=');
- output =aParam[1];
- break;
- }
- }
- }
- return unescape(output);
- },
-
- /* Get all properties in an object */
- getKeys: function(obj) {
- var temp = [];
- for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- temp.push(k);
- }
- }
- return temp;
- },
-
- /* Input validation */
- validateInputNameLength: function(name) {
- return (name.length <= 25);
- },
-
- /* Decide multiselect height based on screen resolution */
- getMultiSelectHeight: function() {
- var h = screen.height;
- return h <= 800 ? 220 :
- h <= 1050 ? 310 :
- h <= 1200 ? 470 : 900;
- },
-
- getGridPanelHeight: function() {
- var h = screen.height;
- return h <= 800 ? 180 :
- h <= 1050 ? 480 :
- h <= 1200 ? 600 : 900;
- },
-
- /* Make map view numbers numeric */
- getNumericMapView: function(mapView) {
- mapView.id = parseFloat(mapView.id);
- mapView.indicatorGroupId = parseFloat(mapView.indicatorGroupId);
- mapView.indicatorId = parseFloat(mapView.indicatorId);
- mapView.periodId = parseFloat(mapView.periodId);
- mapView.method = parseFloat(mapView.method);
- mapView.classes = parseFloat(mapView.classes);
- mapView.mapLegendSetId = parseFloat(mapView.mapLegendSetId);
- mapView.longitude = parseFloat(mapView.longitude);
- mapView.latitude = parseFloat(mapView.latitude);
- mapView.zoom = parseFloat(mapView.zoom);
- return mapView;
- },
-
- /* Get number of decimals */
- getNumberOfDecimals: function(x,dec_sep) {
- var tmp = new String();
- tmp = x;
- return tmp.indexOf(dec_sep) > -1 ? tmp.length-tmp.indexOf(dec_sep) - 1 : 0;
- },
-
- /* Feature labels */
- labels: {
- getActivatedOpenLayersStyleMap: function() {
- return new OpenLayers.StyleMap({
- 'default' : new OpenLayers.Style(
- OpenLayers.Util.applyDefaults({
- 'fillOpacity': 1,
- 'strokeColor': '#222222',
- 'strokeWidth': 1,
- 'label': '${labelString}',
- 'fontFamily': 'arial,lucida sans unicode',
- 'fontWeight': 'bold',
- 'fontSize': 14
- },
- OpenLayers.Feature.Vector.style['default'])
- ),
- 'select': new OpenLayers.Style({
- 'strokeColor': '#000000',
- 'strokeWidth': 2,
- 'cursor': 'pointer'
- })
- });
- },
- getDeactivatedOpenLayersStyleMap: function() {
- return new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(
- OpenLayers.Util.applyDefaults({
- 'fillOpacity': 1,
- 'strokeColor': '#222222',
- 'strokeWidth': 1
- },
- OpenLayers.Feature.Vector.style['default'])
- ),
- 'select': new OpenLayers.Style({
- 'strokeColor': '#000000',
- 'strokeWidth': 2,
- 'cursor': 'pointer'
- })
- });
- }
- },
-
- toggleFeatureLabels: function(widget) {
- function activateLabels(scope) {
- widget.layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
- widget.labels = true;
- }
- function deactivateLabels(scope) {
- widget.layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
- widget.labels = false;
- }
-
- if (widget.labels) {
- deactivateLabels(this);
- }
- else {
- activateLabels(this);
- }
-
- widget.applyValues();
- },
-
- toggleFeatureLabelsAssignment: function() {
- function activateLabels(scope) {
- mapping.layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
- mapping.labels = true;
- }
- function deactivateLabels(scope) {
- mapping.layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
- mapping.labels = false;
- }
-
- if (mapping.labels) {
- deactivateLabels(this);
- }
- else {
- activateLabels(this);
- }
-
- mapping.classify(false, true);
- },
-
- /* Sort values */
- sortByValue: function(a,b) {
- return b.value-a.value;
- },
-
- /* Create JSON for map export */
- getExportDataValueJSON: function(mapValues) {
- var json = '{';
- json += '"datavalues": ';
- json += '[';
- mapValues.sort(this.sortByValue);
- for (var i = 0; i < mapValues.length; i++) {
- json += '{';
- json += '"organisation": "' + mapValues[i].orgUnitId + '",';
- json += '"value": "' + mapValues[i].value + '" ';
- json += i < mapValues.length - 1 ? '},' : '}';
- }
- json += ']';
- json += '}';
- return json;
- },
-
- getLegendsJSON: function() {
- var widget = ACTIVEPANEL == GLOBALS.config.thematicMap ? choropleth : proportionalSymbol;
- var json = '{';
- json += '"legends":';
- json += '[';
- for(var i = 0; i < widget.imageLegend.length; i++) {
- json += '{';
- json += '"label": "' + widget.imageLegend[i].label + '",';
- json += '"color": "' + widget.imageLegend[i].color + '" ';
- json += i < widget.imageLegend.length-1 ? '},' : '}';
- }
- json += ']';
- json += '}';
- return json;
- }
-};
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2010-10-21 15:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2010-10-29 14:27:36 +0000
@@ -93,19 +93,19 @@
this.layer.addFeatures(format.read(doc));
this.requestSuccess(request);
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
if (!choropleth.validateForm()) {
- MASK.hide();
+ GLOBALS.vars.mask.hide();
}
choropleth.classify(false);
}
- else if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ else if (GLOBALS.vars.activePanel.isPoint()) {
if (!proportionalSymbol.validateForm()) {
- MASK.hide();
+ GLOBALS.vars.mask.hide();
}
proportionalSymbol.classify(false);
}
- else if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment) {
+ else if (GLOBALS.vars.activePanel.isAssignment()) {
mapping.classify(false);
}
},
@@ -204,7 +204,7 @@
},
defaultLabelGenerator: function(bin, binIndex, nbBins, maxDec) {
- if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment) {
+ if (GLOBALS.vars.activePanel.isAssignment()) {
return bin.upperBound < 1 ?
'Available' + ' ( ' + bin.nbVal + ' )' : 'Assigned' + ' ( ' + bin.nbVal + ' )';
}
@@ -258,10 +258,10 @@
imageLegend[i].label = bins[i].label.replace(' ', ' ');
}
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
choropleth.imageLegend = imageLegend;
}
- else if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ else if (GLOBALS.vars.activePanel.isPoint()) {
proportionalSymbol.imageLegend = imageLegend;
}
@@ -307,14 +307,14 @@
},
classify: function(method, nbBins, bounds) {
- var mlt = ACTIVEPANEL == GLOBALS.conf.thematicMap ?
- choropleth.legend.type : ACTIVEPANEL == GLOBALS.conf.thematicMap2 ?
- proportionalSymbol.legend.type : ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment ?
+ var mlt = GLOBALS.vars.activePanel.isPolygon() ?
+ choropleth.legend.type : GLOBALS.vars.activePanel.isPoint() ?
+ proportionalSymbol.legend.type : GLOBALS.vars.activePanel.isAssignment() ?
GLOBALS.conf.map_legend_type_automatic : GLOBALS.conf.map_legend_type_automatic;
if (mlt == GLOBALS.conf.map_legend_type_automatic) {
if (method == mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS) {
- var str = ACTIVEPANEL == GLOBALS.conf.thematicMap ? Ext.getCmp('bounds_tf').getValue() : Ext.getCmp('bounds_tf2').getValue();
+ var str = GLOBALS.vars.activePanel.isPolygon() ? Ext.getCmp('bounds_tf').getValue() : Ext.getCmp('bounds_tf2').getValue();
for (var i = 0; i < str.length; i++) {
str = str.replace(' ','');
@@ -336,7 +336,7 @@
var newInput = bounds.join(',');
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
Ext.getCmp('bounds_tf').setValue(newInput);
}
else {
@@ -355,11 +355,11 @@
}
}
else if (mlt == GLOBALS.conf.map_legend_type_predefined) {
- bounds = ACTIVEPANEL == GLOBALS.conf.thematicMap ? choropleth.bounds : proportionalSymbol.bounds;
+ bounds = GLOBALS.vars.activePanel.isPolygon() ? choropleth.bounds : proportionalSymbol.bounds;
if (bounds[0] > this.minVal) {
bounds.unshift(this.minVal);
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
choropleth.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240));
}
else {
@@ -369,7 +369,7 @@
if (bounds[bounds.length-1] < this.maxVal) {
bounds.push(this.maxVal);
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
choropleth.colorInterpolation.push(new mapfish.ColorRgb(240,240,240));
}
else {
@@ -377,7 +377,7 @@
}
}
- method = ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment ? mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS : mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS;
+ method = GLOBALS.vars.activePanel.isAssignment() ? mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS : mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS;
}
var classification = null;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2010-10-21 15:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2010-10-29 14:27:36 +0000
@@ -53,8 +53,8 @@
createColorInterpolation: function() {
var initialColors = this.colors;
var numColors = this.classification.bins.length;
- var mapLegendType = ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment ?
- GLOBALS.conf.map_legend_type_automatic : ACTIVEPANEL == GLOBALS.conf.thematicMap ?
+ var mapLegendType = GLOBALS.vars.activePanel.isAssignment() ?
+ GLOBALS.conf.map_legend_type_automatic : GLOBALS.vars.activePanel.isPolygon() ?
Ext.getCmp('maplegendtype_cb').getValue() : Ext.getCmp('maplegendtype_cb2').getValue();
if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2010-10-21 15:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2010-10-29 14:27:36 +0000
@@ -61,7 +61,7 @@
createColorInterpolation: function() {
var initialColors = this.colors;
var numColors = this.classification.bins.length;
- var mapLegendType = ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment ?
+ var mapLegendType = GLOBALS.vars.activePanel.isAssignment() ?
GLOBALS.conf.map_legend_type_automatic : Ext.getCmp('maplegendtype_cb2').getValue();
if (mapLegendType == GLOBALS.conf.map_legend_type_automatic) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-10-29 11:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-11-01 17:30:19 +0000
@@ -82,31 +82,31 @@
this.createSelectFeatures();
- if (PARAMETER) {
- this.mapView = PARAMETER.mapView;
+ if (GLOBALS.vars.parameter) {
+ this.mapView = GLOBALS.vars.parameter.mapView;
this.legend = {
- type: this.mapView.mapLegendType,
+ value: this.mapView.mapLegendType,
method: this.mapView.method || this.legend.method,
classes: this.mapView.classes || this.legend.classes
};
- PARAMETER = false;
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
-
- Ext.getCmp('mapsource_cb').setValue(MAPSOURCE);
- Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
+ GLOBALS.vars.parameter = false;
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+
+ Ext.getCmp('mapsource_cb').setValue(GLOBALS.vars.mapSourceType.value);
+ Ext.getCmp('mapdatetype_cb').setValue(GLOBALS.vars.mapDateType.value);
function mapViewStoreCallback() {
Ext.getCmp('mapview_cb').setValue(this.mapView.id);
- this.valueType = this.mapView.mapValueType;
- Ext.getCmp('mapvaluetype_cb').setValue(this.valueType);
+ this.valueType.value = this.mapView.mapValueType;
+ Ext.getCmp('mapvaluetype_cb').setValue(this.valueType.value);
this.setMapView();
}
if (GLOBALS.stores.mapView.isLoaded) {
mapViewStoreCallback.call(this);
- }
+ }
else {
GLOBALS.stores.mapView.load({scope: this, callback: function() {
mapViewStoreCallback.call(this);
@@ -144,7 +144,7 @@
initProperties: function() {
this.legend = {
- type: GLOBALS.conf.map_legend_type_automatic,
+ value: GLOBALS.conf.map_legend_type_automatic,
method: GLOBALS.conf.classify_by_equal_intervals,
classes: 5
};
@@ -169,7 +169,21 @@
}
};
- this.valueType = GLOBALS.conf.map_value_type_indicator;
+ this.valueType = {
+ value: GLOBALS.conf.map_value_type_indicator,
+ setIndicator: function() {
+ this.value = GLOBALS.conf.map_value_type_indicator;
+ },
+ setDatElement: function() {
+ this.value = GLOBALS.conf.map_value_type_dataelement;
+ },
+ isIndicator: function() {
+ return this.value == GLOBALS.conf.map_value_type_indicator;
+ },
+ isDataElement: function() {
+ return this.value == GLOBALS.conf.map_value_type_datalement;
+ }
+ };
},
createItems: function() {
@@ -196,17 +210,17 @@
fn: function(cb) {
this.mapView = GLOBALS.stores.mapView.getAt(GLOBALS.stores.mapView.find('id', cb.getValue())).data;
- this.legend.type = this.mapView.mapLegendType;
+ this.legend.value = this.mapView.mapLegendType;
this.legend.method = this.mapView.method || this.legend.method;
this.legend.classes = this.mapView.classes || this.legend.classes;
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
- Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
+ Ext.getCmp('mapdatetype_cb').setValue(GLOBALS.vars.mapDateType.value);
Ext.getCmp('mapview_cb').setValue(this.mapView.id);
- this.valueType = this.mapView.mapValueType;
- Ext.getCmp('mapvaluetype_cb').setValue(this.valueType);
+ this.valueType.value = this.mapView.mapValueType;
+ Ext.getCmp('mapvaluetype_cb').setValue(this.valueType.value);
this.setMapView();
}
@@ -239,7 +253,7 @@
'select': {
scope: this,
fn: function(cb) {
- this.valueType = cb.getValue();
+ this.valueType.value = cb.getValue();
this.prepareMapViewValueType();
this.classify(false, true);
}
@@ -306,7 +320,7 @@
success: function(r) {
var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0];
if (mapLegendSet.id) {
- this.legend.type = GLOBALS.conf.map_legend_type_predefined;
+ this.legend.value = GLOBALS.conf.map_legend_type_predefined;
this.prepareMapViewLegend();
function load() {
@@ -324,7 +338,7 @@
}
}
else {
- this.legend.type = GLOBALS.conf.map_legend_type_automatic;
+ this.legend.value = GLOBALS.conf.map_legend_type_automatic;
this.prepareMapViewLegend();
this.classify(false, true);
}
@@ -394,7 +408,7 @@
success: function(r) {
var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0];
if (mapLegendSet.id) {
- this.legend.type = GLOBALS.conf.map_legend_type_predefined;
+ this.legend.value = GLOBALS.conf.map_legend_type_predefined;
this.prepareMapViewLegend();
function load() {
@@ -412,7 +426,7 @@
}
}
else {
- this.legend.type = GLOBALS.conf.map_legend_type_automatic;
+ this.legend.value = GLOBALS.conf.map_legend_type_automatic;
this.prepareMapViewLegend();
this.classify(false, true);
}
@@ -616,9 +630,9 @@
dataUrl: GLOBALS.conf.path_mapping + 'getOrganisationUnitChildren' + GLOBALS.conf.type
}),
root: {
- id: TOPLEVELUNIT.id,
- text: TOPLEVELUNIT.name,
- hasChildrenWithCoordinates: TOPLEVELUNIT.hasChildrenWithCoordinates,
+ id: GLOBALS.vars.topLevelUnit.id,
+ text: GLOBALS.vars.topLevelUnit.name,
+ hasChildrenWithCoordinates: GLOBALS.vars.topLevelUnit.hasChildrenWithCoordinates,
nodeType: 'async',
draggable: false,
expanded: true
@@ -751,7 +765,7 @@
w.show();
}
- if (TOPLEVELUNIT) {
+ if (GLOBALS.vars.topLevelUnit) {
showTree.call(this);
}
else {
@@ -762,7 +776,7 @@
scope: this,
success: function(r) {
var rootNode = Ext.util.JSON.decode(r.responseText).organisationUnits[0];
- TOPLEVELUNIT = {
+ GLOBALS.vars.topLevelUnit = {
id: rootNode.id,
name: rootNode.name,
hasChildrenWithCoordinates: rootNode.hasChildrenWithCoordinates
@@ -788,7 +802,7 @@
fieldLabel: i18n_legend_type,
emptyText: GLOBALS.conf.emptytext,
labelSeparator: GLOBALS.conf.labelseparator,
- value: this.legend.type,
+ value: this.legend.value,
triggerAction: 'all',
width: GLOBALS.conf.combo_width,
store: new Ext.data.SimpleStore({
@@ -802,16 +816,16 @@
'select': {
scope: this,
fn: function(cb) {
- if (cb.getValue() == GLOBALS.conf.map_legend_type_predefined && cb.getValue() != this.legend.type) {
- this.legend.type = GLOBALS.conf.map_legend_type_predefined;
+ if (cb.getValue() == GLOBALS.conf.map_legend_type_predefined && cb.getValue() != this.legend.value) {
+ this.legend.value = GLOBALS.conf.map_legend_type_predefined;
this.prepareMapViewLegend();
if (Ext.getCmp('maplegendset_cb').getValue()) {
this.applyPredefinedLegend();
}
}
- else if (cb.getValue() == GLOBALS.conf.map_legend_type_automatic && cb.getValue() != this.legend.type) {
- this.legend.type = GLOBALS.conf.map_legend_type_automatic;
+ else if (cb.getValue() == GLOBALS.conf.map_legend_type_automatic && cb.getValue() != this.legend.value) {
+ this.legend.value = GLOBALS.conf.map_legend_type_automatic;
this.prepareMapViewLegend();
this.classify(false, true);
}
@@ -975,10 +989,10 @@
var scope = this;
var onHoverSelect = function onHoverSelect(feature) {
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap) {
+ if (GLOBALS.vars.activePanel.isPolygon()) {
Ext.getCmp('featureinfo_l').setText('<div style="color:black">' + feature.attributes[choropleth.mapData.nameColumn] + '</div><div style="color:#555">' + feature.attributes.value + '</div>', false);
}
- else if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment) {
+ else if (GLOBALS.vars.activePanel.isAssignment()) {
Ext.getCmp('featureinfo_l').setText('<div style="color:black">' + feature.attributes[mapping.mapData.nameColumn] + '</div>', false);
}
};
@@ -992,15 +1006,15 @@
var x = east_panel.x - 210;
var y = east_panel.y + 41;
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap && MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.activePanel.isPolygon() && GLOBALS.vars.mapSourceType.isDatabase()) {
if (feature.attributes.hasChildrenWithCoordinates) {
- if (lfw) {
- lfw.destroy();
+ if (GLOBALS.vars.locateFeatureWindow) {
+ GLOBALS.vars.locateFeatureWindow.destroy();
}
Ext.getCmp('map_tf').setValue(feature.data.name);
Ext.getCmp('map_tf').value = feature.attributes.id;
- scope.organisationUnitSelectionType.setParent(feature.attributes.id);
+ choropleth.organisationUnitSelectionType.setParent(feature.attributes.id);
choropleth.loadFromDatabase(feature.attributes.id, true);
}
else {
@@ -1008,9 +1022,9 @@
}
}
- if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment && MAPSOURCE != GLOBALS.conf.map_source_type_database) {
- if (selectFeaturePopup) {
- selectFeaturePopup.destroy();
+ if (GLOBALS.vars.activePanel.isAssignment() && GLOBALS.vars.mapSourceType.value != GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.selectFeatureWindow) {
+ GLOBALS.vars.selectFeatureWindow.destroy();
}
var popup = new Ext.Window({
@@ -1031,7 +1045,7 @@
}
});
- selectFeaturePopup = popup;
+ GLOBALS.vars.selectFeatureWindow = popup;
popup.show();
mapping.relation = feature.attributes[mapping.mapData.nameColumn];
}
@@ -1045,14 +1059,14 @@
}
);
- MAP.addControl(this.selectFeatures);
+ GLOBALS.vars.map.addControl(this.selectFeatures);
this.selectFeatures.activate();
},
prepareMapViewValueType: function() {
var obj = {};
- if (this.valueType == GLOBALS.conf.map_value_type_indicator) {
+ if (this.valueType.isIndicator()) {
Ext.getCmp('indicatorgroup_cb').showField();
Ext.getCmp('indicator_cb').showField();
Ext.getCmp('dataelementgroup_cb').hideField();
@@ -1070,7 +1084,7 @@
valueType: 'indicatorId'
};
}
- else if (this.valueType == GLOBALS.conf.map_value_type_dataelement) {
+ else if (this.valueType.isDataElement()) {
Ext.getCmp('indicatorgroup_cb').hideField();
Ext.getCmp('indicator_cb').hideField();
Ext.getCmp('dataelementgroup_cb').showField();
@@ -1093,7 +1107,7 @@
prepareMapViewDateType: function() {
var obj = {};
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_fixed) {
+ if (GLOBALS.vars.mapDateType.isFixed()) {
Ext.getCmp('periodtype_cb').showField();
Ext.getCmp('period_cb').showField();
Ext.getCmp('startdate_df').hideField();
@@ -1111,7 +1125,7 @@
c2: 'periodId'
};
}
- else if (MAPDATETYPE == GLOBALS.conf.map_date_type_start_end) {
+ else if (GLOBALS.vars.mapDateType.isStartEnd()) {
Ext.getCmp('periodtype_cb').hideField();
Ext.getCmp('period_cb').hideField();
Ext.getCmp('startdate_df').showField();
@@ -1129,9 +1143,9 @@
},
prepareMapViewLegend: function() {
- Ext.getCmp('maplegendtype_cb').setValue(this.legend.type);
+ Ext.getCmp('maplegendtype_cb').setValue(this.legend.value);
- if (this.legend.type == GLOBALS.conf.map_legend_type_automatic) {
+ if (this.legend.value == GLOBALS.conf.map_legend_type_automatic) {
Ext.getCmp('method_cb').showField();
Ext.getCmp('colorA_cf').showField();
Ext.getCmp('colorB_cf').showField();
@@ -1146,7 +1160,7 @@
Ext.getCmp('bounds_tf').hideField();
}
}
- else if (this.legend.type == GLOBALS.conf.map_legend_type_predefined) {
+ else if (this.legend.value == GLOBALS.conf.map_legend_type_predefined) {
Ext.getCmp('method_cb').hideField();
Ext.getCmp('numClasses_cb').hideField();
Ext.getCmp('bounds_tf').hideField();
@@ -1157,7 +1171,7 @@
},
prepareMapViewMap: function() {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
Ext.getCmp('map_cb').hideField();
Ext.getCmp('map_tf').showField();
}
@@ -1186,7 +1200,7 @@
obj.components.valueType.setValue(this.mapView[obj.mapView.valueType]);
obj = this.prepareMapViewDateType();
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_fixed) {
+ if (GLOBALS.vars.mapDateType.isFixed()) {
if (obj.stores.c1.isLoaded) {
dateTypeGroupStoreCallback.call(this);
}
@@ -1196,7 +1210,7 @@
}});
}
}
- else if (MAPDATETYPE == GLOBALS.conf.map_date_type_start_end) {
+ else if (GLOBALS.vars.mapDateType.isStartEnd()) {
obj.components.c1.setValue(new Date(this.mapView[obj.mapView.c1]));
obj.components.c2.setValue(new Date(this.mapView[obj.mapView.c2]));
@@ -1234,7 +1248,7 @@
this.applyPredefinedLegend(true);
}
- if (this.legend.type == GLOBALS.conf.map_legend_type_automatic) {
+ if (this.legend.value == GLOBALS.conf.map_legend_type_automatic) {
Ext.getCmp('method_cb').setValue(this.mapView.method);
Ext.getCmp('colorA_cf').setValue(this.mapView.colorLow);
Ext.getCmp('colorB_cf').setValue(this.mapView.colorHigh);
@@ -1248,7 +1262,7 @@
this.setMapViewMap();
}
- else if (this.legend.type == GLOBALS.conf.map_legend_type_predefined) {
+ else if (this.legend.value == GLOBALS.conf.map_legend_type_predefined) {
if (GLOBALS.stores.predefinedMapLegendSet.isLoaded) {
predefinedMapLegendSetStoreCallback.call(this);
}
@@ -1263,7 +1277,7 @@
setMapViewMap: function() {
this.prepareMapViewMap();
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
Ext.getCmp('map_tf').setValue(this.mapView.organisationUnitSelectionTypeName);
Ext.getCmp('map_tf').value = this.mapView.mapSource;
this.loadFromDatabase(this.mapView.mapSource);
@@ -1275,7 +1289,7 @@
},
applyPredefinedLegend: function(isMapView) {
- this.legend.type = GLOBALS.conf.map_legend_type_predefined;
+ this.legend.value = GLOBALS.conf.map_legend_type_predefined;
var mls = Ext.getCmp('maplegendset_cb').getValue();
var bounds = [];
Ext.Ajax.request({
@@ -1330,7 +1344,7 @@
}
}
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_fixed) {
+ if (GLOBALS.vars.mapDateType.isFixed()) {
if (!Ext.getCmp('period_cb').getValue()) {
if (exception) {
Ext.message.msg(false, i18n_form_is_not_complete);
@@ -1347,7 +1361,7 @@
}
}
- var cmp = MAPSOURCE == GLOBALS.conf.map_source_type_database ? Ext.getCmp('map_tf') : Ext.getCmp('map_cb');
+ var cmp = GLOBALS.vars.mapSourceType.isDatabase() ? Ext.getCmp('map_tf') : Ext.getCmp('map_cb');
if (!cmp.getValue()) {
if (exception) {
Ext.message.msg(false, i18n_form_is_not_complete);
@@ -1389,24 +1403,24 @@
startDate: Ext.getCmp('startdate_df').getValue() || '',
endDate: Ext.getCmp('enddate_df').getValue() || '',
organisationUnitSelectionType: this.organisationUnitSelectionType.value,
- mapSource: MAPSOURCE == GLOBALS.conf.map_source_type_database ? Ext.getCmp('map_tf').value : Ext.getCmp('map_cb').getValue(),
+ mapSource: GLOBALS.vars.mapSourceType.isDatabase() ? Ext.getCmp('map_tf').value : Ext.getCmp('map_cb').getValue(),
mapLegendType: Ext.getCmp('maplegendtype_cb').getValue(),
- method: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('method_cb').getValue() : '',
- classes: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('numClasses_cb').getValue() : '',
- bounds: this.legend.type == GLOBALS.conf.map_legend_type_automatic && this.legend.method == GLOBALS.conf.classify_with_bounds ? Ext.getCmp('bounds_tf').getValue() : '',
- colorLow: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('colorA_cf').getValue() : '',
- colorHigh: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('colorB_cf').getValue() : '',
+ method: this.legend.value == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('method_cb').getValue() : '',
+ classes: this.legend.value == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('numClasses_cb').getValue() : '',
+ bounds: this.legend.value == GLOBALS.conf.map_legend_type_automatic && this.legend.method == GLOBALS.conf.classify_with_bounds ? Ext.getCmp('bounds_tf').getValue() : '',
+ colorLow: this.legend.value == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('colorA_cf').getValue() : '',
+ colorHigh: this.legend.value == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('colorB_cf').getValue() : '',
mapLegendSetId: Ext.getCmp('maplegendset_cb').getValue() || '',
- longitude: MAP.getCenter().lon,
- latitude: MAP.getCenter().lat,
- zoom: parseInt(MAP.getZoom())
+ longitude: GLOBALS.vars.map.getCenter().lon,
+ latitude: GLOBALS.vars.map.getCenter().lat,
+ zoom: parseInt(GLOBALS.vars.map.getZoom())
};
},
loadFromDatabase: function(id, isDrillDown) {
function load() {
- MASK.msg = i18n_loading_geojson;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_loading_geojson;
+ GLOBALS.vars.mask.show();
if (this.organisationUnitSelectionType.isParent()) {
this.setUrl(GLOBALS.conf.path_mapping + 'getGeoJsonByParent.action?parentId=' + id);
@@ -1435,10 +1449,10 @@
if (url != this.newUrl) {
this.newUrl = url;
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson) {
+ if (GLOBALS.vars.mapSourceType.isGeojson()) {
this.setUrl(GLOBALS.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + url);
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ else if (GLOBALS.vars.mapSourceType.isShapefile()) {
this.setUrl(GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + url + GLOBALS.conf.output);
}
}
@@ -1448,7 +1462,7 @@
},
classify: function(exception, position) {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
this.classifyDatabase(exception, position);
}
else {
@@ -1458,11 +1472,11 @@
classifyDatabase: function(exception, position) {
if (this.validateForm(exception)) {
- MASK.msg = i18n_aggregating_map_values;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_aggregating_map_values;
+ GLOBALS.vars.mask.show();
if (!position) {
- MAP.zoomToExtent(this.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(this.layer.getDataExtent());
}
this.mapData = {
@@ -1471,23 +1485,23 @@
if (this.mapView) {
if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
}
else {
- MAP.zoomToExtent(this.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(this.layer.getDataExtent());
}
this.mapView = false;
}
- var dataUrl = this.valueType == GLOBALS.conf.map_value_type_indicator ?
+ var dataUrl = this.valueType.isIndicator() ?
(this.organisationUnitSelectionType.isParent() ? 'getIndicatorMapValuesByParent' : 'getIndicatorMapValuesByLevel') :
(this.organisationUnitSelectionType.isLevel() ? 'getDataMapValuesByParent' : 'getDataMapValuesByLevel');
var params = {
- id: this.valueType == GLOBALS.conf.map_value_type_indicator ? Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue(),
- periodId: MAPDATETYPE == GLOBALS.conf.map_date_type_fixed ? Ext.getCmp('period_cb').getValue() : null,
- startDate: MAPDATETYPE == GLOBALS.conf.map_date_type_start_end ? new Date(Ext.getCmp('startdate_df').getValue()).format('Y-m-d') : null,
- endDate: MAPDATETYPE == GLOBALS.conf.map_date_type_start_end ? new Date(Ext.getCmp('enddate_df').getValue()).format('Y-m-d') : null,
+ id: this.valueType.isIndicator() ? Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue(),
+ periodId: GLOBALS.vars.mapDateType.isFixed() ? Ext.getCmp('period_cb').getValue() : null,
+ startDate: GLOBALS.vars.mapDateType.isStartEnd() ? new Date(Ext.getCmp('startdate_df').getValue()).format('Y-m-d') : null,
+ endDate: GLOBALS.vars.mapDateType.isStartEnd() ? new Date(Ext.getCmp('enddate_df').getValue()).format('Y-m-d') : null,
parentId: this.organisationUnitSelectionType.parent,
level: this.organisationUnitSelectionType.level
};
@@ -1499,11 +1513,11 @@
scope: this,
success: function(r) {
var mapvalues = Ext.util.JSON.decode(r.responseText).mapvalues;
- EXPORTVALUES = GLOBALS.util.getExportDataValueJSON(mapvalues);
+ GLOBALS.vars.exportValues = GLOBALS.util.getExportDataValueJSON(mapvalues);
if (mapvalues.length == 0) {
Ext.message.msg(false, i18n_current_selection_no_data);
- MASK.hide();
+ GLOBALS.vars.mask.hide();
return;
}
@@ -1526,8 +1540,8 @@
classifyFile: function(exception, position) {
if (this.validateForm(exception)) {
- MASK.msg = i18n_aggregating_map_values;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_aggregating_map_values;
+ GLOBALS.vars.mask.show();
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'getMapByMapLayerPath' + GLOBALS.conf.type,
@@ -1543,30 +1557,30 @@
this.mapData.zoom = parseFloat(this.mapData.zoom);
if (!position) {
- if (this.mapData.zoom != MAP.getZoom()) {
- MAP.zoomTo(this.mapData.zoom);
+ if (this.mapData.zoom != GLOBALS.vars.map.getZoom()) {
+ GLOBALS.vars.map.zoomTo(this.mapData.zoom);
}
- MAP.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude));
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude));
}
if (this.mapView) {
if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
}
else {
- MAP.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude), this.mapData.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude), this.mapData.zoom);
}
this.mapView = false;
}
var params = {
- id: this.valueType == GLOBALS.conf.map_value_type_indicator ? Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue()
+ id: this.valueType.isIndicator() ? Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue()
};
- var indicatorOrDataElementId = this.valueType == GLOBALS.conf.map_value_type_indicator ?
+ var indicatorOrDataElementId = this.valueType.isIndicator() ?
Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
- var dataUrl = this.valueType == GLOBALS.conf.map_value_type_indicator ?
+ var dataUrl = this.valueType.isIndicator() ?
'getIndicatorMapValuesByMap' : 'getDataMapValuesByMap';
var periodId = Ext.getCmp('period_cb').getValue();
var mapLayerPath = this.newUrl;
@@ -1578,7 +1592,7 @@
scope: this,
success: function(r) {
var mapvalues = Ext.util.JSON.decode(r.responseText).mapvalues;
- EXPORTVALUES = GLOBALS.util.getExportDataValueJSON(mapvalues);
+ GLOBALS.vars.exportValues = GLOBALS.util.getExportDataValueJSON(mapvalues);
var mv = new Array();
var mour = new Array();
var nameColumn = this.mapData.nameColumn;
@@ -1586,7 +1600,7 @@
if (mapvalues.length == 0) {
Ext.message.msg(false, i18n_current_selection_no_data );
- MASK.hide();
+ GLOBALS.vars.mask.hide();
return;
}
@@ -1636,7 +1650,7 @@
this.coreComp.applyClassification();
this.classificationApplied = true;
- MASK.hide();
+ GLOBALS.vars.mask.hide();
},
onRender: function(ct, position) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-10-21 15:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-10-29 14:27:36 +0000
@@ -293,7 +293,7 @@
success: function() {
Ext.message.msg(true, '<span class="x-msg-hl">' + mapping.relation + '</span> (' + i18n_in_the_map + ') ' + i18n_assigned_to + ' <span class="x-msg-hl">' + name + '</span> (' + i18n_database + ').');
Ext.getCmp('grid_gp').getStore().load();
- selectFeaturePopup.hide();
+ GLOBALS.vars.selectFeatureWindow.hide();
mapping.relation = false;
Ext.getCmp('filter_tf').setValue('');
mapping.classify(true, true);
@@ -372,10 +372,10 @@
if (url != mapping.newUrl) {
mapping.newUrl = url;
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson) {
+ if (GLOBALS.vars.mapSourceType.isGeojson()) {
mapping.setUrl(GLOBALS.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + url);
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ else if (GLOBALS.vars.mapSourceType.isShapefile()) {
mapping.setUrl(GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + url + GLOBALS.conf.output);
}
}
@@ -399,12 +399,12 @@
mapping.coreComp.applyClassification();
mapping.classificationApplied = true;
- MASK.hide();
+ GLOBALS.vars.mask.hide();
},
autoAssign: function(position) {
- MASK.msg = i18n_loading ;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_loading ;
+ GLOBALS.vars.mask.show();
var level = this.mapData.organisationUnitLevel;
@@ -438,8 +438,8 @@
}
}
- MASK.msg = count_match == 0 ? i18n_no + ' ' + i18n_organisation_units + ' ' + i18n_assigned + '...' : + i18n_assigning +' ' + count_match + ' '+ i18n_organisation_units + '...';
- MASK.show();
+ GLOBALS.vars.mask.msg = count_match == 0 ? i18n_no + ' ' + i18n_organisation_units + ' ' + i18n_assigned + '...' : + i18n_assigning +' ' + count_match + ' '+ i18n_organisation_units + '...';
+ GLOBALS.vars.mask.show();
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'addOrUpdateMapOrganisationUnitRelations' + GLOBALS.conf.type,
@@ -447,8 +447,8 @@
params: {mapLayerPath:mlp, relations:relations},
scope: this,
success: function(r) {
- MASK.msg = i18n_applying_organisation_units_relations ;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_applying_organisation_units_relations ;
+ GLOBALS.vars.mask.show();
Ext.message.msg(true, '<span class="x-msg-hl">' + count_match + '</span> '+ i18n_organisation_units_assigned + ' (map <span class="x-msg-hl">' + this.layer.features.length + '</span>, db <span class="x-msg-hl">' + organisationUnits.length + '</span>)');
@@ -462,8 +462,8 @@
classify: function(exception, position) {
if (mapping.validateForm(exception)) {
- MASK.msg = i18n_creating_map;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_creating_map;
+ GLOBALS.vars.mask.show();
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'getMapByMapLayerPath' + GLOBALS.conf.type,
@@ -479,7 +479,7 @@
this.mapData.zoom = parseFloat(this.mapData.zoom);
if (!position) {
- MAP.zoomToExtent(this.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(this.layer.getDataExtent());
}
var mlp = this.mapData.mapLayerPath;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-10-29 11:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-10-29 14:27:36 +0000
@@ -168,9 +168,9 @@
this.legend.method = this.mapView.method || this.legend.method;
this.legend.classes = this.mapView.classes || this.legend.classes;
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
- Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
+ Ext.getCmp('mapdatetype_cb').setValue(GLOBALS.vars.mapDateType.value);
Ext.getCmp('mapview_cb2').setValue(this.mapView.id);
this.valueType = this.mapView.mapValueType;
@@ -584,9 +584,9 @@
dataUrl: GLOBALS.conf.path_mapping + 'getOrganisationUnitChildren' + GLOBALS.conf.type
}),
root: {
- id: TOPLEVELUNIT.id,
- text: TOPLEVELUNIT.name,
- hasChildrenWithCoordinates: TOPLEVELUNIT.hasChildrenWithCoordinates,
+ id: GLOBALS.vars.topLevelUnit.id,
+ text: GLOBALS.vars.topLevelUnit.name,
+ hasChildrenWithCoordinates: GLOBALS.vars.topLevelUnit.hasChildrenWithCoordinates,
nodeType: 'async',
draggable: false,
expanded: true
@@ -719,7 +719,7 @@
w.show();
}
- if (TOPLEVELUNIT) {
+ if (GLOBALS.vars.topLevelUnit) {
showTree.call(this);
}
else {
@@ -730,7 +730,7 @@
scope: this,
success: function(r) {
var rootNode = Ext.util.JSON.decode(r.responseText).organisationUnits[0];
- TOPLEVELUNIT = {
+ GLOBALS.vars.topLevelUnit = {
id: rootNode.id,
name: rootNode.name,
hasChildrenWithCoordinates: rootNode.hasChildrenWithCoordinates
@@ -943,10 +943,10 @@
var scope = this;
var onHoverSelect = function onHoverSelect(feature) {
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap2) {
+ if (GLOBALS.vars.activePanel.isPoint()) {
Ext.getCmp('featureinfo_l').setText('<div style="color:black">' + feature.attributes[proportionalSymbol.mapData.nameColumn] + '</div><div style="color:#555">' + feature.attributes.value + '</div>', false);
}
- else if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment) {
+ else if (GLOBALS.vars.activePanel.isAssignment()) {
Ext.getCmp('featureinfo_l').setText('<div style="color:black">' + feature.attributes[mapping.mapData.nameColumn] + '</div>', false);
}
};
@@ -960,10 +960,10 @@
var x = east_panel.x - 210;
var y = east_panel.y + 41;
- if (ACTIVEPANEL == GLOBALS.conf.thematicMap2 && MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.activePanel.isPoint() && GLOBALS..isDatabase()) {
if (feature.attributes.hasChildrenWithCoordinates) {
- if (lfw) {
- lfw.destroy();
+ if (GLOBALS.vars.locateFeatureWindow) {
+ GLOBALS.vars.locateFeatureWindow.destroy();
}
Ext.getCmp('map_tf2').setValue(feature.data.name);
@@ -976,9 +976,9 @@
}
}
- if (ACTIVEPANEL == GLOBALS.conf.organisationUnitAssignment && MAPSOURCE != GLOBALS.conf.map_source_type_database) {
- if (selectFeaturePopup) {
- selectFeaturePopup.destroy();
+ if (GLOBALS.vars.activePanel.isAssignment() && GLOBALS.vars.mapSourceType.value != GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.selectFeatureWindow) {
+ GLOBALS.vars.selectFeatureWindow.destroy();
}
var popup = new Ext.Window({
@@ -999,7 +999,7 @@
}
});
- selectFeaturePopup = popup;
+ GLOBALS.vars.selectFeatureWindow = popup;
popup.show();
mapping.relation = feature.attributes[mapping.mapData.nameColumn];
}
@@ -1013,7 +1013,7 @@
}
);
- MAP.addControl(this.selectFeatures);
+ GLOBALS.vars.map.addControl(this.selectFeatures);
this.selectFeatures.activate();
},
@@ -1061,7 +1061,7 @@
prepareMapViewDateType: function() {
var obj = {};
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_fixed) {
+ if (GLOBALS.vars.mapDateType.isFixed()) {
Ext.getCmp('periodtype_cb2').showField();
Ext.getCmp('period_cb2').showField();
Ext.getCmp('startdate_df2').hideField();
@@ -1079,7 +1079,7 @@
c2: 'periodId'
};
}
- else if (MAPDATETYPE == GLOBALS.conf.map_date_type_start_end) {
+ else if (GLOBALS.vars.mapDateType.isStartEnd()) {
Ext.getCmp('periodtype_cb2').hideField();
Ext.getCmp('period_cb2').hideField();
Ext.getCmp('startdate_df2').showField();
@@ -1125,7 +1125,7 @@
},
prepareMapViewMap: function() {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
Ext.getCmp('map_cb2').hideField();
Ext.getCmp('map_tf2').showField();
}
@@ -1154,7 +1154,7 @@
obj.components.valueType.setValue(this.mapView[obj.mapView.valueType]);
obj = this.prepareMapViewDateType();
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_fixed) {
+ if (GLOBALS.vars.mapDateType.isFixed()) {
if (obj.stores.c1.isLoaded) {
dateTypeGroupStoreCallback.call(this);
}
@@ -1164,7 +1164,7 @@
}});
}
}
- else if (MAPDATETYPE == GLOBALS.conf.map_date_type_start_end) {
+ else if (GLOBALS.vars.mapDateType.isStartEnd()) {
obj.components.c1.setValue(new Date(this.mapView[obj.mapView.c1]));
obj.components.c2.setValue(new Date(this.mapView[obj.mapView.c2]));
@@ -1231,7 +1231,7 @@
setMapViewMap: function() {
this.prepareMapViewMap();
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
Ext.getCmp('map_tf2').setValue(this.mapView.organisationUnitSelectionTypeName);
Ext.getCmp('map_tf2').value = this.mapView.mapSource;
this.loadFromDatabase(this.mapView.mapSource);
@@ -1298,7 +1298,7 @@
}
}
- if (MAPDATETYPE == GLOBALS.conf.map_date_type_fixed) {
+ if (GLOBALS.vars.mapDateType.isFixed()) {
if (!Ext.getCmp('period_cb2').getValue()) {
if (exception) {
Ext.message.msg(false, i18n_form_is_not_complete);
@@ -1315,7 +1315,7 @@
}
}
- var cmp = MAPSOURCE == GLOBALS.conf.map_source_type_database ? Ext.getCmp('map_tf2') : Ext.getCmp('map_cb2');
+ var cmp = GLOBALS.vars.mapSourceType.isDatabase() ? Ext.getCmp('map_tf2') : Ext.getCmp('map_cb2');
if (!cmp.getValue()) {
if (exception) {
Ext.message.msg(false, i18n_form_is_not_complete);
@@ -1357,7 +1357,7 @@
startDate: Ext.getCmp('startdate_df2').getValue() || '',
endDate: Ext.getCmp('enddate_df2').getValue() || '',
organisationUnitSelectionType: this.organisationUnitSelectionType.value,
- mapSource: MAPSOURCE == GLOBALS.conf.map_source_type_database ? Ext.getCmp('map_tf2').value : Ext.getCmp('map_cb2').getValue(),
+ mapSource: GLOBALS.vars.mapSourceType.isDatabase() ? Ext.getCmp('map_tf2').value : Ext.getCmp('map_cb2').getValue(),
mapLegendType: Ext.getCmp('maplegendtype_cb2').getValue(),
method: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('method_cb2').getValue() : '',
classes: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('numClasses_cb2').getValue() : '',
@@ -1365,16 +1365,16 @@
colorLow: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('colorA_cf2').getValue() : '',
colorHigh: this.legend.type == GLOBALS.conf.map_legend_type_automatic ? Ext.getCmp('colorB_cf2').getValue() : '',
mapLegendSetId: Ext.getCmp('maplegendset_cb2').getValue() || '',
- longitude: MAP.getCenter().lon,
- latitude: MAP.getCenter().lat,
- zoom: parseInt(MAP.getZoom())
+ longitude: GLOBALS.vars.map.getCenter().lon,
+ latitude: GLOBALS.vars.map.getCenter().lat,
+ zoom: parseInt(GLOBALS.vars.map.getZoom())
};
},
loadFromDatabase: function(id, isDrillDown) {
function load() {
- MASK.msg = i18n_loading_geojson;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_loading_geojson;
+ GLOBALS.vars.mask.show();
if (this.organisationUnitSelectionType.isParent()) {
this.setUrl(GLOBALS.conf.path_mapping + 'getGeoJsonByParent.action?parentId=' + id);
@@ -1403,10 +1403,10 @@
if (url != this.newUrl) {
this.newUrl = url;
- if (MAPSOURCE == GLOBALS.conf.map_source_type_geojson) {
+ if (GLOBALS.vars.mapSourceType.isGeojson()) {
this.setUrl(GLOBALS.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + url);
}
- else if (MAPSOURCE == GLOBALS.conf.map_source_type_shapefile) {
+ else if (GLOBALS.vars.mapSourceType.isShapefile()) {
this.setUrl(GLOBALS.conf.path_geoserver + GLOBALS.conf.wfs + url + GLOBALS.conf.output);
}
}
@@ -1416,7 +1416,7 @@
},
classify: function(exception, position) {
- if (MAPSOURCE == GLOBALS.conf.map_source_type_database) {
+ if (GLOBALS.vars.mapSourceType.isDatabase()) {
this.classifyDatabase(exception, position);
}
else {
@@ -1426,11 +1426,11 @@
classifyDatabase: function(exception, position) {
if (this.validateForm(exception)) {
- MASK.msg = i18n_aggregating_map_values;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_aggregating_map_values;
+ GLOBALS.vars.mask.show();
if (!position) {
- MAP.zoomToExtent(this.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(this.layer.getDataExtent());
}
this.mapData = {
@@ -1439,10 +1439,10 @@
if (this.mapView) {
if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
}
else {
- MAP.zoomToExtent(this.layer.getDataExtent());
+ GLOBALS.vars.map.zoomToExtent(this.layer.getDataExtent());
}
this.mapView = false;
}
@@ -1453,9 +1453,9 @@
var params = {
id: this.valueType == GLOBALS.conf.map_value_type_indicator ? Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue(),
- periodId: MAPDATETYPE == GLOBALS.conf.map_date_type_fixed ? Ext.getCmp('period_cb2').getValue() : null,
- startDate: MAPDATETYPE == GLOBALS.conf.map_date_type_start_end ? new Date(Ext.getCmp('startdate_df2').getValue()).format('Y-m-d') : null,
- endDate: MAPDATETYPE == GLOBALS.conf.map_date_type_start_end ? new Date(Ext.getCmp('enddate_df2').getValue()).format('Y-m-d') : null,
+ periodId: GLOBALS.vars.mapDateType.isFixed() ? Ext.getCmp('period_cb2').getValue() : null,
+ startDate: GLOBALS.vars.mapDateType.isStartEnd() ? new Date(Ext.getCmp('startdate_df2').getValue()).format('Y-m-d') : null,
+ endDate: GLOBALS.vars.mapDateType.isStartEnd() ? new Date(Ext.getCmp('enddate_df2').getValue()).format('Y-m-d') : null,
parentId: this.organisationUnitSelectionType.parent,
level: this.organisationUnitSelectionType.level
};
@@ -1467,11 +1467,11 @@
scope: this,
success: function(r) {
var mapvalues = Ext.util.JSON.decode(r.responseText).mapvalues;
- EXPORTVALUES = GLOBALS.util.getExportDataValueJSON(mapvalues);
+ GLOBALS.vars.exportValues = GLOBALS.util.getExportDataValueJSON(mapvalues);
if (mapvalues.length == 0) {
Ext.message.msg(false, i18n_current_selection_no_data);
- MASK.hide();
+ GLOBALS.vars.mask.hide();
return;
}
@@ -1494,8 +1494,8 @@
classifyFile: function(exception, position) {
if (this.validateForm(exception)) {
- MASK.msg = i18n_aggregating_map_values;
- MASK.show();
+ GLOBALS.vars.mask.msg = i18n_aggregating_map_values;
+ GLOBALS.vars.mask.show();
Ext.Ajax.request({
url: GLOBALS.conf.path_mapping + 'getMapByMapLayerPath' + GLOBALS.conf.type,
@@ -1511,18 +1511,18 @@
this.mapData.zoom = parseFloat(this.mapData.zoom);
if (!position) {
- if (this.mapData.zoom != MAP.getZoom()) {
- MAP.zoomTo(this.mapData.zoom);
+ if (this.mapData.zoom != GLOBALS.vars.map.getZoom()) {
+ GLOBALS.vars.map.zoomTo(this.mapData.zoom);
}
- MAP.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude));
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude));
}
if (this.mapView) {
if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) {
- MAP.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
}
else {
- MAP.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude), this.mapData.zoom);
+ GLOBALS.vars.map.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude), this.mapData.zoom);
}
this.mapView = false;
}
@@ -1546,7 +1546,7 @@
scope: this,
success: function(r) {
var mapvalues = Ext.util.JSON.decode(r.responseText).mapvalues;
- EXPORTVALUES = GLOBALS.util.getExportDataValueJSON(mapvalues);
+ GLOBALS.vars.exportValues = GLOBALS.util.getExportDataValueJSON(mapvalues);
var mv = new Array();
var mour = new Array();
var nameColumn = this.mapData.nameColumn;
@@ -1554,7 +1554,7 @@
if (mapvalues.length == 0) {
Ext.message.msg(false, i18n_current_selection_no_data );
- MASK.hide();
+ GLOBALS.vars.mask.hide();
return;
}
@@ -1604,7 +1604,7 @@
this.coreComp.applyClassification();
this.classificationApplied = true;
- MASK.hide();
+ GLOBALS.vars.mask.hide();
},
onRender: function(ct, position) {