Pman.Dialog.CmsBlog.bjs
[Pman.Cms] / Pman.Tab.CmsTranslateTemplates.js
index 20a12db..565539a 100644 (file)
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
-    part     :  ["Cms","TranslateTemplates"],
-    order    : '800-Pman.Tab.CmsTranslateTemplates',
-    region   : 'center',
-    parent   : 'Pman.Tab.Cms',
-    name     : "Pman.Tab.CmsTranslateTemplates",
-    disabled : false, 
-    permname : '', 
-    _tree : function()
-    {
-        var _this = this;
-        var MODULE = this;
-        return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
-            region : 'center',
-            title : "Translate Templates",
-            layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
-                items : [
-                    {
-                        xtype: 'TreePanel',
-                        xns: Roo,
-                        listeners : {
-                            render : function (_self)
-                            {
-                                _this.treepanel = _self;
-                            }
-                        },
-                        region : 'west',
-                        toolbar : {
-                            xtype: 'Toolbar',
-                            xns: Roo,
-                            items : [
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            Pman.Dialog.CmsLanguagePick.show( {  }, function(lang) {
-                                                
-                                                new Pman.Request({
-                                                    url : baseURL + '/Roo/cms_templatestr',
-                                                    method : 'GET',
-                                                    params : {
-                                                       
-                                                        lang : lang
-                                                    }, 
-                                                    success : function()
-                                                    {
-                                        
-                                                        _this.treepanel.tree.getRootNode().reload();
-                                                    
-                                                    }
-                                                });
-                                            
-                                            });
-                                            
-                                        }
-                                    },
-                                    text : "New"
-                                },
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            var tree = _this.treepanel.tree;
-                                            var sn  = tree.getSelectionModel().getSelectedNode();
-                                            if (!sn || sn.id.split('/').length > 1) {
-                                                Roo.MessageBox.alert("Error", "Select a language");
-                                                return;
-                                            }
-                                            
-                                             Roo.MessageBox.confirm("Confirm", "Are sure you want to delete the language", function (v){
-                                                    if (v != 'yes') {
-                                                        return;
-                                                    }
-                                                    Roo.MessageBox.alert("Not yet", "not done yet");
-                                                    return;
-                                                    Roo.Ajax.request({
-                                                        url : baseURL + '/Roo/cms_language.php',
-                                                        method: 'POST',
-                                                        params : {
-                                                            _delete : _t.selectedNode.id 
-                                                        },
-                                                        success : function()
-                                                        {
-                                                           _this.treepanel.tree.getRootNode().reload();
-                                                            //g.getDataSource().reload();
-                                                        },
-                                                        failure : function()
-                                                        {
-                                                            Roo.MessageBox.alert("Error", 
-                                                                "There was a problem saving the data - try reloading");
-                                                            
-                                                        }
-                                                        
-                                                    });
-                                                    
-                                                    
-                                                    
-                                                    
-                                                });
-                                        }
-                                    },
-                                    text : "Delete"
-                                },
-                                {
-                                    xtype: 'Button',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            _this.treepanel.tree.getRootNode().reload();
-                                            
-                                        }
-                                    },
-                                    text : "Reload"
-                                }
-                            ]
-                        },
-                        tree : {
-                            xtype: 'TreePanel',
-                            xns: Roo.tree,
-                            containerScroll : false,
-                            rootVisible : true,
-                            loader : {
-                                xtype: 'TreeLoader',
-                                xns: Roo.tree,
-                                listeners : {
-                                    beforeload : function (This, node, callback)
-                                    {
-                                        // set some params.
-                                        Roo.log(node);
-                                        this.baseParams._tree = 1;
-                                        
-                                        //this.baseParams.category = node.attributes.category;
-                                    },
-                                    loadexception : function (This, node, response)
-                                    {
-                                        Roo.MessageBox.alert("Error", "Problem loading tree");
-                                    }
-                                },
-                                requestMethod : 'GET',
-                                baseParams : { _tree : 1 },
-                                dataUrl : baseURL + '/Roo/cms_templatestr'
-                            },
-                            root : {
-                                xtype: 'AsyncTreeNode',
-                                xns: Roo.tree,
-                                id : 'transtree',
-                                text : "Translations"
-                            },
-                            selModel : {
-                                xtype: 'DefaultSelectionModel',
-                                xns: Roo.tree,
-                                listeners : {
-                                    selectionchange : function (_self, node)
-                                    {
-                                        Roo.log(node);
-                                        
-                                        //if (node.id.split('/').length < 2) {
-                                        //    return;
-                                       // }
-                                        (function() {
-                                            _this.grid.footer.onClick('first');
-                                        }).defer(100);
-                                        
-                                    }
-                                }
-                            }
-                        }
-                    },
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                                if (_this.grid) {
-                                    _this.grid.footer.onClick('first');
-                                }
-                            }
-                        },
-                        background : false,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'Page',
-                        title : "Page",
-                        grid : {
-                            xtype: 'EditorGrid',
-                            xns: Roo.grid,
-                            listeners : {
-                                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');
-                                    }); 
-                                },
-                                beforeedit : function (e)
-                                {   
-                                    Roo.log('in1?');
-                                    
-                                    if (e.record.data.src_id_txt.indexOf('<') > -1) {
-                                       // console.log("HTML EDITOR!!");
-                                        Pman.Dialog.CmsTranslateEditor.show(e.record);
-                                        return false;
-                                    }
-                                    
-                                    Roo.log('in2?');
-                                    
-                                    if (e.record.data.txt.replace(/\s+/, '').length) {
-                                        return true;
-                                    }
-                                    Roo.log('in3?');
-                                    
-                                    var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;
-                                    // mapping?
-                                    
-                                    Roo.log(e);
-                                    Roo.log(tl);
-                                    var str=e.record.data.src_id_txt;
-                                    var patt=/{(.*?)}/g;
-                                    
-                                    if(patt.test(str)){
-                                        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);
-                                            }
-                                        });
-                                        return true;
-                                    }
-                                    
-                                    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;
-                                },
-                                afteredit : function (e)
-                                {
-                                    e.record.commit();
-                                }
-                            },
-                            autoExpandColumn : 'txt',
-                            clicksToEdit : 1,
-                            loadMask : true,
-                            footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                displayInfo : true,
-                                displayMsg : "Displaying petition_entry{0} - {1} of {2}",
-                                emptyMsg : "Not Found",
-                                pageSize : 25
-                            },
-                            dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                listeners : {
-                                    update : function (_self, rec, operation)
-                                    {
-                                        Roo.log(operation);
-                                        
-                                        if (operation != 'commit') {
-                                            return;
-                                        }
-                                        
-                                    
-                                        _this.grid.getView().el.mask("Saving");
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/cms_templatestr',
-                                            method: 'POST',
-                                            params : {
-                                                id : rec.get('id'),
-                                                txt : rec.get('txt')
-                                            },
-                                            success : function()
-                                            {
-                                                _this.grid.getView().el.unmask();
-                                                    //g.getDataSource().reload();
-                                            },
-                                            failure : function()
-                                            {
-                                                _this.grid.getView().el.unmask();
-                                                Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
-                                             }
-                                                
-                                        });
-                                        
-                                    },
-                                    beforeload : function (_self, o)
-                                    {
-                                       
-                                        var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
-                                    
-                                        if (!sn) { // || (sn.id.split('/').length < 2)) {
-                                           
-                                            _this.grid.ds.removeAll();
-                                            return false;
-                                        }
-                                        Roo.log("load?");
-                                        var ar = sn.attributes.id * 1;//.split('/');
-                                        
-                                        o.params = o.params || {};
-                                        o.params.lang = sn.parentNode.attributes.id;
-                                        o.params.template_id = sn.attributes.id;
-                                        o.params.sort= 'src_id_txt';
-                                        o.params.dir = 'ASC';
-                                    }
-                                },
-                                remoteSort : true,
-                                sortInfo : { field : 'shortname', direction: 'ASC' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    method : 'GET',
-                                    url : baseURL + '/Roo/cms_templatestr.php'
-                                },
-                                reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    id : 'id',
-                                    root : 'data',
-                                    totalProperty : 'total',
-                                    fields : [
-                                        {
-                                            'name': 'id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'shortname',
-                                            'type': 'string'
-                                        },
-                                       
-                                    ]
-                                }
-                            },
-                            colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'src_id_txt',
-                                    header : 'Original',
-                                    width : 200,
-                                    renderer : function(v,x,r) { 
-                                    
-                                     var c = '#666';
-                                            if (r.data.updated  < r.data.src_id_origupdated) {
-                                                c = 'red';
-                                            }
-                                            
-                                    //        return '<div style="color:'+c+'";>' +r.data.tableid + ':' + v + '</div>';
-                                            return String.format('<div style="color:'+c+'";>{0}</div>', v)
-                                    
-                                    }
-                                },
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'txt',
-                                    header : 'Translation',
-                                    width : 200,
-                                    renderer : function(v,x,r) { 
-                                    
-                                     var c = '#666';
-                                            if (r.data.updated  < r.data.src_id_updated) {
-                                                c = 'red';
-                                            }
-                                            
-                                    //        return '<div style="color:'+c+'";>' +r.data.tableid + ':' + v + '</div>';
-                                            return String.format('<div style="color:'+c+'";>{0}</div>', v)
-                                    
-                                    },
-                                    editor : {
-                                        xtype: 'GridEditor',
-                                        xns: Roo.grid,
-                                        field : {
-                                            xtype: 'TextField',
-                                            xns: Roo.form,
-                                            allowBlank : false
-                                        }
-                                    }
-                                }
-                            ]
-                        }
-                    }
-                ],
-                west : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    split : true,
-                    width : 200
-                },
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                }
+
+ _strings : {
+  '0a52da7a03a6de3beefe54f8c03ad80d' :"Original",
+  '0b8d92bc19b720bb1065649535463409' :"Translations",
+  '9d1ead73e678fa2f51a70a933b0bf017' :"Not Found",
+  '6dd08874f83507e9c7b23f1a46b7fa7c' :"Translation",
+  'e3d388b2c43e5ba0905702620ae2abc1' :"Search for",
+  'e2f9d206562d8f5ea421ad51100f7151' :"Displaying petition_entry{0} - {1} of {2}",
+  'dc00a593c8be0a664ba934335b093154' :"Translate Templates",
+  'cd6ae20e52d83f601c5fa12b66f0f6d0' :"Rescan",
+  '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
+  'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
+  '03c2e7e41ffc181a4e84080b4710e81e' :"New",
+  '193cfc9be3b995831c6af2fea6650e60' :"Page",
+  '1bc29b36f623ba82aaf6724fd3b16718' :"md5"
+ },
+
+  part     :  ["Cms", "TranslateTemplates" ],
+  order    : '800-Pman.Tab.CmsTranslateTemplates',
+  region   : 'center',
+  parent   : 'Pman.Tab.Cms',
+  name     : "Pman.Tab.CmsTranslateTemplates",
+  disabled : false, 
+  permname : '', 
+  _tree : function()
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   region : 'center',
+   title : _this._strings['dc00a593c8be0a664ba934335b093154'] /* Translate Templates */,
+   xns : Roo,
+   '|xns' : 'Roo',
+   xtype : 'NestedLayoutPanel',
+   layout : {
+    xns : Roo,
+    '|xns' : 'Roo',
+    xtype : 'BorderLayout',
+    center : {
+     xns : Roo,
+     '|xns' : 'Roo',
+     xtype : 'LayoutRegion'
+    },
+    west : {
+     split : true,
+     width : 300,
+     xns : Roo,
+     '|xns' : 'Roo',
+     xtype : 'LayoutRegion'
+    },
+    items  : [
+     {
+      region : 'west',
+      xns : Roo,
+      '|xns' : 'Roo',
+      xtype : 'TreePanel',
+      listeners : {
+       render : function (_self)
+        {
+            _this.treepanel = _self;
+        }
+      },
+      toolbar : {
+       xns : Roo,
+       '|xns' : 'Roo',
+       xtype : 'Toolbar',
+       items  : [
+        {
+         text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Button',
+         listeners : {
+          click : function (_self, e)
+           {
+               Pman.Dialog.CmsLanguagePick.show( {  }, function(lang) {
+                   
+                   new Pman.Request({
+                       url : baseURL + '/Roo/cms_templatestr',
+                       method : 'POST',
+                       params : {
+                           _rescan : lang
+                       }, 
+                       success : function()
+                       {
+                           _this.treepanel.tree.getRootNode().reload();
+                       }
+                   });
+               
+               });
+               
+           }
+         }
+        },
+        {
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Separator'
+        },
+        {
+         text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Button',
+         listeners : {
+          click : function (_self, e)
+           {
+               var tree = _this.treepanel.tree;
+               var sn  = tree.getSelectionModel().getSelectedNode();
+           
+               if (!sn || typeof(sn.attributes.language) == 'undefined' || !sn.attributes.language) {
+                   Roo.MessageBox.alert("Error", "Select a language");
+                   return;
+               }
+           
+                Roo.MessageBox.confirm("Confirm", "Are sure you want to delete the language", function (v){
+                       if (v != 'yes') {
+                           return;
+                       }
+                       Roo.MessageBox.alert("Not yet", "not done yet");
+                       return;
+                       Roo.Ajax.request({
+                           url : baseURL + '/Roo/cms_language.php',
+                           method: 'POST',
+                           params : {
+                               _delete : _t.selectedNode.id 
+                           },
+                           success : function()
+                           {
+                              _this.treepanel.tree.getRootNode().reload();
+                               //g.getDataSource().reload();
+                           },
+                           failure : function()
+                           {
+                               Roo.MessageBox.alert("Error", 
+                                   "There was a problem saving the data - try reloading");
+                               
+                           }
+                           
+                       });
+                       
+                       
+                       
+                       
+                   });
+           }
+         }
+        },
+        {
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Separator'
+        },
+        {
+         text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Button',
+         listeners : {
+          click : function (_self, e)
+           {
+               var tree = _this.treepanel.tree;
+               Roo.log(tree);
+               var sn  = tree.getSelectionModel().getSelectedNode();
+           
+               if (!sn) {
+                   Roo.MessageBox.alert("Error", "Select a node");
+                   return;
+               }
+               
+               var syncTemplate = function(){
+                   new Pman.Request({
+                       url : baseURL + '/Cms/UpdateBjsTemplates',
+                       method : 'GET',
+                       mask : 'Processing...',
+                       timeout : 9000000,
+                       success : function()
+                       {
+                           _this.treepanel.tree.getRootNode().reload();
+                       }
+                   });
+               
+               };
+               
+               
+               var syncLanguage = function(){
+                   new Pman.Request({
+                       url : baseURL + '/Roo/cms_templatestr',
+                       method : 'POST',
+                       mask : 'Processing...',
+                       params : {
+                           _rescan : sn.attributes.id
+                       }, 
+                       success : function()
+                       {
+                           _this.treepanel.tree.getRootNode().reload();
+                       }
+                   });
+               };
+               
+               if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){
+                   syncTemplate();
+                   return;
+               }
+               
+               if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){
+                   syncLanguage();
+                   return;
+               }
+               
+               
+               
+               
+               
+           }
+         }
+        },
+        {
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Fill'
+        },
+        {
+         text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         xtype : 'Button',
+         listeners : {
+          click : function (_self, e)
+           {
+               _this.treepanel.tree.getRootNode().reload();
+               
+           }
+         }
+        }
+       ]
+      },
+      tree : {
+       containerScroll : false,
+       rootVisible : true,
+       xns : Roo.tree,
+       '|xns' : 'Roo.tree',
+       xtype : 'TreePanel',
+       root : {
+        id : 'transtree',
+        text : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree',
+        xtype : 'AsyncTreeNode'
+       },
+       selModel : {
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree',
+        xtype : 'DefaultSelectionModel',
+        listeners : {
+         selectionchange : function (_self, node)
+          {
+              Roo.log(node);
+              
+              //if (node.id.split('/').length < 2) {
+              //    return;
+             // }
+              (function() {
+                  _this.grid.footer.onClick('first');
+              }).defer(100);
+              
+          }
+        }
+       },
+       loader : {
+        baseParams : { _tree : 1 },
+        dataUrl : baseURL + '/Roo/cms_templatestr',
+        requestMethod : 'GET',
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree',
+        xtype : 'TreeLoader',
+        listeners : {
+         beforeload : function (This, node, callback)
+          {
+              // set some params.
+              Roo.log(node);
+              this.baseParams._tree = 1;
+              
+              //this.baseParams.category = node.attributes.category;
+          },
+         loadexception : function (This, node, response)
+          {
+              Roo.MessageBox.alert("Error", "Problem loading tree");
+          }
+        }
+       }
+      }
+     },
+     {
+      background : false,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'Page',
+      title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
+      xns : Roo,
+      '|xns' : 'Roo',
+      xtype : 'GridPanel',
+      listeners : {
+       activate : function() {
+            _this.panel = this;
+            if (_this.grid) {
+                _this.grid.footer.onClick('first');
+            }
+        }
+      },
+      grid : {
+       autoExpandColumn : 'txt',
+       clicksToEdit : 1,
+       loadMask : true,
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       xtype : 'EditorGrid',
+       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.CmsTranslateTemplates.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.CmsTranslateTemplates.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');
+             }); 
+         }
+       },
+       footer : {
+        displayInfo : true,
+        displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
+        emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
+        pageSize : 100,
+        xns : Roo,
+        '|xns' : 'Roo',
+        xtype : 'PagingToolbar'
+       },
+       toolbar : {
+        xns : Roo,
+        '|xns' : 'Roo',
+        xtype : 'Toolbar',
+        items  : [
+         {
+          emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
+          xns : Roo.form,
+          '|xns' : 'Roo.form',
+          xtype : 'TextField',
+          listeners : {
+           render : function (_self)
+            {
+                _this.searchBox = this;
+            },
+           specialkey : function (_self, e)
+            {
+            _this.grid.footer.onClick('first');
+            }
+          }
+         },
+         {
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/search.gif',
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          listeners : {
+           click : function (_self, e)
+            {
+            _this.grid.footer.onClick('first');
+            }
+          }
+         },
+         {
+          cls : 'x-btn-icon',
+          icon : rootURL + '/Pman/templates/images/edit-clear.gif',
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar',
+          xtype : 'Button',
+          listeners : {
+           click : function (_self, e)
+            {
+                _this.searchBox.setValue('');
+                
+                _this.grid.footer.onClick('first');
             }
-        };
-    }
+          }
+         }
+        ]
+       },
+       dataSource : {
+        remoteSort : true,
+        sortInfo : { field : 'src_id_txt', direction: 'ASC' },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        xtype : 'Store',
+        listeners : {
+         beforeload : function (_self, o)
+          {
+             
+              var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
+          
+              if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) { 
+                  _this.grid.ds.removeAll();
+                  return false;
+              }
+          
+              o.params = o.params || {};
+              o.params.lang = sn.parentNode.attributes.id ;
+              o.params.template_id = sn.attributes.id * 1;
+              o.params.active = 1;
+              o.params['!src_id'] = 0;
+              
+              if (_this.searchBox && _this.searchBox.getValue().length) { 
+                  o.params['_search_txt'] = _this.searchBox.getValue();
+              }
+              
+              
+              if(sn.attributes.on_table){
+                  o.params.on_table = sn.attributes.on_table;
+              }
+              
+          },
+         update : function (_self, rec, operation)
+          {
+              Roo.log(operation);
+              
+              if (operation != 'commit') {
+                  return;
+              }
+              
+          
+              _this.grid.getView().el.mask("Saving");
+              new Pman.Request({
+                  url : baseURL + '/Roo/cms_templatestr',
+                  method: 'POST',
+                  params : {
+                      id : rec.get('id'),
+                      txt : rec.get('txt')
+                  },
+                  success : function()
+                  {
+                      _this.grid.getView().el.unmask();
+                          //g.getDataSource().reload();
+                  },
+                  failure : function()
+                  {
+                      _this.grid.getView().el.unmask();
+                      Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
+                   }
+                      
+              });
+              
+          }
+        },
+        proxy : {
+         method : 'GET',
+         url : baseURL + '/Roo/cms_templatestr.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         xtype : 'HttpProxy'
+        },
+        reader : {
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'shortname',
+                 'type': 'string'
+             }
+            
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data',
+         xtype : 'JsonReader'
+        }
+       },
+       cm : [
+        {
+         dataIndex : 'src_id_txt',
+         header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
+         renderer : function(v,x,r) 
+         {
+             var c = '#666';
+             if (r.data.updated  < r.data.src_id_updated) {
+                 c = 'red';
+             }
+             
+             return String.format('<div style="color:'+c+'";>{0}</div>', v)
+         
+         },
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        },
+        {
+         dataIndex : 'txt',
+         header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
+         renderer : function(v,x,r) 
+         { 
+         
+             var c = '#666';
+             if (r.data.updated  < r.data.src_id_updated) {
+                 c = 'red';
+             }
+             
+             return String.format('<div style="color:'+c+'";>{0}</div>', v)
+         
+         },
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel',
+         editor : {
+          xns : Roo.grid,
+          '|xns' : 'Roo.grid',
+          xtype : 'GridEditor',
+          field : {
+           allowBlank : false,
+           xns : Roo.form,
+           '|xns' : 'Roo.form',
+           xtype : 'TextField'
+          }
+         }
+        },
+        {
+         dataIndex : 'src_id_mdsum',
+         header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
+         hidden : true,
+         renderer : function(v,x,r) 
+         {
+             return v ? v : '';
+         
+         },
+         width : 250,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid',
+         xtype : 'ColumnModel'
+        }
+       ]
+      }
+     }
+    ]
+   }
+  };  }
 });