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          }
263         ]
264        },
265        {
266         xtype : 'Row',
267         listeners : {
268          render : function (_self)
269           {
270               _this.row_pwd1 = _self;
271           }
272         },
273         xns : Roo.bootstrap,
274         '|xns' : 'Roo.bootstrap',
275         items  : [
276          {
277           xtype : 'Column',
278           xs : 12,
279           xns : Roo.bootstrap,
280           '|xns' : 'Roo.bootstrap',
281           items  : [
282            {
283             xtype : 'SecurePass',
284             allowBlank : false,
285             inputType : 'password',
286             labelAlign : 'top',
287             name : 'password',
288             placeholder : _this._strings['51eea3dc60ae3a0b1bb8188bc6337dc2'] /* enter password */,
289             xns : Roo.bootstrap,
290             '|xns' : 'Roo.bootstrap'
291            }
292           ]
293          }
294         ]
295        },
296        {
297         xtype : 'Row',
298         listeners : {
299          render : function (_self)
300           {
301               _this.row_pwd2 = _self;
302           }
303         },
304         xns : Roo.bootstrap,
305         '|xns' : 'Roo.bootstrap',
306         items  : [
307          {
308           xtype : 'Column',
309           xs : 12,
310           xns : Roo.bootstrap,
311           '|xns' : 'Roo.bootstrap',
312           items  : [
313            {
314             xtype : 'Input',
315             allowBlank : false,
316             inputType : 'password',
317             invalidText : 'The passwords you entered do not match',
318             name : 'password1',
319             placeholder : _this._strings['1849ffc8731b5e74ae6157c91ba73575'] /* Please confirm your password */,
320             validator : function(v){
321                 
322                 if(_this.form.findField('password').getValue() == v) {
323                     
324                     return true;
325                 }
326                 
327                 return false;
328             },
329             xns : Roo.bootstrap,
330             '|xns' : 'Roo.bootstrap'
331            }
332           ]
333          }
334         ]
335        },
336        {
337         xtype : 'Row',
338         xns : Roo.bootstrap,
339         '|xns' : 'Roo.bootstrap',
340         items  : [
341          {
342           xtype : 'Column',
343           xs : 8,
344           xns : Roo.bootstrap,
345           '|xns' : 'Roo.bootstrap',
346           items  : [
347            {
348             xtype : 'Input',
349             inputType : 'hidden',
350             name : 'id',
351             xns : Roo.bootstrap,
352             '|xns' : 'Roo.bootstrap'
353            },
354            {
355             xtype : 'Input',
356             inputType : 'hidden',
357             name : 'authorized_key',
358             xns : Roo.bootstrap,
359             '|xns' : 'Roo.bootstrap'
360            }
361           ]
362          }
363         ]
364        }
365       ]
366      },
367      {
368       xtype : 'Row',
369       listeners : {
370        render : function (_self)
371         {
372             _this.error_row = this;
373             
374             this.el.setVisibilityMode(Roo.Element.DISPLAY);
375             
376             this.el.hide();
377         }
378       },
379       xns : Roo.bootstrap,
380       '|xns' : 'Roo.bootstrap',
381       items  : [
382        {
383         xtype : 'Column',
384         xs : 12,
385         xns : Roo.bootstrap,
386         '|xns' : 'Roo.bootstrap',
387         items  : [
388          {
389           xtype : 'Element',
390           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
391           listeners : {
392            render : function (_self)
393             {
394                 _this.text_el = _self;
395             }
396           },
397           xns : Roo.bootstrap,
398           '|xns' : 'Roo.bootstrap'
399          }
400         ]
401        }
402       ]
403      }
404     ]
405    }  );
406  }
407 });
408 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);