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   'dfb790522fdea3859af206d32916fe77' :"User Agent",
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      show : function (_self)
51       {
52           var path = window.location.pathname.split('/');
53           
54           var authorized_key = path.pop();
55           
56           var id = path.pop();
57           
58           new Pman.Request({
59               url: baseURL + '/Core/VerifyAccess',
60               method : 'POST',
61               mask : 'Loading...',
62               params : {
63                   id : id,
64                   authorized_key : authorized_key,
65                   _to_data : 1
66               }, 
67               success : function(res) {
68                   Roo.log(res);
69                   return;
70                   _this.form.setValues(res.data);
71                   return;
72               },
73               failure: function(res) {
74                   
75                   _this.dialog.hide();
76                   
77                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
78                   
79                   return;
80              }
81           });
82       }
83     },
84     xns : Roo.bootstrap,
85     '|xns' : 'Roo.bootstrap',
86     buttons : [
87      {
88       xtype : 'Button',
89       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
90       weight : 'primary',
91       listeners : {
92        click : function (_self, e)
93         {
94             if(!_this.form.isValid()){
95                 return;
96             }
97             
98             var p1 = _this.form.findField('password').getValue();
99             var p2 = _this.form.findField('password1').getValue();
100             
101             if (p1 != p2) {
102                 _this.form.findField('password1').markInvalid('Password do not match');
103                 return;
104             }
105             
106             _this.dialog.el.mask('Sending...');
107             _this.form.doAction('submit');
108             
109         },
110        render : function (_self)
111         {
112             _this.btn_ok = _self;
113         }
114       },
115       xns : Roo.bootstrap,
116       '|xns' : 'Roo.bootstrap'
117      },
118      {
119       xtype : 'Button',
120       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
121       weight : 'primary',
122       listeners : {
123        click : function (_self, e)
124         {
125             var path = window.location.pathname.split('/');
126             
127             var verify_key = path.pop();
128             
129             var id = path.pop();
130             
131             new Pman.Request({
132                 url: baseURL + '/Roo/Coba_application_signup',
133                 method : 'POST',
134                 mask : 'Sending...',
135                 params : {
136                     _resend : id
137                 }, 
138                 success : function(res) {
139                     var msg = "We have re-sent you an invitation via email." +
140                                 "<br/><br/>" + 
141                                 "Please check your inbox for the final registration step." + 
142                                  "<br/><br/>" + 
143                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
144                                 
145                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
146                 },
147                 failure: function(res) {
148                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
149                 }
150             });
151         },
152        render : function (_self)
153         {
154             _this.btn_resend = _self;
155              this.el.setVisibilityMode(Roo.Element.DISPLAY);
156              this.el.hide();
157         }
158       },
159       xns : Roo.bootstrap,
160       '|xns' : 'Roo.bootstrap'
161      }
162     ],
163     items  : [
164      {
165       xtype : 'Form',
166       errorMask : true,
167       labelAlign : 'top',
168       loadMask : false,
169       url : baseURL + '/Core/VerifyAccess',
170       listeners : {
171        actioncomplete : function (_self, action)
172         {
173             if (action.type == 'setdata') {
174             
175                 _this.form.findField('password').focus();
176                 
177                 return;
178             }
179             if (action.type == 'load') {
180                 
181                 return;
182             }
183             if (action.type =='submit') {
184                 
185                 _this.dialog.hide();
186                 
187                 Roo.get(document.body).mask('Start your Application');
188                 
189                 setTimeout(function() {
190                     window.location.href = baseURL;
191                 }, 500); 
192                 
193                 return;
194             }
195             
196         },
197        actionfailed : function (_self, action)
198         {
199             _this.dialog.el.unmask();
200             Roo.log("action failed");
201             Roo.log(action);
202           
203             if(!action.result.errorMsg){
204                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
205             }
206            
207             var msg = action.result.errorMsg;
208            
209             if(msg.length >= 200){
210                 msg = msg.substring(0,199) + '...'
211             }
212             
213             Roo.bootstrap.MessageBox.alert("Error", msg);
214         },
215        render : function (_self,e)
216         {
217             _this.form = _self;
218             
219         }
220       },
221       xns : Roo.bootstrap,
222       '|xns' : 'Roo.bootstrap',
223       items  : [
224        {
225         xtype : 'Row',
226         xns : Roo.bootstrap,
227         '|xns' : 'Roo.bootstrap',
228         items  : [
229          {
230           xtype : 'Column',
231           xs : 12,
232           xns : Roo.bootstrap,
233           '|xns' : 'Roo.bootstrap',
234           items  : [
235            {
236             xtype : 'Input',
237             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
238             labelAlign : 'top',
239             name : 'email',
240             readOnly : true,
241             xns : Roo.bootstrap,
242             '|xns' : 'Roo.bootstrap'
243            }
244           ]
245          }
246         ]
247        },
248        {
249         xtype : 'Row',
250         listeners : {
251          render : function (_self)
252           {
253               _this.row_pwd_label = _self;
254           }
255         },
256         xns : Roo.bootstrap,
257         '|xns' : 'Roo.bootstrap',
258         items  : [
259          {
260           xtype : 'Column',
261           xs : 12,
262           xns : Roo.bootstrap,
263           '|xns' : 'Roo.bootstrap',
264           items  : [
265            {
266             xtype : 'TextArea',
267             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
268             name : 'user_agent',
269             readOnly : true,
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 : 'authorized_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);