Ext.Loader.setConfig({ enabled: true }); Ext.Loader.setPath('Ext.ux', 'sysJS/extJS/examples/ux'); Ext.require([ 'Ext.selection.CellModel', 'Ext.grid.*', 'Ext.data.*', 'Ext.util.*', 'Ext.state.*', 'Ext.form.*', 'Ext.ux.CheckColumn', 'Ext.ux.layout.Center' ]); var MainPanel = null; var MainApp; Ext.onReady(function(){ Ext.create('Ext.window.Window', { title: 'Вас приветствует сисема "ГеоС". Пожалуйста авторизуйтесь.', width: 400, listeners : { afterrender : function () { Ext.get('gsLoad').remove(); } }, layout: 'fit', closable: false, items: [{ xtype: 'form', bodyPadding: '5 10 5 10', id : 'auth-form', url: '/sysKernel/login', border: true, layout: 'anchor', defaults: { anchor: '100%', labelWidth: 100, labelAlign: 'right', enableKeyEvents:true, listeners:{ specialKey: function(field, el) { if(el.getKey() == Ext.EventObject.ENTER) { Ext.getCmp('auth-form-button').handler(); } } } }, defaultType: 'textfield', items: [ { fieldLabel : 'Логин', name: 'user_login', allowBlank: false }, { fieldLabel : 'Пароль', name: 'user_password', allowBlank: false, inputType: 'password' } ], buttons: [ { xtype: 'button', id: 'auth-form-button', text : 'Авторизоваться', arrowAlign: 'right', handler: function () { Ext.getCmp('auth-form').submit({ clientValidation: false, success: function (form, action) { window.location.href = baseUrl; // window.location.href= window.location.href = 'https://' + bsForm.findField('user_login').getValue() + ':' + bsForm.findField('user_password').getValue() + '@'+window.location.host+ baseRelativeUrl; }, failure: function(form, action) { if(action&&action.response&&action.response.responseText.length>0){ var text = Ext.JSON.decode(action.response.responseText).msg; text = text.length>0?text:errorSummary(form,action.result.msg); Ext.Msg.alert(Ext.JSON.decode(action.response.responseText).title, text); return true; } switch (action.failureType) { case Ext.form.action.Action.CLIENT_INVALID: Ext.Msg.alert('Failure', 'Ошибка отправки данных'); break; case Ext.form.action.Action.CONNECT_FAILURE: Ext.Msg.alert('Failure', 'Ошибка соединения с сервером'); break; case Ext.form.action.Action.SERVER_INVALID: Ext.Msg.alert(action.result.title, errorSummary(form,action.result.msg)); } } }); } } ] }] }).show() });