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          }
269         ]
270        },
271        {
272         xtype : 'Row',
273         listeners : {
274          render : function (_self)
275           {
276               _this.row_pwd_label = _self;
277           }
278         },
279         xns : Roo.bootstrap,
280         '|xns' : 'Roo.bootstrap',
281         items  : [
282          {
283           xtype : 'Column',
284           xs : 12,
285           xns : Roo.bootstrap,
286           '|xns' : 'Roo.bootstrap',
287           items  : [
288            {
289             xtype : 'ComboBox',
290             allowBlank : false,
291             displayField : 'value',
292             editable : false,
293             hiddenName : 'status',
294             mode : 'local',
295             name : 'status_name',
296             triggerAction : 'all',
297             valueField : 'code',
298             listeners : {
299              select : function (combo, record, index)
300               {
301                   
302               }
303             },
304             xns : Roo.bootstrap,
305             '|xns' : 'Roo.bootstrap',
306             store : {
307              xtype : 'SimpleStore',
308              data : [
309                  ['all', 'All'],
310                  ['submitted', 'Submitted'],
311                  ['pending_submission', 'Pending Submission'],
312                  ['pending_approval', 'Pending Approval'],
313                  ['rejected', 'Rejected'],
314                  ['approved', 'Approved'],
315                  ['deleted', 'Deleted']
316              ],
317              fields : [ 'code', 'value' ],
318              xns : Roo.data,
319              '|xns' : 'Roo.data'
320             }
321            }
322           ]
323          }
324         ]
325        },
326        {
327         xtype : 'Row',
328         xns : Roo.bootstrap,
329         '|xns' : 'Roo.bootstrap',
330         items  : [
331          {
332           xtype : 'Column',
333           xs : 12,
334           xns : Roo.bootstrap,
335           '|xns' : 'Roo.bootstrap',
336           items  : [
337            {
338             xtype : 'Input',
339             inputType : 'hidden',
340             name : 'id',
341             xns : Roo.bootstrap,
342             '|xns' : 'Roo.bootstrap'
343            },
344            {
345             xtype : 'Input',
346             inputType : 'hidden',
347             name : 'authorized_key',
348             xns : Roo.bootstrap,
349             '|xns' : 'Roo.bootstrap'
350            }
351           ]
352          }
353         ]
354        }
355       ]
356      },
357      {
358       xtype : 'Row',
359       listeners : {
360        render : function (_self)
361         {
362             _this.error_row = this;
363             
364             this.el.setVisibilityMode(Roo.Element.DISPLAY);
365             
366             this.el.hide();
367         }
368       },
369       xns : Roo.bootstrap,
370       '|xns' : 'Roo.bootstrap',
371       items  : [
372        {
373         xtype : 'Column',
374         xs : 12,
375         xns : Roo.bootstrap,
376         '|xns' : 'Roo.bootstrap',
377         items  : [
378          {
379           xtype : 'Element',
380           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
381           listeners : {
382            render : function (_self)
383             {
384                 _this.text_el = _self;
385             }
386           },
387           xns : Roo.bootstrap,
388           '|xns' : 'Roo.bootstrap'
389          }
390         ]
391        }
392       ]
393      }
394     ]
395    }  );
396  }
397 });
398 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);