Mercurial > lada > lada-client
changeset 1012:2adc329d90fe stammdatengrids
Replaced Locations with Ortszuordnung
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 26 Jan 2016 10:40:48 +0100 (2016-01-26) |
parents | 6afdbc8ee920 |
children | 75ce503ab296 |
files | app/controller/grid/Ort.js app/controller/grid/Ortszuordnung.js app/model/Messung.js app/view/grid/Ortszuordnung.js app/view/window/ProbeEdit.js |
diffstat | 5 files changed, 121 insertions(+), 123 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/grid/Ort.js Thu Jan 21 10:54:20 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +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 grid of Orte - */ -Ext.define('Lada.controller.grid.Ort', { - extend: 'Ext.app.Controller', - - requires: [ - 'Lada.view.window.OrtEdit', - 'Lada.view.window.OrtCreate' - ], - - /** - * Inhitialize the controller - * It has 3 listeners - */ - init: function() { - this.control({ - 'ortgrid': { - itemdblclick: this.open - }, - 'ortgrid button[action=add]': { - click: this.add - }, - 'ortgrid button[action=delete]': { - click: this.remove - } - }); - }, - - /** - * When open is called, a {@link Lada.view.window.OrtEdit} - * is created which allows to edit the Orte - */ - open: function(grid, record) { - var probe = grid.up('window').record; - var win = Ext.create('Lada.view.window.OrtEdit', { - parentWindow: grid.up('window'), - probe: probe, - record: record, - grid: grid - }); - win.show(); - win.initData(); - }, - - /** - * This function adds a new row to add an Ort - */ - add: function(button) { - var probe = button.up('window').record; - var win = Ext.create('Lada.view.window.OrtCreate', { - record: probe, - grid: button.up('ortgrid') - }); - win.show(); - win.initData(); - }, - - /** - * A Ort-row can be removed from the grid with the remove - * function. It asks the user for confirmation - * If the removal was confirmed, it reloads the parent window on success, - * on failure, an error message is shown. - */ - 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(request, response) { - var json = response.request.scope.reader.jsonData; - if (json) { - if (json.message){ - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') - +' #'+json.message, - Lada.getApplication().bundle.getMsg(json.message)); - } else { - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), - Lada.getApplication().bundle.getMsg('err.msg.generic.body')); - } - } else { - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), - Lada.getApplication().bundle.getMsg('err.msg.response.body')); - } - } - }); - } - }); - grid.down('button[action=delete]').disable(); - } -});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/Ortszuordnung.js Tue Jan 26 10:40:48 2016 +0100 @@ -0,0 +1,106 @@ +/* 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 grid of Orte + */ +Ext.define('Lada.controller.grid.Ortszuordnung', { + extend: 'Ext.app.Controller', + + requires: [ + 'Lada.view.window.OrtEdit', + 'Lada.view.window.OrtCreate' + ], + + /** + * Inhitialize the controller + * It has 3 listeners + */ + init: function() { + this.control({ + 'ortszuordnunggrid': { + itemdblclick: this.open + }, + 'ortszuordnunggrid button[action=add]': { + click: this.add + }, + 'ortszuordnunggrid button[action=delete]': { + click: this.remove + } + }); + }, + + /** + * When open is called, a {@link Lada.view.window.OrtEdit} + * is created which allows to edit the Orte + */ + open: function(grid, record) { + var probe = grid.up('window').record; + var win = Ext.create('Lada.view.window.OrtEdit', { + parentWindow: grid.up('window'), + probe: probe, + record: record, + grid: grid + }); + win.show(); + win.initData(); + }, + + /** + * This function adds a new row to add an Ort + */ + add: function(button) { + var probe = button.up('window').record; + var win = Ext.create('Lada.view.window.OrtCreate', { + record: probe, + grid: button.up('ortszuordnung') + }); + win.show(); + win.initData(); + }, + + /** + * A Ort-row can be removed from the grid with the remove + * function. It asks the user for confirmation + * If the removal was confirmed, it reloads the parent window on success, + * on failure, an error message is shown. + */ + remove: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection()[0]; + var i18n = Lada.getApplication().bundle; + Ext.MessageBox.confirm(i18n.getMsg('delete'), i18n.getMsg('confirmation.question'), + function(btn) { + if (btn === 'yes') { + selection.destroy({ + success: function() { + button.up('window').initData(); + }, + failure: function(request, response) { + var i18n = Lada.getApplication().bundle; + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.response.body')); + } + } + }); + } + }); + grid.down('button[action=delete]').disable(); + } +});
--- a/app/model/Messung.js Thu Jan 21 10:54:20 2016 +0100 +++ b/app/model/Messung.js Tue Jan 26 10:40:48 2016 +0100 @@ -1,4 +1,4 @@ -* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz * Software engineering by Intevation GmbH * * This file is Free Software under the GNU GPL (v>=3) @@ -82,7 +82,7 @@ proxy: { type: 'rest', - url: 'lada-server/rest/messung', + url: 'lada-server/rest/messung/', reader: { type: 'json', root: 'data'
--- a/app/view/grid/Ortszuordnung.js Thu Jan 21 10:54:20 2016 +0100 +++ b/app/view/grid/Ortszuordnung.js Tue Jan 26 10:40:48 2016 +0100 @@ -11,7 +11,7 @@ */ Ext.define('Lada.view.grid.Ortszuordnung', { extend: 'Ext.grid.Panel', - alias: 'widget.ortgrid', + alias: 'widget.ortszuordnunggrid', maxHeight: 350, emptyText: 'Keine Orte gefunden.', @@ -47,14 +47,14 @@ }]; this.columns = [{ header: 'Typ', - dataIndex: 'ortsTyp', + dataIndex: 'ortszuordnungTyp', width: 50, editor: { allowBlank: false } }, { header: 'Staat', - dataIndex: 'ort', + dataIndex: 'ortId', width: 70, renderer: function(value) { var store = Ext.data.StoreManager.get('orte'); @@ -64,8 +64,8 @@ return record.get('staatIso'); } }, { - header: 'Gemeineschlüssel', - dataIndex: 'ort', + header: 'Gemeindeschlüssel', + dataIndex: 'ortId', width: 120, renderer: function(value) { var store = Ext.data.StoreManager.get('orte'); @@ -74,7 +74,7 @@ } }, { header: 'Gemeindename', - dataIndex: 'ort', + dataIndex: 'ortId', flex: 1, renderer: function(value) { var store = Ext.data.StoreManager.get('orte'); @@ -86,13 +86,8 @@ return record2.get('bezeichnung'); } }, { - header: 'Messpunkt', - dataIndex: 'ort', - renderer: function(value) { - var store = Ext.getStore('orte'); - var record = store.getById(value); - return record.get('bezeichnung'); - } + header: 'Ortszusatztext', + dataIndex: 'ortszusatztext' }]; this.listeners = { select: {
--- a/app/view/window/ProbeEdit.js Thu Jan 21 10:54:20 2016 +0100 +++ b/app/view/window/ProbeEdit.js Tue Jan 26 10:40:48 2016 +0100 @@ -75,7 +75,7 @@ padding: '5, 5', margin: 5, items: [{ - xtype: 'ortgrid', + xtype: 'ortszuordnunggrid', recordId: this.record.get('id') }] }, { @@ -183,8 +183,8 @@ this.down('fset[name=messungen]').down('messunggrid').setReadOnly(true); this.down('fset[name=messungen]').down('messunggrid').readOnly = true; } - this.down('fset[name=orte]').down('ortgrid').setReadOnly(true); - this.down('fset[name=orte]').down('ortgrid').readOnly = true; + this.down('fset[name=orte]').down('ortszuordnunggrid').setReadOnly(true); + this.down('fset[name=orte]').down('ortszuordnunggrid').readOnly = true; this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(true); this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').readOnly = true; this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(true); @@ -197,8 +197,8 @@ enableChildren: function() { this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false); this.down('fset[name=messungen]').down('messunggrid').readOnly = false; - this.down('fset[name=orte]').down('ortgrid').setReadOnly(false); - this.down('fset[name=orte]').down('ortgrid').readOnly = false; + this.down('fset[name=orte]').down('ortszuordnunggrid').setReadOnly(false); + this.down('fset[name=orte]').down('ortszuordnunggrid').readOnly = false; this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(false); this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').readOnly = false; this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(false);