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                   _this.form.setValues(res.data);
68                   return;
69               },
70               failure: function(res) {
71                   
72                   _this.dialog.hide();
73                   
74                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
75                   
76                   return;
77              }
78           });
79       }
80     },
81     xns : Roo.bootstrap,
82     '|xns' : 'Roo.bootstrap',
83     buttons : [
84      {
85       xtype : 'Button',
86       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
87       weight : 'primary',
88       listeners : {
89        click : function (_self, e)
90         {
91             if(!_this.form.isValid()){
92                 return;
93             }
94             
95             var p1 = _this.form.findField('password').getValue();
96             var p2 = _this.form.findField('password1').getValue();
97             
98             if (p1 != p2) {
99                 _this.form.findField('password1').markInvalid('Password do not match');
100                 return;
101             }
102             
103             _this.dialog.el.mask('Sending...');
104             _this.form.doAction('submit');
105             
106         },
107        render : function (_self)
108         {
109             _this.btn_ok = _self;
110         }
111       },
112       xns : Roo.bootstrap,
113       '|xns' : 'Roo.bootstrap'
114      },
115      {
116       xtype : 'Button',
117       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
118       weight : 'primary',
119       listeners : {
120        click : function (_self, e)
121         {
122             var path = window.location.pathname.split('/');
123             
124             var verify_key = path.pop();
125             
126             var id = path.pop();
127             
128             new Pman.Request({
129                 url: baseURL + '/Roo/Coba_application_signup',
130                 method : 'POST',
131                 mask : 'Sending...',
132                 params : {
133                     _resend : id
134                 }, 
135                 success : function(res) {
136                     var msg = "We have re-sent you an invitation via email." +
137                                 "<br/><br/>" + 
138                                 "Please check your inbox for the final registration step." + 
139                                  "<br/><br/>" + 
140                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
141                                 
142                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
143                 },
144                 failure: function(res) {
145                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
146                 }
147             });
148         },
149        render : function (_self)
150         {
151             _this.btn_resend = _self;
152              this.el.setVisibilityMode(Roo.Element.DISPLAY);
153              this.el.hide();
154         }
155       },
156       xns : Roo.bootstrap,
157       '|xns' : 'Roo.bootstrap'
158      }
159     ],
160     items  : [
161      {
162       xtype : 'Form',
163       errorMask : true,
164       labelAlign : 'top',
165       loadMask : false,
166       url : baseURL + '/Core/VerifyAccess',
167       listeners : {
168        actioncomplete : function (_self, action)
169         {
170             if (action.type == 'setdata') {
171                 
172                 return;
173             }
174             if (action.type == 'load') {
175                 
176                 if(_this.data.sta)
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         xns : Roo.bootstrap,
246         '|xns' : 'Roo.bootstrap',
247         items  : [
248          {
249           xtype : 'Column',
250           xs : 12,
251           xns : Roo.bootstrap,
252           '|xns' : 'Roo.bootstrap',
253           items  : [
254            {
255             xtype : 'TextArea',
256             fieldLabel : _this._strings['dfb790522fdea3859af206d32916fe77'] /* User Agent */,
257             name : 'user_agent',
258             readOnly : true,
259             rows : 3,
260             style : 'margin-bottom: 15px;',
261             xns : Roo.bootstrap,
262             '|xns' : 'Roo.bootstrap'
263            }
264           ]
265          }
266         ]
267        },
268        {
269         xtype : 'Row',
270         xns : Roo.bootstrap,
271         '|xns' : 'Roo.bootstrap',
272         items  : [
273          {
274           xtype : 'Column',
275           xs : 12,
276           xns : Roo.bootstrap,
277           '|xns' : 'Roo.bootstrap',
278           items  : [
279            {
280             xtype : 'ComboBox',
281             allowBlank : false,
282             displayField : 'value',
283             editable : false,
284             fieldLabel : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */,
285             hiddenName : 'status',
286             mode : 'local',
287             name : 'status_name',
288             triggerAction : 'all',
289             valueField : 'code',
290             listeners : {
291              select : function (combo, record, index)
292               {
293                   
294               }
295             },
296             xns : Roo.bootstrap,
297             '|xns' : 'Roo.bootstrap',
298             store : {
299              xtype : 'SimpleStore',
300              data : [
301                  ['1', 'Approve'],
302                  ['-1', 'Reject']
303              ],
304              fields : [ 'code', 'value' ],
305              xns : Roo.data,
306              '|xns' : 'Roo.data'
307             }
308            }
309           ]
310          }
311         ]
312        },
313        {
314         xtype : 'Row',
315         xns : Roo.bootstrap,
316         '|xns' : 'Roo.bootstrap',
317         items  : [
318          {
319           xtype : 'Column',
320           xs : 12,
321           xns : Roo.bootstrap,
322           '|xns' : 'Roo.bootstrap',
323           items  : [
324            {
325             xtype : 'Input',
326             inputType : 'hidden',
327             name : 'id',
328             xns : Roo.bootstrap,
329             '|xns' : 'Roo.bootstrap'
330            },
331            {
332             xtype : 'Input',
333             inputType : 'hidden',
334             name : 'authorized_key',
335             xns : Roo.bootstrap,
336             '|xns' : 'Roo.bootstrap'
337            }
338           ]
339          }
340         ]
341        }
342       ]
343      },
344      {
345       xtype : 'Row',
346       listeners : {
347        render : function (_self)
348         {
349             _this.error_row = this;
350             
351             this.el.setVisibilityMode(Roo.Element.DISPLAY);
352             
353             this.el.hide();
354         }
355       },
356       xns : Roo.bootstrap,
357       '|xns' : 'Roo.bootstrap',
358       items  : [
359        {
360         xtype : 'Column',
361         xs : 12,
362         xns : Roo.bootstrap,
363         '|xns' : 'Roo.bootstrap',
364         items  : [
365          {
366           xtype : 'Element',
367           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
368           listeners : {
369            render : function (_self)
370             {
371                 _this.text_el = _self;
372             }
373           },
374           xns : Roo.bootstrap,
375           '|xns' : 'Roo.bootstrap'
376          }
377         ]
378        }
379       ]
380      }
381     ]
382    }  );
383  }
384 });
385 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);