Pman.Dialog.BAdminIPAccess.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminIPAccess.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.BAdminIPAccess= function() {}
8 Roo.apply(Pman.Dialog.BAdminIPAccess.prototype, {
9
10  _strings : {
11   'e2c9d024b79dfb48b42a7807206c6aed' :"Verify New IP Access",
12   'd41d8cd98f00b204e9800998ecf8427e' :"",
13   'a12a3079e14ced46e69ba52b8a90b21a' :"IP",
14   'f6039d44b29456b20f8f373155ae4973' :"Username",
15   '004bf6c9a40003140292e97330236c53' :"Action",
16   '5a787141d53b573ec9b86e900bfe0d79' :"Expire Date",
17   'dfb790522fdea3859af206d32916fe77' :"User Agent",
18   '70d9be9b139893aa6c69b5e77e614311' :"Confirm"
19  },
20
21  dialog : false,
22  callback:  false,
23
24  show : function(data, cb)
25  {
26   if (!this.dialog) {
27    this.create();
28   }
29
30   this.callback = cb;
31   this.data = data;
32   this.dialog.show(this.data._el);
33   if (this.form) {
34    this.form.reset();
35    this.form.setValues(data);
36    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
37   }
38
39  },
40
41  create : function()
42  {
43   var _this = this;
44   this.dialog = Roo.factory({
45     xtype : 'Modal',
46     allow_close : false,
47     cls : 'enable-overflow',
48     title : _this._strings['e2c9d024b79dfb48b42a7807206c6aed'] /* Verify New IP Access */,
49     xns : Roo.bootstrap,
50     '|xns' : 'Roo.bootstrap',
51     buttons : [
52      {
53       xtype : 'Button',
54       html : _this._strings['70d9be9b139893aa6c69b5e77e614311'] /* Confirm */,
55       weight : 'primary',
56       listeners : {
57        click : function (_self, e)
58         {
59             if(!_this.form.isValid()){
60                 return;
61             }
62         
63             _this.dialog.el.mask('Sending...');
64             _this.form.doAction('submit');
65             
66         }
67       },
68       xns : Roo.bootstrap,
69       '|xns' : 'Roo.bootstrap'
70      }
71     ],
72     items  : [
73      {
74       xtype : 'Form',
75       errorMask : true,
76       labelAlign : 'top',
77       loadMask : false,
78       url : baseURL + '/Core/VerifyAccess',
79       listeners : {
80        actioncomplete : function (_self, action)
81         {
82             if (action.type == 'setdata') {
83                 
84                 if(_this.data.id) {
85                     this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});
86                 } 
87                 
88                 return;
89             }
90             if (action.type == 'load') {
91                 
92                 return;
93             }
94             if (action.type =='submit') {
95                 
96                 _this.dialog.hide();
97                 
98                 if (_this.callback) {
99                     _this.callback.call(this, action.result.data);
100                 }
101                 
102                 return;
103             }
104             
105         },
106        actionfailed : function (_self, action)
107         {
108             _this.dialog.el.unmask();
109             Roo.log("action failed");
110             Roo.log(action);
111           
112             if(!action.result.errorMsg){
113                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
114             }
115            
116             var msg = action.result.errorMsg;
117            
118             if(msg.length >= 200){
119                 msg = msg.substring(0,199) + '...'
120             }
121             
122             Roo.bootstrap.MessageBox.alert("Error", msg);
123         },
124        render : function (_self,e)
125         {
126             _this.form = _self;
127             
128         }
129       },
130       xns : Roo.bootstrap,
131       '|xns' : 'Roo.bootstrap',
132       items  : [
133        {
134         xtype : 'Row',
135         xns : Roo.bootstrap,
136         '|xns' : 'Roo.bootstrap',
137         items  : [
138          {
139           xtype : 'Column',
140           xs : 12,
141           xns : Roo.bootstrap,
142           '|xns' : 'Roo.bootstrap',
143           items  : [
144            {
145             xtype : 'Input',
146             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
147             name : 'email',
148             readOnly : true,
149             xns : Roo.bootstrap,
150             '|xns' : 'Roo.bootstrap'
151            }
152           ]
153          },
154          {
155           xtype : 'Column',
156           xs : 12,
157           xns : Roo.bootstrap,
158           '|xns' : 'Roo.bootstrap',
159           items  : [
160            {
161             xtype : 'Input',
162             fieldLabel : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */,
163             name : 'ip',
164             readOnly : true,
165             xns : Roo.bootstrap,
166             '|xns' : 'Roo.bootstrap'
167            }
168           ]
169          },
170          {
171           xtype : 'Column',
172           xs : 12,
173           xns : Roo.bootstrap,
174           '|xns' : 'Roo.bootstrap',
175           items  : [
176            {
177             xtype : 'TextArea',
178             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
179             name : 'user_agent',
180             readOnly : true,
181             rows : 3,
182             style : 'margin-bottom: 15px;',
183             xns : Roo.bootstrap,
184             '|xns' : 'Roo.bootstrap'
185            }
186           ]
187          },
188          {
189           xtype : 'Column',
190           xs : 12,
191           xns : Roo.bootstrap,
192           '|xns' : 'Roo.bootstrap',
193           items  : [
194            {
195             xtype : 'ComboBox',
196             allowBlank : false,
197             alwaysQuery : true,
198             displayField : 'value',
199             editable : false,
200             fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
201             forceSelection : true,
202             hiddenName : 'status',
203             indicatorpos : 'right',
204             mode : 'local',
205             name : 'status_name',
206             selectOnFocus : true,
207             tpl : '<div class=\"roo-select2-result\"><b>{value}</b></div>',
208             triggerAction : 'all',
209             valueField : 'code',
210             listeners : {
211              select : function (combo, record, index)
212               {
213                   _this.expire_dt.allowBlank = true;
214                   _this.expire_dt.el.hide();
215                   
216                   if(record.data.code == '-2'){
217                       _this.expire_dt.allowBlank = false;
218                       _this.expire_dt.el.show();
219                   }
220               }
221             },
222             xns : Roo.bootstrap,
223             '|xns' : 'Roo.bootstrap',
224             store : {
225              xtype : 'SimpleStore',
226              data : [
227                  ['1', 'Approve'],
228                  ['-2', 'Temporary'],
229                  ['-1', 'Reject']
230              ],
231              fields : [ 'code', 'value' ],
232              xns : Roo.data,
233              '|xns' : 'Roo.data'
234             }
235            }
236           ]
237          },
238          {
239           xtype : 'Column',
240           xs : 12,
241           xns : Roo.bootstrap,
242           '|xns' : 'Roo.bootstrap',
243           items  : [
244            {
245             xtype : 'DateField',
246             allowBlank : false,
247             fieldLabel : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
248             format : 'Y-m-d',
249             indicatorpos : 'right',
250             name : 'expire_dt',
251             listeners : {
252              render : function (_self)
253               {
254                   _this.expire_dt = this;
255                   
256                   var d = new Date();
257                   
258                   d.setDate(d.getDate() - 1);
259               
260                   this.setStartDate(d);
261                   
262                   this.el.setVisibilityMode(Roo.Element.DISPLAY);
263                   
264                   this.el.hide();
265               }
266             },
267             xns : Roo.bootstrap,
268             '|xns' : 'Roo.bootstrap'
269            }
270           ]
271          }
272         ]
273        },
274        {
275         xtype : 'Row',
276         xns : Roo.bootstrap,
277         '|xns' : 'Roo.bootstrap',
278         items  : [
279          {
280           xtype : 'Column',
281           xs : 12,
282           xns : Roo.bootstrap,
283           '|xns' : 'Roo.bootstrap',
284           items  : [
285            {
286             xtype : 'Input',
287             inputType : 'hidden',
288             name : 'id',
289             xns : Roo.bootstrap,
290             '|xns' : 'Roo.bootstrap'
291            },
292            {
293             xtype : 'Input',
294             inputType : 'hidden',
295             name : 'authorized_key',
296             xns : Roo.bootstrap,
297             '|xns' : 'Roo.bootstrap'
298            }
299           ]
300          }
301         ]
302        }
303       ]
304      },
305      {
306       xtype : 'Row',
307       listeners : {
308        render : function (_self)
309         {
310             _this.error_row = this;
311             
312             this.el.setVisibilityMode(Roo.Element.DISPLAY);
313             
314             this.el.hide();
315         }
316       },
317       xns : Roo.bootstrap,
318       '|xns' : 'Roo.bootstrap',
319       items  : [
320        {
321         xtype : 'Column',
322         xs : 12,
323         xns : Roo.bootstrap,
324         '|xns' : 'Roo.bootstrap',
325         items  : [
326          {
327           xtype : 'Element',
328           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
329           listeners : {
330            render : function (_self)
331             {
332                 _this.text_el = _self;
333             }
334           },
335           xns : Roo.bootstrap,
336           '|xns' : 'Roo.bootstrap'
337          }
338         ]
339        }
340       ]
341      }
342     ]
343    }  );
344  }
345 });
346 Roo.apply(Pman.Dialog.BAdminIPAccess, Pman.Dialog.BAdminIPAccess.prototype);