Wtf.common.myProfile=function(config){Wtf.apply(this,config);Wtf.common.myProfile.superclass.constructor.call(this,{layout:"fit",border:false,plain:true,shadow:false,autoScroll:true,width:400,title:"Profile Management",modal:true,iconCls:"winicon",resizable:false,items:[{layout:"form",border:false,height:500,id:"myProfile"+this.id}],buttons:[{text:"Save",scope:this,handler:function(){if(isRoleGroup("2")||(this.parentid)){if(this.pro.form.el){if((this.pro.form.isValid())&&(this.per.form.isValid())){this.pro.form.submit({scope:this,failure:function(frm,action){Wtf.Msg.alert("Error","Error in Connection",function(btn){if(btn=="ok"){}},this)},success:function(frm,action){var nodeobj=eval("("+action.response.responseText.trim()+")");if(nodeobj.success=="false"){Wtf.Msg.alert("Status","An error occurred while connecting to server.",function(btn){if(btn=="ok"){}},this)}else{if(nodeobj.success=="true"){Wtf.Msg.alert("Status","Details saved successfully.",function(btn){if(btn=="ok"){}},this)}}}});this.subPer()}else{if(!(this.pro.form.isValid())&&!(this.per.form.isValid())){msgBoxShow(["Validation Failure","Some fields in both the Personal Details and Professional Details tabs are invalid."],Wtf.MessageBox.ERROR)}else{if(!(this.pro.form.isValid())){msgBoxShow(["Validation Failure","Some fields in the Professional Details tab are invalid."],Wtf.MessageBox.ERROR)}if(!(this.per.form.isValid())){msgBoxShow(["Validation Failure","Some fields in the Personal Details tab are invalid."],Wtf.MessageBox.ERROR)}}}}}else{this.subPer()}}},{text:"Close",scope:this,handler:function(){this.close()}}]})};Wtf.extend(Wtf.common.myProfile,Wtf.Window,{onRender:function(B){Wtf.common.myProfile.superclass.onRender.call(this,B);this.deptStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=dept",root:"data",fields:["departmentid","departmentname"]});this.deptStore.load();this.dsgStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=designation",root:"data",fields:["desigid","designame"]});this.dsgStore.load();this.typeStore=new Wtf.data.SimpleStore({data:[["Regular","0"],["Adjunct","1"]],fields:["type","roleid"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"roleid"}]),autoLoad:true});this.payStore=new Wtf.data.SimpleStore({data:[["Krawler","0"],["Other","1"]],fields:["paytype","payid"],reader:new Wtf.data.ArrayReader({},[{name:"paytype"},{name:"payid"}]),autoLoad:true});if(isRoleGroup("1")||this.isStudent){this.salStore=new Wtf.data.SimpleStore({data:[["Mr.","0"],["Ms.","1"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true})}else{this.salStore=new Wtf.data.SimpleStore({data:[["Mr.","0"],["Ms.","1"],["Dr.","2"],["Professor","3"],["Datuk","4"]],fields:["type","id"],reader:new Wtf.data.ArrayReader({},[{name:"type"},{name:"id"}]),autoLoad:true})}if(!Wtf.StoreMgr.containsKey("country")){Wtf.countryStore.load();Wtf.StoreMgr.add("country",Wtf.countryStore)}if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}if(!Wtf.StoreMgr.containsKey("nationality")){Wtf.nationalityStore.load();Wtf.StoreMgr.add("nationality",Wtf.nationalityStore)}if(!Wtf.StoreMgr.containsKey("race")){Wtf.raceStore.load();Wtf.StoreMgr.add("race",Wtf.raceStore)}if(!Wtf.StoreMgr.containsKey("prog")){Wtf.progStore.load();Wtf.StoreMgr.add("prog",Wtf.progStore)}this.facLocStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=loc",root:"loclist",fields:["locid","locname"]});this.facLevelStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=level",root:"levellist",fields:["levelid","levelname"]});this.facQualStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=qual",root:"quallist",fields:["qualid","qualname"]});this.facSkillStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=skill",root:"skilllist",fields:["skillid","skillname"]});this.stateStore=new Wtf.data.JsonStore({url:"CountryList.jsp?mode=state&country=130",root:"data",fields:["id","name"]});this.stateStore.load();this.religionStore=new Wtf.data.SimpleStore({data:[["Islam","Islam"],["Buddhist","Buddhist"],["Christian","Christian"],["Hindu","Hindu"],["Jew","Jew"],["Other","Other"]],fields:["name","id"],reader:new Wtf.data.ArrayReader({},[{name:"name"},{name:"id"}]),autoLoad:true});this.idTypeStore=new Wtf.data.SimpleStore({data:[["My Kad",1],["Passport",2],["Malaysian IC",3],["Military Number",4]],fields:["name","id"],reader:new Wtf.data.ArrayReader({},[{name:"name",name:"id"}]),autoLoad:true});var D=(this.facId)?this.facId:loginid;this.pro=new Wtf.form.FormPanel({url:"jspfiles/schclass.jsp?type=updateFacProfile&userid="+D,waitMsgTarget:true,method:"POST",title:"Professional Details",border:false,region:"center",border:false,layout:"accordion",height:450,layoutConfig:{deferredRender:false},frame:true,items:[this.profield1=new Wtf.Panel({title:"General",height:360,layout:"fit",items:[{layout:"column",items:[{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facName=new Wtf.form.TextField({fieldLabel:"Trainer's Name*",name:"name",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facType=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Trainer Type*",hiddenName:"factype",store:this.typeStore,readOnly:true,displayField:"type",valueField:"roleid",mode:"local",triggerAction:"all",emptyText:"Select a type...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facDesig=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Designation*",hiddenName:"desg",store:this.dsgStore,readOnly:true,displayField:"designame",valueField:"desigid",mode:"local",triggerAction:"all",emptyText:"Select designation...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facDept=new Wtf.form.ComboBox({mode:"local",store:this.deptStore,fieldLabel:"Department*",hiddenName:"dept",valueField:"departmentid",triggerAction:"all",displayField:"departmentname",readOnly:true,emptyText:"Select department...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facLevel=new Wtf.form.ComboBox({mode:"local",store:this.facLevelStore,fieldLabel:"Level*",scope:this,hiddenName:"level",valueField:"levelid",triggerAction:"all",displayField:"levelname",readOnly:true,emptyText:"Select Level...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facCost=new Wtf.form.TextField({fieldLabel:"Cost(Per Week)*",name:"cost",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facPayroll=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Payroll*",hiddenName:"payroll",store:this.payStore,readOnly:true,displayField:"paytype",valueField:"payid",mode:"local",triggerAction:"all",emptyText:"Select payroll...",allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facProgramme=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Programmes*",hiddenName:"programmes",store:Wtf.progStore,readOnly:true,displayField:"programname",valueField:"programid",mode:"local",triggerAction:"all",emptyText:"Select programme...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facLocation=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Locations*",hiddenName:"locations",scope:this,store:this.facLocStore,readOnly:true,displayField:"locname",valueField:"locid",mode:"local",triggerAction:"all",emptyText:"Select location...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facJoin=new Wtf.form.DateField({editable:false,format:"Y/d/m",width:160,fieldLabel:"Joining Date*",name:"joiningdate",allowBlank:false,anchor:"98%"})]}]}]}),this.profield2=new Wtf.Panel({border:false,title:"Skills",height:360,layout:"fit",items:[{layout:"column",items:[{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facQual=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Qualifications*",hiddenName:"qualifications",scope:this,store:this.facQualStore,width:250,height:10,readOnly:true,displayField:"qualname",valueField:"qualid",mode:"local",triggerAction:"all",emptyText:"Select qualification...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facSkill=new Wtf.common.Select(Wtf.applyIf({multiSelect:true,forceSelection:true},{xtype:"combo",fieldLabel:"Skills*",hiddenName:"skills",scope:this,store:this.facSkillStore,readOnly:true,height:10,width:250,displayField:"skillname",valueField:"skillid",mode:"local",triggerAction:"all",emptyText:"Select skills...",allowBlank:false,anchor:"98%"}))]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facPrevWorkEx=new Wtf.form.TextArea({fieldLabel:"Work Experience*",name:"prevworkex",height:100,width:240,allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facBookRef=new Wtf.form.TextArea({fieldLabel:"Book/Article References*",name:"bookref",height:100,width:240,allowBlank:false,anchor:"98%"})]},{columnWidth:0.99,labelWidth:100,layout:"form",items:[this.facultyId=new Wtf.form.Hidden({name:"facultyid"})]}]}]})]});this.facName.disable();if(isRoleGroup("2")){this.facCost.disable()}var C=(this.facId)?this.facId:loginid;this.crDate=(new Date()).format("Y/m/d");this.per=new Wtf.form.FormPanel({url:"editProfile.jsp?userid="+C,waitMsgTarget:true,method:"POST",scope:this,title:"Personal Details",fileUpload:true,region:"center",border:false,autoHeight:true,layout:"Accordion",layoutConfig:{activeOnTop:true},id:"createuserForm",items:[this.general1=new Wtf.Panel({title:"General",height:400,border:false,bodyStyle:"background:#f1f1f1;",layout:"fit",items:[{layout:"form",labelWidth:84,height:390,border:false,bodyStyle:"padding:10px",items:[this.sal=new Wtf.form.ComboBox({fieldLabel:"Salutation*",mode:"local",scope:this,triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a salutation",store:this.salStore,displayField:"type",valueField:"id",allowBlank:false,width:270,disabled:isRoleGroup("1")}),this.idType=new Wtf.form.ComboBox({mode:"local",store:this.idTypeStore,fieldLabel:"ID Type*",valueField:"id",name:"idtype",editable:false,triggerAction:"all",displayField:"name",emptyText:"Select an ID Type...",allowBlank:false,width:270,disabled:isRoleGroup("1")}),this.idNumber=new Wtf.form.TextField({fieldLabel:"ID Number*",allowBlank:false,maxLength:30,scope:this,width:270,disabled:isRoleGroup("1")}),this.userid=new Wtf.form.TextField({fieldLabel:"User ID*",maxLength:50,scope:this,disabled:true,allowBlank:false,width:270}),this.oid=new Wtf.form.TextField({fieldLabel:"Other ID",maxLength:50,scope:this,allowBlank:true,width:270,disabled:isRoleGroup("1")}),this.dlno=new Wtf.form.TextField({fieldLabel:"Driving License No",name:"dlno",maxLength:50,scope:this,allowBlank:true,width:270}),this.fName=new Wtf.form.TextField({fieldLabel:"First Name*",scope:this,maxLength:100,allowBlank:false,width:270,disabled:isRoleGroup("1")}),this.lName=new Wtf.form.TextField({fieldLabel:"Last Name*",scope:this,maxLength:100,allowBlank:false,width:270,disabled:isRoleGroup("1")}),this.facDob=new Wtf.form.DateField({editable:false,format:"Y/m/d",fieldLabel:"Date of Birth*",name:"dob",allowBlank:false,maxValue:this.crDate,width:270}),new Wtf.form.TextField({labelStyle:"width: 80px",fieldLabel:"User Picture",hidden:isRoleGroup("1")?true:false,hideLabel:isRoleGroup("1")?true:false,name:"image",scope:this,anchor:"98%",height:24,inputType:"file"})]}]}),this.resident1=new Wtf.Panel({title:"Residential Details",height:390,border:false,layout:"fit",bodyStyle:"background:#f1f1f1;",items:[{layout:"form",border:false,bodyStyle:"padding:10px",items:[this.nationality=new Wtf.form.ComboBox({fieldLabel:"Nationality*",mode:"local",triggerAction:"all",typeAhead:true,editable:false,emptyText:"Select a nationality...",store:Wtf.nationalityStore,displayField:"name",valueField:"id",allowBlank:false,width:240}),this.race=new Wtf.form.ComboBox({fieldLabel:"Race*",mode:"local",triggerAction:"all",typeAhead:true,valueNotFoundText:"Select a race...",editable:false,disabled:true,emptyText:"Select a race...",store:Wtf.raceStore,displayField:"name",valueField:"id",allowBlank:false,width:240}),this.religion=new Wtf.form.ComboBox({mode:"local",store:this.religionStore,fieldLabel:"Religion*",valueField:"name",editable:false,triggerAction:"all",displayField:"name",emptyText:"Select a religion...",allowBlank:false,width:240}),this.country=new Wtf.form.ComboBox({fieldLabel:"Country*",mode:"local",triggerAction:"all",typeAhead:true,editable:false,emptyText:"Select a country...",store:Wtf.countryStore,displayField:"name",valueField:"id",allowBlank:false,width:240}),this.state=new Wtf.form.ComboBox({mode:"local",store:this.stateStore,fieldLabel:"State",valueField:"id",editable:false,triggerAction:"all",displayField:"name",emptyText:"Select a state...",allowBlank:true,width:240}),this.ostate=new Wtf.form.TextField({fieldLabel:"State (Non-Malaysian)",name:"ostate",maxLength:50,valuefield:"id",width:240}),this.city=new Wtf.form.TextField({fieldLabel:"City",maxLength:50,name:"city",width:240}),this.address=new Wtf.form.TextArea({fieldLabel:"Address (mailing)",height:65,maxLength:256,scope:this,name:"address",width:240}),this.paddress=new Wtf.form.TextArea({fieldLabel:"Address (permanent)",height:65,scope:this,maxLength:200,name:"paddress",width:240}),this.postcode=new Wtf.form.TextField({fieldLabel:"Post Code*",name:"postcode",allowBlank:false,maxLength:50,regex:new RegExp("^(([0-9A-Z]{2,5}[ \\-]?[0-9A-Z]{2,5})|\\d{0})$"),scope:this,width:240})]}]}),this.contact1=new Wtf.Panel({title:"Contact Details",height:390,layout:"fit",border:false,bodyStyle:"background:#f1f1f1;",items:[{layout:"form",border:false,height:380,id:this.id+"contactfrm",bodyStyle:"padding:10px",items:[this.phone=new Wtf.form.TextField({fieldLabel:"Telephone",name:"telephone",maxLength:50,scope:this,validator:this.phoneValidator,width:240}),this.fax=new Wtf.form.TextField({fieldLabel:"Fax",name:"faxno",scope:this,maxLength:50,validator:this.phoneValidator,width:240}),this.mobile=new Wtf.form.TextField({fieldLabel:"Mobile*",name:"mobileno",maxLength:50,allowBlank:false,scope:this,validator:this.phoneValidator,width:240}),this.email=new Wtf.form.TextField({fieldLabel:"User Email*",name:"emailid",scope:this,allowBlank:false,vtype:"email",width:240}),this.locale=new Wtf.form.ComboBox({fieldLabel:"Time Zone*",mode:"local",scope:this,triggerAction:"all",typeAhead:true,editable:false,blankText:"Select a time zone",store:Wtf.timezoneStore,displayField:"name",valueField:"id",allowBlank:false,width:240}),this.about=new Wtf.form.TextArea({fieldLabel:"About User",name:"aboutuser",maxLength:256,scope:this,width:240}),new Wtf.form.Hidden({name:"userid",value:(this.facId)?this.facId:loginid,width:240})]}]}),this.other1=new Wtf.Panel({title:"Other Details",height:390,border:false,autoScroll:true,bodyStyle:"background:#f1f1f1;",items:[{layout:"form",border:false,height:380,autoScroll:true,bodyStyle:"padding:10px;overflow:auto;",id:this.id+"otherdetails"}]})]});this.tp=new Wtf.TabPanel({activeTab:0,region:"center",layoutOnTabChange:true,layoutConfig:{deferredRender:false},deferredRender:false,items:[this.per]});this.tp.on("tabchange",function(F,E){if(E==this.pro){this.profield1.setHeight(360);this.profield2.setHeight(360)}},this);this.nationality.on("select",function(F,G,E){if(G.get("name")=="MALAYSIAN"){this.race.enable()}else{this.race.disable()}},this);this.country.on("select",function(F,G,E){if(G.get("name")=="Malaysia"){this.state.enable();this.ostate.disable();this.ostate.setValue("")}else{this.state.disable();this.ostate.enable();this.state.setValue("")}},this);if(isRoleGroup("2")||(this.parentid)){this.tp.add(this.pro);this.pro.form.render()}this.addPer();Wtf.getCmp("myProfile"+this.id).add(this.tp);Wtf.getCmp("myProfile"+this.id).add(this.tp);var A="";if(this.rolestr.indexOf("1")>-1){A="Employee Profile"}if(this.rolestr.indexOf("2")>-1){A="Trainer Profile"}if(this.rolestr.indexOf("4")>-1){A="Admin Profile"}this.attrPanel=new Wtf.attributeComponent({facId:this.facId,widthValue:220,autoScroll:true,configType:A,layout:"form",refid:(this.facId)?this.facId:loginid,border:false});Wtf.getCmp(this.id+"otherdetails").add(this.attrPanel);this.attrPanel.on("closeform",function(E){Wtf.getCmp(this.id+"otherdetails").doLayout();this.loadMask.hide()},this);this.general1.on("expand",function(E){return false},this);this.contact1.on("expand",function(E){return false},this);this.resident1.on("expand",function(E){return false},this);this.other1.on("expand",function(E){return false},this);this.profield1.on("expand",function(E){this.facSkillStore.loadData(rec,true);return false},this);this.profield2.on("expand",function(E){return false},this)},setFormValues:function(A){if(A){if(A.loclist){this.facLocStore.loadData(A,true)}if(A.quallist){this.facQualStore.loadData(A,true)}if(A.levellist){this.facLevelStore.loadData(A,true)}if(A.skilllist){this.facSkillStore.loadData(A,true)}this.facultyId.setValue(A.Id);this.facName.setValue(A.Name);this.facType.setValue(A.Type);this.facDesig.setValue(A.Designation);this.facDept.setValue(A.Department);this.facPayroll.setValue(A.Payroll);if(A.Level){this.facLevel.setValue(A.Level)}this.facCost.setValue(A.Cost);this.facJoin.setValue(A.JoiningDate);this.facPrevWorkEx.setValue(A.PrevWorkEx);this.facBookRef.setValue(A.BookRef);if(A.LocationIds){this.facLocation.setValue(A.LocationIds)}if(A.QualIds){this.facQual.setValue(A.QualIds)}if(A.SkillIds){this.facSkill.setValue(A.SkillIds)}if(A.ProgramIds){this.facProgramme.setValue(A.ProgramIds)}}},createStores:function(A){this.programmeReader=new Wtf.data.Record.create([{name:"programid"},{name:"programname"}]);this.programmeStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.programmeReader)});this.locationReader=new Wtf.data.Record.create([{name:"locid"},{name:"locname"}]);this.locationStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.locationReader)});this.levelReader=new Wtf.data.Record.create([{name:"levelid"},{name:"levelname"}]);this.levelStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.levelReader)});this.qualReader=new Wtf.data.Record.create([{name:"qualid"},{name:"qualname"}]);this.qualStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.qualReader)});this.skillReader=new Wtf.data.Record.create([{name:"skillid"},{name:"skillname"}]);this.skillStore=new Wtf.data.Store({url:"jspfiles/admin/getMasterData.jsp",method:"POST",reader:new Wtf.data.JsonReader({root:"data"},this.skillReader)})},setPerformValues:function(A){if(A.info.length>0){this.sal.setValue(A.info[0].salutation);this.idType.setValue(A.info[0].idtypenum);this.idNumber.setValue(A.info[0].idnumber);this.userid.setValue(A.info[0].username);this.fName.setValue(A.info[0].fname);this.lName.setValue(A.info[0].lname);this.facDob.setValue(A.info[0].dob);this.religion.setValue(A.info[0].religion);this.race.setValue(A.info[0].race);this.nationality.setValue(A.info[0].nationality);if(A.info[0].nationalityname=="MALAYSIAN"){this.race.enable()}this.country.setValue(A.info[0].country);if(A.info[0].countryname=="Malaysia"){this.state.enable();this.ostate.disable();this.state.setValue(A.info[0].state)}else{this.state.disable();this.ostate.enable();this.ostate.setValue(A.info[0].state)}this.city.setValue(A.info[0].city);this.address.setValue(A.info[0].add);this.postcode.setValue((A.info[0].postcode==""?0:A.info[0].postcode));this.phone.setValue(A.info[0].contactno);this.fax.setValue(A.info[0].fax);this.mobile.setValue(A.info[0].mobile);this.email.setValue(A.info[0].emailid);this.locale.setValue(A.info[0].timezone);this.about.setValue(A.info[0].aboutme);this.dlno.setValue(A.info[0].dlno);this.oid.setValue(A.info[0].oid);this.paddress.setValue(A.info[0].paddr)}},phoneValidator:function(A){return true},addPer:function(){this.loadMask=new Wtf.LoadMask(this.id,{msg:"loading..."});this.loadMask.show();Wtf.Ajax.request({url:"jspfiles/profilePage.jsp",method:"POST",scope:this,params:{userid:(this.facId)?this.facId:loginid},success:function(response,options){var responseObj=eval("("+response.responseText+")");var text="Edit";var createuserForm=null;this.setPerformValues(responseObj);if(isRoleGroup("2")||(this.parentid)){this.setFormValues(responseObj)}this.loadMask.hide()},failure:function(request,response){this.loadMask.hide()}})},subPer:function(){if(this.per.form.isValid()){this.per.form.submit({useraction:1,scope:this,params:{locale:this.locale.getValue(),salutation:this.sal.getValue(),country:this.country.getValue(),state:this.state.getValue(),religion:this.religion.getValue(),nationality:this.nationality.getValue(),idtype:this.idType.getValue(),race:this.race.getValue(),idnumber:this.idNumber.getValue(),username:this.userid.getValue(),oid:this.oid.getValue(),fname:this.fName.getValue(),lname:this.lName.getValue()},success:function(B,A){this.close();Wtf.MessageBox.alert("Status","Details saved successfully.")},failure:function(B,A){Wtf.MessageBox.alert("Status","An error occurred while connecting to server.")}})}else{msgBoxShow(["Validation Failure","Some fields in the Personal Details tab are invalid."],Wtf.MessageBox.ERROR)}}});Wtf.changePassWin=function(A){Wtf.apply(this,A);Wtf.changePassWin.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:250,title:"Change Password",buttons:[{text:"Change",scope:this,handler:function(){if(this.pass.form.isValid()){if(this.newPass.getValue()==this.cNewPass.getValue()){this.pass.form.submit({waitMsg:"Loading...",scope:this,params:{action:"pass"},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){var D=Wtf.decode(B.response.responseText);if(D.flag!=null){if(D.flag==1){Wtf.Msg.alert("Alert","Please enter the correct old password",function(E){if(E=="ok"){}},this)}else{Wtf.Msg.alert("Alert","Password changed successfully",function(E){if(E=="ok"){this.close()}},this)}}}})}else{Wtf.Msg.alert("Alert","Entered passwords do not match",function(B){if(B=="ok"){}},this)}}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Change Password","Enter password details")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.pass=new Wtf.form.FormPanel({url:"jspfiles/admin/getMasterData.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:160,items:[this.oldPass=new Wtf.form.TextField({allowBlank:false,fieldLabel:"Old Password*",name:"oldpass",inputType:"password"}),this.newPass=new Wtf.form.TextField({allowBlank:false,fieldLabel:"New Password*",name:"newpass",inputType:"password"}),this.cNewPass=new Wtf.form.TextField({allowBlank:false,fieldLabel:"Confirm New Password*",name:"newpass",inputType:"password"})]})]}]})};Wtf.extend(Wtf.changePassWin,Wtf.Window,{});Wtf.passwordPolicy=function(A){Wtf.apply(this,A);Wtf.passwordPolicy.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:315,title:"Password Policy",buttons:[{text:"Set",scope:this,handler:function(){if(this.passPolicy.form.isValid()){this.passPolicy.form.submit({waitMsg:"Loading...",scope:this,params:{action:"policy"},success:function(C,B){Wtf.Msg.alert("Alert","Password policy rules set successfully",function(D){if(D=="ok"){this.close()}},this)},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Password Policy","Set values for policy parameters")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.passPolicy=new Wtf.form.FormPanel({url:"jspfiles/admin/getMasterData.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:130,layout:"column",items:[{columnWidth:1,border:false,layout:"form",height:115,items:[this.minchar=new Wtf.form.NumberField({name:"minchar",allowBlank:false,fieldLabel:"Minimum Characters*",allowBlank:false,allowNegative:false,value:0}),this.maxchar=new Wtf.form.NumberField({name:"maxchar",allowBlank:false,fieldLabel:"Maximum Characters*",allowBlank:false,allowNegative:false,value:0}),this.minnum=new Wtf.form.NumberField({name:"minnum",allowBlank:false,fieldLabel:"Minimum Numbers*",allowBlank:false,allowNegative:false,value:0}),this.minalpha=new Wtf.form.NumberField({name:"minalpha",allowBlank:false,fieldLabel:"Minimum alphabets*",allowBlank:false,allowNegative:false,value:0})]},{columnWidth:1,layout:"column",labelWidth:0,border:false,height:30,items:[{columnWidth:0.5,border:false,layout:"form",items:[this.specialchars=new Wtf.form.Checkbox({name:"specchars",boxLabel:"Special Characters",labelSeparator:""})]},{columnWidth:0.5,border:false,layout:"form",items:[this.appPolicy=new Wtf.form.Checkbox({name:"appPolicy",boxLabel:"Apply Password Policy",labelSeparator:""})]}]}]})]}]})};Wtf.extend(Wtf.passwordPolicy,Wtf.Window,{});Wtf.SystemTimezone=function(A){if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}Wtf.apply(this,A);Wtf.SystemTimezone.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:200,buttons:[{text:"Set",scope:this,handler:function(){if(this.pass.form.isValid()){Wtf.Ajax.request({url:"jspfiles/admin/getMasterData.jsp",method:"POST",scope:this,params:{action:"tzone",id:this.tzone.getValue()},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){Wtf.Msg.alert("Alert","Timezone set successfully",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Set System Time Zone","Select a time zone for the system")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:20px",items:[this.pass=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,labelWidth:75,items:[this.tzone=new Wtf.form.ComboBox({fieldLabel:"Time Zone*",editable:false,store:Wtf.timezoneStore,displayField:"name",valueField:"id",typeAhead:true,mode:"local",width:215,triggerAction:"all",selectOnFocus:true,allowBlank:false,blankText:"Select a time zone"})]})]}]})};Wtf.extend(Wtf.SystemTimezone,Wtf.Window,{});Wtf.Feedback=function(A){Wtf.apply(this,A);Wtf.Feedback.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:350,modal:true,height:200,buttons:[{text:"Set",scope:this,handler:function(){if(this.pass.form.isValid()){Wtf.Ajax.request({url:"jspfiles/admin/getMasterData.jsp",method:"POST",scope:this,params:{action:"setfeedback",value:this.displayFeed.getValue()},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){Wtf.Msg.alert("Alert","Status set successfully",function(D){if(D=="ok"){this.close()}},this)}})}}},{text:"Cancel",scope:this,handler:function(){this.close()}}],layout:"border",items:[{region:"north",border:false,height:90,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Allow Feedback","Allow employees to submit feedback.")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:20px",items:[this.pass=new Wtf.form.FormPanel({waitMsgTarget:true,method:"POST",border:false,labelWidth:100,items:[this.displayFeed=new Wtf.form.Checkbox({fieldLabel:"Allow feedback?"})]})]}]})};Wtf.extend(Wtf.Feedback,Wtf.Window,{onRender:function(A){Wtf.Feedback.superclass.onRender.call(this,A);Wtf.Ajax.request({url:"jspfiles/admin/getMasterData.jsp",method:"POST",scope:this,params:{action:"getfeedback"},failure:function(C,B){Wtf.Msg.alert("Error","Error connecting to server",function(D){if(D=="ok"){this.close()}},this)},success:function(C,B){this.displayFeed.setValue(Wtf.decode(C.responseText))}})}});Wtf.personalPref=function(A){Wtf.apply(this,A);this.dt=new Date();this.dt.format(Date.patterns.ShortDate);this.dtStore=new Wtf.data.SimpleStore({data:[[this.dt.format(Date.patterns.ISO8601Short),"1"],[this.dt.format(Date.patterns.ShortDate),"2"],[this.dt.format(Date.patterns.LongDate),"3"],[this.dt.format(Date.patterns.MonthDay),"5"],[this.dt.format(Date.patterns.YearMonth),"10"],[this.dt.format(Date.patterns.Kdate1),"11"],[this.dt.format(Date.patterns.Kdate2),"12"],[this.dt.format(Date.patterns.Kdate3),"13"],[this.dt.format(Date.patterns.Kdate4),"14"]],fields:["name","id"],reader:new Wtf.data.ArrayReader({},[{name:"name"},{name:"id"}]),autoLoad:true});if(!Wtf.StoreMgr.containsKey("timezone")){Wtf.timezoneStore.load();Wtf.StoreMgr.add("timezone",Wtf.timezoneStore)}Wtf.personalPref.superclass.constructor.call(this,{iconCls:"winicon",resizable:false,width:400,modal:true,plain:true,height:215,keys:{key:[10,13],fn:this.handleKey,scope:this},title:"Personal Preferences",items:[{region:"north",height:75,border:false,bodyStyle:"background:white;border-bottom:1px solid #bfbfbf;",html:getHeader("images/ack40.gif","Personal Preferences","Set your personal preferences")},{region:"center",layout:"fit",border:false,bodyStyle:"background:#f1f1f1;border-bottom:1px solid #bfbfbf;padding:10px",items:[this.pp=new Wtf.form.FormPanel({url:"jspfiles/savePref.jsp",waitMsgTarget:true,method:"POST",border:false,labelWidth:100,defaultType:"textfield",items:[this.dtCombo=new Wtf.form.ComboBox({xtype:"combo",fieldLabel:"Date Format*",hiddenName:"factype",store:this.dtStore,readOnly:true,displayField:"name",valueField:"id",value:Wtf.pref.DateFormat,editable:false,name:"dateformat",mode:"local",triggerAction:"all",emptyText:"Select a type...",allowBlank:false,anchor:"98%"}),this.locale=new Wtf.form.ComboBox({fieldLabel:"Time Zone*",mode:"local",scope:this,triggerAction:"all",typeAhead:true,value:Wtf.pref.Timezone,editable:false,name:"timezone",blankText:"Select a time zone",store:Wtf.timezoneStore,displayField:"name",valueField:"id",allowBlank:false,anchor:"98%"})]})]}],buttons:[{text:"OK",scope:this,handler:function(){this.handleKey()}},{text:"Cancel",scope:this,handler:function(){this.close()}}]})};Wtf.extend(Wtf.personalPref,Wtf.Window,{onRender:function(A){Wtf.personalPref.superclass.onRender.call(this,A);Wtf.timezoneStore.on("load",function(){this.locale.setValue(Wtf.pref.Timezone)},this)},handleKey:function(){if(this.pp.form.isValid()){this.pp.form.submit({scope:this,params:{dateformat:this.dtCombo.getValue(),timezone:this.locale.getValue()},success:function(B,A){msgBoxShow(["Success","Preferences saved successfully"],Wtf.MessageBox.INFO);var C=Wtf.getCmp("ascalctrl");if(C){if(C.weekWin){Wtf.each(C.weekWin.buttons,function(D){D.purgeListeners()});C.weekWin.destroy();C.weekWin=null}if(C.apptForm){C.apptForm.destroy();C.apptForm=null}}},failure:function(B,A){msgBoxShow(["Failure","Error connecting to Server"],Wtf.MessageBox.ERROR)}})}Wtf.pref.DateFormat=this.dtCombo.getValue();Wtf.pref.Timezone=this.locale.getValue();this.close()}})