annotate app/controller/Orte.js @ 136:4dc84682110d

Removed nested elements in Zusatzwerte. Change getting aditional info for Probenzusätze in the Zusatzwert listing.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 26 Jun 2013 10:18:08 +0200
parents 2308094f5a8c
children 26ac4c99f8c4
rev   line source
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
1 Ext.define('Lada.controller.Orte', {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
2 extend: 'Ext.app.Controller',
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
3 views: [
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
4 'orte.List',
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
5 'orte.Create'
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
6 ],
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
7 stores: [
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
8 ],
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
9 models: [
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
10 'Ort'
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
11 ],
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
12 init: function() {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 console.log('Initialising the Orte controller');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 this.control({
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 // CSS like selector to select element in the viewport. See
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 // ComponentQuery documentation for more details.
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 'ortelist': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 itemdblclick: this.editOrt
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 'ortelist toolbar button[action=add]': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 click: this.addOrt
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
22 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
23 'ortelist toolbar button[action=delete]': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
24 click: this.deleteOrt
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
25 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
26 'ortecreate form': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
27 savesuccess: this.createSuccess,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
28 savefailure: this.createFailure
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
29 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 'orteedit form': {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
31 savesuccess: this.editSuccess,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 savefailure: this.editFailure
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
34 });
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
35 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
36 addOrt: function(button) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 console.log('Adding new Ort');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 var view = Ext.widget('ortecreate');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
39 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
40 editOrt: function(grid, record) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
41 console.log('Editing Ort');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
42 var view = Ext.widget('ortecreate', {model: record});
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 console.log("Loaded Ort with ID " + record.getId()); //outputs ID
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
45 deleteOrt: function(button) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
46 // Get selected item in grid
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
47 var grid = button.up('grid');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
48 var selection = grid.getView().getSelectionModel().getSelection()[0];
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
49 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 if(btn === 'yes'){
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
51 var store = grid.getStore();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
52 store.remove(selection);
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
53 store.sync();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
54 console.log('Deleting Kommentar');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
55 } else {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
56 console.log('Cancel Deleting Kommentar');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
57 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
58 });
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
59 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
60 createSuccess: function(form, record, operation) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
61 // Reload store
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
62 var store = this.getOrteStore();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
63 store.reload();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
64 var win = form.up('window');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
65 win.close();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
66 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
67 createFailure: function(form, record, operation) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
68 Ext.MessageBox.show({
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
69 title: 'Fehler beim Speichern',
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
70 msg: form.message,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
71 icon: Ext.MessageBox.ERROR,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
72 buttons: Ext.Msg.OK
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
73 });
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
74 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
75 editSuccess: function(form, record, operation) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
76 // Reload store
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
77 var store = this.getOrteStore();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
78 store.reload();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
79 var win = form.up('window');
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
80 win.close();
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
81 },
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
82 editFailure: function(form, record, operation) {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
83 Ext.MessageBox.show({
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
84 title: 'Fehler beim Speichern',
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
85 msg: form.message,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
86 icon: Ext.MessageBox.ERROR,
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
87 buttons: Ext.Msg.OK
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
88 });
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
89 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
90 });

http://lada.wald.intevation.org