annotate app/controller/Orte.js @ 530:95bad130be98

Increased list grid height.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 17 Dec 2014 11:31:47 +0100
parents de1acaf21db3
children
rev   line source
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
2 * Software engineering by Intevation GmbH
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
3 *
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
7 */
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
8
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
9 /**
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
10 * Controller for Orte
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
11 */
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.controller.Orte', {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
13 extend: 'Lada.controller.Base',
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
14
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 views: [
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 'orte.List',
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
17 'orte.Create',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
18 'orte.CreateOrt'
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
20
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 stores: [
496
d07e5086a64b Moved stammdaten stores to app.js and load them via storemanager.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 491
diff changeset
22 'Orte'
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
24
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 models: [
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 'Ort'
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
28
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
29 init: function() {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
30 this.callParent(arguments);
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
31 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
32
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
33 addListeners: function() {
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 this.control({
522
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
35 'ortelist toolbar button[action=open]': {
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
36 click: this.editItem
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
37 },
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 'ortelist toolbar button[action=add]': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
39 click: this.addItem
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 'ortelist toolbar button[action=delete]': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
42 click: this.deleteItem
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 },
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
44 'ortecreate button[action=save]': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
45 click: this.saveItem
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
46 },
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
47 'ortecreate form button[action=newort]': {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
48 click: this.createOrt
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
49 },
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
50 'createortdetail button[action=save]': {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
51 click: this.saveNewOrt
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
52 },
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
53 'ortecreate form': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
54 savesuccess: this.createSuccess,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
55 savefailure: this.createFailure
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
56 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
57 'orteedit form': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
58 savesuccess: this.editSuccess,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 savefailure: this.editFailure
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
60 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
61 });
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
62 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
63
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
64 createOrt: function() {
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
65 var win = Ext.create('Lada.view.orte.CreateOrt', {});
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
66 win.show();
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
67 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
68
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
69 saveNewOrt: function(button) {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
70 var form = button.up('window').down('form').getForm();
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
71 var ortdetailstore = Ext.getStore('Ortedetails');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
72 var ortdetail = Ext.create('Lada.model.Ortdetail');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
73 var fields = ['beschreibung', 'hoeheLand',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
74 'latitude', 'longitude', 'staatId', 'gemId'];
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
75 var i = 0;
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
76 var ffield;
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
77 for (i = fields.length - 1; i >= 0; i++) {
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
78 ffield = form.findField('ort_' + fields[i]);
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
79 ortdetail.set(fields[i], ffield.getValue());
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
80 }
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
81 ortdetailstore.add(ortdetail);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
82 ortdetailstore.sync({
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
83 success: function(batch) {
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
84 var od = Ext.ComponentQuery.query('ortdetail');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
85 var response = batch.operations[0].resultSet.records[0].data;
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
86 od[0].setValue(response.ortId);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
87 button.up('window').close();
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
88 },
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
89 failure: function() {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
90 ortdetailstore.remove(ortdetail);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
91 }
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
92 });
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
93 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
94
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
95 saveItem: function(button) {
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
96 var form = button.up('window').down('form');
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
97 var fform = form.getForm();
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
98
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
99 var ortdetail = null;
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
100 var ortdetailstore = Ext.getStore('Ortedetails');
155
5414e611097e Set ortId in l_ort if new ortdetail was created.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 154
diff changeset
101 var newortdetail = false;
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
102
216
6aedf2026fb4 Fixed issue23
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 215
diff changeset
103 var ortidfield = fform.findField('ortId');
6aedf2026fb4 Fixed issue23
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 215
diff changeset
104 var ortid = ortidfield.getValue();
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
105 if (ortid === null) {
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
106 ortdetail = Ext.create('Lada.model.Ortdetail');
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
107 ortdetailstore.add(ortdetail);
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
108 newortdetail = true;
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
109 }
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
110 else {
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
111 ortdetail = ortdetailstore.getById(ortid);
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
112 }
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
113
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
114 var fields = ['beschreibung', 'bezeichnung', 'hoeheLand',
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
115 'latitude', 'longitude', 'staatId', 'gemId'];
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
116 var i = 0;
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
117 var ffield;
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
118 for (i = fields.length - 1; i >= 0; i--) {
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
119 ffield = fform.findField('ort_' + fields[i]);
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
120 ortdetail.set(fields[i], ffield.getValue());
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
121 }
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
122 // Create a new Ortedetail if nessecary
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
123 ortdetailstore.sync({
155
5414e611097e Set ortId in l_ort if new ortdetail was created.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 154
diff changeset
124 success: function(batch, options) {
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
125 if (newortdetail) {
155
5414e611097e Set ortId in l_ort if new ortdetail was created.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 154
diff changeset
126 // Get ID from new created ortdetail and set it to the ort
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
127 var response =
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
128 options.operations.create[0]
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
129 .store.proxy.reader.jsonData;
155
5414e611097e Set ortId in l_ort if new ortdetail was created.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 154
diff changeset
130 form.model.set('ortId', response.ortId);
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
131 }
216
6aedf2026fb4 Fixed issue23
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 215
diff changeset
132 ortidfield.setValue(ortid);
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
133 },
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
134 failure: function() {
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
135 }
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
136 });
454
edb9dee114f8 Issue67: Always commit the form und not only if there has been changes to the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 447
diff changeset
137 form.commit();
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
138 },
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
139
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
140 addItem: function(button) {
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
141 var ort = Ext.create('Lada.model.Ort');
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
142 ort.set('probeId', button.probeId);
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
143 Ext.widget('ortecreate', {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
144 model: ort
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
145 });
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
146 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
147
522
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
148 editItem: function(button) {
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
149 var grid = button.up('grid');
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
150 var selection = grid.getView().getSelectionModel().getSelection()[0];
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
151 var ortId = selection.getId();
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
152 var record = selection.store.getById(ortId);
de1acaf21db3 Add detail button for 'Orte' table
Roland Geider <roland.geider@intevation.de>
parents: 510
diff changeset
153
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
154 record.getAuthInfo(this.initEditWindow);
362
6a7a9267e00f Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 292
diff changeset
155 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
156
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
157 initEditWindow: function(record, readonly) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
158 var view = Ext.widget('ortecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
159 model: record,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
160 edit: true
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
161 });
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
162 var ignore = [];
362
6a7a9267e00f Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 292
diff changeset
163 if (readonly) {
6a7a9267e00f Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 292
diff changeset
164 var form = view.down('form');
6a7a9267e00f Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 292
diff changeset
165 form.setReadOnly(true, ignore);
6a7a9267e00f Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 292
diff changeset
166 }
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
167 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
168
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
169 createSuccess: function(form) {
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
170 // Reload store
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
171 var store = this.getOrteStore();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
172 store.reload();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
173 var win = form.up('window');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
174 win.close();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
175 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
176
497
7c0653e8d9f7 Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 496
diff changeset
177 editSuccess: function(form) {
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
178 // Reload store
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
179 var store = this.getOrteStore();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
180 store.reload();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
181 var win = form.up('window');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
182 win.close();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
183 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
184 });

http://lada.wald.intevation.org