[ { name : 'tablewidgt', type : 'TabWidget', property : {}, pack : {stretch:1}, child : [ { name : 'userinfo_page', type : 'ScrollArea', property : { widgetResizable:true, frameShape: 'QFrame::NoFrame'}, pack : {label:self.ttr("User Information")}, child : { name : 'formlayout', type : 'FormLayout', property : {labelAlignment:'Qt::AlignRight',margin : 20,verticalSpacing : 10,horizontalSpacing :20}, pack : {}, child : [ { name : 'id', type : 'LineEdit', title : self.ttr('ID'), property : {enabled:false}, pack : {label: self.ttr('ID')}, }, { name : 'name', type : 'LineEdit', title : self.ttr('Login Name'), property : {}, pack : {label: self.ttr('Login Name')}, validate: function(obj,val,title,moment,self){ if (val.trim() == ''){ return [title + self.ttr(" can not be null!"),'Error']; } else if (! val.match(new RegExp('^[a-z0-9_]+$'))){ return [title + self.ttr(" can only contain [a-z0-9]!"),'Error']; } return; }, }, { name : 'fullname', type : 'LineEdit', title : self.ttr('Full Name'), property : {}, pack : {label: self.ttr('Full Name')}, }, { name : 'cardid', type : 'LineEdit', title : self.ttr('Card ID'), property : {}, pack : {label: self.ttr('Card ID')}, validate: function(obj,val,title,moment,self){ if (val.match(new RegExp('[a-zA-Z0-9]+$')) || val == ''){ return ; } else{ return [title+self.ttr(" illegal input!!"),'ERROR']; } }, }, { name : 'staffid', type : 'LineEdit', title : self.ttr('Staff ID'), property : {}, pack : {label: self.ttr('Staff ID')}, }, { name : 'mail', type : 'LineEdit', title : self.ttr('Mail'), property : {}, validate: function(obj,val,title,moment){ if (val != ''){ //var myregex = new RegExp('^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?$'); var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!filter.test(val)){ return [self.ttr("invalid mail format;"),'ERROR'] } } }, pack : {label: self.ttr('Mail')}, }, { name : 'work_phone', type : 'LineEdit', title : self.ttr('Work Phone'), property : {}, pack : {label: self.ttr('Work Phone')}, }, { name : 'cell_phone', type : 'LineEdit', title : self.ttr('Cell Phone'), property : {}, pack : {label: self.ttr('Cell Phone')}, validate: function(obj,val,title,moment,self){ if (val.match(new RegExp('[0-9]+$')) || val == ''){ return ; } else{ return [title+self.ttr("illegal input!"),'ERROR']; } }, }, { name : 'password', type : 'LineEdit', title : self.ttr('Password'), property : {echoMode:'QLineEdit::Password'}, pack : {label: self.ttr('Password')}, }, { name : 'department', type : 'ComboBox', title : self.ttr('Department'), property : { itemList : TOPENM.enumList("Sys_Department").toComboList() }, pack : { label : self.ttr('Department') }, }, { name : 'status', type : 'ComboBox', title : self.ttr('Status'), property : { itemList: TOPENM.enumList("Sys_UserStatus").toComboList() }, pack : {label: self.ttr('Status')}, validate: function(obj,val,title,moment,self){ if (val.trim() == ''){ return [title + self.ttr(" can not be null!"),'Error']; } } }, { name : 'product_category', type : 'MultiComboBox', title : self.ttr('Category'), property : { nameFormat: "|A|B|", itemList: TOPENM.enumList("Sys_ProductCategory").toComboList() }, pack : {label: self.ttr('Category')}, validate: '', state: function(obj,self){ if ((self.config("productCategory") != "") && (self.config("productCategory") != undefined) && (self.config("productCategory").length == 1)) { return "Hide"; } else { return "Show"; } }, }, { name : 'tag', type : 'LineEdit', title : self.ttr('Tag'), property : { }, pack : {label: self.ttr('Tag')}, }, { name : 'remark', type : 'PlainTextEdit', title : self.ttr('Remark'), property : { verticalScrollBarPolicy:'Qt::ScrollBarAlwaysOff'}, pack : {label: self.ttr('Remark')}, }, ] } }, { name : 'ROLE_PAGE', type : 'VBoxLayout', property : {spacing:0, margin:0}, pack : {label:self.ttr("Role")}, child : [ { name : 'role_toolbar', type : 'ToolBar', property : {toolButtonStyle:'Qt::ToolButtonTextBesideIcon'}, pack : {}, child : [ { name : 'act_add_role', type: 'Action' , property : {text:self.ttr('Add Role'),icon:'add_list',shortcut:'',tooltip:''}, callback : function(obj,checked,self) { self.showAddRoleDialog(); }, }, { name : 'act_remove_role', type: 'Action' , property : {text:self.ttr('Remove Role'),icon:'remove_list',shortcut:'',tooltip:''}, callback : function(obj,checked,self) { if (TMessageBox.msgbox(self,self.ttr("Are you sure to delete selected roles?"), '', 'Question',self.ttr("Question"),["Yes","No"]) == 'Yes') { this.getObject('ROLE_LIST').removeSelectedRows(); } }, }, ] }, { name : 'ROLE_LIST', type : 'TableView', property : {}, pack : {}, initCallback : function(obj){ obj.setHeaderItem( [ { name : 'id', displayRole : '$id'}, { name : 'name', display:self.ttr('Role Name'),displayRole:'$name',resizeMode:'Interactive'}, { name : 'remark', display:self.ttr('Remark'),displayRole:'$remark',resizeMode:'Stretch'}, ] ); obj.setDataKeyList(["id","name","remark"]); }, } ] } ] }, ]