comparison app/view/window/About.js @ 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
children 646779690e20
comparison
equal deleted inserted replaced
799:ad24af3fcf89 800:4b9b1d3ad9f1
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 /**
10 * About Window with basic information.
11 */
12 Ext.define('Lada.view.window.About', {
13 extend: 'Ext.window.Window',
14
15 layout: 'fit',
16
17 initComponent: function() {
18 var i18n = Lada.getApplication().bundle;
19
20 // add listeners to change the window appearence when it becomes inactive
21 this.on({
22 activate: function(){
23 this.getEl().removeCls('window-inactive');
24 },
25 deactivate: function(){
26 this.getEl().addCls('window-inactive');
27 }
28 });
29
30 var me = this;
31 this.title = i18n.getMsg('about.window.title');
32 this.buttons = [{
33 text: i18n.getMsg('close'),
34 scope: this,
35 handler: this.close
36 }];
37 this.items = [{
38 border: 0,
39 autoscroll: 'true',
40 layout: 'vbox',
41 items: [{
42 xtype: 'text',
43 style: {
44 width: '95%',
45 marginBottom: '5px'
46 },
47 text: i18n.getMsg('about.window.text.login')
48 }, {
49 xtype: 'text',
50 style: {
51 width: '95%',
52 marginBottom: '5px'
53 },
54 text: Lada.username
55 }, {
56 xtype: 'text',
57 style: {
58 width: '95%',
59 marginBottom: '5px'
60 },
61 text: i18n.getMsg('about.window.text.roles')
62 }, {
63 xtype: 'text',
64 style: {
65 width: '95%',
66 marginBottom: '5px'
67 },
68 text: Lada.userroles
69 }, {
70 xtype: 'text',
71 style: {
72 width: '95%',
73 marginBottom: '5px'
74 },
75 text: i18n.getMsg('about.window.text.logintime')
76 }, {
77 xtype: 'text',
78 style: {
79 width: '95%',
80 marginBottom: '5px'
81 },
82 text: Ext.Date.format(new Date(Lada.logintime), 'd.m.Y H:i:s P')
83 }, {
84 xtype: 'text',
85 style: {
86 width: '95%',
87 marginBottom: '5px'
88 },
89 text: i18n.getMsg('about.window.text.serverversion')
90 }, {
91 xtype: 'text',
92 style: {
93 width: '95%',
94 marginBottom: '5px'
95 },
96 text: this.requestServerVersion()
97 }]
98 }];
99
100 this.callParent(arguments);
101 },
102
103 requestServerVersion: function() {
104 var i18n = Lada.getApplication().bundle;
105 Ext.Ajax.request({
106 url: '/lada-server/version',
107 method: 'GET',
108 headers: {
109 'X-OPENID-PARAMS': Lada.openIDParams
110 },
111 success: function(response) {
112 var json = Ext.decode(response.responseText);
113 // TODO
114 console.log(json);
115 return json.data;
116 },
117 failure: function(response) {
118 console.log('Error in Retrieving the Server Version.'
119 + ' It might be lower than 2.0-beta2'
120 + ' Or something is broken...');
121 return i18n.getMsg('err.msg.generic.body');
122 }
123 });
124 }
125 });

http://lada.wald.intevation.org