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   'd41d8cd98f00b204e9800998ecf8427e' :"",
12   'b945ed1d61d8edbe16a1192ad6d2fd58' :"Please enter a memorable password for logging into your application",
13   '07ae22a49223522664766d12c37a4eeb' :"Activate Your account",
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     size : 'sm',
49     title : _this._strings['07ae22a49223522664766d12c37a4eeb'] /* Activate Your account */,
50     listeners : {
51      render : function (_self)
52       {
53           _this.modal = _self;
54       },
55      show : function (_self)
56       {
57           var path = window.location.pathname.split('/');
58           
59           var authorized_key = path.pop();
60           
61           var id = path.pop();
62           
63           new Pman.Request({
64               url: baseURL + '/Core/VerifyAccess',
65               method : 'POST',
66               params : {
67                   id : id,
68                   authorized_key : authorized_key,
69                   _to_data : 1
70               }, 
71               success : function(res) {
72                   _this.form.setValues(res.data);
73                   return;
74               },
75               failure: function(res) {
76                   
77                   _this.dialog.hide();
78                   
79                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
80                   
81                   return;
82              }
83           });
84       }
85     },
86     xns : Roo.bootstrap,
87     '|xns' : 'Roo.bootstrap',
88     buttons : [
89      {
90       xtype : 'Button',
91       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
92       weight : 'primary',
93       listeners : {
94        click : function (_self, e)
95         {
96             if(!_this.form.isValid()){
97                 return;
98             }
99             
100             var p1 = _this.form.findField('password').getValue();
101             var p2 = _this.form.findField('password1').getValue();
102             
103             if (p1 != p2) {
104                 _this.form.findField('password1').markInvalid('Password do not match');
105                 return;
106             }
107             
108             _this.dialog.el.mask('Sending...');
109             _this.form.doAction('submit');
110             
111         },
112        render : function (_self)
113         {
114             _this.btn_ok = _self;
115         }
116       },
117       xns : Roo.bootstrap,
118       '|xns' : 'Roo.bootstrap'
119      },
120      {
121       xtype : 'Button',
122       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
123       weight : 'primary',
124       listeners : {
125        click : function (_self, e)
126         {
127             var path = window.location.pathname.split('/');
128             
129             var verify_key = path.pop();
130             
131             var id = path.pop();
132             
133             new Pman.Request({
134                 url: baseURL + '/Roo/Coba_application_signup',
135                 method : 'POST',
136                 mask : 'Sending...',
137                 params : {
138                     _resend : id
139                 }, 
140                 success : function(res) {
141                     var msg = "We have re-sent you an invitation via email." +
142                                 "<br/><br/>" + 
143                                 "Please check your inbox for the final registration step." + 
144                                  "<br/><br/>" + 
145                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
146                                 
147                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
148                 },
149                 failure: function(res) {
150                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
151                 }
152             });
153         },
154        render : function (_self)
155         {
156             _this.btn_resend = _self;
157              this.el.setVisibilityMode(Roo.Element.DISPLAY);
158              this.el.hide();
159         }
160       },
161       xns : Roo.bootstrap,
162       '|xns' : 'Roo.bootstrap'
163      }
164     ],
165     items  : [
166      {
167       xtype : 'Form',
168       errorMask : true,
169       loadMask : false,
170       url : baseURL + '/Register/Confirm',
171       listeners : {
172        actioncomplete : function (_self, action)
173         {
174             if (action.type == 'setdata') {
175             
176                 _this.form.findField('password').focus();
177                 
178                 return;
179             }
180             if (action.type == 'load') {
181                 
182                 return;
183             }
184             if (action.type =='submit') {
185                 
186                 _this.dialog.hide();
187                 
188                 Roo.get(document.body).mask('Start your Application');
189                 
190                 setTimeout(function() {
191                     window.location.href = baseURL;
192                 }, 500); 
193                 
194                 return;
195             }
196             
197         },
198        actionfailed : function (_self, action)
199         {
200             _this.dialog.el.unmask();
201             Roo.log("action failed");
202             Roo.log(action);
203           
204             if(!action.result.errorMsg){
205                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
206             }
207            
208             var msg = action.result.errorMsg;
209            
210             if(msg.length >= 200){
211                 msg = msg.substring(0,199) + '...'
212             }
213             
214             Roo.bootstrap.MessageBox.alert("Error", msg);
215         },
216        render : function (_self,e)
217         {
218             _this.form = _self;
219             
220         }
221       },
222       xns : Roo.bootstrap,
223       '|xns' : 'Roo.bootstrap',
224       items  : [
225        {
226         xtype : 'Row',
227         xns : Roo.bootstrap,
228         '|xns' : 'Roo.bootstrap',
229         items  : [
230          {
231           xtype : 'Column',
232           xs : 12,
233           xns : Roo.bootstrap,
234           '|xns' : 'Roo.bootstrap',
235           items  : [
236            {
237             xtype : 'Input',
238             fieldLabel : _this._strings['ee7ad62ad69b9ab5f25d273e4e0a1736'] /* Your Username */,
239             labelAlign : 'top',
240             name : 'email',
241             readOnly : true,
242             xns : Roo.bootstrap,
243             '|xns' : 'Roo.bootstrap'
244            }
245           ]
246          }
247         ]
248        },
249        {
250         xtype : 'Row',
251         listeners : {
252          render : function (_self)
253           {
254               _this.row_pwd_label = _self;
255           }
256         },
257         xns : Roo.bootstrap,
258         '|xns' : 'Roo.bootstrap',
259         items  : [
260          {
261           xtype : 'Column',
262           xs : 12,
263           xns : Roo.bootstrap,
264           '|xns' : 'Roo.bootstrap',
265           items  : [
266            {
267             xtype : 'FieldLabel',
268             html : _this._strings['b945ed1d61d8edbe16a1192ad6d2fd58'] /* Please enter a memorable password for logging into your application */,
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 : 'verify_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);