=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/relocate_14.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/relocate_14.png 2012-10-02 11:24:35 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/relocate_14.png 2013-12-27 18:20:40 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/relocate_16.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/relocate_16.png 2012-10-02 09:45:46 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/relocate_16.png 2013-12-27 18:20:40 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-12-27 13:44:39 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-12-27 18:04:31 +0000 @@ -8433,7 +8433,6 @@ success: function(r) { gis.olmap.relocate.active = false; gis.olmap.relocate.window.destroy(); - gis.olmap.relocate.feature.move({x: parseFloat(e.clientX - center.x), y: parseFloat(e.clientY - 28)}); gis.olmap.getViewport().style.cursor = 'auto'; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2013-12-24 15:22:04 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2013-12-27 18:43:30 +0000 @@ -486,6 +486,46 @@ })); menuItems.push( Ext.create('Ext.menu.Item', { + text: 'Swap lon/lat', + iconCls: 'gis-menu-item-icon-relocate', + disabled: !gis.init.user.isAdmin, + handler: function(item) { + var id = feature.attributes.id, + geo = Ext.clone(feature.geometry).transform('EPSG:900913', 'EPSG:4326'); + + if (Ext.isNumber(geo.x) && Ext.isNumber(geo.y) && gis.init.user.isAdmin) { + Ext.Ajax.request({ + url: gis.init.contextPath + '/api/organisationUnits/' + id + '.json?links=false', + success: function(r) { + var orgUnit = Ext.decode(r.responseText); + + orgUnit.coordinates = '[' + geo.y.toFixed(5) + ',' + geo.x.toFixed(5) + ']'; + + Ext.Ajax.request({ + url: gis.init.contextPath + '/api/metaData?preheatCache=false', + method: 'POST', + headers: {'Content-Type': 'application/json'}, + params: Ext.encode({organisationUnits: [orgUnit]}), + success: function(r) { + var x = feature.geometry.x, + y = feature.geometry.y; + + delete feature.geometry.bounds; + feature.geometry.x = y; + feature.geometry.y = x; + + layer.redraw(); + + console.log(feature.attributes.name + ' relocated to ' + orgUnit.coordinates); + } + }); + } + }); + } + } + })); + + menuItems.push( Ext.create('Ext.menu.Item', { text: GIS.i18n.show_information_sheet, iconCls: 'gis-menu-item-icon-information', handler: function(item) {