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             Roo.log('submit');
105             return;
106             _this.dialog.el.mask('Sending...');
107             _this.form.doAction('submit');
108             
109         }
110       },
111       xns : Roo.bootstrap,
112       '|xns' : 'Roo.bootstrap'
113      }
114     ],
115     items  : [
116      {
117       xtype : 'Form',
118       errorMask : true,
119       labelAlign : 'top',
120       loadMask : false,
121       url : baseURL + '/Core/VerifyAccess',
122       listeners : {
123        actioncomplete : function (_self, action)
124         {
125             if (action.type == 'setdata') {
126                 
127                 return;
128             }
129             if (action.type == 'load') {
130                 
131                 return;
132             }
133             if (action.type =='submit') {
134                 
135                 _this.dialog.hide();
136                 
137                 return;
138             }
139             
140         },
141        actionfailed : function (_self, action)
142         {
143             _this.dialog.el.unmask();
144             Roo.log("action failed");
145             Roo.log(action);
146           
147             if(!action.result.errorMsg){
148                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
149             }
150            
151             var msg = action.result.errorMsg;
152            
153             if(msg.length >= 200){
154                 msg = msg.substring(0,199) + '...'
155             }
156             
157             Roo.bootstrap.MessageBox.alert("Error", msg);
158         },
159        render : function (_self,e)
160         {
161             _this.form = _self;
162             
163         }
164       },
165       xns : Roo.bootstrap,
166       '|xns' : 'Roo.bootstrap',
167       items  : [
168        {
169         xtype : 'Row',
170         xns : Roo.bootstrap,
171         '|xns' : 'Roo.bootstrap',
172         items  : [
173          {
174           xtype : 'Column',
175           xs : 12,
176           xns : Roo.bootstrap,
177           '|xns' : 'Roo.bootstrap',
178           items  : [
179            {
180             xtype : 'Input',
181             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
182             name : 'email',
183             readOnly : true,
184             xns : Roo.bootstrap,
185             '|xns' : 'Roo.bootstrap'
186            }
187           ]
188          },
189          {
190           xtype : 'Column',
191           xs : 12,
192           xns : Roo.bootstrap,
193           '|xns' : 'Roo.bootstrap',
194           items  : [
195            {
196             xtype : 'TextArea',
197             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
198             name : 'user_agent',
199             readOnly : true,
200             rows : 3,
201             style : 'margin-bottom: 15px;',
202             xns : Roo.bootstrap,
203             '|xns' : 'Roo.bootstrap'
204            }
205           ]
206          },
207          {
208           xtype : 'Column',
209           xs : 12,
210           xns : Roo.bootstrap,
211           '|xns' : 'Roo.bootstrap',
212           items  : [
213            {
214             xtype : 'ComboBox',
215             allowBlank : false,
216             alwaysQuery : true,
217             displayField : 'value',
218             editable : false,
219             fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
220             forceSelection : true,
221             hiddenName : 'status',
222             indicatorpos : 'right',
223             mode : 'local',
224             name : 'status_name',
225             selectOnFocus : true,
226             tpl : '<div class=\"roo-select2-result\"><b>{value}</b></div>',
227             triggerAction : 'all',
228             valueField : 'code',
229             listeners : {
230              select : function (combo, record, index)
231               {
232                   _this.expire_dt.allowBlank = true;
233                   _this.expire_dt.el.hide();
234                   
235                   if(record.data.code == '-2'){
236                       _this.expire_dt.allowBlank = false;
237                       _this.expire_dt.el.show();
238                   }
239               }
240             },
241             xns : Roo.bootstrap,
242             '|xns' : 'Roo.bootstrap',
243             store : {
244              xtype : 'SimpleStore',
245              data : [
246                  ['1', 'Approve'],
247                  ['-2', 'Temporary'],
248                  ['-1', 'Reject']
249              ],
250              fields : [ 'code', 'value' ],
251              xns : Roo.data,
252              '|xns' : 'Roo.data'
253             }
254            }
255           ]
256          },
257          {
258           xtype : 'Column',
259           xs : 12,
260           xns : Roo.bootstrap,
261           '|xns' : 'Roo.bootstrap',
262           items  : [
263            {
264             xtype : 'DateField',
265             allowBlank : false,
266             fieldLabel : _this._strings['5a787141d53b573ec9b86e900bfe0d79'] /* Expire Date */,
267             indicatorpos : 'right',
268             name : 'expire_dt',
269             listeners : {
270              render : function (_self)
271               {
272                   _this.expire_dt = this;
273                   
274                   this.setStartDate(new Date());
275                   
276                   this.el.setVisibilityMode(Roo.Element.DISPLAY);
277                   
278                   this.el.hide();
279               }
280             },
281             xns : Roo.bootstrap,
282             '|xns' : 'Roo.bootstrap'
283            }
284           ]
285          }
286         ]
287        },
288        {
289         xtype : 'Row',
290         xns : Roo.bootstrap,
291         '|xns' : 'Roo.bootstrap',
292         items  : [
293          {
294           xtype : 'Column',
295           xs : 12,
296           xns : Roo.bootstrap,
297           '|xns' : 'Roo.bootstrap',
298           items  : [
299            {
300             xtype : 'Input',
301             inputType : 'hidden',
302             name : 'id',
303             xns : Roo.bootstrap,
304             '|xns' : 'Roo.bootstrap'
305            },
306            {
307             xtype : 'Input',
308             inputType : 'hidden',
309             name : 'authorized_key',
310             xns : Roo.bootstrap,
311             '|xns' : 'Roo.bootstrap'
312            }
313           ]
314          }
315         ]
316        }
317       ]
318      },
319      {
320       xtype : 'Row',
321       listeners : {
322        render : function (_self)
323         {
324             _this.error_row = this;
325             
326             this.el.setVisibilityMode(Roo.Element.DISPLAY);
327             
328             this.el.hide();
329         }
330       },
331       xns : Roo.bootstrap,
332       '|xns' : 'Roo.bootstrap',
333       items  : [
334        {
335         xtype : 'Column',
336         xs : 12,
337         xns : Roo.bootstrap,
338         '|xns' : 'Roo.bootstrap',
339         items  : [
340          {
341           xtype : 'Element',
342           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
343           listeners : {
344            render : function (_self)
345             {
346                 _this.text_el = _self;
347             }
348           },
349           xns : Roo.bootstrap,
350           '|xns' : 'Roo.bootstrap'
351          }
352         ]
353        }
354       ]
355      }
356     ]
357    }  );
358  }
359 });
360 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);