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