/*
 * Compressed by JSA(www.xidea.org)
 */
MyinfoPanel=function($){Ext.apply(this.config);Ext.data.Store.prototype.applySort=function(){if(this.sortInfo&&!this.remoteSort){var _=this.sortInfo,$=_.field,A=this.fields.get($).sortType,B=function(C,D){var _=A(C.data[$]),B=A(D.data[$]);if(typeof(_)=="string")return _.localeCompare(B);return _>B?1:(_<B?-1:0)};this.data.sort(_.direction,B);if(this.snapshot&&this.snapshot!=this.data)this.snapshot.sort(_.direction,B)}};this.userType=$.userType;this.provinceCombo=new Ext.form.ComboBox({hiddenName:"province",name:"province_name",valueField:"text",displayField:"text",mode:"local",fieldLabel:"\u6240\u5728\u7701\u4efd",blankText:"\u8bf7\u9009\u62e9\u7701\u4efd",emptyText:"\u8bf7\u9009\u62e9\u7701\u4efd",editable:false,forceSelection:true,triggerAction:"all",store:new Ext.data.SimpleStore({fields:["text","city"],data:citys,sortInfo:{field:"text"}}),listeners:{scope:this,select:function(A,$,_){this.cityCombo.clearValue();this.cityCombo.store.loadData($.data.city)}}});this.cityCombo=new Ext.form.ComboBox({hiddenName:"city",name:"city_name",valueField:"text",displayField:"text",mode:"local",fieldLabel:"\u6240\u5728\u57ce\u5e02",blankText:"\u8bf7\u9009\u62e9\u57ce\u5e02",emptyText:"\u8bf7\u9009\u62e9\u57ce\u5e02",editable:false,forceSelection:true,triggerAction:"all",store:new Ext.data.SimpleStore({fields:["text"],data:[],sortInfo:{field:"text"}})});this.industryCombo=new Ext.form.ComboBox({hiddenName:"U_Industry",name:"industry_name",valueField:"text",displayField:"text",mode:"local",fieldLabel:"\u6240\u5c5e\u884c\u4e1a",blankText:"\u8bf7\u9009\u62e9\u884c\u4e1a",emptyText:"\u8bf7\u9009\u62e9\u884c\u4e1a",editable:false,forceSelection:true,triggerAction:"all",store:new Ext.data.SimpleStore({fields:["text"],data:[["\u91d1\u878d"],["\u7535\u4fe1"],["\u653f\u5e9c"],["\u80fd\u6e90\u7535\u529b"],["\u4ea4\u901a\u7269\u6d41"],["\u5236\u9020"],["\u5176\u4ed6"]]})});this.jobCombo=new Ext.form.ComboBox({hiddenName:"U_Job",id:"ujob",name:"job_name",valueField:"text",displayField:"text",mode:"local",width:220,fieldLabel:"\u804c\u3000\u3000\u4f4d",blankText:"\u8bf7\u9009\u62e9\u804c\u4f4d",emptyText:"\u8bf7\u9009\u62e9\u804c\u4f4d",editable:false,forceSelection:true,triggerAction:"all",store:new Ext.data.SimpleStore({fields:["text"],data:[["\u5b66\u751f/\u5b9e\u4e60\u751f"],["\u65b0\u8fdb\u5458\u5de5"],["\u4e13\u4e1a\u4eba\u58eb"],["\u4e2d\u7ea7\u7ba1\u7406\u5c42\uff08\u90e8\u95e8\u7ecf\u7406\uff09"],["\u9ad8\u7ea7\u7ba1\u7406\u5c42\uff08\u6267\u884c\u526f\u603b\uff09"],["\u4f01\u4e1a\u51b3\u7b56\u5c42\uff08CEO,CFO,CTO,\u603b\u88c1\uff09"],["\u5176\u4ed6"]]})});this.BirthdayField=new Ext.form.DateField({fieldLabel:"\u51fa\u751f\u65e5\u671f",id:"uBirthday",format:"Y-n-j",name:"U_Birthday"});this.ContactField=new Ext.form.TextField({fieldLabel:"\u8054 \u7cfb \u4eba",id:"ucontact",name:"U_ContactName",maxLength:50,anchor:"95%"});MyinfoPanel.superclass.constructor.call(this,{closable:true,autoScroll:true,bodyStyle:"padding:5px 3px 0",title:"\u8be6\u7ec6\u8d44\u6599",border:false,labelAlign:"right",labelWidth:60,url:"updateinfo.aspx",defaultType:"textfield",items:[{fieldLabel:this.userType==0?"\u771f\u5b9e\u59d3\u540d":"\u4f01\u4e1a\u540d\u79f0",id:"uTruename",name:"U_TrueName",maxLength:50,anchor:"95%"},this.BirthdayField,this.provinceCombo,this.cityCombo,this.industryCombo,this.jobCombo,{fieldLabel:"\u7535\u5b50\u90ae\u4ef6",id:"uemail",name:"U_Email",validator:this.vEmail,maxLength:100,anchor:"95%"},{fieldLabel:"\u8054\u7cfb\u5730\u5740",id:"uaddress",name:"U_Address",maxLength:50,anchor:"95%"},{fieldLabel:"\u90ae\u653f\u7f16\u7801",id:"uzip",name:"U_Zip",maxLength:10,anchor:"95%"},this.ContactField,{fieldLabel:"\u8054\u7cfb\u7535\u8bdd",id:"uphone",name:"U_Phone",maxLength:50,anchor:"95%"},{fieldLabel:"\u624b\u3000\u3000\u673a",id:"umobi",name:"U_Mobile",maxLength:50,anchor:"95%"},{xtype:"hidden",name:"regClass",value:this.userType},{xtype:"hidden",name:"U_Tags",value:""}],tbar:[{text:"\u63d0\u4ea4",scope:this,iconCls:"icon-submit",tooltip:"\u5c06\u4fee\u6539\u5185\u5bb9\u63d0\u4ea4",handler:this.OnBtnSubmit},"-",{text:"\u5173\u95ed",iconCls:"icon-close",scope:this,tooltip:"\u5173\u95ed",handler:function(){this.ownerCt.remove(this,true)}}]})};Ext.extend(MyinfoPanel,Ext.form.FormPanel,{OnBtnSubmit:function(){if(this.form.isValid())this.form.submit({waitMsg:"\u6b63\u5728\u63d0\u4ea4...",scope:this,failure:function($,_){if(_.result)Ext.MessageBox.alert("\u9519\u8bef\u4fe1\u606f",_.result.info);else Ext.MessageBox.alert("\u9519\u8bef\u4fe1\u606f","\u670d\u52a1\u5668\u7aef\u53d1\u751f\u9519\u8bef\uff01")},success:function($,_){if(_.result.success)Ext.MessageBox.alert("\u6210\u529f","\u8be6\u7ec6\u8d44\u6599\u63d0\u4ea4\u6210\u529f\uff01");else Ext.MessageBox.alert("\u9519\u8bef\u4fe1\u606f",_.result.info)}});else Ext.MessageBox.alert("\u9519\u8bef","\u8bf7\u68c0\u67e5\u60a8\u7684\u8f93\u5165\uff01")},init:function(){var _=new Ext.LoadMask(this.body,{msg:"\u6b63\u5728\u8f7d\u5165......",msgCls:"x-mask-loading"});Ext.get(this.body).mask("\u6b63\u5728\u8f7d\u5165......");var A,$=new Ext.data.Connection();$.request({url:"Ajax.aspx",params:{act:"getfullinfo"},method:"post",scope:this,callback:function(C,_,$){if(_){A=Ext.util.JSON.decode($.responseText);if(A.success){this.getComponent("uTruename").setValue(A.info.U_TrueName);if(A.info.U_Birthday)this.getComponent("uBirthday").setValue(this.formatDate(A.info.U_Birthday));this.provinceCombo.setValue(A.info.U_Province);for(var B=0;B<citys.length;B++)if(A.info.U_Province==citys[B][0]){this.cityCombo.store.loadData(citys[B][1]);break}this.cityCombo.setValue(A.info.U_City);this.industryCombo.setValue(A.info.U_Industry);if(A.info.U_Job)this.jobCombo.setValue(A.info.U_Job);this.getComponent("uemail").setValue(A.info.U_Email);this.getComponent("uaddress").setValue(A.info.U_Address);if(A.info.U_ContactName)this.getComponent("ucontact").setValue(A.info.U_ContactName);this.getComponent("uphone").setValue(A.info.U_Phone);this.getComponent("umobi").setValue(A.info.U_Mobile);this.getComponent("uzip").setValue(A.info.U_Zip);Ext.get(this.body).unmask()}else{Ext.get(this.body).unmask();Ext.MessageBox.alert("\u63d0\u793a",A.errinfo);if(win)win.close();return}}else{Ext.get(this.body).unmask();Ext.MessageBox.alert("\u63d0\u793a","\u83b7\u53d6\u6587\u7ae0\u4fe1\u606f\u53d1\u751f\u9519\u8bef");return}}});if(this.userType==0)this.remove("ucontact",true);else{this.remove("uBirthday",true);this.remove("ujob",true)}},formatDate:function(sDate){var exp=sDate.toString().replace(new RegExp("\\/Date\\((-?[0-9]+)\\)\\/","g"),"new Date($1)"),a=eval(exp);return a.getFullYear()+"-"+(a.getMonth()+1)+"-"+a.getDate()},vEmail:function($){var _=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;if(_.test($))return true;else return"\u4e0d\u7b26\u5408\u90ae\u4ef6\u5730\u5740\u683c\u5f0f"}})
