Mercurial > lada > lada-client
annotate app/controller/form/Messung.js @ 1111:a73726bba79c
Use custom row expander in probe list grid to display messung grid.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 17 May 2016 17:12:07 +0200 |
parents | 24b5684d74d7 |
children | 0a032c98c3a6 |
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 }, |
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
|
27 '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
|
28 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
|
29 } |
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 }); |
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 }, |
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 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
33 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
34 * 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
|
35 * On success it will reload the Store, |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
36 * on failure, it will display an Errormessage |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
37 */ |
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
|
38 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
|
39 var formPanel = button.up('form'); |
713
2e478b3a587a
Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
712
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 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
|
44 } |
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 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 .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
|
52 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
|
53 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
|
54 formPanel.setMessages(json.errors, json.warnings); |
710
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
55 formPanel.up('window').initData(); |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
639
diff
changeset
|
56 formPanel.up('window').grid.store.reload(); |
710
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
57 var parentWin = button.up('window').grid.up('window'); |
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
58 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
|
59 if (response.action === 'create' && json.success) { |
710
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
60 var oldWin = button.up('window'); |
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
61 var probe = oldWin.record; |
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
62 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
|
63 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
|
64 probe: probe, |
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
65 parentWindow: parentWin, |
f204f30b824a
Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
701
diff
changeset
|
66 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
|
67 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
|
68 }); |
fdaabab6f4cc
Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents:
622
diff
changeset
|
69 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
|
70 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
|
71 } |
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
|
72 } |
713
2e478b3a587a
Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
712
diff
changeset
|
73 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
|
74 }, |
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 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
|
76 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
|
77 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
|
78 .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
|
79 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
|
80 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
|
81 if (json) { |
972
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
82 if (json.errors || json.warnings) { |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
83 if (json.errors.totalCount > 0 || json.warnings.totalCount > 0) { |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
84 formPanel.setMessages(json.errors, json.warnings); |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
85 } |
693 | 86 } |
712 | 87 if (json.message) { |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
88 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') |
712 | 89 + ' #' + json.message, |
695
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
693
diff
changeset
|
90 Lada.getApplication().bundle.getMsg(json.message)); |
712 | 91 } |
92 else { | |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
93 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
94 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
693 | 95 } |
720
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
715
diff
changeset
|
96 formPanel.clearMessages(); |
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
715
diff
changeset
|
97 formPanel.setRecord(record); |
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
715
diff
changeset
|
98 formPanel.setMessages(json.errors, json.warnings); |
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
715
diff
changeset
|
99 formPanel.up('window').initData(); |
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
715
diff
changeset
|
100 formPanel.up('window').grid.store.reload(); |
c2a6f7caa71b
Fix for ErrorMessages in FieldSets for IE8 IE9
Dustin Demuth <dustin@intevation.de>
parents:
715
diff
changeset
|
101 } |
712 | 102 else { |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
103 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
104 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
|
105 } |
713
2e478b3a587a
Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
712
diff
changeset
|
106 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
|
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 }); |
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
|
109 }, |
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
|
110 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
111 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
112 * The discard function resets the Location form |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
113 * to its original state. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
114 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 }, |
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
|
119 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
120 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
121 * 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
|
122 * 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
|
123 * 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
|
124 * (the form is dirty). |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
125 * 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
|
126 * 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
|
127 * 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
|
128 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
720
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 } |
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 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
|
136 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
|
137 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
|
138 //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
|
139 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
|
140 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
|
141 } |
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
|
142 } |
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
|
143 } |
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
|
144 }); |