changeset 1291:e9f812528324

ortszuordnung form changes removed discard button cursor change if new position is to be selected on map display of GemeindeId and Staat in ortzuordnung
author Maximilian Krambach <mkrambach@intevation.de>
date Wed, 01 Feb 2017 18:00:59 +0100
parents d17501b967f2
children 317ae6bfd647
files app/controller/form/Ortszuordnung.js app/controller/grid/Ortszuordnung.js app/view/form/OrtInfo.js app/view/form/Ortszuordnung.js
diffstat 4 files changed, 10 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- 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);
         }
     }
 });
--- 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');
--- 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'
             }, {
--- 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: [{

http://lada.wald.intevation.org