[pve-devel] [PATCH widget-toolkit 1/1] add LanguageEditWindow

Dominik Csapak d.csapak at proxmox.com
Fri Apr 17 13:23:35 CEST 2020


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 Makefile               |  1 +
 window/LanguageEdit.js | 43 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 window/LanguageEdit.js

diff --git a/Makefile b/Makefile
index a729b95..2907419 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,7 @@ JSSRC=					\
 	window/Edit.js			\
 	window/PasswordEdit.js		\
 	window/TaskViewer.js		\
+	window/LanguageEdit.js		\
 	node/APT.js			\
 	node/NetworkEdit.js		\
 	node/NetworkView.js		\
diff --git a/window/LanguageEdit.js b/window/LanguageEdit.js
new file mode 100644
index 0000000..51f0ab2
--- /dev/null
+++ b/window/LanguageEdit.js
@@ -0,0 +1,43 @@
+Ext.define('Proxmox.window.LanguageEditWindow', {
+    extend: 'Ext.window.Window',
+    alias: 'widget.pmxLanguageEditWindow',
+
+    cookieName: 'PVELangCookie',
+
+    title: gettext('Language'),
+    modal: true,
+    bodyPadding: 10,
+    items: [
+	{
+	    xtype: 'proxmoxLanguageSelector',
+	    fieldLabel: gettext('Language'),
+	},
+    ],
+
+    buttons: [
+	{
+	    text: gettext('OK'),
+	    handler: function() {
+		let me = this;
+		let win = this.up('window');
+		let value = win.down('proxmoxLanguageSelector').getValue();
+		let dt = Ext.Date.add(new Date(), Ext.Date.YEAR, 10);
+		Ext.util.Cookies.set(win.cookieName, value, dt);
+		win.mask(gettext('Please wait...'), 'x-mask-loading');
+		window.location.reload();
+	    }
+	},
+    ],
+
+    initComponent: function() {
+	let me = this;
+
+	if (!me.cookieName) {
+	    throw "no cookie name given";
+	}
+
+	me.callParent();
+	me.down('proxmoxLanguageSelector')
+	    .setValue(Ext.util.Cookies.get(me.cookieName) || '__default__');
+    },
+});
-- 
2.20.1





More information about the pve-devel mailing list