annotate app/controller/Messungen.js @ 158:8e7f890dd6f4

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

http://lada.wald.intevation.org