[Lada-commits] [PATCH 3 of 3] merged
Wald Commits
scm-commit at wald.intevation.org
Fri Mar 13 16:28:13 CET 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1426260542 -3600
# Node ID dfc07fa0ceb1fb5bc261f1883a5363e57f77d7fc
# Parent 3d33c65319f3c6eceb43d03662cbd1becbc38392
# Parent f959205ab173877ab9af02e5816123876192a774
merged.
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app.js
--- a/app.js Fri Mar 13 16:28:37 2015 +0100
+++ b/app.js Fri Mar 13 16:29:02 2015 +0100
@@ -104,6 +104,7 @@
'Lada.controller.Filter',
'Lada.controller.FilterResult',
'Lada.controller.form.Probe',
+ 'Lada.controller.form.Messung',
'Lada.controller.form.Ort',
'Lada.controller.grid.Ort',
'Lada.controller.grid.Probenzusatzwert',
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app/controller/form/Messung.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/form/Messung.js Fri Mar 13 16:29:02 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.Messung', {
+ extend: 'Ext.app.Controller',
+
+ init: function() {
+ this.control({
+ 'messungform button[action=save]': {
+ click: this.save
+ },
+ 'messungform button[action=discard]': {
+ click: this.discard
+ },
+ 'messungform': {
+ 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 3d33c65319f3 -r dfc07fa0ceb1 app/view/form/Messung.js
--- a/app/view/form/Messung.js Fri Mar 13 16:28:37 2015 +0100
+++ b/app/view/form/Messung.js Fri Mar 13 16:29:02 2015 +0100
@@ -14,10 +14,10 @@
alias: 'widget.messungform',
requires: [
'Lada.view.widget.Datenbasis',
+ 'Lada.view.widget.base.CheckBox',
+ 'Lada.view.widget.Messmethode',
'Lada.view.widget.base.TextField',
'Lada.view.widget.base.Datetime',
- 'Lada.view.widget.base.FieldSet',
- 'Lada.model.Messung'
],
model: 'Lada.model.Messung',
@@ -30,9 +30,87 @@
trackResetOnLoad: true,
initComponent: function() {
+ var me = this;
this.items = [{
xtype: 'fieldset',
- title: 'Allgemein'
+ title: 'Allgemein',
+ items: [{
+ border: 0,
+ margin: '0, 0, 10, 0',
+ layout: {
+ type: 'table',
+ columns: 2
+ },
+ 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: 'textfield',
+ name: 'nebenprobenNr',
+ maxLength: 10,
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Nebenprobennr.',
+ width: 300,
+ labelWidth: 100,
+ }, {
+ xtype: 'messmethode',
+ name: 'mmtId',
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Messmethode',
+ width: 300,
+ labelWidth: 100,
+ }, {
+ xtype: 'datetime',
+ name: 'messzeitpunkt',
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Messzeitpunkt',
+ width: 300,
+ labelWidth: 100,
+ }, {
+ xtype: 'numberfield',
+ allowDecimals: false,
+ minValue: 0,
+ name: 'messdauer',
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Messdauer',
+ width: 300,
+ labelWidth: 100,
+ }, {
+ xtype: 'chkbox',
+ name: 'fertig',
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Fertig',
+ width: 300,
+ labelWidth: 100,
+ }, {
+ xtype: 'chkbox',
+ name: 'geplant',
+ margin: '0, 10, 5, 0',
+ fieldLabel: 'Geplant',
+ width: 300,
+ labelWidth: 100,
+ }]
+ }]
}];
this.callParent(arguments);
},
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app/view/form/Probe.js
--- a/app/view/form/Probe.js Fri Mar 13 16:28:37 2015 +0100
+++ b/app/view/form/Probe.js Fri Mar 13 16:29:02 2015 +0100
@@ -106,35 +106,17 @@
name: 'datenbasisId',
fieldLabel: 'Datenbasis',
labelWidth: 100,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}, {
xtype: 'betriebsart',
name: 'baId',
fieldLabel: 'Betriebsart',
labelWidth: 100,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}, {
xtype: 'testdatensatz',
name: 'test',
fieldLabel: 'Testdatensatz',
labelWidth: 100,
allowBlank: false,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}, {
xtype: 'probenart',
editable: false,
@@ -142,24 +124,12 @@
fieldLabel: 'Probenart',
labelWidth: 100,
allowBlank: false,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}, {
xtype: 'numberfield',
allowDecimals: false,
name: 'probeNehmerId',
fieldLabel: 'Probennehmer',
labelWidth: 100,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}, {
xtype: 'netzbetreiber',
name: 'netzbetreiberId',
@@ -167,23 +137,11 @@
fieldLabel: 'Netzbetreiber',
labelWidth: 100,
allowBlank: false,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}, {
xtype: 'tfield',
name: 'x11',
fieldLabel: 'Datensatzerzeuger',
labelWidth: 100,
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
}]
}]
}]
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app/view/widget/Messmethode.js
--- a/app/view/widget/Messmethode.js Fri Mar 13 16:28:37 2015 +0100
+++ b/app/view/widget/Messmethode.js Fri Mar 13 16:29:02 2015 +0100
@@ -22,7 +22,8 @@
triggerAction: 'all',
typeAhead: true,
minChars: 0,
-
+ layout: 'hbox',
+
initComponent: function() {
this.store = Ext.data.StoreManager.get('messmethoden');
if (!this.store) {
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app/view/widget/Testdatensatz.js
--- a/app/view/widget/Testdatensatz.js Fri Mar 13 16:28:37 2015 +0100
+++ b/app/view/widget/Testdatensatz.js Fri Mar 13 16:29:02 2015 +0100
@@ -6,16 +6,7 @@
* the documentation coming with IMIS-Labordaten-Application for details.
*/
-var testdatensatzStore = Ext.create('Ext.data.Store', {
- fields: ['testdatensatzId', 'testdatensatz'],
- data: [{
- 'testdatensatzId': true,
- 'testdatensatz': 'Ja'
- }, {
- 'testdatensatzId': false,
- 'testdatensatz': 'Nein'
- }]
-});
+
/**
* Combobox for Testdatensatz.
@@ -23,15 +14,23 @@
*/
Ext.define('Lada.view.widget.Testdatensatz', {
extend: 'Lada.view.widget.base.ComboBox',
- editable: false,
alias: 'widget.testdatensatz',
- store: testdatensatzStore,
queryMode: 'local',
displayField: 'testdatensatz',
valueField: 'testdatensatzId',
emptyText: 'Testdatensatz?',
initComponent: function() {
+ this.store = Ext.create('Ext.data.Store', {
+ fields: ['testdatensatzId', 'testdatensatz'],
+ data: [{
+ 'testdatensatzId': true,
+ 'testdatensatz': 'Ja'
+ }, {
+ 'testdatensatzId': false,
+ 'testdatensatz': 'Nein'
+ }]
+ });
this.callParent(arguments);
}
});
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app/view/widget/base/CheckBox.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/widget/base/CheckBox.js Fri Mar 13 16:29:02 2015 +0100
@@ -0,0 +1,96 @@
+/* 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.view.widget.base.CheckBox', {
+ extend: 'Ext.form.Panel',
+ alias: 'widget.chkbox',
+
+ layout: 'hbox',
+
+ border: 0,
+
+ margin: '0, 0, 5, 0',
+
+ initComponent: function() {
+ this.items = [{
+ xtype: 'checkbox',
+ flex: 1,
+ name: this.name,
+ fieldLabel: this.fieldLabel,
+ labelWidth: this.labelWidth,
+ listeners: this.listeners,
+ triggerAction: this.triggerAction,
+ msgTarget: 'none',
+ tpl: this.tpl
+ }, {
+ xtype: 'image',
+ name: 'warnImg',
+ src: 'resources/img/icon-warning.gif',
+ width: 12,
+ height: 12,
+ hidden: true
+ }, {
+ xtype: 'image',
+ name: 'errorImg',
+ src: 'resources/img/icon-error.gif',
+ width: 12,
+ height: 12,
+ hidden: true
+ }];
+ this.callParent(arguments);
+ },
+
+ showWarnings: function(warnings) {
+ var img = this.down('image[name=warnImg]');
+ Ext.create('Ext.tip.ToolTip', {
+ target: img.getEl(),
+ html: warnings
+ });
+ this.down('checkbox').invalidCls = 'x-lada-warning';
+ this.down('checkbox').markInvalid('');
+ img.show();
+ var fieldset = this.up('fieldset[collapsible=true]');
+ if (fieldset) {
+ fieldset.showWarnings(warnings);
+ }
+ },
+
+ showErrors: function(errors) {
+ var img = this.down('image[name=errorImg]');
+ var warnImg = this.down('image[name=warnImg]');
+ warnImg.hide();
+ Ext.create('Ext.tip.ToolTip', {
+ target: img.getEl(),
+ html: errors
+ });
+ this.down('checkbox').invalidCls = 'x-lada-error';
+ this.down('checkbox').markInvalid('');
+ img.show();
+ var fieldset = this.up('fieldset[collapsible=true]');
+ if (fieldset) {
+ fieldset.showErrors();
+ }
+ },
+
+ clearWarningOrError: function() {
+ this.down('image[name=errorImg]').hide();
+ this.down('image[name=warnImg]').hide();
+ },
+
+ getValue: function() {
+ return this.down('checkbox').getValue();
+ },
+
+ getName: function() {
+ return this.name;
+ },
+
+ setReadOnly: function(value) {
+ this.down('checkbox').setReadOnly(value);
+ }
+});
diff -r 3d33c65319f3 -r dfc07fa0ceb1 app/view/window/MessungEdit.js
--- a/app/view/window/MessungEdit.js Fri Mar 13 16:28:37 2015 +0100
+++ b/app/view/window/MessungEdit.js Fri Mar 13 16:29:02 2015 +0100
@@ -48,8 +48,9 @@
autoScroll: true,
items: [{
xtype: 'messungform',
+ margin: 5,
recordId: this.record.get('id')
- }, {
+ }, {
xtype: 'fset',
name: 'messwerte',
title: 'Messwerte',
@@ -86,6 +87,7 @@
initData: function() {
this.clearMessages();
+ this.down('messungform').setRecord(this.record);
Ext.ClassManager.get('Lada.model.Messung').load(this.record.get('id'), {
failure: function(record) {
// TODO
@@ -99,8 +101,7 @@
}
},
scope: this
- }
- );
+ });
},
setMessages: function(errors, warnings) {
More information about the Lada-commits
mailing list