sync
[Pman.BAdmin] / Pman.Dialog.BAdminGroups.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.BAdminGroups= function() {}
8 Roo.apply(Pman.Dialog.BAdminGroups.prototype, {
9
10  _strings : {
11   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
12   '106eefbc3cdf294434c52c2638ce28df' :"Add / Edit Group",
13   '49ee3087348e8d44e1feda1917443987' :"Name",
14   'c9cc8cce247e49bae79f15173ce97354' :"Save"
15  },
16  _named_strings : {
17   'display_name_placeholder' : '49ee3087348e8d44e1feda1917443987' /* Name */ 
18  },
19
20  dialog : false,
21  callback:  false,
22
23  show : function(data, cb)
24  {
25   if (!this.dialog) {
26    this.create();
27   }
28
29   this.callback = cb;
30   this.data = data;
31   this.dialog.show(this.data._el);
32   if (this.form) {
33    this.form.reset();
34    this.form.setValues(data);
35    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
36   }
37
38  },
39
40  create : function()
41  {
42   var _this = this;
43   this.dialog = Roo.factory({
44     xtype : 'Modal',
45     cls : 'enable-overflow',
46     title : _this._strings['106eefbc3cdf294434c52c2638ce28df'] /* Add / Edit Group */,
47     xns : Roo.bootstrap,
48     '|xns' : 'Roo.bootstrap',
49     buttons : [
50      {
51       xtype : 'Button',
52       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
53       listeners : {
54        click : function (_self, e)
55         {
56             _this.dialog.hide(); 
57         }
58       },
59       xns : Roo.bootstrap,
60       '|xns' : 'Roo.bootstrap'
61      },
62      {
63       xtype : 'Button',
64       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
65       weight : 'primary',
66       listeners : {
67        click : function (_self, e)
68         {
69             if(!_this.form.isValid()){
70                 Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');
71                 return;
72             }
73             
74             _this.form.doAction("submit");
75             
76             return;
77         }
78       },
79       xns : Roo.bootstrap,
80       '|xns' : 'Roo.bootstrap'
81      }
82     ],
83     items  : [
84      {
85       xtype : 'Form',
86       labelAlign : 'top',
87       url : baseURL + '/Roo/Core_group',
88       listeners : {
89        actioncomplete : function (_self, action)
90         {
91             if(action.type == 'setdata'){
92             
93                if(_this.data.id * 1 > 0) {
94                     this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
95                 } 
96                 
97                 return;
98             }
99            
100             if (action.type == 'load') {
101                 _this.data = action.result.data;
102                 
103                 if(!_this.data.display_name.length){
104                     _this.form.findField('display_name').setValue(_this.data.name);
105                 }
106                 return;
107             }
108             
109             
110             if (action.type == 'submit') {
111             
112                 _this.dialog.hide();
113                
114                 if (_this.callback) {
115                     _this.callback.call(this, action.result.data);
116                 }
117                 
118                 return; 
119             }
120         },
121        actionfailed : function (_self, action)
122         {
123             Roo.log(action);
124             Roo.bootstrap.MessageBox.alert('Error', action.result.errorMsg);
125         },
126        render : function (_self)
127         {
128             _this.form = _self;
129         }
130       },
131       xns : Roo.bootstrap,
132       '|xns' : 'Roo.bootstrap',
133       items  : [
134        {
135         xtype : 'Input',
136         name : 'display_name',
137         placeholder : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
138         xns : Roo.bootstrap,
139         '|xns' : 'Roo.bootstrap'
140        },
141        {
142         xtype : 'Input',
143         inputType : 'hidden',
144         name : 'id',
145         xns : Roo.bootstrap,
146         '|xns' : 'Roo.bootstrap'
147        }
148       ]
149      }
150     ]
151    }  );
152  }
153 });
154 Roo.apply(Pman.Dialog.BAdminGroups, Pman.Dialog.BAdminGroups.prototype);