1 |
<?php |
<?php |
2 |
|
|
3 |
|
if (! file_exists("config.php") ) { |
4 |
|
die("Could not find config.php file"); |
5 |
|
} |
6 |
|
|
7 |
require("config.php"); |
require("config.php"); |
8 |
|
|
9 |
function format_memory($size) { |
function format_memory($size) { |
88 |
openConsole(conurl,session,name); |
openConsole(conurl,session,name); |
89 |
}); |
}); |
90 |
|
|
91 |
|
$('.bar').progressbar( ); |
92 |
|
|
93 |
$('#logo').click( function() { |
$('#logo').click( function() { |
94 |
refreshData(); |
refreshData(); |
95 |
}); |
}); |
140 |
$('#dialog-login').dialog({ |
$('#dialog-login').dialog({ |
141 |
modal: true, |
modal: true, |
142 |
height: 210, |
height: 210, |
143 |
width: 325, |
width: 350, |
144 |
buttons: { |
buttons: { |
145 |
Login: loginDialogSubmit |
Login: loginDialogSubmit |
146 |
} |
} |
156 |
password = $('#password').val(); |
password = $('#password').val(); |
157 |
|
|
158 |
$('#login').html("Logged in as <i>" + username + "</i>"); |
$('#login').html("Logged in as <i>" + username + "</i>"); |
159 |
|
refreshData(); |
160 |
} else { |
} else { |
161 |
alert(data); |
alert(data); |
162 |
} |
} |
176 |
cddata = data; |
cddata = data; |
177 |
if (data.ISO != '') { |
if (data.ISO != '') { |
178 |
$('#cdcurrent').html( data.ISO ); |
$('#cdcurrent').html( data.ISO ); |
179 |
|
$(":button:contains('Mount')").prop("disabled", true).addClass("ui-state-disabled"); |
180 |
} else { |
} else { |
181 |
$('#cdcurrent').html('<i>No ISO currently mounted</i>'); |
$('#cdcurrent').html('<i>No ISO currently mounted</i>'); |
182 |
|
$(":button:contains('Eject')").prop("disabled", true).addClass("ui-state-disabled"); |
183 |
} |
} |
184 |
}); |
}); |
185 |
|
|
218 |
$(xml).find('host').each(function() { |
$(xml).find('host').each(function() { |
219 |
var memtotal = $(this).find('memtotal').text(); |
var memtotal = $(this).find('memtotal').text(); |
220 |
var memfree = $(this).find('memfree').text(); |
var memfree = $(this).find('memfree').text(); |
221 |
var cpuavg = $(this).find('cpuavg').text(); |
var cpuavg = $(this).find('cpuavg').text() * 1; // *1 is used to convert the string var to an int |
222 |
|
|
223 |
memtotal = Math.round ( memtotal / (1024*1024) ); |
memtotal = Math.round ( memtotal / (1024*1024) ); |
224 |
memfree = Math.round ( memfree / (1024*1024) ); |
memfree = Math.round ( memfree / (1024*1024) ); |
227 |
|
|
228 |
//alert(memused + ' ' + mem_percentage); |
//alert(memused + ' ' + mem_percentage); |
229 |
|
|
230 |
$('#server_memory_usage').attr('src', 'usagebar.php?usage=' + mem_percentage); |
//$('#server_memory_usage').attr('src', 'usagebar.php?usage=' + mem_percentage); |
231 |
|
$('#server_memory_usage').progressbar( "value", mem_percentage ); |
232 |
$('#server_memory_usage').attr('alt', mem_percentage + '%'); |
$('#server_memory_usage').attr('alt', mem_percentage + '%'); |
233 |
$('#server_memory_usage').attr('title', mem_percentage + '%'); |
$('#server_memory_usage').attr('title', mem_percentage + '%'); |
234 |
$('#server_memory_usage_txt').text( memused + '/' + memtotal + 'MB'); |
$('#server_memory_usage_txt').text( memused + '/' + memtotal + 'MB'); |
235 |
|
|
236 |
|
|
237 |
$('#server_cpu_usage').attr('src', 'usagebar.php?usage=' + cpuavg); |
//$('#server_cpu_usage').attr('src', 'usagebar.php?usage=' + cpuavg); |
238 |
|
$('#server_cpu_usage').progressbar( "value", cpuavg ); |
239 |
$('#server_cpu_usage').attr('alt', cpuavg + '%'); |
$('#server_cpu_usage').attr('alt', cpuavg + '%'); |
240 |
$('#server_cpu_usage').attr('title', cpuavg + '%'); |
$('#server_cpu_usage').attr('title', cpuavg + '%'); |
241 |
$('#server_cpu_usage_txt').text( cpuavg+ '%'); |
$('#server_cpu_usage_txt').text( cpuavg+ '%'); |
281 |
vm.find('.console').data('session', session); |
vm.find('.console').data('session', session); |
282 |
vm.find('.console').data('name', name); |
vm.find('.console').data('name', name); |
283 |
vm.find('.settings').hide(); |
vm.find('.settings').hide(); |
284 |
vm.find('.actionstop').show(); |
if (loggedin) { |
285 |
vm.find('.actionstart').hide(); |
vm.find('.actionstop').show(); |
286 |
|
vm.find('.actionstart').hide(); |
287 |
|
} |
288 |
vm.find('.os').text(' - ' + os); |
vm.find('.os').text(' - ' + os); |
289 |
|
|
290 |
|
cpuavg = cpuavg * 1; |
291 |
vm.find('.cpu_graph').show(); |
vm.find('.cpu_graph').show(); |
292 |
vm.find('.cpu_graph').attr('src', 'usagebar.php?usage=' + cpuavg); |
//vm.find('.cpu_graph').attr('src', 'usagebar.php?usage=' + cpuavg); |
293 |
|
vm.find('.cpu_graph').progressbar( "value", cpuavg ); |
294 |
vm.find('.cpu_graph').attr('title', cpuavg + '%'); |
vm.find('.cpu_graph').attr('title', cpuavg + '%'); |
295 |
|
|
296 |
vm.find('.mem_graph').show(); |
vm.find('.mem_graph').show(); |
297 |
vm.find('.mem_graph').attr('src', 'usagebar.php?usage=' + mempercent); |
//vm.find('.mem_graph').attr('src', 'usagebar.php?usage=' + mempercent); |
298 |
|
vm.find('.mem_graph').progressbar( "value", mempercent ); |
299 |
vm.find('.mem_graph').attr('title', curmem + ' / ' + maxmem + ' MB' ); |
vm.find('.mem_graph').attr('title', curmem + ' / ' + maxmem + ' MB' ); |
300 |
} else { |
} else { |
301 |
if (state == "Halted") { |
if (state == "Halted") { |
308 |
vm.find('.network').hide(); |
vm.find('.network').hide(); |
309 |
vm.find('.console').hide(); |
vm.find('.console').hide(); |
310 |
vm.find('.settings').show(); |
vm.find('.settings').show(); |
311 |
vm.find('.actionstop').hide(); |
if (loggedin) { |
312 |
vm.find('.actionstart').show(); |
vm.find('.actionstop').hide(); |
313 |
|
vm.find('.actionstart').show(); |
314 |
|
} |
315 |
vm.find('.cpu_graph').hide(); |
vm.find('.cpu_graph').hide(); |
316 |
vm.find('.mem_graph').hide(); |
vm.find('.mem_graph').hide(); |
317 |
} |
} |
318 |
|
vm.find('.state').attr('title', state); |
319 |
|
|
320 |
}); |
}); |
321 |
$('#logo').show(); |
$('#logo').show(); |
378 |
if (isLoggedIn() == false) |
if (isLoggedIn() == false) |
379 |
return; |
return; |
380 |
|
|
381 |
var url = "console.php?url=" + url + "&session=" + session + "&key=" + key + "&name=" + name; |
var url = "console.php?url=" + url + "&session=" + session + "&key=" + password + "&name=" + name; |
382 |
|
|
383 |
//window.location = url; |
//window.location = url; |
384 |
//$('#mainwindow').load(url); |
//$('#mainwindow').load(url); |
419 |
margin: 4; |
margin: 4; |
420 |
border: 1px solid #222; |
border: 1px solid #222; |
421 |
} |
} |
422 |
|
|
423 |
|
.ui-progressbar-value { |
424 |
|
background: #61B4F3; |
425 |
|
} |
426 |
|
|
427 |
|
.ui-progressbar { |
428 |
|
border-style:solid; |
429 |
|
border-width:1px; |
430 |
|
border-color: #666666; |
431 |
|
} |
432 |
|
|
433 |
|
.bar { |
434 |
|
width: 102px; |
435 |
|
height: 16px; |
436 |
|
} |
437 |
|
|
438 |
</style> |
</style> |
439 |
</head> |
</head> |
440 |
<body> |
<body> |
452 |
</span> |
</span> |
453 |
</td> |
</td> |
454 |
<td width='150'></td> |
<td width='150'></td> |
455 |
<td width='150' align='right' class='small'><img src='gfx/icon-cpu.png'> |
<td width='150' align='right' class='small'> |
456 |
<img id='server_cpu_usage' src='usagebar.php?usage=12' width='102' height='16' title='static dummy data'><div id='server_cpu_usage_txt'>12%</div></td> |
<div id='server_cpu_usage' class='bar'></div> |
457 |
|
<img src='gfx/icon-cpu.png'> |
458 |
|
<span id='server_cpu_usage_txt'>12%</span> |
459 |
|
</td> |
460 |
|
|
461 |
<td width='150' align='right' class='small'><img src='gfx/icon-memory.png'> |
<td width='150' align='right' class='small'> |
462 |
<img id='server_memory_usage' src='usagebar.php?usage=1' width='102' height='16' title='static dummy data'><div id='server_memory_usage_txt'>0/4 MB</div></td> |
<div id='server_memory_usage' class='bar'></div> |
463 |
|
<img src='gfx/icon-memory.png'> |
464 |
|
<span id='server_memory_usage_txt'>0/4 MB</span> |
465 |
|
</td> |
466 |
<!-- |
<!-- |
467 |
<td width='150' align='right' class='small'><img src='gfx/icon-network.png'> |
<td width='150' align='right' class='small'><img src='gfx/icon-network.png'> |
468 |
<img id='server_net_usage' src='usagebar.php?usage=41' width='102' height='16' title='static dummy data'><div id='server_net_usage_txt'>1%</div></td> |
<img id='server_net_usage' src='usagebar.php?usage=41' width='102' height='16' title='static dummy data'><div id='server_net_usage_txt'>1%</div></td> |
514 |
<td colspan='2' class='small' align='right'> |
<td colspan='2' class='small' align='right'> |
515 |
<span class='network'></span> |
<span class='network'></span> |
516 |
<a href='#' class='cd' uuid='<?php echo $uuid;?>' > |
<a href='#' class='cd' uuid='<?php echo $uuid;?>' > |
517 |
<img src='gfx/icon-cd.png' style='vertical-align: middle;'> |
<img src='gfx/icon-cd.gif' style='vertical-align: middle;'></a> |
|
</a> |
|
518 |
<a href='#' style='display:none;' class='console'> |
<a href='#' style='display:none;' class='console'> |
519 |
<img src='gfx/icon-terminal.png' style='vertical-align: middle;'> |
<img src='gfx/icon-terminal.png' style='vertical-align: middle;'> |
520 |
</a> |
</a> |
521 |
|
|
522 |
<a href='#' style='display:none;' class='settings' uuid='<?php echo $uuid;?>'> |
<a href='#' style='display:none;' class='settings' uuid='<?php echo $uuid;?>'> |
523 |
<img src='gfx/icon-settings16.png' style='vertical-align: middle;'> |
<img src='gfx/icon-settings16.png' style='vertical-align: middle;'> |
524 |
</a> |
</a> |
532 |
<span class="actionstop" style='display:none'> |
<span class="actionstop" style='display:none'> |
533 |
start | |
start | |
534 |
<a href='#' onclick="doAction('shutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >stop</a> | |
<a href='#' onclick="doAction('shutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >stop</a> | |
535 |
<a href='#' onclick="doAction('hardshutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >force shutdown</a> |
<a href='#' onclick="doAction('hardshutdown','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >force shutdown</a> | |
536 |
|
<a href='#' onclick="doAction('hardreboot','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >force reboot</a> |
537 |
</span> |
</span> |
538 |
|
|
539 |
<span class="actionstart"> |
<span class="actionstart" style='display:none'> |
540 |
<a href='#' onclick="doAction('start','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >start</a> | |
<a href='#' onclick="doAction('start','<?php echo $uuid;?>','<?php echo $clean_name;?>')" >start</a> | |
541 |
stop | |
stop | |
542 |
force shutdown |
force shutdown |
545 |
</td> |
</td> |
546 |
|
|
547 |
<td width='100' align='right' class='small' valign='top'> |
<td width='100' align='right' class='small' valign='top'> |
548 |
<img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='cpu_graph'><br> |
<div class='cpu_graph bar'></div> |
549 |
<img src='gfx/icon-cpu.png' style='vertical-align: middle;'> |
<img src='gfx/icon-cpu.png' style='vertical-align: middle;'> |
550 |
<span class='vps_cpu_usage_txt_UID'><?php echo $cpu_count; ?> VCPU</span> |
<span class='vps_cpu_usage_txt_UID'><?php echo $cpu_count; ?> VCPU</span> |
551 |
</td> |
</td> |
552 |
<td width='100' align='right' class='small'> |
<td width='100' align='right' class='small'> |
553 |
<img src='usagebar.php?usage=1' width='102' height='16' title='static dummy data' class='mem_graph'><br> |
<div class='mem_graph bar'></div> |
554 |
<img src='gfx/icon-memory.png' style='vertical-align: middle;'> |
<img src='gfx/icon-memory.png' style='vertical-align: middle;'> |
555 |
<span class='vps_memory_usage_txt_UID'><?php echo format_memory($memory); ?></span> |
<span class='vps_memory_usage_txt_UID'><?php echo format_memory($memory); ?></span> |
556 |
</td> |
</td> |