From 8cf73191ff3315d28e11e08422022b2843345d82 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 15 Sep 2011 12:17:22 +0800 Subject: [PATCH] Pman.Tab.AdminTranslations.bjs --- Pman.Tab.AdminTranslations.bjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Pman.Tab.AdminTranslations.bjs b/Pman.Tab.AdminTranslations.bjs index 3ad1ab4..3eb6e48 100644 --- a/Pman.Tab.AdminTranslations.bjs +++ b/Pman.Tab.AdminTranslations.bjs @@ -36,16 +36,16 @@ "|xns": "Roo", "items": [ { - "*prop": "grid", - "xtype": "EditorGrid", - "autoExpandColumn": "txt", - "loadMask": true, "listeners": { "|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}", "|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 } ", "|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}" }, + "*prop": "grid", + "autoExpandColumn": "txt", "clicksToEdit": 1, + "loadMask": true, + "xtype": "EditorGrid", "|xns": "Roo.grid", "items": [ { -- 2.39.2