changeset 68:e54cb2f3566e

Do not define form element in the window. Use new defined Probencreate Form.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 05 Jun 2013 15:41:44 +0200
parents 7ea76e760fc2
children cb1138f5cea7
files app/view/proben/Create.js
diffstat 1 files changed, 6 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/proben/Create.js	Wed Jun 05 15:40:40 2013 +0200
+++ b/app/view/proben/Create.js	Wed Jun 05 15:41:44 2013 +0200
@@ -12,175 +12,23 @@
     modal: true,
 
     requires: [
+        'Lada.view.proben.CreateForm',
         'Lada.view.widgets.Uwb',
         'Lada.view.widgets.Datenbasis',
         'Lada.view.widgets.Probenart',
         'Lada.view.widgets.Betriebsart',
         'Lada.view.widgets.Testdatensatz'
     ],
-
     initComponent: function() {
-        this.items = [
-            {
-                //Define the form
-                xtype: 'form',
-                bodyPadding: '10 10',
-                border: 0,
-                items: [
-                    // Probenangaben
-                    {
-                        xtype: 'fieldset',
-                        title: 'Probenangaben',
-                        defaults: {
-                                labelWidth: 150
-                        },
-                        items: [
-                            {
-                                xtype: 'textfield',
-                                name: 'mstId',
-                                fieldLabel: 'Messstelle'
-                            },
-                            {
-                                xtype: 'textfield',
-                                name: 'hauptprobenNr',
-                                fieldLabel: 'Hauptprobennr.'
-                            },
-                            {
-                                xtype: 'textfield',
-                                name: 'probeId',
-                                fieldLabel: 'Probe-ID'
-                            },
-                            {
-                                xtype: 'fieldset',
-                                title: 'Erweiterte Probenangaben',
-                                collapsible: true,
-                                collapsed: false,
-                                items: [
-                                    {
-                                        xtype: 'datenbasis',
-                                        id: 'datenbasis',
-                                        editable: false,
-                                        name: 'datenbasisId',
-                                        fieldLabel: 'Datenbasis'
-                                    },
-                                    {
-                                        xtype: 'betriebsart',
-                                        name: 'baId',
-                                        fieldLabel: 'Betriebsart'
-                                    },
-                                    {
-                                        xtype: 'testdatensatz',
-                                        name: 'test',
-                                        fieldLabel: 'Testdatensatz'
-                                    },
-                                    {
-                                        xtype: 'probenart',
-                                        id: 'probenart',
-                                        editable: false,
-                                        name: 'probenartId',
-                                        fieldLabel: 'Probenart'
-                                    },
-                                    {
-                                        xtype: 'textfield',
-                                        name: 'probenartId',
-                                        fieldLabel: 'Probennehmer'
-                                    },
-                                    {
-                                        xtype: 'textfield',
-                                        name: 'x11',
-                                        fieldLabel: 'Datensatzerzeuger'
-                                    }
-                                ]
-                            }
-                        ]
-                    },
-                    // Medium
-                    {
-                        xtype: 'fieldset',
-                        title: 'Medium',
-                        defaults: {
-                                labelWidth: 150
-                        },
-                        items: [
-                                {
-                                    xtype: 'uwb',
-                                    name: 'umwId',
-                                    fieldLabel: 'Umweltbereich'
-                                },
-                                {
-                                    xtype: 'textfield',
-                                    name: 'media',
-                                    fieldLabel: 'Medienbezeichnung'
-                                },
-                                {
-                                    xtype: 'textfield',
-                                    name: 'mediaDesk',
-                                    fieldLabel: 'Deskriptoren'
-                                },
-                                {
-                                    xtype: 'fieldset',
-                                    title: 'Details Deskriptoren',
-                                    collapsible: true,
-                                    collapsed: true,
-                                    defaultType: 'textfield',
-                                    items: this.buildDescriptors()
-                                }
-                        ]
-                    },
-                    // Zeit
-                    {
-                        xtype: 'fieldset',
-                        title: 'Zeit',
-                        defaultType: 'datefield',
-                        defaults: {
-                                labelWidth: 150
-                        },
-                        items: [
-                            {
-                                fieldLabel: 'Probennahme Beginn',
-                                name: 'probeentnahmeBeginn'
-                            },
-                            {
-                                fieldLabel: 'Probennahme Ende',
-                                name: 'probeentnahmeEnde'
-                            },
-                            {
-                                fieldLabel: 'Sollzeit Von',
-                                name: 'solldatumBeginn'
-                            },
-                            {
-                                fieldLabel: 'Sollzeit Bis',
-                                name: 'solldatumEnde'
-                            },
-                            {
-                                fieldLabel: 'Ursprungszeit',
-                                name: 'z5'
-                            }
-                        ]
-                    }
-                ]
-            }
-        ];
-
+        var form = Ext.create('Lada.view.proben.CreateForm');
+        this.items = [form];
         this.buttons = [
             {
                 text: 'Speichern',
-                action: 'save'
-            },
-            {
-                text: 'Verwerfen',
-                scope: this,
-                handler: this.close
+                handler: form.commit,
+                scope: form
             }
         ];
-        this.callParent(arguments);
-    },
-    buildDescriptors: function() {
-        var fields = new Array();
-        for ($i=0; $i<12; $i++) {
-            fields[$i] = {fieldLabel: 'S'+$i, name: 's'+$i};
-        }
-        return fields;
+        this.callParent();
     }
 });
-

http://lada.wald.intevation.org