From 9e78ed77c58031c09709716a71dfca400ce3bcb6 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 16 Aug 2013 13:03:11 +0800 Subject: [PATCH] Pman.Tab.AdminTranslations.bjs Pman.Tab.AdminTranslations.js --- Pman.Tab.AdminTranslations.bjs | 2 +- Pman.Tab.AdminTranslations.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Pman.Tab.AdminTranslations.bjs b/Pman.Tab.AdminTranslations.bjs index bdc6b05..0bfc91f 100644 --- a/Pman.Tab.AdminTranslations.bjs +++ b/Pman.Tab.AdminTranslations.bjs @@ -40,7 +40,7 @@ "|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 new Roo.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}", - "celldblclick": "function (_self, rowIndex, columnIndex, e)\n{\n var di = this.colModel.config[columnIndex].dataIndex;\n if (di != 'reset_tx') {\n return;\n }\n}" + "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 //g.getView().el.mask('Saving');\n new Roo.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 },\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}" }, "*prop": "grid", "autoExpandColumn": "txt", diff --git a/Pman.Tab.AdminTranslations.js b/Pman.Tab.AdminTranslations.js index 20591d3..089909a 100644 --- a/Pman.Tab.AdminTranslations.js +++ b/Pman.Tab.AdminTranslations.js @@ -137,6 +137,34 @@ Pman.Tab.AdminTranslations = new Roo.XComponent({ if (di != 'reset_tx') { return; } + rec = this.ds.getAt(rowIndex); + + var g = _this.grid; + + //g.getView().el.mask('Saving'); + new Roo.Request({ + url : baseURL + '/Admin/Translations.php', + method: 'POST', + params : { + id : rec.get('id'), + txt : '', + lang : _this.langCombo.getValue(), + module : _this.modCombo.getValue() + }, + success : function() + { + //g.getView().el.unmask(); + //g.getDataSource().reload(); + }, + failure : function() + { + Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading"); + // g.getView().el.unmask(); + } + + }); + + } }, autoExpandColumn : 'txt', -- 2.39.2