comparison app/controller/Orte.js @ 499:8b4ec61c5752

Removed most log messages to make the application less verbose.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 06 Nov 2014 11:12:21 +0100
parents 7c0653e8d9f7
children 1643d74a40bb
comparison
equal deleted inserted replaced
498:c1b77fb96b01 499:8b4ec61c5752
25 models: [ 25 models: [
26 'Ort' 26 'Ort'
27 ], 27 ],
28 28
29 init: function() { 29 init: function() {
30 console.log('Initialising the Orte controller');
31 this.callParent(arguments); 30 this.callParent(arguments);
32 }, 31 },
33 32
34 addListeners: function() { 33 addListeners: function() {
35 this.control({ 34 this.control({
61 } 60 }
62 }); 61 });
63 }, 62 },
64 63
65 createOrt: function() { 64 createOrt: function() {
66 console.log('button clicked');
67 var win = Ext.create('Lada.view.orte.CreateOrt', {}); 65 var win = Ext.create('Lada.view.orte.CreateOrt', {});
68 win.show(); 66 win.show();
69 }, 67 },
70 68
71 saveNewOrt: function(button) { 69 saveNewOrt: function(button) {
72 console.log('button clicked');
73
74 var form = button.up('window').down('form').getForm(); 70 var form = button.up('window').down('form').getForm();
75 var ortdetailstore = Ext.getStore('Ortedetails'); 71 var ortdetailstore = Ext.getStore('Ortedetails');
76 var ortdetail = Ext.create('Lada.model.Ortdetail'); 72 var ortdetail = Ext.create('Lada.model.Ortdetail');
77 var fields = ['beschreibung', 'hoeheLand', 73 var fields = ['beschreibung', 'hoeheLand',
78 'latitude', 'longitude', 'staatId', 'gemId']; 74 'latitude', 'longitude', 'staatId', 'gemId'];
83 ortdetail.set(fields[i], ffield.getValue()); 79 ortdetail.set(fields[i], ffield.getValue());
84 } 80 }
85 ortdetailstore.add(ortdetail); 81 ortdetailstore.add(ortdetail);
86 ortdetailstore.sync({ 82 ortdetailstore.sync({
87 success: function(batch) { 83 success: function(batch) {
88 console.log(batch);
89 var od = Ext.ComponentQuery.query('ortdetail'); 84 var od = Ext.ComponentQuery.query('ortdetail');
90 console.log(od);
91 var response = batch.operations[0].resultSet.records[0].data; 85 var response = batch.operations[0].resultSet.records[0].data;
92 od[0].setValue(response.ortId); 86 od[0].setValue(response.ortId);
93 console.log('id:' + response.ortId);
94 button.up('window').close(); 87 button.up('window').close();
95 }, 88 },
96 failure: function() { 89 failure: function() {
97 console.log('Error on saving Ortdetails');
98 ortdetailstore.remove(ortdetail); 90 ortdetailstore.remove(ortdetail);
99 } 91 }
100 }); 92 });
101 }, 93 },
102 94
103 saveItem: function(button) { 95 saveItem: function(button) {
104 console.log('Saving Ort');
105 var form = button.up('window').down('form'); 96 var form = button.up('window').down('form');
106 var fform = form.getForm(); 97 var fform = form.getForm();
107 98
108 var ortdetail = null; 99 var ortdetail = null;
109 var ortdetailstore = Ext.getStore('Ortedetails'); 100 var ortdetailstore = Ext.getStore('Ortedetails');
110 var newortdetail = false; 101 var newortdetail = false;
111 102
112 var ortidfield = fform.findField('ortId'); 103 var ortidfield = fform.findField('ortId');
113 var ortid = ortidfield.getValue(); 104 var ortid = ortidfield.getValue();
114 if (ortid === null) { 105 if (ortid === null) {
115 console.log('New Ortdetail');
116 ortdetail = Ext.create('Lada.model.Ortdetail'); 106 ortdetail = Ext.create('Lada.model.Ortdetail');
117 ortdetailstore.add(ortdetail); 107 ortdetailstore.add(ortdetail);
118 newortdetail = true; 108 newortdetail = true;
119 } 109 }
120 else { 110 else {
121 console.log('Editing Ortdetail');
122 ortdetail = ortdetailstore.getById(ortid); 111 ortdetail = ortdetailstore.getById(ortid);
123 } 112 }
124 113
125 var fields = ['beschreibung', 'bezeichnung', 'hoeheLand', 114 var fields = ['beschreibung', 'bezeichnung', 'hoeheLand',
126 'latitude', 'longitude', 'staatId', 'gemId']; 115 'latitude', 'longitude', 'staatId', 'gemId'];
141 form.model.set('ortId', response.ortId); 130 form.model.set('ortId', response.ortId);
142 } 131 }
143 ortidfield.setValue(ortid); 132 ortidfield.setValue(ortid);
144 }, 133 },
145 failure: function() { 134 failure: function() {
146 console.log('Error on saving Ortdetails');
147 } 135 }
148 }); 136 });
149 form.commit(); 137 form.commit();
150 }, 138 },
151 139
152 addItem: function(button) { 140 addItem: function(button) {
153 console.log('Adding new Ort for Probe ' + button.probeId);
154 var ort = Ext.create('Lada.model.Ort'); 141 var ort = Ext.create('Lada.model.Ort');
155 ort.set('probeId', button.probeId); 142 ort.set('probeId', button.probeId);
156 Ext.widget('ortecreate', { 143 Ext.widget('ortecreate', {
157 model: ort 144 model: ort
158 }); 145 });
159 }, 146 },
160 147
161 editItem: function(grid, record) { 148 editItem: function(grid, record) {
162 console.log('Editing Ort');
163 record.getAuthInfo(this.initEditWindow); 149 record.getAuthInfo(this.initEditWindow);
164 console.log('Loaded Ort with ID ' + record.getId());
165 }, 150 },
166 151
167 initEditWindow: function(record, readonly) { 152 initEditWindow: function(record, readonly) {
168 var view = Ext.widget('ortecreate', { 153 var view = Ext.widget('ortecreate', {
169 model: record, 154 model: record,

http://lada.wald.intevation.org