fix missing var issue
[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 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.CmsLanguagePick = {
8
9  _strings : {
10   '4994a8ffeba4ac3140beb89e8d41f174' :"Language",
11   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
12   '052ca52fc8eb1bdff3e34de3fa735e35' :"Select a Language",
13   'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
14  },
15
16  dialog : false,
17  callback:  false,
18
19  show : function(data, cb)
20  {
21   if (!this.dialog) {
22    this.create();
23   }
24
25   this.callback = cb;
26   this.data = data;
27   this.dialog.show(this.data._el);
28   if (this.form) {
29    this.form.reset();
30    this.form.setValues(data);
31    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
32   }
33
34  },
35
36  create : function()
37  {
38    var _this = this;
39    this.dialog = Roo.factory({
40     xtype : 'LayoutDialog',
41     closable : false,
42     collapsible : false,
43     height : 120,
44     modal : true,
45     resizable : false,
46     title : _this._strings['052ca52fc8eb1bdff3e34de3fa735e35'] /* Select a Language */,
47     width : 400,
48     xns : Roo,
49     '|xns' : 'Roo',
50     center : {
51      xtype : 'LayoutRegion',
52      xns : Roo,
53      '|xns' : 'Roo'
54     },
55     buttons : [
56      {
57       xtype : 'Button',
58       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
59       listeners : {
60        click : function (_self, e)
61         {
62             _this.dialog.hide();
63         }
64       },
65       xns : Roo,
66       '|xns' : 'Roo'
67      },
68      {
69       xtype : 'Button',
70       text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
71       listeners : {
72        click : function (_self, e)
73         {
74             // do some checks?
75              
76             var data =  _this.form.getValues();
77          
78             if (!data.lang.length) {
79             
80                 Roo.MessageBox.alert("Error", "Select language");
81                 return;
82             
83             }
84             _this.dialog.hide();
85                     
86             var callbackData = data.lang;
87            // Roo.log(_this.data);
88             if(_this.data._with_name == true){
89                 callbackData = {'lang' : data.lang , 'lang_name' : _this.form.findField('lang').lastSelectionText};
90             }
91             
92             _this.callback(callbackData);
93             
94         
95         }
96       },
97       xns : Roo,
98       '|xns' : 'Roo'
99      }
100     ],
101     items  : [
102      {
103       xtype : 'ContentPanel',
104       region : 'center',
105       xns : Roo,
106       '|xns' : 'Roo',
107       items  : [
108        {
109         xtype : 'Form',
110         method : 'GET',
111         style : 'margin:10px;',
112         url : baseURL + '/Roo/INGORE.php',
113         listeners : {
114          actioncomplete : function(_self,action)
115           {
116               if (action.type == 'setdata') {
117                  //_this.dialog.el.mask("Loading");
118                  //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
119                  return;
120               }
121               if (action.type == 'load') {
122                   _this.dialog.el.unmask();
123                   return;
124               }
125               if (action.type =='submit') {
126               
127                   _this.dialog.el.unmask();
128                   _this.dialog.hide();
129           
130                    if (_this.callback) {
131                       _this.callback.call(_this, _this.form.getValues());
132                    }
133                    _this.form.reset();
134                    return;
135               }
136           },
137          rendered : function (form)
138           {
139               _this.form= form;
140           }
141         },
142         xns : Roo.form,
143         '|xns' : 'Roo.form',
144         items  : [
145          {
146           xtype : 'ComboBox',
147           allowBlank : false,
148           alwaysQuery : true,
149           displayField : 'title',
150           editable : false,
151           fieldLabel : _this._strings['4994a8ffeba4ac3140beb89e8d41f174'] /* Language */,
152           hiddenName : 'lang',
153           listWidth : 200,
154           name : 'language_name',
155           triggerAction : 'all',
156           valueField : 'code',
157           width : 200,
158           xns : Roo.form,
159           '|xns' : 'Roo.form',
160           store : {
161            xtype : 'Store',
162            listeners : {
163             beforeload : function (_self, o)
164              {
165                  o.params['!code'] = 'en'; // exclude english from the list (it's the default?)
166              }
167            },
168            xns : Roo.data,
169            '|xns' : 'Roo.data',
170            proxy : {
171             xtype : 'HttpProxy',
172             method : 'GET',
173             url : baseURL + '/Core/I18n/Lang',
174             xns : Roo.data,
175             '|xns' : 'Roo.data'
176            },
177            reader : {
178             xtype : 'JsonReader',
179             fields : [
180                 {
181                     'name': 'code',
182                     'type': 'string'
183                 },
184                 {
185                     'name': 'title',
186                     'type': 'string'
187                 }
188             ],
189             id : 'code',
190             root : 'data',
191             totalProperty : 'total',
192             xns : Roo.data,
193             '|xns' : 'Roo.data'
194            }
195           }
196          }
197         ]
198        }
199       ]
200      }
201     ]
202    });
203  }
204 };