annotate app/view/window/ProbeEdit.js @ 891:8054232535ba

More JSduck
author Dustin Demuth <dustin@intevation.de>
date Thu, 23 Jul 2015 16:47:48 +0200
parents def27cdd0dfa
children 0a233865a9c3
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
891
8054232535ba More JSduck
Dustin Demuth <dustin@intevation.de>
parents: 890
diff changeset
9 /**
548
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
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
33 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
34 * This function initialises the Window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
35 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 if (this.record === null) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 Ext.Msg.alert('Keine valide Probe ausgewählt!');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 return;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 }
639
fdaabab6f4cc Open Probe-/Messung-Edit window automatically if a new item was saved
Raimund Renkert <raimund.renkert@intevation.de>
parents: 601
diff changeset
42 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
43 this.title = '§3-Probe ' + extendedTitle;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 this.buttons = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 text: 'Schließen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 scope: this,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 handler: this.close
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 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
50
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 // 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
52 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
53 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
54 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
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 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
57 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
58 }
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
59 });
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
60
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 this.height = Ext.getBody().getViewSize().height - 30;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 // InitialConfig is the config object passed to the constructor on
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 // 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
64 // we need the "modelId" param to load the correct item.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 this.items = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 border: 0,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 autoScroll: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 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
70 recordId: this.record.get('id')
839
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
71 }, {
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
72 xtype: 'fset',
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
73 name: 'orte',
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
74 title: 'Ortsangaben',
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
75 padding: '5, 5',
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
76 margin: 5,
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
77 items: [{
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
78 xtype: 'ortgrid',
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
79 recordId: this.record.get('id')
135cd5814b15 Diplays Orte atop of Messungen
Dustin Demuth <dustin@intevation.de>
parents: 823
diff changeset
80 }]
601
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
81 }, {
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
82 xtype: 'fset',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
83 name: 'messungen',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
84 title: 'Messungen',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
85 padding: '5, 5',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
86 margin: 5,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
87 collapsible: false,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
88 collapsed: false,
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
89 items: [{
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
90 xtype: 'messunggrid',
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
91 recordId: this.record.get('id')
f9c2e82ebc20 Moved messungen field in probe edit window up.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 592
diff changeset
92 }]
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 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
95 name: 'probenzusatzwerte',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 title: 'Zusatzwerte',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 collapsed: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 xtype: 'probenzusatzwertgrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 recordId: this.record.get('id')
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 xtype: 'fset',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 name: 'pkommentare',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 title: 'Kommentare',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 padding: '5, 5',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 margin: 5,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 collapsible: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 collapsed: true,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 items: [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 xtype: 'pkommentargrid',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 recordId: this.record.get('id')
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 }]
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 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
122 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
123 * Initialise the Data of this Window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
124 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 initData: function() {
713
2e478b3a587a Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 712
diff changeset
126 this.setLoading(true);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 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
128 me = this;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 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
130 failure: function(record, action) {
713
2e478b3a587a Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 712
diff changeset
131 me.setLoading(false);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 // TODO
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
133 console.log('An unhandled Failure occured. See following Response and Record');
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
134 console.log(action);
696
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
135 console.log(record);
b0f1dcdf981d Made the unhandled Errors more talkativew
Dustin Demuth <dustin@intevation.de>
parents: 693
diff changeset
136 },
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 success: function(record, response) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 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
139 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
140 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
141
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
142 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
143 //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
144 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
145 }
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
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 var json = Ext.decode(response.response.responseText);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 if (json) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 this.setMessages(json.errors, json.warnings);
771
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 713
diff changeset
150 if (!json.warnings.mediaDesk) {
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 713
diff changeset
151 this.down('probeform').setMediaDesk(record);
dd6925ef6028 Load, set and parse deskriptoren in probe form.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 713
diff changeset
152 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 }
710
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
154 // If the Probe is ReadOnly, disable Inputfields and grids
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
155 if (this.record.get('readonly') === true) {
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
156 this.down('probeform').setReadOnly(true);
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
157 this.disableChildren();
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
158 }
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
159 else {
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
160 this.down('probeform').setReadOnly(false);
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
161 this.enableChildren();
f204f30b824a Handle readonly mode and refresh operations.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
162 }
713
2e478b3a587a Set some loading masks.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 712
diff changeset
163 me.setLoading(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 scope: this
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 });
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
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
169 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
170 * Enable the Messungengrid
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
171 */
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
172 enableAddMessungen: 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
173 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
174 },
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
175
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
176 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
177 * Disable the Childelements of this window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
178 */
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
179 disableChildren: function() {
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
180 if (!this.record.get('owner')) {
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
181 // 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
182 // Works in symbiosis with success callback some lines above.
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
183 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(true);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
184 this.down('fset[name=messungen]').down('messunggrid').readOnly = true;
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 706
diff changeset
185 }
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
186 this.down('fset[name=orte]').down('ortgrid').setReadOnly(true);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
187 this.down('fset[name=orte]').down('ortgrid').readOnly = true;
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
188 this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(true);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
189 this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').readOnly = true;
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
190 this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(true);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
191 this.down('fset[name=pkommentare]').down('pkommentargrid').readOnly = 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
192 },
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
193
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
194 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
195 * Enable the Childelements of this window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
196 */
712
baef70abfe71 Cosmetics.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 710
diff changeset
197 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
198 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
199 this.down('fset[name=messungen]').down('messunggrid').readOnly = false;
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
200 this.down('fset[name=orte]').down('ortgrid').setReadOnly(false);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
201 this.down('fset[name=orte]').down('ortgrid').readOnly = false;
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
202 this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(false);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
203 this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').readOnly = false;
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
204 this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(false);
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 771
diff changeset
205 this.down('fset[name=pkommentare]').down('pkommentargrid').readOnly = false;
548
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
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
208 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
209 * Instructs the fields / forms listed in this method to set a message.
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
210 * @param errors These Errors shall be shown
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
211 * @param warnings These Warning shall be shown
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
212 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 setMessages: function(errors, warnings) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 this.down('probeform').setMessages(errors, warnings);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 var errorOrtText = '';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 var errorOrt = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 var warningOrtText = '';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 var warningOrt = false;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 var key;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 var content;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 var i;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
222 var keyText;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 var i18n = Lada.getApplication().bundle;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
224 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
225 if (key && key.indexOf('Ort') > -1) {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 errorOrt = true;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
227 content = errors[key];
557
48ee1adee0a2 Added i18n string for 'orte' errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
228 keyText = i18n.getMsg(key);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
229 for (i = 0; i < content.length; i++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
230 errorOrtText += keyText + ': ' +
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
231 i18n.getMsg(content[i].toString()) + '\n';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
232 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
235 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
236 if (key && key.indexOf('Ort') > -1) {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
237 warningOrt = true;
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238 content = warnings[key];
557
48ee1adee0a2 Added i18n string for 'orte' errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
239 keyText = i18n.getMsg(key);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 for (i = 0; i < content.length; i++) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
241 warningOrtText += keyText + ': ' +
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
242 i18n.getMsg(content[i].toString()) + '\n';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
243 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
244 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
245 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
246 this.down('fset[name=orte]').showWarningOrError(
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
247 warningOrt,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
248 warningOrtText === '' ? null : warningOrtText,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 errorOrt,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
250 errorOrtText === '' ? null : errorOrtText);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
253 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
254 * Instructs the fields / forms listed in this method to clear their messages.
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 839
diff changeset
255 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
256 clearMessages: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
257 this.down('probeform').clearMessages();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
258 this.down('fset[name=orte]').clearMessages();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
259 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
260 });

http://lada.wald.intevation.org