]>
Commit | Line | Data |
---|---|---|
e55bd5a1 DM |
1 | package PVE::ExtJSIndex; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | sub get_index { | |
69f17ac3 | 7 | my ($lang, $username, $csrftoken, $console, $nodename, $debug) = @_; |
e55bd5a1 DM |
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" /> | |
936e4d89 | 14 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
5783c7f4 | 15 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> |
c7f32808 | 16 | <title>$nodename - Proxmox Virtual Environment</title> |
5b193174 DC |
17 | <link rel="icon" sizes="128x128" href="/pve2/images/logo-128.png" /> |
18 | <link rel="apple-touch-icon" sizes="128x128" href="/pve2/images/logo-128.png" /> | |
5783c7f4 DM |
19 | <link rel="stylesheet" type="text/css" href="/pve2/ext6/theme-crisp/resources/theme-crisp-all.css" /> |
20 | <link rel="stylesheet" type="text/css" href="/pve2/ext6/crisp/resources/charts-all.css" /> | |
d9fd02eb | 21 | <link rel="stylesheet" type="text/css" href="/pve2/css/font-awesome.css" /> |
5783c7f4 | 22 | <link rel="stylesheet" type="text/css" href="/pve2/css/ext6-pve.css" /> |
e55bd5a1 DM |
23 | _EOD |
24 | ||
25 | my $langfile = "/usr/share/pve-manager/locale/pve-lang-${lang}.js"; | |
26 | if (-f $langfile) { | |
248ff6ca | 27 | $page .= " <script type='text/javascript' src='/pve2/locale/pve-lang-${lang}.js'></script>\n"; |
e55bd5a1 | 28 | } else { |
248ff6ca | 29 | $page .= " <script type='text/javascript'>function gettext(buf) { return buf; }</script>\n"; |
e55bd5a1 DM |
30 | } |
31 | ||
69f17ac3 EK |
32 | if ($debug) { |
33 | $page .= <<_EOD; | |
34 | <script type="text/javascript" src="/pve2/ext6/ext-all-debug.js"></script> | |
35 | <script type="text/javascript" src="/pve2/ext6/charts-debug.js"></script> | |
36 | _EOD | |
37 | } else { | |
38 | $page .= <<_EOD; | |
650920de EK |
39 | <script type="text/javascript" src="/pve2/ext6/ext-all.js"></script> |
40 | <script type="text/javascript" src="/pve2/ext6/charts.js"></script> | |
69f17ac3 EK |
41 | _EOD |
42 | } | |
43 | ||
44 | $page .= <<_EOD; | |
5783c7f4 | 45 | <script type="text/javascript" src="/pve2/ext6/pvemanagerlib.js"></script> |
6cf9cce3 | 46 | <script type="text/javascript" src="/pve2/ext6/locale/locale-${lang}.js"></script> |
e55bd5a1 DM |
47 | _EOD |
48 | ||
49 | my $jssrc = <<_EOJS; | |
d6015915 | 50 | if (typeof(PVE) === 'undefined') PVE = {}; |
e55bd5a1 DM |
51 | PVE.UserName = '$username' |
52 | PVE.CSRFPreventionToken = '$csrftoken'; | |
53 | _EOJS | |
54 | ||
55 | my $workspace = defined($console) ? | |
56 | "PVE.ConsoleWorkspace" : "PVE.StdWorkspace"; | |
57 | ||
58 | $jssrc .= <<_EOJS; | |
e55bd5a1 DM |
59 | Ext.History.fieldid = 'x-history-field'; |
60 | Ext.onReady(function() { Ext.create('$workspace');}); | |
61 | _EOJS | |
62 | ||
63 | $page .= <<_EOD; | |
64 | <script type="text/javascript">$jssrc</script> | |
65 | ||
66 | </head> | |
67 | <body> | |
68 | <!-- Fields required for history management --> | |
69 | <form id="history-form" class="x-hidden"> | |
70 | <input type="hidden" id="x-history-field"/> | |
71 | </form> | |
72 | </body> | |
73 | </html> | |
74 | _EOD | |
75 | ||
76 | return $page; | |
77 | ||
78 | } | |
79 | ||
80 | 1; |