tweak the way the login is built up

This commit is contained in:
Damien Churchill 2010-01-23 15:31:17 +00:00
parent f14b3a8459
commit 1b2d5bc6ad
1 changed files with 125 additions and 136 deletions

View File

@ -1,5 +1,5 @@
/* /*
Script: deluge-login.js Script: Deluge.Login.js
Contains all objects and functions related to the login system. Contains all objects and functions related to the login system.
Copyright: Copyright:
@ -32,28 +32,21 @@ Copyright:
*/ */
(function(){ Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
Ext.deluge.LoginWindow = Ext.extend(Ext.Window, {
firstShow: true, firstShow: true,
constructor: function(config) {
config = Ext.apply({
layout: 'fit',
width: 300,
height: 120,
bodyStyle: 'padding: 10px 5px;', bodyStyle: 'padding: 10px 5px;',
buttonAlign: 'center', buttonAlign: 'center',
closeAction: 'hide',
closable: false, closable: false,
closeAction: 'hide',
iconCls: 'x-deluge-login-window-icon',
layout: 'fit',
modal: true, modal: true,
plain: true, plain: true,
resizable: false, resizable: false,
title: _('Login'), title: _('Login'),
iconCls: 'x-deluge-login-window-icon' width: 300,
}, config); height: 120,
Ext.deluge.LoginWindow.superclass.constructor.call(this, config);
},
initComponent: function() { initComponent: function() {
Ext.deluge.LoginWindow.superclass.initComponent.call(this); Ext.deluge.LoginWindow.superclass.initComponent.call(this);
@ -65,26 +58,23 @@ Copyright:
scope: this scope: this
}); });
this.loginForm = this.add({ this.form = this.add({
xtype: 'form', xtype: 'form',
defaultType: 'textfield',
id: 'loginForm',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 55, labelWidth: 55,
items: [{ width: 300,
defaults: {width: 200},
defaultType: 'textfield',
});
this.passwordField = this.form.add({
xtype: 'textfield',
fieldLabel: _('Password'), fieldLabel: _('Password'),
id: 'password', id: '_password',
name: 'password', name: 'password',
inputType: 'password', inputType: 'password'
anchor: '100%', });
listeners: { this.passwordField.on('specialkey', this.onSpecialKey, this);
'specialkey': {
fn: this.onKey,
scope: this
}
}
}]
})
}, },
logout: function() { logout: function() {
@ -122,7 +112,7 @@ Copyright:
}); });
}, },
onKey: function(field, e) { onSpecialKey: function(field, e) {
if (e.getKey() == 13) this.onLogin(); if (e.getKey() == 13) this.onLogin();
}, },
@ -164,7 +154,6 @@ Copyright:
passwordField.focus(false, 150); passwordField.focus(false, 150);
passwordField.setRawValue(''); passwordField.setRawValue('');
} }
}); });
Deluge.Login = new Ext.deluge.LoginWindow(); Deluge.Login = new Ext.deluge.LoginWindow();
})();