1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.AdminTranslations = new Roo.XComponent({
10 '0a52da7a03a6de3beefe54f8c03ad80d' :"Original",
11 'ae739a236065a45c64ad51aacb19498c' :"Active?",
12 '801ab24683a4a8c433c6eb40c48bcd9d' :"Download",
13 'e2ade2e0b88406a390f59b5232abb328' :"Translated (Click to Edit)",
14 '6dd08874f83507e9c7b23f1a46b7fa7c' :"Translation",
15 '83dad8107f9459efe2b4fabcf5b63108' :"Select Language",
16 'a1d1ae170f841c328acdc6052511ed8c' :"Text in interface",
17 '78463a384a5aa4fad5fa73e2f506ecfc' :"English",
18 '4e7c16d320ae129cc81b296e05748b3a' :"Translate App",
19 '526d688f37a86d3c3f27d0c5016eb71d' :"Reset",
20 'b51c3fa7e0ae26a1d88bf1279f265bb4' :"Select Module",
21 '49ee3087348e8d44e1feda1917443987' :"Name",
22 '552bcc4e00cd663f09cc4efbaca1cd45' :"Select Translation of",
23 'ca0dbad92a874b2f69b549293387925e' :"Code",
24 '0a9e8bd9e8b301dfb2c21c355e0b377d' :"Languages and Countries"
27 part : ["Admin", "Translations" ],
28 order : '950-Pman.Tab.AdminTranslations',
30 parent : 'Pman.Tab.Admin',
31 name : "Admin - Translations",
33 permname : 'Admin.Translations',
40 title : _this._strings['4e7c16d320ae129cc81b296e05748b3a'] /* Translate App */,
43 xtype : 'NestedLayoutPanel',
47 xtype : 'BorderLayout',
49 alwaysShowTabs : true,
53 xtype : 'LayoutRegion'
61 title : _this._strings['a1d1ae170f841c328acdc6052511ed8c'] /* Text in interface */,
66 activate : function() {
69 _this.grid.getDataSource().reload();
74 autoExpandColumn : 'txt',
81 afteredit : function (e)
83 var saveRec = function(rec)
87 //g.getView().el.mask('Saving');
89 url : baseURL + '/Admin/Translations.php',
94 lang : _this.langCombo.getValue(),
95 module : _this.modCombo.getValue()
99 //g.getView().el.unmask();
100 //g.getDataSource().reload();
104 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
105 // g.getView().el.unmask();
111 saveRec.defer(1000, _this, [ e.record ]);
113 beforeedit : function(e) {
114 console.log('beforeedit');
115 //if (e.record.get('origtxt').indexOf('<') > -1) {
116 // console.log("HTML EDITOR!!");
120 if (e.record.get('txt').replace(/\s+/, '').length) {
123 if (e.record.get('suggest').length) {
124 e.record.set('txt', e.record.get('suggest'));
125 // _this.saveRec(e.record);
132 var tl = e.record.get('id').split('/')[0];
134 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
135 tl = tl.replace('_', '-');
140 Pman.gtranslate(e.record.get('origtxt'), 'en', tl, function(result) {
141 if (typeof(result) == 'object') { //error
145 if (_this.grid.activeEditor) {
146 _this.grid.activeEditor.setValue(result);
148 rec.set('txt',result);
149 //_this.saveRec(rec);
155 //console.log(result.translation);
162 celldblclick : function (_self, rowIndex, columnIndex, e)
164 var di = this.colModel.config[columnIndex].dataIndex;
165 if (di != 'reset_tx') {
168 rec = this.ds.getAt(rowIndex);
173 url : baseURL + '/Admin/Translations.php',
178 lang : _this.langCombo.getValue(),
179 module : _this.modCombo.getValue()
183 //g.getView().el.unmask();
184 //g.getDataSource().reload();
189 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
190 // g.getView().el.unmask();
197 render : function() {
199 //_this.dialog = Pman.Dialog.FILL_IN
200 if (_this.panel.active) {
201 _this.grid.getDataSource().reload();
211 displayField : 'module',
213 emptyText : _this._strings['b51c3fa7e0ae26a1d88bf1279f265bb4'] /* Select Module */,
215 selectOnFocus : true,
216 triggerAction : 'all',
218 valueField : 'module',
224 render : function (_self)
226 _this.modCombo = _self;
228 select : function (combo, record, index)
230 _this.grid.getDataSource().reload();
236 AppModules = typeof(AppModules) == 'undefined' ? '' : AppModules;
237 Roo.each( AppModules.split(','), function(mod) {
238 modlist.push( [ mod ] );
245 xtype : 'SimpleStore'
249 displayField : 'ldisp',
251 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
253 selectOnFocus : true,
254 triggerAction : 'all',
262 render : function (_self)
264 _this.langCombo=_self;
266 select : function (combo, record, index)
268 _this.grid.getDataSource().reload();
272 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
273 fields : ['lang', 'ldisp'],
276 xtype : 'SimpleStore'
281 '|xns' : 'Roo.Toolbar',
285 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
287 '|xns' : 'Roo.Toolbar',
290 click : function (_self, e)
302 reader : Pman.Readers.Category,
307 beforeload : function (_self, opts)
310 if (!_this.langCombo || !_this.langCombo.getValue().length) {
313 if (!_this.modCombo || !_this.modCombo.getValue().length) {
317 lang : _this.langCombo.getValue(),
318 module : _this.modCombo.getValue()
321 loadexception : function (self, ret, load, jsonData)
323 Roo.MessageBox.alert("Error", jsonData);
328 url : baseURL + '/Admin/Translations.php',
334 fields : [ 'id', 'tablename', 'tableid', 'colname', 'txt', 'lang', { name:'updated', type:'date', dateFormat: 'Y-m-d H:i:s' }, { name:'origupdated', type:'date', dateFormat: 'Y-m-d H:i:s' }, 'origtxt', 'msum', 'suggest' ],
337 totalProperty : 'total',
345 dataIndex : 'colname',
346 header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
347 renderer : function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style="color:'+c+'";>' +r.get('tableid')+ ':' + v + '</div>'; },
351 xtype : 'ColumnModel'
354 dataIndex : 'origtxt',
355 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
356 renderer : function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style="color:' + c+ '">' + Ext.util.Format.htmlEncode(v) + '</div>'; },
360 xtype : 'ColumnModel'
363 dataIndex : 'reset_tx',
364 header : _this._strings['526d688f37a86d3c3f27d0c5016eb71d'] /* Reset */,
365 renderer : function(v,x,r) {
366 return '<img src="' + rootURL + '/Pman/templates/images/edit-clear.gif' + '" width="16" height="16">';
371 xtype : 'ColumnModel'
375 header : _this._strings['e2ade2e0b88406a390f59b5232abb328'] /* Translated (Click to Edit) */,
376 renderer : function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style="color:' + c+ '">' + Ext.util.Format.htmlEncode(v) + '</div>'; },
380 xtype : 'ColumnModel',
384 xtype : 'GridEditor',
401 title : _this._strings['0a9e8bd9e8b301dfb2c21c355e0b377d'] /* Languages and Countries */,
406 activate : function() {
407 _this.langpanel = this;
408 if (_this.langgrid) {
409 _this.langgrid.ds.load({});
414 autoExpandColumn : 'lval',
419 xtype : 'EditorGrid',
421 afteredit : function (e)
423 var saveRec = function(rec)
427 //g.getView().el.mask('Saving');
429 url : baseURL + '/Roo/I18n.php',
433 lval : rec.get('lval')
437 //g.getView().el.unmask();
438 //g.getDataSource().reload();
442 Ext.Msg.alert("Error", "There was a problem saving the data - try reloading");
443 // g.getView().el.unmask();
449 saveRec.defer(1000, _this, [ e.record ]);
451 beforeedit : function(e) {
452 console.log('beforeedit');
453 //if (e.record.get('origtxt').indexOf('<') > -1) {
454 // console.log("HTML EDITOR!!");
458 if (e.record.get('lval').replace(/\s+/, '').length) {
463 var tl = _this.langgridCombo.getValue();
465 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
466 tl = tl.replace('_', '-');
471 Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) {
472 if (typeof(result) == 'object') { //error
476 if (_this.grid.activeEditor) {
477 _this.grid.activeEditor.setValue(result);
479 rec.set('lval',result);
480 //_this.saveRec(rec);
486 //console.log(result.translation);
493 cellclick : function (_self, rowIndex, columnIndex, e)
495 if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){
499 var s = _this.langgrid.ds.getAt(rowIndex);
501 if(!s || s.data.id * 1 < 0){
505 s.set('is_active', s.data.is_active ? 0 : 1);
508 url : baseURL+'/Roo/I18n',
512 is_active : s.data.is_active
519 _this.langgrid = this;
520 //_this.dialog = Pman.Dialog.FILL_IN
521 if (_this.langpanel.active) {
532 displayField : 'lval',
534 emptyText : _this._strings['552bcc4e00cd663f09cc4efbaca1cd45'] /* Select Translation of */,
536 selectOnFocus : true,
537 triggerAction : 'all',
545 render : function (_self)
547 _this.langtypeCombo = _self;
549 select : function (combo, record, index)
551 _this.langgrid.getDataSource().reload();
556 [ 'l', 'Language Names' ],
557 [ 'c', 'Country Names' ],
558 [ 'm', 'Currency Names' ]
560 fields : ['lkey','lval'],
563 xtype : 'SimpleStore'
567 displayField : 'ldisp',
569 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
571 selectOnFocus : true,
572 triggerAction : 'all',
580 render : function (_self)
582 _this.langgridCombo=_self;
584 select : function (combo, record, index)
586 _this.langgrid.getDataSource().reload();
590 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
591 fields : ['lang', 'ldisp'],
594 xtype : 'SimpleStore'
601 sortInfo : { field : 'lkey', direction: 'ASC' },
606 beforeload : function (_self, options)
608 options =options || {};
609 options.params =options.params|| {};
610 options.params.ltype = _this.langtypeCombo.getValue();
611 options.params.inlang = _this.langgridCombo.getValue();
612 options.params['query[_with_en]'] = 1;
613 if (!options.params.ltype.length || !options.params.inlang.length) {
617 options.params.limit = 9999;
623 url : baseURL + '/Roo/i18n.php',
653 totalProperty : 'total',
662 header : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
663 renderer : function(v) { return String.format('{0}', v); },
667 xtype : 'ColumnModel'
670 dataIndex : 'lval_en',
671 header : _this._strings['78463a384a5aa4fad5fa73e2f506ecfc'] /* English */,
672 renderer : function(v) { return String.format('{0}', v); },
676 xtype : 'ColumnModel'
680 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
681 renderer : function(v) { return String.format('{0}', v); },
685 xtype : 'ColumnModel',
689 xtype : 'GridEditor',
698 dataIndex : 'is_active',
699 header : _this._strings['ae739a236065a45c64ad51aacb19498c'] /* Active? */,
700 renderer : function(v,x,r) {
702 return '<img class="x-grid-check-icon' + (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
709 xtype : 'ColumnModel'