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