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                   Roo.log(res);
67                   return;
68                   _this.form.setValues(res.data);
69                   return;
70               },
71               failure: function(res) {
72                   
73                   _this.dialog.hide();
74                   
75                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
76                   
77                   return;
78              }
79           });
80       }
81     },
82     xns : Roo.bootstrap,
83     '|xns' : 'Roo.bootstrap',
84     buttons : [
85      {
86       xtype : 'Button',
87       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
88       weight : 'primary',
89       listeners : {
90        click : function (_self, e)
91         {
92             if(!_this.form.isValid()){
93                 return;
94             }
95             
96             var p1 = _this.form.findField('password').getValue();
97             var p2 = _this.form.findField('password1').getValue();
98             
99             if (p1 != p2) {
100                 _this.form.findField('password1').markInvalid('Password do not match');
101                 return;
102             }
103             
104             _this.dialog.el.mask('Sending...');
105             _this.form.doAction('submit');
106             
107         },
108        render : function (_self)
109         {
110             _this.btn_ok = _self;
111         }
112       },
113       xns : Roo.bootstrap,
114       '|xns' : 'Roo.bootstrap'
115      },
116      {
117       xtype : 'Button',
118       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
119       weight : 'primary',
120       listeners : {
121        click : function (_self, e)
122         {
123             var path = window.location.pathname.split('/');
124             
125             var verify_key = path.pop();
126             
127             var id = path.pop();
128             
129             new Pman.Request({
130                 url: baseURL + '/Roo/Coba_application_signup',
131                 method : 'POST',
132                 mask : 'Sending...',
133                 params : {
134                     _resend : id
135                 }, 
136                 success : function(res) {
137                     var msg = "We have re-sent you an invitation via email." +
138                                 "<br/><br/>" + 
139                                 "Please check your inbox for the final registration step." + 
140                                  "<br/><br/>" + 
141                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
142                                 
143                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
144                 },
145                 failure: function(res) {
146                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
147                 }
148             });
149         },
150        render : function (_self)
151         {
152             _this.btn_resend = _self;
153              this.el.setVisibilityMode(Roo.Element.DISPLAY);
154              this.el.hide();
155         }
156       },
157       xns : Roo.bootstrap,
158       '|xns' : 'Roo.bootstrap'
159      }
160     ],
161     items  : [
162      {
163       xtype : 'Form',
164       errorMask : true,
165       labelAlign : 'top',
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             name : 'email',
237             readOnly : true,
238             xns : Roo.bootstrap,
239             '|xns' : 'Roo.bootstrap'
240            }
241           ]
242          }
243         ]
244        },
245        {
246         xtype : 'Row',
247         listeners : {
248          render : function (_self)
249           {
250               _this.row_pwd_label = _self;
251           }
252         },
253         xns : Roo.bootstrap,
254         '|xns' : 'Roo.bootstrap',
255         items  : [
256          {
257           xtype : 'Column',
258           xs : 12,
259           xns : Roo.bootstrap,
260           '|xns' : 'Roo.bootstrap',
261           items  : [
262            {
263             xtype : 'TextArea',
264             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
265             name : 'user_agent',
266             readOnly : true,
267             xns : Roo.bootstrap,
268             '|xns' : 'Roo.bootstrap'
269            }
270           ]
271          }
272         ]
273        },
274        {
275         xtype : 'Row',
276         xns : Roo.bootstrap,
277         '|xns' : 'Roo.bootstrap',
278         items  : [
279          {
280           xtype : 'Column',
281           xs : 8,
282           xns : Roo.bootstrap,
283           '|xns' : 'Roo.bootstrap',
284           items  : [
285            {
286             xtype : 'Input',
287             inputType : 'hidden',
288             name : 'id',
289             xns : Roo.bootstrap,
290             '|xns' : 'Roo.bootstrap'
291            },
292            {
293             xtype : 'Input',
294             inputType : 'hidden',
295             name : 'authorized_key',
296             xns : Roo.bootstrap,
297             '|xns' : 'Roo.bootstrap'
298            }
299           ]
300          }
301         ]
302        }
303       ]
304      },
305      {
306       xtype : 'Row',
307       listeners : {
308        render : function (_self)
309         {
310             _this.error_row = this;
311             
312             this.el.setVisibilityMode(Roo.Element.DISPLAY);
313             
314             this.el.hide();
315         }
316       },
317       xns : Roo.bootstrap,
318       '|xns' : 'Roo.bootstrap',
319       items  : [
320        {
321         xtype : 'Column',
322         xs : 12,
323         xns : Roo.bootstrap,
324         '|xns' : 'Roo.bootstrap',
325         items  : [
326          {
327           xtype : 'Element',
328           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
329           listeners : {
330            render : function (_self)
331             {
332                 _this.text_el = _self;
333             }
334           },
335           xns : Roo.bootstrap,
336           '|xns' : 'Roo.bootstrap'
337          }
338         ]
339        }
340       ]
341      }
342     ]
343    }  );
344  }
345 });
346 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);