diff 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
line wrap: on
line diff
--- a/app.js	Thu May 21 17:59:48 2015 +0200
+++ b/app.js	Fri May 22 12:34:14 2015 +0200
@@ -61,6 +61,7 @@
         Lada.userroles = '';
         Lada.logintime = '';
         Lada.mst = [];
+        Lada.clientversion = '2.0beta2';
 
         var queryString = document.location.href.split('?')[1];
         if (queryString) {
@@ -105,6 +106,7 @@
     },
 
     onLoginSuccess: function(response) {
+        Lada.serverversion = this.getServerVersion();
 
         if (!Ext.isIE9m) {
           /* Strip out the openid query params to look nicers. */
@@ -162,6 +164,27 @@
         });
     },
 
+    getServerVersion: function() {
+        var i18n = Lada.getApplication().bundle;
+        Ext.Ajax.request({
+            url: '/lada-server/version',
+            method: 'GET',
+            headers: {
+                'X-OPENID-PARAMS': Lada.openIDParams
+            },
+            success: function(response) {
+                var json = Ext.decode(response.responseText);
+                return json.data;
+            },
+            failure: function(response) {
+                console.log('Error in retrieving the server version.'
+                    + ' It might be lower than 2.0-beta2'
+                    + ' Or something is broken...');
+                return i18n.getMsg('err.msg.generic.title');
+            }
+        });
+    },
+
     // Define the controllers of the application. They will be initialized
     // first before the application "launch" function is called.
     controllers: [

http://lada.wald.intevation.org