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