=== 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 2011-03-20 17:57:30 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2011-03-21 11:49:58 +0000 @@ -3,7 +3,7 @@ - DHIS 2 - OpenHealthMapper + OpenHealthMapper - Joint HISP/WHO initiative === 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 2011-03-16 13:42:50 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2011-03-21 11:49:58 +0000 @@ -385,6 +385,7 @@ maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), numZoomLevels: 21 }); + gm_normal.layerType = G.conf.map_layer_type_baselayer; G.vars.map.addLayer(gm_normal); @@ -394,6 +395,7 @@ maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), numZoomLevels: 21 }); + gm_hybrid.layerType = G.conf.map_layer_type_baselayer; G.vars.map.addLayer(gm_hybrid); @@ -549,44 +551,46 @@ handler: function() { var v = Ext.getCmp('favorite_cb').getValue(); var rw = Ext.getCmp('favorite_cb').getRawValue(); - var userId = G.stores.mapView.getAt(G.stores.mapView.findExact('id', v)).data.userId; - if (userId || G.user.isAdmin) { - if (!v) { - Ext.message.msg(false, G.i18n.please_select_a_map_view); - return; - } - - Ext.Ajax.request({ - url: G.conf.path_mapping + 'deleteMapView' + G.conf.type, - method: 'POST', - params: {id: v}, - success: function(r) { - Ext.message.msg(true, G.i18n.favorite + ' ' + rw + ' ' + G.i18n.deleted); - Ext.getCmp('favorite_cb').clearValue(); - - var featureType = G.stores.mapView.getAt(G.stores.mapView.findExact('id', v)).data.featureType; - if (featureType == G.conf.map_feature_type_multipolygon) { - G.stores.polygonMapView.load(); - } - else if (featureType == G.conf.map_feature_type_point) { - G.stores.pointMapView.load(); - } - - G.stores.mapView.load(); - - if (v == choropleth.form.findField('mapview').getValue()) { - choropleth.form.findField('mapview').clearValue(); - } - if (v == symbol.form.findField('mapview').getValue()) { - symbol.form.findField('mapview').clearValue(); - } - } - }); + if (v) { + var userId = G.stores.mapView.getAt(G.stores.mapView.findExact('id', v)).data.userId; + if (userId || G.user.isAdmin) { + Ext.Ajax.request({ + url: G.conf.path_mapping + 'deleteMapView' + G.conf.type, + method: 'POST', + params: {id: v}, + success: function(r) { + Ext.message.msg(true, G.i18n.favorite + ' ' + rw + ' ' + G.i18n.deleted); + Ext.getCmp('favorite_cb').clearValue(); + + var featureType = G.stores.mapView.getAt(G.stores.mapView.findExact('id', v)).data.featureType; + if (featureType == G.conf.map_feature_type_multipolygon) { + G.stores.polygonMapView.load(); + } + else if (featureType == G.conf.map_feature_type_point) { + G.stores.pointMapView.load(); + } + + G.stores.mapView.load(); + + if (v == choropleth.form.findField('mapview').getValue()) { + choropleth.form.findField('mapview').clearValue(); + } + if (v == symbol.form.findField('mapview').getValue()) { + symbol.form.findField('mapview').clearValue(); + } + } + }); + } + else { + Ext.message.msg(false, 'Access denied'); + } } else { - Ext.message.msg(false, 'Access denied'); + Ext.message.msg(false, G.i18n.please_select_a_map_view); + return; } + } }, { @@ -609,8 +613,8 @@ method: 'POST', params: {id: v}, success: function(r) { + Ext.getCmp('favorite_cb').clearValue(); Ext.message.msg(true, G.i18n.favorite + ' ' + rv + ' ' + G.i18n.added_to_dashboard); - Ext.getCmp('favorite_cb').clearValue(); } }); }