# HG changeset patch # User Dustin Demuth # Date 1426506006 -3600 # Node ID e3cdc36cbcaeaaf546ad104d089a7f8db3cf8ecb # Parent 6742ae5f35dcc434c785d212539f2a65a8bfb53f# Parent ee92e352be205dfb6ee464b8349c4004e3f0d9ed merged diff -r 6742ae5f35dc -r e3cdc36cbcae app/controller/FilterResult.js --- a/app/controller/FilterResult.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/FilterResult.js Mon Mar 16 12:40:06 2015 +0100 @@ -42,6 +42,9 @@ }, addItem: function(button) { + var win = Ext.create('Lada.view.window.ProbeCreate'); + win.show(); + win.initData(); }, diff -r 6742ae5f35dc -r e3cdc36cbcae app/controller/form/Messung.js --- a/app/controller/form/Messung.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/form/Messung.js Mon Mar 16 12:40:06 2015 +0100 @@ -32,9 +32,7 @@ formPanel.getForm().getRecord().save({ success: function(record, response) { var json = Ext.decode(response.response.responseText); - if (response.action !== 'create' && - json && - json.success) { + if (json) { button.setDisabled(true); button.up('toolbar').down('button[action=discard]') .setDisabled(true); diff -r 6742ae5f35dc -r e3cdc36cbcae app/controller/form/Probe.js --- a/app/controller/form/Probe.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/form/Probe.js Mon Mar 16 12:40:06 2015 +0100 @@ -32,9 +32,7 @@ formPanel.getForm().getRecord().save({ success: function(record, response) { var json = Ext.decode(response.response.responseText); - if (response.action !== 'create' && - json && - json.success) { + if (json) { button.setDisabled(true); button.up('toolbar').down('button[action=discard]') .setDisabled(true); diff -r 6742ae5f35dc -r e3cdc36cbcae app/controller/grid/Messung.js --- a/app/controller/grid/Messung.js Mon Mar 16 12:38:56 2015 +0100 +++ b/app/controller/grid/Messung.js Mon Mar 16 12:40:06 2015 +0100 @@ -38,9 +38,13 @@ win.initData(); }, - add: function() { - // TODO - console.log('add'); + add: function(button) { + var probe = button.up('window').record; + var win = Ext.create('Lada.view.window.MessungCreate', { + record: probe + }); + win.show(); + win.initData(); }, remove: function(button) { @@ -59,6 +63,7 @@ } }); } - }); + } + ); } }); diff -r 6742ae5f35dc -r e3cdc36cbcae app/view/window/MessungCreate.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/MessungCreate.js Mon Mar 16 12:40:06 2015 +0100 @@ -0,0 +1,62 @@ +/* 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 Messung + */ +Ext.define('Lada.view.window.MessungCreate', { + extend: 'Ext.window.Window', + alias: 'widget.messungcreate', + + requires: [ + 'Lada.view.form.Messung' + ], + + collapsible: true, + maximizable: true, + autoshow: true, + autoscroll: true, + layout: 'fit', + + record: null, + + initComponent: function() { + this.title = 'Messung'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 700; + + this.items = [{ + border: 0, + autoScroll: true, + items: [{ + xtype: 'messungform' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + this.clearMessages(); + var messung = Ext.create('Lada.model.Messung', { + probeId: this.record.get('id') + }); + this.down('messungform').setRecord(messung); + }, + + setMessages: function(errors, warnings) { + //todo this is a stub + }, + clearMessages: function() { + //todo this is a stub + } + +}); diff -r 6742ae5f35dc -r e3cdc36cbcae app/view/window/ProbeCreate.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/ProbeCreate.js Mon Mar 16 12:40:06 2015 +0100 @@ -0,0 +1,62 @@ +/* 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 Probe + */ +Ext.define('Lada.view.window.ProbeCreate', { + extend: 'Ext.window.Window', + alias: 'widget.probecreate', + + requires: [ + 'Lada.view.form.Probe' + ], + + collapsible: true, + maximizable: true, + autoShow: true, + autoScroll: true, + layout: 'fit', + + record: null, + + initComponent: function() { + this.title = '§3-Probe'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 700; + // 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: 'probeform' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + var record = Ext.create('Lada.model.Probe'); + this.down('probeform').setRecord(record); + }, + + setMessages: function(errors, warnings) { + this.down('probeform').setMessages(errors, warnings); + }, + + clearMessages: function() { + this.down('probeform').clearMessages(); + } +});