Merge authors: Jan Henrik Ă˜verland (janhenrik-overland) ------------------------------------------------------------ revno: 13406 [merge] committer: Jan Henrik Overland <janhenrik.overl...@gmail.com> branch nick: dhis2 timestamp: Mon 2013-12-23 17:06:44 +0100 message: gis relocate facility request migrated to web api modified: dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.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/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-12-23 15:33:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-12-23 16:05:10 +0000 @@ -8414,23 +8414,34 @@ gis.olmap.events.register('click', null, function(e) { if (gis.olmap.relocate.active) { var el = Ext.query('#mouseposition')[0], + id = gis.olmap.relocate.feature.attributes.id, coordinates = '[' + el.childNodes[1].data + ',' + el.childNodes[3].data + ']', center = gis.viewport.centerRegion; - Ext.Ajax.request({ - url: gis.init.contextPath + gis.conf.finals.url.path_module + 'updateOrganisationUnitCoordinates.action', - method: 'POST', - params: {id: gis.olmap.relocate.feature.attributes.id, coordinates: coordinates}, - 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'; - - console.log(gis.olmap.relocate.feature.attributes.name + ' relocated to ' + coordinates); - } - }); + Ext.Ajax.request({ + url: gis.init.contextPath + '/api/organisationUnits/' + id + '.json?links=false', + success: function(r) { + var orgUnit = Ext.decode(r.responseText); + + orgUnit.coordinates = coordinates; + + 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) { + 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'; + + console.log(gis.olmap.relocate.feature.attributes.name + ' relocated to ' + coordinates); + } + }); + } + }); } });
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp