annotate app/view/window/ProbeEdit.js @ 707:c632c7c34029

added disable/enableChildren Method
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 15:22:32 +0100
parents 3e4be37e3e46
children 6f6d2df00130
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Window to edit a Probe
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.ProbeEdit', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.probenedit',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.form.Probe',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'Lada.view.grid.Ort',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 'Lada.view.grid.Probenzusatzwert',
561
ea2c35cd9c19 Ein grid für Messungen hinzugefügt und im Window ProbeEdit eingesetzt. Ohne Funktion sind die Felder: Status, OK-Flag, Anzahl Nuklide/Kommentare
Dustin Demuth <dustin@intevation.de>
parents: 557
diff changeset
20 'Lada.view.grid.PKommentar',
592
825973ca386f Updated missing name changes for messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 588
diff changeset
21 'Lada.view.grid.Messung'
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 ],
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 maximizable: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 autoShow: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 autoScroll: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 layout: 'fit',
688
6a6d1b02a1a3 constrain windows to viewport
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
29 constrain: true,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 record: null,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
33
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 if (this.record === null) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 Ext.Msg.alert('Keine valide Probe ausgewählt!');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 }
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 601
diff changeset
40 var extendedTitle = this.record.get('probeId') ? this.record.get('probeId') : '';
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 601
diff changeset
41 this.title = '§3-Probe ' + extendedTitle;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 this.buttons = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 text: 'Schließen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 scope: this,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 handler: this.close
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 this.width = 700;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 this.height = Ext.getBody().getViewSize().height - 30;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 // InitialConfig is the config object passed to the constructor on
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 // creation of this window. We need to pass it throuh to the form as
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 // we need the "modelId" param to load the correct item.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 this.items = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 border: 0,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 autoScroll: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 xtype: 'probeform',
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
57 recordId: this.record.get('id')
601
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
58 }, {
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
59 xtype: 'fset',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
60 name: 'messungen',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
61 title: 'Messungen',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
62 padding: '5, 5',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
63 margin: 5,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
64 collapsible: false,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
65 collapsed: false,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
66 items: [{
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
67 xtype: 'messunggrid',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
68 recordId: this.record.get('id')
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
69 }]
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 xtype: 'fset',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 name: 'orte',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 title: 'Ortsangaben',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 xtype: 'ortgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 xtype: 'fset',
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
82 name: 'probenzusatzwerte',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 title: 'Zusatzwerte',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 collapsed: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 xtype: 'probenzusatzwertgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 xtype: 'fset',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 name: 'pkommentare',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 title: 'Kommentare',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 collapsed: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 xtype: 'pkommentargrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 initData: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 this.clearMessages();
706
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
111 me = this;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 Ext.ClassManager.get('Lada.model.Probe').load(this.record.get('id'), {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 failure: function(record, action) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 // TODO
696
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
115 console.log("An unhandled Failure occured. See following Response and Record");
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
116 console.log(response);
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
117 console.log(record);
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
118 },
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 success: function(record, response) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 this.down('probeform').setRecord(record);
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
121 this.record = record;
706
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
122 owner = this.record.get('owner');
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
123
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
124 if (owner) {
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
125 //Always allow to Add Messungen.
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
126 me.enableAddMessungen();
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
127 }
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
128
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 var json = Ext.decode(response.response.responseText);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 if (json) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 this.setMessages(json.errors, json.warnings);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 scope: this
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 });
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
136
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
137 // If the Probe is ReadOnly, disable Inputfields and grids
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
138 if (this.record.get('readonly') == true){
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
139 this.down('probeform').setReadOnly(true);
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
140 this.disableChildren();
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
141 }
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
142 },
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
143
706
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
144 enableAddMessungen: function(){
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
145 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false);
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
146 },
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
147
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
148 disableChildren: function(){
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
149 if (!this.record.get('owner')) {
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
150 // Disable only when the User is not the owner of the Probe
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
151 // Works in symbiosis with success callback some lines above.
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
152 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(true);
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
153 }
706
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
154 this.down('fset[name=orte]').down('ortgrid').setReadOnly(true);
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
155 this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(true);
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
156 this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(true);
684
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
157 },
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
158
69cb367c0a63 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents: 681
diff changeset
159 enableChildren: function(){
706
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
160 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false);
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
161 this.down('fset[name=orte]').down('ortgrid').setReadOnly(false);
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
162 this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(false);
3e4be37e3e46 Re-Enable Add/Delete Button of a MessungGrid in Cases when the User owns the Probe
Dustin Demuth <dustin@intevation.de>
parents: 696
diff changeset
163 this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(false);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 setMessages: function(errors, warnings) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 this.down('probeform').setMessages(errors, warnings);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 var errorOrtText = '';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 var errorOrt = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 var warningOrtText = '';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 var warningOrt = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 var key;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 var content;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 var i;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 var keyText;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 var i18n = Lada.getApplication().bundle;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 for (key in errors) {
582
a241362cda68 Use indexOf instead of contains to check if a substring exists.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 561
diff changeset
178 if (key && key.indexOf('Ort') > -1) {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 errorOrt = true;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 content = errors[key];
557
48ee1adee0a2 Added i18n string for 'orte' errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
181 keyText = i18n.getMsg(key);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 for (i = 0; i < content.length; i++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 errorOrtText += keyText + ': ' +
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 i18n.getMsg(content[i].toString()) + '\n';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 for (key in warnings) {
582
a241362cda68 Use indexOf instead of contains to check if a substring exists.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 561
diff changeset
189 if (key && key.indexOf('Ort') > -1) {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 warningOrt = true;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 content = warnings[key];
557
48ee1adee0a2 Added i18n string for 'orte' errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
192 keyText = i18n.getMsg(key);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 for (i = 0; i < content.length; i++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 warningOrtText += keyText + ': ' +
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 i18n.getMsg(content[i].toString()) + '\n';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 this.down('fset[name=orte]').showWarningOrError(
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 warningOrt,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 warningOrtText === '' ? null : warningOrtText,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 errorOrt,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 errorOrtText === '' ? null : errorOrtText);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 clearMessages: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 this.down('probeform').clearMessages();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 this.down('fset[name=orte]').clearMessages();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 });

http://lada.wald.intevation.org