1 Ext
.ns('jibu.security.setting');
2 jibu
.security
.setting
.Form
=
3 Ext
.extend(Ext
.form
.FormPanel
,{
4 fullName
: 'Full Name',
7 password
: 'New Password',
8 passwordRepeat
: 'Re-enter New Password',
9 userInformation
:'Account Information',
10 settings
: 'Preference Settings',
12 language
: 'Language',
14 confirmPassword
: 'Passwords do not match',
15 passwordInfo
: 'Password',
16 oldPassword
: 'Current Password',
18 waitMsgText
: 'Submitting...',
19 initComponent:function() {
27 title
: this.userInformation
,
30 defaults
: {width
: 210},
31 defaultType
: 'textfield',
36 fieldLabel
: this.fullName
,
37 name
: 'User.fullname',
40 fieldLabel
: this.email
,
41 name
: 'User.emailaddress',
44 fieldLabel
: this.userName
,
45 name
: 'User.username',
52 title
: this.passwordInfo
,
55 defaults
: {width
: 210},
56 defaultType
: 'textfield',
58 fieldLabel
: this.oldPassword
,
63 fieldLabel
: this.password
,
64 id
:'setting_newpassword',
65 name
: 'User.password',
68 fieldLabel
: this.passwordRepeat
,
69 name
: 'passwordAgain',
70 inputType
: 'password',
71 vtype
: 'passwordAgain'
79 defaults
: {width
: 210},
80 defaultType
: 'textfield',
82 new Ext
.form
.ComboBox({
83 store
:new Ext
.data
.JsonStore({
84 fields
:[{name
:'id', type
:'int'},
85 {name
:'value', type
:'string'}],
86 url
:'Setting.y?ci=settingLoad',
88 baseParams
:{'settings.name' :'language'}
92 id
:'setting_language',
93 hiddenId
:'h_setting_language',
94 hiddenName
:'settings.id',
96 fieldLabel
: this.language
,
99 new Ext
.form
.ComboBox({
100 store
:new Ext
.data
.JsonStore({
101 fields
:[{name
:'id', type
:'int'},
102 {name
:'value', type
:'string'}],
103 url
:'Setting.y?ci=settingLoad',
105 baseParams
:{'settings.name' :'layout'}
107 displayField
:'value',
110 hiddenId
:'h_setting_layout',
111 hiddenName
:'settings.id',
113 fieldLabel
: this.fl_layout
,
116 new Ext
.form
.ComboBox({
117 store
:new Ext
.data
.JsonStore({
118 fields
:[{name
:'id', type
:'int'},
119 {name
:'value', type
:'string'}],
120 url
:'Setting.y?ci=settingLoad',
123 'settings.name' :'theme'
126 displayField
:'value',
129 hiddenId
:'h_setting_theme',
130 hiddenName
:'settings.id',
132 fieldLabel
:this.theme
,
137 buttonAlign
:'center',
139 id
:'setting_submitBtn',
140 text
: this.submitText
,
144 this.getForm().submit({
145 url
: 'Setting.y?ci=settingUpdate',
147 waitMsg
: this.waitMsgText
,
148 success: function(form
, action
) {
150 failure: function(form
, action
) {
160 url
: 'Setting.y?ci=formLoad',
161 success:function(f
,a
){
162 var settings
= a
.result
.settings
;
163 // f.setValues() 会把显示值和实际值都置为 settings[i].value
164 // 需要 Ext.fly 将实际值置为 settings[i].id,而且必须在 f.setValues() 之后
165 for (var i
=0;i
<settings
.length
;i
++) {
166 f
.setValues([{id
:'setting_'+settings
[i
].name
,value
:settings
[i
].value
}]);
167 Ext
.fly('h_setting_'+settings
[i
].name
).dom
.value
=settings
[i
].id
;
173 }; // eof config object
175 Ext
.apply(this, Ext
.apply(this.initialConfig
, config
));
177 jibu
.security
.setting
.Form
.superclass
.initComponent
.apply(this, arguments
);
180 Ext
.apply(Ext
.form
.VTypes
, {
181 passwordAgain: function(val
, field
) {
182 var password
= Ext
.getCmp("setting_newpassword").getValue();
183 if (val
!= password
) {
184 Ext
.getCmp("setting_submitBtn").disable();
187 Ext
.getCmp("setting_submitBtn").enable();
193 // 处理“再次录入密码”校验未通过时显示的提示信息
194 Ext
.apply(Ext
.form
.VTypes
, {
195 passwordAgainText
: this.confirmPassword
197 }// eo funtion initComponent
200 Ext
.reg('system.setting', jibu
.security
.setting
.Form
);