Mercurial > lada > lada-client
changeset 759:b7484c7da2d4
Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 07 May 2015 10:55:44 +0200 |
parents | b2fcbdc4969d |
children | 2e7e1a8bf79f |
files | app/controller/FilterResult.js app/controller/form/Messprogramm.js app/store/Messmethoden.js app/view/form/Messprogramm.js app/view/grid/Messmethoden.js app/view/window/Messprogramm.js app/view/window/MessprogrammCreate.js app/view/window/MessprogrammEdit.js resources/i18n/Lada_de-DE.properties |
diffstat | 9 files changed, 191 insertions(+), 264 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/FilterResult.js Wed May 06 16:24:23 2015 +0200 +++ b/app/controller/FilterResult.js Thu May 07 10:55:44 2015 +0200 @@ -13,7 +13,7 @@ extend: 'Ext.app.Controller', requires: [ 'Lada.view.window.ProbeEdit', - 'Lada.view.window.MessprogrammEdit' + 'Lada.view.window.Messprogramm' ], /** @@ -58,7 +58,7 @@ winname = 'Lada.view.window.ProbeEdit'; } else if (mname == 'Lada.model.MessprogrammList'){ - winname = 'Lada.view.window.MessprogrammEdit'; + winname = 'Lada.view.window.Messprogramm'; } if (winname){ var win = Ext.create(winname, { @@ -90,7 +90,7 @@ * {@link Lada.view.window.MessprogrammCreate} */ addMessprogrammItem: function() { - var win = Ext.create('Lada.view.window.MessprogrammCreate'); + var win = Ext.create('Lada.view.window.Messprogramm'); win.show(); win.initData(); },
--- a/app/controller/form/Messprogramm.js Wed May 06 16:24:23 2015 +0200 +++ b/app/controller/form/Messprogramm.js Thu May 07 10:55:44 2015 +0200 @@ -106,7 +106,7 @@ formPanel.setMessages(json.errors, json.warnings); if (response.action === 'create' && json.success) { button.up('window').close(); - var win = Ext.create('Lada.view.window.MessprogrammEdit', { + var win = Ext.create('Lada.view.window.Messprogramm', { record: record }); win.show();
--- a/app/store/Messmethoden.js Wed May 06 16:24:23 2015 +0200 +++ b/app/store/Messmethoden.js Thu May 07 10:55:44 2015 +0200 @@ -26,6 +26,5 @@ return ''; } }], - autoLoad: true, sortOnLoad: true });
--- a/app/view/form/Messprogramm.js Wed May 06 16:24:23 2015 +0200 +++ b/app/view/form/Messprogramm.js Thu May 07 10:55:44 2015 +0200 @@ -316,6 +316,8 @@ var svalUpper = null var svalLower = null + var min = null + var max = null if (!intervallstore) { intervallstore = Ext.create('Lada.store.Probenintervall'); @@ -325,7 +327,7 @@ // called from the controller, //and the probenintervall was not changed. // Load the records in this case - if (!intervall) { + if (!intervall && record) { intervall = record.get('probenintervall', 0, false, false, true); @@ -338,8 +340,12 @@ .findRecord('probenintervall', intervall, 0, false, false, true); - var min = intrec.get('periodstart'); - var max = intrec.get('periodend'); + if (intrec) { // in cases when a new messprogramm is + // created and the discard function is used, intrec will be null + // consequently the assertion below will fail. + min = intrec.get('periodstart'); + max = intrec.get('periodend'); + } if (!svalUpper) { svalUpper = max;
--- a/app/view/grid/Messmethoden.js Wed May 06 16:24:23 2015 +0200 +++ b/app/view/grid/Messmethoden.js Thu May 07 10:55:44 2015 +0200 @@ -80,7 +80,9 @@ if (!store) { store = Ext.create('Lada.store.Messmethoden'); } - return value + " - " + store.findRecord('id', value, 0, false, false, true).get('messmethode'); + store.load(); + console.log(store); + return value + " - " + store.findRecord('id', value, 0, false, false, true).get('messmethode'); }, editor: { xtype: 'combobox', @@ -112,11 +114,14 @@ else { this.store = Ext.create('Lada.store.MmtMessprogramm'); } - this.store.load({ - params: { - messprogrammId: this.recordId - } - }); + // Only load the Store when a Record ID is Present + if (this.recordId) { + this.store.load({ + params: { + messprogrammId: this.recordId + } + }); + } }, setReadOnly: function(b) { if (b == true){
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/Messprogramm.js Thu May 07 10:55:44 2015 +0200 @@ -0,0 +1,165 @@ +/* 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 edit a Messprogramm + */ +Ext.define('Lada.view.window.Messprogramm', { + extend: 'Ext.window.Window', + alias: 'widget.messprogramm', + + requires: [ + 'Lada.view.form.Messprogramm', + 'Lada.view.grid.Messmethoden', + ], + + collapsible: true, + maximizable: true, + autoShow: true, + autoScroll: true, + layout: 'fit', + constrain: true, + + record: null, + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + + if (this.record == null) { + this.title = i18n.getMsg('messprogramm.window.create.title'); + } + else { + this.title = i18n.getMsg('messprogramm.window.edit.title'); + } + + this.buttons = [{ + text: i18n.getMsg('close'), + scope: this, + handler: this.close + }]; + this.width = 700; + + // 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'); + } + }); + + this.height = Ext.getBody().getViewSize().height - 30; + // InitialConfig is the config object passed to the constructor on + // creation of this window. We need to pass it throuh to the form as + // we need the "Id" param to load the correct item. + this.items = [{ + border: 0, + autoScroll: true, + items: [{ + xtype: 'messprogrammform', + recordId: this.record? this.record.get('id') : null + }, { + //Messmethoden + xtype: 'fieldset', + title: i18n.getMsg('mmtmessprogramm.form.fieldset.title'), + autoScroll: true, + margin: 5, + layout: { + type: 'hbox', + }, + items: [{ + xtype: 'messmethodengrid', + recordId: this.record? this.record.get('id') : null, + disabled: this.record? false : true, + flex: 1 + }] + }] + }]; + this.callParent(arguments); + }, + + /** + * Init Data is longer than in other windows. + * If the Window was used to CREATE a Messprogramm, + * it will load an empty record + * if it was used to EDIT an existing Messprogramm, + * it will load this record AND create a grid to + * enable the editing of Messmethoden + * which are associated to the Messprogramm + */ + initData: function() { + var i18n = Lada.getApplication().bundle; + this.clearMessages(); + me = this; + + // If a record was passed to this window, + // create a Edit window + if (this.record) { + this.setLoading(true); + Ext.ClassManager.get('Lada.model.Messprogramm').load(this.record.get('id'), { + failure: function(record, action) { + me.setLoading(false); + // TODO + console.log('An unhandled Failure occured. See following Response and Record'); + console.log(action); + console.log(record); + }, + success: function(record, response) { + this.down('messprogrammform').setRecord(record); + this.record = record; + + var json = Ext.decode(response.response.responseText); + if (json) { + this.setMessages(json.errors, json.warnings); + } + // If the Messprogramm is ReadOnly, disable Inputfields and grids + if (this.record.get('readonly') === true) { + this.down('messprogrammform').setReadOnly(true); + this.disableChildren(); + } + else { + this.down('messprogrammform').setReadOnly(false); + this.enableChildren(); + } + me.setLoading(false); + }, + scope: this + }); + + } + // Create a Create Window + else { + var record = Ext.create('Lada.model.Messprogramm'); + this.down('messprogrammform').setRecord(record); + } + }, + + //This was used in a Probewindow, I left it here for reference... + /* + enableAddMessungen: function() { + this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false); + }, + */ + + disableChildren: function() { + // there are no children.... + }, + + enableChildren: function() { + // there are no children.... + }, + + setMessages: function(errors, warnings) { + this.down('messprogrammform').setMessages(errors, warnings); + }, + + clearMessages: function() { + this.down('messprogrammform').clearMessages(); + } +});
--- a/app/view/window/MessprogrammCreate.js Wed May 06 16:24:23 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +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 create a Messprogramm - * - */ -Ext.define('Lada.view.window.MessprogrammCreate', { - extend: 'Ext.window.Window', - alias: 'widget.messprogrammcreate', - - requires: [ - 'Lada.view.form.Messprogramm' - ], - - collapsible: true, - maximizable: true, - autoShow: true, - autoScroll: true, - layout: 'fit', - constrain: true, - - record: null, - - initComponent: function() { - var i18n = Lada.getApplication().bundle; - this.title = i18n.getMsg('messprogramm.window.create.title'); - this.buttons = [{ - text: i18n.getMsg('close'), - scope: this, - handler: this.close - }]; - - // 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'); - } - }); - - this.width = 700; - this.height = Ext.getBody().getViewSize().height - 30; - // InitialConfig is the config object passed to the constructor on - // creation of this window. We need to pass it throuh to the form as - // we need the "modelId" param to load the correct item. - - this.items = [{ - border: 0, - autoScroll: true, - items: [{ - xtype: 'messprogrammform' - }, { - //Messmethoden - xtype: 'fieldset', - title: i18n.getMsg('mmtmessprogramm.form.fieldset.title'), - autoScroll: true, - margin: 5, - layout: { - type: 'hbox', - }, - items: [{ - xtype: 'messmethodengrid', - recordId: null, - flex: 1 - }, { - xtype: 'messmethodengrid', - recordId: null, - flex: 1 - }] - }] - }]; - this.callParent(arguments); - }, - - initData: function() { - record = Ext.create('Lada.model.Messprogramm'); - this.down('messprogrammform').setRecord(record); - }, - - setMessages: function(errors, warnings) { - this.down('messprogrammform').setMessages(errors, warnings); - }, - - clearMessages: function() { - this.down('messprogrammform').clearMessages(); - }, - - disableChildren: function(){ - //intentionally! - return true; - }, - - enableChildren: function(){ - //intentionally! - return true; - } -});
--- a/app/view/window/MessprogrammEdit.js Wed May 06 16:24:23 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +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 edit a Messprogramm - */ -Ext.define('Lada.view.window.MessprogrammEdit', { - extend: 'Ext.window.Window', - alias: 'widget.messprogrammedit', - - requires: [ - 'Lada.view.form.Messprogramm', - 'Lada.view.grid.Messmethoden', - ], - - collapsible: true, - maximizable: true, - autoShow: true, - autoScroll: true, - layout: 'fit', - constrain: true, - - record: null, - - initComponent: function() { - var i18n = Lada.getApplication().bundle; - - if (this.record === null) { - Ext.Msg.create(i18n.getMsg('err.msg.generic.title'), - i18n.getMsg('err.msg.novalidmessprogram')); - this.callParent(arguments); - return; - } - this.title = i18n.getMsg('messprogramm.window.edit.title'); - this.buttons = [{ - text: i18n.getMsg('close'), - scope: this, - handler: this.close - }]; - this.width = 700; - - // 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'); - } - }); - - this.height = Ext.getBody().getViewSize().height - 30; - // InitialConfig is the config object passed to the constructor on - // creation of this window. We need to pass it throuh to the form as - // we need the "Id" param to load the correct item. - this.items = [{ - border: 0, - autoScroll: true, - items: [{ - xtype: 'messprogrammform', - recordId: this.record.get('id') - }, { - //Messmethoden - xtype: 'fieldset', - title: i18n.getMsg('mmtmessprogramm.form.fieldset.title'), - autoScroll: true, - margin: 5, - layout: { - type: 'hbox', - }, - items: [{ - xtype: 'messmethodengrid', - //recordId: null, - recordId: this.record.get('id'), - flex: 1 - }] - }] - }]; - this.callParent(arguments); - }, - - initData: function() { - this.setLoading(true); - this.clearMessages(); - me = this; - Ext.ClassManager.get('Lada.model.Messprogramm').load(this.record.get('id'), { - failure: function(record, action) { - me.setLoading(false); - // TODO - console.log('An unhandled Failure occured. See following Response and Record'); - console.log(action); - console.log(record); - }, - success: function(record, response) { - this.down('messprogrammform').setRecord(record); - this.record = record; - - //this.down('messmethodengrid').recordId = record.get('id'); - var json = Ext.decode(response.response.responseText); - if (json) { - this.setMessages(json.errors, json.warnings); - } - // If the Messprogramm is ReadOnly, disable Inputfields and grids - if (this.record.get('readonly') === true) { - this.down('messprogrammform').setReadOnly(true); - this.disableChildren(); - } - else { - this.down('messprogrammform').setReadOnly(false); - this.enableChildren(); - } - me.setLoading(false); - }, - scope: this - }); - }, - - //This was used in a Probewindow, I left it here for reference... - /* - enableAddMessungen: function() { - this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false); - }, - */ - - disableChildren: function() { - // there are no children.... - }, - - enableChildren: function() { - // there are no children.... - }, - - setMessages: function(errors, warnings) { - this.down('messprogrammform').setMessages(errors, warnings); - }, - - clearMessages: function() { - this.down('messprogrammform').clearMessages(); - } -});
--- a/resources/i18n/Lada_de-DE.properties Wed May 06 16:24:23 2015 +0200 +++ b/resources/i18n/Lada_de-DE.properties Thu May 07 10:55:44 2015 +0200 @@ -65,6 +65,8 @@ emptytext.probenart:Wahlen Sie eine Probenart emptytext.umweltbereich:Wahlen Sie einen Umweltbereich emptytext.netzbetrieber:Wahlen Sie einen Netzbetreiber +emptytext.mmtgrid:Fügen Sie eine Messmethoden hinzu. +emptytext.nuklidgrid:Für die ausgewählte Messmethode existieren keine Nuklide oder es wurde keine Messmethode ausgewählt. ##Fieldsets erwAngaben:Erweiterte Angaben