Mercurial > lada > lada-client
annotate app/view/window/DeleteProbe.js @ 895:2b7bcb778f0a
Jsduck debug
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 23 Jul 2015 17:14:05 +0200 |
parents | 8054232535ba |
children | f220ba587c89 |
rev | line source |
---|---|
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 * |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 */ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
8 |
891 | 9 /** |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
10 * Window to show a confirmation dialog to delete a Probe |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
11 */ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.window.DeleteProbe', { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.window.Window', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.deleteProbe', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
15 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
16 collapsible: true, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
17 maximizable: true, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
18 autoShow: true, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
19 autoScroll: true, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 layout: 'fit', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 constrain: true, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 record: null, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 parentWindow: null, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
26 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
27 * This function initialises the Window |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
28 */ |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
29 initComponent: function() { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
30 var i18n = Lada.getApplication().bundle; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
31 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
32 // add listeners to change the window appearence when it becomes inactive |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
33 this.on({ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 activate: function(){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 this.getEl().removeCls('window-inactive'); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
36 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
37 deactivate: function(){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
38 this.getEl().addCls('window-inactive'); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
39 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
40 }); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 this.title = i18n.getMsg('delete.probe.window.title'); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
43 var me = this; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 this.buttons = [{ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 text: i18n.getMsg('cancel'), |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 scope: this, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 handler: this.close |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 }, { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 text: i18n.getMsg('delete'), |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
50 handler: function() { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
51 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
52 Ext.Ajax.request({ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
53 //TODO Use correct URLs |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 url: 'lada-server/probe/'+me.record.get('id'), |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
55 method: 'DELETE', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
56 headers: { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
57 'X-OPENID-PARAMS': Lada.openIDParams |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 success: function(response) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 var json = Ext.JSON.decode(response.responseText); |
858
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
61 if (json.success && json.message === '200') { |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
62 Ext.Msg.show({ |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
63 title: i18n.getMsg('success'), |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
64 autoScroll: true, |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
65 msg: 'Probe gelöscht!', |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
66 buttons: Ext.Msg.OK |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
67 }); |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
68 } |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
69 else { |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
70 Ext.Msg.show({ |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
71 title: 'Fehler!', |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
72 msg: 'Ein Fehler ist aufgetreten, ist die Probe nicht leer?', |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
73 buttons: Ext.Msg.OK |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
74 }); |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
75 } |
2c686025934a
Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
856
diff
changeset
|
76 me.close(); |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
78 failure: function(response) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 var json = null; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 try { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 json = Ext.JSON.decode(response.responseText); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
82 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
83 catch(err){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
84 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
86 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
87 if (json) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
88 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
89 formPanel.setMessages(json.errors, json.warnings); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
90 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
91 // TODO Move this handling of 699 and 698 to a more central place! |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
92 // TODO i18n |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 if (json.message === "699" || json.message === "698") { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 /* This is the unauthorized message with the authentication |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 * redirect in the data */ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 /* We decided to handle this with a redirect to the identity |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 * provider. In which case we have no other option then to |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 * handle it here with relaunch. */ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 Ext.MessageBox.confirm('Erneutes Login erforderlich', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 'FĂĽr ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
103 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 'Soll die Anwendung jetzt neu geladen werden?', me.reload); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 else if(json.message){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 +' #'+json.message, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 Lada.getApplication().bundle.getMsg(json.message)); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
110 } else { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
111 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
112 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
114 } else { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
115 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
119 }); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
120 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 }]; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
122 this.width = 350; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
123 this.height = 250; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
125 // add listeners to change the window appearence when it becomes inactive |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
126 this.on({ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
127 activate: function(){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
128 this.getEl().removeCls('window-inactive'); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
129 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 deactivate: function(){ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
131 this.getEl().addCls('window-inactive'); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
132 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
133 close: function () { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
134 this.parentWindow.probenWindow = null; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
135 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
136 }); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
137 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
138 // InitialConfig is the config object passed to the constructor on |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
139 // creation of this window. We need to pass it throuh to the form as |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 // we need the "Id" param to load the correct item. |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
141 this.items = [{ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 border: 0, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
143 autoScroll: true, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
144 items: [{ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
145 xtype: 'panel', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
146 border: 0, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
147 margin: 5, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
148 layout: 'fit', |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
149 html: '<p>' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
150 + i18n.getMsg('delete.probe') |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 + '<br/>' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 + '<br/>' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
153 + this.record.get('probeId') |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
154 + '<br/>' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
155 + '<br/>' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
156 + i18n.getMsg('delete.probe.warning') |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
157 + '</p>' |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
158 }] |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
159 }]; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
160 this.callParent(arguments); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
161 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
162 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
163 /** |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
164 * Inititalise Data |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
165 */ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
166 initData: function() { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
167 var i18n = Lada.getApplication().bundle; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
168 me = this; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
169 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
170 |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
171 /** |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
172 * Parse ServerResponse when Proben have been generated |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
173 */ |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
174 evalResponse: function(response) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
175 var i18n = Lada.getApplication().bundle; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
176 var r = ''; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
177 r += response.data.length; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
178 r += ' ' + i18n.getMsg('probedeleted'); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
179 return r; |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
180 }, |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
181 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
182 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
183 * Reload the Application |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
858
diff
changeset
|
184 */ |
856
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
185 reload: function(btn) { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
186 if (btn === 'yes') { |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
187 location.reload(); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
188 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
189 } |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
190 }); |
e44070aa45d2
Implemented a 'Delete Button' in the ResultGrid. Proben can be deleted when they are not ReadOnly and the Users is the Owner of the Probe
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
191 |