annotate app/view/window/MessprogrammEdit.js @ 757:b8502964f5c3

Added missing files. Added MmtMockup
author Dustin Demuth <dustin@intevation.de>
date Wed, 06 May 2015 14:15:37 +0200
parents
children b2fcbdc4969d
rev   line source
757
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /*
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * Window to edit a Messprogramm
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.MessprogrammEdit', {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.messprogrammedit',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
16 requires: [
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
17 'Lada.view.form.Messprogramm',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
18 'Lada.view.grid.Messmethoden',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
19 ],
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 collapsible: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22 maximizable: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 autoShow: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 autoScroll: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 layout: 'fit',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 constrain: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
28 record: null,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
30 initComponent: function() {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31 var i18n = Lada.getApplication().bundle;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 if (this.record === null) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 Ext.Msg.create(i18n.getMsg('err.msg.generic.title'),
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 i18n.getMsg('err.msg.novalidmessprogram'));
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 this.callParent(arguments);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 return;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
38 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 this.title = i18n.getMsg('messprogramm.window.edit.title');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 this.buttons = [{
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 text: i18n.getMsg('close'),
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 scope: this,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 handler: this.close
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 }];
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 this.width = 700;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 // add listeners to change the window appearence when it becomes inactive
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 this.on({
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 activate: function(){
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 this.getEl().removeCls('window-inactive');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52 deactivate: function(){
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 this.getEl().addCls('window-inactive');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 });
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 this.height = Ext.getBody().getViewSize().height - 30;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 // InitialConfig is the config object passed to the constructor on
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
59 // creation of this window. We need to pass it throuh to the form as
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
60 // we need the "Id" param to load the correct item.
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 this.items = [{
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 border: 0,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 autoScroll: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 items: [{
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 xtype: 'messprogrammform',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 recordId: this.record.get('id')
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 }, {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 //Messmethoden
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 xtype: 'fieldset',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 title: i18n.getMsg('mmtmessprogramm.form.fieldset.title'),
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 autoScroll: true,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 margin: 5,
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 layout: {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 type: 'hbox',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 items: [{
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 xtype: 'messmethodengrid',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 flex: 1
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 }, {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80 xtype: 'messmethodengrid',
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
81 flex: 1
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
82 }]
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
83 }]
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
84 }];
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
85 this.callParent(arguments);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
86 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
87
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
88 initData: function() {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
89 this.setLoading(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
90 this.clearMessages();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
91 me = this;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
92 Ext.ClassManager.get('Lada.model.Messprogramm').load(this.record.get('id'), {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
93 failure: function(record, action) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
94 me.setLoading(false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
95 // TODO
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
96 console.log('An unhandled Failure occured. See following Response and Record');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
97 console.log(action);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
98 console.log(record);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
99 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
100 success: function(record, response) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
101 this.down('messprogrammform').setRecord(record);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
102 this.record = record;
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
103 owner = this.record.get('owner');
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
104
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
105 // If this would be A probe, it would be always
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
106 // allowed to add Messungen:
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
107 /*
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
108 if (owner) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
109 me.enableAddMessungen();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
110 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
111 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
112
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
113 var json = Ext.decode(response.response.responseText);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
114 if (json) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
115 this.setMessages(json.errors, json.warnings);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
116 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
117 // If the Messprogramm is ReadOnly, disable Inputfields and grids
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
118 if (this.record.get('readonly') === true) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
119 this.down('messprogrammform').setReadOnly(true);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
120 this.disableChildren();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
121 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122 else {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123 this.down('messprogrammform').setReadOnly(false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124 this.enableChildren();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126 me.setLoading(false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
127 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 scope: this
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 });
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
130 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
131
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 //This was used in a Probewindow, I left it here for reference...
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 /*
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134 enableAddMessungen: function() {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
135 this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
136 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
137 */
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
138
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
139 disableChildren: function() {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
140 // thera are no children....
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
141 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
142
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
143 enableChildren: function() {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
144 // there are no children....
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
145 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
146
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
147 setMessages: function(errors, warnings) {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
148 this.down('messprogrammform').setMessages(errors, warnings);
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
149 },
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
150
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
151 clearMessages: function() {
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
152 this.down('messprogrammform').clearMessages();
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
153 }
b8502964f5c3 Added missing files. Added MmtMockup
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
154 });

http://lada.wald.intevation.org