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