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                   return;
72               },
73               failure: function(res) {
74                   
75                   _this.dialog.hide();
76                   
77                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
78                   
79                   return;
80              }
81           });
82       }
83     },
84     xns : Roo.bootstrap,
85     '|xns' : 'Roo.bootstrap',
86     buttons : [
87      {
88       xtype : 'Button',
89       html : _this._strings['70d9be9b139893aa6c69b5e77e614311'] /* Confirm */,
90       weight : 'primary',
91       listeners : {
92        click : function (_self, e)
93         {
94             if(!_this.form.isValid()){
95                 return;
96             }
97             
98             _this.dialog.el.mask('Sending...');
99             _this.form.doAction('submit');
100             
101         }
102       },
103       xns : Roo.bootstrap,
104       '|xns' : 'Roo.bootstrap'
105      }
106     ],
107     items  : [
108      {
109       xtype : 'Form',
110       errorMask : true,
111       labelAlign : 'top',
112       loadMask : false,
113       url : baseURL + '/Core/VerifyAccess',
114       listeners : {
115        actioncomplete : function (_self, action)
116         {
117             if (action.type == 'setdata') {
118                 
119                 return;
120             }
121             if (action.type == 'load') {
122                 
123                 if(_this.data.status * 1 == 0){
124                     _this.form.findField('status').reset();
125                     Roo.log('reset???');
126                 }
127                 
128                 return;
129             }
130             if (action.type =='submit') {
131                 
132                 _this.dialog.hide();
133                 
134                 return;
135             }
136             
137         },
138        actionfailed : function (_self, action)
139         {
140             _this.dialog.el.unmask();
141             Roo.log("action failed");
142             Roo.log(action);
143           
144             if(!action.result.errorMsg){
145                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
146             }
147            
148             var msg = action.result.errorMsg;
149            
150             if(msg.length >= 200){
151                 msg = msg.substring(0,199) + '...'
152             }
153             
154             Roo.bootstrap.MessageBox.alert("Error", msg);
155         },
156        render : function (_self,e)
157         {
158             _this.form = _self;
159             
160         }
161       },
162       xns : Roo.bootstrap,
163       '|xns' : 'Roo.bootstrap',
164       items  : [
165        {
166         xtype : 'Row',
167         xns : Roo.bootstrap,
168         '|xns' : 'Roo.bootstrap',
169         items  : [
170          {
171           xtype : 'Column',
172           xs : 12,
173           xns : Roo.bootstrap,
174           '|xns' : 'Roo.bootstrap',
175           items  : [
176            {
177             xtype : 'Input',
178             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
179             name : 'email',
180             readOnly : true,
181             xns : Roo.bootstrap,
182             '|xns' : 'Roo.bootstrap'
183            }
184           ]
185          }
186         ]
187        },
188        {
189         xtype : 'Row',
190         xns : Roo.bootstrap,
191         '|xns' : 'Roo.bootstrap',
192         items  : [
193          {
194           xtype : 'Column',
195           xs : 12,
196           xns : Roo.bootstrap,
197           '|xns' : 'Roo.bootstrap',
198           items  : [
199            {
200             xtype : 'TextArea',
201             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
202             name : 'user_agent',
203             readOnly : true,
204             rows : 3,
205             style : 'margin-bottom: 15px;',
206             xns : Roo.bootstrap,
207             '|xns' : 'Roo.bootstrap'
208            }
209           ]
210          }
211         ]
212        },
213        {
214         xtype : 'Row',
215         xns : Roo.bootstrap,
216         '|xns' : 'Roo.bootstrap',
217         items  : [
218          {
219           xtype : 'Column',
220           xs : 12,
221           xns : Roo.bootstrap,
222           '|xns' : 'Roo.bootstrap',
223           items  : [
224            {
225             xtype : 'ComboBox',
226             allowBlank : false,
227             displayField : 'value',
228             editable : false,
229             fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
230             hiddenName : 'status',
231             mode : 'local',
232             name : 'status_name',
233             triggerAction : 'all',
234             valueField : 'code',
235             listeners : {
236              select : function (combo, record, index)
237               {
238                   
239               }
240             },
241             xns : Roo.bootstrap,
242             '|xns' : 'Roo.bootstrap',
243             store : {
244              xtype : 'SimpleStore',
245              data : [
246                  ['1', 'Approve'],
247                  ['-1', 'Reject']
248              ],
249              fields : [ 'code', 'value' ],
250              xns : Roo.data,
251              '|xns' : 'Roo.data'
252             }
253            }
254           ]
255          }
256         ]
257        },
258        {
259         xtype : 'Row',
260         xns : Roo.bootstrap,
261         '|xns' : 'Roo.bootstrap',
262         items  : [
263          {
264           xtype : 'Column',
265           xs : 12,
266           xns : Roo.bootstrap,
267           '|xns' : 'Roo.bootstrap',
268           items  : [
269            {
270             xtype : 'Input',
271             inputType : 'hidden',
272             name : 'id',
273             xns : Roo.bootstrap,
274             '|xns' : 'Roo.bootstrap'
275            },
276            {
277             xtype : 'Input',
278             inputType : 'hidden',
279             name : 'authorized_key',
280             xns : Roo.bootstrap,
281             '|xns' : 'Roo.bootstrap'
282            }
283           ]
284          }
285         ]
286        }
287       ]
288      },
289      {
290       xtype : 'Row',
291       listeners : {
292        render : function (_self)
293         {
294             _this.error_row = this;
295             
296             this.el.setVisibilityMode(Roo.Element.DISPLAY);
297             
298             this.el.hide();
299         }
300       },
301       xns : Roo.bootstrap,
302       '|xns' : 'Roo.bootstrap',
303       items  : [
304        {
305         xtype : 'Column',
306         xs : 12,
307         xns : Roo.bootstrap,
308         '|xns' : 'Roo.bootstrap',
309         items  : [
310          {
311           xtype : 'Element',
312           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
313           listeners : {
314            render : function (_self)
315             {
316                 _this.text_el = _self;
317             }
318           },
319           xns : Roo.bootstrap,
320           '|xns' : 'Roo.bootstrap'
321          }
322         ]
323        }
324       ]
325      }
326     ]
327    }  );
328  }
329 });
330 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);