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   '294176b7ee742a4fcfe2085448e6f138' :"Cacel",
12   'e2c9d024b79dfb48b42a7807206c6aed' :"Verify New IP Access",
13   'd41d8cd98f00b204e9800998ecf8427e' :"",
14   'f6039d44b29456b20f8f373155ae4973' :"Username",
15   '004bf6c9a40003140292e97330236c53' :"Action",
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                   return;
73               },
74               failure: function(res) {
75                   
76                   _this.dialog.hide();
77                   
78                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
79                   
80                   return;
81              }
82           });
83       }
84     },
85     xns : Roo.bootstrap,
86     '|xns' : 'Roo.bootstrap',
87     buttons : [
88      {
89       xtype : 'Button',
90       html : _this._strings['70d9be9b139893aa6c69b5e77e614311'] /* Confirm */,
91       weight : 'primary',
92       listeners : {
93        click : function (_self, e)
94         {
95             if(!_this.form.isValid()){
96                 return;
97             }
98             
99             _this.dialog.el.mask('Sending...');
100             _this.form.doAction('submit');
101             
102         }
103       },
104       xns : Roo.bootstrap,
105       '|xns' : 'Roo.bootstrap'
106      },
107      {
108       xtype : 'Button',
109       html : _this._strings['294176b7ee742a4fcfe2085448e6f138'] /* Cacel */,
110       weight : 'primary',
111       listeners : {
112        click : function (_self, e)
113         {
114             var path = window.location.pathname.split('/');
115             
116             var verify_key = path.pop();
117             
118             var id = path.pop();
119             
120             new Pman.Request({
121                 url: baseURL + '/Roo/Coba_application_signup',
122                 method : 'POST',
123                 mask : 'Sending...',
124                 params : {
125                     _resend : id
126                 }, 
127                 success : function(res) {
128                     var msg = "We have re-sent you an invitation via email." +
129                                 "<br/><br/>" + 
130                                 "Please check your inbox for the final registration step." + 
131                                  "<br/><br/>" + 
132                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
133                                 
134                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
135                 },
136                 failure: function(res) {
137                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
138                 }
139             });
140         },
141        render : function (_self)
142         {
143             _this.btn_resend = _self;
144              this.el.setVisibilityMode(Roo.Element.DISPLAY);
145              this.el.hide();
146         }
147       },
148       xns : Roo.bootstrap,
149       '|xns' : 'Roo.bootstrap'
150      }
151     ],
152     items  : [
153      {
154       xtype : 'Form',
155       errorMask : true,
156       labelAlign : 'top',
157       loadMask : false,
158       url : baseURL + '/Core/VerifyAccess',
159       listeners : {
160        actioncomplete : function (_self, action)
161         {
162             if (action.type == 'setdata') {
163                 
164                 return;
165             }
166             if (action.type == 'load') {
167                 
168                 if(_this.data.status * 1 == 0){
169                     _this.form.findField('status').reset();
170                 }
171                 
172                 return;
173             }
174             if (action.type =='submit') {
175                 
176                 _this.dialog.hide();
177                 
178                 return;
179             }
180             
181         },
182        actionfailed : function (_self, action)
183         {
184             _this.dialog.el.unmask();
185             Roo.log("action failed");
186             Roo.log(action);
187           
188             if(!action.result.errorMsg){
189                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
190             }
191            
192             var msg = action.result.errorMsg;
193            
194             if(msg.length >= 200){
195                 msg = msg.substring(0,199) + '...'
196             }
197             
198             Roo.bootstrap.MessageBox.alert("Error", msg);
199         },
200        render : function (_self,e)
201         {
202             _this.form = _self;
203             
204         }
205       },
206       xns : Roo.bootstrap,
207       '|xns' : 'Roo.bootstrap',
208       items  : [
209        {
210         xtype : 'Row',
211         xns : Roo.bootstrap,
212         '|xns' : 'Roo.bootstrap',
213         items  : [
214          {
215           xtype : 'Column',
216           xs : 12,
217           xns : Roo.bootstrap,
218           '|xns' : 'Roo.bootstrap',
219           items  : [
220            {
221             xtype : 'Input',
222             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
223             name : 'email',
224             readOnly : true,
225             xns : Roo.bootstrap,
226             '|xns' : 'Roo.bootstrap'
227            }
228           ]
229          }
230         ]
231        },
232        {
233         xtype : 'Row',
234         xns : Roo.bootstrap,
235         '|xns' : 'Roo.bootstrap',
236         items  : [
237          {
238           xtype : 'Column',
239           xs : 12,
240           xns : Roo.bootstrap,
241           '|xns' : 'Roo.bootstrap',
242           items  : [
243            {
244             xtype : 'TextArea',
245             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
246             name : 'user_agent',
247             readOnly : true,
248             rows : 3,
249             style : 'margin-bottom: 15px;',
250             xns : Roo.bootstrap,
251             '|xns' : 'Roo.bootstrap'
252            }
253           ]
254          }
255         ]
256        },
257        {
258         xtype : 'Row',
259         xns : Roo.bootstrap,
260         '|xns' : 'Roo.bootstrap',
261         items  : [
262          {
263           xtype : 'Column',
264           xs : 12,
265           xns : Roo.bootstrap,
266           '|xns' : 'Roo.bootstrap',
267           items  : [
268            {
269             xtype : 'ComboBox',
270             allowBlank : false,
271             displayField : 'value',
272             editable : false,
273             fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
274             hiddenName : 'status',
275             mode : 'local',
276             name : 'status_name',
277             triggerAction : 'all',
278             valueField : 'code',
279             listeners : {
280              select : function (combo, record, index)
281               {
282                   
283               }
284             },
285             xns : Roo.bootstrap,
286             '|xns' : 'Roo.bootstrap',
287             store : {
288              xtype : 'SimpleStore',
289              data : [
290                  ['1', 'Approve'],
291                  ['-1', 'Reject']
292              ],
293              fields : [ 'code', 'value' ],
294              xns : Roo.data,
295              '|xns' : 'Roo.data'
296             }
297            }
298           ]
299          }
300         ]
301        },
302        {
303         xtype : 'Row',
304         xns : Roo.bootstrap,
305         '|xns' : 'Roo.bootstrap',
306         items  : [
307          {
308           xtype : 'Column',
309           xs : 12,
310           xns : Roo.bootstrap,
311           '|xns' : 'Roo.bootstrap',
312           items  : [
313            {
314             xtype : 'Input',
315             inputType : 'hidden',
316             name : 'id',
317             xns : Roo.bootstrap,
318             '|xns' : 'Roo.bootstrap'
319            },
320            {
321             xtype : 'Input',
322             inputType : 'hidden',
323             name : 'authorized_key',
324             xns : Roo.bootstrap,
325             '|xns' : 'Roo.bootstrap'
326            }
327           ]
328          }
329         ]
330        }
331       ]
332      },
333      {
334       xtype : 'Row',
335       listeners : {
336        render : function (_self)
337         {
338             _this.error_row = this;
339             
340             this.el.setVisibilityMode(Roo.Element.DISPLAY);
341             
342             this.el.hide();
343         }
344       },
345       xns : Roo.bootstrap,
346       '|xns' : 'Roo.bootstrap',
347       items  : [
348        {
349         xtype : 'Column',
350         xs : 12,
351         xns : Roo.bootstrap,
352         '|xns' : 'Roo.bootstrap',
353         items  : [
354          {
355           xtype : 'Element',
356           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
357           listeners : {
358            render : function (_self)
359             {
360                 _this.text_el = _self;
361             }
362           },
363           xns : Roo.bootstrap,
364           '|xns' : 'Roo.bootstrap'
365          }
366         ]
367        }
368       ]
369      }
370     ]
371    }  );
372  }
373 });
374 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);