Pman.Tab.AdminTranslations.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 16 Aug 2013 05:18:26 +0000 (13:18 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 16 Aug 2013 05:18:26 +0000 (13:18 +0800)
Pman.Tab.AdminTranslations.js

Pman.Tab.AdminTranslations.bjs
Pman.Tab.AdminTranslations.js

index c10de2a..1ade213 100644 (file)
@@ -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 Pman.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                Roo.MessageBox.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    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}"
+                                        "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    new Pman.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",
index b7e83f7..7119b5e 100644 (file)
@@ -140,28 +140,27 @@ Pman.Tab.AdminTranslations = new Roo.XComponent({
                                     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();
-                                            }
-                                            
+                                 
+                                    new Pman.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();
+                                        }
+                                        
                                     });