annotate app/view/window/DeleteProbe.js @ 882:f1e964b3aad6

Trailing Commas
author Dustin Demuth <dustin@intevation.de>
date Thu, 23 Jul 2015 09:39:53 +0200
parents 2c686025934a
children def27cdd0dfa
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
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
9 /*
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
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
26 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
27 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
28
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 // 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
30 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
31 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
32 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
33 },
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 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
35 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
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 });
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
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 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
40 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
41 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
42 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
43 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
44 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
45 }, {
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 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
47 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
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 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
50 //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
51 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
52 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
53 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
54 '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
55 },
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 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
57 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
58 if (json.success && json.message === '200') {
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
59 Ext.Msg.show({
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
60 title: i18n.getMsg('success'),
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
61 autoScroll: true,
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
62 msg: 'Probe gelöscht!',
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
63 buttons: Ext.Msg.OK
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
64 });
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
65 }
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
66 else {
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
67 Ext.Msg.show({
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
68 title: 'Fehler!',
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
69 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
70 buttons: Ext.Msg.OK
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
71 });
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
72 }
2c686025934a Show message on probe delete success/error.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 856
diff changeset
73 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
74 },
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
75 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
76 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
77 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
78 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
79 }
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 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
81 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
82 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
83 }
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 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
85 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
86 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
87 }
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 // 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
89 // 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
90 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
91 /* 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
92 * 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
93
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 /* 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
95 * 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
96 * 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
97 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
98 '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
99 '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
100 '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
101 '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
102 }
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 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
104 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
105 +' #'+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
106 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
107 } 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
108 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
109 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
110 }
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 } 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
112 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
113 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
114 }
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 }
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 });
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 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
120 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
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 // 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
123 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
124 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
125 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
126 },
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 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
128 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
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 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
131 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
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 });
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
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 // 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
136 // 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
137 // 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
138 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
139 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
140 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
141 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 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
143 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
144 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
145 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
146 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
147 + 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
148 + '<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
149 + '<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
150 + 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
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 + 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
154 + '</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
155 }]
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 }];
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 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
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 /**
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 * Init
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 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
164 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
165 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
166 },
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
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 /**
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 * 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
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 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
172 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
173 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
174 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
175 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
176 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
177 },
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
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 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
180 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
181 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
182 }
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
183 }
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
184 });
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

http://lada.wald.intevation.org