[Lada-commits] [PATCH] removed unused code (older Location/Ort forms)

Wald Commits scm-commit at wald.intevation.org
Tue Feb 7 20:01:04 CET 2017


# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486494059 -3600
# Node ID ec1625ba433b4ce19aa5b1d13c4b3fe06709bcd1
# Parent  5c2d6812d85a1d12b46e403af345b1d99dabbb20
removed unused code (older Location/Ort forms)

diff -r 5c2d6812d85a -r ec1625ba433b app.js
--- a/app.js	Tue Feb 07 19:50:36 2017 +0100
+++ b/app.js	Tue Feb 07 20:00:59 2017 +0100
@@ -345,7 +345,6 @@
         'Lada.controller.grid.Status',
         'Lada.controller.grid.Ortszuordnung',
         'Lada.controller.form.Ortszuordnung',
-        'Lada.controller.form.Location',
         'Lada.controller.form.Messprogramm',
         'Lada.controller.grid.MessprogrammKategorie',
         'Lada.controller.grid.Messmethode',
diff -r 5c2d6812d85a -r ec1625ba433b app/controller/form/Location.js
--- a/app/controller/form/Location.js	Tue Feb 07 19:50:36 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU GPL (v>=3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out
- * the documentation coming with IMIS-Labordaten-Application for details.
- */
-
-/**
- * This is a Controller for a Location Form
- */
-Ext.define('Lada.controller.form.Location', {
-    extend: 'Ext.app.Controller',
-    /**
-     * Initialize the Controller with
-     * 5 listeners
-     */
-    init: function() {
-        this.control({
-            'locationform button[action=save]': {
-                click: this.save
-            },
-            'locationform button[action=discard]': {
-                click: this.discard
-            },
-            'locationform': {
-                dirtychange: this.dirtyForm
-            },
-            'locationform numberfield[name=latitude]': {
-                change: this.updateFeatureLatitude
-            },
-            'locationform numberfield[name=longitude]': {
-                change: this.updateFeatureLongitude
-            }
-        });
-    },
-
-    /**
-     * The save function saves the content of the Location form.
-     * On success it will reload the Store,
-     * on failure, it will display an Errormessage
-     */
-    save: function(button) {
-        var formPanel = button.up('form');
-        var data = formPanel.getForm().getFieldValues(true);
-        for (var key in data) {
-            formPanel.getForm().getRecord().set(key, data[key]);
-        }
-        if (!formPanel.getForm().getRecord().get('letzteAenderung')) {
-            formPanel.getForm().getRecord().data.letzteAenderung = new Date();
-        }
-        formPanel.getForm().getRecord().save({
-            success: function(record, response) {
-                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);
-                    button.up('window').down('map').locationRecord = null;
-                    var orte = button.up('window').down('ortform combobox');
-                    orte.store.reload({
-                        callback: function() {
-                            orte.setValue(record.data.id);
-                        }
-                    });
-                }
-            },
-            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) {
-                    if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
-                        formPanel.setMessages(json.errors, json.warnings);
-                    }
-
-                    if(json.message){
-                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
-                            +' #'+json.message,
-                            Lada.getApplication().bundle.getMsg(json.message));
-                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
-                    }
-                } else {
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
-                }
-            }
-        });
-    },
-
-    /**
-     * The discard function resets the Location form
-     * to its original state.
-     */
-    discard: function(button) {
-        var formPanel = button.up('form');
-        formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
-        button.up('window').down('map').locationRecord = null;
-    },
-
-    /**
-     * The dirtyForm function enables or disables the save and discard
-     * button which are present in the toolbar of the form.
-     * The Buttons are only active if the content of the form was altered
-     * (the form is dirty).
-     */
-    dirtyForm: function(form, dirty) {
-        if (dirty) {
-            form.owner.down('button[action=save]').setDisabled(false);
-            form.owner.down('button[action=discard]').setDisabled(false);
-        }
-        else {
-            form.owner.down('button[action=save]').setDisabled(true);
-            form.owner.down('button[action=discard]').setDisabled(true);
-        }
-    },
-
-    /**
-     * This function updates the Latitude (heigth-value / y-value) of a feature
-     * (geospatial object). The feature can be a marker in the map
-     * @param {Ext.form.field.Field} field the Ext.field which was altered
-     * @param nValue the new Latitude as WGS84 in decimaldegrees
-     */
-    updateFeatureLatitude: function(field, nValue) {
-        var layer = field.up('window').down('map').selectControl.layer;
-        var newLocation = field.up('window').down('map').locationRecord;
-        if (layer && layer.selectedFeatures[0] && newLocation) {
-            var feature = layer.getFeatureById(layer.selectedFeatures[0].id);
-            feature.move(new OpenLayers.LonLat(feature.geometry.x, nValue));
-            layer.refresh();
-        }
-    },
-
-    /**
-     * This function updates the Longitude (right-value / x-value) of a feature
-     * (geospatial object). The feature can be a marker in the map
-     * @param {Ext.form.field.Field} field the Ext.field which was altered
-     * @param nValue the new Longitude as WGS84 in decimaldegrees
-     */
-    updateFeatureLongitude: function(field, nValue) {
-        var layer = field.up('window').down('map').selectControl.layer;
-        var newLocation = field.up('window').down('map').locationRecord;
-        if (layer && layer.selectedFeatures[0] && newLocation) {
-            var feature = layer.getFeatureById(layer.selectedFeatures[0].id);
-            feature.move(new OpenLayers.LonLat(nValue, feature.geometry.y));
-            layer.refresh();
-        }
-    }
-});
diff -r 5c2d6812d85a -r ec1625ba433b app/view/form/Location.js
--- a/app/view/form/Location.js	Tue Feb 07 19:50:36 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU GPL (v>=3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out
- * the documentation coming with IMIS-Labordaten-Application for details.
- */
-
-/**
- * Form to edit the Location of a Probe
- */
-Ext.define('Lada.view.form.Location', {
-    extend: 'Ext.form.Panel',
-    alias: 'widget.locationform',
-
-    requires: [
-        'Lada.view.widget.Verwaltungseinheit',
-        'Lada.view.widget.Staat'
-    ],
-
-    model: 'Lada.model.Ort',
-    minWidth: 300,
-    margin: 5,
-    border: 0,
-
-    recordId: null,
-
-    trackResetOnLoad: true,
-
-    initComponent: function() {
-        this.items = [{
-            xtype: 'fieldset',
-            title: 'Details',
-            items: [{
-                border: 0,
-                margin: '0, 0, 10, 0',
-                dockedItems: [{
-                    xtype: 'toolbar',
-                    dock: 'bottom',
-                    border: '0, 1, 1, 1',
-                    style: {
-                        borderBottom: '1px solid #b5b8c8 !important',
-                        borderLeft: '1px solid #b5b8c8 !important',
-                        borderRight: '1px solid #b5b8c8 !important'
-                    },
-                    items: ['->', {
-                        text: 'Speichern',
-                        qtip: 'Daten speichern',
-                        icon: 'resources/img/dialog-ok-apply.png',
-                        action: 'save',
-                        disabled: true
-                    }, {
-                        text: 'Verwerfen',
-                        qtip: 'Änderungen verwerfen',
-                        icon: 'resources/img/dialog-cancel.png',
-                        action: 'discard',
-                        disabled: true
-                    }]
-                }],
-                items: [{
-                    xtype: 'tfield',
-                    maxLength: 100,
-                    name: 'beschreibung',
-                    fieldLabel: 'Beschreibung',
-                    width: 280,
-                    labelWidth: 80
-                }, {
-                    xtype: 'staat',
-                    name: 'staatId',
-                    fieldLabel: 'Staat',
-                    width: 280,
-                    labelWidth: 80
-                }, {
-                    xtype: 'verwaltungseinheit',
-                    name: 'verwaltungseinheitId',
-                    fieldLabel: 'Gemeinde',
-                    editable: true,
-                    width: 280,
-                    labelWidth: 80
-                }, {
-                    xtype: 'numberfield',
-                    name: 'latitude',
-                    fieldLabel: 'Lat',
-                    decimalPrecision: 5,
-                    width: 280,
-                    labelWidth: 80
-                }, {
-                    xtype: 'numberfield',
-                    name: 'longitude',
-                    fieldLabel: 'Lon',
-                    decimalPrecision: 5,
-                    width: 280,
-                    labelWidth: 80
-                }, {
-                    xtype: 'numberfield',
-                    name: 'hoeheLand',
-                    fieldLabel: 'Höhe',
-                    width: 280,
-                    labelWidth: 80
-                }]
-            }]
-        }];
-        this.callParent(arguments);
-    },
-
-    setRecord: function(record) {
-        this.getForm().loadRecord(record);
-    },
-
-    setMessages: function(errors, warnings) {
-        var key;
-        var element;
-        var content;
-        var i18n = Lada.getApplication().bundle;
-        if (warnings) {
-            for (key in warnings) {
-                element = this.down('component[name=' + key + ']');
-                if (!element) {
-                    continue;
-                }
-                content = warnings[key];
-                var warnText = '';
-                for (var i = 0; i < content.length; i++) {
-                    warnText += i18n.getMsg(content[i].toString()) + '\n';
-                }
-                element.showWarnings(warnText);
-            }
-        }
-        if (errors) {
-            for (key in errors) {
-                element = this.down('component[name=' + key + ']');
-                if (!element) {
-                    continue;
-                }
-                content = errors[key];
-                var errorText = '';
-                for (var i = 0; i < content.length; i++) {
-                    errorText += i18n.getMsg(content[i].toString()) + '\n';
-                }
-                element.showErrors(errorText);
-            }
-        }
-     },
-
-    clearMessages: function() {
-        this.down('tfield[name=beschreibung]').clearWarningOrError();
-        this.down('staat[name=staatId]').clearWarningOrError();
-        this.down('verwaltungseinheit[name=verwaltungseinheitId]').clearWarningOrError();
-        //this.down('numberfield[name=longitude]').clearWarningOrError();
-        //this.down('numberfield[name=latitude]').clearWarningOrError();
-        //this.down('numberfield[name=hoeheLand]').clearWarningOrError();
-     },
-
-    setReadOnly: function(value) {
-        this.down('tfield[name=beschreibung]').setReadOnly(value);
-        this.down('staat[name=staatId]').setReadOnly(value);
-        this.down('verwaltungseinheit[name=verwaltungseinheitId]').setReadOnly(value);
-        this.down('numberfield[name=longitude]').setReadOnly(value);
-        this.down('numberfield[name=latitude]').setReadOnly(value);
-        this.down('numberfield[name=hoeheLand]').setReadOnly(value);
-    }
-});
diff -r 5c2d6812d85a -r ec1625ba433b app/view/form/Ort.js
--- a/app/view/form/Ort.js	Tue Feb 07 19:50:36 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU GPL (v>=3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out
- * the documentation coming with IMIS-Labordaten-Application for details.
- */
-
-/**
- * Form to edit a Ort of a Probe.
- * This differs from a Location
- */
-Ext.define('Lada.view.form.Ort', {
-    extend: 'Ext.form.Panel',
-    alias: 'widget.ortform',
-
-    requires: [
-        'Lada.view.widget.Location'
-    ],
-
-    model: 'Lada.model.Ort',
-    minWidth: 300,
-    margin: 5,
-    border: 0,
-
-    recordId: null,
-
-    trackResetOnLoad: true,
-
-    initComponent: function() {
-        this.items = [{
-            xtype: 'fieldset',
-            title: 'Ort',
-            items: [{
-                border: 0,
-                margin: '0, 0, 10, 0',
-                dockedItems: [{
-                    xtype: 'toolbar',
-                    dock: 'bottom',
-                    border: '0, 1, 1, 1',
-                    style: {
-                        borderBottom: '1px solid #b5b8c8 !important',
-                        borderLeft: '1px solid #b5b8c8 !important',
-                        borderRight: '1px solid #b5b8c8 !important'
-                    },
-                    items: ['->', {
-                        text: 'Speichern',
-                        qtip: 'Daten speichern',
-                        icon: 'resources/img/dialog-ok-apply.png',
-                        action: 'save',
-                        disabled: true
-                    }, {
-                        text: 'Verwerfen',
-                        qtip: 'Änderungen verwerfen',
-                        icon: 'resources/img/dialog-cancel.png',
-                        action: 'discard',
-                        disabled: true
-                    }]
-                }],
-                items: [{
-                    xtype: 'location',
-                    name: 'ort',
-                    fieldLabel: 'Ort',
-                    labelWidth: 80,
-                    width: 280
-                }, {
-                    xtype: 'tfield',
-                    name: 'ortsTyp',
-                    fieldLabel: 'Typ',
-                    labelWidth: 80,
-                    width: 280,
-                    maxLength: 1
-                }, {
-                    xtype: 'textarea',
-                    name: 'ortszusatztext',
-                    fieldLabel: 'Ortszusatz',
-                    width: 280,
-                    labelWidth: 80
-                }]
-            }]
-        }];
-        this.callParent(arguments);
-    },
-
-    setRecord: function(record) {
-        this.getForm().loadRecord(record);
-    },
-
-    setMessages: function(errors, warnings) {
-        var key;
-        var element;
-        var content;
-        var i18n = Lada.getApplication().bundle;
-        if (warnings) {
-            for (key in warnings) {
-                element = this.down('component[name=' + key + ']');
-                if (!element) {
-                    continue;
-                }
-                content = warnings[key];
-                var warnText = '';
-                for (var i = 0; i < content.length; i++) {
-                    warnText += i18n.getMsg(content[i].toString()) + '\n';
-                }
-                element.showWarnings(warnText);
-            }
-        }
-        if (errors) {
-            for (key in errors) {
-                element = this.down('component[name=' + key + ']');
-                if (!element) {
-                    continue;
-                }
-                content = errors[key];
-                var errorText = '';
-                for (var i = 0; i < content.length; i++) {
-                    errorText += i18n.getMsg(content[i].toString()) + '\n';
-                }
-                element.showErrors(errorText);
-            }
-        }
-    },
-
-    clearMessages: function() {
-        //this.down('location[name=ort]').clearWarningOrError();
-        this.down('tfield[name=ortsTyp]').clearWarningOrError();
-        //this.down('textarea[name=ortszusatztext]').clearWarningOrError();
-    },
-
-    setReadOnly: function(value) {
-        this.down('location[name=ort]').setReadOnly(value);
-        this.down('tfield[name=ortsTyp]').setReadOnly(value);
-        this.down('textarea[name=ortszusatztext]').setReadOnly(value);
-    }
-});
diff -r 5c2d6812d85a -r ec1625ba433b app/view/window/MessprogrammOrt.js
--- a/app/view/window/MessprogrammOrt.js	Tue Feb 07 19:50:36 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU GPL (v>=3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out
- * the documentation coming with IMIS-Labordaten-Application for details.
- */
-
-/**
- * Window to add a Ort to a Messprogramm
- */
-// TODO: This is >80% identical to Lada.view.form.Ortszuordnung.
-// Differences: This has no ortszuordnung record. It only receives and sends
-// an ortId
-
-Ext.define('Lada.view.window.MessprogrammOrt', {
-    extend: 'Ext.window.Window',
-    alias: 'widget.messprogrammort',
-
-    requires: [
-        'Lada.view.form.Ortserstellung',
-        'Lada.view.panel.Map',
-        'Lada.view.grid.Orte'
-    ],
-
-    collapsible: true,
-    maximizable: true,
-    autoshow: true,
-    layout: 'fit',
-    constrain: true,
-
-    parentWindow: null,
-
-    ortId: null,
-
-    /**
-     * This function initialises the Window
-     */
-    initComponent: function() {
-        var i18n = Lada.getApplication().bundle;
-
-        this.title = i18n.getMsg('messprogrammort.window.title');
-        this.buttons = [{
-            text: i18n.getMsg('apply'),
-            scope: this,
-            handler: this.apply
-        }, {
-            text: i18n.getMsg('cancel'),
-            scope: this,
-            handler: function() {
-                this.close();
-                this.parentWindow.down('messprogrammform')
-                    .ortWindow = null;
-           }
-        }];
-
-        // add listeners to change the window appearence when it becomes inactive
-        this.on({
-            activate: function(){
-                this.getEl().removeCls('window-inactive');
-            },
-            deactivate: function(){
-                this.getEl().addCls('window-inactive');
-            },
-            close: function () {
-                this.parentWindow.down('messprogrammform')
-                    .ortWindow = null;
-            }
-        });
-
-        this.items = [{
-            layout: 'border',
-            bodyStyle: {background: '#fff'},
-            border: 0,
-            items: [{
-                xtype: 'map',
-                region: 'center',
-                layout: 'border',
-                margin: '13, 5, 10, 5',
-                minHeight: 380,
-                externalOrteStore: true
-            }, {
-                xtype: 'panel',
-                layout: 'hbox',
-                border: 0,
-                margin: '0, 0, 10, 0',
-                dockedItems: [{
-                    xtype: 'toolbar',
-                    dock: 'bottom',
-                    ui: 'footer',
-                    border: '0, 1, 1, 1',
-                    style: {
-                        borderBottom: '1px solid #b5b8c8 !important',
-                        borderLeft: '1px solid #b5b8c8 !important',
-                        borderRight: '1px solid #b5b8c8 !important'
-                    },
-                    items: [{
-                        text: i18n.getMsg('ortszuordnung.form.setOrt'),
-                        tooltip: i18n.getMsg('ortszuordnung.form.setOrt.qtip'),
-                        icon: 'resources/img/dialog-ok-apply.png',
-                        action: 'setOrt',
-                        enableToggle: true,
-                        disabled: true
-                    }, '->', {
-                        text: i18n.getMsg('save'),
-                        tooltip: i18n.getMsg('save.qtip'),
-                        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: [Ext.create('Lada.view.form.OrtInfo')]
-            }, {
-                region: 'south',
-                border: 0,
-                layout: 'fit',
-                name: 'ortgrid',
-                hidden: true,
-                maxHeight: 240,
-                items: [{
-                    xtype: 'ortstammdatengrid'
-                }],
-                dockedItems: [{
-                    xtype: 'toolbar',
-                    dock: 'bottom',
-                    border: '0, 1, 1, 1',
-                    style: {
-                        borderBottom: '1px solid #b5b8c8 !important',
-                        borderLeft: '1px solid #b5b8c8 !important',
-                        borderRight: '1px solid #b5b8c8 !important'
-                    },
-                    items: [{
-                        xtype: 'textfield',
-                        name: 'search',
-                        labelWidth: 50,
-                        enableKeyEvents: true,
-                        fieldLabel: i18n.getMsg('ortszuordnung.ortsuche'),
-                    }, '->', {
-                        text: i18n.getMsg('orte.new'),
-                        action: 'createort'
-                    }, {
-                        text: i18n.getMsg('orte.frommap'),
-                        action: 'frommap'
-                    }, {
-                        text: i18n.getMsg('orte.clone'),
-                        action: 'clone'
-                    }]
-                }]
-            }]
-        }];
-        this.callParent(arguments);
-        //TODO: load the passed OrtId
-    },
-
-    selectedFeature: function(context, args) {
-    var feature = args[0];
-        if (feature.attributes.id &&
-            feature.attributes.id !== '') {
-            var record = Ext.data.StoreManager.get('orte').getById(feature.attributes.id);
-            context.up('window').down('locationform').setRecord(record);
-            context.up('window').down('locationform').setReadOnly(true);
-            context.up('window').down('location').down('combobox').setValue(record.id);
-        }
-        else {
-            context.up('window').down('locationform').setRecord(this.locationRecord);
-            context.up('window').down('locationform').setReadOnly(false);
-        }
-    },
-
-    /**
-     *  updateDetails is used when a value is selected within the location combobox
-     *  When this function is called, the map element within the window
-     *  which is embedding this form is updated.
-     *
-     *  Mostly the same as in Lada.controlle.form.Ort
-     */
-    updateDetails: function(combobox, record) {
-        var win = combobox.up('window');
-        var details = win.down('locationform');
-        //var id = record[0].get('id'); // We are interested in the cbox...
-        var id = combobox.getValue();
-
-        if (details) {
-            var toLoad = Ext.data.StoreManager.get('orte').getById(id);
-            win.down('locationform').setRecord(toLoad);
-            win.down('map').selectFeature(id, toLoad);
-        }
-    },
-
-    /**
-     * Write the selected ortId into the record, and update the MessprogrammWindow.
-     */
-    apply: function(button) {
-        var win = button.up('window');
-        var ortId = win.down('location').down('combobox').value;
-        if (this.parentWindow) {
-            this.parentWindow.down('messprogrammform').down('location')
-                .down('combobox').setValue(ortId);
-        }
-
-        this.parentWindow.down('messprogrammform')
-                .ortWindow = null;
-        this.close();
-    },
-
-    /**
-     * Instructs the fields / forms listed in this method to set a message.
-     * @param errors These Errors shall be shown
-     * @param warnings These Warning shall be shown
-     */
-    setMessages: function(errors, warnings) {
-        //todo this is a stub
-    },
-
-    /**
-     * Instructs the fields / forms listed in this method to clear their messages.
-     */
-    clearMessages: function() {
-        //todo this is a stub
-    }
-});
-


More information about the Lada-commits mailing list