[Lada-commits] [PATCH 4 of 5] Open the ort create window on button click

Wald Commits scm-commit at wald.intevation.org
Tue Mar 17 16:05:43 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426604752 -3600
# Node ID 477379250512581ae1fe9e5ffd02d98f0840429b
# Parent  bd151c8b7ad109d34809ab38ae0e522ca1eb1f8e
Open the ort create window on button click.

diff -r bd151c8b7ad1 -r 477379250512 app/controller/grid/Ort.js
--- 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) {
diff -r bd151c8b7ad1 -r 477379250512 app/view/panel/Map.js
--- 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();
         }
     },
 


More information about the Lada-commits mailing list