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