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.sta)
181                 return;
182             }
183             if (action.type =='submit') {
184                 
185                 _this.dialog.hide();
186                 
187                 Roo.get(document.body).mask('Start your Application');
188                 
189                 setTimeout(function() {
190                     window.location.href = baseURL;
191                 }, 500); 
192                 
193                 return;
194             }
195             
196         },
197        actionfailed : function (_self, action)
198         {
199             _this.dialog.el.unmask();
200             Roo.log("action failed");
201             Roo.log(action);
202           
203             if(!action.result.errorMsg){
204                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
205             }
206            
207             var msg = action.result.errorMsg;
208            
209             if(msg.length >= 200){
210                 msg = msg.substring(0,199) + '...'
211             }
212             
213             Roo.bootstrap.MessageBox.alert("Error", msg);
214         },
215        render : function (_self,e)
216         {
217             _this.form = _self;
218             
219         }
220       },
221       xns : Roo.bootstrap,
222       '|xns' : 'Roo.bootstrap',
223       items  : [
224        {
225         xtype : 'Row',
226         xns : Roo.bootstrap,
227         '|xns' : 'Roo.bootstrap',
228         items  : [
229          {
230           xtype : 'Column',
231           xs : 12,
232           xns : Roo.bootstrap,
233           '|xns' : 'Roo.bootstrap',
234           items  : [
235            {
236             xtype : 'Input',
237             fieldLabel : _this._strings['f6039d44b29456b20f8f373155ae4973'] /* Username */,
238             name : 'email',
239             readOnly : true,
240             xns : Roo.bootstrap,
241             '|xns' : 'Roo.bootstrap'
242            }
243           ]
244          }
245         ]
246        },
247        {
248         xtype : 'Row',
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             style : 'margin-bottom: 15px;',
265             xns : Roo.bootstrap,
266             '|xns' : 'Roo.bootstrap'
267            }
268           ]
269          }
270         ]
271        },
272        {
273         xtype : 'Row',
274         xns : Roo.bootstrap,
275         '|xns' : 'Roo.bootstrap',
276         items  : [
277          {
278           xtype : 'Column',
279           xs : 12,
280           xns : Roo.bootstrap,
281           '|xns' : 'Roo.bootstrap',
282           items  : [
283            {
284             xtype : 'ComboBox',
285             allowBlank : false,
286             displayField : 'value',
287             editable : false,
288             fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
289             hiddenName : 'status',
290             mode : 'local',
291             name : 'status_name',
292             triggerAction : 'all',
293             valueField : 'code',
294             listeners : {
295              select : function (combo, record, index)
296               {
297                   
298               }
299             },
300             xns : Roo.bootstrap,
301             '|xns' : 'Roo.bootstrap',
302             store : {
303              xtype : 'SimpleStore',
304              data : [
305                  ['1', 'Approve'],
306                  ['-1', 'Reject']
307              ],
308              fields : [ 'code', 'value' ],
309              xns : Roo.data,
310              '|xns' : 'Roo.data'
311             }
312            }
313           ]
314          }
315         ]
316        },
317        {
318         xtype : 'Row',
319         xns : Roo.bootstrap,
320         '|xns' : 'Roo.bootstrap',
321         items  : [
322          {
323           xtype : 'Column',
324           xs : 12,
325           xns : Roo.bootstrap,
326           '|xns' : 'Roo.bootstrap',
327           items  : [
328            {
329             xtype : 'Input',
330             inputType : 'hidden',
331             name : 'id',
332             xns : Roo.bootstrap,
333             '|xns' : 'Roo.bootstrap'
334            },
335            {
336             xtype : 'Input',
337             inputType : 'hidden',
338             name : 'authorized_key',
339             xns : Roo.bootstrap,
340             '|xns' : 'Roo.bootstrap'
341            }
342           ]
343          }
344         ]
345        }
346       ]
347      },
348      {
349       xtype : 'Row',
350       listeners : {
351        render : function (_self)
352         {
353             _this.error_row = this;
354             
355             this.el.setVisibilityMode(Roo.Element.DISPLAY);
356             
357             this.el.hide();
358         }
359       },
360       xns : Roo.bootstrap,
361       '|xns' : 'Roo.bootstrap',
362       items  : [
363        {
364         xtype : 'Column',
365         xs : 12,
366         xns : Roo.bootstrap,
367         '|xns' : 'Roo.bootstrap',
368         items  : [
369          {
370           xtype : 'Element',
371           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
372           listeners : {
373            render : function (_self)
374             {
375                 _this.text_el = _self;
376             }
377           },
378           xns : Roo.bootstrap,
379           '|xns' : 'Roo.bootstrap'
380          }
381         ]
382        }
383       ]
384      }
385     ]
386    }  );
387  }
388 });
389 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);