showosid_list.php3 2.33 KB
Newer Older
1 2 3 4 5 6
<?php
include("defs.php3");

#
# Standard Testbed Header
#
7
PAGEHEADER("OS Descriptor List");
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

#
#
# Only known and logged in users allowed.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);

#
# Admin users can see all OSIDs, while normal users can only see
# ones in their projects or ones that are globally available.
#
$isadmin = ISADMIN($uid);

#
# Get the project list.
#
if ($isadmin) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
26
    $query_result =
27
	DBQueryFatal("SELECT * FROM os_info order by pid,osname");
28 29
}
else {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
30 31
    $query_result =
	DBQueryFatal("select distinct o.* from os_info as o ".
32 33 34
		     "left join group_membership as g on g.pid=o.pid ".
		     "where g.uid='$uid' or o.shared=1 ".
		     "order by o.pid,o.osname");
35 36 37 38 39 40 41 42 43 44 45
}

if (mysql_num_rows($query_result) == 0) {
	if ($isadmin) {
	    USERERROR("There are no OSIDs!", 1);
	}
	else {
	    USERERROR("There are no OSIDs in any of your projects!", 1);
	}
}

46 47 48 49 50 51 52 53 54
SUBPAGESTART();
SUBMENUSTART("More Options");
WRITESUBMENUBUTTON("Create an Image Descriptor",
		   "newimageid_explain.php3");
WRITESUBMENUBUTTON("Create an OS Descriptor",
		   "newosid_form.php3");
WRITESUBMENUBUTTON("Back to Image Descriptor list",
		   "showimageid_list.php3");
SUBMENUEND();
55 56 57 58 59 60 61 62 63 64 65 66

echo "<p><br>
      Listed below are the OS Descriptors that you may use in your NS file
      with the <a href='tutorial/docwrapper.php3?docname=nscommands.html#OS'>
      <tt>tb-set-node-os</tt></a> directive. If the OS you have selected for
      a node is not loaded on that node when the experiment is swapped in,
      the Testbed system will automatically reload that node's disk with the
      appropriate image. You might notice that it takes a few minutes longer
      to start start your experiment when selecting an OS that is not
      already resident. Please be patient.
      <br>\n";

67 68
SUBPAGEEND();

69 70
echo "<br>
      <table border=2 cellpadding=0 cellspacing=2 align='center'>\n";
71 72

echo "<tr>
73
          <td>Name</td>
74 75 76 77 78
          <td>PID</td>
          <td>Description</td>
      </tr>\n";

while ($row = mysql_fetch_array($query_result)) {
79
    $osname  = $row[osname];
80 81 82 83 84
    $osid    = $row[osid];
    $descrip = $row[description];
    $pid     = $row[pid];

    echo "<tr>
85
              <td><A href='showosinfo.php3?osid=$osid'>$osname</A></td>
86 87 88 89 90 91 92 93 94 95 96
              <td>$pid</td>
              <td>$descrip</td>\n";
    echo "</tr>\n";
}
echo "</table>\n";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>