Mercurial > lada > lada-client
annotate app/controller/grid/Messung.js @ 727:e002234d7da5
Corrected URL for lada-server in export and import
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 17 Apr 2015 10:51:40 +0200 |
parents | cc9107d9be17 |
children | 6e28ebbe1a73 |
rev | line source |
---|---|
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /* |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Controller for a Messungengrid |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.grid.Messung', { |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 requires: [ |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 'Lada.view.window.MessungEdit' |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 ], |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 init: function() { |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 this.control({ |
592
825973ca386f
Updated missing name changes for messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
591
diff
changeset
|
21 'messunggrid': { |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 itemdblclick: this.editItem |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 }, |
592
825973ca386f
Updated missing name changes for messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
591
diff
changeset
|
24 'messunggrid button[action=add]': { |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 click: this.add |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 }, |
592
825973ca386f
Updated missing name changes for messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
591
diff
changeset
|
27 'messunggrid button[action=delete]': { |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 click: this.remove |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 } |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 }); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 }, |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 editItem: 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
|
34 var probe = grid.up('window').record; |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 var win = Ext.create('Lada.view.window.MessungEdit', { |
690
e88381fb3bdb
Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
644
diff
changeset
|
36 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
|
37 probe: probe, |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
622
diff
changeset
|
38 record: record, |
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
622
diff
changeset
|
39 grid: grid |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 }); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 win.show(); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 win.initData(); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 }, |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 |
622
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
45 add: function(button) { |
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
46 var probe = button.up('window').record; |
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
47 var win = Ext.create('Lada.view.window.MessungCreate', { |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
622
diff
changeset
|
48 record: probe, |
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
622
diff
changeset
|
49 grid: button.up('messunggrid') |
622
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
50 }); |
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
51 win.show(); |
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
52 win.initData(); |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 }, |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 remove: function(button) { |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 var grid = button.up('grid'); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 Ext.MessageBox.confirm( |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 'Messung löschen', |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 'Sind Sie sicher?', |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 function(btn) { |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 if (btn === 'yes') { |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 selection.destroy({ |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 success: function() { |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 button.up('window').initData(); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 }, |
705
cc9107d9be17
ResponseObject was not defined
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
67 failure: function(request, response) { |
704
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
68 var json = response.request.scope.reader.jsonData; |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
69 if (json) { |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
70 if (json.message){ |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
71 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title') |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
72 +' #'+json.message, |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
73 Lada.getApplication().bundle.getMsg(json.message)); |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
74 } else { |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
75 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
76 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
77 } |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
78 } else { |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
79 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'), |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
80 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
690
diff
changeset
|
81 } |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 } |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 }); |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 } |
622
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
85 } |
ee92e352be20
Open messung create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
592
diff
changeset
|
86 ); |
588
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 } |
e24bc8cf8e1d
Renamed messungen grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 }); |