From b18aa13fc0b9708635128c9f06d603d679a45d3a Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 2 Dec 2020 14:22:50 +0800 Subject: [PATCH] Fix #6494 - translations code for reports --- Pman.Dialog.AdminEnumType.bjs | 177 ++-- Pman.Dialog.AdminEnumType.js | 269 +++--- Pman.Dialog.AdminLanguagePick.bjs | 118 +++ Pman.Dialog.AdminLanguagePick.js | 207 +++++ Pman.Dialog.AdminTranslateTemplates.bjs | 116 +++ Pman.Dialog.AdminTranslateTemplates.js | 188 ++++ Pman.Tab.AdminTranslations.bjs | 482 ++++------ Pman.Tab.AdminTranslations.js | 1091 ++++++++++------------- Translations.php | 50 +- UpdateBjsTemplates.php | 335 +++++++ 10 files changed, 1911 insertions(+), 1122 deletions(-) create mode 100644 Pman.Dialog.AdminLanguagePick.bjs create mode 100644 Pman.Dialog.AdminLanguagePick.js create mode 100644 Pman.Dialog.AdminTranslateTemplates.bjs create mode 100644 Pman.Dialog.AdminTranslateTemplates.js create mode 100644 UpdateBjsTemplates.php diff --git a/Pman.Dialog.AdminEnumType.bjs b/Pman.Dialog.AdminEnumType.bjs index 86cf4f8..0243514 100644 --- a/Pman.Dialog.AdminEnumType.bjs +++ b/Pman.Dialog.AdminEnumType.bjs @@ -1,87 +1,98 @@ { - "name" : "Pman.Dialog.AdminEnumType", - "parent" : "", - "title" : "", - "path" : "/home/michael/gitlive/Pman.Admin/Pman.Dialog.AdminEnumType.bjs", - "permname" : "", - "modOrder" : "001", - "items" : [ + "name" : "Pman.Dialog.AdminEnumType", + "parent" : "", + "title" : "", + "path" : "/home/alan/gitlive/Pman.Admin/Pman.Dialog.AdminEnumType.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "7dce122004969d56ae2e0245cb754d35" : "Edit", + "b48968e1c912da07df5e8d6d246291ec" : "Display Name", + "ea4788705e6873b424c65e91c2846b19" : "Cancel", + "49ee3087348e8d44e1feda1917443987" : "Name", + "c9cc8cce247e49bae79f15173ce97354" : "Save" + }, + "named_strings" : { + "display_name_fieldLabel" : "b48968e1c912da07df5e8d6d246291ec", + "name_fieldLabel" : "49ee3087348e8d44e1feda1917443987" + }, + "items" : [ + { + "Boolean modal" : true, + "Number width" : 480, + "xtype" : "LayoutDialog", + "Number height" : 160, + "Boolean resizable" : false, + "$ xns" : "Roo", + "String title" : "Edit", + "items" : [ + { + "xtype" : "LayoutRegion", + "$ xns" : "Roo", + "* prop" : "center\n" + }, + { + "xtype" : "ContentPanel", + "$ xns" : "Roo", + "String region" : "center", + "items" : [ + { + "listeners" : { + "|actioncomplete" : "function (_self, action)\n{\n if(action.type == 'submit'){\n _this.dialog.hide();\n \n if(_this.callback){\n _this.callback.call(_this, _this.form.getValues());\n }\n return\n }\n}", + "rendered" : "function (form)\n{\n _this.form = this;\n}" + }, + "$ url" : "baseURL + '/Roo/Core_enum'", + "xtype" : "Form", + "$ xns" : "Roo.form", + "items" : [ { - "Boolean modal" : true, - "Number width" : 480, - "xtype" : "LayoutDialog", - "Number height" : 160, - "Boolean resizable" : false, - "$ xns" : "Roo", - "String title" : "Edit", - "items" : [ - { - "xtype" : "LayoutRegion", - "$ xns" : "Roo", - "* prop" : "center\n" - }, - { - "xtype" : "ContentPanel", - "String region" : "center", - "$ xns" : "Roo", - "items" : [ - { - "listeners" : { - "rendered" : "function (form)\n{\n _this.form = this;\n}", - "|actioncomplete" : "function (_self, action)\n{\n if(action.type == 'submit'){\n _this.dialog.hide();\n \n if(_this.callback){\n _this.callback.call(_this, _this.form.getValues());\n }\n return\n }\n}" - }, - "$ url" : "baseURL + '/Roo/Core_enum'", - "xtype" : "Form", - "$ xns" : "Roo.form", - "items" : [ - { - "Boolean allowBlank" : false, - "String name" : "name", - "Number width" : 270, - "xtype" : "TextField", - "String fieldLabel" : "Name", - "$ xns" : "Roo.form" - }, - { - "String name" : "id", - "xtype" : "Hidden", - "$ xns" : "Roo.form" - }, - { - "String name" : "etype", - "xtype" : "Hidden", - "$ xns" : "Roo.form" - }, - { - "String name" : "display_name", - "Number width" : 270, - "xtype" : "TextField", - "String fieldLabel" : "Display Name", - "$ xns" : "Roo.form" - } - ] - } - ] - }, - { - "listeners" : { - "click" : "function (_self, e)\n{\n //this.url = baseURL + '/Roo/Core_enum.php';\n //_this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n}" - }, - "xtype" : "Button", - "String text" : "Save", - "$ xns" : "Roo", - "* prop" : "buttons[]" - }, - { - "listeners" : { - "click" : "function (_self, e)\n{\n _this.dialog.hide();\n}" - }, - "xtype" : "Button", - "String text" : "Cancel", - "$ xns" : "Roo", - "* prop" : "buttons[]" - } - ] + "Boolean allowBlank" : false, + "String name" : "name", + "Number width" : 270, + "xtype" : "TextField", + "String fieldLabel" : "Name", + "$ xns" : "Roo.form" + }, + { + "String name" : "id", + "xtype" : "Hidden", + "$ xns" : "Roo.form" + }, + { + "String name" : "etype", + "xtype" : "Hidden", + "$ xns" : "Roo.form" + }, + { + "String name" : "display_name", + "Number width" : 270, + "xtype" : "TextField", + "String fieldLabel" : "Display Name", + "$ xns" : "Roo.form" } - ] + ] + } + ] + }, + { + "listeners" : { + "click" : "function (_self, e)\n{\n //this.url = baseURL + '/Roo/Core_enum.php';\n //_this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n}" + }, + "xtype" : "Button", + "String text" : "Save", + "$ xns" : "Roo", + "* prop" : "buttons[]" + }, + { + "listeners" : { + "click" : "function (_self, e)\n{\n _this.dialog.hide();\n}" + }, + "xtype" : "Button", + "String text" : "Cancel", + "$ xns" : "Roo", + "* prop" : "buttons[]" + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Dialog.AdminEnumType.js b/Pman.Dialog.AdminEnumType.js index e94bf6a..0067865 100644 --- a/Pman.Dialog.AdminEnumType.js +++ b/Pman.Dialog.AdminEnumType.js @@ -6,139 +6,148 @@ Roo.namespace('Pman.Dialog'); Pman.Dialog.AdminEnumType = { - dialog : false, - callback: false, + _strings : { + '7dce122004969d56ae2e0245cb754d35' :"Edit", + 'b48968e1c912da07df5e8d6d246291ec' :"Display Name", + 'ea4788705e6873b424c65e91c2846b19' :"Cancel", + '49ee3087348e8d44e1feda1917443987' :"Name", + 'c9cc8cce247e49bae79f15173ce97354' :"Save" + }, + _named_strings : { + 'display_name_fieldLabel' : 'b48968e1c912da07df5e8d6d246291ec' /* Display Name */ , + 'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ + }, - show : function(data, cb) - { - if (!this.dialog) { - this.create(); - } - - this.callback = cb; - this.data = data; - this.dialog.show(this.data._el); - if (this.form) { - this.form.reset(); - this.form.setValues(data); - this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data }); - } - - }, + dialog : false, + callback: false, - create : function() - { - var _this = this; - this.dialog = Roo.factory({ - center - : { - '|xns' : 'Roo', - xtype : 'LayoutRegion', - xns : Roo - }, - '|xns' : 'Roo', - modal : true, - width : 480, - xtype : 'LayoutDialog', - height : 160, - resizable : false, - xns : Roo, - title : "Edit", - buttons : [ - { - '|xns' : 'Roo', - xtype : 'Button', - text : "Save", - xns : Roo, - listeners : { - click : function (_self, e) - { - //this.url = baseURL + '/Roo/Core_enum.php'; - //_this.dialog.el.mask("Saving"); - _this.form.doAction("submit"); - } - } - }, -{ - '|xns' : 'Roo', - xtype : 'Button', - text : "Cancel", - xns : Roo, - listeners : { - click : function (_self, e) - { - _this.dialog.hide(); - } - } - } - ], - items : [ - { - '|xns' : 'Roo', - xtype : 'ContentPanel', - region : 'center', - xns : Roo, - items : [ - { - '|xns' : 'Roo.form', - url : baseURL + '/Roo/Core_enum', - xtype : 'Form', - xns : Roo.form, - listeners : { - rendered : function (form) - { - _this.form = this; - }, - actioncomplete : function (_self, action) - { - if(action.type == 'submit'){ - _this.dialog.hide(); - - if(_this.callback){ - _this.callback.call(_this, _this.form.getValues()); - } - return - } - } - }, - items : [ - { - '|xns' : 'Roo.form', - allowBlank : false, - name : 'name', - width : 270, - xtype : 'TextField', - fieldLabel : 'Name', - xns : Roo.form - }, - { - '|xns' : 'Roo.form', - name : 'id', - xtype : 'Hidden', - xns : Roo.form - }, - { - '|xns' : 'Roo.form', - name : 'etype', - xtype : 'Hidden', - xns : Roo.form - }, - { - '|xns' : 'Roo.form', - name : 'display_name', - width : 270, - xtype : 'TextField', - fieldLabel : 'Display Name', - xns : Roo.form - } - ] + show : function(data, cb) + { + if (!this.dialog) { + this.create(); + } - } - ] + this.callback = cb; + this.data = data; + this.dialog.show(this.data._el); + if (this.form) { + this.form.reset(); + this.form.setValues(data); + this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data }); + } - } - ] + }, - }); - } + create : function() + { + var _this = this; + this.dialog = Roo.factory({ + xtype : 'LayoutDialog', + height : 160, + modal : true, + resizable : false, + title : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */, + width : 480, + xns : Roo, + '|xns' : 'Roo', + center + : { + xtype : 'LayoutRegion', + xns : Roo, + '|xns' : 'Roo' + }, + buttons : [ + { + xtype : 'Button', + text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */, + listeners : { + click : function (_self, e) + { + //this.url = baseURL + '/Roo/Core_enum.php'; + //_this.dialog.el.mask("Saving"); + _this.form.doAction("submit"); + } + }, + xns : Roo, + '|xns' : 'Roo' + }, + { + xtype : 'Button', + text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */, + listeners : { + click : function (_self, e) + { + _this.dialog.hide(); + } + }, + xns : Roo, + '|xns' : 'Roo' + } + ], + items : [ + { + xtype : 'ContentPanel', + region : 'center', + xns : Roo, + '|xns' : 'Roo', + items : [ + { + xtype : 'Form', + url : baseURL + '/Roo/Core_enum', + listeners : { + actioncomplete : function (_self, action) + { + if(action.type == 'submit'){ + _this.dialog.hide(); + + if(_this.callback){ + _this.callback.call(_this, _this.form.getValues()); + } + return + } + }, + rendered : function (form) + { + _this.form = this; + } + }, + xns : Roo.form, + '|xns' : 'Roo.form', + items : [ + { + xtype : 'TextField', + allowBlank : false, + fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */, + name : 'name', + width : 270, + xns : Roo.form, + '|xns' : 'Roo.form' + }, + { + xtype : 'Hidden', + name : 'id', + xns : Roo.form, + '|xns' : 'Roo.form' + }, + { + xtype : 'Hidden', + name : 'etype', + xns : Roo.form, + '|xns' : 'Roo.form' + }, + { + xtype : 'TextField', + fieldLabel : _this._strings['b48968e1c912da07df5e8d6d246291ec'] /* Display Name */, + name : 'display_name', + width : 270, + xns : Roo.form, + '|xns' : 'Roo.form' + } + ] + } + ] + } + ] + }); + } }; diff --git a/Pman.Dialog.AdminLanguagePick.bjs b/Pman.Dialog.AdminLanguagePick.bjs new file mode 100644 index 0000000..5f5fd3c --- /dev/null +++ b/Pman.Dialog.AdminLanguagePick.bjs @@ -0,0 +1,118 @@ +{ + "name" : "Pman.Dialog.AdminLanguagePick", + "parent" : "", + "title" : "", + "path" : "/home/alan/gitlive/Pman.Admin/Pman.Dialog.AdminLanguagePick.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "4994a8ffeba4ac3140beb89e8d41f174" : "Language", + "ea4788705e6873b424c65e91c2846b19" : "Cancel", + "052ca52fc8eb1bdff3e34de3fa735e35" : "Select a Language", + "e0aa021e21dddbd6d8cecec71e9cf564" : "OK" + }, + "named_strings" : { + "language_name_fieldLabel" : "4994a8ffeba4ac3140beb89e8d41f174" + }, + "items" : [ + { + "modal" : true, + "collapsible" : false, + "title" : "Select a Language", + "xtype" : "LayoutDialog", + "width" : 400, + "$ xns" : "Roo", + "closable" : false, + "resizable" : false, + "height" : 120, + "items" : [ + { + "xtype" : "LayoutRegion", + "$ xns" : "Roo", + "* prop" : "center" + }, + { + "region" : "center", + "xtype" : "ContentPanel", + "$ xns" : "Roo", + "items" : [ + { + "listeners" : { + "|actioncomplete" : "function(_self,action)\n{\n if (action.type == 'setdata') {\n //_this.dialog.el.mask(\"Loading\");\n //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n return;\n }\n if (action.type == 'load') {\n _this.dialog.el.unmask();\n return;\n }\n if (action.type =='submit') {\n \n _this.dialog.el.unmask();\n _this.dialog.hide();\n\n if (_this.callback) {\n _this.callback.call(_this, _this.form.getValues());\n }\n _this.form.reset();\n return;\n }\n}\n", + "|rendered" : "function (form)\n{\n _this.form= form;\n}\n" + }, + "$ url" : "baseURL + '/Roo/INGORE.php'", + "xtype" : "Form", + "method" : "GET", + "style" : "margin:10px;", + "$ xns" : "Roo.form", + "items" : [ + { + "alwaysQuery" : true, + "listWidth" : 200, + "triggerAction" : "all", + "fieldLabel" : "Language", + "displayField" : "title", + "hiddenName" : "lang", + "valueField" : "code", + "xtype" : "ComboBox", + "allowBlank" : false, + "editable" : false, + "width" : 200, + "$ xns" : "Roo.form", + "name" : "language_name", + "items" : [ + { + "listeners" : { + "beforeload" : "function (_self, o)\n{\n o.params['!code'] = 'en'; // exclude english from the list (it's the default?)\n}" + }, + "xtype" : "Store", + "$ xns" : "Roo.data", + "* prop" : "store", + "items" : [ + { + "$ url" : "baseURL + '/Core/I18n/Lang'", + "xtype" : "HttpProxy", + "method" : "GET", + "$ xns" : "Roo.data", + "* prop" : "proxy" + }, + { + "id" : "code", + "root" : "data", + "xtype" : "JsonReader", + "$ fields" : "[\n {\n 'name': 'code',\n 'type': 'string'\n },\n {\n 'name': 'title',\n 'type': 'string'\n }\n]", + "$ xns" : "Roo.data", + "* prop" : "reader", + "totalProperty" : "total" + } + ] + } + ] + } + ] + } + ] + }, + { + "listeners" : { + "click" : "function (_self, e)\n{\n _this.dialog.hide();\n}" + }, + "text" : "Cancel", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + }, + { + "listeners" : { + "click" : "function (_self, e)\n{\n // do some checks?\n \n var data = _this.form.getValues();\n \n if (!data.lang.length) {\n \n Roo.MessageBox.alert(\"Error\", \"Select language\");\n return;\n \n }\n _this.dialog.hide();\n \n var callbackData = data.lang;\n // Roo.log(_this.data);\n if(_this.data._with_name == true){\n callbackData = {'lang' : data.lang , 'lang_name' : _this.form.findField('lang').lastSelectionText};\n }\n \n _this.callback(callbackData);\n \n\n}" + }, + "text" : "OK", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + } + ] + } + ] +} \ No newline at end of file diff --git a/Pman.Dialog.AdminLanguagePick.js b/Pman.Dialog.AdminLanguagePick.js new file mode 100644 index 0000000..386b0c8 --- /dev/null +++ b/Pman.Dialog.AdminLanguagePick.js @@ -0,0 +1,207 @@ +//