diff --git a/PVE/ExtJSIndex.pm b/PVE/ExtJSIndex.pm
new file mode 100644
index 00000000..2672277a
--- /dev/null
+++ b/PVE/ExtJSIndex.pm
@@ -0,0 +1,66 @@
+package PVE::ExtJSIndex;
+
+use strict;
+use warnings;
+
+sub get_index {
+ my ($lang, $username, $csrftoken, $console) = @_;
+
+ my $page = <<_EOD;
+
+
+
+
+ Proxmox Virtual Environment
+
+
+
+_EOD
+
+ my $langfile = "/usr/share/pve-manager/locale/pve-lang-${lang}.js";
+ if (-f $langfile) {
+ $page .= "";
+ } else {
+ $page .= '';
+ }
+
+ $page .= <<_EOD;
+
+
+
+_EOD
+
+ my $jssrc = <<_EOJS;
+if (!PVE) PVE = {};
+PVE.UserName = '$username'
+PVE.CSRFPreventionToken = '$csrftoken';
+_EOJS
+
+ my $workspace = defined($console) ?
+ "PVE.ConsoleWorkspace" : "PVE.StdWorkspace";
+
+ $jssrc .= <<_EOJS;
+// we need this (the java applet ignores the zindex)
+Ext.useShims = true;
+Ext.History.fieldid = 'x-history-field';
+Ext.onReady(function() { Ext.create('$workspace');});
+_EOJS
+
+ $page .= <<_EOD;
+
+
+
+
+
+
+
+
+_EOD
+
+ return $page;
+
+}
+
+1;
diff --git a/PVE/Makefile b/PVE/Makefile
index e1553a4f..30ffd797 100644
--- a/PVE/Makefile
+++ b/PVE/Makefile
@@ -6,6 +6,7 @@ PERLSOURCE = \
API2.pm \
API2Tools.pm \
API2Client.pm \
+ ExtJSIndex.pm \
HTTPServer.pm \
APIDaemon.pm \
REST.pm \
diff --git a/bin/pveproxy b/bin/pveproxy
index 7cc1077a..a1ba11f3 100755
--- a/bin/pveproxy
+++ b/bin/pveproxy
@@ -23,6 +23,8 @@ use PVE::API2;
use PVE::API2::Formatter::Standard;
use PVE::API2::Formatter::HTML;
+use PVE::ExtJSIndex;
+
my $pidfile = "/var/run/pveproxy/pveproxy.pid";
my $lockfile = "/var/lock/pveproxy.lck";
@@ -78,6 +80,7 @@ eval {
my $dirs = {};
+ add_dirs($dirs, '/pve2/locale/', '/usr/share/pve-manager/locale/');
add_dirs($dirs, '/pve2/ext4/', '/usr/share/pve-manager/ext4/');
add_dirs($dirs, '/pve2/images/' => '/usr/share/pve-manager/images/');
add_dirs($dirs, '/pve2/css/' => '/usr/share/pve-manager/css/');
@@ -194,63 +197,9 @@ sub get_index {
}
}
- my $workspace = defined($args->{console}) ?
- "PVE.ConsoleWorkspace" : "PVE.StdWorkspace";
-
$username = '' if !$username;
- my $jssrc = <<_EOJS;
-if (!PVE) PVE = {};
-PVE.UserName = '$username';
-PVE.CSRFPreventionToken = '$token';
-_EOJS
-
- my $langfile = "/usr/share/pve-manager/ext4/locale/ext-lang-${lang}.js";
- $jssrc .= PVE::Tools::file_get_contents($langfile) if -f $langfile;
-
- my $i18nsrc;
- $langfile = "/usr/share/pve-manager/root/pve-lang-${lang}.js";
- if (-f $langfile) {
- $i18nsrc = PVE::Tools::file_get_contents($langfile);
- } else {
- $i18nsrc = 'function gettext(buf) { return buf; }';
- }
-
- $jssrc .= <<_EOJS;
-
-// we need this (the java applet ignores the zindex)
-Ext.useShims = true;
-
-Ext.History.fieldid = 'x-history-field';
-
-Ext.onReady(function() { Ext.create('$workspace');});
-
-_EOJS
-
- my $page = <<_EOD;
-
-
-
-
- Proxmox Virtual Environment
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-_EOD
+ my $page = PVE::ExtJSIndex::get_index($lang, $username, $token, $args->{console});
my $headers = HTTP::Headers->new(Content_Type => "text/html; charset=utf-8");
my $resp = HTTP::Response->new(200, "OK", $headers, $page);
diff --git a/defines.mk b/defines.mk
index c64cb0d1..40162883 100644
--- a/defines.mk
+++ b/defines.mk
@@ -14,6 +14,7 @@ DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
PODDIR=${DESTDIR}/usr/share/doc/${PACKAGE}/pod
WWWBASEDIR=${DESTDIR}/usr/share/${PACKAGE}
WWWROOTDIR=${WWWBASEDIR}/root
+WWWLOCALEDIR=${WWWBASEDIR}/locale
WWWIMAGEDIR=${WWWBASEDIR}/images
WWWEXT4DIR=${WWWBASEDIR}/ext4
WWWCSSDIR=${WWWBASEDIR}/css