annotate app/controller/form/Messung.js @ 1395:f428b7d8f19b

SENCHAPATH now can be preset by using export SENCHAPATH=... before ./build.sh
author Marco Lechner, Bundesamt fuer Strahlenschutz, SW 2.1 <mlechner@bfs.de>
date Mon, 13 Mar 2017 12:39:14 +0100
parents 7e9a6f0e55b3
children
rev   line source
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
9 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
10 * This is a controller for a Messung form
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
11 */
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.form.Messung', {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.app.Controller',
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
15 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
16 * Initialize the Controller
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
17 * It has 3 listeners
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
18 */
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
19 init: function() {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20 this.control({
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 'messungform button[action=save]': {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22 click: this.save
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 },
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 'messungform button[action=discard]': {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 click: this.discard
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 },
1386
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
27 'messungform button[action=audit]': {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
28 click: this.showAuditTrail
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
29 },
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
30 'messungform': {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31 dirtychange: this.dirtyForm
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 }
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 });
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 },
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
36 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
37 * The save function saves the content of the Location form.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
38 * On success it will reload the Store,
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
39 * on failure, it will display an Errormessage
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
40 */
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 save: function(button) {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 var formPanel = button.up('form');
713
2e478b3a587a Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 712
diff changeset
43 formPanel.setLoading(true);
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 var data = formPanel.getForm().getFieldValues(true);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 for (var key in data) {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46 formPanel.getForm().getRecord().set(key, data[key]);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 }
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 formPanel.getForm().getRecord().save({
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 success: function(record, response) {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 var json = Ext.decode(response.response.responseText);
622
ee92e352be20 Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 611
diff changeset
51 if (json) {
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52 button.setDisabled(true);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 button.up('toolbar').down('button[action=discard]')
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 .setDisabled(true);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 formPanel.clearMessages();
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 formPanel.setRecord(record);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 formPanel.setMessages(json.errors, json.warnings);
710
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
58 formPanel.up('window').initData();
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 639
diff changeset
59 formPanel.up('window').grid.store.reload();
1120
0a032c98c3a6 Use correct parent window reference for messung windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 972
diff changeset
60 var parentWin = button.up('window').parentWindow;
710
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
61 parentWin.initData();
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
62 if (response.action === 'create' && json.success) {
710
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
63 var oldWin = button.up('window');
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
64 var probe = oldWin.record;
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
65 oldWin.close();
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
66 var win = Ext.create('Lada.view.window.MessungEdit', {
710
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
67 probe: probe,
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
68 parentWindow: parentWin,
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 701
diff changeset
69 grid: oldWin.grid,
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
70 record: record
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
71 });
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
72 win.show();
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
73 win.initData();
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 622
diff changeset
74 }
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 }
713
2e478b3a587a Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 712
diff changeset
76 formPanel.setLoading(false);
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 },
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 failure: function(record, response) {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 button.setDisabled(true);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80 button.up('toolbar').down('button[action=discard]')
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
81 .setDisabled(true);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
82 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
83 var json = response.request.scope.reader.jsonData;
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
84 if (json) {
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
85 if (json.message) {
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 695
diff changeset
86 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
87 + ' #' + json.message,
695
d6ef146e1a9f Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
88 Lada.getApplication().bundle.getMsg(json.message));
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
89 }
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
90 else {
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 695
diff changeset
91 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 695
diff changeset
92 Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 687
diff changeset
93 }
720
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 715
diff changeset
94 formPanel.clearMessages();
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 715
diff changeset
95 formPanel.setRecord(record);
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 715
diff changeset
96 formPanel.setMessages(json.errors, json.warnings);
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 715
diff changeset
97 formPanel.up('window').initData();
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 715
diff changeset
98 formPanel.up('window').grid.store.reload();
c2a6f7caa71b Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents: 715
diff changeset
99 }
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
100 else {
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 695
diff changeset
101 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 695
diff changeset
102 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
103 }
713
2e478b3a587a Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 712
diff changeset
104 formPanel.setLoading(false);
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
105 }
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
106 });
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
107 },
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
108
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
109 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
110 * The discard function resets the Location form
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
111 * to its original state.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
112 */
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
113 discard: function(button) {
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
114 var formPanel = button.up('form');
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
115 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
116 },
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
117
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
118 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
119 * The dirtyForm function enables or disables the save and discard
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
120 * button which are present in the toolbar of the form.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
121 * The Buttons are only active if the content of the form was altered
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
122 * (the form is dirty).
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
123 * In Additon it calls the disableChildren() function of the window
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
124 * embedding the form. Only when the record does not carry the readonly
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
125 * flag, the function calls the embedding windows enableChilren() function
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
126 */
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 720
diff changeset
127 dirtyForm: function(form, dirty) {
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 if (dirty) {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 form.owner.down('button[action=save]').setDisabled(false);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
130 form.owner.down('button[action=discard]').setDisabled(false);
687
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
131 form.owner.up('window').disableChildren();
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 }
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 else {
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134 form.owner.down('button[action=save]').setDisabled(true);
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
135 form.owner.down('button[action=discard]').setDisabled(true);
715
605bc34b45a0 Disable the Fertig-Flag Checkbox in a Messung when the User is not the owner. Do not enable Form-Children when readonly is set to true. Parse login-response in app.js
Dustin Demuth <dustin@intevation.de>
parents: 713
diff changeset
136 //Only enable children if the form was not readOnly
605bc34b45a0 Disable the Fertig-Flag Checkbox in a Messung when the User is not the owner. Do not enable Form-Children when readonly is set to true. Parse login-response in app.js
Dustin Demuth <dustin@intevation.de>
parents: 713
diff changeset
137 if (!form.getRecord().get('readonly')) {
605bc34b45a0 Disable the Fertig-Flag Checkbox in a Messung when the User is not the owner. Do not enable Form-Children when readonly is set to true. Parse login-response in app.js
Dustin Demuth <dustin@intevation.de>
parents: 713
diff changeset
138 form.owner.up('window').enableChildren();
605bc34b45a0 Disable the Fertig-Flag Checkbox in a Messung when the User is not the owner. Do not enable Form-Children when readonly is set to true. Parse login-response in app.js
Dustin Demuth <dustin@intevation.de>
parents: 713
diff changeset
139 }
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
140 }
1386
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
141 },
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
142
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
143 showAuditTrail: function(button) {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
144 Ext.create('Lada.view.window.AuditTrail', {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
145 autoShow: true,
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
146 closeAction: 'destroy',
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
147 type: 'messung',
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
148 objectId: button.up('form').recordId
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1356
diff changeset
149 });
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
150 }
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
151 });

http://lada.wald.intevation.org