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