3 "name": "Pman.Tab.AdminTranslations",
4 "parent": "Pman.Tab.Admin",
5 "title": "Admin - Translations",
6 "path": "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminTranslations.bjs",
10 "title": "Translate App",
11 "xtype": "NestedLayoutPanel",
16 "xtype": "BorderLayout",
21 "alwaysShowTabs": true,
23 "xtype": "LayoutRegion",
28 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.getDataSource().reload(); \n }\n}"
34 "title": "Text in interface",
40 "|render": "function() { \n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n _this.grid.getDataSource().reload(); \n }\n}",
41 "|beforeedit": "function(e) {\n console.log('beforeedit');\n //if (e.record.get('origtxt').indexOf('<') > -1) {\n // console.log(\"HTML EDITOR!!\");\n \n // return false;\n //}\n if (e.record.get('txt').replace(/\\s+/, '').length) {\n return true;\n }\n if (e.record.get('suggest').length) {\n e.record.set('txt', e.record.get('suggest'));\n // _this.saveRec(e.record);\n return;\n }\n \n \n \n \n var tl = e.record.get('id').split('/')[0];\n \n tl = (tl == 'zh_HK') ? 'zh-TW' : tl; \n tl = tl.replace('_', '-');\n var rec = e.record;\n \n \n \n Pman.gtranslate(e.record.get('origtxt'), 'en', tl, function(result) { \n if (typeof(result) == 'object') { //error\n return; \n }\n \n if (_this.grid.activeEditor) {\n _this.grid.activeEditor.setValue(result);\n } else {\n rec.set('txt',result);\n //_this.saveRec(rec);\n }\n\n //\n \n \n //console.log(result.translation);\n });\n \n \n \n return true;\n } ",
42 "|afteredit": "function (e)\n{\n var saveRec = function(rec)\n {\n var g = _this.grid;\n\n //g.getView().el.mask('Saving');\n new Pman.Request({\n url : baseURL + '/Admin/Translations.php',\n method: 'POST',\n params : {\n id : rec.get('id'),\n txt : rec.get('txt'),\n lang : _this.langCombo.getValue(),\n module : _this.modCombo.getValue()\n },\n success : function()\n {\n //g.getView().el.unmask();\n //g.getDataSource().reload();\n },\n failure : function()\n {\n Roo.MessageBox.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n // g.getView().el.unmask();\n }\n \n });\n };\n \n saveRec.defer(1000, _this, [ e.record ]);\n}",
43 "celldblclick": "function (_self, rowIndex, columnIndex, e)\n{\n var di = this.colModel.config[columnIndex].dataIndex;\n if (di != 'reset_tx') {\n return;\n }\n rec = this.ds.getAt(rowIndex);\n \n var g = _this.grid;\n \n new Pman.Request({\n url : baseURL + '/Admin/Translations.php',\n method: 'POST',\n params : {\n id : rec.get('id'),\n txt : '',\n lang : _this.langCombo.getValue(),\n module : _this.modCombo.getValue()\n },\n success : function()\n {\n //g.getView().el.unmask();\n //g.getDataSource().reload();\n rec.set('txt', '');\n },\n failure : function()\n {\n Roo.MessageBox.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n // g.getView().el.unmask();\n }\n \n });\n \n \n}"
46 "autoExpandColumn": "txt",
49 "xtype": "EditorGrid",
54 "|beforeload": "function (_self, opts)\n{\n\n if (!_this.langCombo || !_this.langCombo.getValue().length) {\n return false;\n }\n if (!_this.modCombo || !_this.modCombo.getValue().length) {\n return false;\n }\n opts.params = {\n lang : _this.langCombo.getValue(),\n module : _this.modCombo.getValue()\n };\n}",
55 "loadexception": "function (self, ret, load, jsonData)\n{\n Roo.MessageBox.alert(\"Error\", jsonData);\n}"
57 "*prop": "dataSource",
59 "|reader": "Pman.Readers.Category",
66 "|url": "baseURL + '/Admin/Translations.php'",
71 "xtype": "JsonReader",
75 "totalProperty": "total",
77 "|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' ]",
91 "|render": "function (_self)\n{\n _this.modCombo = _self;\n}",
92 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}"
94 "valueField": "module",
95 "displayField": "module",
100 "triggerAction": "all",
101 "emptyText": "Select Module",
102 "selectOnFocus": true,
107 "xtype": "SimpleStore",
108 "|data": "(function() { \n var modlist = []; \n AppModules = typeof(AppModules) == 'undefined' ? '' : AppModules;\n Roo.each( AppModules.split(','), function(mod) { \n modlist.push( [ mod ] ); \n }); \n return modlist;\n })()",
109 "|fields": "['module']",
117 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}",
118 "|render": "function (_self)\n{\n _this.langCombo=_self;\n}"
120 "valueField": "lang",
121 "displayField": "ldisp",
126 "triggerAction": "all",
127 "emptyText": "Select Language",
128 "selectOnFocus": true,
132 "xtype": "SimpleStore",
136 "|fields": "['lang', 'ldisp']",
137 "|data": "[ [ 'zh_HK' , '\\u7E41\\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\\u7C21\\u4E2D - Simp. Chin.' ] ]"
142 "|xns": "Roo.Toolbar",
147 "click": "function (_self, e)\n{\n new Pman.Download({\n grid: _this.grid\n \n });\n}"
151 "|xns": "Roo.Toolbar"
156 "xtype": "ColumnModel",
159 "dataIndex": "colname",
160 "|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>'; }",
163 "*prop": "colModel[]"
166 "xtype": "ColumnModel",
167 "header": "Original",
169 "dataIndex": "origtxt",
170 "|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>'; }",
173 "*prop": "colModel[]"
176 "*prop": "colModel[]",
177 "dataIndex": "reset_tx",
180 "xtype": "ColumnModel",
181 "|renderer": "function(v,x,r) { \n return '<img src=\"' + rootURL + '/Pman/templates/images/edit-clear.gif' + '\" width=\"16\" height=\"16\">';\n}",
185 "*prop": "colModel[]",
187 "header": "Translated (Click to Edit)",
189 "xtype": "ColumnModel",
190 "|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>'; }",
194 "xtype": "GridEditor",
200 "xtype": "TextField",
215 "|activate": "function() {\n _this.langpanel = this;\n if (_this.langgrid) {\n _this.langgrid.ds.load({});\n }\n}"
218 "fitContainer": true,
222 "title": "Languages and Countries",
223 "xtype": "GridPanel",
228 "|render": "function() \n{\n _this.langgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.langpanel.active) {\n this.ds.load({});\n }\n}",
229 "afteredit": "function (e)\n{\n var saveRec = function(rec)\n {\n var g = _this.grid;\n\n //g.getView().el.mask('Saving');\n Ext.Ajax.request({\n url : baseURL + '/Roo/I18n.php',\n method: 'POST',\n params : {\n id : rec.get('id'),\n lval : rec.get('lval')\n },\n success : function()\n {\n //g.getView().el.unmask();\n //g.getDataSource().reload();\n },\n failure : function()\n {\n Ext.Msg.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n // g.getView().el.unmask();\n }\n \n });\n };\n \n saveRec.defer(1000, _this, [ e.record ]);\n}",
230 "beforeedit": "function(e) {\n console.log('beforeedit');\n //if (e.record.get('origtxt').indexOf('<') > -1) {\n // console.log(\"HTML EDITOR!!\");\n \n // return false;\n //}\n if (e.record.get('lval').replace(/\\s+/, '').length) {\n return true;\n }\n \n \n var tl = _this.langgridCombo.getValue();\n \n tl = (tl == 'zh_HK') ? 'zh-TW' : tl; \n tl = tl.replace('_', '-');\n var rec = e.record;\n \n \n \n Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) { \n if (typeof(result) == 'object') { //error\n return; \n }\n \n if (_this.grid.activeEditor) {\n _this.grid.activeEditor.setValue(result);\n } else {\n rec.set('lval',result);\n //_this.saveRec(rec);\n }\n\n //\n \n \n //console.log(result.translation);\n });\n \n \n \n return true;\n } ",
231 "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){\n return;\n }\n \n var s = _this.langgrid.ds.getAt(rowIndex);\n \n if(!s || s.data.id * 1 < 0){\n return;\n }\n \n s.data.is_active = s.data.is_active ? 0 : 1;\n \n s.data.commit();\n \n \n}"
234 "autoExpandColumn": "lval",
237 "xtype": "EditorGrid",
242 "beforeload": "function (_self, options)\n{\n options =options || {};\n options.params =options.params|| {};\n options.params.ltype = _this.langtypeCombo.getValue();\n options.params.inlang = _this.langgridCombo.getValue();\n options.params['query[_with_en]'] = 1;\n if (!options.params.ltype.length || !options.params.inlang.length) {\n return false;\n }\n \n options.params.limit = 9999;\n \n}"
244 "*prop": "dataSource",
247 "|sortInfo": "{ field : 'lkey', direction: 'ASC' }",
252 "xtype": "HttpProxy",
254 "|url": "baseURL + '/Roo/i18n.php'",
259 "xtype": "JsonReader",
260 "totalProperty": "total",
264 "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'ltype',\n 'type': 'string'\n },\n {\n 'name': 'lkey',\n 'type': 'string'\n },\n {\n 'name': 'inlang',\n 'type': 'string'\n },\n {\n 'name': 'lval',\n 'type': 'string'\n }\n]"
275 "|render": "function (_self)\n{\n _this.langtypeCombo = _self;\n}",
276 "|select": "function (combo, record, index)\n{\n _this.langgrid.getDataSource().reload(); \n}"
278 "displayField": "lval",
280 "emptyText": "Select Translation of",
282 "selectOnFocus": true,
283 "triggerAction": "all",
285 "valueField": "lkey",
292 "xtype": "SimpleStore",
293 "|data": "[\n [ 'l', 'Language Names' ],\n [ 'c', 'Country Names' ],\n [ 'm', 'Currency Names' ]\n]",
294 "|fields": "['lkey','lval']",
301 "|select": "function (combo, record, index)\n{\n _this.langgrid.getDataSource().reload(); \n}",
302 "|render": "function (_self)\n{\n _this.langgridCombo=_self;\n}"
304 "displayField": "ldisp",
306 "emptyText": "Select Language",
308 "selectOnFocus": true,
309 "triggerAction": "all",
311 "valueField": "lang",
317 "xtype": "SimpleStore",
321 "|fields": "['lang', 'ldisp']",
322 "|data": "[ [ 'zh_HK' , '\\u7E41\\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\\u7C21\\u4E2D - Simp. Chin.' ] ]"
329 "*prop": "colModel[]",
333 "xtype": "ColumnModel",
334 "|renderer": "function(v) { return String.format('{0}', v); }",
338 "*prop": "colModel[]",
339 "dataIndex": "lval_en",
342 "xtype": "ColumnModel",
343 "|renderer": "function(v) { return String.format('{0}', v); }",
347 "*prop": "colModel[]",
349 "header": "Translation",
351 "xtype": "ColumnModel",
352 "|renderer": "function(v) { return String.format('{0}', v); }",
356 "xtype": "GridEditor",
362 "xtype": "TextField",
372 "*prop": "colModel[]",
373 "dataIndex": "is_active",
376 "xtype": "ColumnModel",
377 "|renderer": "function(v,x,r) { \n\n return '<img class=\"x-grid-check-icon' + (v*1 ? '-checked' : '') + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n \n \n}",
389 "permname": "Admin.Translations",