Pman.Tab.CmsTranslateTemplates.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 27 May 2013 09:22:02 +0000 (17:22 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 27 May 2013 09:22:02 +0000 (17:22 +0800)
Pman.Tab.CmsTranslateTemplates.js

Pman.Tab.CmsTranslateTemplates.bjs
Pman.Tab.CmsTranslateTemplates.js

index f75d39e..e919755 100644 (file)
                                     "listeners": {
                                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    //if (_this.panel.active) {\n      // this.ds.onc.onClick('first');\n    //}\n}",
                                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
-                                        "beforeedit": "function (e)\n{\n    if (e.record.data.src_id_txt.indexOf('<') > -1) {\n       // console.log(\"HTML EDITOR!!\");\n        Pman.Dialog.CmsTranslateEditor.show(e.record);\n        return false;\n    }\n    if (e.record.data.txt.replace(/\\s+/, '').length) {\n        return true;\n    }\n    var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;\n    // mapping?\n    tl = (tl == 'zh_HK') ? 'zh-TW' : tl;\n    \n    if (tl == 'en') {\n        (function() { \n            Roo.log(\"set the value\");\n            _this.grid.activeEditor.setValue(e.record.data.txt);\n        }).defer(500);\n        return true;\n    }    \n     \n    Pman.GoogleTranslate(e.record.data.txt, \"en\", tl, function(result) {\n       // Roo.log(result);\n        _this.grid.activeEditor.setValue(result);\n        //console.log(result.translation);\n    });\n    \n\n    \n    return true;\n}",
+                                        "beforeedit": "function (e)\n{\n    if (e.record.data.src_id_txt.indexOf('<') > -1) {\n       // console.log(\"HTML EDITOR!!\");\n        Pman.Dialog.CmsTranslateEditor.show(e.record);\n        return false;\n    }\n    if (e.record.data.txt.replace(/\\s+/, '').length) {\n        return true;\n    }\n    var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;\n    // mapping?\n    tl = (tl == 'zh_HK') ? 'zh-TW' : tl;\n    \n    if (tl == 'en') {\n\n            e.value =  e.record.data.txt; \n        return true;\n    }    \n     \n    Pman.GoogleTranslate(e.record.data.txt, \"en\", tl, function(result) {\n       // Roo.log(result);\n        _this.grid.activeEditor.setValue(result);\n        //console.log(result.translation);\n    });\n    \n\n    \n    return true;\n}",
                                         "afteredit": "function (e)\n{\n    e.record.commit();\n}"
                                     },
                                     "*prop": "grid",
index e333754..bf3ea28 100644 (file)
@@ -230,10 +230,8 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
                                     tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
                                     
                                     if (tl == 'en') {
-                                        (function() { 
-                                            Roo.log("set the value");
-                                            _this.grid.activeEditor.setValue(e.record.data.txt);
-                                        }).defer(500);
+                                
+                                            e.value =  e.record.data.txt; 
                                         return true;
                                     }