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