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