dustin@800: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
dustin@800:  * Software engineering by Intevation GmbH
dustin@800:  *
dustin@800:  * This file is Free Software under the GNU GPL (v>=3)
dustin@800:  * and comes with ABSOLUTELY NO WARRANTY! Check out
dustin@800:  * the documentation coming with IMIS-Labordaten-Application for details.
dustin@800:  */
dustin@800: 
dustin@800: /**
dustin@800:  * About Window with basic information.
dustin@800:  */
dustin@800: Ext.define('Lada.view.window.About', {
dustin@800:     extend: 'Ext.window.Window',
dustin@800: 
dustin@800:     layout: 'fit',
dustin@800: 
dustin@890:     /**
dustin@890:      * This function initialises the Window
dustin@890:      */
dustin@800:     initComponent: function() {
dustin@800:         var i18n = Lada.getApplication().bundle;
dustin@800: 
dustin@800:         // add listeners to change the window appearence when it becomes inactive
dustin@800:         this.on({
dustin@800:             activate: function(){
dustin@800:                 this.getEl().removeCls('window-inactive');
dustin@800:             },
dustin@800:             deactivate: function(){
dustin@800:                 this.getEl().addCls('window-inactive');
dustin@800:             }
dustin@800:         });
dustin@800: 
dustin@800:         var me = this;
dustin@800:         this.title = i18n.getMsg('about.window.title');
dustin@800:         this.buttons = [{
dustin@800:             text: i18n.getMsg('close'),
dustin@800:             scope: this,
dustin@800:             handler: this.close
dustin@800:         }];
dustin@800:         this.items = [{
dustin@800:             border: 0,
dustin@800:             autoscroll: 'true',
dustin@800:             items: [{
dustin@805:                 xtype: 'panel',
dustin@805:                 border: 0,
dustin@805:                 layout: 'fit',
dustin@805:                 bodyPadding: 20,
dustin@805:                 html: '<p>'
dustin@805:                     + i18n.getMsg('about.window.text.login')
dustin@805:                     + '<br />'
dustin@805:                     + Lada.username
dustin@805:                     + '</p>'
dustin@805:                     + '<p>'
dustin@805:                     + i18n.getMsg('about.window.text.roles')
dustin@805:                     + this.rolesToHtml()
dustin@805:                     + '</p>'
dustin@805:                     + '<p>'
dustin@805:                     + i18n.getMsg('about.window.text.logintime')
dustin@805:                     + '<br />'
dustin@805:                     + Ext.Date.format(new Date(Lada.logintime), 'd.m.y h:i:s P')
dustin@805:                     + '</p>'
dustin@805:                     + '<p>'
dustin@805:                     + i18n.getMsg('about.window.text.serverversion')+ ' '
dustin@805:                     + Lada.serverVersion
dustin@805:                     + '</p>'
dustin@805:                     + '<p>'
dustin@805:                     + i18n.getMsg('about.window.text.clientversion')+' '
dustin@805:                     + Lada.clientVersion
dustin@805:                     + '</p>'
dustin@800:             }]
dustin@800:         }];
dustin@800: 
dustin@800:         this.callParent(arguments);
dustin@805:     },
dustin@805: 
dustin@890:     /**
dustin@890:      * This function converts an Array into HTML-paragraphs
dustin@890:      */
dustin@805:     rolesToHtml: function() {
rrenkert@915:         var roles = '';
rrenkert@914: //        var r = Lada.userroles.split(',');
dustin@805:         var i;
rrenkert@914:         for (i in Lada.userroles){
rrenkert@916:             roles += '<br />' + Lada.userroles[i];
dustin@805:         }
dustin@805:         return roles;
dustin@800:     }
dustin@800: });