[Lada-commits] [PATCH 4 of 5] ClearMessages

Wald Commits scm-commit at wald.intevation.org
Tue May 12 17:01:14 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1431442822 -7200
# Node ID 5a153d36ed4e79f8ec87bcf5a685448af8ebf4d3
# Parent  da14e0f3e5997acc2e47239bfb29e5862188dc96
ClearMessages

diff -r da14e0f3e599 -r 5a153d36ed4e app/controller/form/Messprogramm.js
--- a/app/controller/form/Messprogramm.js	Tue May 12 16:26:05 2015 +0200
+++ b/app/controller/form/Messprogramm.js	Tue May 12 17:00:22 2015 +0200
@@ -26,14 +26,18 @@
             'messprogrammform': {
                 dirtychange: this.dirtyForm
             },
-            'messprogrammform gueltigPeriod datetime': {
-                blur: this.checkPeriod
+            'messprogrammform datetime textfield': {
+                blur: this.checkDatePeriod
             },
-            'messprogrammform probenintervall numberfield': {
+            '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
             }
         });
@@ -184,7 +188,6 @@
      * The function validates if the start is smaller than end.
      */
     checkPeriod: function(field) {
-        alert();
         // This field might be a field within a Period.
         // Search for Partner field (period: end/start) and validate
         // End Before Start validation
@@ -199,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();
+            }
+        }
+    }});
diff -r da14e0f3e599 -r 5a153d36ed4e app/view/form/Messprogramm.js
--- a/app/view/form/Messprogramm.js	Tue May 12 16:26:05 2015 +0200
+++ b/app/view/form/Messprogramm.js	Tue May 12 17:00:22 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',
@@ -266,7 +266,7 @@
                     }, {
                         xtype: 'fset',
                         title: i18n.getMsg('probenintervall'),
-                        name: 'probenintervall',
+                        name: 'probenIntervallFieldset',
                         anchor: '100%',
                         width: '50%',
                         margin: '0, 5, 5, 5',
@@ -437,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) {


More information about the Lada-commits mailing list