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 : 120,
36             modal : true,
37             resizable : false,
38             title : "Select a Language",
39             width : 400,
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 : 'GET',
79                             style : 'margin:10px;',
80                             url : baseURL + '/Roo/INGORE.php',
81                             items : [
82                                 {
83                                     xtype: 'ComboBox',
84                                     xns: Roo.form,
85                                     allowBlank : false,
86                                     alwaysQuery : true,
87                                     displayField : 'title',
88                                     editable : false,
89                                     fieldLabel : 'Language',
90                                     hiddenName : 'lang',
91                                     listWidth : 200,
92                                     name : 'language_name',
93                                     triggerAction : 'all',
94                                     valueField : 'code',
95                                     width : 200,
96                                     store : {
97                                         xtype: 'Store',
98                                         xns: Roo.data,
99                                         proxy : {
100                                             xtype: 'HttpProxy',
101                                             xns: Roo.data,
102                                             method : 'GET',
103                                             url : baseURL + '/I18N/Language.php'
104                                         },
105                                         reader : {
106                                             xtype: 'JsonReader',
107                                             xns: Roo.data,
108                                             id : 'code',
109                                             root : 'data',
110                                             totalProperty : 'total',
111                                             fields : [
112                                                 {
113                                                     'name': 'code',
114                                                     'type': 'string'
115                                                 },
116                                                 {
117                                                     'name': 'title',
118                                                     'type': 'string'
119                                                 }
120                                             ]
121                                         }
122                                     }
123                                 }
124                             ]
125                         }
126                     ]
127                 }
128             ],
129             center : {
130                 xtype: 'LayoutRegion',
131                 xns: Roo
132             },
133             buttons : [
134                 {
135                     xtype: 'Button',
136                     xns: Roo,
137                     listeners : {
138                         click : function (_self, e)
139                         {
140                             _this.dialog.hide();
141                         }
142                     },
143                     text : "Cancel"
144                 },
145                 {
146                     xtype: 'Button',
147                     xns: Roo,
148                     listeners : {
149                         click : function (_self, e)
150                         {
151                             // do some checks?
152                              
153                             
154                             _this.dialog.el.mask("Saving");
155                             _this.form.doAction("submit");
156                         
157                         }
158                     },
159                     text : "OK"
160                 }
161             ]
162         });
163     }
164 };