changeset 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 4b9b1d3ad9f1
children 3139b920dd0e
files app.js app/view/window/About.js resources/i18n/Lada_de-DE.properties
diffstat 3 files changed, 39 insertions(+), 24 deletions(-) [+]
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: [
--- a/app/view/window/About.js	Thu May 21 17:59:48 2015 +0200
+++ b/app/view/window/About.js	Fri May 22 12:34:14 2015 +0200
@@ -93,33 +93,24 @@
                     width: '95%',
                     marginBottom: '5px'
                 },
-                text: this.requestServerVersion()
+                text: Lada.serverversion
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: i18n.getMsg('about.window.text.clientversion')
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: Lada.clientversion
             }]
         }];
 
         this.callParent(arguments);
-    },
-
-    requestServerVersion: 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);
-                // TODO
-                console.log(json);
-                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.body');
-            }
-        });
     }
 });
--- a/resources/i18n/Lada_de-DE.properties	Thu May 21 17:59:48 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Fri May 22 12:34:14 2015 +0200
@@ -95,6 +95,7 @@
 about.window.text.roles:Sie sind Mitglied der folgenden Gruppen:
 about.window.text.logintime:Die Anmeldung wurde durchgeführt um:
 about.window.text.serverversion:Der Server läuft mit Softwareversion:
+about.window.text.clientversion:Der Client läuft mit Softwareversion:
 
 # Actions
 add:Hinzufügen

http://lada.wald.intevation.org