showosid_list.php3 1.74 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 55 56
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();
SUBPAGEEND();

57 58 59 60
echo "<table border=2 cellpadding=0 cellspacing=2
       align='center'>\n";

echo "<tr>
61
          <td>Name</td>
62 63 64 65 66
          <td>PID</td>
          <td>Description</td>
      </tr>\n";

while ($row = mysql_fetch_array($query_result)) {
67
    $osname  = $row[osname];
68 69 70 71 72
    $osid    = $row[osid];
    $descrip = $row[description];
    $pid     = $row[pid];

    echo "<tr>
73
              <td><A href='showosinfo.php3?osid=$osid'>$osname</A></td>
74 75 76 77 78 79 80 81 82 83 84
              <td>$pid</td>
              <td>$descrip</td>\n";
    echo "</tr>\n";
}
echo "</table>\n";

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