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