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             allowBlank : false,
259             fieldLabel : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
260             name : 'expire_dt',
261             xns : Roo.bootstrap,
262             '|xns' : 'Roo.bootstrap'
263            }
264           ]
265          }
266         ]
267        },
268        {
269         xtype : 'Row',
270         xns : Roo.bootstrap,
271         '|xns' : 'Roo.bootstrap',
272         items  : [
273          {
274           xtype : 'Column',
275           xs : 12,
276           xns : Roo.bootstrap,
277           '|xns' : 'Roo.bootstrap',
278           items  : [
279            {
280             xtype : 'Input',
281             inputType : 'hidden',
282             name : 'id',
283             xns : Roo.bootstrap,
284             '|xns' : 'Roo.bootstrap'
285            },
286            {
287             xtype : 'Input',
288             inputType : 'hidden',
289             name : 'authorized_key',
290             xns : Roo.bootstrap,
291             '|xns' : 'Roo.bootstrap'
292            }
293           ]
294          }
295         ]
296        }
297       ]
298      },
299      {
300       xtype : 'Row',
301       listeners : {
302        render : function (_self)
303         {
304             _this.error_row = this;
305             
306             this.el.setVisibilityMode(Roo.Element.DISPLAY);
307             
308             this.el.hide();
309         }
310       },
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 : 'Element',
322           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
323           listeners : {
324            render : function (_self)
325             {
326                 _this.text_el = _self;
327             }
328           },
329           xns : Roo.bootstrap,
330           '|xns' : 'Roo.bootstrap'
331          }
332         ]
333        }
334       ]
335      }
336     ]
337    }  );
338  }
339 });
340 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);