bootstrap introduced
This commit is contained in:
parent
f5fa2a3ada
commit
abcc43367d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,13 @@
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
|
||||||
|
<link rel="stylesheet" href="bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
|
||||||
|
<script src="jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||||
|
<script src="popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
|
||||||
|
<script src="bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
|
||||||
|
<script src="nlvmi.js"></script>
|
||||||
|
<title>nlvmi</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class=container-fluid><div class="row" style="background-color:lightgreen;"><div class="col"><h1><a href="?" style=color:white;>nlvmi</a></h1></div></div>
|
|
@ -35,9 +35,12 @@ if ($config['DATABASETYPE']=="sqlite"){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
include('header.php');
|
||||||
|
$mode="";
|
||||||
|
|
||||||
//form for edit and new vms
|
//form for edit and new vms
|
||||||
if (isset($_REQUEST['edit'])){
|
if (isset($_REQUEST['edit'])){
|
||||||
|
$mode="editvm";
|
||||||
$formname="editvm";
|
$formname="editvm";
|
||||||
$eid=clean($_REQUEST['edit']);
|
$eid=clean($_REQUEST['edit']);
|
||||||
$sql="SELECT * FROM vms WHERE id='$eid'";
|
$sql="SELECT * FROM vms WHERE id='$eid'";
|
||||||
|
@ -49,8 +52,9 @@ if (isset($_REQUEST['edit'])){
|
||||||
} elseif(isset($_REQUEST['newvm'])) {
|
} elseif(isset($_REQUEST['newvm'])) {
|
||||||
$formname="newvm";
|
$formname="newvm";
|
||||||
$editid="";
|
$editid="";
|
||||||
|
$mode="newvm";
|
||||||
}
|
}
|
||||||
//echo $e[vmname];
|
|
||||||
if (isset($formname)){
|
if (isset($formname)){
|
||||||
echo "<h2>$formname</h2></br>";
|
echo "<h2>$formname</h2></br>";
|
||||||
echo "<form name=$formname action=? method=post>";
|
echo "<form name=$formname action=? method=post>";
|
||||||
|
@ -61,67 +65,83 @@ while ($col = $res->fetchArray(SQLITE3_ASSOC)) {
|
||||||
for ($col=0; $col <count($arrColnames); $col++){
|
for ($col=0; $col <count($arrColnames); $col++){
|
||||||
if ($arrColnames[$col]!="id"){
|
if ($arrColnames[$col]!="id"){
|
||||||
if ($arrColnames[$col] == "bootoption"){
|
if ($arrColnames[$col] == "bootoption"){
|
||||||
echo "$arrColnames[$col] <select name=bootoption><option value=c>C</option><option value=d>D</option></select></br>";
|
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>";
|
||||||
|
// echo "$arrColnames[$col] <select name=bootoption><option value=c>C</option><option value=d>D</option></select></br>";
|
||||||
} elseif ($arrColnames[$col] == "arch"){
|
} elseif ($arrColnames[$col] == "arch"){
|
||||||
echo "$arrColnames[$col] <select name=arch><option value=qemu-system-x86_64>x86_64</option></select></br>";
|
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=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>";
|
||||||
} else {
|
} else {
|
||||||
if (isset($e[$arrColnames[$col]])){
|
if (isset($e[$arrColnames[$col]])){
|
||||||
$val = $e[$arrColnames[$col]];
|
$val = $e[$arrColnames[$col]];
|
||||||
} else {
|
} else {
|
||||||
$val = "";
|
$val = "";
|
||||||
}
|
}
|
||||||
echo "$arrColnames[$col] <input type=text name=$arrColnames[$col] value=$val></br>";
|
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 type=submit></form>";
|
echo "$editid<input type=hidden name=mode value=$formname><input class=\"btn btn-primary\" type=submit></form>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo "<a href=?newvm>Create a new VM</a></br>";
|
|
||||||
|
|
||||||
//getting vms from DB
|
|
||||||
$sql="SELECT * FROM vms";
|
|
||||||
$res = $db_handle->query($sql);
|
|
||||||
while ($row = $res->fetchArray(SQLITE3_ASSOC)){
|
|
||||||
echo "<div style=\"border:solid 1px;float:left;min-width:100px;\">$row[vmname]</br><a href=?edit=$row[id]>edit</a></div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
//insert in db
|
//insert in db
|
||||||
if(isset($_REQUEST['mode'])){
|
if(isset($_REQUEST['mode'])){
|
||||||
if($_REQUEST['mode']=="newvm"){
|
if($_REQUEST['mode']=="newvm"){
|
||||||
$sqls="INSERT INTO vms ";
|
$mode="newvm";
|
||||||
$sqlc="(";
|
$sqls="INSERT INTO vms ";
|
||||||
$sqlv=" VALUES (";
|
$sqlc="(";
|
||||||
foreach(array_keys($_REQUEST) as $rkey){
|
$sqlv=" VALUES (";
|
||||||
|
foreach(array_keys($_REQUEST) as $rkey){
|
||||||
if ($rkey!="mode"){
|
if ($rkey!="mode"){
|
||||||
$rvalue = clean($_REQUEST[$rkey]);
|
$rvalue = clean($_REQUEST[$rkey]);
|
||||||
$sqlc .= "$rkey,";
|
$sqlc .= "$rkey,";
|
||||||
$sqlv .= "'$rvalue',";
|
$sqlv .= "'$rvalue',";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sqlc = rtrim($sqlc, ',');
|
$sqlc = rtrim($sqlc, ',');
|
||||||
$sqlc.=")";
|
$sqlc.=")";
|
||||||
$sqlv = rtrim($sqlv, ',');
|
$sqlv = rtrim($sqlv, ',');
|
||||||
$sqlv.=")";
|
$sqlv.=")";
|
||||||
$sql = "$sqls$sqlc$sqlv";
|
$sql = "$sqls$sqlc$sqlv";
|
||||||
echo $sql;
|
echo $sql;
|
||||||
$result = $db_handle->exec($sql);
|
$result = $db_handle->exec($sql);
|
||||||
//$result = $db_handle->query($sql);
|
} elseif ($_REQUEST['mode']=="editvm"){
|
||||||
print_r($result);
|
$mode="editvm";
|
||||||
} elseif ($_REQUEST['mode']=="editvm"){
|
$sql="UPDATE vms SET ";
|
||||||
$sql="UPDATE vms SET ";
|
foreach(array_keys($_REQUEST) as $rkey){
|
||||||
foreach(array_keys($_REQUEST) as $rkey){
|
|
||||||
if (($rkey!="mode")&&($rkey!="editid")){
|
if (($rkey!="mode")&&($rkey!="editid")){
|
||||||
$rvalue = clean($_REQUEST[$rkey]);
|
$rvalue = clean($_REQUEST[$rkey]);
|
||||||
$sql .= " $rkey='$rvalue',";
|
$sql .= " $rkey='$rvalue',";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$sql = rtrim($sql, ',');
|
||||||
|
$eid=clean($_REQUEST['editid']);
|
||||||
|
$sql .= " WHERE id='$eid'";
|
||||||
|
$result = $db_handle->exec($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$sql = rtrim($sql, ',');
|
|
||||||
$eid=clean($_REQUEST['editid']);
|
if($mode!="newvm"){
|
||||||
$sql .= " WHERE id='$eid'";
|
echo "<a href=?newvm>Create a new VM</a></br>";
|
||||||
$result = $db_handle->exec($sql);
|
|
||||||
}
|
}
|
||||||
|
//getting vms from DB
|
||||||
|
$sql="SELECT * FROM vms";
|
||||||
|
$res = $db_handle->query($sql);
|
||||||
|
echo "<div class=row>";
|
||||||
|
while ($row = $res->fetchArray(SQLITE3_ASSOC)){
|
||||||
|
echo "<div class=col style=\"border:solid 1px;\">$row[vmname]</br><a href=?edit=$row[id]>edit</a></div>";
|
||||||
}
|
}
|
||||||
|
echo "</div></div></body></html>";
|
||||||
?>
|
?>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,4 @@
|
||||||
|
function dropdown(i,e) {
|
||||||
|
document.getElementById(i).innerHTML = e;
|
||||||
|
document.getElementById(i +'h').value = e;
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue