changeset 800:4b9b1d3ad9f1

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
author Dustin Demuth <dustin@intevation.de>
date Thu, 21 May 2015 17:59:48 +0200
parents ad24af3fcf89
children 646779690e20
files app/controller/Filter.js app/view/Viewport.js app/view/window/About.js resources/i18n/Lada_de-DE.properties
diffstat 4 files changed, 136 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- 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();
     }
 });
--- 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>"
-                                       );
-                                }
                             }
                             ]
                         }
--- /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');
+            }
+        });
+    }
+});
--- 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

http://lada.wald.intevation.org