[Lada-commits] [PATCH] Moved controller into subfolders

Wald Commits scm-commit at wald.intevation.org
Wed Mar 11 13:38:13 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426077544 -3600
# Node ID cf328526b5bb079a131315e4a592047246b1000f
# Parent  a9268f5cde267e38a595d6ddf3d46fb755fad523
Moved controller into subfolders.

diff -r a9268f5cde26 -r cf328526b5bb app.js
--- a/app.js	Wed Mar 11 13:14:31 2015 +0100
+++ b/app.js	Wed Mar 11 13:39:04 2015 +0100
@@ -103,10 +103,10 @@
     controllers: [
         'Lada.controller.Filter',
         'Lada.controller.FilterResult',
-        'Lada.controller.ProbeForm',
-        'Lada.controller.OrtGrid',
-        'Lada.controller.ProbenzusatzwertGrid',
-        'Lada.controller.PKommentarGrid',
-        'Lada.controller.MessungenGrid'
+        'Lada.controller.form.Probe',
+        'Lada.controller.grid.Ort',
+        'Lada.controller.grid.Probenzusatzwert',
+        'Lada.controller.grid.PKommentar',
+        'Lada.controller.grid.Messungen'
     ]
 });
diff -r a9268f5cde26 -r cf328526b5bb app/controller/MessungenGrid.js
--- a/app/controller/MessungenGrid.js	Wed Mar 11 13:14:31 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +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.
- */
-
-/*
- * Controller for a Messungengrid
- */
-Ext.define('Lada.controller.MessungenGrid', {
-    extend: 'Ext.app.Controller',
-
-    requires: [
-        'Lada.view.window.MessungEdit'
-    ],
-
-    init: function() {
-        this.control({
-            'messungengrid': {
-                itemdblclick: this.open
-            },
-            'messungengrid button[action=add]': {
-                click: this.add
-            },
-            'messungengrid button[action=delete]': {
-                click: this.remove
-            }
-        });
-    },
-
-    open: function(grid, record) {
-        //Opens a detailed view of the Messung
-        var win = Ext.create('Lada.view.window.MessungEdit', {
-            record: record
-        });
-        win.show();
-        win.initData();
-    },
-
-    add: function() {
-        // TODO
-        console.log('add');
-    },
-
-    remove: function(button) {
-        var grid = button.up('grid');
-        var selection = grid.getView().getSelectionModel().getSelection()[0];
-        Ext.MessageBox.confirm(
-            'Messung löschen',
-            'Sind Sie sicher?',
-            function(btn) {
-                if (btn === 'yes') {
-                    selection.destroy({
-                        success: function() {
-                            button.up('window').initData();
-                        },
-                        failure: function() {
-                        }
-                    });
-                }
-        });
-    }
-});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/OrtGrid.js
--- a/app/controller/OrtGrid.js	Wed Mar 11 13:14:31 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +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.
- */
-
-Ext.define('Lada.controller.OrtGrid', {
-    extend: 'Ext.app.Controller',
-
-    init: function() {
-        this.control({
-            'ortgrid': {
-                selectionchange: this.selectionChanged,
-                edit: this.gridSave
-            },
-            'ortgrid button[action=open]': {
-                click: this.open
-            },
-            'ortgrid button[action=add]': {
-                click: this.add
-            },
-            'ortgrid button[action=delete]': {
-                click: this.remove
-            }
-        });
-    },
-
-    selectionChanged: function(grid, record) {
-        if (record) {
-            grid.view.panel.down('button[action=open]').enable();
-        }
-    },
-
-    gridSave: function(editor, context) {
-        context.record.save({
-            success: function() {
-                context.grid.store.reload();
-                context.grid.up('window').initData();
-            },
-            failure: function() {
-                // TODO
-            }
-        });
-    },
-
-    open: function() {
-        // todo
-        console.log('open');
-    },
-
-    add: function() {
-        // todo
-        console.log('add');
-    },
-
-    remove: function(button) {
-        var grid = button.up('grid');
-        var selection = grid.getView().getSelectionModel().getSelection()[0];
-        Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) {
-            if (btn === 'yes') {
-                selection.destroy({
-                    success: function() {
-                        button.up('window').initData();
-                    },
-                    failure: function() {
-                    }
-                });
-            }
-        });
-    }
-});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/PKommentarGrid.js
--- a/app/controller/PKommentarGrid.js	Wed Mar 11 13:14:31 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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.
- */
-
-Ext.define('Lada.controller.PKommentarGrid', {
-    extend: 'Ext.app.Controller',
-
-    init: function() {
-        this.control({
-            'pkommentargrid': {
-                edit: this.edit
-            },
-            'pkommentargrid button[action=add]': {
-                click: this.add
-            },
-            'pkommentargrid button[action=delete]': {
-                click: this.remove
-            }
-        });
-    },
-
-    edit: function(editor, context) {
-        context.record.save({
-            success: function() {
-                context.grid.store.reload();
-                context.grid.up('window').initData();
-            },
-            failure: function() {
-                // TODO
-            }
-        });
-    },
-
-    add: function(button) {
-        var record = Ext.create('Lada.model.PKommentar');
-        record.set('probeId', button.up('pkommentargrid').recordId);
-        button.up('pkommentargrid').store.insert(0, record);
-        button.up('pkommentargrid').rowEditing.startEdit(0, 1);
-    },
-
-    remove: function(button) {
-        var grid = button.up('grid');
-        var selection = grid.getView().getSelectionModel().getSelection()[0];
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
-            if (btn === 'yes') {
-                selection.destroy({
-                    success: function() {
-                        button.up('window').initData();
-                    },
-                    failure: function() {
-                        // TODO
-                    }
-                });
-            }
-        });
-    }
-});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/ProbeForm.js
--- a/app/controller/ProbeForm.js	Wed Mar 11 13:14:31 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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.
- */
-
-Ext.define('Lada.controller.ProbeForm', {
-    extend: 'Ext.app.Controller',
-
-    init: function() {
-        this.control({
-            'probeform button[action=save]': {
-                click: this.save
-            },
-            'probeform button[action=discard]': {
-                click: this.discard
-            },
-            'probeform': {
-                dirtychange: this.dirtyForm
-            }
-        });
-    },
-
-    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]);
-        }
-        formPanel.getForm().getRecord().save({
-            success: function(record, response) {
-                var json = Ext.decode(response.response.responseText);
-                if (response.action !== 'create' &&
-                    json &&
-                    json.success) {
-                    button.setDisabled(true);
-                    button.up('toolbar').down('button[action=discard]')
-                        .setDisabled(true);
-                    formPanel.clearMessages();
-                    formPanel.setRecord(record);
-                    formPanel.setMessages(json.errors, json.warnings);
-                }
-            },
-            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) {
-                    formPanel.setMessages(json.errors, json.warnings);
-                }
-            }
-        });
-        console.log('save');
-    },
-
-    discard: function(button) {
-        var formPanel = button.up('form');
-        formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
-    },
-
-    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);
-        }
-    }
-});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/ProbenzusatzwertGrid.js
--- a/app/controller/ProbenzusatzwertGrid.js	Wed Mar 11 13:14:31 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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.
- */
-
-Ext.define('Lada.controller.ProbenzusatzwertGrid', {
-    extend: 'Ext.app.Controller',
-
-    init: function() {
-        this.control({
-            'probenzusatzwertgrid': {
-                edit: this.gridSave
-            },
-            'probenzusatzwertgrid button[action=add]': {
-                click: this.add
-            },
-            'probenzusatzwertgrid button[action=delete]': {
-                click: this.remove
-            }
-        });
-    },
-
-    gridSave: function(editor, context) {
-        context.record.save({
-            success: function() {
-                context.grid.store.reload();
-                context.grid.up('window').initData();
-            },
-            failure: function() {
-                // TODO
-            }
-        });
-    },
-
-    add: function(button) {
-        var record = Ext.create('Lada.model.Zusatzwert', {
-            probeId: button.up('probenzusatzwertgrid').recordId
-        });
-        button.up('probenzusatzwertgrid').store.insert(0, record);
-        button.up('probenzusatzwertgrid').rowEditing.startEdit(0, 1);
-    },
-
-    remove: function(button) {
-        var grid = button.up('grid');
-        var selection = grid.getView().getSelectionModel().getSelection()[0];
-        Ext.MessageBox.confirm('Zusatzwert löschen', 'Sind Sie sicher?', function(btn) {
-            if (btn === 'yes') {
-                selection.destroy({
-                    success: function() {
-                        button.up('window').initData();
-                        grid.initData();
-                    },
-                    failure: function() {
-                        // TODO
-                    }
-                });
-            }
-        });
-    }
-});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/form/Probe.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/form/Probe.js	Wed Mar 11 13:39:04 2015 +0100
@@ -0,0 +1,75 @@
+/* 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.
+ */
+
+Ext.define('Lada.controller.form.Probe', {
+    extend: 'Ext.app.Controller',
+
+    init: function() {
+        this.control({
+            'probeform button[action=save]': {
+                click: this.save
+            },
+            'probeform button[action=discard]': {
+                click: this.discard
+            },
+            'probeform': {
+                dirtychange: this.dirtyForm
+            }
+        });
+    },
+
+    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]);
+        }
+        formPanel.getForm().getRecord().save({
+            success: function(record, response) {
+                var json = Ext.decode(response.response.responseText);
+                if (response.action !== 'create' &&
+                    json &&
+                    json.success) {
+                    button.setDisabled(true);
+                    button.up('toolbar').down('button[action=discard]')
+                        .setDisabled(true);
+                    formPanel.clearMessages();
+                    formPanel.setRecord(record);
+                    formPanel.setMessages(json.errors, json.warnings);
+                }
+            },
+            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) {
+                    formPanel.setMessages(json.errors, json.warnings);
+                }
+            }
+        });
+        console.log('save');
+    },
+
+    discard: function(button) {
+        var formPanel = button.up('form');
+        formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
+    },
+
+    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);
+        }
+    }
+});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/grid/Messungen.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/grid/Messungen.js	Wed Mar 11 13:39:04 2015 +0100
@@ -0,0 +1,65 @@
+/* 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.
+ */
+
+/*
+ * Controller for a Messungengrid
+ */
+Ext.define('Lada.controller.grid.Messungen', {
+    extend: 'Ext.app.Controller',
+
+    requires: [
+        'Lada.view.window.MessungEdit'
+    ],
+
+    init: function() {
+        this.control({
+            'messungengrid': {
+                itemdblclick: this.open
+            },
+            'messungengrid button[action=add]': {
+                click: this.add
+            },
+            'messungengrid button[action=delete]': {
+                click: this.remove
+            }
+        });
+    },
+
+    open: function(grid, record) {
+        //Opens a detailed view of the Messung
+        var win = Ext.create('Lada.view.window.MessungEdit', {
+            record: record
+        });
+        win.show();
+        win.initData();
+    },
+
+    add: function() {
+        // TODO
+        console.log('add');
+    },
+
+    remove: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        Ext.MessageBox.confirm(
+            'Messung löschen',
+            'Sind Sie sicher?',
+            function(btn) {
+                if (btn === 'yes') {
+                    selection.destroy({
+                        success: function() {
+                            button.up('window').initData();
+                        },
+                        failure: function() {
+                        }
+                    });
+                }
+        });
+    }
+});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/grid/Ort.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/grid/Ort.js	Wed Mar 11 13:39:04 2015 +0100
@@ -0,0 +1,73 @@
+/* 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.
+ */
+
+Ext.define('Lada.controller.grid.Ort', {
+    extend: 'Ext.app.Controller',
+
+    init: function() {
+        this.control({
+            'ortgrid': {
+                selectionchange: this.selectionChanged,
+                edit: this.gridSave
+            },
+            'ortgrid button[action=open]': {
+                click: this.open
+            },
+            'ortgrid button[action=add]': {
+                click: this.add
+            },
+            'ortgrid button[action=delete]': {
+                click: this.remove
+            }
+        });
+    },
+
+    selectionChanged: function(grid, record) {
+        if (record) {
+            grid.view.panel.down('button[action=open]').enable();
+        }
+    },
+
+    gridSave: function(editor, context) {
+        context.record.save({
+            success: function() {
+                context.grid.store.reload();
+                context.grid.up('window').initData();
+            },
+            failure: function() {
+                // TODO
+            }
+        });
+    },
+
+    open: function() {
+        // todo
+        console.log('open');
+    },
+
+    add: function() {
+        // todo
+        console.log('add');
+    },
+
+    remove: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) {
+            if (btn === 'yes') {
+                selection.destroy({
+                    success: function() {
+                        button.up('window').initData();
+                    },
+                    failure: function() {
+                    }
+                });
+            }
+        });
+    }
+});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/grid/PKommentar.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/grid/PKommentar.js	Wed Mar 11 13:39:04 2015 +0100
@@ -0,0 +1,61 @@
+/* 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.
+ */
+
+Ext.define('Lada.controller.grid.PKommentar', {
+    extend: 'Ext.app.Controller',
+
+    init: function() {
+        this.control({
+            'pkommentargrid': {
+                edit: this.edit
+            },
+            'pkommentargrid button[action=add]': {
+                click: this.add
+            },
+            'pkommentargrid button[action=delete]': {
+                click: this.remove
+            }
+        });
+    },
+
+    edit: function(editor, context) {
+        context.record.save({
+            success: function() {
+                context.grid.store.reload();
+                context.grid.up('window').initData();
+            },
+            failure: function() {
+                // TODO
+            }
+        });
+    },
+
+    add: function(button) {
+        var record = Ext.create('Lada.model.PKommentar');
+        record.set('probeId', button.up('pkommentargrid').recordId);
+        button.up('pkommentargrid').store.insert(0, record);
+        button.up('pkommentargrid').rowEditing.startEdit(0, 1);
+    },
+
+    remove: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+            if (btn === 'yes') {
+                selection.destroy({
+                    success: function() {
+                        button.up('window').initData();
+                    },
+                    failure: function() {
+                        // TODO
+                    }
+                });
+            }
+        });
+    }
+});
diff -r a9268f5cde26 -r cf328526b5bb app/controller/grid/Probenzusatzwert.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/grid/Probenzusatzwert.js	Wed Mar 11 13:39:04 2015 +0100
@@ -0,0 +1,63 @@
+/* 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.
+ */
+
+Ext.define('Lada.controller.grid.Probenzusatzwert', {
+    extend: 'Ext.app.Controller',
+
+    init: function() {
+        this.control({
+            'probenzusatzwertgrid': {
+                edit: this.gridSave
+            },
+            'probenzusatzwertgrid button[action=add]': {
+                click: this.add
+            },
+            'probenzusatzwertgrid button[action=delete]': {
+                click: this.remove
+            }
+        });
+    },
+
+    gridSave: function(editor, context) {
+        context.record.save({
+            success: function() {
+                context.grid.store.reload();
+                context.grid.up('window').initData();
+            },
+            failure: function() {
+                // TODO
+            }
+        });
+    },
+
+    add: function(button) {
+        var record = Ext.create('Lada.model.Zusatzwert', {
+            probeId: button.up('probenzusatzwertgrid').recordId
+        });
+        button.up('probenzusatzwertgrid').store.insert(0, record);
+        button.up('probenzusatzwertgrid').rowEditing.startEdit(0, 1);
+    },
+
+    remove: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        Ext.MessageBox.confirm('Zusatzwert löschen', 'Sind Sie sicher?', function(btn) {
+            if (btn === 'yes') {
+                selection.destroy({
+                    success: function() {
+                        button.up('window').initData();
+                        grid.initData();
+                    },
+                    failure: function() {
+                        // TODO
+                    }
+                });
+            }
+        });
+    }
+});


More information about the Lada-commits mailing list