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',
42 alwaysShowTabs : true,
45 xtype : 'LayoutRegion'
49 xtype : 'BorderLayout',
57 url : baseURL + '/Admin/Translations.php',
63 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' ],
66 totalProperty : 'total',
71 reader : Pman.Readers.Category,
75 beforeload : function (_self, opts)
78 if (!_this.langCombo || !_this.langCombo.getValue().length) {
81 if (!_this.modCombo || !_this.modCombo.getValue().length) {
85 lang : _this.langCombo.getValue(),
86 module : _this.modCombo.getValue()
89 loadexception : function (self, ret, load, jsonData)
91 Roo.MessageBox.alert("Error", jsonData);
109 AppModules = typeof(AppModules) == 'undefined' ? '' : AppModules;
110 Roo.each( AppModules.split(','), function(mod) {
111 modlist.push( [ mod ] );
117 xtype : 'SimpleStore'
120 displayField : 'module',
122 emptyText : _this._strings['b51c3fa7e0ae26a1d88bf1279f265bb4'],
124 selectOnFocus : true,
125 triggerAction : 'all',
127 valueField : 'module',
132 render : function (_self)
134 _this.modCombo = _self;
136 select : function (combo, record, index)
138 _this.grid.getDataSource().reload();
149 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
150 fields : ['lang', 'ldisp'],
152 xtype : 'SimpleStore'
155 displayField : 'ldisp',
157 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'],
159 selectOnFocus : true,
160 triggerAction : 'all',
167 render : function (_self)
169 _this.langCombo=_self;
171 select : function (combo, record, index)
173 _this.grid.getDataSource().reload();
182 '|xns' : 'Roo.Toolbar',
187 '|xns' : 'Roo.Toolbar',
188 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'],
192 click : function (_self, e)
205 autoExpandColumn : 'txt',
209 xtype : 'EditorGrid',
213 dataIndex : 'colname',
214 header : _this._strings['49ee3087348e8d44e1feda1917443987'],
215 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>'; },
218 xtype : 'ColumnModel'
222 dataIndex : 'origtxt',
223 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'],
224 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>'; },
227 xtype : 'ColumnModel'
231 dataIndex : 'reset_tx',
232 header : _this._strings['526d688f37a86d3c3f27d0c5016eb71d'],
233 renderer : function(v,x,r) {
234 return '<img src="' + rootURL + '/Pman/templates/images/edit-clear.gif' + '" width="16" height="16">';
238 xtype : 'ColumnModel'
249 xtype : 'GridEditor',
257 header : _this._strings['e2ade2e0b88406a390f59b5232abb328'],
258 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>'; },
261 xtype : 'ColumnModel',
269 afteredit : function (e)
271 var saveRec = function(rec)
275 //g.getView().el.mask('Saving');
277 url : baseURL + '/Admin/Translations.php',
281 txt : rec.get('txt'),
282 lang : _this.langCombo.getValue(),
283 module : _this.modCombo.getValue()
287 //g.getView().el.unmask();
288 //g.getDataSource().reload();
292 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
293 // g.getView().el.unmask();
299 saveRec.defer(1000, _this, [ e.record ]);
301 beforeedit : function(e) {
302 console.log('beforeedit');
303 //if (e.record.get('origtxt').indexOf('<') > -1) {
304 // console.log("HTML EDITOR!!");
308 if (e.record.get('txt').replace(/\s+/, '').length) {
311 if (e.record.get('suggest').length) {
312 e.record.set('txt', e.record.get('suggest'));
313 // _this.saveRec(e.record);
320 var tl = e.record.get('id').split('/')[0];
322 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
323 tl = tl.replace('_', '-');
328 Pman.gtranslate(e.record.get('origtxt'), 'en', tl, function(result) {
329 if (typeof(result) == 'object') { //error
333 if (_this.grid.activeEditor) {
334 _this.grid.activeEditor.setValue(result);
336 rec.set('txt',result);
337 //_this.saveRec(rec);
343 //console.log(result.translation);
350 celldblclick : function (_self, rowIndex, columnIndex, e)
352 var di = this.colModel.config[columnIndex].dataIndex;
353 if (di != 'reset_tx') {
356 rec = this.ds.getAt(rowIndex);
361 url : baseURL + '/Admin/Translations.php',
366 lang : _this.langCombo.getValue(),
367 module : _this.modCombo.getValue()
371 //g.getView().el.unmask();
372 //g.getDataSource().reload();
377 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
378 // g.getView().el.unmask();
385 render : function() {
387 //_this.dialog = Pman.Dialog.FILL_IN
388 if (_this.panel.active) {
389 _this.grid.getDataSource().reload();
403 title : _this._strings['a1d1ae170f841c328acdc6052511ed8c'],
407 activate : function() {
410 _this.grid.getDataSource().reload();
425 url : baseURL + '/Roo/i18n.php',
455 totalProperty : 'total',
461 sortInfo : { field : 'lkey', direction: 'ASC' },
465 beforeload : function (_self, options)
467 options =options || {};
468 options.params =options.params|| {};
469 options.params.ltype = _this.langtypeCombo.getValue();
470 options.params.inlang = _this.langgridCombo.getValue();
471 options.params['query[_with_en]'] = 1;
472 if (!options.params.ltype.length || !options.params.inlang.length) {
476 options.params.limit = 9999;
494 [ 'l', 'Language Names' ],
495 [ 'c', 'Country Names' ],
496 [ 'm', 'Currency Names' ]
498 fields : ['lkey','lval'],
500 xtype : 'SimpleStore'
503 displayField : 'lval',
505 emptyText : _this._strings['552bcc4e00cd663f09cc4efbaca1cd45'],
507 selectOnFocus : true,
508 triggerAction : 'all',
515 render : function (_self)
517 _this.langtypeCombo = _self;
519 select : function (combo, record, index)
521 _this.langgrid.getDataSource().reload();
532 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
533 fields : ['lang', 'ldisp'],
535 xtype : 'SimpleStore'
538 displayField : 'ldisp',
540 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'],
542 selectOnFocus : true,
543 triggerAction : 'all',
550 render : function (_self)
552 _this.langgridCombo=_self;
554 select : function (combo, record, index)
556 _this.langgrid.getDataSource().reload();
568 autoExpandColumn : 'lval',
572 xtype : 'EditorGrid',
577 header : _this._strings['ca0dbad92a874b2f69b549293387925e'],
578 renderer : function(v) { return String.format('{0}', v); },
581 xtype : 'ColumnModel'
585 dataIndex : 'lval_en',
586 header : _this._strings['78463a384a5aa4fad5fa73e2f506ecfc'],
587 renderer : function(v) { return String.format('{0}', v); },
590 xtype : 'ColumnModel'
601 xtype : 'GridEditor',
609 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'],
610 renderer : function(v) { return String.format('{0}', v); },
613 xtype : 'ColumnModel',
621 dataIndex : 'is_active',
622 header : _this._strings['ae739a236065a45c64ad51aacb19498c'],
623 renderer : function(v,x,r) {
625 return '<img class="x-grid-check-icon' + (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
631 xtype : 'ColumnModel'
635 afteredit : function (e)
637 var saveRec = function(rec)
641 //g.getView().el.mask('Saving');
643 url : baseURL + '/Roo/I18n.php',
647 lval : rec.get('lval')
651 //g.getView().el.unmask();
652 //g.getDataSource().reload();
656 Ext.Msg.alert("Error", "There was a problem saving the data - try reloading");
657 // g.getView().el.unmask();
663 saveRec.defer(1000, _this, [ e.record ]);
665 beforeedit : function(e) {
666 console.log('beforeedit');
667 //if (e.record.get('origtxt').indexOf('<') > -1) {
668 // console.log("HTML EDITOR!!");
672 if (e.record.get('lval').replace(/\s+/, '').length) {
677 var tl = _this.langgridCombo.getValue();
679 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
680 tl = tl.replace('_', '-');
685 Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) {
686 if (typeof(result) == 'object') { //error
690 if (_this.grid.activeEditor) {
691 _this.grid.activeEditor.setValue(result);
693 rec.set('lval',result);
694 //_this.saveRec(rec);
700 //console.log(result.translation);
707 cellclick : function (_self, rowIndex, columnIndex, e)
709 if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){
713 var s = _this.langgrid.ds.getAt(rowIndex);
715 if(!s || s.data.id * 1 < 0){
719 s.set('is_active', s.data.is_active ? 0 : 1);
722 url : baseURL+'/Roo/I18n',
726 is_active : s.data.is_active
733 _this.langgrid = this;
734 //_this.dialog = Pman.Dialog.FILL_IN
735 if (_this.langpanel.active) {
751 title : _this._strings['0a9e8bd9e8b301dfb2c21c355e0b377d'],
755 activate : function() {
756 _this.langpanel = this;
757 if (_this.langgrid) {
758 _this.langgrid.ds.load({});
772 title : _this._strings['4e7c16d320ae129cc81b296e05748b3a'],
774 xtype : 'NestedLayoutPanel',