annotate app/controller/Orte.js @ 495:649bf1d08531

Use extjs dev with all classes and css from extjs resources for development.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 03 Nov 2014 12:12:24 +0100
parents 850ccfe5f3c4
children d07e5086a64b
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
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 454
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
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: [
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
22 'Orte',
490
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
23 'StaOrte',
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
24 'StaStaaten',
446e99cfd425 Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
25 'StaVerwaltungseinheiten'
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
27
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 models: [
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
29 'Ort'
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
31
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 init: function() {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 console.log('Initialising the Orte controller');
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
34 this.callParent(arguments);
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
35 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
36
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
37 addListeners: function() {
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 this.control({
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 'ortelist': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
40 itemdblclick: this.editItem
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 'ortelist toolbar button[action=add]': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
43 click: this.addItem
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 'ortelist toolbar button[action=delete]': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
46 click: this.deleteItem
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
47 },
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
48 'ortecreate button[action=save]': {
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
49 click: this.saveItem
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
50 },
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
51 'ortecreate form button[action=newort]': {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
52 click: this.createOrt
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
53 },
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
54 'createortdetail button[action=save]': {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
55 click: this.saveNewOrt
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
56 },
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
57 'ortecreate form': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
58 savesuccess: this.createSuccess,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 savefailure: this.createFailure
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 'orteedit form': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
62 savesuccess: this.editSuccess,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
63 savefailure: this.editFailure
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
65 });
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
66 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
67
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
68 createOrt: function(button) {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
69 console.log('button clicked');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
70 var win = Ext.create('Lada.view.orte.CreateOrt',{});
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
71 win.show();
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
72 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
73
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
74 saveNewOrt: function(button) {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
75 console.log('button clicked');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
76
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
77 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
78 var ortdetailstore = Ext.getStore('Ortedetails');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
79 var ortdetail = Ext.create('Lada.model.Ortdetail');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
80 var fields = ['beschreibung', 'hoeheLand',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
81 'latitude', 'longitude', 'staatId', 'gemId'];
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
82 for (var i = fields.length - 1; i >= 0; i--) {
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
83 var ffield = form.findField("ort_"+fields[i]);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
84 ortdetail.set(fields[i], ffield.getValue());
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
85 }
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
86 ortdetailstore.add(ortdetail);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
87 ortdetailstore.sync({
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
88 success: function(batch, options) {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
89 console.log(batch);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
90 var od = Ext.ComponentQuery.query('ortdetail');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
91 console.log(od);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
92 batch.operations[0].resultSet.records[0].data;
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
93 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
94 od[0].setValue(response.ortId);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
95 console.log('id:' + response.ortId);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
96 button.up('window').close();
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
97 },
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
98 failure: function() {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
99 console.log('Error on saving Ortdetails');
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
100 ortdetailstore.remove(ortdetail);
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
101 }
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
102 });
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 362
diff changeset
103 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
104
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
105 saveItem: function(button) {
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
106 console.log('Saving Ort');
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
107 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
108 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
109
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
110 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
111 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
112 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
113
216
6aedf2026fb4 Fixed issue23
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 215
diff changeset
114 var ortidfield = fform.findField('ortId');
6aedf2026fb4 Fixed issue23
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 215
diff changeset
115 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
116 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
117 console.log('New Ortdetail');
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
118 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
119 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
120 newortdetail = true;
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
121 } else {
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
122 console.log('Editing Ortdetail');
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
123 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
124 }
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
125
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
126 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
127 'latitude', 'longitude', 'staatId', 'gemId'];
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
128 for (var i = fields.length - 1; i >= 0; i--){
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
129 ffield = fform.findField("ort_"+fields[i]);
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
130 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
131 }
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
132 // 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
133 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
134 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
135 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
136 // 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
137 var response =
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
138 options.operations.create[0].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
139 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
140 }
216
6aedf2026fb4 Fixed issue23
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 215
diff changeset
141 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
142 },
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
143 failure: function() {
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
144 console.log('Error on saving Ortdetails');
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
145 }
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
146 });
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
147 form.commit();
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
148 },
154
16ba7e2465fd Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 149
diff changeset
149
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
150 addItem: function(button) {
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
151 console.log('Adding new Ort for Probe ' + button.probeId);
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
152 var ort = Ext.create('Lada.model.Ort');
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
153 ort.set('probeId', button.probeId);
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
154 var view = Ext.widget('ortecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
155 model: ort
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
156 });
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
157 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
158
292
73a2c114db64 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 217
diff changeset
159 editItem: function(grid, record) {
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
160 console.log('Editing Ort');
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
161 record.getAuthInfo(this.initEditWindow)
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
162 console.log("Loaded Ort with ID " + record.getId()); //outputs ID
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 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
164
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
165 initEditWindow: function(record, readonly, owner) {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
166 var view = Ext.widget('ortecreate', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
167 model: record,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
168 edit: true
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
169 });
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
170 var ignore = Array();
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
171 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
172 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
173 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
174 }
109
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
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
177 createSuccess: function(form, record, operation) {
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 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 490
diff changeset
184
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
185 editSuccess: function(form, record, operation) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
186 // Reload store
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
187 var store = this.getOrteStore();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
188 store.reload();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
189 var win = form.up('window');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
190 win.close();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
191 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
192 });

http://lada.wald.intevation.org