+ ],
+ "listeners" : {
+ "afteredit" : [
+ "function (e)",
+ "{",
+ " e.record.commit();",
+ "}"
+ ],
+ "beforeedit" : [
+ "function (e)",
+ "{ ",
+ " /*if (e.record.data.src_id_txt.indexOf('<') > -1) {",
+ " // console.log(\"HTML EDITOR!!\");",
+ " Pman.Dialog.CmsTranslateEditor.show(e.record);",
+ " return false;",
+ " }*/",
+ " ",
+ " var str=e.record.data.src_id_txt;",
+ " var patt=/{(.*?)}/g;",
+ " ",
+ " Roo.log(str.length);",
+ " ",
+ " ",
+ " if(patt.test(str)){",
+ " e.cancel = true;",
+ " Pman.Dialog.AdminTranslateTemplates.show(e.record.data, function(v){",
+ " Roo.log(v);",
+ " e.value = v.txt;",
+ " e.record.set('txt', v.txt);",
+ " e.record.commit();",
+ " });",
+ " /*",
+ " Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\\'s change? '+str, function(btn, text){",
+ " if (btn == 'ok'){",
+ " e.value = text;",
+ " e.record.set('txt', text);",
+ " e.record.commit();",
+ " }",
+ " });*/",
+ " return;",
+ " }",
+ " ",
+ " if(str.length > 150){",
+ " e.cancel = true;",
+ " Pman.Dialog.AdminTranslateTemplates.show(e.record.data, function(v){",
+ " e.value = v.txt;",
+ " e.record.set('txt', v.txt);",
+ " e.record.commit();",
+ " });",
+ " /*",
+ " Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\\'s change? '+str, function(btn, text){",
+ " if (btn == 'ok'){",
+ " e.value = text;",
+ " e.record.set('txt', text);",
+ " e.record.commit();",
+ " }",
+ " });*/",
+ " return;",
+ " }",
+ " ",
+ "",
+ " if (e.record.data.txt.replace(/\\s+/, '').length) {",
+ " return true;",
+ " }",
+ " ",
+ " var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;",
+ " // mapping?",
+ " ",
+ " tl = (tl == 'zh_HK') ? 'zh-TW' : tl;",
+ " ",
+ " if (tl == 'en' && !e.value.length) {",
+ "",
+ " e.value = e.record.data.src_id_txt;",
+ " e.record.set('txt', e.record.data.src_id_txt);",
+ " return true;",
+ " }",
+ " ",
+ " Pman.GoogleTranslate(e.record.data.src_id_txt, \"en\", tl, function(result) {",
+ " // Roo.log(result);",
+ " _this.grid.activeEditor.setValue(result);",
+ " //console.log(result.translation);",
+ " });",
+ " ",
+ "",
+ " ",
+ " return true;",
+ "}"
+ ],
+ "|render" : [
+ "function() ",
+ "{",
+ " _this.grid = this; ",
+ " //_this.dialog = Pman.Dialog.FILL_IN",
+ " if (_this.panel.active) {",
+ " this.footer.onClick('first');",
+ " // this.ds.onc.onClick('first');",
+ " }",
+ "}"
+ ],
+ "|rowdblclick" : [
+ "function (_self, rowIndex, e)",
+ "{",
+ " if (!_this.dialog) {",
+ " return;",
+ " }",
+ " _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {",
+ " _this.grid.footer.onClick('first');",
+ " }); ",
+ "}",
+ ""
+ ]
+ },
+ "loadMask" : true,
+ "xtype" : "EditorGrid"