Title="Add VM"
Tag="clipboard"
Cond="(pgrep('libvirtd')!==false)"
Markdown="false"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
 * Copyright 2015-2020, Derek Macias, Eric Schultz, Jon Panozzo.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<style type="text/css">
.vmheader{padding:10px;font-size:1.4rem;text-align:left;color:#888}
.vmtemplate{display:inline-block;width:80px;height:90px;margin-bottom:15px;margin-left:10px;text-align:center;vertical-align:top}
.vmtemplate img{width:48px;height:48px}
.vmtemplate p{text-align:center;margin-top:8px;line-height:12px}
</style>
<?
	$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
	require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";

	foreach($arrAllTemplates as $strName => $arrTemplate):
	if (empty($arrTemplate)) {
		// render header
		echo '<div class="vmheader">'.$strName.'</div>';
		continue;
	}
?>
<div class="vmtemplate">
	<a href="/VMs/AddVM?template=<?=htmlspecialchars(urlencode($strName))?>">
		<img src="/plugins/dynamix.vm.manager/templates/images/<?=htmlspecialchars($arrTemplate['icon'])?>" title="<?=htmlspecialchars($strName)?>">
		<p><?=htmlspecialchars($strName)?></p>
	</a>
</div>
<? endforeach; ?>
<br>
<center><button type='button' onclick='done()'>_(Cancel)_</button></center>
<br>