bootoption fix
This commit is contained in:
parent
f4d6a616fb
commit
3048e4e9a2
115
web/index.php
115
web/index.php
|
@ -44,6 +44,7 @@ if ($config['DATABASETYPE']=="sqlite"){
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ((isset($_POST['deletevm']))&&(isset($_POST['deletename']))){
|
||||
$vmname = clean($_POST['deletename']);
|
||||
$vmid = clean($_POST['deletevm']);
|
||||
|
@ -99,73 +100,75 @@ if (isset($_REQUEST['edit'])){
|
|||
}
|
||||
|
||||
if (isset($formname)){
|
||||
echo "<h2>$formname</h2></br>";
|
||||
echo "<form name=$formname action=? method=post>";
|
||||
$res = $db_handle->query('PRAGMA table_info(vms)');
|
||||
while ($col = $res->fetchArray(SQLITE3_ASSOC)) {
|
||||
$arrColnames[]=$col['name'];
|
||||
}
|
||||
for ($col=0; $col <count($arrColnames); $col++){
|
||||
if ($arrColnames[$col]!="id"){
|
||||
if (isset($e[$arrColnames[$col]])){
|
||||
echo "<h2>$formname</h2></br>";
|
||||
echo "<form name=$formname action=? method=post>";
|
||||
$res = $db_handle->query('PRAGMA table_info(vms)');
|
||||
while ($col = $res->fetchArray(SQLITE3_ASSOC)) {
|
||||
$arrColnames[]=$col['name'];
|
||||
}
|
||||
for ($col=0; $col <count($arrColnames); $col++){
|
||||
if ($arrColnames[$col]!="id"){
|
||||
if (isset($e[$arrColnames[$col]])){
|
||||
$val = $e[$arrColnames[$col]];
|
||||
} else {
|
||||
$val = "";
|
||||
}
|
||||
if ($arrColnames[$col] == "bootoption"){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>bootoption</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=bootoptionbutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>C</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=bootoptionbutton>";
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('bootoptionbutton','c')\">c</a>";
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('bootoptionbutton','d')\">d</a>";
|
||||
echo "</div></div></div></div><input type=hidden id=bootoptionbuttonh name=bootoption value=c>";
|
||||
if ($arrColnames[$col] == "bootoption"){
|
||||
if($val=="") {
|
||||
$val="c";
|
||||
}
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>bootoption</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=bootoptionbutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=bootoptionbutton>";
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('bootoptionbutton','c')\">c</a>";
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('bootoptionbutton','d')\">d</a>";
|
||||
echo "</div></div></div></div><input type=hidden id=bootoptionbuttonh name=bootoption value=c>";
|
||||
// echo "$arrColnames[$col] <select name=bootoption><option value=c>C</option><option value=d>D</option></select></br>";
|
||||
} elseif ($arrColnames[$col] == "arch"){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>arch</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=archbutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>x86_64</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=archbutton>";
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('archbutton','x86_64')\">x86_64</a>";
|
||||
echo "</div></div></div></div><input type=hidden id=archbuttonh name=arch value=x86_64>";
|
||||
} elseif ($arrColnames[$col] == "arch"){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>arch</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=archbutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>x86_64</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=archbutton>";
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('archbutton','x86_64')\">x86_64</a>";
|
||||
echo "</div></div></div></div><input type=hidden id=archbuttonh name=arch value=x86_64>";
|
||||
// echo "$arrColnames[$col] <select name=arch><option value=qemu-system-x86_64>x86_64</option></select></br>";
|
||||
} elseif ($arrColnames[$col] == "cdrom"){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>cdrom</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=cdrombutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=cdrombutton>";
|
||||
$isodirs = explode('|', $config['ISODIRECTORY']);
|
||||
foreach($isodirs as $isodir){
|
||||
$files = array_diff(scandir($isodir), array('.', '..'));
|
||||
$files = array_values(array_filter($files));
|
||||
for ($f=0; $f<count($files); $f++){
|
||||
if ((preg_match('/iso/', $files[$f]))||(preg_match('/ISO/', $files[$f]))){
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('cdrombutton','$isodir/$files[$f]')\">$isodir/$files[$f]</a>";
|
||||
} elseif ($arrColnames[$col] == "cdrom"){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>cdrom</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=cdrombutton data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=cdrombutton>";
|
||||
$isodirs = explode('|', $config['ISODIRECTORY']);
|
||||
foreach($isodirs as $isodir){
|
||||
$files = array_diff(scandir($isodir), array('.', '..'));
|
||||
$files = array_values(array_filter($files));
|
||||
for ($f=0; $f<count($files); $f++){
|
||||
if ((preg_match('/iso/', $files[$f]))||(preg_match('/ISO/', $files[$f]))){
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('cdrombutton','$isodir/$files[$f]')\">$isodir/$files[$f]</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</div></div></div></div><input type=hidden id=cdrombuttonh name=cdrom value=$val>";
|
||||
} elseif (preg_match('/format/', $arrColnames[$col])) {
|
||||
echo "<div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div></div>";
|
||||
} elseif (preg_match('/tapdev/', $arrColnames[$col])) {
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div>";
|
||||
} elseif (preg_match('/macaddr/', $arrColnames[$col])) {
|
||||
echo "<div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div>";
|
||||
} elseif (preg_match('/brdev/', $arrColnames[$col])) {
|
||||
echo "<div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div></div>";
|
||||
} elseif (preg_match('/drive/', $arrColnames[$col])){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=$arrColnames[$col]button data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=$arrColnames[$col]button>";
|
||||
$vmdirs = explode('|', $config['VMDIRECTORY']);
|
||||
foreach($vmdirs as $vmdir){
|
||||
$files = array_diff(scandir($vmdir), array('.', '..'));
|
||||
$files = array_values(array_filter($files));
|
||||
for ($f=0; $f<count($files); $f++){
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('$arrColnames[$col]button','$vmdir/$files[$f]')\">$vmdir/$files[$f]</a>";
|
||||
echo "</div></div></div></div><input type=hidden id=cdrombuttonh name=cdrom value=$val>";
|
||||
} elseif (preg_match('/format/', $arrColnames[$col])) {
|
||||
echo "<div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div></div>";
|
||||
} elseif (preg_match('/tapdev/', $arrColnames[$col])) {
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div>";
|
||||
} elseif (preg_match('/macaddr/', $arrColnames[$col])) {
|
||||
echo "<div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div>";
|
||||
} elseif (preg_match('/brdev/', $arrColnames[$col])) {
|
||||
echo "<div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div></div>";
|
||||
} elseif (preg_match('/drive/', $arrColnames[$col])){
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=$arrColnames[$col]button data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
|
||||
echo "<div class=dropdown-menu aria-labelledby=$arrColnames[$col]button>";
|
||||
$vmdirs = explode('|', $config['VMDIRECTORY']);
|
||||
foreach($vmdirs as $vmdir){
|
||||
$files = array_diff(scandir($vmdir), array('.', '..'));
|
||||
$files = array_values(array_filter($files));
|
||||
for ($f=0; $f<count($files); $f++){
|
||||
echo "<a class=dropdown-item href=\"javascript:dropdown('$arrColnames[$col]button','$vmdir/$files[$f]')\">$vmdir/$files[$f]</a>";
|
||||
}
|
||||
}
|
||||
echo "</div></div></div><input type=hidden id=$arrColnames[$col]buttonh name=$arrColnames[$col] value=$val>";
|
||||
} else {
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div></div>";
|
||||
}
|
||||
echo "</div></div></div><input type=hidden id=$arrColnames[$col]buttonh name=$arrColnames[$col] value=$val>";
|
||||
} else {
|
||||
echo "<div class=row><div class=col-md-1 style=text-align:right>$arrColnames[$col]</div><div class=col-md-2><input class=form-control type=text name=$arrColnames[$col] value=$val></div></div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "$editid<input type=hidden name=mode value=$formname><input class=\"btn btn-primary\" type=submit></form>";
|
||||
echo "$editid<input type=hidden name=mode value=$formname><input class=\"btn btn-primary\" type=submit></form>";
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,7 +234,7 @@ while ($row = $res->fetchArray(SQLITE3_ASSOC)){
|
|||
$button = "stop";
|
||||
$buttonc = "btn-warning";
|
||||
}
|
||||
echo "<div class=col style=\"border:solid 1px;\">$row[vmname]</br><a class=\"btn btn-primary\" href=# onclick=\"post('?', {edit: '$row[id]'});\">edit</a> ";
|
||||
echo "<div class=col style=\"border:solid 1px;max-width:320px;\">$row[vmname]</br><a class=\"btn btn-primary\" href=# onclick=\"post('?', {edit: '$row[id]'});\">edit</a> ";
|
||||
echo "<a href=# onclick=\"post('?', {'$button': '$row[vmname]'});\"class=\"btn $buttonc\">$button</a> ";
|
||||
echo "<button class=\"btn btn-danger\" data-delete-text=\"Delete VM $row[vmname]!\" data-delete-vm=\"$row[id]\" data-delete-name=\"$row[vmname]\" data-toggle=\"modal\" data-target=\"#confirm-delete\">Delete VM</button> ";
|
||||
$server = gethostname();
|
||||
|
|
Loading…
Reference in New Issue