Pman.Tab.CmsTranslateTemplates.bjs
authorChris <chris@roojs.com>
Tue, 28 May 2013 11:05:20 +0000 (19:05 +0800)
committerChris <chris@roojs.com>
Tue, 28 May 2013 11:05:20 +0000 (19:05 +0800)
Pman.Tab.CmsTranslateTemplates.js

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

index 8781525..8aa373e 100644 (file)
                                     "listeners": {
                                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n        this.footer.onClick('first');\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    \n    Roo.log(e);\n    Roo.log(tl);\n    var str=e.record.data.src_id_txt;\n    var patt=/{(.*?)}/g;\n    \n    if(patt.test(str)){\n        Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\\'s change? '+str, function(btn, text){\n            if (btn == 'ok'){\n                e.value = text;\n                e.record.set('txt', text);\n            }\n        });\n    }\n    \n    tl = (tl == 'zh_HK') ? 'zh-TW' : tl;\n    \n    if (tl == 'en' && !e.value.length) {\n\n        e.value = e.record.data.src_id_txt;\n        e.record.set('txt', e.record.data.src_id_txt);\n        return true;\n    }\n    \n    Pman.GoogleTranslate(e.record.data.src_id_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    \n    Roo.log(e);\n    Roo.log(tl);\n    var str=e.record.data.src_id_txt;\n    var patt=/{(.*?)}/g;\n    \n    if(patt.test(str)){\n        Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\\'s change? '+str, function(btn, text){\n            if (btn == 'ok'){\n                e.value = text;\n                e.record.set('txt', text);\n            }\n        });\n        return;\n    }\n    \n    tl = (tl == 'zh_HK') ? 'zh-TW' : tl;\n    \n    if (tl == 'en' && !e.value.length) {\n\n        e.value = e.record.data.src_id_txt;\n        e.record.set('txt', e.record.data.src_id_txt);\n        return true;\n    }\n    \n    Pman.GoogleTranslate(e.record.data.src_id_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 bf7d8b1..971fc8d 100644 (file)
@@ -241,6 +241,7 @@ Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
                                                 e.record.set('txt', text);
                                             }
                                         });
+                                        return;
                                     }
                                     
                                     tl = (tl == 'zh_HK') ? 'zh-TW' : tl;