annotate app/controller/form/Probe.js @ 625:f59bda7551d7

Xtype numbercolumn hinzugefügt, Eine neue Spalte dem Grid hinzugefügt, die angibt wenn der Messwert unterhalb der Nachweisegrenze liegt. Das Bisherige Konstrukt, dass ein < mit in die Messwert-Spalte ausgegeben wird führte dazu, dass die Locale-Spezifischen ersetzungen . -> , nicht griffen.
author Dustin Demuth <dustin@intevation.de>
date Mon, 16 Mar 2015 11:40:15 +0100
parents cf328526b5bb
children e0b966b32163
rev   line source
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.controller.form.Probe', {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.app.Controller',
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 init: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 this.control({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 'probeform button[action=save]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 click: this.save
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'probeform button[action=discard]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 click: this.discard
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 'probeform': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 dirtychange: this.dirtyForm
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 save: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 var formPanel = button.up('form');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 var data = formPanel.getForm().getFieldValues(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 for (var key in data) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 formPanel.getForm().getRecord().set(key, data[key]);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 formPanel.getForm().getRecord().save({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 success: function(record, response) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 var json = Ext.decode(response.response.responseText);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 if (response.action !== 'create' &&
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 json &&
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 json.success) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 button.setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 button.up('toolbar').down('button[action=discard]')
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 .setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 formPanel.clearMessages();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 formPanel.setRecord(record);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 formPanel.setMessages(json.errors, json.warnings);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 failure: function(record, response) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 button.setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 button.up('toolbar').down('button[action=discard]')
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 .setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 var json = response.request.scope.reader.jsonData;
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 if (json) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 formPanel.setMessages(json.errors, json.warnings);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 console.log('save');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 discard: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 var formPanel = button.up('form');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 dirtyForm: function(form, dirty) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 if (dirty) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 form.owner.down('button[action=save]').setDisabled(false);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 form.owner.down('button[action=discard]').setDisabled(false);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 else {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 form.owner.down('button[action=save]').setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 form.owner.down('button[action=discard]').setDisabled(true);
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 });

http://lada.wald.intevation.org