[Lada-commits] [PATCH 1 of 9] moved code to request the server version to app.js

Wald Commits scm-commit at wald.intevation.org
Fri May 22 16:14:35 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1432290854 -7200
# Node ID 646779690e205f45ad6fe2cc70c2932194d65a33
# Parent  4b9b1d3ad9f1cb07cca28d53c02450dd83e10bd6
moved code to request the server version to app.js

diff -r 4b9b1d3ad9f1 -r 646779690e20 app.js
--- 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: [
diff -r 4b9b1d3ad9f1 -r 646779690e20 app/view/window/About.js
--- 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');
-            }
-        });
     }
 });
diff -r 4b9b1d3ad9f1 -r 646779690e20 resources/i18n/Lada_de-DE.properties
--- 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


More information about the Lada-commits mailing list