From a36431e9dfaabdff9e278aa9db0cd29f59e9e94e Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 28 Mar 2022 12:19:57 +0800 Subject: [PATCH] Fix #7175 - refine translation code --- Pman.Tab.AdminTranslations.bjs | 2 +- Pman.Tab.AdminTranslations.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Pman.Tab.AdminTranslations.bjs b/Pman.Tab.AdminTranslations.bjs index fa44582..02c3c65 100644 --- a/Pman.Tab.AdminTranslations.bjs +++ b/Pman.Tab.AdminTranslations.bjs @@ -85,7 +85,7 @@ }, { "listeners" : { - "click" : "function (_self, e)\n{\n var tree = _this.treepanel.tree;\n Roo.log(tree);\n var sn = tree.getSelectionModel().getSelectedNode();\n\n if (!sn) {\n Roo.MessageBox.alert(\"Error\", \"Select a node\");\n return;\n }\n \n \n var steps = [ \n 'scanProjectBJS',\n 'scanPmanBJS',\n 'scanPmanTemplates',\n 'scanTables',\n 'syncLanguage' \n ];\n \n \n var syncTemplate = function(){\n \n var step = steps.shift();\n Roo.MessageBox.updateProgress( (5.0 - steps.length) / 5.0, \"Running \" + step);\n \n new Pman.Request({\n url : baseURL + '/Admin/UpdateBjsTemplates/' + step,\n method : 'GET',\n //mask : 'Processing...',\n timeout : 9000000,\n success : function()\n {\n if (steps.length > 0 ) { \n syncTemplate();\n return;\n }\n Roo.MessageBox.hide();\n _this.treepanel.tree.getRootNode().reload();\n }\n });\n \n };\n \n \n var syncLanguage = function(){\n new Pman.Request({\n url : baseURL + '/Roo/Core_templatestr',\n method : 'POST',\n mask : 'Processing...',\n params : {\n _rescan : sn.attributes.id.split(':')[1]\n }, \n success : function()\n {\n _this.treepanel.tree.getRootNode().reload();\n }\n });\n };\n \n if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){\n Roo.MessageBox.progress(\"Syncing templates\", \"Starting\");\n syncTemplate();\n return;\n }\n \n if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){\n syncLanguage();\n return;\n }\n \n \n \n \n \n}" + "click" : "function (_self, e)\n{\n var tree = _this.treepanel.tree;\n Roo.log(tree);\n var sn = tree.getSelectionModel().getSelectedNode();\n\n if (!sn) {\n Roo.MessageBox.alert(\"Error\", \"Select a node\");\n return;\n }\n \n \n var steps = [ \n 'scanProjectBJS',\n 'scanPmanBJS',\n 'scanPmanTemplates',\n 'scanTables',\n 'syncLanguage' \n ];\n \n \n var syncTemplate = function(){\n \n var step = steps.shift();\n Roo.MessageBox.updateProgress( (5.0 - steps.length) / 5.0, \"Running \" + step);\n \n new Pman.Request({\n url : baseURL + '/Admin/UpdateBjsTemplates/' + step,\n method : 'GET',\n //mask : 'Processing...',\n timeout : 9000000,\n success : function()\n {\n if (steps.length > 0 ) { \n syncTemplate();\n return;\n }\n Roo.MessageBox.hide();\n _this.treepanel.tree.getRootNode().reload();\n }\n });\n \n };\n \n \n var syncLanguage = function(){\n new Pman.Request({\n url : baseURL + '/Roo/Core_templatestr',\n method : 'POST',\n mask : 'Processing...',\n params : {\n _rescan : sn.attributes.id.split(':')[1]\n }, \n success : function()\n {\n _this.treepanel.tree.getRootNode().reload();\n }\n });\n };\n \n var syncSingleTemplate = function(id){\n new Pman.Request({\n url : baseURL + '/Roo/Core_template',\n method : 'POST',\n mask : 'Processing...',\n params : {\n id : id,\n _rescan : 1\n }, \n success : function()\n {\n (function() {\n _this.grid.footer.onClick('first');\n }).defer(100);\n }\n });\n };\n \n \n if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){\n Roo.MessageBox.progress(\"Syncing templates\", \"Starting\");\n syncTemplate();\n return;\n }\n \n if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){\n syncLanguage();\n return;\n }\n \n if(typeof(sn.attributes.id) != 'undefined' && sn.attributes.id * 1> 0){\n syncSingleTemplate(sn.attributes.id);\n return;\n }\n \n \n \n \n}" }, "text" : "Rescan", "xtype" : "Button", diff --git a/Pman.Tab.AdminTranslations.js b/Pman.Tab.AdminTranslations.js index e66f55c..724d43e 100644 --- a/Pman.Tab.AdminTranslations.js +++ b/Pman.Tab.AdminTranslations.js @@ -205,6 +205,25 @@ Pman.Tab.AdminTranslations = new Roo.XComponent({ }); }; + var syncSingleTemplate = function(id){ + new Pman.Request({ + url : baseURL + '/Roo/Core_template', + method : 'POST', + mask : 'Processing...', + params : { + id : id, + _rescan : 1 + }, + success : function() + { + (function() { + _this.grid.footer.onClick('first'); + }).defer(100); + } + }); + }; + + if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){ Roo.MessageBox.progress("Syncing templates", "Starting"); syncTemplate(); @@ -216,6 +235,10 @@ Pman.Tab.AdminTranslations = new Roo.XComponent({ return; } + if(typeof(sn.attributes.id) != 'undefined' && sn.attributes.id * 1> 0){ + syncSingleTemplate(sn.attributes.id); + return; + } -- 2.39.2