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