changeset 94:21c069e2ecdb

Added Orte to the Proben edit window
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 13 Jun 2013 14:24:18 +0200 (2013-06-13)
parents ab067fdb91b5
children 453985cacb39
files app/controller/Proben.js app/model/Ort.js app/store/Orte.js app/view/orte/List.js app/view/proben/Edit.js app/view/proben/EditForm.js
diffstat 6 files changed, 95 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Proben.js	Thu Jun 13 11:04:11 2013 +0200
+++ b/app/controller/Proben.js	Thu Jun 13 14:24:18 2013 +0200
@@ -7,6 +7,7 @@
     ],
     stores: [
         'Proben',
+        'Orte',
         'Uwb',
         'Datenbasis',
         'Probenart',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/model/Ort.js	Thu Jun 13 14:24:18 2013 +0200
@@ -0,0 +1,35 @@
+Ext.define('Lada.model.Ort', {
+    extend: 'Ext.data.Model',
+    fields: [
+        {name: "ort"},
+        {name: "ortId", mapping:"ort.ortId", type: 'int'},
+        {name: "otyp", mapping:"ort.otyp"},
+        {name: "bezeichnung", mapping:"ort.bezeichnung"},
+        {name: "beschreibung", mapping:"ort.beschreibung"},
+        {name: "unscharf", mapping:"ort.unscharf"},
+        {name: "nutsCode", mapping:"ort.nutsCode"},
+        {name: "koordXExtern", mapping:"ort.koordXExtern"},
+        {name: "koordYExtern", mapping:"ort.koordYExtern"},
+        {name: "hoeheLand", mapping:"ort.hoeheLand", type: 'float'},
+        {name: "letzteAenderung", mapping:"ort.letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()},
+        {name: "latitude", mapping:"ort.latitude", type: 'float'},
+        {name: "longitude", mapping:"ort.longitude", type: 'float'}
+    ],
+    idProperty: "ortId",
+    proxy: {
+        type: 'rest',
+        appendId: true, //default
+        url: 'server/rest/ort',
+        api: {
+        },
+        reader: {
+            type: 'json',
+            root: 'data'
+        }
+    }
+});
+
+function ts2date(v, record){
+    // Converts a timestamp into a date object.
+    return new Date(v);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/store/Orte.js	Thu Jun 13 14:24:18 2013 +0200
@@ -0,0 +1,4 @@
+Ext.define('Lada.store.Orte', {
+    extend: 'Ext.data.Store',
+    model: 'Lada.model.Ort'
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/orte/List.js	Thu Jun 13 14:24:18 2013 +0200
@@ -0,0 +1,43 @@
+Ext.define('Lada.view.orte.List' ,{
+    extend: 'Ext.grid.Panel',
+    alias: 'widget.ortelist',
+    store: 'Orte',
+    viewConfig: {
+        maxHeight: 350,
+        emptyText: 'Keine Orte gefunden.',
+        // minHeight and deferEmptyText are needed to be able to show the
+        // emptyText message.
+        minHeight: 35,
+        deferEmptyText: false
+    },
+    initComponent: function() {
+        this.dockedItems = [
+            {
+                xtype: 'toolbar',
+                dock: 'top',
+                items: [
+                    {
+                        text: 'Hinzufügen',
+                        icon: 'gfx/plus.gif',
+                        action: 'add'
+                    },
+                    {
+                        text: 'Löschen',
+                        icon: 'gfx/minus.gif',
+                        action: 'delete'
+                    }
+                ]
+            }
+        ];
+        this.columns = [
+            {header: 'Typ', dataIndex: 'otyp'},
+            {header: 'ID', dataIndex: 'ortId'},
+            {header: 'Staat', dataIndex: ''},
+            {header: 'Gem-ID', dataIndex: ''},
+            {header: 'Gemeindebezeichnung', dataIndex: 'bezeichnung'},
+            {header: 'Messpunkt', dataIndex: ''}
+        ];
+        this.callParent(arguments);
+    }
+});
+
--- a/app/view/proben/Edit.js	Thu Jun 13 11:04:11 2013 +0200
+++ b/app/view/proben/Edit.js	Thu Jun 13 14:24:18 2013 +0200
@@ -19,7 +19,8 @@
         'Lada.view.widgets.Betriebsart',
         'Lada.view.widgets.Testdatensatz',
         'Lada.view.widgets.Netzbetreiber',
-        'Lada.view.kommentare.List'
+        'Lada.view.kommentare.List',
+        'Lada.view.orte.List'
     ],
 
     initComponent: function() {
@@ -37,6 +38,15 @@
                 //probe: record.data['probeId']
             }
         });
+        // Load Orte
+        var orte = form.down('ortelist');
+        var ostore = orte.getStore();
+        ostore.load({
+            params: {
+                probe: this.initialConfig['modelId']
+                //probe: record.data['probeId']
+            }
+        });
         this.items = [form];
         this.buttons = [
             {
--- a/app/view/proben/EditForm.js	Thu Jun 13 11:04:11 2013 +0200
+++ b/app/view/proben/EditForm.js	Thu Jun 13 14:24:18 2013 +0200
@@ -148,42 +148,7 @@
                 padding: '10 10',
                 items: [
                     {
-                        xtype: 'grid',
-                        dockedItems: [
-                            {
-                                xtype: 'toolbar',
-                                dock: 'top',
-                                items: [
-                                    {
-                                        text: 'Hinzufügen',
-                                        icon: 'gfx/plus.gif'
-                                    },
-                                    {
-                                        text: 'Löschen',
-                                        icon: 'gfx/minus.gif'
-                                    }
-                                ]
-                            }
-                        ],
-                        columns: [
-                            {
-                                text: 'Typ'
-                            },
-                            {
-                                text: 'Staat'
-                            },
-                            {
-                                text: 'Gem-ID'
-                            },
-                            {
-                                text: 'Gemeindebezeichnung',
-                                flex: 1
-                            },
-                            {
-                                text: 'Messpunkt',
-                                flex: 1
-                            }
-                        ]
+                        xtype: 'ortelist'
                     }
                 ]
             },

http://lada.wald.intevation.org