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