]>
Commit | Line | Data |
---|---|---|
e55bd5a1 DM |
1 | package PVE::ExtJSIndex; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | sub get_index { | |
7 | my ($lang, $username, $csrftoken, $console) = @_; | |
8 | ||
9 | my $page = <<_EOD; | |
162d0d1a | 10 | <!DOCTYPE html> |
e55bd5a1 DM |
11 | <html> |
12 | <head> | |
13 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
841bbcec | 14 | <meta http-equiv="X-UA-Compatible" content="IE=10"> |
e55bd5a1 DM |
15 | <title>Proxmox Virtual Environment</title> |
16 | ||
17 | <link rel="stylesheet" type="text/css" href="/pve2/ext4/resources/css/ext-all.css" /> | |
18 | <link rel="stylesheet" type="text/css" href="/pve2/css/ext-pve.css" /> | |
19 | _EOD | |
20 | ||
21 | my $langfile = "/usr/share/pve-manager/locale/pve-lang-${lang}.js"; | |
22 | if (-f $langfile) { | |
23 | $page .= "<script type='text/javascript' src='/pve2/locale/pve-lang-${lang}.js'></script>"; | |
24 | } else { | |
25 | $page .= '<script type="text/javascript">function gettext(buf) { return buf; }</script>'; | |
26 | } | |
27 | ||
28 | $page .= <<_EOD; | |
29 | <script type="text/javascript" src="/pve2/ext4/ext-all-debug.js"></script> | |
30 | <script type="text/javascript" src="/pve2/ext4/pvemanagerlib.js"></script> | |
31 | <script type="text/javascript" src="/pve2/ext4/locale/ext-lang-${lang}.js"></script> | |
32 | _EOD | |
33 | ||
34 | my $jssrc = <<_EOJS; | |
d6015915 | 35 | if (typeof(PVE) === 'undefined') PVE = {}; |
e55bd5a1 DM |
36 | PVE.UserName = '$username' |
37 | PVE.CSRFPreventionToken = '$csrftoken'; | |
38 | _EOJS | |
39 | ||
40 | my $workspace = defined($console) ? | |
41 | "PVE.ConsoleWorkspace" : "PVE.StdWorkspace"; | |
42 | ||
43 | $jssrc .= <<_EOJS; | |
44 | // we need this (the java applet ignores the zindex) | |
45 | Ext.useShims = true; | |
46 | Ext.History.fieldid = 'x-history-field'; | |
47 | Ext.onReady(function() { Ext.create('$workspace');}); | |
48 | _EOJS | |
49 | ||
50 | $page .= <<_EOD; | |
51 | <script type="text/javascript">$jssrc</script> | |
52 | ||
53 | </head> | |
54 | <body> | |
55 | <!-- Fields required for history management --> | |
56 | <form id="history-form" class="x-hidden"> | |
57 | <input type="hidden" id="x-history-field"/> | |
58 | </form> | |
59 | </body> | |
60 | </html> | |
61 | _EOD | |
62 | ||
63 | return $page; | |
64 | ||
65 | } | |
66 | ||
67 | 1; |