]> git.proxmox.com Git - pve-manager.git/blame - PVE/ExtJSIndex.pm
Change Ct restore rest call
[pve-manager.git] / PVE / ExtJSIndex.pm
CommitLineData
e55bd5a1
DM
1package PVE::ExtJSIndex;
2
3use strict;
4use warnings;
5
6sub 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 35if (typeof(PVE) === 'undefined') PVE = {};
e55bd5a1
DM
36PVE.UserName = '$username'
37PVE.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)
45Ext.useShims = true;
46Ext.History.fieldid = 'x-history-field';
47Ext.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
671;