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