[Lada-commits] [PATCH] ortszuordnung form changes

Wald Commits scm-commit at wald.intevation.org
Wed Feb 1 18:01:08 CET 2017


# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1485968459 -3600
# Node ID e9f812528324b496be32afc02e60d6a910fea234
# Parent  d17501b967f24eb29fc1ad1788f843cbe0fda5bc
ortszuordnung form changes

removed discard button
cursor change if new position is to be selected on map
display of GemeindeId and Staat in ortzuordnung

diff -r d17501b967f2 -r e9f812528324 app/controller/form/Ortszuordnung.js
--- a/app/controller/form/Ortszuordnung.js	Wed Feb 01 15:31:41 2017 +0100
+++ b/app/controller/form/Ortszuordnung.js	Wed Feb 01 18:00:59 2017 +0100
@@ -23,9 +23,6 @@
             'ortszuordnungform button[action=save]': {
                 click: this.save
             },
-            'ortszuordnungform button[action=discard]': {
-                click: this.discard
-            },
             'ortszuordnungform': {
                 validitychange: this.validityChange,
                 dirtychange: this.validityChange
@@ -73,8 +70,6 @@
                 var json = Ext.decode(response.response.responseText);
                 if (json) {
                     button.setDisabled(true);
-                    button.up('toolbar').down('button[action=discard]')
-                        .setDisabled(true);
                     formPanel.clearMessages();
                     formPanel.setRecord(record);
                     formPanel.setMessages(json.errors, json.warnings);
@@ -91,8 +86,6 @@
             },
             failure: function(record, response) {
                 button.setDisabled(true);
-                button.up('toolbar').down('button[action=discard]')
-                    .setDisabled(true);
                 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
                 var json = response.request.scope.reader.jsonData;
                 if (json) {
@@ -119,26 +112,6 @@
     },
 
     /**
-     * The discard function resets the Location form
-     * to its original state.
-     */
-    discard: function(button) {
-        var formPanel = button.up('form');
-        var record = formPanel.getForm().getRecord();
-        formPanel.getForm().loadRecord(record);
-        try {
-            if (record.get('ortId') !== undefined) {
-                formPanel.setOrt(record.get('ortId'));
-            } else {
-                formPanel.setOrt(record.get('ort'));
-            }
-            formPanel.down('button[action=setOrt]').toggle(false);
-        }
-        catch (e) {
-        }
-    },
-
-    /**
      * When the button is Active, a Record can be selected.
      * If the Record was selected from a grid this function
      * sets the ortzuordnung.
@@ -169,17 +142,16 @@
     },
 
     /**
-     * The validitychange function enables or disables the save and discard
-     * button which are present in the toolbar of the form.
+     * The validitychange function enables or disables the save button which
+     * is present in the toolbar of the form.
      */
     validityChange: function(form, valid) {
         if (form.isDirty()) {
-            form.owner.down('button[action=discard]').setDisabled(false);
             if (valid) {
                 if (form.getValues().ortId !== ''
                     && /[UEZA]/.test(form.getValues().ortszuordnungTyp)) {
                     // valid ortzuordnung(Probe)
-                        form.owner.down('button[action=save]').setDisabled(false);
+                    form.owner.down('button[action=save]').setDisabled(false);
                 } else if (form.getValues().ort !== ''
                     && /[UEZA]/.test(form.getValues().ortsTyp)) {
                     // valid ortzuordnung(messprogramm)
@@ -194,7 +166,6 @@
         } else {
             //not dirty
             form.owner.down('button[action=save]').setDisabled(true);
-            form.owner.down('button[action=discard]').setDisabled(true);
         }
     }
 });
diff -r d17501b967f2 -r e9f812528324 app/controller/grid/Ortszuordnung.js
--- a/app/controller/grid/Ortszuordnung.js	Wed Feb 01 15:31:41 2017 +0100
+++ b/app/controller/grid/Ortszuordnung.js	Wed Feb 01 18:00:59 2017 +0100
@@ -158,9 +158,9 @@
      */
     frommap: function(button) {
         var map = button.up('ortszuordnungwindow').down('map');
+        map.getEl().setStyle('cursor', 'crosshair');
         var me = this;
         map.map.events.register('click', button, me.newOrtfromMapClick);
-        // TODO visual feedback that map click is active.
         // TODO Deactivate event listener if button is destroyed
     },
 
@@ -183,6 +183,7 @@
     newOrtfromMapClick: function(evt) {
         var me = this; //this = button(action:frommap)
         var map = this.up('ortszuordnungwindow').down('map').map;
+        this.up('ortszuordnungwindow').down('map').getEl().setStyle('cursor', 'auto');
         var lonlat = map.getLonLatFromViewPortPx(evt.xy).transform(new OpenLayers.Projection('EPSG:3857'),
                                                                    new OpenLayers.Projection('EPSG:4326'));
         var controller = Lada.app.getController('Lada.controller.grid.Ortszuordnung');
diff -r d17501b967f2 -r e9f812528324 app/view/form/OrtInfo.js
--- a/app/view/form/OrtInfo.js	Wed Feb 01 15:31:41 2017 +0100
+++ b/app/view/form/OrtInfo.js	Wed Feb 01 18:00:59 2017 +0100
@@ -40,11 +40,15 @@
                 name: 'langtext'
             }, {
                 fieldLabel: i18n.getMsg('staat'),
-                name: 'staatISO'
+                name: 'staat'
             }, {
                 fieldLabel: i18n.getMsg('orte.gemeindename'),
                 name: 'gemeinde'
             }, {
+                fieldLabel: i18n.getMsg('orte.gemId'),
+                name: 'gemId'
+            },
+           {
                 fieldLabel: i18n.getMsg('orte.kda'),
                 name: 'kdaId'
             }, {
diff -r d17501b967f2 -r e9f812528324 app/view/form/Ortszuordnung.js
--- a/app/view/form/Ortszuordnung.js	Wed Feb 01 15:31:41 2017 +0100
+++ b/app/view/form/Ortszuordnung.js	Wed Feb 01 18:00:59 2017 +0100
@@ -74,12 +74,6 @@
                         icon: 'resources/img/dialog-ok-apply.png',
                         action: 'save',
                         disabled: true
-                    }, {
-                        text: i18n.getMsg('discard'),
-                        tooltip: i18n.getMsg('discard.qtip'),
-                        icon: 'resources/img/dialog-cancel.png',
-                        action: 'discard',
-                        disabled: true
                     }]
                 }],
                 items: [{


More information about the Lada-commits mailing list