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 '4994a8ffeba4ac3140beb89e8d41f174' :"Language",
12 'ae739a236065a45c64ad51aacb19498c' :"Active?",
13 'd41d8cd98f00b204e9800998ecf8427e' :"",
14 '801ab24683a4a8c433c6eb40c48bcd9d' :"Download",
15 'e2ade2e0b88406a390f59b5232abb328' :"Translated (Click to Edit)",
16 '6dd08874f83507e9c7b23f1a46b7fa7c' :"Translation",
17 '83dad8107f9459efe2b4fabcf5b63108' :"Select Language",
18 'a1d1ae170f841c328acdc6052511ed8c' :"Text in interface",
19 '78463a384a5aa4fad5fa73e2f506ecfc' :"English",
20 '4e7c16d320ae129cc81b296e05748b3a' :"Translate App",
21 '526d688f37a86d3c3f27d0c5016eb71d' :"Reset",
22 'b51c3fa7e0ae26a1d88bf1279f265bb4' :"Select Module",
23 '49ee3087348e8d44e1feda1917443987' :"Name",
24 '552bcc4e00cd663f09cc4efbaca1cd45' :"Select Translation of",
25 'ca0dbad92a874b2f69b549293387925e' :"Code",
26 '0a9e8bd9e8b301dfb2c21c355e0b377d' :"Languages and Countries"
29 'language_title_value' : 'd41d8cd98f00b204e9800998ecf8427e' /* */ ,
30 'language_title_qtip' : '83dad8107f9459efe2b4fabcf5b63108' /* Select Language */ ,
31 'language_title_fieldLabel' : '4994a8ffeba4ac3140beb89e8d41f174' /* Language */
34 part : ["Admin", "Translations" ],
35 order : '950-Pman.Tab.AdminTranslations',
37 parent : 'Pman.Tab.Admin',
38 name : "Admin - Translations",
40 permname : 'Admin.Translations',
41 _tree : function(_data)
46 xtype : 'NestedLayoutPanel',
48 title : _this._strings['4e7c16d320ae129cc81b296e05748b3a'] /* Translate App */,
52 xtype : 'BorderLayout',
56 xtype : 'LayoutRegion',
57 alwaysShowTabs : true,
69 title : _this._strings['a1d1ae170f841c328acdc6052511ed8c'] /* Text in interface */,
71 activate : function() {
74 _this.grid.getDataSource().reload();
82 autoExpandColumn : 'txt',
86 afteredit : function (e)
88 var saveRec = function(rec)
92 //g.getView().el.mask('Saving');
94 url : baseURL + '/Admin/Translations.php',
99 lang : _this.langCombo.getValue(),
100 module : _this.modCombo.getValue()
104 //g.getView().el.unmask();
105 //g.getDataSource().reload();
109 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
110 // g.getView().el.unmask();
116 saveRec.defer(1000, _this, [ e.record ]);
118 beforeedit : function(e) {
119 console.log('beforeedit');
120 //if (e.record.get('origtxt').indexOf('<') > -1) {
121 // console.log("HTML EDITOR!!");
125 if (e.record.get('txt').replace(/\s+/, '').length) {
128 if (e.record.get('suggest').length) {
129 e.record.set('txt', e.record.get('suggest'));
130 // _this.saveRec(e.record);
137 var tl = e.record.get('id').split('/')[0];
139 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
140 tl = tl.replace('_', '-');
145 Pman.gtranslate(e.record.get('origtxt'), 'en', tl, function(result) {
146 if (typeof(result) == 'object') { //error
150 if (_this.grid.activeEditor) {
151 _this.grid.activeEditor.setValue(result);
153 rec.set('txt',result);
154 //_this.saveRec(rec);
160 //console.log(result.translation);
167 celldblclick : function (_self, rowIndex, columnIndex, e)
169 var di = this.colModel.config[columnIndex].dataIndex;
170 if (di != 'reset_tx') {
173 rec = this.ds.getAt(rowIndex);
178 url : baseURL + '/Admin/Translations.php',
183 lang : _this.langCombo.getValue(),
184 module : _this.modCombo.getValue()
188 //g.getView().el.unmask();
189 //g.getDataSource().reload();
194 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
195 // g.getView().el.unmask();
202 render : function() {
204 //_this.dialog = Pman.Dialog.FILL_IN
205 if (_this.panel.active) {
206 _this.grid.getDataSource().reload();
219 displayField : 'module',
221 emptyText : _this._strings['b51c3fa7e0ae26a1d88bf1279f265bb4'] /* Select Module */,
223 selectOnFocus : true,
224 triggerAction : 'all',
226 valueField : 'module',
229 render : function (_self)
231 _this.modCombo = _self;
233 select : function (combo, record, index)
235 _this.grid.getDataSource().reload();
241 xtype : 'SimpleStore',
244 AppModules = typeof(AppModules) == 'undefined' ? '' : AppModules;
245 Roo.each( AppModules.split(','), function(mod) {
246 modlist.push( [ mod ] );
257 displayField : 'ldisp',
259 emptyText : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
261 selectOnFocus : true,
262 triggerAction : 'all',
267 render : function (_self)
269 _this.langCombo=_self;
271 select : function (combo, record, index)
273 _this.grid.getDataSource().reload();
279 xtype : 'SimpleStore',
280 data : [ [ 'zh_HK' , '\u7E41\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\u7C21\u4E2D - Simp. Chin.' ] ],
281 fields : ['lang', 'ldisp'],
289 '|xns' : 'Roo.Toolbar'
293 text : _this._strings['801ab24683a4a8c433c6eb40c48bcd9d'] /* Download */,
295 click : function (_self, e)
304 '|xns' : 'Roo.Toolbar'
310 reader : Pman.Readers.Category,
312 beforeload : function (_self, opts)
315 if (!_this.langCombo || !_this.langCombo.getValue().length) {
318 if (!_this.modCombo || !_this.modCombo.getValue().length) {
322 lang : _this.langCombo.getValue(),
323 module : _this.modCombo.getValue()
326 loadexception : function (self, ret, load, jsonData)
328 Roo.MessageBox.alert("Error", jsonData);
336 url : baseURL + '/Admin/Translations.php',
341 xtype : 'JsonReader',
342 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' ],
345 totalProperty : 'total',
352 xtype : 'ColumnModel',
353 dataIndex : 'colname',
354 header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
355 renderer : function(v,x,r) {
357 if (r.get('updated') < r.get('origupdated')) {
361 return '<div style="color:'+c+'";>' +r.get('tableid')+ ':' + v + '</div>';
368 xtype : 'ColumnModel',
369 dataIndex : 'origtxt',
370 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
371 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>'; },
377 xtype : 'ColumnModel',
378 dataIndex : 'reset_tx',
379 header : _this._strings['526d688f37a86d3c3f27d0c5016eb71d'] /* Reset */,
380 renderer : function(v,x,r) {
381 return '<img src="' + rootURL + '/Pman/templates/images/edit-clear.gif' + '" width="16" height="16">';
388 xtype : 'ColumnModel',
390 header : _this._strings['e2ade2e0b88406a390f59b5232abb328'] /* Translated (Click to Edit) */,
391 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>'; },
396 xtype : 'GridEditor',
416 title : _this._strings['0a9e8bd9e8b301dfb2c21c355e0b377d'] /* Languages and Countries */,
418 activate : function() {
419 _this.langpanel = this;
420 if (_this.langgrid) {
421 _this.langgrid.ds.load({});
428 xtype : 'EditorGrid',
429 autoExpandColumn : 'lval',
433 afteredit : function (e)
435 var saveRec = function(rec)
439 //g.getView().el.mask('Saving');
441 url : baseURL + '/Roo/I18n.php',
445 lval : rec.get('lval'),
446 ltype : rec.get('ltype')
450 //g.getView().el.unmask();
451 //g.getDataSource().reload();
455 Ext.Msg.alert("Error", "There was a problem saving the data - try reloading");
456 // g.getView().el.unmask();
462 saveRec.defer(1000, _this, [ e.record ]);
464 beforeedit : function(e) {
465 console.log('beforeedit');
466 //if (e.record.get('origtxt').indexOf('<') > -1) {
467 // console.log("HTML EDITOR!!");
471 if (e.record.get('lval').replace(/\s+/, '').length) {
476 var tl = _this.langgridCombo.getValue();
478 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
479 tl = tl.replace('_', '-');
484 Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) {
485 if (typeof(result) == 'object') { //error
489 if (_this.grid.activeEditor) {
490 _this.grid.activeEditor.setValue(result);
492 rec.set('lval',result);
493 //_this.saveRec(rec);
499 //console.log(result.translation);
506 cellclick : function (_self, rowIndex, columnIndex, e)
508 if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){
512 var s = _this.langgrid.ds.getAt(rowIndex);
514 if(!s || s.data.id * 1 < 0){
518 s.set('is_active', s.data.is_active ? 0 : 1);
521 url : baseURL+'/Roo/I18n',
525 is_active : s.data.is_active
532 _this.langgrid = this;
533 //_this.dialog = Pman.Dialog.FILL_IN
534 if (_this.langpanel.active) {
548 displayField : 'lval',
550 emptyText : _this._strings['552bcc4e00cd663f09cc4efbaca1cd45'] /* Select Translation of */,
552 selectOnFocus : true,
553 triggerAction : 'all',
558 render : function (_self)
560 _this.langtypeCombo = _self;
562 select : function (combo, record, index)
564 _this.langgrid.getDataSource().reload();
570 xtype : 'SimpleStore',
572 [ 'l', 'Language Names' ],
573 [ 'c', 'Country Names' ],
574 [ 'm', 'Currency Names' ]
576 fields : ['lkey','lval'],
584 displayField : 'title',
586 fieldLabel : _this._strings['4994a8ffeba4ac3140beb89e8d41f174'] /* Language */,
587 hiddenName : 'language',
590 name : 'language_title',
592 qtip : _this._strings['83dad8107f9459efe2b4fabcf5b63108'] /* Select Language */,
593 queryParam : 'query[name_starts]',
594 selectOnFocus : true,
595 triggerAction : 'all',
597 value : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /* */,
601 render : function (_self)
603 _this.langgridCombo=_self;
605 select : function (combo, record, index)
607 _this.langgrid.getDataSource().reload();
614 sortInfo : { field : 'title', direction: 'ASC' },
616 beforeload : function (_self, options)
618 options =options || {};
619 options.params =options.params|| {};
620 options.params.ltype = 'l';
621 options.params.inlang = 'en';
623 options.params._as_code_and_title = 1;
632 url : baseURL + '/Roo/i18n.php',
637 xtype : 'JsonReader',
662 totalProperty : 'total',
673 sortInfo : { field : 'lkey', direction: 'ASC' },
675 beforeload : function (_self, options)
677 options =options || {};
678 options.params =options.params|| {};
679 options.params.ltype = _this.langtypeCombo.getValue();
680 options.params.inlang = _this.langgridCombo.getValue();
681 options.params['query[_with_en]'] = 1;
682 if (!options.params.ltype.length || !options.params.inlang.length) {
686 options.params.limit = 9999;
695 url : baseURL + '/Roo/i18n.php',
700 xtype : 'JsonReader',
725 totalProperty : 'total',
732 xtype : 'ColumnModel',
734 header : _this._strings['ca0dbad92a874b2f69b549293387925e'] /* Code */,
735 renderer : function(v) { return String.format('{0}', v); },
741 xtype : 'ColumnModel',
742 dataIndex : 'lval_en',
743 header : _this._strings['78463a384a5aa4fad5fa73e2f506ecfc'] /* English */,
744 renderer : function(v) { return String.format('{0}', v); },
750 xtype : 'ColumnModel',
752 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
753 renderer : function(v) { return String.format('{0}', v); },
758 xtype : 'GridEditor',
769 xtype : 'ColumnModel',
770 dataIndex : 'is_active',
771 header : _this._strings['ae739a236065a45c64ad51aacb19498c'] /* Active? */,
772 renderer : function(v,x,r) {
774 return '<img class="x-grid-check-icon' + (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';