[pve-devel] r5760 - in pve-manager/pve2/www: . new

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Mar 28 14:47:23 CEST 2011


Author: dietmar
Date: 2011-03-28 14:47:23 +0200 (Mon, 28 Mar 2011)
New Revision: 5760

Added:
   pve-manager/pve2/www/new/
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/index.pl
   pve-manager/pve2/www/new/startup.pl
   pve-manager/pve2/www/new/test.js
Log:
first test with extjs 4


Added: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	                        (rev 0)
+++ pve-manager/pve2/www/new/Makefile.am	2011-03-28 12:47:23 UTC (rev 5760)
@@ -0,0 +1,28 @@
+include $(top_builddir)/common.mk
+
+JSSRC= 				                 	\
+	test.js
+
+pvemanagerlib.js: ${JSSRC}
+	cat ${JSSRC} >$@
+
+pvelib_DATA = pvemanagerlib.js
+pvelibdir = ${WWW_EXTDIR}
+
+privatedir = ${WWW_BASEDIR}
+private_SCRIPTS = 		\
+	startup.pl
+
+managerdir = ${WWW_ROOTDIR}
+manager_SCRIPTS = 		\
+	index.pl
+
+install-data-hook: 
+	chown -R www-data:www-data ${DESTDIR}/${privatedir}
+	chown -R www-data:www-data ${DESTDIR}/${managerdir}
+	chown -R www-data:www-data ${DESTDIR}/${pvelibdir}
+
+clean-local:
+	-rm -rf *~ store/*~ pvemanagerlib.js
+
+

Added: pve-manager/pve2/www/new/index.pl
===================================================================
--- pve-manager/pve2/www/new/index.pl	                        (rev 0)
+++ pve-manager/pve2/www/new/index.pl	2011-03-28 12:47:23 UTC (rev 5760)
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+
+use strict;
+use mod_perl2 '1.9922';
+use Encode;
+use CGI;
+use PVE::AccessControl;
+use PVE::REST;
+
+sub send_output {
+    my ($r, $data) = @_;
+
+    my $encdata = encode('UTF-8', $data);
+    $r->no_cache (1);
+    my $x = length ($encdata);
+    $r->content_type ("text/html;charset=UTF-8");
+    $r->headers_out->set ("Content-length", "$x");
+    $r->headers_out->set ("Pragma", "no-cache");
+
+    $r->print ($encdata);
+}
+
+# NOTE: Requests to this page are not authenticated
+# so we must be very careful here 
+
+my $r = Apache2::RequestUtil->request();
+
+my $token = 'null';
+if (my $cookie = $r->headers_in->{Cookie}) {
+    my $ticket = PVE::REST::extract_auth_cookie($cookie);
+    if (PVE::AccessControl::verify_ticket($ticket, 1)) {
+	$token = PVE::AccessControl::assemble_csrf_prevention_token($ticket);
+    }
+}
+
+my $cgi = CGI->new($r);
+my %args =  $cgi->Vars();
+
+my $console = $args{console};
+
+my $title = "Proxmox Virtual Environment";
+if (defined($console)) {
+    if ($console eq 'kvm' && $args{vmid}) {
+	my $name = "VM $args{vmid}"; # fixme: use real VM name
+	$title = "$name - Proxmox Console";
+    } elsif ($console eq 'shell' && $args{node}) {
+	$title = "node $args{node} - Proxmox Console";
+    }
+}
+
+my $jssrc = <<_EOJS;
+PVECSRFPreventionToken = '$token';
+Ext.require(['*']);
+Ext.onReady(function() {
+    Ext.create('PVE.Workspace');
+});
+_EOJS
+
+
+my $page = <<_EOD;
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+    <title id='title'>$title</title>
+ 
+    <link rel="stylesheet" type="text/css" href="/ext/ext-all-debug.css" />
+    <link rel="stylesheet" type="text/css" href="/css/ext-pve.css" />
+ 
+    <script type="text/javascript" src="/ext/ext-core-debug.js"></script>
+    <script type="text/javascript" src="/ext/ext-all-debug.js"></script>
+    <script type="text/javascript" src="/ext/pvemanagerlib.js"></script>
+    
+    <script type="text/javascript">$jssrc</script>
+    
+  </head>
+  <body>
+    <!-- Fields required for history management -->
+    <form id="history-form" class="x-hidden">
+    <input type="hidden" id="x-history-field"/>
+    <iframe id="x-history-frame"></iframe>
+    </form>
+  </body>
+</html>
+_EOD
+
+send_output ($r, $page);
+exit (0);

Added: pve-manager/pve2/www/new/startup.pl
===================================================================
--- pve-manager/pve2/www/new/startup.pl	                        (rev 0)
+++ pve-manager/pve2/www/new/startup.pl	2011-03-28 12:47:23 UTC (rev 5760)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use PVE::SafeSyslog;
+
+use ModPerl::Util (); #for CORE::GLOBAL::exit
+
+use Apache2::RequestRec ();
+use Apache2::RequestIO ();
+use Apache2::RequestUtil ();
+use Apache2::Access;
+use Apache2::Response;
+use Apache2::Util;
+  
+use Apache2::ServerUtil ();
+use Apache2::Connection ();
+use Apache2::Log ();
+  
+use APR::Table ();
+  
+use ModPerl::Registry ();
+  
+use Apache2::Const -compile => ':common';
+use APR::Const -compile => ':common';
+
+initlog ('proxwww', 'daemon');
+
+use PVE::pvecfg;
+use PVE::REST;
+use PVE::Cluster;
+use PVE::INotify;
+use PVE::RPCEnvironment;
+
+sub childinit {
+    syslog ('info', "Starting new child $$");
+    PVE::INotify::inotify_init();
+    PVE::RPCEnvironment->init('pub');
+
+    PVE::Config::inotify_init();
+}
+
+sub childexit {
+    syslog ('info', "Finish child $$");
+}
+
+my $s = Apache2::ServerUtil->server;
+$s->push_handlers(PerlChildInitHandler => \&childinit);
+$s->push_handlers(PerlChildExitHandler => \&childexit);
+
+1;
+


Property changes on: pve-manager/pve2/www/new/startup.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: pve-manager/pve2/www/new/test.js
===================================================================
--- pve-manager/pve2/www/new/test.js	                        (rev 0)
+++ pve-manager/pve2/www/new/test.js	2011-03-28 12:47:23 UTC (rev 5760)
@@ -0,0 +1,96 @@
+Ext.define('PVE.Workspace', {
+    extend: 'Ext.container.Viewport',
+
+    // private
+    defaultView: {
+	title: 'Nothing selected',
+	border: false,
+	region:'center'
+    },
+
+    initComponent : function() {
+	var self = this;
+
+	Ext.tip.QuickTips.init();
+
+	Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
+	    secure: true }));
+
+	Ext.apply(self, {
+ 	    layout: 'border',
+	    border: false,
+
+	    items: [
+		{
+		    region: 'north',
+		    height: 30,
+		    layout: { 
+			type: 'hbox',
+			align : 'stretch'
+		    },
+		    baseCls: 'x-plain',		
+		    defaults: {
+			baseCls: 'x-plain'			
+		    },
+		    border: false,
+		    items: [
+			{
+			    margins: '0 0 0 2',
+			    html: '<img height=30 width=209 src="/images/proxmox_logo.png"/>'
+			},
+			{
+			    flex: 1,
+			    //html: '<span style="white-space: nowrap;"><b>Proxmox Virtual Environment</b><br>Version 2.0</span>',
+			    html: '<b class="x-panel-header-text">Proxmox Virtual Environment</b><br>Version 2.0</span>',
+			},
+			{
+			    pack: 'end',
+			    width: 100,
+			    margins: '3 5 0 0',
+			    xtype: 'button',
+			    baseCls: 'x-btn',
+			    text: "Logout"
+			}
+		    ],
+		    margins: '2 0 5 0'
+		},
+		{
+		    region: 'center',
+		    margins:'0 0 0 0',
+		    items: self.defaultView
+		},
+		{
+		    //xtype: 'pveResourceTree',
+		    html: 'tree',
+		    width: 200,
+		    region: 'west',
+		    margins: '0 0 0 0',
+		    //  collapsible: true
+		    split: true
+		},
+		{
+		    //xtype: 'pveStatusPanel',
+		    xtype: 'tabpanel',
+		    title: "Realtime logfile viewer",
+		    tabPosition: 'bottom',
+		    region:'south',
+		    margins:'0 0 0 0',
+	    	    height: 200,       
+		    collapsible: true,
+		    split:true,
+		    items: [
+			{
+			    title: 'tab1'
+			},
+			{
+			    title: 'tab2'
+			}
+		    ]
+		}
+	    ]
+	});
+
+	PVE.Workspace.superclass.initComponent.call(self);
+    }
+});
+



More information about the pve-devel mailing list