[Lada-commits] [PATCH 2 of 3] merged heads
Wald Commits
scm-commit at wald.intevation.org
Wed May 13 10:59:22 CEST 2015
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1431505635 -7200
# Node ID 442e7bd290dc39f24aee77779b5a5fd0f2216ffe
# Parent d2ee6858f45285c1948279d5e7bbf60af1f7a47f
# Parent bb2593ca23e8cbad874a5d75c4d804cda202ff7b
merged heads
diff -r d2ee6858f452 -r 442e7bd290dc app/controller/form/Messprogramm.js
--- a/app/controller/form/Messprogramm.js Wed May 13 09:33:58 2015 +0200
+++ b/app/controller/form/Messprogramm.js Wed May 13 10:27:15 2015 +0200
@@ -39,6 +39,9 @@
},
'messprogrammform probenintervall combobox': {
select: this.updateIntervalls
+ },
+ 'messprogrammform panel[xtype="deskriptor] combobox': {
+ select: this.deskriptorSelect
}
});
},
@@ -231,4 +234,51 @@
field.up('fieldset').clearMessages();
}
}
- }});
+ },
+
+ deskriptorSelect: function(field, records) {
+ var desk = field.up('deskriptor');
+ var media = field.up('messprogrammform').down('textfield[name="mediaDesk"]');
+ var current = media.getValue().split(' ');
+ this.clearChildDesk(field.up('deskriptor'), current);
+ if (current.length < 13) {
+ for (var i = 0; i <= 12; i++) {
+ if (i === 0) {
+ current.push('D:');
+ }
+ else if (i === desk.layer + 1) {
+ var value;
+ if (records[0].get('sn') < 10) {
+ value = '0' + records[0].get('sn');
+ }
+ else {
+ value = records[0].get('sn');
+ }
+ current.push(value);
+ }
+ else {
+ current.push('00');
+ }
+ }
+ }
+ else {
+ var value;
+ if (records[0].get('sn') < 10) {
+ value = '0' + records[0].get('sn');
+ }
+ else {
+ value = records[0].get('sn');
+ }
+ current[desk.layer + 1] = value;
+ }
+ media.setValue(current.join(' ').trim());
+ },
+
+ clearChildDesk: function(field, media) {
+ var allS = field.up('fieldset').items.items;
+ for (var i = field.layer + 1; i < 12; i++) {
+ allS[i].clearValue();
+ media[i + 1] = '00';
+ }
+ }
+});
diff -r d2ee6858f452 -r 442e7bd290dc app/view/form/Messprogramm.js
--- a/app/view/form/Messprogramm.js Wed May 13 09:33:58 2015 +0200
+++ b/app/view/form/Messprogramm.js Wed May 13 10:27:15 2015 +0200
@@ -399,7 +399,42 @@
Lada.app.getController('Lada.controller.form.Messprogramm')
.synchronizeFields
);
+ },
+ setMediaDesk: function(record) {
+ var media = record.get('mediaDesk').split(' ');
+ this.setMediaSN(0, media);
+ },
+
+ setMediaSN: function(ndx, media) {
+ if (ndx >= 12) {
+ return;
+ }
+ var me = this;
+ var current = this.down('deskriptor[layer=' + ndx + ']');
+ var cbox = current.down('combobox');
+ if (ndx === 0) {
+ cbox.store.proxy.extraParams = {
+ 'layer': ndx
+ };
+ }
+ else {
+ var parents = current.getParents(current.down('combobox'));
+ if (parents.length === 0) {
+ return;
+ }
+ cbox.store.proxy.extraParams = {
+ 'layer': ndx,
+ 'parents': parents
+ };
+ }
+ cbox.store.load(function(records, op, success) {
+ if (!success) {
+ return;
+ }
+ cbox.select(cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10)));
+ me.setMediaSN(++ndx, media);
+ });
},
setMessages: function(errors, warnings) {
@@ -463,9 +498,11 @@
var fields = [];
for (var i = 0; i < 12; i++) {
fields[i] = {
+ xtype: 'deskriptor',
fieldLabel: 'S' + i,
- name: 's' + i,
labelWidth: 25,
+ width: 190,
+ layer: i,
margin: '0, 10, 5, 0'
};
}
diff -r d2ee6858f452 -r 442e7bd290dc app/view/form/Probe.js
--- a/app/view/form/Probe.js Wed May 13 09:33:58 2015 +0200
+++ b/app/view/form/Probe.js Wed May 13 10:27:15 2015 +0200
@@ -180,7 +180,7 @@
}
}
}, {
- xtype: 'textfield',
+ xtype: 'tfield',
maxLength: 38,
enforceMaxLength: true,
name: 'mediaDesk',
@@ -213,18 +213,11 @@
title: 'Details Deskriptoren',
collapsible: true,
collapsed: true,
- defaultType: 'textfield',
layout: {
type: 'table',
columns: 3
},
- items: this.buildDescriptors(),
- listeners: {
- dirtychange: {
- fn: this.updateOnChange,
- scope: me
- }
- }
+ items: this.buildDescriptors()
}]
}]
}, {
@@ -405,7 +398,7 @@
this.down('cbox[name=netzbetreiberId]').setReadOnly(value);
this.down('tfield[name=x11]').setReadOnly(value);
this.down('textfield[name=media]').setReadOnly(value);
- this.down('textfield[name=mediaDesk]').setReadOnly(value);
+ this.down('tfield[name=mediaDesk]').setReadOnly(value);
this.down('cbox[name=umwId]').setReadOnly(value);
this.down('datetime[name=probeentnahmeBeginn]').setReadOnly(value);
this.down('datetime[name=probeentnahmeEnde]').setReadOnly(value);
@@ -415,7 +408,7 @@
//Deskriptoren
for (var i = 0; i < 12; i++) {
- this.down('field[name=s'+i+']').setReadOnly(value);
+ this.down('deskriptor[layer='+i+']').setReadOnly(value);
}
},
@@ -425,7 +418,7 @@
fields[i] = {
xtype: 'deskriptor',
fieldLabel: 'S' + i,
- name: 's' + i,
+ //name: 's' + i,
labelWidth: 25,
width: 190,
layer: i,
diff -r d2ee6858f452 -r 442e7bd290dc app/view/widget/Deskriptor.js
--- a/app/view/widget/Deskriptor.js Wed May 13 09:33:58 2015 +0200
+++ b/app/view/widget/Deskriptor.js Wed May 13 10:27:15 2015 +0200
@@ -44,6 +44,7 @@
this.store = Ext.create('Lada.store.Deskriptoren');
this.callParent(arguments);
+ this.down('combobox').isFormField = false;
},
getParents: function(field) {
diff -r d2ee6858f452 -r 442e7bd290dc app/view/widget/ProbenintervallSlider.js
--- a/app/view/widget/ProbenintervallSlider.js Wed May 13 09:33:58 2015 +0200
+++ b/app/view/widget/ProbenintervallSlider.js Wed May 13 10:27:15 2015 +0200
@@ -2,6 +2,7 @@
extend: 'Ext.slider.Multi',
alias: 'widget.probenintervallslider',
useTips: false,
+ isFormField: false,
//editable: this.editable || false,
initComponent: function() {
diff -r d2ee6858f452 -r 442e7bd290dc app/view/window/Messprogramm.js
--- a/app/view/window/Messprogramm.js Wed May 13 09:33:58 2015 +0200
+++ b/app/view/window/Messprogramm.js Wed May 13 10:27:15 2015 +0200
@@ -138,6 +138,9 @@
var json = Ext.decode(response.response.responseText);
if (json) {
this.setMessages(json.errors, json.warnings);
+ if (!json.warnings.mediaDesk) {
+ this.down('messprogrammform').setMediaDesk(record);
+ }
}
// If the Messprogramm is ReadOnly, disable Inputfields and grids
if (this.record.get('readonly') === true) {
More information about the Lada-commits
mailing list