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