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   'dfb790522fdea3859af206d32916fe77' :"User Agent",
15   'd71940f24ee38ee09f6e06b908480bcf' :"Resend email",
16   '14cf5e829f5cb6fbf8cb54f7c5ff4ca9' :"Start the application process   "
17  },
18
19  dialog : false,
20  callback:  false,
21
22  show : function(data, cb)
23  {
24   if (!this.dialog) {
25    this.create();
26   }
27
28   this.callback = cb;
29   this.data = data;
30   this.dialog.show(this.data._el);
31   if (this.form) {
32    this.form.reset();
33    this.form.setValues(data);
34    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
35   }
36
37  },
38
39  create : function()
40  {
41   var _this = this;
42   this.dialog = Roo.factory({
43     xtype : 'Modal',
44     allow_close : false,
45     cls : 'enable-overflow',
46     title : _this._strings['e2c9d024b79dfb48b42a7807206c6aed'] /* Verify New IP Access */,
47     listeners : {
48      show : function (_self)
49       {
50           var path = window.location.pathname.split('/');
51           
52           var authorized_key = path.pop();
53           
54           var id = path.pop();
55           
56           new Pman.Request({
57               url: baseURL + '/Core/VerifyAccess',
58               method : 'POST',
59               mask : 'Loading...',
60               params : {
61                   id : id,
62                   authorized_key : authorized_key,
63                   _to_data : 1
64               }, 
65               success : function(res) {
66                   _this.form.setValues(res.data);
67                   return;
68               },
69               failure: function(res) {
70                   
71                   _this.dialog.hide();
72                   
73                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
74                   
75                   return;
76              }
77           });
78       }
79     },
80     xns : Roo.bootstrap,
81     '|xns' : 'Roo.bootstrap',
82     buttons : [
83      {
84       xtype : 'Button',
85       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
86       weight : 'primary',
87       listeners : {
88        click : function (_self, e)
89         {
90             if(!_this.form.isValid()){
91                 return;
92             }
93             
94             var p1 = _this.form.findField('password').getValue();
95             var p2 = _this.form.findField('password1').getValue();
96             
97             if (p1 != p2) {
98                 _this.form.findField('password1').markInvalid('Password do not match');
99                 return;
100             }
101             
102             _this.dialog.el.mask('Sending...');
103             _this.form.doAction('submit');
104             
105         },
106        render : function (_self)
107         {
108             _this.btn_ok = _self;
109         }
110       },
111       xns : Roo.bootstrap,
112       '|xns' : 'Roo.bootstrap'
113      },
114      {
115       xtype : 'Button',
116       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
117       weight : 'primary',
118       listeners : {
119        click : function (_self, e)
120         {
121             var path = window.location.pathname.split('/');
122             
123             var verify_key = path.pop();
124             
125             var id = path.pop();
126             
127             new Pman.Request({
128                 url: baseURL + '/Roo/Coba_application_signup',
129                 method : 'POST',
130                 mask : 'Sending...',
131                 params : {
132                     _resend : id
133                 }, 
134                 success : function(res) {
135                     var msg = "We have re-sent you an invitation via email." +
136                                 "<br/><br/>" + 
137                                 "Please check your inbox for the final registration step." + 
138                                  "<br/><br/>" + 
139                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
140                                 
141                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
142                 },
143                 failure: function(res) {
144                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
145                 }
146             });
147         },
148        render : function (_self)
149         {
150             _this.btn_resend = _self;
151              this.el.setVisibilityMode(Roo.Element.DISPLAY);
152              this.el.hide();
153         }
154       },
155       xns : Roo.bootstrap,
156       '|xns' : 'Roo.bootstrap'
157      }
158     ],
159     items  : [
160      {
161       xtype : 'Form',
162       errorMask : true,
163       labelAlign : 'top',
164       loadMask : false,
165       url : baseURL + '/Core/VerifyAccess',
166       listeners : {
167        actioncomplete : function (_self, action)
168         {
169             if (action.type == 'setdata') {
170                 
171                 return;
172             }
173             if (action.type == 'load') {
174                 
175                 return;
176             }
177             if (action.type =='submit') {
178                 
179                 _this.dialog.hide();
180                 
181                 Roo.get(document.body).mask('Start your Application');
182                 
183                 setTimeout(function() {
184                     window.location.href = baseURL;
185                 }, 500); 
186                 
187                 return;
188             }
189             
190         },
191        actionfailed : function (_self, action)
192         {
193             _this.dialog.el.unmask();
194             Roo.log("action failed");
195             Roo.log(action);
196           
197             if(!action.result.errorMsg){
198                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
199             }
200            
201             var msg = action.result.errorMsg;
202            
203             if(msg.length >= 200){
204                 msg = msg.substring(0,199) + '...'
205             }
206             
207             Roo.bootstrap.MessageBox.alert("Error", msg);
208         },
209        render : function (_self,e)
210         {
211             _this.form = _self;
212             
213         }
214       },
215       xns : Roo.bootstrap,
216       '|xns' : 'Roo.bootstrap',
217       items  : [
218        {
219         xtype : 'Row',
220         xns : Roo.bootstrap,
221         '|xns' : 'Roo.bootstrap',
222         items  : [
223          {
224           xtype : 'Column',
225           xs : 12,
226           xns : Roo.bootstrap,
227           '|xns' : 'Roo.bootstrap',
228           items  : [
229            {
230             xtype : 'Input',
231             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
232             name : 'email',
233             readOnly : true,
234             xns : Roo.bootstrap,
235             '|xns' : 'Roo.bootstrap'
236            }
237           ]
238          }
239         ]
240        },
241        {
242         xtype : 'Row',
243         listeners : {
244          render : function (_self)
245           {
246               _this.row_pwd_label = _self;
247           }
248         },
249         xns : Roo.bootstrap,
250         '|xns' : 'Roo.bootstrap',
251         items  : [
252          {
253           xtype : 'Column',
254           xs : 12,
255           xns : Roo.bootstrap,
256           '|xns' : 'Roo.bootstrap',
257           items  : [
258            {
259             xtype : 'TextArea',
260             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
261             name : 'user_agent',
262             readOnly : true,
263             rows : 3,
264             xns : Roo.bootstrap,
265             '|xns' : 'Roo.bootstrap'
266            }
267           ]
268          }
269         ]
270        },
271        {
272         xtype : 'Row',
273         xns : Roo.bootstrap,
274         '|xns' : 'Roo.bootstrap',
275         items  : [
276          {
277           xtype : 'Column',
278           xs : 8,
279           xns : Roo.bootstrap,
280           '|xns' : 'Roo.bootstrap',
281           items  : [
282            {
283             xtype : 'Input',
284             inputType : 'hidden',
285             name : 'id',
286             xns : Roo.bootstrap,
287             '|xns' : 'Roo.bootstrap'
288            },
289            {
290             xtype : 'Input',
291             inputType : 'hidden',
292             name : 'authorized_key',
293             xns : Roo.bootstrap,
294             '|xns' : 'Roo.bootstrap'
295            }
296           ]
297          }
298         ]
299        },
300        {
301         xtype : 'Row',
302         xns : Roo.bootstrap,
303         '|xns' : 'Roo.bootstrap',
304         items  : [
305          {
306           xtype : 'Column',
307           xs : 8,
308           xns : Roo.bootstrap,
309           '|xns' : 'Roo.bootstrap',
310           items  : [
311            {
312             xtype : 'Input',
313             inputType : 'hidden',
314             name : 'id',
315             xns : Roo.bootstrap,
316             '|xns' : 'Roo.bootstrap'
317            },
318            {
319             xtype : 'Input',
320             inputType : 'hidden',
321             name : 'authorized_key',
322             xns : Roo.bootstrap,
323             '|xns' : 'Roo.bootstrap'
324            }
325           ]
326          }
327         ]
328        }
329       ]
330      },
331      {
332       xtype : 'Row',
333       listeners : {
334        render : function (_self)
335         {
336             _this.error_row = this;
337             
338             this.el.setVisibilityMode(Roo.Element.DISPLAY);
339             
340             this.el.hide();
341         }
342       },
343       xns : Roo.bootstrap,
344       '|xns' : 'Roo.bootstrap',
345       items  : [
346        {
347         xtype : 'Column',
348         xs : 12,
349         xns : Roo.bootstrap,
350         '|xns' : 'Roo.bootstrap',
351         items  : [
352          {
353           xtype : 'Element',
354           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
355           listeners : {
356            render : function (_self)
357             {
358                 _this.text_el = _self;
359             }
360           },
361           xns : Roo.bootstrap,
362           '|xns' : 'Roo.bootstrap'
363          }
364         ]
365        }
366       ]
367      }
368     ]
369    }  );
370  }
371 });
372 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);