annotate app/controller/Proben.js @ 141:1fb79e16149f

Displaye Messeinheit in the Zusatzwerte Overview.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 28 Jun 2013 09:51:41 +0200
parents df6e36dd57ee
children 7b1140bd8b3d
rev   line source
1
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.controller.Proben', {
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 extend: 'Ext.app.Controller',
4
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 1
diff changeset
3 views: [
65
9e2e09e819fd Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 64
diff changeset
4 'proben.Edit',
9e2e09e819fd Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 64
diff changeset
5 'proben.Create'
4
b8e56e880f02 Added a first example view (userlisting) from the EXJS Tutorial. Need to be
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 1
diff changeset
6 ],
13
a8efc4b96888 Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 5
diff changeset
7 stores: [
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
8 'Proben',
135
e80a9114524c Load Probenzusatzwerte on editing a Probe. Values are needed in the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 122
diff changeset
9 'Zusatzwerte',
e80a9114524c Load Probenzusatzwerte on editing a Probe. Values are needed in the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 122
diff changeset
10 'Probenzusatzwerte'
121
c05fda928b82 Cleanup part two. Reenabled Proben edit but one use minimum version of the probenedit. Move some stores to the combobox definitons
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 112
diff changeset
11 // 'Orte',
c05fda928b82 Cleanup part two. Reenabled Proben edit but one use minimum version of the probenedit. Move some stores to the combobox definitons
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 112
diff changeset
12 // 'Messungen',
13
a8efc4b96888 Added model for Proben and a Store.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 5
diff changeset
13 ],
1
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 init: function() {
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 console.log('Initialising the Proben controller');
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 this.control({
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 // CSS like selector to select element in the viewport. See
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 // ComponentQuery documentation for more details.
18
9e1a40312bbe Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 13
diff changeset
19 'probenlist': {
5
039584709fa7 Map double click event on rows of the userlist to the editProben function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 4
diff changeset
20 itemdblclick: this.editProbe
18
9e1a40312bbe Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 13
diff changeset
21 },
64
a4a24e737deb Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
22 'probenlist toolbar button[action=add]': {
a4a24e737deb Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
23 click: this.addProbe
a4a24e737deb Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
24 },
70
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
25 'probencreate form': {
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
26 savesuccess: this.createSuccess,
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
27 savefailure: this.createFailure
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
28 },
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
29 'probenedit form': {
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
30 savesuccess: this.editSuccess,
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
31 savefailure: this.editFailure
1
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 }
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 });
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 },
64
a4a24e737deb Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
35 addProbe: function(button) {
71
db26aeebe521 Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 70
diff changeset
36 console.log('Adding new Probe');
65
9e2e09e819fd Added a new Dialog to create proben without any kommentare or other additional
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 64
diff changeset
37 var view = Ext.widget('probencreate');
64
a4a24e737deb Added listener to open a new window to enter data fpr the new probe.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 54
diff changeset
38 },
5
039584709fa7 Map double click event on rows of the userlist to the editProben function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 4
diff changeset
39 editProbe: function(grid, record) {
71
db26aeebe521 Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 70
diff changeset
40 console.log('Editing Probe');
db26aeebe521 Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 70
diff changeset
41 var id = record.get('probeId');
db26aeebe521 Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 70
diff changeset
42 var view = Ext.widget('probenedit', {modelId: id});
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
43
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
44 // Load Zusatzwerte
135
e80a9114524c Load Probenzusatzwerte on editing a Probe. Values are needed in the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 122
diff changeset
45 var pstore = this.getProbenzusatzwerteStore();
e80a9114524c Load Probenzusatzwerte on editing a Probe. Values are needed in the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 122
diff changeset
46 pstore.load();
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
47 var zstore = this.getZusatzwerteStore();
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
48 zstore.load({
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
49 params: {
139
df6e36dd57ee Changed params probe -> probeId, mst -> mstId, uwb -> umwId
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 135
diff changeset
50 probeId: id
122
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
51 }
a7bfaeb1655d Cleanup part three. Reenabled Zusatzwerte and implemented sending nested data.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 121
diff changeset
52 });
71
db26aeebe521 Added new Form for editing proben. Use this form in the edit window.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 70
diff changeset
53 console.log("Loaded Probe with ID " + record.getId()); //outputs ID
18
9e1a40312bbe Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 13
diff changeset
54 },
69
cb1138f5cea7 Removed old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 65
diff changeset
55 createSuccess: function(form, record, operation) {
86
eb40b74f871a Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 76
diff changeset
56 // Reload store
eb40b74f871a Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 76
diff changeset
57 var store = this.getProbenStore();
eb40b74f871a Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 76
diff changeset
58 store.reload();
69
cb1138f5cea7 Removed old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 65
diff changeset
59 var win = form.up('window');
18
9e1a40312bbe Implemented a basic edit dialog. Data will be set to data/proben2.json url
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 13
diff changeset
60 win.close();
70
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
61 },
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
62 createFailure: function(form, record, operation) {
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
63 Ext.MessageBox.show({
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
64 title: 'Fehler beim Speichern',
76
eb8a7d3cca89 Use translated message from server in error dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 71
diff changeset
65 msg: form.message,
70
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
66 icon: Ext.MessageBox.ERROR,
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
67 buttons: Ext.Msg.OK
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
68 });
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
69 },
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
70 editSuccess: function(form, record, operation) {
86
eb40b74f871a Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 76
diff changeset
71 // Reload store
eb40b74f871a Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 76
diff changeset
72 var store = this.getProbenStore();
eb40b74f871a Reload the store after the probe was created or edited.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 76
diff changeset
73 store.reload();
70
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
74 var win = form.up('window');
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
75 win.close();
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
76 },
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
77 editFailure: function(form, record, operation) {
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
78 Ext.MessageBox.show({
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
79 title: 'Fehler beim Speichern',
76
eb8a7d3cca89 Use translated message from server in error dialog
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 71
diff changeset
80 msg: form.message,
70
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
81 icon: Ext.MessageBox.ERROR,
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
82 buttons: Ext.Msg.OK
1a943947a7d2 Added new listeners for events comming from the Probenforms.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 69
diff changeset
83 });
1
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 }
af8d7217521d Added basic Proben controller.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
85 });

http://lada.wald.intevation.org