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                 return;
174             }
175             if (action.type == 'load') {
176                 
177                 return;
178             }
179             if (action.type =='submit') {
180                 
181                 _this.dialog.hide();
182                 
183                 Roo.get(document.body).mask('Start your Application');
184                 
185                 setTimeout(function() {
186                     window.location.href = baseURL;
187                 }, 500); 
188                 
189                 return;
190             }
191             
192         },
193        actionfailed : function (_self, action)
194         {
195             _this.dialog.el.unmask();
196             Roo.log("action failed");
197             Roo.log(action);
198           
199             if(!action.result.errorMsg){
200                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
201             }
202            
203             var msg = action.result.errorMsg;
204            
205             if(msg.length >= 200){
206                 msg = msg.substring(0,199) + '...'
207             }
208             
209             Roo.bootstrap.MessageBox.alert("Error", msg);
210         },
211        render : function (_self,e)
212         {
213             _this.form = _self;
214             
215         }
216       },
217       xns : Roo.bootstrap,
218       '|xns' : 'Roo.bootstrap',
219       items  : [
220        {
221         xtype : 'Row',
222         xns : Roo.bootstrap,
223         '|xns' : 'Roo.bootstrap',
224         items  : [
225          {
226           xtype : 'Column',
227           xs : 12,
228           xns : Roo.bootstrap,
229           '|xns' : 'Roo.bootstrap',
230           items  : [
231            {
232             xtype : 'Input',
233             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
234             name : 'email',
235             readOnly : true,
236             xns : Roo.bootstrap,
237             '|xns' : 'Roo.bootstrap'
238            }
239           ]
240          }
241         ]
242        },
243        {
244         xtype : 'Row',
245         listeners : {
246          render : function (_self)
247           {
248               _this.row_pwd_label = _self;
249           }
250         },
251         xns : Roo.bootstrap,
252         '|xns' : 'Roo.bootstrap',
253         items  : [
254          {
255           xtype : 'Column',
256           xs : 12,
257           xns : Roo.bootstrap,
258           '|xns' : 'Roo.bootstrap',
259           items  : [
260            {
261             xtype : 'TextArea',
262             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
263             name : 'user_agent',
264             readOnly : true,
265             rows : 3,
266             xns : Roo.bootstrap,
267             '|xns' : 'Roo.bootstrap'
268            }
269           ]
270          }
271         ]
272        },
273        {
274         xtype : 'Row',
275         xns : Roo.bootstrap,
276         '|xns' : 'Roo.bootstrap',
277         items  : [
278          {
279           xtype : 'Column',
280           xs : 8,
281           xns : Roo.bootstrap,
282           '|xns' : 'Roo.bootstrap',
283           items  : [
284            {
285             xtype : 'Input',
286             inputType : 'hidden',
287             name : 'id',
288             xns : Roo.bootstrap,
289             '|xns' : 'Roo.bootstrap'
290            },
291            {
292             xtype : 'Input',
293             inputType : 'hidden',
294             name : 'authorized_key',
295             xns : Roo.bootstrap,
296             '|xns' : 'Roo.bootstrap'
297            }
298           ]
299          }
300         ]
301        }
302       ]
303      },
304      {
305       xtype : 'Row',
306       listeners : {
307        render : function (_self)
308         {
309             _this.error_row = this;
310             
311             this.el.setVisibilityMode(Roo.Element.DISPLAY);
312             
313             this.el.hide();
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 : 'Element',
327           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
328           listeners : {
329            render : function (_self)
330             {
331                 _this.text_el = _self;
332             }
333           },
334           xns : Roo.bootstrap,
335           '|xns' : 'Roo.bootstrap'
336          }
337         ]
338        }
339       ]
340      }
341     ]
342    }  );
343  }
344 });
345 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);