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