changeset 643:477379250512

Open the ort create window on button click.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 17 Mar 2015 16:05:52 +0100
parents bd151c8b7ad1
children 71e8b84d7829
files app/controller/grid/Ort.js app/view/panel/Map.js
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/Ort.js	Tue Mar 17 16:05:04 2015 +0100
+++ b/app/controller/grid/Ort.js	Tue Mar 17 16:05:52 2015 +0100
@@ -35,9 +35,14 @@
         win.initData();
     },
 
-    add: function() {
-        // todo
-        console.log('add');
+    add: function(button) {
+        var probe = button.up('window').record;
+        var win = Ext.create('Lada.view.window.OrtCreate', {
+            record: probe,
+            grid: button.up('ortgrid')
+        });
+        win.show();
+        win.initData();
     },
 
     remove: function(button) {
--- a/app/view/panel/Map.js	Tue Mar 17 16:05:04 2015 +0100
+++ b/app/view/panel/Map.js	Tue Mar 17 16:05:52 2015 +0100
@@ -32,9 +32,10 @@
      * Initialize the map panel.
      */
     initComponent: function() {
+        var id = this.record ? this.record.get('id') : Math.floor(Math.random() * 100);
         this.layers = [
             new OpenLayers.Layer.WMS(
-                'Standard' + this.record.get('id'),
+                'Standard' + id,
                 'http://osm.intevation.de/cgi-bin/standard.fcgi?',
                 {
                     layers: 'OSM-WMS-Dienst',
@@ -46,7 +47,7 @@
                     visibility: true
                 })
         ];
-        this.map = new OpenLayers.Map('map_' + this.record.get('id'), {
+        this.map = new OpenLayers.Map('map_' + id, {
             controls: [],
             tileManager: null,
             zoomMethod: null
@@ -77,7 +78,7 @@
                 }
             ));
         }
-        this.featureLayer = new OpenLayers.Layer.Vector('vector' + this.record.get('id'), {
+        this.featureLayer = new OpenLayers.Layer.Vector('vector_' + this.map.name, {
             styleMap: new OpenLayers.StyleMap({
                 'default': new OpenLayers.Style(OpenLayers.Util.applyDefaults({
                     externalGraphic: 'resources/lib/OpenLayers/img/marker-green.png',
@@ -160,7 +161,7 @@
             this.selectFeature(this.record.get('ort'));
         }
         else {
-            this.map.zoomToScale(this.mapOptions.scales[0]);
+            this.map.zoomToMaxExtent();
         }
     },
 

http://lada.wald.intevation.org