dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08934
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2259: (GIS) Image export for point layer implemented. Work in progress on exporting both layers together.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2259 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-12-02 13:43:37 +0100
message:
(GIS) Image export for point layer implemented. Work in progress on exporting both layers together.
modified:
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/index.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/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/script/globals.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-11-30 18:26:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-12-02 12:41:12 +0000
@@ -249,7 +249,7 @@
},
getLegendsJSON: function() {
- var widget = GLOBAL.vars.activePanel.isPolygon() ? choropleth : proportionalSymbol;
+ var widget = GLOBAL.vars.activePanel.isPolygon() ? choropleth : symbol;
var json = '{';
json += '"legends":';
json += '[';
=== 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-12-01 12:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-12-02 12:41:12 +0000
@@ -262,15 +262,6 @@
listeners: {
'load': function(store) {
store.isLoaded = true;
-
- if (!symbol.form.findField('level').getValue()) {
- if (this.isLoaded) {
- var data = this.getAt(this.getTotalCount()-1).data;
- symbol.organisationUnitSelection.setValues(null, null, null, data.level, data.name);
- symbol.form.findField('level').setValue(data.name);
- }
- }
- // Ext.getCmp('level_cb').mode = 'local';
}
}
});
@@ -474,7 +465,7 @@
if (!choropleth.formValidation.validateForm(true)) {
return;
}
- formValues = choropleth.getFormValues();
+ formValues = choropleth.formValues.getAllValues.call(choropleth);
}
else if (GLOBAL.vars.activePanel.isPoint()) {
if (!symbol.formValidation.validateForm(true)) {
@@ -724,58 +715,57 @@
cls: 'window-button',
text: i18n_export,
handler: function() {
- var vcb, period;
+ var values, svgElement;
if (GLOBAL.vars.activePanel.isPolygon()) {
if (choropleth.formValidation.validateForm()) {
- vcb = choropleth.form.findField('mapvaluetype').getValue() == GLOBAL.conf.map_value_type_indicator ? choropleth.form.findField('indicator').getValue() : choropleth.form.findField('dataelement').getValue();
- period = GLOBAL.vars.mapDateType.isFixed() ? choropleth.form.findField('period').getRawValue() : new Date(choropleth.form.findField('startdate').getRawValue()).format('Y M j') + ' - ' + new Date(choropleth.form.findField('enddate').getRawValue()).format('Y M j');
-
- var svgElement = document.getElementsByTagName('svg')[0];
- var parentSvgElement = svgElement.parentNode;
- var svg = parentSvgElement.innerHTML;
- var viewBox = svgElement.getAttribute('viewBox');
- var title = Ext.getCmp('exportimagetitle_tf').getValue();
-
- if (!title) {
- Ext.message.msg(false, i18n_form_is_not_complete);
- }
- else {
- var q = Ext.getCmp('exportimagequality_cb').getValue();
- var w = svgElement.getAttribute('width') * q;
- var h = svgElement.getAttribute('height') * q;
- var includeLegend = Ext.getCmp('exportimageincludelegend_chb').getValue();
-
- Ext.getCmp('exportimagetitle_tf').reset();
-
- var exportForm = document.getElementById('exportForm');
- exportForm.action = '../exportImage.action';
- exportForm.target = '_blank';
-
- document.getElementById('titleField').value = title;
- document.getElementById('viewBoxField').value = viewBox;
- document.getElementById('svgField').value = svg;
- document.getElementById('widthField').value = w;
- document.getElementById('heightField').value = h;
- document.getElementById('includeLegendsField').value = includeLegend;
- document.getElementById('periodField').value = period;
- document.getElementById('indicatorField').value = vcb;
- document.getElementById('legendsField').value = GLOBAL.util.getLegendsJSON();
-
- exportForm.submit();
- }
- }
- else {
- Ext.message.msg(false, i18n_please_render_map_first);
- }
- }
- else if (GLOBAL.vars.activePanel.isPoint()) {
- Ext.message.msg(false, 'Please use <span class="x-msg-hl">polygon layer</span> for printing');
- return;
- }
- else {
- Ext.message.msg(false, i18n_please_expand_layer_panel);
- return;
- }
+ values = choropleth.formValues.getImageExportValues.call(choropleth);
+ svgElement = document.getElementsByTagName('svg')[0];
+ }
+ else {
+ Ext.message.msg(false, i18n_please_render_map_first);
+ }
+ }
+ else if (GLOBAL.vars.activePanel.isPoint()) {
+ if (symbol.formValidation.validateForm()) {
+ values = symbol.formValues.getImageExportValues.call(symbol);
+ svgElement = document.getElementsByTagName('svg')[1];
+ }
+ else {
+ Ext.message.msg(false, i18n_please_render_map_first);
+ }
+ }
+
+ var svg = svgElement.parentNode.innerHTML;
+ var viewBox = svgElement.getAttribute('viewBox');
+ var title = Ext.getCmp('exportimagetitle_tf').getValue();
+
+ if (!title) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ }
+ else {
+ var q = Ext.getCmp('exportimagequality_cb').getValue();
+ var w = svgElement.getAttribute('width') * q;
+ var h = svgElement.getAttribute('height') * q;
+ var includeLegend = Ext.getCmp('exportimageincludelegend_chb').getValue();
+
+ Ext.getCmp('exportimagetitle_tf').reset();
+
+ var exportForm = document.getElementById('exportForm');
+ exportForm.action = '../exportImage.action';
+ exportForm.target = '_blank';
+
+ document.getElementById('titleField').value = title;
+ document.getElementById('viewBoxField').value = viewBox;
+ document.getElementById('svgField').value = svg;
+ document.getElementById('widthField').value = w;
+ document.getElementById('heightField').value = h;
+ document.getElementById('includeLegendsField').value = includeLegend;
+ document.getElementById('periodField').value = values.dateValue;
+ document.getElementById('indicatorField').value = values.mapValueTypeValue;
+ document.getElementById('legendsField').value = GLOBAL.util.getLegendsJSON();
+
+ exportForm.submit();
+ }
}
}
]
=== 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-12-01 12:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-12-02 12:41:12 +0000
@@ -1371,34 +1371,45 @@
}
},
- getFormValues: function() {
- return {
- featureType: GLOBAL.conf.map_feature_type_multipolygon,
- mapValueType: this.form.findField('mapvaluetype').getValue(),
- indicatorGroupId: this.form.findField('indicatorgroup').getValue(),
- indicatorId: this.form.findField('indicator').getValue(),
- dataElementGroupId: this.form.findField('dataelementgroup').getValue(),
- dataElementId: this.form.findField('dataelement').getValue(),
- periodTypeId: this.form.findField('periodtype').getValue(),
- periodId: this.form.findField('period').getValue(),
- startDate: this.form.findField('startdate').getValue(),
- endDate: this.form.findField('enddate').getValue(),
- parentOrganisationUnitId: this.organisationUnitSelection.parent.id,
- organisationUnitLevel: this.organisationUnitSelection.level.level,
- mapLegendType: this.form.findField('maplegendtype').getValue(),
- method: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('method').getValue() : null,
- classes: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('classes').getValue() : null,
- bounds: this.legend.value == GLOBAL.conf.map_legend_type_automatic && this.legend.method == GLOBAL.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null,
- colorLow: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null,
- colorHigh: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null,
- mapLegendSetId: this.form.findField('maplegendset').getValue(),
- radiusLow: null,
- radiusHigh: null,
- longitude: GLOBAL.vars.map.getCenter().lon,
- latitude: GLOBAL.vars.map.getCenter().lat,
- zoom: parseFloat(GLOBAL.vars.map.getZoom())
- };
- },
+ formValues: {
+ getAllValues: function() {
+ return {
+ featureType: GLOBAL.conf.map_feature_type_multipolygon,
+ mapValueType: this.form.findField('mapvaluetype').getValue(),
+ indicatorGroupId: this.form.findField('indicatorgroup').getValue(),
+ indicatorId: this.form.findField('indicator').getValue(),
+ dataElementGroupId: this.form.findField('dataelementgroup').getValue(),
+ dataElementId: this.form.findField('dataelement').getValue(),
+ periodTypeId: this.form.findField('periodtype').getValue(),
+ periodId: this.form.findField('period').getValue(),
+ startDate: this.form.findField('startdate').getValue(),
+ endDate: this.form.findField('enddate').getValue(),
+ parentOrganisationUnitId: this.organisationUnitSelection.parent.id,
+ organisationUnitLevel: this.organisationUnitSelection.level.level,
+ mapLegendType: this.form.findField('maplegendtype').getValue(),
+ method: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('method').getValue() : null,
+ classes: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('classes').getValue() : null,
+ bounds: this.legend.value == GLOBAL.conf.map_legend_type_automatic && this.legend.method == GLOBAL.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null,
+ colorLow: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null,
+ colorHigh: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null,
+ mapLegendSetId: this.form.findField('maplegendset').getValue(),
+ radiusLow: null,
+ radiusHigh: null,
+ longitude: GLOBAL.vars.map.getCenter().lon,
+ latitude: GLOBAL.vars.map.getCenter().lat,
+ zoom: parseFloat(GLOBAL.vars.map.getZoom())
+ };
+ },
+
+ getImageExportValues: function() {
+ return {
+ mapValueTypeValue: this.form.findField('mapvaluetype').getValue() == GLOBAL.conf.map_value_type_indicator ?
+ this.form.findField('indicator').getValue() : this.form.findField('dataelement').getValue(),
+ dateValue: GLOBAL.vars.mapDateType.isFixed() ?
+ this.form.findField('period').getRawValue() : new Date(this.form.findField('startdate').getRawValue()).format('Y M j') + ' - ' + new Date(this.form.findField('enddate').getRawValue()).format('Y M j')
+ };
+ }
+ },
loadGeoJson: function() {
function load() {
=== 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-11-30 18:26:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-12-02 12:41:12 +0000
@@ -1338,34 +1338,45 @@
}
},
- getFormValues: function() {
- return {
- featureType: GLOBAL.conf.map_feature_type_point,
- mapValueType: this.form.findField('mapvaluetype').getValue(),
- indicatorGroupId: this.form.findField('indicatorgroup').getValue(),
- indicatorId: this.form.findField('indicator').getValue(),
- dataElementGroupId: this.form.findField('dataelementgroup').getValue(),
- dataElementId: this.form.findField('dataelement').getValue(),
- periodTypeId: this.form.findField('periodtype').getValue(),
- periodId: this.form.findField('period').getValue(),
- startDate: this.form.findField('startdate').getValue(),
- endDate: this.form.findField('enddate').getValue(),
- parentOrganisationUnitId: this.organisationUnitSelection.parent.id,
- organisationUnitLevel: this.organisationUnitSelection.level.level,
- mapLegendType: this.form.findField('maplegendtype').getValue(),
- method: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('method').getValue() : null,
- classes: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('classes').getValue() : null,
- bounds: this.legend.value == GLOBAL.conf.map_legend_type_automatic && this.legend.method == GLOBAL.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null,
- colorLow: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null,
- colorHigh: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null,
- mapLegendSetId: this.form.findField('maplegendset').getValue(),
- radiusLow: this.form.findField('radiuslow').getValue(),
- radiusHigh: this.form.findField('radiushigh').getValue(),
- longitude: GLOBAL.vars.map.getCenter().lon,
- latitude: GLOBAL.vars.map.getCenter().lat,
- zoom: parseFloat(GLOBAL.vars.map.getZoom())
- };
- },
+ formValues: {
+ getAllFormValues: function() {
+ return {
+ featureType: GLOBAL.conf.map_feature_type_point,
+ mapValueType: this.form.findField('mapvaluetype').getValue(),
+ indicatorGroupId: this.form.findField('indicatorgroup').getValue(),
+ indicatorId: this.form.findField('indicator').getValue(),
+ dataElementGroupId: this.form.findField('dataelementgroup').getValue(),
+ dataElementId: this.form.findField('dataelement').getValue(),
+ periodTypeId: this.form.findField('periodtype').getValue(),
+ periodId: this.form.findField('period').getValue(),
+ startDate: this.form.findField('startdate').getValue(),
+ endDate: this.form.findField('enddate').getValue(),
+ parentOrganisationUnitId: this.organisationUnitSelection.parent.id,
+ organisationUnitLevel: this.organisationUnitSelection.level.level,
+ mapLegendType: this.form.findField('maplegendtype').getValue(),
+ method: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('method').getValue() : null,
+ classes: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('classes').getValue() : null,
+ bounds: this.legend.value == GLOBAL.conf.map_legend_type_automatic && this.legend.method == GLOBAL.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null,
+ colorLow: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null,
+ colorHigh: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null,
+ mapLegendSetId: this.form.findField('maplegendset').getValue(),
+ radiusLow: this.form.findField('radiuslow').getValue(),
+ radiusHigh: this.form.findField('radiushigh').getValue(),
+ longitude: GLOBAL.vars.map.getCenter().lon,
+ latitude: GLOBAL.vars.map.getCenter().lat,
+ zoom: parseFloat(GLOBAL.vars.map.getZoom())
+ };
+ },
+
+ getImageExportValues: function() {
+ return {
+ mapValueTypeValue: this.form.findField('mapvaluetype').getValue() == GLOBAL.conf.map_value_type_indicator ?
+ this.form.findField('indicator').getValue() : this.form.findField('dataelement').getValue(),
+ dateValue: GLOBAL.vars.mapDateType.isFixed() ?
+ this.form.findField('period').getRawValue() : new Date(this.form.findField('startdate').getRawValue()).format('Y M j') + ' - ' + new Date(this.form.findField('enddate').getRawValue()).format('Y M j')
+ };
+ }
+ },
loadGeoJson: function() {
function load() {