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