annotate app/view/window/ProbeEdit.js @ 709:6f6d2df00130

Added some CSS to make distinction between active and inactice windows more simple for the user
author Dustin Demuth <dustin@intevation.de>
date Tue, 07 Apr 2015 17:16:59 +0200
parents c632c7c34029
children f204f30b824a
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
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 if (this.record === null) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 Ext.Msg.alert('Keine valide Probe ausgewählt!');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 }
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 601
diff changeset
39 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
40 this.title = '§3-Probe ' + extendedTitle;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 this.buttons = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 text: 'Schließen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 scope: this,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 handler: this.close
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 this.width = 700;
709
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
47
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
48 // add listeners to change the window appearence when it becomes inactive
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
49 this.on({
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
50 activate: function(){
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
51 this.getEl().removeCls('window-inactive');
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
52 },
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
53 deactivate: function(){
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
54 this.getEl().addCls('window-inactive');
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
55 }
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
56 });
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
57
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 this.height = Ext.getBody().getViewSize().height - 30;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 // InitialConfig is the config object passed to the constructor on
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 // 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
61 // we need the "modelId" param to load the correct item.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 this.items = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 border: 0,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 autoScroll: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 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
67 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
68 }, {
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
69 xtype: 'fset',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
70 name: 'messungen',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
71 title: 'Messungen',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
72 padding: '5, 5',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
73 margin: 5,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
74 collapsible: false,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
75 collapsed: false,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
76 items: [{
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
77 xtype: 'messunggrid',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
78 recordId: this.record.get('id')
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
79 }]
548
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',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 name: 'orte',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 title: 'Ortsangaben',
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 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 xtype: 'ortgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 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
92 name: 'probenzusatzwerte',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 title: 'Zusatzwerte',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 collapsed: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 xtype: 'probenzusatzwertgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 xtype: 'fset',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 name: 'pkommentare',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 title: 'Kommentare',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 collapsed: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 xtype: 'pkommentargrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 initData: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 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
121 me = this;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 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
123 failure: function(record, action) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 // TODO
696
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
125 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
126 console.log(response);
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
127 console.log(record);
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
128 },
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 success: function(record, response) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 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
131 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
132 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
133
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
134 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
135 //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
136 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
137 }
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
138
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 var json = Ext.decode(response.response.responseText);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 if (json) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 this.setMessages(json.errors, json.warnings);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 scope: this
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 });
693
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
146
817524db4017 Readonly was missing
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
147 // 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
148 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
149 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
150 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
151 }
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
152 },
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
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 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
155 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
156 },
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
157
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
158 disableChildren: function(){
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
159 if (!this.record.get('owner')) {
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
160 // 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
161 // Works in symbiosis with success callback some lines above.
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
162 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(true);
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
163 }
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
164 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
165 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
166 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
167 },
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
168
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
169 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
170 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
171 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
172 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
173 this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(false);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 setMessages: function(errors, warnings) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 this.down('probeform').setMessages(errors, warnings);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 var errorOrtText = '';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 var errorOrt = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 var warningOrtText = '';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 var warningOrt = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 var key;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 var content;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 var i;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 var keyText;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 var i18n = Lada.getApplication().bundle;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 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
188 if (key && key.indexOf('Ort') > -1) {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 errorOrt = true;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 content = errors[key];
557
48ee1adee0a2 Added i18n string for 'orte' errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
191 keyText = i18n.getMsg(key);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 for (i = 0; i < content.length; i++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 errorOrtText += keyText + ': ' +
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 i18n.getMsg(content[i].toString()) + '\n';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 }
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 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
199 if (key && key.indexOf('Ort') > -1) {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 warningOrt = true;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 content = warnings[key];
557
48ee1adee0a2 Added i18n string for 'orte' errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
202 keyText = i18n.getMsg(key);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 for (i = 0; i < content.length; i++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 warningOrtText += keyText + ': ' +
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 i18n.getMsg(content[i].toString()) + '\n';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 this.down('fset[name=orte]').showWarningOrError(
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 warningOrt,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 warningOrtText === '' ? null : warningOrtText,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 errorOrt,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 errorOrtText === '' ? null : errorOrtText);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 clearMessages: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 this.down('probeform').clearMessages();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 this.down('fset[name=orte]').clearMessages();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 });

http://lada.wald.intevation.org