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