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',
34 _tree : function(_data)
39 xtype : 'NestedLayoutPanel',
41 title : _this._strings['4e7c16d320ae129cc81b296e05748b3a'] /* Translate App */,
45 xtype : 'BorderLayout',
49 xtype : 'LayoutRegion',
50 alwaysShowTabs : true,
62 title : _this._strings['a1d1ae170f841c328acdc6052511ed8c'] /* Text in interface */,
64 activate : function() {
67 _this.grid.getDataSource().reload();
75 autoExpandColumn : 'txt',
79 afteredit : function (e)
81 var saveRec = function(rec)
85 //g.getView().el.mask('Saving');
87 url : baseURL + '/Admin/Translations.php',
92 lang : _this.langCombo.getValue(),
93 module : _this.modCombo.getValue()
97 //g.getView().el.unmask();
98 //g.getDataSource().reload();
102 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
103 // g.getView().el.unmask();
109 saveRec.defer(1000, _this, [ e.record ]);
111 beforeedit : function(e) {
112 console.log('beforeedit');
113 //if (e.record.get('origtxt').indexOf('<') > -1) {
114 // console.log("HTML EDITOR!!");
118 if (e.record.get('txt').replace(/\s+/, '').length) {
121 if (e.record.get('suggest').length) {
122 e.record.set('txt', e.record.get('suggest'));
123 // _this.saveRec(e.record);
130 var tl = e.record.get('id').split('/')[0];
132 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
133 tl = tl.replace('_', '-');
138 Pman.gtranslate(e.record.get('origtxt'), 'en', tl, function(result) {
139 if (typeof(result) == 'object') { //error
143 if (_this.grid.activeEditor) {
144 _this.grid.activeEditor.setValue(result);
146 rec.set('txt',result);
147 //_this.saveRec(rec);
153 //console.log(result.translation);
160 celldblclick : function (_self, rowIndex, columnIndex, e)
162 var di = this.colModel.config[columnIndex].dataIndex;
163 if (di != 'reset_tx') {
166 rec = this.ds.getAt(rowIndex);
171 url : baseURL + '/Admin/Translations.php',
176 lang : _this.langCombo.getValue(),
177 module : _this.modCombo.getValue()
181 //g.getView().el.unmask();
182 //g.getDataSource().reload();
187 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
188 // g.getView().el.unmask();
195 render : function() {
197 //_this.dialog = Pman.Dialog.FILL_IN
198 if (_this.panel.active) {
199 _this.grid.getDataSource().reload();
212 displayField : 'module',
214 emptyText : _this._strings['b51c3fa7e0ae26a1d88bf1279f265bb4'] /* Select Module */,
216 selectOnFocus : true,
217 triggerAction : 'all',
219 valueField : 'module',
222 render : function (_self)
224 _this.modCombo = _self;
226 select : function (combo, record, index)
228 _this.grid.getDataSource().reload();
234 xtype : 'SimpleStore',
237 AppModules = typeof(AppModules) == 'undefined' ? '' : AppModules;
238 Roo.each( AppModules.split(','), function(mod) {
239 modlist.push( [ mod ] );
250 displayField : 'ldisp',
252 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
254 selectOnFocus : true,
255 triggerAction : 'all',
260 render : function (_self)
262 _this.langCombo=_self;
264 select : function (combo, record, index)
266 _this.grid.getDataSource().reload();
272 xtype : 'SimpleStore',
273 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
274 fields : ['lang', 'ldisp'],
282 '|xns' : 'Roo.Toolbar'
286 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
288 click : function (_self, e)
297 '|xns' : 'Roo.Toolbar'
303 reader : Pman.Readers.Category,
305 beforeload : function (_self, opts)
308 if (!_this.langCombo || !_this.langCombo.getValue().length) {
311 if (!_this.modCombo || !_this.modCombo.getValue().length) {
315 lang : _this.langCombo.getValue(),
316 module : _this.modCombo.getValue()
319 loadexception : function (self, ret, load, jsonData)
321 Roo.MessageBox.alert("Error", jsonData);
329 url : baseURL + '/Admin/Translations.php',
334 xtype : 'JsonReader',
335 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' ],
338 totalProperty : 'total',
345 xtype : 'ColumnModel',
346 dataIndex : 'colname',
347 header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
348 renderer : function(v,x,r) {
350 if (r.get('updated') < r.get('origupdated')) {
354 return '<div style="color:'+c+'";>' +r.get('tableid')+ ':' + v + '</div>';
361 xtype : 'ColumnModel',
362 dataIndex : 'origtxt',
363 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
364 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>'; },
370 xtype : 'ColumnModel',
371 dataIndex : 'reset_tx',
372 header : _this._strings['526d688f37a86d3c3f27d0c5016eb71d'] /* Reset */,
373 renderer : function(v,x,r) {
374 return '<img src="' + rootURL + '/Pman/templates/images/edit-clear.gif' + '" width="16" height="16">';
381 xtype : 'ColumnModel',
383 header : _this._strings['e2ade2e0b88406a390f59b5232abb328'] /* Translated (Click to Edit) */,
384 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>'; },
389 xtype : 'GridEditor',
409 title : _this._strings['0a9e8bd9e8b301dfb2c21c355e0b377d'] /* Languages and Countries */,
411 activate : function() {
412 _this.langpanel = this;
413 if (_this.langgrid) {
414 _this.langgrid.ds.load({});
421 xtype : 'EditorGrid',
422 autoExpandColumn : 'lval',
426 afteredit : function (e)
428 var saveRec = function(rec)
432 //g.getView().el.mask('Saving');
434 url : baseURL + '/Roo/I18n.php',
438 lval : rec.get('lval')
442 //g.getView().el.unmask();
443 //g.getDataSource().reload();
447 Ext.Msg.alert("Error", "There was a problem saving the data - try reloading");
448 // g.getView().el.unmask();
454 saveRec.defer(1000, _this, [ e.record ]);
456 beforeedit : function(e) {
457 console.log('beforeedit');
458 //if (e.record.get('origtxt').indexOf('<') > -1) {
459 // console.log("HTML EDITOR!!");
463 if (e.record.get('lval').replace(/\s+/, '').length) {
468 var tl = _this.langgridCombo.getValue();
470 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
471 tl = tl.replace('_', '-');
476 Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) {
477 if (typeof(result) == 'object') { //error
481 if (_this.grid.activeEditor) {
482 _this.grid.activeEditor.setValue(result);
484 rec.set('lval',result);
485 //_this.saveRec(rec);
491 //console.log(result.translation);
498 cellclick : function (_self, rowIndex, columnIndex, e)
500 if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){
504 var s = _this.langgrid.ds.getAt(rowIndex);
506 if(!s || s.data.id * 1 < 0){
510 s.set('is_active', s.data.is_active ? 0 : 1);
513 url : baseURL+'/Roo/I18n',
517 is_active : s.data.is_active
524 _this.langgrid = this;
525 //_this.dialog = Pman.Dialog.FILL_IN
526 if (_this.langpanel.active) {
540 displayField : 'lval',
542 emptyText : _this._strings['552bcc4e00cd663f09cc4efbaca1cd45'] /* Select Translation of */,
544 selectOnFocus : true,
545 triggerAction : 'all',
550 render : function (_self)
552 _this.langtypeCombo = _self;
554 select : function (combo, record, index)
556 _this.langgrid.getDataSource().reload();
562 xtype : 'SimpleStore',
564 [ 'l', 'Language Names' ],
565 [ 'c', 'Country Names' ],
566 [ 'm', 'Currency Names' ]
568 fields : ['lkey','lval'],
575 displayField : 'ldisp',
577 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
579 selectOnFocus : true,
580 triggerAction : 'all',
585 render : function (_self)
587 _this.langgridCombo=_self;
589 select : function (combo, record, index)
591 _this.langgrid.getDataSource().reload();
597 xtype : 'SimpleStore',
598 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
599 fields : ['lang', 'ldisp'],
609 sortInfo : { field : 'lkey', direction: 'ASC' },
611 beforeload : function (_self, options)
613 options =options || {};
614 options.params =options.params|| {};
615 options.params.ltype = _this.langtypeCombo.getValue();
616 options.params.inlang = _this.langgridCombo.getValue();
617 options.params['query[_with_en]'] = 1;
618 if (!options.params.ltype.length || !options.params.inlang.length) {
622 options.params.limit = 9999;
631 url : baseURL + '/Roo/i18n.php',
636 xtype : 'JsonReader',
661 totalProperty : 'total',
668 xtype : 'ColumnModel',
670 header : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
671 renderer : function(v) { return String.format('{0}', v); },
677 xtype : 'ColumnModel',
678 dataIndex : 'lval_en',
679 header : _this._strings['78463a384a5aa4fad5fa73e2f506ecfc'] /* English */,
680 renderer : function(v) { return String.format('{0}', v); },
686 xtype : 'ColumnModel',
688 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
689 renderer : function(v) { return String.format('{0}', v); },
694 xtype : 'GridEditor',
705 xtype : 'ColumnModel',
706 dataIndex : 'is_active',
707 header : _this._strings['ae739a236065a45c64ad51aacb19498c'] /* Active? */,
708 renderer : function(v,x,r) {
710 return '<img class="x-grid-check-icon' + (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';