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