edivm format dropdown, introduce placeholders

This commit is contained in:
mad 2018-08-16 17:15:56 +02:00
parent 2add658700
commit 30f1ab1f26
2 changed files with 58 additions and 4 deletions

View File

@ -30,3 +30,19 @@
<script src="nlvmi.js?2"></script>
<div class=container-fluid><div class="row" style="background-color:lightgreen;"><div class="col-sm"><h1><a href="?" style=color:white;>nlvmi</a><a href="?" style="color:black;font-size:10px;">@<?php echo gethostname();?></a></h1></div><div class=col-sm style=text-align:right>
<?php if($_SESSION['isadmin']==1){ echo "<a style=color:black href=# onclick=\"javascript:post('?', {'usermgmt': 'show'});\">usermanagement</a></br>"; } ?><a style=color:black href=# onclick="javascript:post('?', {'logout': 'logout'});">logout</a></div></div>
<style>
::-webkit-input-placeholder {
font-size: 9px!important;
}
:-moz-placeholder { /* Firefox 18- */
font-size: 8px!important;
}
::-moz-placeholder { /* Firefox 19+ */
font-size: 8px!important;
}
</style>

View File

@ -254,6 +254,27 @@ if (isset($_SESSION['username'])){
}
if (isset($formname)){
$placehold['vmname']="Name of the VM";
$placehold['server']="ip or name of host server";
$placehold['cputype']="normally just 'host'";
$placehold['cpus']="Number of core for the VM";
$placehold['memory']="Amount of RAM for the VM im Mb";
$placehold['usbdev']="Normally just 'tablet' to get a mouse";
$placehold['kblang']="Qemu keyboard layout. Like 'de-ch'";
$placehold['custom']="Customstring to add to the qemu command";
$placehold['tapdev1']="tapname of first netinterface";
$placehold['tapdev2']="tapname of second netinterface";
$placehold['tapdev3']="tapname of third netinterface";
$placehold['macaddr1']="macaddress of first netinterface";
$placehold['macaddr2']="macaddress of second netinterface";
$placehold['macaddr3']="macaddress of third netinterface";
$placehold['brdev1']="bridge on host to add first netinterface";
$placehold['brdev2']="bridge on host to add second netinterface";
$placehold['brdev3']="bridge on host to add third netinterface";
$placehold['vncport']="VNC displaynumber like '1'";
$placehold['websocket']="port to bind the VNC websocket";
$placehold['vncpasswort']="the password for VNC";
echo "<h2>$formname</h2></br>";
echo "<form name=$formname action=? method=post>";
$res = $db_handle->query('PRAGMA table_info(vms)');
@ -267,6 +288,8 @@ if (isset($_SESSION['username'])){
} else {
$val = "";
}
$colname=$arrColnames[$col];
//$placeh=$placehold[$arrColnames[$col]];
if ($arrColnames[$col] == "bootoption"){
if($val=="") {
$val="c";
@ -295,6 +318,20 @@ if (isset($_SESSION['username'])){
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 (preg_match('/format/', $arrColnames[$col])){
echo "<div class=row><div class=col>$arrColnames[$col]</div><div class=col><div class=dropdown><button class=\"btn btn-secondary dropdown-toggle\" type=button id=formatbutton$arrColnames[$col] data-toggle=dropdown aria-haspopup=true aria-expanded=false>$val</button>";
echo "<div class=dropdown-menu aria-labelledby=formatbutton$arrColnames[$col]>";
echo "<a class=dropdown-item href=\"javascript:dropdown('formatbutton$arrColnames[$col]','')\">&nbsp</a>";
echo "<div class=dropdown-divider></div>";
echo "<a class=dropdown-item href=\"javascript:dropdown('formatbutton$arrColnames[$col]','raw')\">raw</a>";
echo "<a class=dropdown-item href=\"javascript:dropdown('formatbutton$arrColnames[$col]','qcow2')\">qcow2</a>";
echo "</div></div></div></div></div><input type=hidden id=formatbutton$arrColnames[$col]h name=arch value=x86_64>";
} elseif ($arrColnames[$col] == "autostart"){
$checked="";
if ($val=="1"){
$checked="checked";
}
echo "<div class=row><div class=col-md-1 style=text-align:right>autostart</div><div class=col-md-2><input data-onstyle=\"success\" data-offstyle=danger name=autostart id=\"autostart\" type=\"checkbox\" data-toggle=\"toggle\" data-on=\"boot with host\" data-off=\"no autostart\" $checked></div></div>";
} 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>";
@ -313,11 +350,11 @@ if (isset($_SESSION['username'])){
} 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>";
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\" placeholder=\"$placehold[$colname]\"></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>";
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\" placeholder=\"$placehold[$colname]\"></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>";
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\" placeholder=\"$placehold[$colname]\"></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>";
@ -332,7 +369,8 @@ if (isset($_SESSION['username'])){
}
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 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\" placeholder=\"$placehold[$colname]\"></div></div>";
}
}
}