diff --git a/web/header.php b/web/header.php
index fe8bcbc..8e5f0cb 100644
--- a/web/header.php
+++ b/web/header.php
@@ -27,7 +27,7 @@
-
+
diff --git a/web/index.php b/web/index.php
index 5c39b8a..1c88c2b 100644
--- a/web/index.php
+++ b/web/index.php
@@ -23,6 +23,29 @@ function checkvm($vmname) {
}
return 0;
}
+function serverdepropdown($server, $val, $what){
+ if ($what == "cdrom"){
+ $dir = "isodirectory";
+ $enddiv = "
";
+ } elseif (preg_match('/drive/', $what)) {
+ $dir = "vmdirectory";
+ $enddiv="";
+ }
+ echo "$what
";
+}
//read config file
$configfile = new SplFileObject("/etc/nlvmi/nlvmi.conf");
@@ -241,7 +264,40 @@ if (isset($_SESSION['username'])){
//}
}
}
-
+ if (isset($_POST['serverbuttoni'])){
+ serverdepropdown($_POST['serverbuttoni'], "no cdrom", 'cdrom');
+ exit;
+ } elseif (isset($_POST['serverbuttona'])){
+ serverdepropdown($_POST['serverbuttona'], "no drive1", 'drive1');
+ echo "
";
+ exit;
+ } elseif (isset($_POST['serverbuttonb'])){
+ serverdepropdown($_POST['serverbuttonb'], "no drive2", 'drive2');
+ echo "";
+ exit;
+ } elseif (isset($_POST['serverbuttonc'])){
+ serverdepropdown($_POST['serverbuttonc'], "no drive3", 'drive3');
+ echo "";
+ exit;
+ }
//ajax queries are all done, time for the header
include('header.php');
@@ -358,6 +414,7 @@ if (isset($_SESSION['username'])){
while ($col = $res->fetchArray(SQLITE3_ASSOC)) {
$arrColnames[]=$col['name'];
}
+ $server = $e['server'];
for ($col=0; $col ";
echo "raw";
echo "qcow2";
- echo "";
+ echo "";
} elseif ($arrColnames[$col] == "autostart"){
$checked="";
if ($val=="1"){
@@ -410,22 +467,11 @@ if (isset($_SESSION['username'])){
}
echo "";
} elseif ($arrColnames[$col] == "cdrom"){
- echo "";
- } elseif (preg_match('/format/', $arrColnames[$col])) {
- echo "$arrColnames[$col]
";
+ echo "";
+ serverdepropdown($server, $val, "cdrom");
+ echo "
";
+// } elseif (preg_match('/format/', $arrColnames[$col])) {
+// echo "$arrColnames[$col]
";
} elseif (preg_match('/tapdev/', $arrColnames[$col])) {
echo "";
} elseif (preg_match('/drive/', $arrColnames[$col])){
+ echo "";
+ serverdepropdown($server, $val, $arrColnames[$col]);
+
+ } elseif ($arrColnames[$col] == "server"){
echo "
$arrColnames[$col]
";
+// $vmdirs = explode('|', $config['VMDIRECTORY']);
+// foreach($vmdirs as $vmdir){
+// $files = array_diff(scandir($vmdir), array('.', '..'));
+// $files = array_values(array_filter($files));
+// for ($f=0; $f
$vmdir/$files[$f]";
+// }
+// }
+ echo " ";
} else {
echo "";
diff --git a/web/nlvmi.js b/web/nlvmi.js
index 31474b4..6092a61 100644
--- a/web/nlvmi.js
+++ b/web/nlvmi.js
@@ -11,6 +11,48 @@ function makeid() {
function dropdown(i,e) {
document.getElementById(i).innerHTML = e;
document.getElementById(i +'h').value = e;
+ if (i == "serverbutton") {
+ console.log("here");
+
+ $.ajax({
+ type: 'POST',
+ url: "?rand="+ makeid(),
+ data: "serverbuttoni="+e,
+ success: function(response) {
+ document.getElementById('cdromdiv').innerHTML = response;
+ },
+ });
+ console.log("a");
+ $.ajax({
+ type: 'POST',
+ url: "?rand="+ makeid(),
+ data: "serverbuttona="+e,
+ success: function(response) {
+ document.getElementById('drive1div').innerHTML = response;
+ },
+ });
+ console.log("b");
+
+ $.ajax({
+ type: 'POST',
+ url: "?rand="+ makeid(),
+ data: "serverbuttonb="+e,
+ success: function(response) {
+ document.getElementById('drive2div').innerHTML = response;
+ },
+ });
+ console.log("c");
+
+ $.ajax({
+ type: 'POST',
+ url: "?rand="+ makeid(),
+ data: "serverbuttonc="+e,
+ success: function(response) {
+ document.getElementById('drive3div').innerHTML = response;
+ },
+ });
+
+ }
}
function post(path, params, method) {
@@ -48,9 +90,7 @@ $('#confirm-delete').on('show.bs.modal', function(e) {
});
function submitbutton(formid){
- console.log(formid);
data = $('#'+ formid).serialize();
- console.log(data);
$.ajax({
type: 'POST',
url: "?rand="+ makeid(),