diff app/controller/grid/Ortszuordnung.js @ 1361:5c2d6812d85a

Merge behaviour of Stammdaten panel and ortszuordnungs grid according to the recent changes in Ortszuordnung and Ortserstellung.
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 07 Feb 2017 19:50:36 +0100
parents 195c5d9b234b
children e98ec562764f
line wrap: on
line diff
--- a/app/controller/grid/Ortszuordnung.js	Tue Feb 07 18:56:35 2017 +0100
+++ b/app/controller/grid/Ortszuordnung.js	Tue Feb 07 19:50:36 2017 +0100
@@ -154,15 +154,12 @@
     },
 
     /**
-     *
-     * Creates an event listener for a map click
+     * Creates a new Ortrecord from map coordinates
      */
     frommap: function(button) {
         var map = button.up('ortszuordnungwindow').down('map');
-        map.getEl().setStyle('cursor', 'crosshair');
-        var me = this;
-        map.map.events.register('click', button, me.newOrtfromMapClick);
-        // TODO Deactivate event listener if button is destroyed
+        var record = Ext.create('Lada.model.Ort');
+        map.activateDraw(record);
     },
 
     /**
@@ -182,28 +179,6 @@
     },
 
     /**
-     * Gets the clicked map's coordinates and opens a new Messpunkt window with coordinates prefilled
-     */
-    newOrtfromMapClick: function(evt) {
-        var me = this; //this = button(action:frommap)
-        var map = this.up('ortszuordnungwindow').down('map').map;
-        this.up('ortszuordnungwindow').down('map').getEl().setStyle('cursor', 'auto');
-        var lonlat = map.getLonLatFromViewPortPx(evt.xy).transform(new OpenLayers.Projection('EPSG:3857'),
-                                                                   new OpenLayers.Projection('EPSG:4326'));
-        var controller = Lada.app.getController('Lada.controller.grid.Ortszuordnung');
-        map.events.unregister('click', this, controller.newOrtfromMapClick);
-        Ext.create('Lada.view.window.Ortserstellung', {
-            record: Ext.create('Lada.model.Ort',{
-                koordXExtern: lonlat.lon,
-                koordYExtern: lonlat.lat,
-                kdaId : 4,
-                ortTyp: 1
-            }),
-            parentWindow: this.up('ortszuordnungwindow')
-        }).show();
-    },
-
-    /**
      * Search triggered by textfield key event.
      */
     search: function(field, evt, opts) {

http://lada.wald.intevation.org