bootoption fix

This commit is contained in:
mad 2018-08-13 20:11:24 +02:00
parent f4d6a616fb
commit 3048e4e9a2
1 changed files with 59 additions and 56 deletions

View File

@ -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,13 +100,13 @@ 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)) {
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++){
}
for ($col=0; $col <count($arrColnames); $col++){
if ($arrColnames[$col]!="id"){
if (isset($e[$arrColnames[$col]])){
$val = $e[$arrColnames[$col]];
@ -113,7 +114,10 @@ for ($col=0; $col <count($arrColnames); $col++){
$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>";
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>";
@ -163,9 +167,8 @@ for ($col=0; $col <count($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></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();