Mercurial > lada > lada-client
annotate app/controller/grid/Ort.js @ 726:6bc05ba2f6b1
Fixed tree_modified check in orte edit.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 16 Apr 2015 15:56:03 +0200 |
parents | f0bc5387abcc |
children | 6e28ebbe1a73 |
rev | line source |
---|---|
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 Ext.define('Lada.controller.grid.Ort', { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 extend: 'Ext.app.Controller', |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
602
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
12 requires: [ |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
643
diff
changeset
|
13 'Lada.view.window.OrtEdit', |
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
643
diff
changeset
|
14 'Lada.view.window.OrtCreate' |
602
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
15 ], |
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
16 |
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 init: function() { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 this.control({ |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 'ortgrid': { |
602
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
20 itemdblclick: this.open |
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 }, |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 'ortgrid button[action=add]': { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 click: this.add |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 }, |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 'ortgrid button[action=delete]': { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 click: this.remove |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 } |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 }); |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 }, |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
602
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
31 open: function(grid, record) { |
690
e88381fb3bdb
Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
32 var probe = grid.up('window').record; |
602
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
33 var win = Ext.create('Lada.view.window.OrtEdit', { |
690
e88381fb3bdb
Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
34 parentWindow: grid.up('window'), |
e88381fb3bdb
Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
35 probe: probe, |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
643
diff
changeset
|
36 record: record, |
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
643
diff
changeset
|
37 grid: grid |
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 }); |
602
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
39 win.show(); |
e1ab24758392
Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
587
diff
changeset
|
40 win.initData(); |
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 }, |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 |
643
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
43 add: function(button) { |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
44 var probe = button.up('window').record; |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
45 var win = Ext.create('Lada.view.window.OrtCreate', { |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
46 record: probe, |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
47 grid: button.up('ortgrid') |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
48 }); |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
49 win.show(); |
477379250512
Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
602
diff
changeset
|
50 win.initData(); |
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 }, |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 remove: function(button) { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 var grid = button.up('grid'); |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 if (btn === 'yes') { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 selection.destroy({ |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 success: function() { |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 button.up('window').initData(); |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 }, |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
62 failure: function(request, response) { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
63 var json = response.request.scope.reader.jsonData; |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
64 if (json) { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
65 if (json.message){ |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
66 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
67 +' #'+json.message, |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
68 Lada.getApplication().bundle.getMsg(json.message)); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
69 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
70 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
71 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
72 } |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
73 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
74 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
75 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
76 } |
587
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 } |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 }); |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 } |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 }); |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 } |
cf328526b5bb
Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 }); |