changeset 778:db85bafd383f

Merged Heads
author Dustin Demuth <dustin@intevation.de>
date Tue, 12 May 2015 17:00:57 +0200
parents 5a153d36ed4e (diff) 882a1a13ea96 (current diff)
children 3309db91b8c1
files
diffstat 4 files changed, 84 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Messprogramm.js	Tue May 12 16:46:39 2015 +0200
+++ b/app/controller/form/Messprogramm.js	Tue May 12 17:00:57 2015 +0200
@@ -26,11 +26,18 @@
             'messprogrammform': {
                 dirtychange: this.dirtyForm
             },
-            'messprogrammform [xtype="numberfield"]': {
+            'messprogrammform datetime textfield': {
+                blur: this.checkDatePeriod
+            },
+            'messprogrammform [name="teilintervallVon"]': {
                 change: this.synchronizeSlider,
                 blur: this.checkPeriod
             },
-            'messprogrammform probenintervall combobox': {
+            'messprogrammform [name="teilintervallBis"]': {
+                change: this.synchronizeSlider,
+                blur: this.checkPeriod
+            },
+             'messprogrammform probenintervall combobox': {
                 select: this.updateIntervalls
             }
         });
@@ -181,7 +188,6 @@
      * The function validates if the start is smaller than end.
      */
     checkPeriod: function(field) {
-
         // This field might be a field within a Period.
         // Search for Partner field (period: end/start) and validate
         // End Before Start validation
@@ -196,5 +202,33 @@
                 field.up('fieldset').clearMessages();
             }
         }
-    }
-});
+    },
+
+    /**
+     * checkDatePeriod() is called when a fields defining an intervall
+     * were modified
+     * The function validates if the start is smaller than end.
+     * Same as checkPeriod but requires DATETIME fields
+     */
+    checkDatePeriod: function(field) {
+        // This field might be a field within a Period.
+        // Search for Partner field (period: end/start) and validate
+        // End Before Start validation
+        if (field.period) {
+            var partners = new Array();
+                partners[0] = field.up('fieldset')
+                    .down('datetime[period=start]')
+                    .down('textfield')
+                    .getValue()
+                partners[1] = field.up('fieldset')
+                    .down('datetime[period=end]')
+                    .down('textfield')
+                    .getValue()
+            if (partners[0] && partners[1] && partners[0] > partners [1]) {
+                var msg = Lada.getApplication().bundle.getMsg('662');
+                field.up('fieldset').showWarningOrError(true, msg, false, '');
+            } else {
+                field.up('fieldset').clearMessages();
+            }
+        }
+    }});
--- a/app/model/Messprogramm.js	Tue May 12 16:46:39 2015 +0200
+++ b/app/model/Messprogramm.js	Tue May 12 17:00:57 2015 +0200
@@ -59,9 +59,23 @@
     }, {
         name: 'intervallOffset'
     }, {
-        name: 'gueltigVon'
+        name: 'gueltigVon',
+        type: 'date',
+        convert: function(v) {
+            if (!v) {
+                return v;
+            }
+            return new Date(v);
+        },
     }, {
-        name: 'gueltigBis'
+        name: 'gueltigBis',
+        type: 'date',
+        convert: function(v) {
+            if (!v) {
+                return v;
+            }
+            return new Date(v);
+        },
     }, {
         name: 'probeNehmerId'
     }, {
--- a/app/view/form/Messprogramm.js	Tue May 12 16:46:39 2015 +0200
+++ b/app/view/form/Messprogramm.js	Tue May 12 17:00:57 2015 +0200
@@ -91,7 +91,7 @@
                             allowBlank: false,
                             editable: true
                         }, {
-                            xtype: 'textfield',
+                            xtype: 'tfield',
                             name: 'name',
                             fieldLabel: i18n.getMsg('name'),
                             labelWidth: 135,
@@ -232,7 +232,7 @@
                     items: [{
                         xtype: 'fset',
                         title: i18n.getMsg('validity'),
-                        name: 'gueltigPeriod',
+                        name: 'gueltigPeriodFieldset',
                         anchor: '100%',
                         width: '50%',
                         margin: '0, 5, 5, 5',
@@ -256,11 +256,17 @@
                             name: 'gueltigBis',
                             format: 'd.m.Y H:i',
                             period: 'end'
+                        }, {
+                            xtype: 'numberfield',
+                            fieldLabel: i18n.getMsg('offset'),
+                            labelWidth: 90,
+                            anchor: '100%',
+                            name: 'intervallOffset',
                         }]
                     }, {
                         xtype: 'fset',
                         title: i18n.getMsg('probenintervall'),
-                        name: 'probenintervall',
+                        name: 'probenIntervallFieldset',
                         anchor: '100%',
                         width: '50%',
                         margin: '0, 5, 5, 5',
@@ -310,6 +316,7 @@
         // for instance H, M, J, ...
         // Initialize the probenintervallslider
         var s = this.down('probenintervallslider');
+        var i = this.getForm().findField('intervallOffset');
         var v = this.getForm().findField('teilintervallVon');
         var b = this.getForm().findField('teilintervallBis');
         var intervallstore = Ext.data.StoreManager.get('Probenintervall');
@@ -367,6 +374,10 @@
         v.setValue(svalLower);
         b.setValue(svalUpper);
 
+        //Set IntervallOffset
+        i.setMinValue(0);
+        i.setMaxValue(max-1);
+
         console.log('Populate End');
     },
 
@@ -426,6 +437,20 @@
 
     clearMessages: function() {
         // TODO
+        this.down('cbox[name=mstId]').clearWarningOrError();
+        this.down('tfield[name=name]').clearWarningOrError();
+        //no clearmsg for probeKommentar
+        this.down('fset[name=erwAngaben]').clearMessages();
+        this.down('cbox[name=datenbasisId]').clearWarningOrError();
+        this.down('cbox[name=baId]').clearWarningOrError();
+        this.down('cbox[name=test]').clearWarningOrError();
+        this.down('cbox[name=probenartId]').clearWarningOrError();
+        this.down('cbox[name=netzbetreiberId]').clearWarningOrError();
+        //no clear for probeNehmerId
+        // Deskriptoren are missing
+        this.down('cbox[name=umwId]').clearWarningOrError();
+        this.down('fset[name=gueltigPeriodFieldset]').clearMessages();
+        this.down('fset[name=probenIntervallFieldset]').clearMessages();
     },
 
     setReadOnly: function(value) {
--- a/resources/i18n/Lada_de-DE.properties	Tue May 12 16:46:39 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Tue May 12 17:00:57 2015 +0200
@@ -61,6 +61,7 @@
 nuklid:Nuklid
 from:Von
 to:Bis
+offset:Offset
 
 emptytext.probenintervall:Wählen Sie ein Probenintervall
 emptytext.datenbasis:Wahlen Sie eine Datenbasis

http://lada.wald.intevation.org