Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
_strings : {
- 'ce8ae9da5b7cd6c3df2929543a9af92d' :"Email",
- 'bcc254b55c4a1babdf1dcb82c207506b' :"Phone",
- 'a0f852ef8bfccd86a0e7217d7959e3e8' :"Add / Edit User",
'ea4788705e6873b424c65e91c2846b19' :"Cancel",
- '6f958ddaf50fd5ade7858ef1d1a63e51' :"Type again to confirm",
- 'bbbabdbe1b262f75d99d62880b953be1' :"Role",
+ '106eefbc3cdf294434c52c2638ce28df' :"Add / Edit Group",
'49ee3087348e8d44e1feda1917443987' :"Name",
- 'c9cc8cce247e49bae79f15173ce97354' :"Save",
- 'acf45fd8829f809b29c601a3a193804f' :"Set / Change Password",
- '439cab8964e2399c21f08caa4b0f5d67' :"Generate one",
- '9810aa2b9f44401be4bf73188ef2b67d' :"Fax"
+ 'c9cc8cce247e49bae79f15173ce97354' :"Save"
+ },
+ _named_strings : {
+ 'display_name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */
},
dialog : false,
var _this = this;
this.dialog = Roo.factory({
xtype : 'Modal',
- title : _this._strings['a0f852ef8bfccd86a0e7217d7959e3e8'] /* Add / Edit User */,
- listeners : {
- render : function (_self)
- {
- _this.modal = _self;
- }
- },
+ cls : 'enable-overflow padding-bottom-trim',
+ title : _this._strings['106eefbc3cdf294434c52c2638ce28df'] /* Add / Edit Group */,
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
buttons : [
return;
}
- var myID = _this.form.findField('id').getValue() * 1;
- var myName = _this.form.findField('name').getValue();
-
- if (_this.form.findField('company_id') && !_this.form.findField('company_id').getValue()) {
- Roo.bootstrap.MessageBox.alert("Error", "Select a Company");
- return;
- }
-
- // validate password match (only needed if we are not using generated one..
- if (_this.form.findField('passwd1')
- && _this.form.findField('passwd1').getValue().length > 0
- && _this.form.findField('passwd1').inputEl().dom.type == "password") {
-
- var p1 = _this.form.findField('passwd1').getValue();
- var p2 = _this.form.findField('passwd2').getValue();
-
-
- if (Pman.Login.authUser.id < 0 && !p1.length) {
- Roo.bootstrap.MessageBox.alert("Error", "You must create a password for the admin account");
- return;
- }
-
-
- if (p1.length || p2.length) {
- if (p1 != p2) {
- Roo.bootstrap.MessageBox.alert("Error", "Passwords do not match");
- return;
- }
- }
-
-
- }
_this.form.doAction("submit");
-
-
-
+
return;
}
},
actioncomplete : function (_self, action)
{
if(action.type == 'setdata'){
-
- _this.form.findField('passwd1').el.select('input',true).first().dom.type="password";
- _this.form.findField('passwd2').show();
- _this.passwordbox.collapse();
-
+ _this.dialog.setTitle("Create Group");
if(_this.data.id * 1 > 0) {
- // this.load({ method: 'GET', params: { '_id' : _this.data.id }});
this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
-
+ _this.dialog.setTitle("Edit Group");
}
+
return;
}
if (action.type == 'load') {
_this.data = action.result.data;
+
+ if(!_this.data.display_name.length){
+ _this.form.findField('display_name').setValue(_this.data.name);
+ }
return;
}
- if (action.type == 'submit') { // only submitted here if we are
+ if (action.type == 'submit') {
+
_this.dialog.hide();
if (_this.callback) {
_this.callback.call(this, action.result.data);
}
+
return;
}
},
actionfailed : function (_self, action)
{
- Roo.bootstrap.MessageBox.alert(action.result.errorMsg);
+ Roo.log(action);
+ Roo.bootstrap.MessageBox.alert('Error', action.result.errorMsg);
},
render : function (_self)
{
items : [
{
xtype : 'Input',
- name : 'name',
+ name : 'display_name',
placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
- listeners : {
- render : function (_self)
- {
- _this.userNmae = _self;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- },
- {
- xtype : 'Input',
- name : 'role',
- placeholder : _this._strings['bbbabdbe1b262f75d99d62880b953be1'] /* Role */,
- listeners : {
- render : function (_self)
- {
- _this.role = _self;
- }
- },
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap'
},
- {
- xtype : 'Input',
- allowBlank : false,
- name : 'email',
- placeholder : _this._strings['ce8ae9da5b7cd6c3df2929543a9af92d'] /* Email */,
- listeners : {
- render : function (_self)
- {
- _this.email = _self;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- },
- {
- 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['439cab8964e2399c21f08caa4b0f5d67'] /* Generate one */,
- style : 'width:100%',
- listeners : {
- click : function (_self, e)
- {
- var pw = Math.random().toString(36).slice(-12);
- _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',
- labelAlign : 'left',
- name : 'passwd2',
- placeholder : _this._strings['6f958ddaf50fd5ade7858ef1d1a63e51'] /* Type again to confirm */,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- },
- {
- xtype : 'CheckBox',
- boxLabel : 'Use Secure Passwords',
- name : 'secure_passwords',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
- xs : 6,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Input',
- fieldLabel : _this._strings['bcc254b55c4a1babdf1dcb82c207506b'] /* Phone */,
- name : 'phone',
- listeners : {
- render : function (_self)
- {
- _this.phone = _self;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- },
- {
- xtype : 'Column',
- xs : 6,
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Input',
- fieldLabel : _this._strings['9810aa2b9f44401be4bf73188ef2b67d'] /* Fax */,
- name : 'fax',
- listeners : {
- render : function (_self)
- {
- _this.fax = _self;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
- },
{
xtype : 'Input',
inputType : 'hidden',
- labelAlign : 'left',
name : 'id',
- listeners : {
- render : function (_self)
- {
- _this.userID = _self;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- },
- {
- xtype : 'Input',
- inputType : 'hidden',
- labelAlign : 'left',
- name : 'company_id',
- listeners : {
- render : function (_self)
- {
- _this.company_id = _self;
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Column',
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap'
}