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