xcpweb

changeset 8:dff069dff4b7

Many new things + some screenshot :)
author Nikola Nikov <nikolanikov@webconnect.bg>
date Tue Jul 13 01:15:04 2010 +0300 (2010-07-13)
parents b9279d8aaa76
children a8a680105b67
files index.html interface/img/bar.png interface/img/button.png interface/img/button_active.png interface/img/cloud_pool_button.png interface/img/cloud_pool_button_active.png interface/img/create_new_button.png interface/img/create_new_button_active.png interface/img/ico-arrow-right.png interface/img/loading.gif interface/img/menu_operations.png interface/img/menu_pause.png interface/img/menu_reboot.png interface/img/menu_settings.png interface/img/menu_shutdown.png interface/img/menu_stats.png interface/img/menu_terminal.png interface/img/meter.gif interface/img/minus_big.png interface/img/minus_small.png interface/img/paused.png interface/img/plus_big.png interface/img/plus_small.png interface/img/running.png interface/img/server.png interface/img/settings_button.png interface/img/settings_button_active.png interface/img/shutdown.png interface/img/stopped.png interface/index.html interface/js/interface_init.js interface/templates/cloud_pool.css interface/templates/cloud_pool.html interface/templates/cloud_pool.html.backup interface/templates/cloud_pool.js interface/templates/create_new.html interface/templates/create_new.js interface/templates/login.css interface/templates/login.html interface/templates/login.js interface/templates/main.css interface/templates/main.html interface/templates/main.js interface/templates/settings.html interface/templates/settings.js interface/xcp.css libxen/db_callbacks.js libxen/libxen.js xcpweb_screenshot.png
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/index.html	Tue Jul 13 01:15:04 2010 +0300
     1.3 @@ -0,0 +1,11 @@
     1.4 +<html>
     1.5 +  <title>XenCloudPlatform 0.1.1</title>
     1.6 +<head>
     1.7 +</head>
     1.8 +<body>
     1.9 +  <p/>Citrix Systems, Inc. XenCloudPlatform 0.1.1
    1.10 +  <p/><a href="XenCenter.iso">XenCenter CD image</a>
    1.11 +  <p/><a href="XenCenter.msi">XenCenter installer</a>
    1.12 +  <p/><a href="interface/">xcpweb</a>
    1.13 +</body>
    1.14 +</html>
     2.1 Binary file interface/img/bar.png has changed
     3.1 Binary file interface/img/button.png has changed
     4.1 Binary file interface/img/button_active.png has changed
     5.1 Binary file interface/img/cloud_pool_button.png has changed
     6.1 Binary file interface/img/cloud_pool_button_active.png has changed
     7.1 Binary file interface/img/create_new_button.png has changed
     8.1 Binary file interface/img/create_new_button_active.png has changed
     9.1 Binary file interface/img/ico-arrow-right.png has changed
    10.1 Binary file interface/img/loading.gif has changed
    11.1 Binary file interface/img/menu_operations.png has changed
    12.1 Binary file interface/img/menu_pause.png has changed
    13.1 Binary file interface/img/menu_reboot.png has changed
    14.1 Binary file interface/img/menu_settings.png has changed
    15.1 Binary file interface/img/menu_shutdown.png has changed
    16.1 Binary file interface/img/menu_stats.png has changed
    17.1 Binary file interface/img/menu_terminal.png has changed
    18.1 Binary file interface/img/meter.gif has changed
    19.1 Binary file interface/img/minus_big.png has changed
    20.1 Binary file interface/img/minus_small.png has changed
    21.1 Binary file interface/img/paused.png has changed
    22.1 Binary file interface/img/plus_big.png has changed
    23.1 Binary file interface/img/plus_small.png has changed
    24.1 Binary file interface/img/running.png has changed
    25.1 Binary file interface/img/server.png has changed
    26.1 Binary file interface/img/settings_button.png has changed
    27.1 Binary file interface/img/settings_button_active.png has changed
    28.1 Binary file interface/img/shutdown.png has changed
    29.1 Binary file interface/img/stopped.png has changed
    30.1 --- a/interface/index.html	Tue Jun 15 00:58:46 2010 +0300
    30.2 +++ b/interface/index.html	Tue Jul 13 01:15:04 2010 +0300
    30.3 @@ -16,7 +16,8 @@ var libxen_path='/libxen';
    30.4  
    30.5  <link href="/interface/xcp.css" rel="stylesheet" type="text/css" />
    30.6  <link href="/interface/templates/login.css" rel="stylesheet" type="text/css" />
    30.7 -
    30.8 +<link href="/interface/templates/main.css" rel="stylesheet" type="text/css" />
    30.9 +<link href="/interface/templates/cloud_pool.css" rel="stylesheet" type="text/css" />
   30.10  
   30.11  </head>
   30.12  <body onLoad="templates.LoadJS(interface_path+'/templates/login.js');templates.LoadTemplate(interface_path+'/templates/login.html','content');">
   30.13 @@ -28,6 +29,7 @@ var libxen_path='/libxen';
   30.14  
   30.15  </div>
   30.16  
   30.17 -
   30.18 +<div id="otherPages"></div>
   30.19 +<div id="submenus"></div>
   30.20  </body>
   30.21  </html>
   30.22 \ No newline at end of file
    31.1 --- a/interface/js/interface_init.js	Tue Jun 15 00:58:46 2010 +0300
    31.2 +++ b/interface/js/interface_init.js	Tue Jul 13 01:15:04 2010 +0300
    31.3 @@ -3,6 +3,11 @@ function templates_req() {
    31.4  	var xmldoc;
    31.5  	var param;
    31.6  	var url;
    31.7 +	var attr;
    31.8 +
    31.9 +	var objElement;
   31.10 +	var strClass;
   31.11 +	var binMayAlredyExists;
   31.12  
   31.13  	this.CreateHttpRequestObject = function(param) {
   31.14  		if (!param) { param = 'text/xml'; }
   31.15 @@ -24,12 +29,13 @@ function templates_req() {
   31.16  		}
   31.17  		return http_request;
   31.18  	}
   31.19 -	this.LoadTemplate = function(url,put_id) {
   31.20 +	this.LoadTemplate = function(url,put_id,onload) {
   31.21  		var httpRequest=self.CreateHttpRequestObject();
   31.22  		httpRequest.onreadystatechange = function() {
   31.23  			if (httpRequest.readyState == 4) {
   31.24  				if (httpRequest.status == 200) {
   31.25  					document.getElementById(put_id).innerHTML=httpRequest.responseText;
   31.26 +					if(typeof(onload)!='undefined')onload();
   31.27  				}
   31.28  				else {
   31.29  					if(httpRequest.status!=404) {
   31.30 @@ -48,10 +54,417 @@ function templates_req() {
   31.31  		document.getElementsByTagName('head')[0].appendChild(fileref);
   31.32  		return true;
   31.33  	}
   31.34 +	this.LoadImage = function(img) {
   31.35 +	imageObj = new Image();
   31.36 +	imageObj.src=img;
   31.37 +	}
   31.38 +	// other functions
   31.39  	
   31.40 -
   31.41 +	this.findPos = function(fobj) {
   31.42 +		if (typeof(fobj) != 'object') { return [0,0]; }
   31.43 +		var curleft = curtop = 0;
   31.44 +		if (fobj.offsetParent) {
   31.45 +			curleft = fobj.offsetLeft
   31.46 +			curtop = fobj.offsetTop
   31.47 +			while (fobj = fobj.offsetParent) {
   31.48 +				curleft += fobj.offsetLeft
   31.49 +				curtop += fobj.offsetTop
   31.50 +			}
   31.51 +		}
   31.52 +		return [curleft,curtop];
   31.53 +	}
   31.54 +	this.findPosX = function(fobj) {
   31.55 +		if (typeof(fobj) != 'object') { return 0; }
   31.56 +		if (navigator.appName == 'Microsoft Internet Explorer' || navigator.appName == 'Opera' || navigator.appName == 'Netscape') {
   31.57 +			return fobj.offsetLeft;
   31.58 +		}
   31.59 +		if (navigator.userAgent.indexOf('Chrome') > -1) {
   31.60 +			return fobj.offsetLeft;
   31.61 +		}
   31.62 +		var curleft = 0;
   31.63 +		if(fobj.offsetParent)
   31.64 +		while(1) {
   31.65 +			curleft += fobj.offsetLeft;
   31.66 +			if(!fobj.offsetParent)
   31.67 +			break;
   31.68 +			fobj = fobj.offsetParent;
   31.69 +		}
   31.70 +		else if(fobj.x)
   31.71 +		curleft += fobj.x;
   31.72 +		return curleft;
   31.73 +	}
   31.74 +	this.findPosY = function(fobj) {
   31.75 +		if (typeof(fobj) != 'object') { return 0; }
   31.76 +		if (navigator.appName == 'Microsoft Internet Explorer' || navigator.appName == 'Opera' || navigator.appName == 'Netscape') {
   31.77 +			return fobj.offsetTop;
   31.78 +		}
   31.79 +		if (navigator.userAgent.indexOf('Chrome') > -1) {
   31.80 +			return fobj.offsetTop;
   31.81 +		}
   31.82 +		var curtop = 0;
   31.83 +		if(fobj.offsetParent)
   31.84 +		while(1) {
   31.85 +			  curtop += fobj.offsetTop;
   31.86 +			  if(!fobj.offsetParent)
   31.87 +			  break;
   31.88 +			  fobj = fobj.offsetParent;
   31.89 +		}
   31.90 +		else if(fobj.y)
   31.91 +		curtop += fobj.y;
   31.92 +		return curtop;
   31.93 +	}
   31.94 +	
   31.95  }
   31.96  var templates = new templates_req();
   31.97  
   31.98 +//the sub menu part
   31.99  
  31.100 +function xcp_Menu() {
  31.101 +	var bw=document.getElementById&&!document.all;
  31.102 +	var winm;
  31.103 +	var prgm;
  31.104 +	var param;
  31.105 +	var attr;
  31.106 +	var oname;
  31.107 +	var fobj;
  31.108 +	var self = this;
  31.109 +	this.openedForFiles = new Array();
  31.110 +	this.openedForObjects = false;
  31.111 +	this.menuopen = new Array();
  31.112 +	this.menubeforeopen = new Array();
  31.113 +	this.winm = false;
  31.114 +	this.mousedown = function(e) {
  31.115 +		fobj = bw ? e.target : event.srcElement;
  31.116 +		self.checkforopenmenu(e,fobj);
  31.117 +	}
  31.118 +	this.checkforopenmenu = function(e,fobj) {
  31.119 +		if (self.winm && typeof(self.winm) == 'object') {
  31.120 +			if (!fobj.getAttribute('submenu')) {
  31.121 +				var menuid;
  31.122 +				if (menuid = self.getMainMenuId(fobj)) {
  31.123 +					self.dropMenu(menuid.substr(5));
  31.124 +				}
  31.125 +				else if (menuid = self.getMainMenuId(self.winm)) {
  31.126 +					self.dropMenu(menuid.substr(5));
  31.127 +				}
  31.128  
  31.129 +			}
  31.130 +			else {
  31.131 +				var menuid = self.getMainMenuId(fobj);
  31.132 +				if (document.getElementById(menuid)) {
  31.133 +					var menuObj = document.getElementById(menuid);
  31.134 +					var menuObjLeft = templates.findPosX(menuObj);
  31.135 +					if (menuObjLeft > menuObj.offsetWidth) {
  31.136 +						var mx = bw ? e.clientX : event.clientX;
  31.137 +						menuObj.style.left = (menuObjLeft-(menuObj.offsetWidth - 15))+'px';
  31.138 +					}
  31.139 +				}
  31.140 +			}
  31.141 +		}
  31.142 +		if (fobj.getAttribute('menuclick') && self.isEnabled(fobj)) {
  31.143 +			if (fobj.tagName == 'INPUT' && fobj.type == 'checkbox') {
  31.144 +				fobj.checked = !fobj.checked;
  31.145 +			}
  31.146 +			else {
  31.147 +				var obj = self.getMenuId(fobj);
  31.148 +				if (typeof(obj) == 'string' && document.getElementById(obj)) {
  31.149 +					self.changeCheckBox(obj);
  31.150 +				}
  31.151 +			}
  31.152 +			eval(fobj.getAttribute('menuclick'));
  31.153 +		}
  31.154 +	}
  31.155 +	this.openRightMenu = function(winm,e,param) {
  31.156 +		if (!document.getElementById(winm)) { return false; }
  31.157 +		var mx = bw ? e.clientX : event.clientX;
  31.158 +		var my = bw ? e.clientY : event.clientY;
  31.159 +		self.winm = document.getElementById(winm);
  31.160 +		if (!param) {
  31.161 +			self.winm.style.left=mx+"px";
  31.162 +			self.winm.style.top=my+"px";
  31.163 +		}
  31.164 +		self.winm.style.display="block";
  31.165 +		if (!param) {
  31.166 +			if (parseInt(navigator.appVersion)>3) {
  31.167 +				if (navigator.appName=="Netscape") {
  31.168 +					var winW = window.innerWidth;
  31.169 +					var winH = window.innerHeight;
  31.170 +				}
  31.171 +				if (navigator.appName.indexOf("Microsoft")!=-1) {
  31.172 +					var winW = document.body.scrollWidth;
  31.173 +					var winH = document.body.scrollHeight;
  31.174 +				}
  31.175 +			}
  31.176 +			if ((Number(self.winm.offsetLeft) + Number(self.winm.offsetWidth)) >= winW) {
  31.177 +				self.winm.style.left = Number(self.winm.offsetLeft) - Number(self.winm.offsetWidth)+'px';
  31.178 +			}
  31.179 +			if ((Number(self.winm.offsetTop) + Number(self.winm.offsetHeight)) >= winH) {
  31.180 +				self.winm.style.top = Number(winH) - Number(self.winm.offsetHeight)+'px';
  31.181 +			}
  31.182 +		}
  31.183 +	}
  31.184 +
  31.185 +	
  31.186 +	var menuobj;
  31.187 +	var menupos;
  31.188 +	var menuname;
  31.189 +	var menuclick;
  31.190 +	var menuicon;
  31.191 +	this.isMenu = function(param) {
  31.192 +		if (document.getElementById('menu_'+param)) { return true; }
  31.193 +		else { return false; }
  31.194 +	}
  31.195 +	this.getMenu = function(param) {
  31.196 +		if (self.isMenu(param)) { return document.getElementById('menu_'+param); }
  31.197 +		else { return false; }
  31.198 +	}
  31.199 +	this.isInMenu = function(menuobj,param) {
  31.200 +		if (!menuobj) { return false; }
  31.201 +		if (typeof(menuobj) == 'object') {
  31.202 +			var mname = self.getMainMenuId(menuobj);
  31.203 +			if (!mname) { return false; }
  31.204 +			if (document.getElementById(mname+'_'+param)) { return true; }
  31.205 +			else { return false; }
  31.206 +		}
  31.207 +		return false;
  31.208 +	}
  31.209 +	this.getInMenu = function(menuobj,param) {
  31.210 +		if (!menuobj) { return false; }
  31.211 +		if (typeof(menuobj) == 'object') {
  31.212 +			var mname = self.getMainMenuId(menuobj);
  31.213 +			if (!mname) { return false; }
  31.214 +			if ((menuobj.className && menuobj.className == 'sub') || menuobj.tagName == 'DIV') {
  31.215 +				menuobj = menuobj.getElementsByTagName('UL');
  31.216 +				if (menuobj.length) { menuobj = menuobj[0]; }
  31.217 +				else { return false; }
  31.218 +			}
  31.219 +			for (i=0;i<menuobj.childNodes.length;i++) {
  31.220 +				if (menuobj.childNodes[i].id && menuobj.childNodes[i].id == mname+'_'+param) {
  31.221 +					return menuobj.childNodes[i];
  31.222 +				}
  31.223 +			}
  31.224 +			return false;
  31.225 +		}
  31.226 +		else { return false; }
  31.227 +	}
  31.228 +	this.getMainMenuId = function(menuobj) {
  31.229 +		if (!menuobj) { return false; }
  31.230 +		if (menuobj.className && menuobj.className == 'rightmenu') { return menuobj.id; }
  31.231 +		while (menuobj.tagName != undefined && menuobj.tagName != 'HTML' && menuobj.tagName != 'HEAD' && menuobj.tagName != 'BODY' && menuobj.parentNode) {
  31.232 +			menuobj = menuobj.parentNode;
  31.233 +			if (menuobj.className && menuobj.className == 'rightmenu') { return menuobj.id; break; }
  31.234 +		}
  31.235 +		return false;
  31.236 +	}
  31.237 +	this.getMenuId = function(menuobj) {
  31.238 +		if (!menuobj) { return false; }
  31.239 +		if (menuobj.tagName && menuobj.tagName == 'LI') { return menuobj.id; }
  31.240 +		while (menuobj.tagName != undefined && menuobj.tagName != 'HTML' && menuobj.tagName != 'HEAD' && menuobj.tagName != 'BODY' && menuobj.parentNode) {
  31.241 +			menuobj = menuobj.parentNode;
  31.242 +			if (menuobj.tagName && menuobj.tagName == 'LI') { return menuobj.id; break; }
  31.243 +		}
  31.244 +		return false;
  31.245 +	}
  31.246 +	this.createMenu = function(param) {
  31.247 +		if (!self.isMenu(param)) {
  31.248 +			var divmenu = document.createElement('DIV');
  31.249 +			divmenu.className = 'rightmenu';
  31.250 +			divmenu.setAttribute('id','menu_'+param);
  31.251 +			var ulmenu = document.createElement('UL');
  31.252 +			ulmenu.setAttribute('id','ul_'+param);
  31.253 +			divmenu.appendChild(ulmenu);
  31.254 +			document.getElementById('submenus').appendChild(divmenu);
  31.255 +			return ulmenu;
  31.256 +		}
  31.257 +		else { return false; }
  31.258 +	}
  31.259 +	this.dropMenu = function(param) {
  31.260 +		if (self.isMenu(param)) {
  31.261 +			var obj = self.getMenu(param);
  31.262 +			obj.parentNode.removeChild(obj);
  31.263 +			obj = undefined;
  31.264 +			return true;
  31.265 +		}
  31.266 +		else { return false; }
  31.267 +	}
  31.268 +	this.appendInMenu = function(menuobj,param,menuname,menuclick,menuicon,menupos) {
  31.269 +		if (typeof(menuobj) != 'object') { return false; }
  31.270 +		if (self.isInMenu(menuobj,param)) { return true; }
  31.271 +		if ((menuobj.className && menuobj.className == 'sub') || menuobj.tagName == 'DIV') {
  31.272 +			menuobj = menuobj.getElementsByTagName('UL');
  31.273 +			if (menuobj.length) { menuobj = menuobj[0]; }
  31.274 +			else { return false; }
  31.275 +		}
  31.276 +		var mname = self.getMainMenuId(menuobj);
  31.277 +		if (!mname) { return false; }
  31.278 +		var newmenu = document.createElement('li');
  31.279 +		newmenu.setAttribute('id',mname+'_'+param);
  31.280 +		newmenu.setAttribute('main','yes');
  31.281 +		if (menuclick) { newmenu.setAttribute('menuclick',menuclick); }
  31.282 +		var mico = document.createElement('span');
  31.283 +		mico.className = 'menu-ico';
  31.284 +		if (menuicon) {
  31.285 +			if (menuicon != 'checkbox' && menuicon != 'null') {
  31.286 +				var icoimg = document.createElement('IMG');
  31.287 +				icoimg.setAttribute('src',menuicon);
  31.288 +				icoimg.setAttribute('border','0');
  31.289 +				var ailink = document.createElement('A');
  31.290 +				ailink.style.cursor = 'pointer';
  31.291 +				ailink.setAttribute('id',mname+'_'+param);
  31.292 +				ailink.className = 'right-menu-'+param;
  31.293 +				if (menuclick) { mico.setAttribute('menuclick',menuclick); icoimg.setAttribute('menuclick',menuclick); ailink.setAttribute('menuclick',menuclick); }
  31.294 +				ailink.appendChild(icoimg);
  31.295 +				mico.appendChild(ailink);
  31.296 +			}
  31.297 +			else {
  31.298 +				if (menuicon == 'checkbox') {
  31.299 +					var icoimg = document.createElement('INPUT');
  31.300 +					icoimg.setAttribute('type',menuicon);
  31.301 +					icoimg.checked = true;
  31.302 +					icoimg.setAttribute('classname',menuicon);
  31.303 +					icoimg.setAttribute('id','checkbox_'+mname+'_'+param);
  31.304 +					if (menuclick) { mico.setAttribute('menuclick',menuclick); icoimg.setAttribute('menuclick',menuclick); }
  31.305 +					mico.appendChild(icoimg);
  31.306 +				}
  31.307 +				if (menuicon == 'null') {
  31.308 +					mico.innerHTML = '&nbsp';
  31.309 +				}
  31.310 +			}
  31.311 +		}
  31.312 +		newmenu.appendChild(mico);
  31.313 +		var alink = document.createElement('A');
  31.314 +		if (menuclick) { alink.setAttribute('menuclick',menuclick); }
  31.315 +		alink.style.cursor = 'pointer';
  31.316 +		alink.setAttribute('id',mname+'_'+param);
  31.317 +		alink.className = 'right-menu-'+param;
  31.318 +		alink.innerHTML = menuname;
  31.319 +		newmenu.appendChild(alink);
  31.320 +		if (menupos && menupos <= menuobj.childNodes.length) {
  31.321 +			menuobj.insertBefore(newmenu,menuobj.childNodes[menupos - 1]);
  31.322 +		}
  31.323 +		else { menuobj.appendChild(newmenu); }
  31.324 +		return newmenu;
  31.325 +	}
  31.326 +
  31.327 +	this.appendSubInMenu = function(menuobj,param,menuname,menuicon,menupos) {
  31.328 +		if (typeof(menuobj) != 'object') { return false; }
  31.329 +		if (self.isInMenu(menuobj,param)) { return true; }
  31.330 +		if ((menuobj.className && menuobj.className == 'sub') || menuobj.tagName == 'DIV') {
  31.331 +			menuobj = menuobj.getElementsByTagName('UL');
  31.332 +			if (menuobj.length) { menuobj = menuobj[0]; }
  31.333 +			else { return false; }
  31.334 +		}
  31.335 +		var mname = self.getMainMenuId(menuobj);
  31.336 +		if (!mname) { return false; }
  31.337 +		var newmenu = document.createElement('li');
  31.338 +		newmenu.setAttribute('id',mname+'_'+param);
  31.339 +		newmenu.setAttribute('main','yes');
  31.340 +		newmenu.className = 'sub';
  31.341 +		var mico = document.createElement('span');
  31.342 +		mico.className = 'menu-ico-sub';
  31.343 +		if (menuicon) {
  31.344 +			if (menuicon == 'null') {
  31.345 +				mico.innerHTML = '&nbsp';
  31.346 +			}
  31.347 +			else {
  31.348 +				var icoimg = document.createElement('IMG');
  31.349 +				icoimg.setAttribute('src',menuicon);
  31.350 +				icoimg.setAttribute('border','0');
  31.351 +				icoimg.setAttribute('submenu','yes');
  31.352 +				mico.appendChild(icoimg);
  31.353 +			}
  31.354 +		}
  31.355 +		mico.setAttribute('submenu','yes');
  31.356 +		newmenu.appendChild(mico);
  31.357 +
  31.358 +		var alink = document.createElement('A');
  31.359 +		alink.style.cursor = 'pointer';
  31.360 +		alink.setAttribute('submenu','yes');
  31.361 +		alink.innerHTML = menuname;
  31.362 +		newmenu.appendChild(alink);
  31.363 +		var subul = document.createElement('UL');
  31.364 +		newmenu.appendChild(subul);
  31.365 +		newmenu.setAttribute('submenu','yes');
  31.366 +		if (menupos && menupos <= menuobj.childNodes.length) {
  31.367 +			menuobj.insertBefore(newmenu,menuobj.childNodes[menupos - 1]);
  31.368 +		}
  31.369 +		else { menuobj.appendChild(newmenu); }
  31.370 +		return subul;
  31.371 +	}
  31.372 +	this.dropInMenu = function(menuobj,param) {
  31.373 +		if (typeof(menuobj) != 'object') { return false; }
  31.374 +		if (!self.isInMenu(menuobj,param)) { return true; }
  31.375 +		if ((menuobj.className && menuobj.className == 'sub') || menuobj.tagName == 'DIV') {
  31.376 +			menuobj = menuobj.getElementsByTagName('UL');
  31.377 +			if (menuobj.length) { menuobj = menuobj[0]; }
  31.378 +			else { return false; }
  31.379 +		}
  31.380 +		var mname = self.getMainMenuId(menuobj);
  31.381 +		if (!mname) { return false; }
  31.382 +		for (i = 0;i<menuobj.childNodes.length;i++) {
  31.383 +			if (menuobj.childNodes[i].tagName == 'LI' && menuobj.childNodes[i].id == mname+'_'+param) {
  31.384 +				menuobj.removeChild(menuobj.childNodes[i]);
  31.385 +				return true;
  31.386 +				break;
  31.387 +			}
  31.388 +		}
  31.389 +		return false;
  31.390 +	}
  31.391 +	this.isEnabled = function(menuobj) {
  31.392 +		if (typeof(menuobj) == 'object' && menuobj.getAttribute('menuclick')) {
  31.393 +			while(!menuobj.getAttribute('main')) {
  31.394 +				menuobj = menuobj.parentNode;
  31.395 +			}
  31.396 +			if (menuobj.getAttribute('disabled')) { return false; }
  31.397 +			return true;
  31.398 +		}
  31.399 +		return false;
  31.400 +	}
  31.401 +	this.enableMenu = function(menuobj) {
  31.402 +		if (typeof(menuobj) == 'object') {
  31.403 +			var elms = menuobj.getElementsByTagName('A');
  31.404 +			if (elms.length) {
  31.405 +				for (var i=0;i<elms.length;i++) {
  31.406 +					elms[i].style.color = "#000000";
  31.407 +				}
  31.408 +			}
  31.409 +			menuobj.style.color="#000000";
  31.410 +			if (menuobj.getAttribute('disabled')) {
  31.411 +				menuobj.removeAttribute('disabled');
  31.412 +			}
  31.413 +		}
  31.414 +	}
  31.415 +	this.changeCheckBox = function(param,attr) {
  31.416 +		if (typeof(param) != 'string' || !document.getElementById(param)) { return false; }
  31.417 +		var chb = self.getCheckBox(param);
  31.418 +		if (!chb) { return false; }
  31.419 +		if (typeof(attr) == 'undefined') {
  31.420 +			chb.checked = !chb.checked;
  31.421 +		}
  31.422 +		else { chb.checked = attr; }
  31.423 +	}
  31.424 +	this.getCheckBox = function(param) {
  31.425 +		if (typeof(param) != 'string' || !document.getElementById(param)) { return false; }
  31.426 +		if (document.getElementById('checkbox_'+param)) {
  31.427 +			return document.getElementById('checkbox_'+param);
  31.428 +		}
  31.429 +	}
  31.430 +	this.disableMenu = function(menuobj) {
  31.431 +		if (typeof(menuobj) == 'object') {
  31.432 +			var elms = menuobj.getElementsByTagName('A');
  31.433 +			if (elms.length) {
  31.434 +				for (var i=0;i<elms.length;i++) {
  31.435 +					elms[i].style.color = "#b1b1b1";
  31.436 +				}
  31.437 +			}
  31.438 +			menuobj.style.color="#b1b1b1";
  31.439 +			menuobj.setAttribute('disabled','yes');
  31.440 +		}
  31.441 +	}
  31.442 +	
  31.443 +}
  31.444 +var xcp_menu = new xcp_Menu();
  31.445 +
  31.446 +//Events
  31.447 +document.onmousedown = xcp_menu.mousedown;
  31.448 +
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/interface/templates/cloud_pool.css	Tue Jul 13 01:15:04 2010 +0300
    32.3 @@ -0,0 +1,170 @@
    32.4 +.vm_list_box
    32.5 +{
    32.6 +margin-left: 30px;
    32.7 +clear:both;
    32.8 +width: 940px;
    32.9 +background-color:#eef6f7;
   32.10 +border: 1px solid #89b1c1;
   32.11 +padding: 5px;
   32.12 +behavior: url("/interface/border-radius.htc");
   32.13 +-moz-border-radius: 4px;
   32.14 +-webkit-border-radius: 4px;
   32.15 +border-radius: 4px;
   32.16 +}
   32.17 +
   32.18 +.vm_list_box  .label
   32.19 +{
   32.20 +font-family: Arial,Helvetica,sans-serif;
   32.21 +font-weight: bold;
   32.22 +font-size: 1.5em;
   32.23 +text-align: left;
   32.24 +color: #444444;
   32.25 +
   32.26 +}
   32.27 +
   32.28 +.vm_list_box .line
   32.29 +{
   32.30 +border-top: 1px solid #89b1c1;
   32.31 +margin-top: 3px;
   32.32 +margin-bottom: 3px;
   32.33 +width: 100%;
   32.34 +}
   32.35 +
   32.36 +.vm_list_box .pool_server
   32.37 +{
   32.38 +margin-top: 4px;
   32.39 +width:100%;
   32.40 +border-collapse: collapse;
   32.41 +}
   32.42 +
   32.43 +/* params for each host */
   32.44 +
   32.45 +.vm_list_box .pool_server .pool_server_tr
   32.46 +{
   32.47 +height: 24px;
   32.48 +}
   32.49 +
   32.50 +.vm_list_box .pool_server .pool_server_tr:hover
   32.51 +{
   32.52 +background-color: #e9fcfe;
   32.53 +cursor: pointer;
   32.54 +}
   32.55 +
   32.56 +.vm_list_box .pool_server .img
   32.57 +{
   32.58 +width:24px;
   32.59 +padding-left:4px;
   32.60 +}
   32.61 +
   32.62 +.vm_list_box .pool_server .server_name
   32.63 +{
   32.64 +font-family: Arial,Helvetica,sans-serif;
   32.65 +font-weight: bold;
   32.66 +font-size: 1.2em;
   32.67 +text-align: left;
   32.68 +width: 140px;
   32.69 +color: #444444;
   32.70 +}
   32.71 +
   32.72 +.vm_list_box .pool_server .server_description
   32.73 +{
   32.74 +font-size: 8pt;
   32.75 +width: 232px;
   32.76 +}
   32.77 +
   32.78 +.vm_list_box .pool_server .memory_usage_text
   32.79 +{
   32.80 +font-family: Arial,Helvetica,sans-serif;
   32.81 +font-weight: bold;
   32.82 +font-size: 0.8em;
   32.83 +text-align: left;
   32.84 +padding-right: 4px;
   32.85 +padding-left: 4px;
   32.86 +color: #444444;
   32.87 +float:left;
   32.88 +clear:none;
   32.89 +}
   32.90 +
   32.91 +.vm_list_box .pool_server .memory_usage
   32.92 +{
   32.93 +width:320px;
   32.94 +}
   32.95 +
   32.96 +.vm_list_box .pool_server .cpu_usage
   32.97 +{
   32.98 +width:220px;
   32.99 +}
  32.100 +
  32.101 +/* params for each VM */
  32.102 +
  32.103 +.vm_list_box .pool_server .vm_row
  32.104 +{
  32.105 +height: 20px;
  32.106 +}
  32.107 +
  32.108 +.vm_list_box .pool_server .vm_row:hover
  32.109 +{
  32.110 +background-color: #e9fcfe;
  32.111 +cursor: pointer;
  32.112 +}
  32.113 +
  32.114 +.vm_list_box .pool_server .vm_row_status
  32.115 +{
  32.116 +width: 28px;
  32.117 +}
  32.118 +
  32.119 +.vm_list_box .pool_server .vm_row_name
  32.120 +{
  32.121 +font-family: Arial,Helvetica,sans-serif;
  32.122 +font-weight: bold;
  32.123 +font-size: 1em;
  32.124 +text-align: left;
  32.125 +width: 137px;
  32.126 +}
  32.127 +
  32.128 +.vm_list_box .pool_server .vm_row_description
  32.129 +{
  32.130 +font-size: 8pt;
  32.131 +width: 234px;
  32.132 +}
  32.133 +
  32.134 +.vm_list_box .pool_server .vm_row_memory
  32.135 +{
  32.136 +width:320px;
  32.137 +}
  32.138 +
  32.139 +.vm_list_box .pool_server .vm_row_cpus
  32.140 +{
  32.141 +font-family: Arial,Helvetica,sans-serif;
  32.142 +font-weight: bold;
  32.143 +font-size: 0.8em;
  32.144 +text-align: left;
  32.145 +color: #444444;
  32.146 +}
  32.147 +
  32.148 +.vm_list_box .pool_server .cpus_count
  32.149 +{
  32.150 +width: 84px;
  32.151 +}
  32.152 +
  32.153 +.vm_list_box .pool_server .cpus_weight
  32.154 +{
  32.155 +width: 76px;
  32.156 +}
  32.157 +
  32.158 +.vm_list_box .pool_server .cpus_cap
  32.159 +{
  32.160 +width: 60px;
  32.161 +}
  32.162 +
  32.163 +
  32.164 +#Bar
  32.165 +{
  32.166 +	width: 101px; height: 10px;
  32.167 +	text-align: center;
  32.168 +	background: url(/interface/img/meter.gif) repeat-x bottom left;
  32.169 +	margin-left: 3px;
  32.170 +	margin-right: 3px;
  32.171 +	margin-top: 3px;
  32.172 +	float: left;
  32.173 +}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/interface/templates/cloud_pool.html	Tue Jul 13 01:15:04 2010 +0300
    33.3 @@ -0,0 +1,14 @@
    33.4 +<div class="vm_list_box">
    33.5 +
    33.6 +<div class="label"><img src="/interface/img/minus_big.png" id="vm_show_hide" style="position:relative;padding-left:3px;padding-right:3px;top:-3px;cursor:pointer;" onClick="cp_vm_box.show_hide();" /> Virtual Machines List</div>
    33.7 +
    33.8 +<hr class="line" />
    33.9 +
   33.10 +<div style="clear:both;" id="vm_box_content">
   33.11 +	<table class="pool_server" id="pool_server" >
   33.12 +		
   33.13 +	</table>
   33.14 +
   33.15 +</div>
   33.16 +
   33.17 +</div>
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/interface/templates/cloud_pool.html.backup	Tue Jul 13 01:15:04 2010 +0300
    34.3 @@ -0,0 +1,87 @@
    34.4 +<div class="vm_list_box">
    34.5 +
    34.6 +<div class="label"><img src="img/minus_big.png" style="position:relative;padding-left:3px;padding-right:3px;top:-3px;cursor:pointer;" /> Virtual Machines List</div>
    34.7 +
    34.8 +<hr class="line">
    34.9 +
   34.10 +<div style="clear:both;">
   34.11 +	<table class="pool_server" >
   34.12 +		<tr id="server_1" class="pool_server_tr">
   34.13 +		<td class="img" ><img src="img/server.png" /></td>
   34.14 +		<td class="server_name">server_name</td>
   34.15 +		<td class="server_description"> Some description for the server. </td>
   34.16 +		<td class="memory_usage"><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 50px;" /></div></div><div class="memory_usage_text"> 5192M / 10280M</div></td>
   34.17 +		<td class="cpu_usage"><div class="memory_usage_text">CPU Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 30px;" /></div></div><div class="memory_usage_text"> 30%</div></td>
   34.18 +		</tr>
   34.19 +		<tr id="server_1_vms">
   34.20 +			<td colspan="5">
   34.21 +				<table width="100%">
   34.22 +				<tr class="vm_row">
   34.23 +				 <td class="vm_row_status" ><img src="img/running.png" style="position:relative;padding-left:3px;padding-right:3px;" /></td>
   34.24 +				 <td class="vm_row_name" >xcpweb-server</td>
   34.25 +				 <td class="vm_row_description" >DDK virtual machine</td>
   34.26 +				 <td class="vm_row_memory" ><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 10px;" /></div></div><div class="memory_usage_text"> 512M / 10280M</div></td>
   34.27 +				 <td class="vm_row_cpus cpus_count" >CPU Count: 1</td>
   34.28 +				 <td class="vm_row_cpus cpus_weight" >Weight: 256</td>
   34.29 +				 <td class="vm_row_cpus cpus_cap" >Cap: 95</td>
   34.30 +				</tr>
   34.31 +				<tr class="vm_row">
   34.32 +				 <td class="vm_row_status" ><img src="img/stopped.png" style="position:relative;padding-left:3px;padding-right:3px;" /></td>
   34.33 +				 <td class="vm_row_name" >testvm</td>
   34.34 +				 <td class="vm_row_description" >Debian Lenny Server</td>
   34.35 +				 <td class="vm_row_memory" ><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 10px;" /></div></div><div class="memory_usage_text"> 512M / 10280M</div></td>
   34.36 +				 <td class="vm_row_cpus cpus_count" >CPU Count: 1</td>
   34.37 +				 <td class="vm_row_cpus cpus_weight" >Weight: 256</td>
   34.38 +				 <td class="vm_row_cpus cpus_cap" >Cap: 95</td>
   34.39 +				</tr>
   34.40 +				<tr class="vm_row">
   34.41 +				 <td class="vm_row_status" ><img src="img/running.png" style="position:relative;padding-left:3px;padding-right:3px;" /></td>
   34.42 +				 <td class="vm_row_name" >centos</td>
   34.43 +				 <td class="vm_row_description" >CentOS 5.4 Virtual Machine</td>
   34.44 +				 <td class="vm_row_memory" ><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 20px;" /></div></div><div class="memory_usage_text"> 1024M / 10280M</div></td>
   34.45 +				 <td class="vm_row_cpus cpus_count" >CPU Count: 1</td>
   34.46 +				 <td class="vm_row_cpus cpus_weight" >Weight: 256</td>
   34.47 +				 <td class="vm_row_cpus cpus_cap" >Cap: 95</td>
   34.48 +				</tr>
   34.49 +				</table>
   34.50 +			</td>
   34.51 +		</tr>
   34.52 +		
   34.53 +		<tr id="server_2" class="pool_server_tr">
   34.54 +		<td class="img" ><img src="img/server.png" /></td>
   34.55 +		<td class="server_name">other_server</td>
   34.56 +		<td class="server_description"> Some description for the server. </td>
   34.57 +		<td class="memory_usage"><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 80px;" /></div></div><div class="memory_usage_text"> 8192M / 10280M</div></td>
   34.58 +		<td class="cpu_usage"><div class="memory_usage_text">CPU Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 10px;" /></div></div><div class="memory_usage_text"> 10%</div></td>
   34.59 +		</tr>
   34.60 +		<tr id="server_2_vms">
   34.61 +			<td colspan="5">
   34.62 +				<table width="100%">
   34.63 +				<tr class="vm_row" onClick="cp_submenus.vm('current_prv',event);">
   34.64 +				 <td class="vm_row_status" ><img src="img/running.png" style="position:relative;padding-left:3px;padding-right:3px;" /></td>
   34.65 +				 <td class="vm_row_name" >backup-server</td>
   34.66 +				 <td class="vm_row_description" >DDK virtual machine</td>
   34.67 +				 <td class="vm_row_memory" ><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 10px;" /></div></div><div class="memory_usage_text"> 512M / 10280M</div></td>
   34.68 +				 <td class="vm_row_cpus cpus_count" >CPU Count: 1</td>
   34.69 +				 <td class="vm_row_cpus cpus_weight" >Weight: 256</td>
   34.70 +				 <td class="vm_row_cpus cpus_cap" >Cap: 95</td>
   34.71 +				</tr>
   34.72 +				<tr class="vm_row">
   34.73 +				 <td class="vm_row_status" ><img src="img/stopped.png" style="position:relative;padding-left:3px;padding-right:3px;" /></td>
   34.74 +				 <td class="vm_row_name" >testvm2</td>
   34.75 +				 <td class="vm_row_description" >Debian Lenny Backup Server</td>
   34.76 +				 <td class="vm_row_memory" ><div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(img/bar.png); width: 10px;" /></div></div><div class="memory_usage_text"> 512M / 10280M</div></td>
   34.77 +				 <td class="vm_row_cpus cpus_count" >CPU Count: 1</td>
   34.78 +				 <td class="vm_row_cpus cpus_weight" >Weight: 256</td>
   34.79 +				 <td class="vm_row_cpus cpus_cap" >Cap: 95</td>
   34.80 +				</tr>
   34.81 +				
   34.82 +				</table>
   34.83 +			</td>
   34.84 +		</tr>
   34.85 +		
   34.86 +	</table>
   34.87 +
   34.88 +</div>
   34.89 +
   34.90 +</div>
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/interface/templates/cloud_pool.js	Tue Jul 13 01:15:04 2010 +0300
    35.3 @@ -0,0 +1,257 @@
    35.4 +var param;
    35.5 +
    35.6 +
    35.7 +//Loag menu images
    35.8 +templates.LoadImage('/interface/img/menu_terminal.png');
    35.9 +templates.LoadImage('/interface/img/menu_reboot.png');
   35.10 +templates.LoadImage('/interface/img/menu_stats.png');
   35.11 +templates.LoadImage('/interface/img/menu_shutdown.png');
   35.12 +templates.LoadImage('/interface/img/menu_settings.png');
   35.13 +templates.LoadImage('/interface/img/menu_operations.png');
   35.14 +templates.LoadImage('/interface/img/server.png');
   35.15 +templates.LoadImage('/interface/img/plus_big.png');
   35.16 +
   35.17 +function Cloud_Pool_VM_box()
   35.18 +{
   35.19 +var self = this;
   35.20 +var is_hidden = 0;
   35.21 +
   35.22 +	this.show_hide = function()
   35.23 +	{
   35.24 +	if(is_hidden)
   35.25 +		{
   35.26 +		document.getElementById('vm_show_hide').src='/interface/img/minus_big.png';
   35.27 +		document.getElementById('vm_show_hide').style.top='-3px';
   35.28 +		document.getElementById('vm_box_content').style.display='';
   35.29 +		is_hidden=0;
   35.30 +		}
   35.31 +	else
   35.32 +		{
   35.33 +		document.getElementById('vm_show_hide').src='/interface/img/plus_big.png';
   35.34 +		document.getElementById('vm_show_hide').style.top='3px';
   35.35 +		document.getElementById('vm_box_content').style.display='none';		
   35.36 +		is_hidden=1;
   35.37 +		}
   35.38 +	}
   35.39 +
   35.40 +	this.addHost = function(id,params)
   35.41 +	{
   35.42 +	var x=document.getElementById('pool_server').insertRow(-1);
   35.43 +	
   35.44 +	var pool = document.createElement('table');
   35.45 +	pool.width='100%';
   35.46 +	pool.id='pool_'+id;
   35.47 +	var y=document.getElementById('pool_server').insertRow(-1).insertCell(0);
   35.48 +	y.colSpan=5;
   35.49 +	y.appendChild(pool);
   35.50 +		
   35.51 +	var tempcell;
   35.52 +	x.className="pool_server_tr";
   35.53 +	x.id=id;
   35.54 +	tempcell=x.insertCell(0);
   35.55 +	tempcell.className="img";
   35.56 +	tempcell.innerHTML='<img src="/interface/img/server.png" />';
   35.57 +	
   35.58 +	tempcell=x.insertCell(1);
   35.59 +	tempcell.className="server_name";
   35.60 +	tempcell.innerHTML=params['name_label'];
   35.61 +	
   35.62 +	tempcell=x.insertCell(2);
   35.63 +	tempcell.className="name_description";
   35.64 +	tempcell.innerHTML=params['server_description'];
   35.65 +	
   35.66 +	tempcell=x.insertCell(3);
   35.67 +	tempcell.className="memory_usage";
   35.68 +	tempcell.innerHTML='<div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(/interface/img/bar.png); width: '+((parseInt(params['memory_free'])/parseInt(params['memory_total']))*100)+'px;" /></div></div><div class="memory_usage_text"> '+params['memory_free']+'M / '+params['memory_total']+'M</div>';
   35.69 +	
   35.70 +	tempcell=x.insertCell(4);
   35.71 +	tempcell.className="cpu_usage";
   35.72 +	tempcell.innerHTML='<div class="memory_usage_text">CPU Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(/interface/img/bar.png); width: '+parseInt(params['cpu_usage'])+'px;" /></div></div><div class="memory_usage_text"> '+params['cpu_usage']+'%</div>';
   35.73 +	
   35.74 +	return pool;
   35.75 +	}
   35.76 +	
   35.77 +	this.addVM = function(id,params,host_table)
   35.78 +	{
   35.79 +	var x=host_table.insertRow(-1);
   35.80 +	var tempcell;
   35.81 +	x.className="vm_row";
   35.82 +	x.id=id;
   35.83 +	x.onclick = function(e) {cp_submenus.vm(id,e);}
   35.84 +	tempcell=x.insertCell(0);
   35.85 +	tempcell.className="vm_row_status";
   35.86 +	if(params['power_state']=='Running')tempcell.innerHTML='<img src="/interface/img/running.png" style="position:relative;padding-left:3px;padding-right:3px;" />'; 
   35.87 +	else if(params['power_state']=='Halted')tempcell.innerHTML='<img src="/interface/img/stopped.png" style="position:relative;padding-left:3px;padding-right:3px;" />'; 
   35.88 +	else if(params['power_state']=='Paused')tempcell.innerHTML='<img src="/interface/img/paused.png" style="position:relative;padding-left:3px;padding-right:3px;" />'; 
   35.89 +	else tempcell.innerHTML='<img src="/interface/img/stopped.png" style="position:relative;padding-left:3px;padding-right:3px;" />';
   35.90 +	
   35.91 +	tempcell=x.insertCell(1);
   35.92 +	tempcell.className="vm_row_name";
   35.93 +	tempcell.innerHTML=params['name_label'];
   35.94 +	
   35.95 +	tempcell=x.insertCell(2);
   35.96 +	tempcell.className="vm_row_description";
   35.97 +	tempcell.innerHTML=params['name_description'];
   35.98 +	
   35.99 +	tempcell=x.insertCell(3);
  35.100 +	tempcell.className="vm_row_memory";
  35.101 +	tempcell.innerHTML='<div class="memory_usage_text">Memory Usage : </div><div id="Bar"><div style="float: left; height: 10px; padding: 0; background-image: url(/interface/img/bar.png); width: '+((parseInt(params['memory_total'])/parseInt(params['max_memory']))*100)+'px;" /></div></div><div class="memory_usage_text"> '+params['memory_total']+'M</div>';
  35.102 +	
  35.103 +	tempcell=x.insertCell(4);
  35.104 +	tempcell.className="vm_row_cpus cpus_count";
  35.105 +	tempcell.innerHTML='CPU Count: '+params['vm_cpus_count'];
  35.106 +	
  35.107 +	tempcell=x.insertCell(5);
  35.108 +	tempcell.className="vm_row_cpus cpus_weight";
  35.109 +	tempcell.innerHTML='Weight: '+params['vm_cpus_weight'];
  35.110 +	
  35.111 +	tempcell=x.insertCell(6);
  35.112 +	tempcell.className="vm_row_cpus cpus_cap";
  35.113 +	tempcell.innerHTML='Cap: '+params['vm_cpus_cap'];
  35.114 +	
  35.115 +	return x;
  35.116 +	}
  35.117 +	
  35.118 +	
  35.119 +	this.initBox = function()
  35.120 +	{
  35.121 +	
  35.122 +	
  35.123 +	/* //only for testing purposes
  35.124 +	var vm_pool=new Array();
  35.125 +	vm_pool['quote:some_test_server_id_0']=new Array();
  35.126 +	vm_pool['quote:some_test_server_id_0']['name_label']='server_name';
  35.127 +	vm_pool['quote:some_test_server_id_0']['server_description']=' Some description for the server. ';
  35.128 +	vm_pool['quote:some_test_server_id_0']['actual_memory']='5120';
  35.129 +	vm_pool['quote:some_test_server_id_0']['max_memory']='10240';
  35.130 +	vm_pool['quote:some_test_server_id_0']['cpu_usage']='40';
  35.131 +	
  35.132 +	vm_pool['quote:some_test_server_id_0']['vm_list']=new Array();
  35.133 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']=new Array();
  35.134 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['name_label']='xcpweb-server';
  35.135 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_description']='DDK virtual machine';
  35.136 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['actual_memory']='512';
  35.137 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_state']='running';
  35.138 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['max_memory']=vm_pool['quote:some_test_server_id_0']['max_memory'];
  35.139 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_count']='1';
  35.140 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_weight']='256';
  35.141 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_cap']='95';
  35.142 +	
  35.143 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']=new Array();
  35.144 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['name_label']='testvm';
  35.145 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_description']='Debian Lenny Server';
  35.146 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['actual_memory']='512';
  35.147 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_state']='paused';
  35.148 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['max_memory']=vm_pool['quote:some_test_server_id_0']['max_memory'];
  35.149 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_count']='2';
  35.150 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_weight']='512';
  35.151 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_cap']='150';
  35.152 +	
  35.153 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']=new Array();
  35.154 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['name_label']='centos';
  35.155 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_description']='CentOS 5.4 Virtual Machine';
  35.156 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['actual_memory']='512';
  35.157 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['max_memory']=vm_pool['quote:some_test_server_id_0']['max_memory'];
  35.158 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_cpus_count']='1';
  35.159 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_cpus_weight']='256';
  35.160 +	vm_pool['quote:some_test_server_id_0']['vm_list']['quote:some_test_server_vm_2']['vm_cpus_cap']='95';
  35.161 +	
  35.162 +	
  35.163 +	vm_pool['quote:some_test_server_id_1']=new Array();
  35.164 +	vm_pool['quote:some_test_server_id_1']['server_name']='other_server';
  35.165 +	vm_pool['quote:some_test_server_id_1']['server_description']=' Some description for the server. ';
  35.166 +	vm_pool['quote:some_test_server_id_1']['actual_memory']='2048';
  35.167 +	vm_pool['quote:some_test_server_id_1']['max_memory']='10240';
  35.168 +	vm_pool['quote:some_test_server_id_1']['cpu_usage']='10';
  35.169 +	
  35.170 +	vm_pool['quote:some_test_server_id_1']['vm_list']=new Array();
  35.171 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']=new Array();
  35.172 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['name_label']='backup-server';
  35.173 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_description']='DDK virtual machine';
  35.174 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['actual_memory']='512';
  35.175 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_count']='1';
  35.176 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_weight']='256';
  35.177 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_0']['vm_cpus_cap']='95';
  35.178 +	
  35.179 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']=new Array();
  35.180 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['name_label']='testvm2';
  35.181 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_description']='Debian Backup Server';
  35.182 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['actual_memory']='512';
  35.183 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_count']='2';
  35.184 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_weight']='512';
  35.185 +	vm_pool['quote:some_test_server_id_1']['vm_list']['quote:some_test_server_vm_1']['vm_cpus_cap']='150';
  35.186 +	// TODO: to get the arrays from the xcp server part
  35.187 +	
  35.188 +
  35.189 +	for ( var server_id in vm_pool )
  35.190 +	{
  35.191 +	
  35.192 +	vm_pool[server_id]['table_id']=self.addHost(server_id,vm_pool[server_id]);
  35.193 +    
  35.194 +		for ( var vm_id in vm_pool[server_id]['vm_list'] )
  35.195 +		{
  35.196 +				self.addVM(vm_id,vm_pool[server_id]['vm_list'][vm_id],vm_pool[server_id]['table_id']);
  35.197 +		}
  35.198 +	
  35.199 +	
  35.200 +	}
  35.201 +	*/
  35.202 +	
  35.203 +	
  35.204 +	var vm_pool=xen_get_vm_list_hosts();
  35.205 +	for ( var server_id in vm_pool )
  35.206 +	{
  35.207 +	vm_pool[server_id]['table_id']=self.addHost(server_id,vm_pool[server_id]);
  35.208 +	
  35.209 +		for ( var vm_id in vm_pool[server_id]['resident_VMs'] ) // every vm
  35.210 +		{
  35.211 +		var current_vm=xen_get_vm_list_vm(vm_pool[server_id]['resident_VMs'][vm_id]);
  35.212 +		current_vm['max_memory']=vm_pool[server_id]['memory_total'];
  35.213 +		self.addVM(vm_id,current_vm,vm_pool[server_id]['table_id']);
  35.214 +		}
  35.215 +	
  35.216 +	}
  35.217 +	
  35.218 +	
  35.219 +	}
  35.220 +
  35.221 +}
  35.222 +
  35.223 +var cp_vm_box = new Cloud_Pool_VM_box();
  35.224 +
  35.225 +
  35.226 +function Cloud_Pool_submenus()
  35.227 +{
  35.228 +
  35.229 +this.vm = function(param,e)
  35.230 +	{
  35.231 +	if (xcp_menu.getMenu(param)) { xcp_menu.dropMenu(param); }
  35.232 +	var currentMenu = xcp_menu.createMenu(param);
  35.233 +	if (typeof(currentMenu) == 'object') {
  35.234 +		xcp_menu.appendInMenu(currentMenu,'console','Console',"",'/interface/img/menu_terminal.png');
  35.235 +		var subcurrent = xcp_menu.appendSubInMenu(currentMenu,'oprations','Operations','/interface/img/menu_operations.png');
  35.236 +		if (typeof(subcurrent) == 'object') {
  35.237 +			xcp_menu.appendInMenu(subcurrent,'shutdown','Shutdown',"",'/interface/img/menu_shutdown.png');
  35.238 +			xcp_menu.appendInMenu(subcurrent,'hard_shutdown','Force Shutdown',"",'/interface/img/menu_shutdown.png');
  35.239 +			xcp_menu.appendInMenu(subcurrent,'reboot','Reboot',"",'/interface/img/menu_reboot.png');
  35.240 +			xcp_menu.appendInMenu(subcurrent,'hard_reboot','Force Reboot',"",'/interface/img/menu_reboot.png');
  35.241 +			xcp_menu.appendInMenu(subcurrent,'pause','Pause',"",'/interface/img/menu_pause.png');
  35.242 +		}
  35.243 +		xcp_menu.appendInMenu(currentMenu,'graphics','Statistics',"",'/interface/img/menu_stats.png');
  35.244 +		xcp_menu.appendInMenu(currentMenu,'settings','Settings',"",'/interface/img/menu_settings.png');
  35.245 +		xcp_menu.openRightMenu('menu_'+param,e);
  35.246 +		}
  35.247 +	}
  35.248 +	
  35.249 +this.host = function(param,e)
  35.250 +	{
  35.251 +	}
  35.252 +	
  35.253 +}
  35.254 +
  35.255 +var cp_submenus = new Cloud_Pool_submenus();
  35.256 +
  35.257 +//Load the template
  35.258 +
  35.259 +templates.LoadTemplate(interface_path+'/templates/cloud_pool.html','main_content',cp_vm_box.initBox);
  35.260 +
    38.1 --- a/interface/templates/login.css	Tue Jun 15 00:58:46 2010 +0300
    38.2 +++ b/interface/templates/login.css	Tue Jul 13 01:15:04 2010 +0300
    38.3 @@ -1,9 +1,7 @@
    38.4  
    38.5  .login_box
    38.6  {
    38.7 -margin: 0 auto;
    38.8 -margin-top: 70px;
    38.9 -margin-bottom: 70px;
   38.10 +margin: 70px auto 20px auto;
   38.11  text-align: left;
   38.12  clear:both;
   38.13  width: 390px;
   38.14 @@ -63,3 +61,44 @@ cursor: pointer;
   38.15  {
   38.16  background-image: url(../img/login_button_active.png);
   38.17  }
   38.18 +
   38.19 +.login_box_loading
   38.20 +{
   38.21 +margin: 0 auto;
   38.22 +clear:both;
   38.23 +width: 390px;
   38.24 +height: 24px;
   38.25 +background-color:#fff8d6;
   38.26 +border: 1px solid #fbc27f;
   38.27 +behavior: url("/interface/border-radius.htc");
   38.28 +-moz-border-radius: 4px;
   38.29 +-webkit-border-radius: 4px;
   38.30 +border-radius: 4px;
   38.31 +font-family: Arial;
   38.32 +font-size: 13px;
   38.33 +font-weight: bold;
   38.34 +text-align: center;
   38.35 +padding-top: 4px;
   38.36 +}
   38.37 +
   38.38 +.login_box_error
   38.39 +{
   38.40 +margin: 0 auto;
   38.41 +clear:both;
   38.42 +width: 390px;
   38.43 +height: 24px;
   38.44 +background-color:#ffd8d6;
   38.45 +border: 1px solid #fb7f7f;
   38.46 +behavior: url("/interface/border-radius.htc");
   38.47 +-moz-border-radius: 4px;
   38.48 +-webkit-border-radius: 4px;
   38.49 +border-radius: 4px;
   38.50 +font-family: Arial;
   38.51 +font-size: 13px;
   38.52 +font-weight: bold;
   38.53 +text-align: center;
   38.54 +padding-top: 6px;
   38.55 +}
   38.56 +
   38.57 +
   38.58 +
    39.1 --- a/interface/templates/login.html	Tue Jun 15 00:58:46 2010 +0300
    39.2 +++ b/interface/templates/login.html	Tue Jul 13 01:15:04 2010 +0300
    39.3 @@ -10,6 +10,14 @@
    39.4  <tr height="54"><td>&nbsp;</td><td align="center"><div class="login_button" onClick="login.try_login();"></div></td></tr>
    39.5  </table>
    39.6  </form>
    39.7 +</div>
    39.8  
    39.9  </div>
   39.10 +
   39.11 +<div class="login_box_loading" id="loading_box" style="display:none;">
   39.12 +<img src="/interface/img/loading.gif" style="position:relative;top:3px;"> Loading... Please wait.
   39.13  </div>
   39.14 +
   39.15 +<div class="login_box_error" id="error_box" style="display:none;">
   39.16 +Wrong username or password.
   39.17 +</div>
   39.18 \ No newline at end of file
    40.1 --- a/interface/templates/login.js	Tue Jun 15 00:58:46 2010 +0300
    40.2 +++ b/interface/templates/login.js	Tue Jul 13 01:15:04 2010 +0300
    40.3 @@ -1,24 +1,39 @@
    40.4 +templates.LoadImage('/interface/img/login_button_active.png');
    40.5 +templates.LoadImage('/interface/img/loading.gif');
    40.6 +
    40.7  function login_req()
    40.8  {
    40.9 +var username='';
   40.10 +var password='';
   40.11  
   40.12  this.try_login = function()
   40.13  	{
   40.14 -	xen_init(document.getElementById('login_username').value,document.getElementById('login_password').value,this.callback,this.callback_error);
   40.15 +	var priv_username=document.getElementById('login_username').value;
   40.16 +	var priv_password=document.getElementById('login_password').value;
   40.17 +	if(priv_username==username && priv_password==password)return;
   40.18 +	username=priv_username;
   40.19 +	password=priv_password;
   40.20 +	document.getElementById('error_box').style.display='none';
   40.21 +	document.getElementById('loading_box').style.display='';
   40.22 +	xen_init(priv_username,priv_password,this.callback,this.callback_error);
   40.23  	return ;
   40.24  	}
   40.25  	
   40.26  this.callback = function()
   40.27  	{
   40.28 +	templates.LoadJS(interface_path+'/templates/main.js');
   40.29  	templates.LoadTemplate(interface_path+'/templates/main.html','content');
   40.30  	return ;
   40.31  	}
   40.32  
   40.33  this.callback_error = function(raw,xmldoc,param_pass)
   40.34  	{
   40.35 -	alert('error');
   40.36 +	document.getElementById('loading_box').style.display='none';
   40.37 +	document.getElementById('error_box').style.display='';
   40.38  	return ;
   40.39  	}	
   40.40  
   40.41  }
   40.42  
   40.43 -var login = new login_req();
   40.44 \ No newline at end of file
   40.45 +var login = new login_req();
   40.46 +
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/interface/templates/main.css	Tue Jul 13 01:15:04 2010 +0300
    41.3 @@ -0,0 +1,65 @@
    41.4 +.header_menu 
    41.5 +{
    41.6 +padding-left: 30px;
    41.7 +text-align: left;
    41.8 +clear:both;
    41.9 +height: 66px;
   41.10 +}
   41.11 +
   41.12 +.header_menu .cloud_pool_button
   41.13 +{
   41.14 +width: 210px;
   41.15 +height: 50px;
   41.16 +background-image: url(/interface/img/cloud_pool_button.png);
   41.17 +display: block;
   41.18 +cursor: pointer;
   41.19 +margin-right: 30px;
   41.20 +float: left;
   41.21 +clear: none;
   41.22 +}
   41.23 +
   41.24 +.header_menu .cloud_pool_button:hover
   41.25 +{
   41.26 +background-image: url(/interface/img/cloud_pool_button_active.png) !important;
   41.27 +}
   41.28 +
   41.29 +.header_menu .create_new_button
   41.30 +{
   41.31 +width: 210px;
   41.32 +height: 50px;
   41.33 +background-image: url(/interface/img/create_new_button.png);
   41.34 +display: block;
   41.35 +cursor: pointer;
   41.36 +margin-right: 30px;
   41.37 +float: left;
   41.38 +clear: none;
   41.39 +}
   41.40 +
   41.41 +.header_menu .create_new_button:hover
   41.42 +{
   41.43 +background-image: url(/interface/img/create_new_button_active.png) !important;
   41.44 +}
   41.45 +
   41.46 +.header_menu .settings_button
   41.47 +{
   41.48 +width: 210px;
   41.49 +height: 50px;
   41.50 +background-image: url(/interface/img/settings_button.png);
   41.51 +display: block;
   41.52 +cursor: pointer;
   41.53 +margin-right: 30px;
   41.54 +float: left;
   41.55 +clear: none;
   41.56 +}
   41.57 +
   41.58 +.header_menu .settings_button:hover
   41.59 +{
   41.60 +background-image: url(/interface/img/settings_button_active.png) !important;
   41.61 +}
   41.62 +
   41.63 +.main_content
   41.64 +{
   41.65 +float:left;
   41.66 +clear:both;
   41.67 +}
   41.68 +
    42.1 --- a/interface/templates/main.html	Tue Jun 15 00:58:46 2010 +0300
    42.2 +++ b/interface/templates/main.html	Tue Jul 13 01:15:04 2010 +0300
    42.3 @@ -1,2 +1,8 @@
    42.4 -Logged !!!
    42.5 -The main template is loaded... now is time for the real content
    42.6 \ No newline at end of file
    42.7 +<div class="header_menu">
    42.8 +<div class="cloud_pool_button" id="cloud_pool_button" onClick="main_buttons.cloud_pool();"></div>
    42.9 +<div class="create_new_button" id="create_new_button" onClick="main_buttons.create_new();"></div>
   42.10 +<div class="settings_button" id="settings_button" onClick="main_buttons.settings();"></div>
   42.11 +</div>
   42.12 +
   42.13 +<div class="main_content" id="main_content">
   42.14 +</div>
   42.15 \ No newline at end of file
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/interface/templates/main.js	Tue Jul 13 01:15:04 2010 +0300
    43.3 @@ -0,0 +1,47 @@
    43.4 +templates.LoadImage('/interface/img/cloud_pool_button_active.png');
    43.5 +templates.LoadImage('/interface/img/create_new_button_active.png');
    43.6 +templates.LoadImage('/interface/img/settings_button_active.png');
    43.7 +
    43.8 +function main_buttons_req()
    43.9 +{
   43.10 +var img_path ='/interface/img/'
   43.11 +var buttons = new Array('cloud_pool_button','create_new_button','settings_button');
   43.12 +
   43.13 +var make_active = function(button_id)
   43.14 +	{
   43.15 +	var i;
   43.16 +	
   43.17 +	for (i in buttons)
   43.18 +		{
   43.19 +		document.getElementById(buttons[i]).style.backgroundImage = "url("+img_path+buttons[i]+".png)";
   43.20 +		}
   43.21 +	document.getElementById(button_id).style.backgroundImage = "url("+img_path+button_id+"_active.png)";
   43.22 +	}
   43.23 +
   43.24 +this.cloud_pool = function()
   43.25 +	{
   43.26 +	make_active('cloud_pool_button');
   43.27 +	templates.LoadJS(interface_path+'/templates/cloud_pool.js');
   43.28 +	return ;
   43.29 +	}
   43.30 +	
   43.31 +this.create_new = function()
   43.32 +	{
   43.33 +	make_active('create_new_button');
   43.34 +	templates.LoadJS(interface_path+'/templates/create_new.js');
   43.35 +	templates.LoadTemplate(interface_path+'/templates/create_new.html','main_content');
   43.36 +	return ;
   43.37 +	}
   43.38 +
   43.39 +this.settings = function()
   43.40 +	{
   43.41 +	make_active('settings_button');
   43.42 +	templates.LoadJS(interface_path+'/templates/settings.js');
   43.43 +	templates.LoadTemplate(interface_path+'/templates/settings.html','main_content');
   43.44 +	return ;
   43.45 +	}
   43.46 +
   43.47 +}
   43.48 +var main_buttons = new main_buttons_req();
   43.49 +
   43.50 +templates.LoadTemplate(interface_path+'/templates/main.html','content',main_buttons.cloud_pool);
    46.1 --- a/interface/xcp.css	Tue Jun 15 00:58:46 2010 +0300
    46.2 +++ b/interface/xcp.css	Tue Jul 13 01:15:04 2010 +0300
    46.3 @@ -49,4 +49,132 @@ float:left;
    46.4  width:100%;
    46.5  float:left;
    46.6  clear:both;
    46.7 -}
    46.8 \ No newline at end of file
    46.9 +}
   46.10 +
   46.11 +
   46.12 +/* the submenus */
   46.13 +
   46.14 +.rightmenu 
   46.15 +{
   46.16 +	margin: 0px;
   46.17 +	padding: 0px;
   46.18 +	background-color: #f2f2f2;
   46.19 +	font-size: 11px;
   46.20 +	width: 160px;
   46.21 +	font-family: Arial, Helvetica, sans-serif;
   46.22 +	border: 1px solid #CCCCCC;
   46.23 +	position: fixed;
   46.24 +	_position:absolute;
   46.25 +	z-index: 30!important;
   46.26 +	z-index:30;
   46.27 +	left: 0px;
   46.28 +	top: 0px;
   46.29 +	display: none;
   46.30 +}
   46.31 +.rightmenu li.sub 
   46.32 +{
   46.33 +	background-color: #f2f2f2;
   46.34 +	background-image: url(img/ico-arrow-right.png);
   46.35 +	background-repeat: no-repeat;
   46.36 +	background-position: 145px center;
   46.37 +} 
   46.38 +
   46.39 +.rightmenu ul 
   46.40 +{
   46.41 +	width:160px;
   46.42 +	height:auto;
   46.43 +	overflow:visible;
   46.44 +	padding:0;
   46.45 +	margin:0;
   46.46 +}
   46.47 +.rightmenu ul li 
   46.48 +{
   46.49 +	list-style-image:none;
   46.50 +	list-style:none;
   46.51 +	list-style-type:none;
   46.52 +	width:160px;
   46.53 +	height:21px;
   46.54 +	text-align:left;
   46.55 +	margin:0;
   46.56 +	padding:0;
   46.57 +	margin-top:-1px;
   46.58 +	clear:both;
   46.59 +	overflow:visible;
   46.60 +	position:relative;
   46.61 +	padding-top:5px;
   46.62 +	border-top: 1px solid #CCCCCC;
   46.63 +	cursor:pointer;
   46.64 +}
   46.65 +
   46.66 +.rightmenu ul li a 
   46.67 +{
   46.68 +	text-decoration:none;
   46.69 +	color:#000000;
   46.70 +}
   46.71 +
   46.72 +.rightmenu ul li:hover 
   46.73 +{
   46.74 +	color:#000000;
   46.75 +	background-color: #9dd4fc;
   46.76 +}
   46.77 +
   46.78 +.rightmenu ul li ul 
   46.79 +{
   46.80 +	position:absolute;
   46.81 +	top:-30px;
   46.82 +	left:145px;
   46.83 +	padding:30px 50px 40px 0px;
   46.84 +	display:none;
   46.85 +	z-index:30;
   46.86 +}
   46.87 +
   46.88 +.rightmenu ul li ul li 
   46.89 +{
   46.90 +	border-top-width: 1px;
   46.91 +	border-right-width: 2px;
   46.92 +	border-bottom-width: 2px;
   46.93 +	border-left-width: 1px;
   46.94 +	border-top-style: solid;
   46.95 +	border-right-style: solid;
   46.96 +	border-bottom-style: solid;
   46.97 +	border-left-style: solid;
   46.98 +	border-top-color: #CCCCCC;
   46.99 +	border-right-color: #666666;
  46.100 +	border-bottom-color: #666666;
  46.101 +	border-left-color: #CCCCCC;
  46.102 +	background-color: #f2f2f2;
  46.103 +	margin-top:-2px;
  46.104 +}
  46.105 +
  46.106 +.rightmenu ul li:hover > ul 
  46.107 +{
  46.108 +	display:block;
  46.109 +}
  46.110 +
  46.111 +.menu-ico 
  46.112 +{
  46.113 +	padding:0;
  46.114 +	float: left;
  46.115 +	width: 16px;
  46.116 +	margin-right: 6px;
  46.117 +	padding-right:0;
  46.118 +	padding-left:6px;
  46.119 +	margin-top:-2px;
  46.120 +}
  46.121 +
  46.122 +.menu-ico input 
  46.123 +{
  46.124 +	float:left;
  46.125 +	margin:0;
  46.126 +	margin-top:2px;
  46.127 +}
  46.128 +
  46.129 +.menu-ico-sub 
  46.130 +{
  46.131 +	padding:0;
  46.132 +	float: left;
  46.133 +	width: 16px;
  46.134 +	margin-right: 3px;
  46.135 +	padding-right:3px;
  46.136 +	padding-left:6px;
  46.137 +}
    47.1 --- a/libxen/db_callbacks.js	Tue Jun 15 00:58:46 2010 +0300
    47.2 +++ b/libxen/db_callbacks.js	Tue Jul 13 01:15:04 2010 +0300
    47.3 @@ -1,1 +1,1 @@
    47.4 -function invoke_event(array_name){if(typeof(xen_db_events[array_name])!='undefined'){xen_db_events[array_name]();}if(typeof(xen_db_events['*'])!='undefined'){xen_db_events['*']();}}
var db_callbacks=new Array();

db_callbacks['session.login_with_password']=function(result)
{
xen_db['session_id']=result;
xen_db['is_logged']=1;
xen_db['logged']=1;
return ;
}

db_callbacks['VM.get_all_records']=function(result){xen_db['VM']=result;invoke_event('VM');return;} 
db_callbacks['task.get_all_records']=function(result){xen_db['task']=result;invoke_event('task');return;} 
db_callbacks['VBD.get_all_records']=function(result){xen_db['VBD']=result;invoke_event('VBD');return;} 
db_callbacks['VBD_metrics.get_all_records']=function(result){xen_db['VBD_metrics']=result;invoke_event('VBD_metrics');return;} 
db_callbacks['VDI.get_all_records']=function(result){xen_db['VDI']=result;invoke_event('VDI');return;} 
db_callbacks['network.get_all_records']=function(result){xen_db['network']=result;invoke_event('network');return;} 
db_callbacks['PIF.get_all_records']=function(result){xen_db['PIF']=result;invoke_event('PIF');return;} 
db_callbacks['PIF_metrics.get_all_records']=function(result){xen_db['PIF_metrics']=result;invoke_event('PIF_metrics');return;} 
db_callbacks['PBD.get_all_records']=function(result){xen_db['PBD']=result;invoke_event('PBD');return;} 
db_callbacks['VIF.get_all_records']=function(result){xen_db['VIF']=result;invoke_event('VIF');return;} 
db_callbacks['VIF_metrics.get_all_records']=function(result){xen_db['VIF_metrics']=result;invoke_event('VIF_metrics');return;} 
db_callbacks['VM_guest_metrics.get_all_records']=function(result){xen_db['VM_guest_metrics']=result;invoke_event('VM_guest_metrics');return;} 
db_callbacks['VM_metrics.get_all_records']=function(result){xen_db['VM_metrics']=result;invoke_event('VM_metrics');return;} 
db_callbacks['host_metrics.get_all_records']=function(result){xen_db['host_metrics']=result;invoke_event('host_metrics');return;} 
db_callbacks['host_cpu.get_all_records']=function(result){xen_db['host_cpu']=result;invoke_event('host_cpu');return;} 
db_callbacks['Bond.get_all_records']=function(result){xen_db['Bond']=result;invoke_event('Bond');return;} 
db_callbacks['pool_patch.get_all_records']=function(result){xen_db['pool_patch']=result;invoke_event('pool_patch');return;} 
db_callbacks['host_patch.get_all_records']=function(result){xen_db['host_patch']=result;invoke_event('host_patch');return;} 
db_callbacks['console.get_all_records']=function(result){xen_db['console']=result;invoke_event('console');return;} 
db_callbacks['host.get_all_records']=function(result){xen_db['host']=result;invoke_event('host');return;} 
db_callbacks['pool.get_all_records']=function(result){xen_db['pool']=result;invoke_event('pool');return;} 
db_callbacks['SR.get_all_records']=function(result){xen_db['SR']=result;invoke_event('SR');return;} 
db_callbacks['message.get_all_records']=function(result){xen_db['message']=result;invoke_event('message');return;}

db_callbacks['event.next']=function(result)
{
	for ( var i in result )
	{
		if(result[i].operation=='mod' || result[i].operation=='add')
		{
		if(typeof(xen_db[result[i].class][result[i].ref])!='undefined')
			{
			xen_db[result[i].class][result[i].ref]=result[i].snapshot;
			invoke_event(result[i].class);
			}
		else
			{
			alert("non existing class in xen_db class name:"+result[i].class+" reference:"+result[i].ref);
			}
		}
		if(result[i].operation=='del')
		{
		delete xen_db[result[i].class][result[i].ref];
		invoke_event('del');
		}
	}
	
	return;
}
    47.5 \ No newline at end of file
    47.6 +function invoke_event(array_name){if(typeof(xen_db_events[array_name])!='undefined'){xen_db_events[array_name]();}if(typeof(xen_db_events['*'])!='undefined'){xen_db_events['*']();}}
var db_callbacks=new Array();

db_callbacks['session.login_with_password']=function(result)
{
xen_db['session_id']=result;
xen_db['is_logged']=1;
xen_db['logged']=1;
return ;
}

db_callbacks['VM.get_all_records']=function(result){xen_db['VM']=result;invoke_event('VM');return;} 
db_callbacks['task.get_all_records']=function(result){xen_db['task']=result;invoke_event('task');return;} 
db_callbacks['VBD.get_all_records']=function(result){xen_db['VBD']=result;invoke_event('VBD');return;} 
db_callbacks['VBD_metrics.get_all_records']=function(result){xen_db['VBD_metrics']=result;invoke_event('VBD_metrics');return;} 
db_callbacks['VDI.get_all_records']=function(result){xen_db['VDI']=result;invoke_event('VDI');return;} 
db_callbacks['network.get_all_records']=function(result){xen_db['network']=result;invoke_event('network');return;} 
db_callbacks['PIF.get_all_records']=function(result){xen_db['PIF']=result;invoke_event('PIF');return;} 
db_callbacks['PIF_metrics.get_all_records']=function(result){xen_db['PIF_metrics']=result;invoke_event('PIF_metrics');return;} 
db_callbacks['PBD.get_all_records']=function(result){xen_db['PBD']=result;invoke_event('PBD');return;} 
db_callbacks['VIF.get_all_records']=function(result){xen_db['VIF']=result;invoke_event('VIF');return;} 
db_callbacks['VIF_metrics.get_all_records']=function(result){xen_db['VIF_metrics']=result;invoke_event('VIF_metrics');return;} 
db_callbacks['VM_guest_metrics.get_all_records']=function(result){xen_db['VM_guest_metrics']=result;invoke_event('VM_guest_metrics');return;} 
db_callbacks['VM_metrics.get_all_records']=function(result){xen_db['VM_metrics']=result;invoke_event('VM_metrics');return;} 
db_callbacks['host_metrics.get_all_records']=function(result){xen_db['host_metrics']=result;invoke_event('host_metrics');return;} 
db_callbacks['host_cpu.get_all_records']=function(result){xen_db['host_cpu']=result;invoke_event('host_cpu');return;} 
db_callbacks['Bond.get_all_records']=function(result){xen_db['Bond']=result;invoke_event('Bond');return;} 
db_callbacks['pool_patch.get_all_records']=function(result){xen_db['pool_patch']=result;invoke_event('pool_patch');return;} 
db_callbacks['host_patch.get_all_records']=function(result){xen_db['host_patch']=result;invoke_event('host_patch');return;} 
db_callbacks['console.get_all_records']=function(result){xen_db['console']=result;invoke_event('console');return;} 
db_callbacks['host.get_all_records']=function(result){xen_db['host']=result;invoke_event('host');return;} 
db_callbacks['pool.get_all_records']=function(result){xen_db['pool']=result;invoke_event('pool');return;} 
db_callbacks['SR.get_all_records']=function(result){xen_db['SR']=result;invoke_event('SR');return;} 
db_callbacks['message.get_all_records']=function(result){xen_db['message']=result;invoke_event('message');return;}

db_callbacks['event.next']=function(result)
{
	for ( var i in result )
	{
		if(result[i].operation=='mod' || result[i].operation=='add')
		{
		if(typeof(xen_db[result[i].class][result[i].ref])!='undefined') //TODO: some errors happen when there are no result[i].class, because it may load before xen_db
			{
			xen_db[result[i].class][result[i].ref]=result[i].snapshot;
			invoke_event(result[i].class);
			}
		else
			{
			alert("non existing class in xen_db class name:"+result[i].class+" reference:"+result[i].ref);
			}
		}
		if(result[i].operation=='del')
		{
		delete xen_db[result[i].class][result[i].ref];
		invoke_event('del');
		}
	}
	
	return;
}
    47.7 \ No newline at end of file
    48.1 --- a/libxen/libxen.js	Tue Jun 15 00:58:46 2010 +0300
    48.2 +++ b/libxen/libxen.js	Tue Jul 13 01:15:04 2010 +0300
    48.3 @@ -21,4 +21,64 @@ function xen_register_db_event(db_array,
    48.4  //example 2 xen_register_db_event('*',make_UI_modifications);
    48.5  {
    48.6  xen_db_events[db_array]=function_call;
    48.7 -}
    48.8 \ No newline at end of file
    48.9 +}
   48.10 +
   48.11 +
   48.12 +//for the vm list box
   48.13 +
   48.14 +function xen_get_vm_list_hosts()
   48.15 +{
   48.16 +
   48.17 +var vm_pool=new Array();
   48.18 +
   48.19 + for ( var host_id in xen_db['host'] )
   48.20 + {
   48.21 +	vm_pool[host_id] = new Array();
   48.22 +	vm_pool[host_id]['name_label']=xen_db['host'][host_id]['name_label'];
   48.23 +	vm_pool[host_id]['name_description']=xen_db['host'][host_id]['name_description'];
   48.24 +	
   48.25 +	//to get other things from the metrics 
   48.26 +	//get the cpu_usage
   48.27 +	var cpu_usage=0;
   48.28 +	var cpus=0
   48.29 +		for (var cpu_id in xen_db['host'][host_id]['host_CPUs'])
   48.30 +			{
   48.31 +			cpu_usage=parseInt(cpu_usage)+parseInt(xen_db['host_cpu'][xen_db['host'][host_id]['host_CPUs'][cpu_id]]['utilisation']);
   48.32 +			cpus++;
   48.33 +			}
   48.34 +		cpu_usage=cpu_usage/cpus;
   48.35 +	
   48.36 +	vm_pool[host_id]['cpu_usage']=cpu_usage;
   48.37 +
   48.38 +	vm_pool[host_id]['memory_free']=Math.floor(parseInt(xen_db['host_metrics'][xen_db['host'][host_id]['metrics']]['memory_free']) / (1024*1024));
   48.39 +	vm_pool[host_id]['memory_total']=Math.floor(parseInt(xen_db['host_metrics'][xen_db['host'][host_id]['metrics']]['memory_total']) / (1024*1024));
   48.40 +	
   48.41 +	vm_pool[host_id]['resident_VMs']=new Array();
   48.42 +	for(var id in xen_db['host'][host_id]['resident_VMs'])
   48.43 +	{
   48.44 +	var vm_id=xen_db['host'][host_id]['resident_VMs'][id];
   48.45 +	if(!xen_db['VM'][vm_id]['is_a_snapshot'] && !xen_db['VM'][vm_id]['is_a_template'] && !xen_db['VM'][vm_id]['is_control_domain'])vm_pool[host_id]['resident_VMs'].push(vm_id);
   48.46 +	}
   48.47 +	
   48.48 + }
   48.49 +
   48.50 + return vm_pool;
   48.51 +}
   48.52 +
   48.53 +function xen_get_vm_list_vm(vm_id)
   48.54 +{
   48.55 +var vm_pool = new Array();
   48.56 +	
   48.57 +	vm_pool['name_label']=xen_db['VM'][vm_id]['name_label'];
   48.58 +	vm_pool['name_description']=xen_db['VM'][vm_id]['name_description'];
   48.59 +	if(vm_pool['name_description']=='')vm_pool['name_description']=xen_db['VM_guest_metrics'][xen_db['VM'][vm_id]['guest_metrics']]['os_version']['name'];
   48.60 +	
   48.61 +	vm_pool['memory_total']=Math.floor(parseInt(xen_db['VM'][vm_id]['memory_target']) / (1024*1024));
   48.62 +	vm_pool['power_state']=xen_db['VM'][vm_id]['power_state'];
   48.63 +	vm_pool['vm_cpus_count']=xen_db['VM'][vm_id]['VCPUs_max'];
   48.64 +	vm_pool['vm_cpus_weight']='';// TODO
   48.65 +	vm_pool['vm_cpus_cap']='';// TODO
   48.66 +return vm_pool;
   48.67 +}
   48.68 +
   48.69 +//end of vm list box
   48.70 \ No newline at end of file
    49.1 Binary file xcpweb_screenshot.png has changed