dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07988
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2372: (GIS) Minor bugs fixed + improved validation + improved code.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2372 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-10-14 18:35:44 +0200
message:
(GIS) Minor bugs fixed + improved validation + improved code.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm
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/resources/org/hisp/dhis/mapping/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2010-10-14 12:39:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2010-10-14 15:22:45 +0000
@@ -143,7 +143,6 @@
was_deleted = was deleted
new_map_view = New map view
there_is_already_a_map_view_called = There is already a map view called
-map_view_name_cannot_be_longer_than_25_characters = Map view name cannot contain more than 25 characters
thematic_map_form_is_not_complete = Thematic map form is not complete
map_view_form_is_not_complete = Map view form is not complete
save = Save
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2010-09-19 23:12:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2010-10-14 15:22:45 +0000
@@ -98,7 +98,6 @@
var i18n_is_already_in_use = '$encoder.jsEscape($i18n.getString( 'is_already_in_use' ) , "'")';
var i18n_new_overlay = '$encoder.jsEscape($i18n.getString( 'new_overlay' ) , "'")';
var i18n_name = '$encoder.jsEscape($i18n.getString( 'name' ) , "'")';
-var i18n_overlay_name_cannot_be_longer_than_25_characters = '$encoder.jsEscape($i18n.getString( 'overlay_name_cannot_be_longer_than_25_characters' ) , "'")';
var i18n_overlay_form_is_not_complete = '$encoder.jsEscape($i18n.getString( 'overlay_form_is_not_complete' ) , "'")';
var i18n_display_name = '$encoder.jsEscape($i18n.getString( 'display_name' ) , "'")';
var i18n_fill_color = '$encoder.jsEscape($i18n.getString( 'fill_color' ) , "'")';
=== 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-14 13:05:47 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-10-14 15:22:45 +0000
@@ -99,7 +99,8 @@
/* Section: mapview */
var viewStore=new Ext.data.JsonStore({url:GLOBALS.config.path_mapping+'getAllMapViews'+GLOBALS.config.type,root:'mapViews',fields:['id','name'],id:'id',sortInfo:{field:'name',direction:'ASC'},autoLoad:false});
- var viewNameTextField=new Ext.form.TextField({id:'viewname_tf',emptytext:'',width:GLOBALS.config.combo_width,hideLabel:true});
+ var viewNameTextField=new Ext.form.TextField({id:'viewname_tf',emptytext:'',width:GLOBALS.config.combo_width,hideLabel:true,autoCreate:{tag:'input',type:'text',size:'20',autocomplete:'off', maxlength:'35'}
+});
var viewComboBox=new Ext.form.ComboBox({id:'view_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:GLOBALS.config.emptytext,selectOnFocus:true,width:GLOBALS.config.combo_width,minListWidth:GLOBALS.config.combo_width,store:viewStore});
var view2ComboBox=new Ext.form.ComboBox({id:'view2_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:GLOBALS.config.emptytext,selectOnFocus:true,width:GLOBALS.config.combo_width,minListWidth:GLOBALS.config.combo_width,store:viewStore});
@@ -120,75 +121,27 @@
text: i18n_save,
handler: function() {
var vn = Ext.getCmp('viewname_tf').getValue();
- var mvt = Ext.getCmp('mapvaluetype_cb').getValue();
- var ig = mvt == GLOBALS.config.map_value_type_indicator ? Ext.getCmp('indicatorgroup_cb').getValue() : '';
- var ii = mvt == GLOBALS.config.map_value_type_indicator ? Ext.getCmp('indicator_cb').getValue() : '';
- var deg = mvt == GLOBALS.config.map_value_type_dataelement ? Ext.getCmp('dataelementgroup_cb').getValue() : '';
- var de = mvt == GLOBALS.config.map_value_type_dataelement ? Ext.getCmp('dataelement_cb').getValue() : '';
- var pt = MAPDATETYPE == GLOBALS.config.map_date_type_fixed ? Ext.getCmp('periodtype_cb').getValue() : '';
- var p = MAPDATETYPE == GLOBALS.config.map_date_type_fixed ? Ext.getCmp('period_cb').getValue() : '';
- var sd = MAPDATETYPE == GLOBALS.config.map_date_type_start_end ? new Date(Ext.getCmp('startdate_df').getValue()).format('Y-m-d') : '';
- var ed = MAPDATETYPE == GLOBALS.config.map_date_type_start_end ? new Date(Ext.getCmp('enddate_df').getValue()).format('Y-m-d') : '';
- var ms = MAPSOURCE == GLOBALS.config.map_source_type_database ? Ext.getCmp('map_tf').value : Ext.getCmp('map_cb').getValue();
- var mlt = Ext.getCmp('maplegendtype_cb').getValue();
- var m = mlt == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('method_cb').getValue() : '';
- var c = mlt == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('numClasses_cb').getValue() : '';
- var b = mlt == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('bounds_tf').getValue() || '' : '';
- var ca = Ext.getCmp('colorA_cf').getValue();
- var cb = Ext.getCmp('colorB_cf').getValue();
- var mlsid = mlt == GLOBALS.config.map_legend_type_predefined ? Ext.getCmp('maplegendset_cb').getValue() || '' : '';
- var lon = MAP.getCenter().lon;
- var lat = MAP.getCenter().lat;
- var zoom = parseInt(MAP.getZoom());
-
- if (!vn) {
- Ext.message.msg(false, i18n_map_view_form_is_not_complete);
- return;
- }
-
- if (!ii && !de) {
- Ext.message.msg(false, i18n_thematic_map_form_is_not_complete);
- return;
- }
-
- if (MAPDATETYPE == GLOBALS.config.map_date_type_fixed) {
- if (!p) {
- Ext.message.msg(false, i18n_thematic_map_form_is_not_complete);
- return;
- }
- }
- else {
- if (!Ext.getCmp('startdate_df').getValue() || !Ext.getCmp('enddate_df').getValue()) {
- Ext.message.msg(false, i18n_thematic_map_form_is_not_complete);
- return;
- }
- }
-
- if (!ms) {
- Ext.message.msg(false, i18n_thematic_map_form_is_not_complete);
- return;
- }
-
- if (mlt == GLOBALS.config.map_legend_type_automatic) {
- if (m == GLOBALS.config.classify_with_bounds) {
- if (!b) {
- Ext.message.msg(false, i18n_thematic_map_form_is_not_complete);
- return;
- }
- }
- }
- else {
- if (!mlsid) {
- Ext.message.msg(false, i18n_thematic_map_form_is_not_complete);
- return;
- }
- }
-
- if (GLOBALS.util.validateInputNameLength(vn) == false) {
- Ext.message.msg(false, i18n_map_view_name_cannot_be_longer_than_25_characters );
- return;
- }
-
+
+ if (!vn) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ return;
+ }
+
+ var formValues;
+
+ if (ACTIVEPANEL == GLOBALS.config.thematicMap) {
+ if (!choropleth.validateForm(true)) {
+ return;
+ }
+ formValues = choropleth.getFormValues();
+ }
+ else if (ACTIVEPANEL == GLOBALS.config.thematicMap2) {
+ if (!proportionalSymbol.validateForm(true)) {
+ return;
+ }
+ formValues = proportionalSymbol.getFormValues();
+ }
+
Ext.Ajax.request({
url: GLOBALS.config.path_mapping + 'getAllMapViews' + GLOBALS.config.type,
method: 'GET',
@@ -207,31 +160,32 @@
method: 'POST',
params: {
name: vn,
- mapValueType: mvt,
- indicatorGroupId: ig,
- indicatorId: ii,
- dataElementGroupId: deg,
- dataElementId: de,
- periodTypeId: pt,
- periodId: p,
- startDate: sd,
- endDate: ed,
- mapSource: ms,
- mapLegendType: mlt,
- method: m,
- classes: c,
- bounds: b,
- colorLow: ca,
- colorHigh: cb,
- mapLegendSetId: mlsid,
- longitude: lon,
- latitude: lat,
- zoom: zoom
+ mapValueType: formValues.mapValueType,
+ indicatorGroupId: formValues.indicatorGroupId,
+ indicatorId: formValues.indicatorId,
+ dataElementGroupId: formValues.dataElementGroupId,
+ dataElementId: formValues.dataElementId,
+ periodTypeId: formValues.periodTypeId,
+ periodId: formValues.periodId,
+ startDate: formValues.startDate,
+ endDate: formValues.endDate,
+ mapSource:formValues.mapSource,
+ mapLegendType: formValues.mapLegendType,
+ method: formValues.method,
+ classes: formValues.classes,
+ bounds: formValues.bounds,
+ colorLow: formValues.colorLow,
+ colorHigh: formValues.colorHigh,
+ mapLegendSetId: formValues.mapLegendSetId,
+ longitude: formValues.longitude,
+ latitude: formValues.latitude,
+ zoom: formValues.zoom
},
success: function(r) {
Ext.message.msg(true, 'The view <span class="x-msg-hl">' + vn + '</span> ' + i18n_was_registered);
Ext.getCmp('view_cb').getStore().load();
Ext.getCmp('mapview_cb').getStore().load();
+ Ext.getCmp('mapview_cb2').getStore().load();
Ext.getCmp('viewname_tf').reset();
}
});
=== 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-13 21:58:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-10-14 16:30:09 +0000
@@ -1299,18 +1299,9 @@
this.prepareMapViewMap();
if (MAPSOURCE == GLOBALS.config.map_source_type_database) {
- Ext.Ajax.request({
- url: GLOBALS.config.path_commons + 'getOrganisationUnit' + GLOBALS.config.type,
- method: 'POST',
- params: {id: this.mapView.mapSource},
- scope: this,
- success: function(r) {
- var name = Ext.util.JSON.decode(r.responseText).organisationUnit.name;
- Ext.getCmp('map_tf').setValue(name);
- Ext.getCmp('map_tf').value = this.mapView.mapSource;
- this.loadFromDatabase(this.mapView.mapSource);
- }
- });
+ Ext.getCmp('map_tf').setValue(this.mapView.parentOrganisationUnitName);
+ Ext.getCmp('map_tf').value = this.mapView.mapSource;
+ this.loadFromDatabase(this.mapView.mapSource);
}
else {
Ext.getCmp('map_cb').setValue(this.mapView.mapSource);
@@ -1441,9 +1432,54 @@
return false;
}
+ if (Ext.getCmp('maplegendtype_cb').getValue() == GLOBALS.config.map_legend_type_automatic) {
+ if (Ext.getCmp('method_cb').getValue() == GLOBALS.config.classify_with_bounds) {
+ if (!Ext.getCmp('bounds_tf').getValue()) {
+ if (exception) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ }
+ return false;
+ }
+ }
+ }
+ else if (Ext.getCmp('maplegendtype_cb').getValue() == GLOBALS.config.map_legend_type_predefined) {
+ if (!Ext.getCmp('maplegendset_cb').getValue()) {
+ if (exception) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ }
+ return false;
+ }
+ }
+
return true;
},
+ getFormValues: function() {
+ return {
+ mapValueType: Ext.getCmp('mapvaluetype_cb').getValue(),
+ indicatorGroupId: Ext.getCmp('indicatorgroup_cb').getValue() || '',
+ indicatorId: Ext.getCmp('indicator_cb').getValue() || '',
+ dataElementGroupId: Ext.getCmp('dataelementgroup_cb').getValue() || '',
+ dataElementId: Ext.getCmp('dataelement_cb').getValue() || '',
+ periodTypeId: Ext.getCmp('periodtype_cb').getValue() || '',
+ periodId: Ext.getCmp('period_cb').getValue() || '',
+ startDate: Ext.getCmp('startdate_df').getValue() || '',
+ endDate: Ext.getCmp('enddate_df').getValue() || '',
+ mapSource: MAPSOURCE == GLOBALS.config.map_source_type_database ?
+ Ext.getCmp('map_tf').value : Ext.getCmp('map_cb').getValue(),
+ mapLegendType: Ext.getCmp('maplegendtype_cb').getValue(),
+ method: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('method_cb').getValue() : '',
+ classes: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('numClasses_cb').getValue() : '',
+ bounds: this.legend.type == GLOBALS.config.map_legend_type_automatic && this.legend.method == GLOBALS.config.classify_with_bounds ? Ext.getCmp('bounds_tf').getValue() : '',
+ colorLow: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('colorA_cf').getValue() : '',
+ colorHigh: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('colorB_cf').getValue() : '',
+ mapLegendSetId: Ext.getCmp('maplegendset_cb').getValue() || '',
+ longitude: MAP.getCenter().lon,
+ latitude: MAP.getCenter().lon,
+ zoom: parseInt(MAP.getZoom())
+ };
+ },
+
applyValues: function() {
var options = {};
this.indicator = 'value';
=== 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-12 15:24:42 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-10-14 16:30:09 +0000
@@ -1233,18 +1233,9 @@
this.prepareMapViewMap();
if (MAPSOURCE == GLOBALS.config.map_source_type_database) {
- Ext.Ajax.request({
- url: GLOBALS.config.path_commons + 'getOrganisationUnit' + GLOBALS.config.type,
- method: 'POST',
- params: {id: this.mapView.mapSource},
- scope: this,
- success: function(r) {
- var name = Ext.util.JSON.decode(r.responseText).organisationUnit.name;
- Ext.getCmp('map_tf2').setValue(name);
- Ext.getCmp('map_tf2').value = this.mapView.mapSource;
- this.loadFromDatabase(this.mapView.mapSource);
- }
- });
+ Ext.getCmp('map_tf2').setValue(this.mapView.parentOrganisationUnitName);
+ Ext.getCmp('map_tf2').value = this.mapView.mapSource;
+ this.loadFromDatabase(this.mapView.mapSource);
}
else {
Ext.getCmp('map_cb2').setValue(this.mapView.mapSource);
@@ -1375,9 +1366,54 @@
return false;
}
+ if (Ext.getCmp('maplegendtype_cb2').getValue() == GLOBALS.config.map_legend_type_automatic) {
+ if (Ext.getCmp('method_cb2').getValue() == GLOBALS.config.classify_with_bounds) {
+ if (!Ext.getCmp('bounds_tf2').getValue()) {
+ if (exception) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ }
+ return false;
+ }
+ }
+ }
+ else if (Ext.getCmp('maplegendtype_cb2').getValue() == GLOBALS.config.map_legend_type_predefined) {
+ if (!Ext.getCmp('maplegendset_cb2').getValue()) {
+ if (exception) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ }
+ return false;
+ }
+ }
+
return true;
},
+ getFormValues: function() {
+ return {
+ mapValueType: Ext.getCmp('mapvaluetype_cb2').getValue(),
+ indicatorGroupId: Ext.getCmp('indicatorgroup_cb2').getValue() || '',
+ indicatorId: Ext.getCmp('indicator_cb2').getValue() || '',
+ dataElementGroupId: Ext.getCmp('dataelementgroup_cb2').getValue() || '',
+ dataElementId: Ext.getCmp('dataelement_cb2').getValue() || '',
+ periodTypeId: Ext.getCmp('periodtype_cb2').getValue() || '',
+ periodId: Ext.getCmp('period_cb2').getValue() || '',
+ startDate: Ext.getCmp('startdate_df2').getValue() || '',
+ endDate: Ext.getCmp('enddate_df2').getValue() || '',
+ mapSource: MAPSOURCE == GLOBALS.config.map_source_type_database ?
+ Ext.getCmp('map_tf2').value : Ext.getCmp('map_cb2').getValue(),
+ mapLegendType: Ext.getCmp('maplegendtype_cb2').getValue(),
+ method: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('method_cb2').getValue() : '',
+ classes: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('numClasses_cb2').getValue() : '',
+ bounds: this.legend.type == GLOBALS.config.map_legend_type_automatic && this.legend.method == GLOBALS.config.classify_with_bounds ? Ext.getCmp('bounds_tf2').getValue() : '',
+ colorLow: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('colorA_cf2').getValue() : '',
+ colorHigh: this.legend.type == GLOBALS.config.map_legend_type_automatic ? Ext.getCmp('colorB_cf2').getValue() : '',
+ mapLegendSetId: Ext.getCmp('maplegendset_cb2').getValue() || '',
+ longitude: MAP.getCenter().lon,
+ latitude: MAP.getCenter().lon,
+ zoom: parseInt(MAP.getZoom())
+ };
+ },
+
applyValues: function() {
var options = {};
this.indicator = 'value';