1 //<script type="text/javascript">
5 * A few usefull tools to convert language info...
7 * Our login details contain the available translation data..
10 * includes standard pulldowns.
16 * turn zh_HK,en => into Chinese(HK) , English
17 * @arg type type (c = country, l = lang)
18 * @arg codes list of languages
20 listToNames: function (type, codes)
24 var cl = codes.split(',');
25 Roo.each(cl , function(c) {
26 ret.push(_this.toName(type, c));
28 return ret.join(', ');
32 * turns zh_HK into a Chinese(HK)
33 * @arg type type (c = country, l = lang)
34 * @arg langcode language code (eg. zh_HK, UK etc.)
37 toName: function(type, code)
40 Roo.each(Pman.Login.authUser.i18n[type], function(d) {
50 * zh_HK,en to [ { code=zh_HK, title=Chinese }, .... ]
51 * @arg type type (c = country, l = lang)
52 * @arg codes list of languages
54 listToObjects: function (type, codes)
61 var cl = codes.split(',');
62 Roo.each(cl , function(c) {
65 title : _this.toName(type,c)
73 reader : { // std. reader for i18n items.
75 totalProperty : 'total',
84 countryStore : function() { return {
90 url: baseURL + '/I18N/Country.html',
94 reader: Pman.I18n.reader,
97 loadexception : Pman.loadException
102 field: 'title', direction: 'ASC'
106 languageStore: function() {return{
111 url: baseURL + '/I18N/Lang.html',
115 reader: Pman.I18n.reader,
118 loadexception : Pman.loadException
123 field: 'title', direction: 'ASC'
126 currencyStore: function() {return{
131 url: baseURL + '/I18N/Currency.html',
135 reader: Pman.I18n.reader,
138 loadexception : Pman.loadException
143 field: 'title', direction: 'ASC'
147 country: function(cfg) {
151 // things that might need chnaging
152 name : 'country_title',
153 hiddenName : 'country',
156 fieldLabel : "Country",
160 qtip : "Select Country",
165 store: this.countryStore(),
166 displayField:'title',
171 triggerAction: 'all',
172 //emptyText:'Select a state...',
177 language: function(cfg) {
181 // things that might need chnaging
183 name : 'language_title',
184 hiddenName : 'language',
187 fieldLabel : "Language",
191 qtip : "Select Language",
196 store: this.languageStore(),
197 displayField:'title',
203 triggerAction: 'all',
204 //emptyText:'Select a state...',
210 currency: function(cfg) {
214 // things that might need chnaging
215 name : 'currency_title',
216 hiddenName : 'currency',
219 fieldLabel : "Currency",
223 qtip : "Select Currency",
228 store: this.currencyStore(),
234 triggerAction: 'all',
235 //emptyText:'Select a state...',
237 tpl: new Ext.Template(
238 '<div class="x-grid-cell-text x-btn button">',
239 '{title} ({code})</b>',
246 languageList : function(cfg) {
253 fieldLabel : "Language(s)",
256 renderer : function(d) {
257 return String.format('{0}', d.title );
261 xtype: 'ComboBoxLister',
262 displayField:'title',
265 qtip : "Select a language to add.",
271 store: this.languageStore(),
275 forceSelection: true,
277 triggerAction: 'all',
278 tpl: new Ext.Template(
279 '<div class="x-grid-cell-text x-btn button">',
283 queryParam: 'query[name]',
284 loadingText: "Searching...",
289 setList : function(ar) {
291 Roo.each(ar, function(a) {
295 toList : function() {
297 this.items.each(function(a) {
306 countryList : function(cfg) {
313 fieldLabel : "Country(s)",
316 renderer : function(d) {
317 return String.format('{0}', d.title );
321 xtype: 'ComboBoxLister',
322 displayField:'title',
325 qtip : "Select a country to add.",
331 store: this.countryStore(),
335 forceSelection: true,
337 triggerAction: 'all',
338 tpl: new Ext.Template(
339 '<div class="x-grid-cell-text x-btn button">',
343 queryParam: 'query[name]',
344 loadingText: "Searching...",
349 setList : function(ar) {
351 Roo.each(ar, function(a) {
355 toList : function() {
357 this.items.each(function(a) {