3 "name": "Pman.Tab.AdminTranslations",
4 "parent": "Pman.Tab.Admin",
5 "title": "Admin - Translations",
6 "path": "/home/alan/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 "xtype": "EditorGrid",
41 "autoExpandColumn": "txt",
44 "|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}",
45 "|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 } ",
46 "|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 + '/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 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}"
52 "*prop": "dataSource",
54 "|reader": "Pman.Readers.Category",
56 "|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}"
64 "|url": "baseURL + '/Admin/Translations.php'",
69 "xtype": "JsonReader",
73 "totalProperty": "total",
75 "|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' ]",
89 "|render": "function (_self)\n{\n _this.modCombo = _self;\n}",
90 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}"
92 "valueField": "module",
93 "displayField": "module",
98 "triggerAction": "all",
99 "emptyText": "Select Module",
100 "selectOnFocus": true,
105 "xtype": "SimpleStore",
106 "|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 })()",
107 "|fields": "['module']",
115 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}",
116 "|render": "function (_self)\n{\n _this.langCombo=_self;\n}"
118 "valueField": "lang",
119 "displayField": "ldisp",
124 "triggerAction": "all",
125 "emptyText": "Select Language",
126 "selectOnFocus": true,
130 "xtype": "SimpleStore",
134 "|fields": "['lang', 'ldisp']",
135 "|data": "[ [ 'zh_HK' , '\\u7E41\\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\\u7C21\\u4E2D - Simp. Chin.' ] ]"
142 "xtype": "ColumnModel",
145 "dataIndex": "colname",
146 "|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>'; }",
149 "*prop": "colModel[]"
152 "xtype": "ColumnModel",
153 "header": "Original",
155 "dataIndex": "origtxt",
156 "|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>'; }",
159 "*prop": "colModel[]"
162 "xtype": "ColumnModel",
163 "header": "Translated (Click to Edit)",
166 "|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>'; }",
169 "*prop": "colModel[]",
172 "xtype": "GridEditor",
178 "xtype": "TextField",
193 "|activate": "function() {\n _this.langpanel = this;\n if (_this.langgrid) {\n _this.langgrid.ds.load({});\n }\n}"
196 "fitContainer": true,
201 "xtype": "GridPanel",
206 "|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}",
207 "|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n"
210 "autoExpandColumn": "ltype",
216 "*prop": "dataSource",
219 "|sortInfo": "{ field : 'ltype', direction: 'ASC' }",
224 "xtype": "HttpProxy",
226 "|url": "baseURL + '/Roo/i18n.php'",
231 "xtype": "JsonReader",
232 "totalProperty": "total",
236 "|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]"
242 "xtype": "PagingToolbar",
245 "displayMsg": "Displaying i18n{0} - {1} of {2}",
246 "emptyMsg": "No i18n found",
256 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}",
257 "|render": "function (_self)\n{\n _this.langgridCombo=_self;\n}"
259 "displayField": "ldisp",
261 "emptyText": "Select Language",
263 "selectOnFocus": true,
264 "triggerAction": "all",
266 "valueField": "lang",
272 "xtype": "SimpleStore",
276 "|fields": "['lang', 'ldisp']",
277 "|data": "[ [ 'zh_HK' , '\\u7E41\\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\\u7C21\\u4E2D - Simp. Chin.' ] ]"
284 "xtype": "ColumnModel",
288 "|renderer": "function(v) { return String.format('{0}', v); }",
290 "*prop": "colModel[]"
293 "xtype": "ColumnModel",
296 "dataIndex": "ltype",
297 "|renderer": "function(v) { return String.format('{0}', v); }",
299 "*prop": "colModel[]"
302 "xtype": "ColumnModel",
306 "|renderer": "function(v) { return String.format('{0}', v); }",
308 "*prop": "colModel[]"
311 "xtype": "ColumnModel",
314 "dataIndex": "inlang",
315 "|renderer": "function(v) { return String.format('{0}', v); }",
317 "*prop": "colModel[]"
320 "xtype": "ColumnModel",
324 "|renderer": "function(v) { return String.format('{0}', v); }",
326 "*prop": "colModel[]"
337 "permname": "Admin.Translations",