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