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