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             format : 'Y-m-d',
268             indicatorpos : 'right',
269             name : 'expire_dt',
270             listeners : {
271              render : function (_self)
272               {
273                   _this.expire_dt = this;
274                   
275                   var d = new Date();
276                   
277                   d.setDate(d.getDate() - 1);
278               
279                   this.setStartDate(d);
280                   
281                   this.el.setVisibilityMode(Roo.Element.DISPLAY);
282                   
283                   this.el.hide();
284               }
285             },
286             xns : Roo.bootstrap,
287             '|xns' : 'Roo.bootstrap'
288            }
289           ]
290          }
291         ]
292        },
293        {
294         xtype : 'Row',
295         xns : Roo.bootstrap,
296         '|xns' : 'Roo.bootstrap',
297         items  : [
298          {
299           xtype : 'Column',
300           xs : 12,
301           xns : Roo.bootstrap,
302           '|xns' : 'Roo.bootstrap',
303           items  : [
304            {
305             xtype : 'Input',
306             inputType : 'hidden',
307             name : 'id',
308             xns : Roo.bootstrap,
309             '|xns' : 'Roo.bootstrap'
310            },
311            {
312             xtype : 'Input',
313             inputType : 'hidden',
314             name : 'authorized_key',
315             xns : Roo.bootstrap,
316             '|xns' : 'Roo.bootstrap'
317            }
318           ]
319          }
320         ]
321        }
322       ]
323      },
324      {
325       xtype : 'Row',
326       listeners : {
327        render : function (_self)
328         {
329             _this.error_row = this;
330             
331             this.el.setVisibilityMode(Roo.Element.DISPLAY);
332             
333             this.el.hide();
334         }
335       },
336       xns : Roo.bootstrap,
337       '|xns' : 'Roo.bootstrap',
338       items  : [
339        {
340         xtype : 'Column',
341         xs : 12,
342         xns : Roo.bootstrap,
343         '|xns' : 'Roo.bootstrap',
344         items  : [
345          {
346           xtype : 'Element',
347           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
348           listeners : {
349            render : function (_self)
350             {
351                 _this.text_el = _self;
352             }
353           },
354           xns : Roo.bootstrap,
355           '|xns' : 'Roo.bootstrap'
356          }
357         ]
358        }
359       ]
360      }
361     ]
362    }  );
363  }
364 });
365 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);