"name" : "Pman.Dialog.BAdminStaff",
"parent" : "",
"title" : "",
- "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminStaff.bjs",
+ "path" : "/home/alan/gitlive/Pman.BAdmin/Pman.Dialog.BAdminStaff.bjs",
"permname" : "",
"modOrder" : "001",
"strings" : {
"ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
- "566a352f95c879ff26e50bad767a28dc" : "Group Membership",
- "4910043d0b2c8c864a0e8672716fee94" : "Is a Member",
- "28974c2c793e780427dfb571b26443e6" : "Group Name",
"bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
"a0f852ef8bfccd86a0e7217d7959e3e8" : "Add / Edit User",
- "3ec365dd533ddb7ef3d1c111186ce872" : "Details",
"0bfe42db3eb05bf39f03812166391939" : "Use Secure Passwords",
"ea4788705e6873b424c65e91c2846b19" : "Cancel",
"6f958ddaf50fd5ade7858ef1d1a63e51" : "Type again to confirm",
- "49ee3087348e8d44e1feda1917443987" : "Name",
"bbbabdbe1b262f75d99d62880b953be1" : "Role",
+ "49ee3087348e8d44e1feda1917443987" : "Name",
"c9cc8cce247e49bae79f15173ce97354" : "Save",
"828e70f83623b262e14187c039df99c0" : "Enable Two-Factor Authentication",
"acf45fd8829f809b29c601a3a193804f" : "Set / Change Password",
"String cls" : "add-user-dialog",
"string fit_content" : true,
"xtype" : "Modal",
- "int max_width" : 650,
- "string max_height" : 680,
"$ xns" : "Roo.bootstrap",
"String title" : "Add / Edit User",
"items" : [
{
"listeners" : {
- "render" : "function (_self)\n{\n _this.layout = _self;\n}"
+ "actioncomplete" : "function (_self, action)\n{\n if(action.type == 'setdata'){\n \n // _this.layout.showPanel('DetailPanel');\n \n _this.dialog.setTitle(_this.data.id *1 > 0 ? \"Edit User: \" + _this.data.name : 'Add User');\n _this.form.findField('role').setDisabled(false);\n \n /*\n * Use for init -- Call from Pman.Login.js\n */\n if(\n typeof(_this.data.role) != 'undefined' &&\n _this.data.role == 'Administrators'\n ) {\n _this.dialog.setTitle(\"Create Adminstrator\");\n _this.form.findField('role').setDisabled(true);\n }\n \n _this.form.findField('passwd1').el.select('input',true).first().dom.type=\"password\";\n _this.form.findField('passwd2').show();\n _this.passwordbox.collapse();\n \n _this.form.findField('secure_passwords').setValue(1);\n \n if(_this.data.id * 1 > 0) {\n this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});\n }\n \n \n \n this.clearInvalid();\n \n _this.dialog.resize();\n \n return;\n }\n \n if (action.type == 'load') {\n \n _this.data = action.result.data;\n \n // oath handling...\n \n _this.form.findField('_enable_oath_key').setChecked(false,false);\n \n if(_this.data.length_oath_key != '0') {\n _this.form.findField('_enable_oath_key').setChecked(true,false);\n }\n \n return;\n }\n \n if (action.type == 'submit') { // only submitted here if we are \n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(this, action.result.data);\n }\n \n return;\n }\n}",
+ "render" : "function (_self)\n{\n _this.form = this;\n}"
},
- "xtype" : "Border",
- "$ xns" : "Roo.bootstrap.layout",
+ "$ url" : "baseURL + '/Roo/core_person' ",
+ "style" : "margin-top: 20px;",
+ "xtype" : "Form",
+ "String labelAlign" : "top",
+ "$ xns" : "Roo.bootstrap",
+ "string errorMask" : true,
"items" : [
{
- "alwaysShowTabs" : true,
- "String tabPosition" : "top",
- "xtype" : "Region",
- "$ xns" : "Roo.bootstrap.layout",
- "* prop" : "center"
+ "xtype" : "Row",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Number md" : 12,
+ "xtype" : "Column",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Boolean allowBlank" : false,
+ "String name" : "name",
+ "xtype" : "Input",
+ "string placeholder" : "Name",
+ "String labelAlign" : "left",
+ "string fieldLabel" : "Name",
+ "$ xns" : "Roo.bootstrap"
+ }
+ ]
+ }
+ ]
},
{
- "listeners" : {
- "activate" : "function (_self)\n{\n /*var url = 'about:blank';\n \n if(_this.data.id * 1 > 0){\n url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;\n }\n \n _this.app_summary_frame.el.dom.src = url;*/\n}",
- "render" : "function (_self)\n{\n _this.detail_tab = _self;\n}"
- },
- "id" : "DetailPanel",
- "Boolean fitContainer" : true,
- "xtype" : "Content",
- "Boolean fitToFrame" : true,
- "$ xns" : "Roo.bootstrap.panel",
- "String region" : "center",
- "String title" : "Details",
- "Boolean autoScroll" : true,
- "Boolean background" : false,
+ "xtype" : "Row",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Number md" : 12,
+ "xtype" : "Column",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "String name" : "role",
+ "xtype" : "Input",
+ "string placeholder" : "Role",
+ "string fieldLabel" : "Role",
+ "String labelAlign" : "left",
+ "$ xns" : "Roo.bootstrap"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "xtype" : "Row",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Number md" : 12,
+ "xtype" : "Column",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Boolean allowBlank" : false,
+ "String name" : "email",
+ "xtype" : "Input",
+ "vtype" : "email",
+ "string placeholder" : "Email",
+ "String labelAlign" : "left",
+ "string fieldLabel" : "Email",
+ "$ xns" : "Roo.bootstrap"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "xtype" : "Row",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Number md" : 12,
+ "xtype" : "Column",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "String name" : "phone",
+ "xtype" : "Input",
+ "string fieldLabel" : "Phone",
+ "String labelAlign" : "left",
+ "$ xns" : "Roo.bootstrap"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "xtype" : "Row",
+ "$ xns" : "Roo.bootstrap",
"items" : [
{
- "String cls" : "col-md-12",
- "xtype" : "Container",
+ "Number md" : 12,
+ "xtype" : "Column",
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
- "actioncomplete" : "function (_self, action)\n{\n if(action.type == 'setdata'){\n \n _this.layout.showPanel('DetailPanel');\n \n _this.dialog.setTitle(\"Add / Edit User\");\n _this.form.findField('role').setDisabled(false);\n \n /*\n * Use for init -- Call from Pman.Login.js\n */\n if(\n typeof(_this.data.role) != 'undefined' &&\n _this.data.role == 'Administrators'\n ) {\n _this.dialog.setTitle(\"Create Adminstrator\");\n _this.form.findField('role').setDisabled(true);\n }\n \n _this.form.findField('passwd1').el.select('input',true).first().dom.type=\"password\";\n _this.form.findField('passwd2').show();\n _this.passwordbox.collapse();\n \n _this.form.findField('secure_passwords').setValue(1);\n \n if(_this.data.id * 1 > 0) {\n this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});\n }\n \n \n \n this.clearInvalid();\n \n _this.dialog.resize();\n \n return;\n }\n \n if (action.type == 'load') {\n \n _this.data = action.result.data;\n \n // oath handling...\n \n _this.form.findField('_enable_oath_key').setChecked(false,false);\n \n if(_this.data.length_oath_key != '0') {\n _this.form.findField('_enable_oath_key').setChecked(true,false);\n }\n \n return;\n }\n \n if (action.type == 'submit') { // only submitted here if we are \n \n _this.dialog.hide();\n \n if (_this.callback) {\n _this.callback.call(this, action.result.data);\n }\n \n return;\n }\n}",
- "render" : "function (_self)\n{\n _this.form = this;\n}"
+ "click" : "function (_self, e)\n{\n if(!Pman.Login.authUser) {\n Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n return;\n }\n \n e.preventDefault();\n \n if(!this.checked) {\n \n Pman.Dialog.BAdminStaffTwoFactorQRCode.show({\n id: _this.data.id,\n allow_close: false,\n allow_cancel : true\n }, function(valid){\n if(valid) {\n _this.dialog.hide({});\n return;\n }\n \n _this.form.findField('_enable_oath_key').setChecked(false,false);\n }\n );\n \n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Core_person',\n method :'GET',\n params : {\n oath_key_disable: 1,\n id: _this.data.id\n },\n success : function(res)\n {\n switch(res.data) {\n case 'DONE':\n Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');\n break;\n default:\n Roo.log('invalid usage');\n break;\n }\n },\n failure : function(res)\n {\n Roo.bootstrap.MessageBox.alert('Error', res);\n }\n });\n}",
+ "check" : "function (_self, checked)\n{\n if(checked) {\n \n this.setBoxLabel('Untick to disable Two Factor authentication');\n \n return;\n }\n \n this.setBoxLabel('Enable Two Factor Authentication');\n}"
},
- "$ url" : "baseURL + '/Roo/core_person' ",
- "xtype" : "Form",
- "style" : "margin-top: 20px;",
- "String labelAlign" : "top",
+ "String name" : "_enable_oath_key",
+ "xtype" : "CheckBox",
+ "String boxLabel" : "Enable Two-Factor Authentication",
+ "$ xns" : "Roo.bootstrap"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "xtype" : "Row",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "Number md" : 12,
+ "xtype" : "Column",
+ "$ xns" : "Roo.bootstrap",
+ "items" : [
+ {
+ "listeners" : {
+ "render" : "function (_self)\n{\n _this.passwordbox = this;\n}"
+ },
+ "String header" : "Set / Change Password",
+ "Boolean expanded" : false,
+ "xtype" : "Container",
+ "String panel" : "primary",
"$ xns" : "Roo.bootstrap",
- "string errorMask" : true,
+ "Boolean expandable" : true,
"items" : [
{
"xtype" : "Row",
"$ xns" : "Roo.bootstrap",
"items" : [
{
- "Number md" : 12,
"xtype" : "Column",
+ "Number xs" : 8,
"$ xns" : "Roo.bootstrap",
"items" : [
{
- "Boolean allowBlank" : false,
- "String name" : "name",
+ "String name" : "passwd1",
"xtype" : "Input",
- "string placeholder" : "Name",
- "String labelAlign" : "left",
- "string fieldLabel" : "Name",
+ "String inputType" : "password",
"$ xns" : "Roo.bootstrap"
}
]
- }
- ]
- },
- {
- "xtype" : "Row",
- "$ xns" : "Roo.bootstrap",
- "items" : [
+ },
{
- "Number md" : 12,
- "xtype" : "Column",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "String name" : "role",
- "xtype" : "Input",
- "string placeholder" : "Role",
- "string fieldLabel" : "Role",
- "String labelAlign" : "left",
- "$ xns" : "Roo.bootstrap"
- }
- ]
- }
- ]
- },
- {
- "xtype" : "Row",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "Number md" : 12,
- "xtype" : "Column",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "Boolean allowBlank" : false,
- "String name" : "email",
- "xtype" : "Input",
- "vtype" : "email",
- "string placeholder" : "Email",
- "String labelAlign" : "left",
- "string fieldLabel" : "Email",
- "$ xns" : "Roo.bootstrap"
- }
- ]
- }
- ]
- },
- {
- "xtype" : "Row",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "Number md" : 12,
- "xtype" : "Column",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "String name" : "phone",
- "xtype" : "Input",
- "string fieldLabel" : "Phone",
- "String labelAlign" : "left",
- "$ xns" : "Roo.bootstrap"
- }
- ]
- }
- ]
- },
- {
- "xtype" : "Row",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "Number md" : 12,
"xtype" : "Column",
+ "Number xs" : 4,
"$ xns" : "Roo.bootstrap",
"items" : [
{
"listeners" : {
- "check" : "function (_self, checked)\n{\n if(checked) {\n \n this.setBoxLabel('Untick to disable Two Factor authentication');\n \n return;\n }\n \n this.setBoxLabel('Enable Two Factor Authentication');\n}",
- "click" : "function (_self, e)\n{\n if(!Pman.Login.authUser) {\n Roo.bootstrap.MessageBox.alert('Error', 'Please login again');\n return;\n }\n \n e.preventDefault();\n \n if(!this.checked) {\n \n Pman.Dialog.BAdminStaffTwoFactorQRCode.show({\n id: _this.data.id,\n allow_close: false,\n allow_cancel : true\n }, function(valid){\n if(valid) {\n _this.dialog.hide({});\n return;\n }\n \n _this.form.findField('_enable_oath_key').setChecked(false,false);\n }\n );\n \n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Core_person',\n method :'GET',\n params : {\n oath_key_disable: 1,\n id: _this.data.id\n },\n success : function(res)\n {\n switch(res.data) {\n case 'DONE':\n Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');\n break;\n default:\n Roo.log('invalid usage');\n break;\n }\n },\n failure : function(res)\n {\n Roo.bootstrap.MessageBox.alert('Error', res);\n }\n });\n}"
+ "click" : "function (_self, e)\n{\n var pw = Math.random().toString(36).replace('0.', '');\n _this.form.findField('passwd1').el.select('input',true).first().dom.type=\"input\";\n _this.form.findField('passwd1').setValue(pw);\n _this.form.findField('passwd2').hide();\n}"
},
- "String name" : "_enable_oath_key",
- "xtype" : "CheckBox",
- "String boxLabel" : "Enable Two-Factor Authentication",
- "$ xns" : "Roo.bootstrap"
- }
- ]
- }
- ]
- },
- {
- "xtype" : "Row",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "Number md" : 12,
- "xtype" : "Column",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "listeners" : {
- "render" : "function (_self)\n{\n _this.passwordbox = this;\n}"
- },
- "String header" : "Set / Change Password",
- "Boolean expanded" : false,
- "xtype" : "Container",
- "String panel" : "primary",
+ "xtype" : "Button",
"$ xns" : "Roo.bootstrap",
- "Boolean expandable" : true,
- "items" : [
- {
- "xtype" : "Row",
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "xtype" : "Column",
- "Number xs" : 8,
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "String name" : "passwd1",
- "xtype" : "Input",
- "String inputType" : "password",
- "$ xns" : "Roo.bootstrap"
- }
- ]
- },
- {
- "xtype" : "Column",
- "Number xs" : 4,
- "$ xns" : "Roo.bootstrap",
- "items" : [
- {
- "listeners" : {
- "click" : "function (_self, e)\n{\n var pw = Math.random().toString(36).replace('0.', '');\n _this.form.findField('passwd1').el.select('input',true).first().dom.type=\"input\";\n _this.form.findField('passwd1').setValue(pw);\n _this.form.findField('passwd2').hide();\n}"
- },
- "xtype" : "Button",
- "$ xns" : "Roo.bootstrap",
- "String html" : "Generate One",
- "String style" : "width:100%"
- }
- ]
- }
- ]
- },
- {
- "String name" : "passwd2",
- "xtype" : "Input",
- "string placeholder" : "Type again to confirm",
- "String inputType" : "password",
- "$ xns" : "Roo.bootstrap"
- },
- {
- "String name" : "secure_passwords",
- "xtype" : "CheckBox",
- "String boxLabel" : "Use Secure Passwords",
- "$ xns" : "Roo.bootstrap"
- }
- ]
+ "String html" : "Generate One",
+ "String style" : "width:100%"
}
]
}
]
},
{
- "listeners" : {
- "render" : "function (_self)\n{\n _this.userID = _self;\n}"
- },
- "String name" : "id",
+ "String name" : "passwd2",
"xtype" : "Input",
- "String labelAlign" : "left",
- "String inputType" : "hidden",
+ "string placeholder" : "Type again to confirm",
+ "String inputType" : "password",
"$ xns" : "Roo.bootstrap"
},
{
- "String name" : "company_id",
- "xtype" : "Input",
- "String inputType" : "hidden",
+ "String name" : "secure_passwords",
+ "xtype" : "CheckBox",
+ "String boxLabel" : "Use Secure Passwords",
"$ xns" : "Roo.bootstrap"
}
]
},
{
"listeners" : {
- "activate" : "function (_self)\n{\n if(_this.option_grid){\n _this.option_grid.store.load({});\n }\n \n}",
- "render" : "function (_self)\n{\n _this.option_panel = this;\n \n \n}"
+ "render" : "function (_self)\n{\n _this.userID = _self;\n}"
},
- "fitToFrame" : true,
- "xtype" : "Grid",
- "String region" : "center",
- "$ xns" : "Roo.bootstrap.panel",
- "fitContainer" : true,
- "String title" : "Group Membership",
- "Boolean background" : true,
- "items" : [
- {
- "listeners" : {
- "cellclick" : "function (_self, el, rowIndex, columnIndex, e)\n{\n var di = _this.option_grid.colModel.getDataIndex(columnIndex);\n \n /*\n if (di != 'is_in_group') {\n return;\n }\n */\n var rec = _this.option_grid.store.getAt(rowIndex);\n \n if(rec.data.name == 'Administrators' && _this.data.id == Pman.Login.authUser.id){\n Roo.bootstrap.MessageBox.alert('Error', 'You can not remove yourself from Administrators group');\n return;\n }\n \n rec.set('is_in_group', rec.data.is_in_group * 1 == 1 ? 0 : 1);\n rec.commit();\n\n}",
- "render" : "function (_self)\n{\n _this.option_grid = this;\n \n this.store.load({})\n}"
- },
- "Boolean footerShow" : false,
- "String cls" : "table-fixed",
- "xtype" : "Table",
- "$ xns" : "Roo.bootstrap",
- "cellSelection" : true,
- "Boolean loadMask" : true,
- "* prop" : "grid",
- "boolean condensed" : true,
- "rowSelection" : false,
- "items" : [
- {
- "Boolean singleSelect" : true,
- "xtype" : "RowSelectionModel",
- "$ xns" : "Roo.bootstrap.Table",
- "* prop" : "sm"
- },
- {
- "listeners" : {
- "update" : "function (_self, record, operation)\n{\n if (operation != 'commit') {\n return;\n }\n \n var params = {\n user_ids : _this.data.id,\n _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',\n group_id : record.data.id\n };\n \n new Pman.Request({\n url : baseURL + '/Roo/Core_group',\n method : 'POST',\n params : params,\n success : function() { \n //_this.option_grid.ds.load({});\n }\n });\n}",
- "beforeload" : "function (_self, options)\n{ \n options.params = options.params || {};\n \n if(_this.data.id * 1 < 1){\n _this.option_grid.el.mask('Please save the member first');\n this.removeAll();\n return false;\n }\n \n options.params._is_in_group = _this.data.id;\n\n}"
- },
- "$ Object sortInfo" : "{ direction : 'ASC', field: 'id' }",
- "xtype" : "Store",
- "boolean remoteSort" : true,
- "$ xns" : "Roo.data",
- "* prop" : "store",
- "items" : [
- {
- "$ url" : "baseURL + '/Roo/core_group'",
- "xtype" : "HttpProxy",
- "$ xns" : "Roo.data",
- "String method" : "GET",
- "* prop" : "proxy"
- },
- {
- "$ Array fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'display_name',\n 'type': 'string'\n },\n {\n 'name': 'is_in_group',\n 'type': 'int'\n }\n]",
- "xtype" : "JsonReader",
- "String root" : "data",
- "$ xns" : "Roo.data",
- "String id" : "id",
- "* prop" : "reader"
- }
- ]
- },
- {
- "String header" : "Is a Member",
- "String cursor" : "pointer",
- "String dataIndex" : "is_in_group",
- "xtype" : "ColumnModel",
- "Number xs" : 3,
- "String align" : "center",
- "$ xns" : "Roo.grid",
- "$ renderer" : "function(v) { \n\n var state = v > 0 ? 'check-' : '';\n var cls = v > 0 ? 'text-primary' : '';\n \n return '<i class=\\\"far fa-'+ state + 'square-o ' + cls + '\\\" aria-hidden=\\\"true\\\"></i>';\n \n }",
- "Boolean sortable" : false,
- "* prop" : "cm[]"
- },
- {
- "String header" : "Group Name",
- "cursor" : "pointer",
- "String dataIndex" : "display_name",
- "xtype" : "ColumnModel",
- "Number xs" : 9,
- "$ xns" : "Roo.grid",
- "$ renderer" : "function(v,x,r) \n{\n var vv = v.length ? v : r.data.name;\n \n return String.format('{0}', vv);\n}",
- "Boolean sortable" : true,
- "* prop" : "cm[]"
- }
- ]
- }
- ]
+ "String name" : "id",
+ "xtype" : "Input",
+ "String labelAlign" : "left",
+ "String inputType" : "hidden",
+ "$ xns" : "Roo.bootstrap"
+ },
+ {
+ "String name" : "company_id",
+ "xtype" : "Input",
+ "String inputType" : "hidden",
+ "$ xns" : "Roo.bootstrap"
}
]
},
_strings : {
'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
- '566a352f95c879ff26e50bad767a28dc' :"Group Membership",
- '4910043d0b2c8c864a0e8672716fee94' :"Is a Member",
- '28974c2c793e780427dfb571b26443e6' :"Group Name",
'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
'a0f852ef8bfccd86a0e7217d7959e3e8' :"Add / Edit User",
- '3ec365dd533ddb7ef3d1c111186ce872' :"Details",
'0bfe42db3eb05bf39f03812166391939' :"Use Secure Passwords",
'ea4788705e6873b424c65e91c2846b19' :"Cancel",
'6f958ddaf50fd5ade7858ef1d1a63e51' :"Type again to confirm",
- '49ee3087348e8d44e1feda1917443987' :"Name",
'bbbabdbe1b262f75d99d62880b953be1' :"Role",
+ '49ee3087348e8d44e1feda1917443987' :"Name",
'c9cc8cce247e49bae79f15173ce97354' :"Save",
'828e70f83623b262e14187c039df99c0' :"Enable Two-Factor Authentication",
'acf45fd8829f809b29c601a3a193804f' :"Set / Change Password",
this.callback = cb;
this.data = data;
- this.dialog.show(this.data._el);
+ this.dialog.show.apply(this.dialog, Array.prototype.slice.call(arguments).slice(2));
if (this.form) {
this.form.reset();
this.form.setValues(data);
xtype : 'Modal',
cls : 'add-user-dialog',
fit_content : true,
- max_height : 680,
- max_width : 650,
title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
listeners : {
render : function (_self)
],
items : [
{
- xtype : 'Border',
+ xtype : 'Form',
+ errorMask : true,
+ labelAlign : 'top',
+ style : 'margin-top: 20px;',
+ url : baseURL + '/Roo/core_person',
listeners : {
+ actioncomplete : function (_self, action)
+ {
+ if(action.type == 'setdata'){
+
+ // _this.layout.showPanel('DetailPanel');
+
+ _this.dialog.setTitle(_this.data.id *1 > 0 ? "Edit User: " + _this.data.name : 'Add User');
+ _this.form.findField('role').setDisabled(false);
+
+ /*
+ * Use for init -- Call from Pman.Login.js
+ */
+ if(
+ typeof(_this.data.role) != 'undefined' &&
+ _this.data.role == 'Administrators'
+ ) {
+ _this.dialog.setTitle("Create Adminstrator");
+ _this.form.findField('role').setDisabled(true);
+ }
+
+ _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
+ _this.form.findField('passwd2').show();
+ _this.passwordbox.collapse();
+
+ _this.form.findField('secure_passwords').setValue(1);
+
+ if(_this.data.id * 1 > 0) {
+ this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
+ }
+
+
+
+ this.clearInvalid();
+
+ _this.dialog.resize();
+
+ return;
+ }
+
+ if (action.type == 'load') {
+
+ _this.data = action.result.data;
+
+ // oath handling...
+
+ _this.form.findField('_enable_oath_key').setChecked(false,false);
+
+ if(_this.data.length_oath_key != '0') {
+ _this.form.findField('_enable_oath_key').setChecked(true,false);
+ }
+
+ return;
+ }
+
+ if (action.type == 'submit') { // only submitted here if we are
+
+ _this.dialog.hide();
+
+ if (_this.callback) {
+ _this.callback.call(this, action.result.data);
+ }
+
+ return;
+ }
+ },
render : function (_self)
{
- _this.layout = _self;
+ _this.form = this;
}
},
- xns : Roo.bootstrap.layout,
- '|xns' : 'Roo.bootstrap.layout',
- center : {
- xtype : 'Region',
- alwaysShowTabs : true,
- tabPosition : 'top',
- xns : Roo.bootstrap.layout,
- '|xns' : 'Roo.bootstrap.layout'
- },
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
items : [
{
- xtype : 'Content',
- autoScroll : true,
- background : false,
- fitContainer : true,
- fitToFrame : true,
- id : 'DetailPanel',
- region : 'center',
- title : _this._strings['3ec365dd533ddb7ef3d1c111186ce872'] /* Details */,
- listeners : {
- activate : function (_self)
- {
- /*var url = 'about:blank';
-
- if(_this.data.id * 1 > 0){
- url = baseURL + '/Coba/Report/ApplicationSummary/' + _this.data.id;
- }
-
- _this.app_summary_frame.el.dom.src = url;*/
- },
- render : function (_self)
- {
- _this.detail_tab = _self;
- }
- },
- xns : Roo.bootstrap.panel,
- '|xns' : 'Roo.bootstrap.panel',
+ xtype : 'Row',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
items : [
{
- xtype : 'Container',
- cls : 'col-md-12',
+ xtype : 'Column',
+ md : 12,
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
items : [
{
- xtype : 'Form',
- errorMask : true,
- labelAlign : 'top',
- style : 'margin-top: 20px;',
- url : baseURL + '/Roo/core_person',
+ xtype : 'Input',
+ allowBlank : false,
+ fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+ labelAlign : 'left',
+ name : 'name',
+ placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ xtype : 'Row',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Column',
+ md : 12,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Input',
+ fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
+ labelAlign : 'left',
+ name : 'role',
+ placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ xtype : 'Row',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Column',
+ md : 12,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Input',
+ allowBlank : false,
+ fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
+ labelAlign : 'left',
+ name : 'email',
+ placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
+ vtype : 'email',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ xtype : 'Row',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Column',
+ md : 12,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Input',
+ fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
+ labelAlign : 'left',
+ name : 'phone',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ xtype : 'Row',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Column',
+ md : 12,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'CheckBox',
+ boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
+ name : '_enable_oath_key',
listeners : {
- actioncomplete : function (_self, action)
+ check : function (_self, checked)
{
- if(action.type == 'setdata'){
-
- _this.layout.showPanel('DetailPanel');
-
- _this.dialog.setTitle("Add / Edit User");
- _this.form.findField('role').setDisabled(false);
-
- /*
- * Use for init -- Call from Pman.Login.js
- */
- if(
- typeof(_this.data.role) != 'undefined' &&
- _this.data.role == 'Administrators'
- ) {
- _this.dialog.setTitle("Create Adminstrator");
- _this.form.findField('role').setDisabled(true);
- }
-
- _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
- _this.form.findField('passwd2').show();
- _this.passwordbox.collapse();
+ if(checked) {
- _this.form.findField('secure_passwords').setValue(1);
-
- if(_this.data.id * 1 > 0) {
- this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
- }
-
-
-
- this.clearInvalid();
-
- _this.dialog.resize();
+ this.setBoxLabel('Untick to disable Two Factor authentication');
return;
}
-
- if (action.type == 'load') {
-
- _this.data = action.result.data;
-
- // oath handling...
-
- _this.form.findField('_enable_oath_key').setChecked(false,false);
-
- if(_this.data.length_oath_key != '0') {
- _this.form.findField('_enable_oath_key').setChecked(true,false);
- }
-
+
+ this.setBoxLabel('Enable Two Factor Authentication');
+ },
+ click : function (_self, e)
+ {
+ if(!Pman.Login.authUser) {
+ Roo.bootstrap.MessageBox.alert('Error', 'Please login again');
return;
}
- if (action.type == 'submit') { // only submitted here if we are
+ e.preventDefault();
- _this.dialog.hide();
-
- if (_this.callback) {
- _this.callback.call(this, action.result.data);
- }
+ if(!this.checked) {
+
+ Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
+ id: _this.data.id,
+ allow_close: false,
+ allow_cancel : true
+ }, function(valid){
+ if(valid) {
+ _this.dialog.hide({});
+ return;
+ }
+
+ _this.form.findField('_enable_oath_key').setChecked(false,false);
+ }
+ );
return;
}
- },
+
+ new Pman.Request({
+ url : baseURL + '/Roo/Core_person',
+ method :'GET',
+ params : {
+ oath_key_disable: 1,
+ id: _this.data.id
+ },
+ success : function(res)
+ {
+ switch(res.data) {
+ case 'DONE':
+ Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');
+ break;
+ default:
+ Roo.log('invalid usage');
+ break;
+ }
+ },
+ failure : function(res)
+ {
+ Roo.bootstrap.MessageBox.alert('Error', res);
+ }
+ });
+ }
+ },
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ xtype : 'Row',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Column',
+ md : 12,
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap',
+ items : [
+ {
+ xtype : 'Container',
+ expandable : true,
+ expanded : false,
+ header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
+ panel : 'primary',
+ listeners : {
render : function (_self)
{
- _this.form = this;
+ _this.passwordbox = this;
}
},
xns : Roo.bootstrap,
items : [
{
xtype : 'Column',
- md : 12,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Input',
- allowBlank : false,
- fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
- labelAlign : 'left',
- name : 'name',
- placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
- md : 12,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Input',
- fieldLabel : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
- labelAlign : 'left',
- name : 'role',
- placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
- md : 12,
+ xs : 8,
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
items : [
{
xtype : 'Input',
- allowBlank : false,
- fieldLabel : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
- labelAlign : 'left',
- name : 'email',
- placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
- vtype : 'email',
+ inputType : 'password',
+ name : 'passwd1',
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap'
}
]
- }
- ]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
- md : 12,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Input',
- fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
- labelAlign : 'left',
- name : 'phone',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
+ },
{
xtype : 'Column',
- md : 12,
+ xs : 4,
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
items : [
{
- xtype : 'CheckBox',
- boxLabel : _this._strings['828e70f83623b262e14187c039df99c0'] /* Enable Two-Factor Authentication */,
- name : '_enable_oath_key',
+ xtype : 'Button',
+ html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
+ style : 'width:100%',
listeners : {
- check : function (_self, checked)
- {
- if(checked) {
-
- this.setBoxLabel('Untick to disable Two Factor authentication');
-
- return;
- }
-
- this.setBoxLabel('Enable Two Factor Authentication');
- },
click : function (_self, e)
{
- if(!Pman.Login.authUser) {
- Roo.bootstrap.MessageBox.alert('Error', 'Please login again');
- return;
- }
-
- e.preventDefault();
-
- if(!this.checked) {
-
- Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
- id: _this.data.id,
- allow_close: false,
- allow_cancel : true
- }, function(valid){
- if(valid) {
- _this.dialog.hide({});
- return;
- }
-
- _this.form.findField('_enable_oath_key').setChecked(false,false);
- }
- );
-
- return;
- }
-
- new Pman.Request({
- url : baseURL + '/Roo/Core_person',
- method :'GET',
- params : {
- oath_key_disable: 1,
- id: _this.data.id
- },
- success : function(res)
- {
- switch(res.data) {
- case 'DONE':
- Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');
- break;
- default:
- Roo.log('invalid usage');
- break;
- }
- },
- failure : function(res)
- {
- Roo.bootstrap.MessageBox.alert('Error', res);
- }
- });
+ var pw = Math.random().toString(36).replace('0.', '');
+ _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
+ _this.form.findField('passwd1').setValue(pw);
+ _this.form.findField('passwd2').hide();
}
},
xns : Roo.bootstrap,
}
]
},
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
- md : 12,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Container',
- expandable : true,
- expanded : false,
- header : _this._strings['acf45fd8829f809b29c601a3a193804f'] /* Set / Change Password */,
- panel : 'primary',
- listeners : {
- render : function (_self)
- {
- _this.passwordbox = this;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
- xs : 8,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Input',
- inputType : 'password',
- name : 'passwd1',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- },
- {
- xtype : 'Column',
- xs : 4,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Button',
- html : _this._strings['01028205a11cf95a503c4c1d005989da'] /* Generate One */,
- style : 'width:100%',
- listeners : {
- click : function (_self, e)
- {
- var pw = Math.random().toString(36).replace('0.', '');
- _this.form.findField('passwd1').el.select('input',true).first().dom.type="input";
- _this.form.findField('passwd1').setValue(pw);
- _this.form.findField('passwd2').hide();
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
- },
- {
- xtype : 'Input',
- inputType : 'password',
- name : 'passwd2',
- placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- },
- {
- xtype : 'CheckBox',
- boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
- name : 'secure_passwords',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
- }
- ]
- },
{
xtype : 'Input',
- inputType : 'hidden',
- labelAlign : 'left',
- name : 'id',
- listeners : {
- render : function (_self)
- {
- _this.userID = _self;
- }
- },
+ inputType : 'password',
+ name : 'passwd2',
+ placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap'
},
{
- xtype : 'Input',
- inputType : 'hidden',
- name : 'company_id',
+ xtype : 'CheckBox',
+ boxLabel : _this._strings['0bfe42db3eb05bf39f03812166391939'] /* Use Secure Passwords */,
+ name : 'secure_passwords',
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap'
}
]
},
{
- xtype : 'Grid',
- background : true,
- fitContainer : true,
- fitToFrame : true,
- region : 'center',
- title : _this._strings['566a352f95c879ff26e50bad767a28dc'] /* Group Membership */,
+ xtype : 'Input',
+ inputType : 'hidden',
+ labelAlign : 'left',
+ name : 'id',
listeners : {
- activate : function (_self)
- {
- if(_this.option_grid){
- _this.option_grid.store.load({});
- }
-
- },
render : function (_self)
{
- _this.option_panel = this;
-
-
+ _this.userID = _self;
}
},
- xns : Roo.bootstrap.panel,
- '|xns' : 'Roo.bootstrap.panel',
- grid : {
- xtype : 'Table',
- cellSelection : true,
- cls : 'table-fixed',
- condensed : true,
- footerShow : false,
- loadMask : true,
- rowSelection : false,
- listeners : {
- cellclick : function (_self, el, rowIndex, columnIndex, e)
- {
- var di = _this.option_grid.colModel.getDataIndex(columnIndex);
-
- /*
- if (di != 'is_in_group') {
- return;
- }
- */
- var rec = _this.option_grid.store.getAt(rowIndex);
-
- if(rec.data.name == 'Administrators' && _this.data.id == Pman.Login.authUser.id){
- Roo.bootstrap.MessageBox.alert('Error', 'You can not remove yourself from Administrators group');
- return;
- }
-
- rec.set('is_in_group', rec.data.is_in_group * 1 == 1 ? 0 : 1);
- rec.commit();
-
- },
- render : function (_self)
- {
- _this.option_grid = this;
-
- this.store.load({})
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- store : {
- xtype : 'Store',
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'id' },
- listeners : {
- beforeload : function (_self, options)
- {
- options.params = options.params || {};
-
- if(_this.data.id * 1 < 1){
- _this.option_grid.el.mask('Please save the member first');
- this.removeAll();
- return false;
- }
-
- options.params._is_in_group = _this.data.id;
-
- },
- update : function (_self, record, operation)
- {
- if (operation != 'commit') {
- return;
- }
-
- var params = {
- user_ids : _this.data.id,
- _action : (record.data.is_in_group * 1 == 0) ? 'sub' : 'add',
- group_id : record.data.id
- };
-
- new Pman.Request({
- url : baseURL + '/Roo/Core_group',
- method : 'POST',
- params : params,
- success : function() {
- //_this.option_grid.ds.load({});
- }
- });
- }
- },
- xns : Roo.data,
- '|xns' : 'Roo.data',
- proxy : {
- xtype : 'HttpProxy',
- method : 'GET',
- url : baseURL + '/Roo/core_group',
- xns : Roo.data,
- '|xns' : 'Roo.data'
- },
- reader : {
- xtype : 'JsonReader',
- fields : [
- {
- 'name': 'id',
- 'type': 'int'
- },
- {
- 'name': 'name',
- 'type': 'string'
- },
- {
- 'name': 'display_name',
- 'type': 'string'
- },
- {
- 'name': 'is_in_group',
- 'type': 'int'
- }
- ],
- id : 'id',
- root : 'data',
- xns : Roo.data,
- '|xns' : 'Roo.data'
- }
- },
- sm : {
- xtype : 'RowSelectionModel',
- singleSelect : true,
- xns : Roo.bootstrap.Table,
- '|xns' : 'Roo.bootstrap.Table'
- },
- cm : [
- {
- xtype : 'ColumnModel',
- align : 'center',
- cursor : 'pointer',
- dataIndex : 'is_in_group',
- header : _this._strings['4910043d0b2c8c864a0e8672716fee94'] /* Is a Member */,
- renderer : function(v) {
-
- var state = v > 0 ? 'check-' : '';
- var cls = v > 0 ? 'text-primary' : '';
-
- return '<i class=\"far fa-'+ state + 'square-o ' + cls + '\" aria-hidden=\"true\"></i>';
-
- },
- sortable : false,
- xs : 3,
- xns : Roo.grid,
- '|xns' : 'Roo.grid'
- },
- {
- xtype : 'ColumnModel',
- cursor : 'pointer',
- dataIndex : 'display_name',
- header : _this._strings['28974c2c793e780427dfb571b26443e6'] /* Group Name */,
- renderer : function(v,x,r)
- {
- var vv = v.length ? v : r.data.name;
-
- return String.format('{0}', vv);
- },
- sortable : true,
- xs : 9,
- xns : Roo.grid,
- '|xns' : 'Roo.grid'
- }
- ]
- }
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ },
+ {
+ xtype : 'Input',
+ inputType : 'hidden',
+ name : 'company_id',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
}
]
}