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