comparison app.js @ 801:646779690e20

moved code to request the server version to app.js
author Dustin Demuth <dustin@intevation.de>
date Fri, 22 May 2015 12:34:14 +0200
parents ff4330d4aba1
children c6e9bcda69b8
comparison
equal deleted inserted replaced
800:4b9b1d3ad9f1 801:646779690e20
59 launch: function() { 59 launch: function() {
60 Lada.username = ''; 60 Lada.username = '';
61 Lada.userroles = ''; 61 Lada.userroles = '';
62 Lada.logintime = ''; 62 Lada.logintime = '';
63 Lada.mst = []; 63 Lada.mst = [];
64 Lada.clientversion = '2.0beta2';
64 65
65 var queryString = document.location.href.split('?')[1]; 66 var queryString = document.location.href.split('?')[1];
66 if (queryString) { 67 if (queryString) {
67 Lada.openIDParams = queryString; 68 Lada.openIDParams = queryString;
68 } 69 }
103 Ext.MessageBox.alert('Kommunikation mit dem Lada Server fehlgeschlagen', 104 Ext.MessageBox.alert('Kommunikation mit dem Lada Server fehlgeschlagen',
104 'Es konnte keine erfolgreiche Verbindung zum lada server aufgebaut werden.'); 105 'Es konnte keine erfolgreiche Verbindung zum lada server aufgebaut werden.');
105 }, 106 },
106 107
107 onLoginSuccess: function(response) { 108 onLoginSuccess: function(response) {
109 Lada.serverversion = this.getServerVersion();
108 110
109 if (!Ext.isIE9m) { 111 if (!Ext.isIE9m) {
110 /* Strip out the openid query params to look nicers. */ 112 /* Strip out the openid query params to look nicers. */
111 // Not supported in old IE's 113 // Not supported in old IE's
112 window.history.pushState(this.name, this.name, window.location.pathname); 114 window.history.pushState(this.name, this.name, window.location.pathname);
157 Ext.create('Lada.store.Umwelt', { 159 Ext.create('Lada.store.Umwelt', {
158 storeId: 'umwelt' 160 storeId: 'umwelt'
159 }); 161 });
160 Ext.create('Lada.store.Verwaltungseinheiten', { 162 Ext.create('Lada.store.Verwaltungseinheiten', {
161 storeId: 'verwaltungseinheiten' 163 storeId: 'verwaltungseinheiten'
164 });
165 },
166
167 getServerVersion: function() {
168 var i18n = Lada.getApplication().bundle;
169 Ext.Ajax.request({
170 url: '/lada-server/version',
171 method: 'GET',
172 headers: {
173 'X-OPENID-PARAMS': Lada.openIDParams
174 },
175 success: function(response) {
176 var json = Ext.decode(response.responseText);
177 return json.data;
178 },
179 failure: function(response) {
180 console.log('Error in retrieving the server version.'
181 + ' It might be lower than 2.0-beta2'
182 + ' Or something is broken...');
183 return i18n.getMsg('err.msg.generic.title');
184 }
162 }); 185 });
163 }, 186 },
164 187
165 // Define the controllers of the application. They will be initialized 188 // Define the controllers of the application. They will be initialized
166 // first before the application "launch" function is called. 189 // first before the application "launch" function is called.

http://lada.wald.intevation.org