Pman.Dialog.CmsLanguagePick.bjs
[Pman.Cms] / Pman.Dialog.CmsLanguagePick.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CmsLanguagePick = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 630,
36             resizable : false,
37             title : "Edit / Create Person",
38             width : 400,
39             modal : true,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'center',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 actioncomplete : function(_self,action)
51                                 {
52                                     if (action.type == 'setdata') {
53                                        //_this.dialog.el.mask("Loading");
54                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
55                                        return;
56                                     }
57                                     if (action.type == 'load') {
58                                         _this.dialog.el.unmask();
59                                         return;
60                                     }
61                                     if (action.type =='submit') {
62                                     
63                                         _this.dialog.el.unmask();
64                                         _this.dialog.hide();
65                                     
66                                          if (_this.callback) {
67                                             _this.callback.call(_this, _this.form.getValues());
68                                          }
69                                          _this.form.reset();
70                                          return;
71                                     }
72                                 },
73                                 rendered : function (form)
74                                 {
75                                     _this.form= form;
76                                 }
77                             },
78                             method : 'POST',
79                             style : 'margin:10px;',
80                             url : baseURL + '/Roo/Person.php',
81                             items : [
82                                 {
83                                     xtype: 'TextField',
84                                     xns: Roo.form,
85                                     fieldLabel : 'Lang',
86                                     name : 'lang',
87                                     width : 200
88                                 }
89                             ]
90                         }
91                     ]
92                 }
93             ],
94             center : {
95                 xtype: 'LayoutRegion',
96                 xns: Roo
97             },
98             buttons : [
99                 {
100                     xtype: 'Button',
101                     xns: Roo,
102                     listeners : {
103                         click : function (_self, e)
104                         {
105                             _this.dialog.hide();
106                         }
107                     },
108                     text : "Cancel"
109                 },
110                 {
111                     xtype: 'Button',
112                     xns: Roo,
113                     listeners : {
114                         click : function (_self, e)
115                         {
116                             // do some checks?
117                              
118                             
119                             _this.dialog.el.mask("Saving");
120                             _this.form.doAction("submit");
121                         
122                         }
123                     },
124                     text : "Save"
125                 }
126             ]
127         });
128     }
129 };