roojs-all.js
[roojs1] / examples / bootstrap / Dialog.Login.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('Dialog');
6
7 Dialog.Login = {
8
9  _strings : {
10   'dc647eb65e6711e155375218212b3964' :"Password",
11   '01a569ddc6cf67ddec2a683f0a5f5956' :"Forgot your password?",
12   'd837cc5a72556c5e2abf4b9fe10ddef8' :"Login ",
13   '5047040b025ce0295b58d42250014417' :"<div id=\"login-err\" class=\"dialog-err\" style=\"color:red\"></div>",
14   '643a860f992333b8600ea264aca7c4fc' :"Email Address"
15  },
16
17  dialog : false,
18  callback:  false,
19
20  show : function(data, cb)
21  {
22   if (!this.dialog) {
23    this.create();
24   }
25
26   this.callback = cb;
27   this.data = data;
28   this.dialog.show(this.data._el);
29   if (this.form) {
30    this.form.reset();
31    this.form.setValues(data);
32    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
33   }
34
35  },
36
37  create : function()
38  {
39   var _this = this;
40   this.dialog = Roo.factory({
41     '|xns' : 'Roo.bootstrap',
42     title : _this._strings['d837cc5a72556c5e2abf4b9fe10ddef8]',
43     xtype : 'Modal',
44     buttonPosition : 'center',
45     buttons : Roo.bootstrap.Modal.OKCANCEL,
46     xns : Roo.bootstrap,
47     listeners : {
48      btnclick : function (e)
49       {
50           if(e == 'cancel'){
51               _this.dialog.hide();
52               return;
53           }
54           
55           _this.form.doAction('submit');
56       },
57      render : function (_self) {
58       
59           Roo.get('login-err').dom.innerHTML = "";
60           
61       },
62      show : function (_self)
63       {
64           Roo.get('login-err').dom.innerHTML = "";
65       }
66     },
67     items : [
68      {
69       '|xns' : 'Roo.bootstrap',
70       xtype : 'Row',
71       xns : Roo.bootstrap,
72       style : 'margin-top:20px;',
73       items : [
74        {
75         '|xns' : 'Roo.bootstrap',
76         xtype : 'Container',
77         cls : 'col-md-12',
78         xns : Roo.bootstrap,
79         items : [
80          {
81           '|xns' : 'Roo.bootstrap',
82           url : baseURL + '/Login',
83           labelAlign : 'left',
84           xtype : 'Form',
85           method : 'POST',
86           xns : Roo.bootstrap,
87           listeners : {
88            actionfailed : function (_self, action) {
89                 Roo.log('action failed?!');
90                 Roo.log(action);
91                 
92                 if (typeof(action) != 'undefined' && action.failureType == 'server') {    
93             
94                     Roo.get('login-err').dom.innerHTML = action.result.errorMsg;
95                     return;
96                 }
97                 
98                 Roo.get('login-err').dom.innerHTML = "Fill in all the required fields";
99             },
100            actioncomplete : function (_self, action) {
101                 
102                 if (action.type =='submit') {
103                     Roo.log(action);
104                     _this.dialog.hide();
105                 
106                     if (_this.callback) {
107                         _this.callback.call(_this, action.result);
108                      }
109                      
110                      _this.form.reset();
111                      
112                      return;
113                 }
114             },
115            render : function (_self) {
116                 _this.form = _self;
117             }
118           },
119           items : [
120            {
121             '|xns' : 'Roo.bootstrap',
122             xtype : 'Container',
123             cls : 'col-sm-12',
124             xns : Roo.bootstrap,
125             items : [
126              {
127               '|xns' : 'Roo.bootstrap',
128               inputType : 'email',
129               xtype : 'Input',
130               vtype : 'email',
131               placeholder : _this._strings['643a860f992333b8600ea264aca7c4fc]',
132               allowBlank : false,
133               xns : Roo.bootstrap,
134               name : 'email',
135               listeners : {
136                specialkey : function (_self, e)
137                 {
138                     if(e.getKey() == 13){
139                         _this.form.doAction('submit');
140                     }
141                     
142                 }
143               }
144              },
145              {
146               '|xns' : 'Roo.bootstrap',
147               inputType : 'password',
148               xtype : 'Input',
149               placeholder : _this._strings['dc647eb65e6711e155375218212b3964]',
150               allowBlank : false,
151               xns : Roo.bootstrap,
152               name : 'password',
153               listeners : {
154                specialkey : function (_self, e)
155                 {
156                     if(e.getKey() == 13){
157                         _this.form.doAction('submit');
158                     }
159                 }
160               }
161              }
162             ]
163
164            }
165           ]
166
167          }
168         ]
169
170        }
171       ]
172
173      },
174      {
175       '|xns' : 'Roo.bootstrap',
176       xtype : 'Row',
177       xns : Roo.bootstrap,
178       style : 'margin-top:20px;',
179       items : [
180        {
181         '|xns' : 'Roo.bootstrap',
182         xtype : 'Container',
183         cls : 'col-md-12',
184         xns : Roo.bootstrap,
185         items : [
186          {
187           '|xns' : 'Roo.bootstrap',
188           tag : 'a',
189           xtype : 'Button',
190           html : _this._strings['01a569ddc6cf67ddec2a683f0a5f5956]',
191           removeClass : true,
192           xns : Roo.bootstrap,
193           weight : 'link',
194           href : '#',
195           listeners : {
196            click : function () {
197                 _this.dialog.hide();
198                 
199                 Hydra.Dialog.ForgotPassword.show({}, function(){
200                     Roo.bootstrap.MessageBox.alert('Notice', 'The password has been sent to your email');
201                 });
202             }
203           }
204          }
205         ]
206
207        }
208       ]
209
210      },
211      {
212       '|xns' : 'Roo.bootstrap',
213       xtype : 'Row',
214       xns : Roo.bootstrap,
215       items : [
216        {
217         '|xns' : 'Roo.bootstrap',
218         xtype : 'Container',
219         cls : 'col-md-12',
220         xns : Roo.bootstrap,
221         items : [
222          {
223           '|xns' : 'Roo.bootstrap',
224           xtype : 'Container',
225           style : 'margin-top:20px;',
226           cls : 'bg-danger',
227           html : _this._strings['5047040b025ce0295b58d42250014417]',
228           xns : Roo.bootstrap
229          }
230         ]
231
232        }
233       ]
234
235      }
236     ]
237
238    }  );
239  }
240 };