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