/*
*/
Ext.namespace('procenter.logic');
var applicationName = '/procenter';
// テナント
var tenantField = null;
// ユーザ名
var userField = null;
// パスワード
var passField = null;
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = applicationName + '/lib/ext/resources/images/default/s.gif';
userField = new Ext.form.TextField( {
applyTo: 'lgnUserNameText',
width: 200,
regex: /^[\x20-\x7e]/,
style: 'ime-mode:inactive;',
enableKeyEvents: true,
listeners: {
keydown: function(textfield, e){
if(e.keyCode == 13){
procenter.logic.submitLoginForm();
}
}
}
} );
passField = new Ext.form.TextField({
applyTo: 'lgnPasswordText',
width: 200,
enableKeyEvents: true,
listeners: {
keydown: function(textfield, e){
if(e.keyCode == 13){
procenter.logic.submitLoginForm();
}
}
}
});
// コンボボックス用Store(JSONを取得)
var store = new procenter.common.BaseJsonStore({
url: applicationName + '/lgnGetLanguage.do',
root: 'data.Languages',
fields: ['value', 'displayValue', 'defaultValue']
});
// 言語
var comboBox = new Ext.form.ComboBox({
id: 'lgnLocaleComboBox',
fieldLabel: '言語',
hiddenName: 'localeId',
listWidth: 150,
width: 150,
store: store,
valueField: 'value',
displayField: 'displayValue',
triggerAction: "all",
editable: false,
mode: 'local',
forceSelection : true,
typeAhead :true
});
// コンボボックス格納用フィールドセット
var fieldSet = new Ext.form.FieldSet({
collapsible : true,
renderTo: 'fieldSet',
title: 'オプション',
width: 300,
autoHeight: true,
animCollapse: true,
collapsed: true,
hideBorders: true,
items: [comboBox]
});
// ボタン
var submitBtn = new Ext.Button({
type :'submit',
applyTo: 'lgnOk',
text: 'ログイン',
formBind: true,
minWidth: 80,
handler: function() {
this.disable();
procenter.logic.submitLoginForm();
}
});
// コンボボックスのデフォルト値を設定する
store.load({callback : function(r, options, success){
if(this.jsonStatus == true){
if(success){
var record = null;
var defaultValue = "";
for (var i = 0; i < r.length; i++){
record = r[i];
// defaultValueの値がtrueのデータをデフォルト値として設定する
defaultValue = record.get('defaultValue');
if (defaultValue) {
comboBox.setValue(r[i].get('value'));
break;
}
}
}
}}
});
// パネルの作成
new Ext.Panel({
title: 'ログイン情報を入力してください',
renderTo: 'show-login-area',
frame: true,
cls: 'loginFormPanel',
items:[{contentEl: 'hide-login-area'},{contentEl: 'hide-forgot-password-area'}],
listeners: {
afterlayout: function(panel, layout) {
}
}
});
userField.focus();
// パスワードを忘れた場合 ボタン
var forgotPasswordBtn = new Ext.Button({
type :'submit',
applyTo: 'forgotPasswordButton',
text: 'パスワードを忘れた場合',
minWidth: 80,
cls: 'password-reset-button',
handler: function() {
//マスクの開始
if(procenter.common.isMaskFullScreen() == true){
return;
}
procenter.common.MaskFullScreen();
this.disable();
Ext.get('forgotPasswordForm').dom.submit();
}
});
procenter.logic.submitLoginForm = function(){
//マスクの開始
procenter.common.MaskFullScreen();
// 入力部品を無効化し、hiddenパラメタにセット
passField.disable();
document.getElementById('password').value = passField.getValue();
userField.disable();
document.getElementById('loginId').value = userField.getValue();
Ext.get('form1').dom.submit();
}
});