in farbe und bunt

This commit is contained in:
mad 2018-08-13 19:21:12 +02:00
parent 471b1a2624
commit a5e02be3d9
1 changed files with 21 additions and 10 deletions

View File

@ -139,6 +139,14 @@ for ($col=0; $col <count($arrColnames); $col++){
}
}
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>";
@ -150,7 +158,7 @@ for ($col=0; $col <count($arrColnames); $col++){
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=$arrColnames[$col]buttonh name=$arrColnames[$col] value=$val>";
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>";
}
@ -208,9 +216,9 @@ if(isset($_REQUEST['mode'])){
}
}
if($mode!="newvm"){
echo "<a class=\"btn btn-primary\" href=?newvm>Create a new VM</a></br>";
}
if(($mode!="newvm")&&($mode!="editvm")){
echo "</br><a class=\"btn btn-primary\" href=# onclick=\"post('?', {newvm: 'newvm'});\">Create a new VM</a></br></br>";
//getting vms from DB
$sql="SELECT * FROM vms";
$res = $db_handle->query($sql);
@ -218,15 +226,18 @@ echo "<div class=row>";
while ($row = $res->fetchArray(SQLITE3_ASSOC)){
if (checkvm($row['vmname'])){
$button = "start";
$buttonc = "btn-success";
} else {
$button = "stop";
$buttonc = "btn-warning";
}
echo "<div class=col style=\"border:solid 1px;\">$row[vmname]</br><a class=\"btn btn-primary\" href=?edit=$row[id]>edit</a> ";
echo "<a href=?$button=$row[vmname] class=\"btn btn-primary\">$button</a> ";
echo "<button class=\"btn btn-default\" 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> ";
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 "<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();
if ($button == "stop") {
echo "<a target=_blank href=novnc/vnc.html?path&host=$server class=\"btn btn-primary\">VNC</a></div>";
if (preg_match('/stop/', $button)) {
echo "<a target=_blank href=novnc/vnc.html?path&host=$server class=\"btn btn-success\">VNC</a></div>";
}
}
}
echo "</div></div></body></html>";