[Lada-commits] [PATCH 2 of 2] Added about window, There are still some todos when retrieving the server version, the asynchronous request seems to fail and does not evaluate in time

Wald Commits scm-commit at wald.intevation.org
Thu May 21 18:01:26 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1432223988 -7200
# Node ID 4b9b1d3ad9f1cb07cca28d53c02450dd83e10bd6
# Parent  ad24af3fcf89edb088bd408d51a5eb94b624f0c9
Added about window, There are still some todos when retrieving the server version, the asynchronous request seems to fail and does not evaluate in time

diff -r ad24af3fcf89 -r 4b9b1d3ad9f1 app/controller/Filter.js
--- a/app/controller/Filter.js	Thu May 21 15:54:25 2015 +0200
+++ b/app/controller/Filter.js	Thu May 21 17:59:48 2015 +0200
@@ -241,9 +241,7 @@
      * It has no function yet.
      */
     about: function() {
-        var info = this.getInfoStore();
-        Ext.widget('about', {
-            info: info
-        });
+        var win = Ext.create('Lada.view.window.About');
+        win.show();
     }
 });
diff -r ad24af3fcf89 -r 4b9b1d3ad9f1 app/view/Viewport.js
--- a/app/view/Viewport.js	Thu May 21 15:54:25 2015 +0200
+++ b/app/view/Viewport.js	Thu May 21 17:59:48 2015 +0200
@@ -22,6 +22,7 @@
     ],
     layout: 'fit',
     initComponent: function() {
+        var i18n = Lada.getApplication().bundle;
         this.items = [{
             title: '<center>Labordatenerfassung</center>',
             layout: 'border',
@@ -43,32 +44,8 @@
                         text: 'Info',
                         menu: {
                             items: [{
-                                text: 'About',
+                                text: i18n.getMsg('about.button.title'),
                                 action: 'about'
-                            }, {
-                                text: 'Anmeldeinformationen',
-                                handler: function(){
-                                    logintime = new Date(Lada.logintime);
-                                    Ext.Msg.alert("Anmeldeinformationen",
-                                        "<p>"
-                                        + "Sie sind angemeldet mit der Kennung:"
-                                        + "<br />"
-                                        + Lada.username
-                                        + "</p>"
-                                        + "<p>"
-                                        + "Sie sind Mitglied der folgenden "
-                                        + "Gruppen:"
-                                        + "<br />"
-                                        + Lada.userroles
-                                        + "</p>"
-                                        + "<p>"
-                                        + "<br/>"
-                                        + "Die Anmeldung wurde durchgeführt um:"
-                                        + "<br />"
-                                        +  Ext.Date.format(logintime, 'd.m.Y H:i:s P')
-                                        + "</p>"
-                                       );
-                                }
                             }
                             ]
                         }
diff -r ad24af3fcf89 -r 4b9b1d3ad9f1 app/view/window/About.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/window/About.js	Thu May 21 17:59:48 2015 +0200
@@ -0,0 +1,125 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+/**
+ * About Window with basic information.
+ */
+Ext.define('Lada.view.window.About', {
+    extend: 'Ext.window.Window',
+
+    layout: 'fit',
+
+    initComponent: function() {
+        var i18n = Lada.getApplication().bundle;
+
+        // add listeners to change the window appearence when it becomes inactive
+        this.on({
+            activate: function(){
+                this.getEl().removeCls('window-inactive');
+            },
+            deactivate: function(){
+                this.getEl().addCls('window-inactive');
+            }
+        });
+
+        var me = this;
+        this.title = i18n.getMsg('about.window.title');
+        this.buttons = [{
+            text: i18n.getMsg('close'),
+            scope: this,
+            handler: this.close
+        }];
+        this.items = [{
+            border: 0,
+            autoscroll: 'true',
+            layout: 'vbox',
+            items: [{
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: i18n.getMsg('about.window.text.login')
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: Lada.username
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: i18n.getMsg('about.window.text.roles')
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: Lada.userroles
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: i18n.getMsg('about.window.text.logintime')
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: Ext.Date.format(new Date(Lada.logintime), 'd.m.Y H:i:s P')
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: i18n.getMsg('about.window.text.serverversion')
+            }, {
+                xtype: 'text',
+                style: {
+                    width: '95%',
+                    marginBottom: '5px'
+                },
+                text: this.requestServerVersion()
+            }]
+        }];
+
+        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 ad24af3fcf89 -r 4b9b1d3ad9f1 resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties	Thu May 21 15:54:25 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Thu May 21 17:59:48 2015 +0200
@@ -88,6 +88,13 @@
 mmtmessprogramm.form.fieldset.title:Messmethode & Nuklide
 messprogrammort.window.title:Ort für Messprogramm festlegen
 messprogrammort.button.title:Ort angeben
+about.window.title:Über
+about.button.title:Über
+
+about.window.text.login:Sie sind angemeldet mit der Kennung:
+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:
 
 # Actions
 add:Hinzufügen


More information about the Lada-commits mailing list