comparison app/controller/Messungen.js @ 497:7c0653e8d9f7

Fixed some js related issues (unused vars, arrays, etc.) and code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 06 Nov 2014 10:38:17 +0100
parents d07e5086a64b
children 8b4ec61c5752
comparison
equal deleted inserted replaced
496:d07e5086a64b 497:7c0653e8d9f7
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz 1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH 2 * Software engineering by Intevation GmbH
3 * 3 *
4 * This file is Free Software under the GNU GPL (v>=3) 4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out 5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */ 7 */
8 8
9 /** 9 /**
10 * Controller for Messungen 10 * Controller for Messungen
11 */ 11 */
66 66
67 addItem: function(button) { 67 addItem: function(button) {
68 console.log('Adding new Messung for Probe ' + button.probeId); 68 console.log('Adding new Messung for Probe ' + button.probeId);
69 var messung = Ext.create('Lada.model.Messung'); 69 var messung = Ext.create('Lada.model.Messung');
70 messung.set('probeId', button.probeId); 70 messung.set('probeId', button.probeId);
71 var view = Ext.widget('messungencreate', {model: messung}); 71 Ext.widget('messungencreate', {
72 model: messung
73 });
72 }, 74 },
73 75
74 editItem: function(grid, record) { 76 editItem: function(grid, record) {
75 console.log('Editing Messung'); 77 console.log('Editing Messung');
76 var kstore = this.getKommentareMStore(); 78 var kstore = this.getKommentareMStore();
93 probeId: record.get('probeId'), 95 probeId: record.get('probeId'),
94 messungsId: record.get('id') 96 messungsId: record.get('id')
95 } 97 }
96 }); 98 });
97 record.getAuthInfo(this.initEditWindow); 99 record.getAuthInfo(this.initEditWindow);
98 console.log("Loaded Messung with ID " + record.getId()); //outputs ID 100 console.log('Loaded Messung with ID ' + record.getId());
99 }, 101 },
100 102
101 initEditWindow: function(record, readonly, owner) { 103 initEditWindow: function(record, readonly, owner) {
102 var view = Ext.widget('messungenedit', { 104 var view = Ext.widget('messungenedit', {
103 model: record 105 model: record
104 }); 106 });
105 var ignore = Array(); 107 var ignore = [];
106 if (owner) { 108 if (owner) {
107 ignore.push('fertig'); 109 ignore.push('fertig');
108 } 110 }
109 if (readonly) { 111 if (readonly) {
110 var form = view.down('form'); 112 var form = view.down('form');
111 form.setReadOnly(true, ignore); 113 form.setReadOnly(true, ignore);
112 } 114 }
121 var store = grid.getStore(); 123 var store = grid.getStore();
122 var deleteUrl = selection.getProxy().url + selection.getId(); 124 var deleteUrl = selection.getProxy().url + selection.getId();
123 Ext.Ajax.request({ 125 Ext.Ajax.request({
124 url: deleteUrl, 126 url: deleteUrl,
125 method: 'DELETE', 127 method: 'DELETE',
126 success: function(response, opts) { 128 success: function() {
127 store.reload(); 129 store.reload();
128 } 130 }
129 }); 131 });
130 console.log('Deleting Messung'); 132 console.log('Deleting Messung');
131 } else { 133 }
134 else {
132 console.log('Cancel Deleting Messung'); 135 console.log('Cancel Deleting Messung');
133 } 136 }
134 }); 137 });
135 }, 138 },
136 139
137 createSuccess: function(form, record, operation) { 140 createSuccess: function(form) {
138 var store = this.getMessungenStore(); 141 var store = this.getMessungenStore();
139 store.reload(); 142 store.reload();
140 var win = form.up('window'); 143 var win = form.up('window');
141 win.close(); 144 win.close();
142 }, 145 },
143 146
144 createFailure: function(form, record, operation) { 147 createFailure: function(form) {
145 Ext.MessageBox.show({ 148 Ext.MessageBox.show({
146 title: 'Fehler beim Speichern', 149 title: 'Fehler beim Speichern',
147 msg: form.message, 150 msg: form.message,
148 icon: Ext.MessageBox.ERROR, 151 icon: Ext.MessageBox.ERROR,
149 buttons: Ext.Msg.OK 152 buttons: Ext.Msg.OK
150 }); 153 });
151 }, 154 },
152 155
153 editSuccess: function(form, record, operation) { 156 editSuccess: function(form) {
154 var store = this.getMessungenStore(); 157 var store = this.getMessungenStore();
155 store.reload(); 158 store.reload();
156 var win = form.up('window'); 159 var win = form.up('window');
157 win.close(); 160 win.close();
158 }, 161 },
159 162
160 editFailure: function(form, record, operation) { 163 editFailure: function(form) {
161 Ext.MessageBox.show({ 164 Ext.MessageBox.show({
162 title: 'Fehler beim Speichern', 165 title: 'Fehler beim Speichern',
163 msg: form.message, 166 msg: form.message,
164 icon: Ext.MessageBox.ERROR, 167 icon: Ext.MessageBox.ERROR,
165 buttons: Ext.Msg.OK 168 buttons: Ext.Msg.OK

http://lada.wald.intevation.org