showosid_list.php3 3.41 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
Timothy Stack's avatar
Timothy Stack committed
4
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh Stoller committed
5 6
# All rights reserved.
#
7 8 9 10 11
include("defs.php3");

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

#
#
# 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);

27 28 29 30 31 32 33 34 35 36 37 38 39
if (! isset($sortby))
    $sortby = "normal";

if (! strcmp($sortby, "normal") ||
    ! strcmp($sortby, "name"))
    $order = "o.osname";
elseif (! strcmp($sortby, "pid"))
    $order = "o.pid";
elseif (! strcmp($sortby, "desc"))
    $order = "o.description";
else 
    $order = "o.osname";

40 41 42 43 44 45 46 47 48 49 50 51 52 53
#
# Allow for creator restriction
#
$extraclause = "";
if (isset($creator) && $creator != "") {
    if (! TBvalid_uid($creator)) {
	PAGEARGERROR("Invalid characters in creator");
    }
    if ($isadmin) 
	$extraclause = "where o.creator='$creator' ";
    else
	$extraclause = "and o.creator='$creator' ";
}

54 55 56 57
#
# Get the project list.
#
if ($isadmin) {
Leigh Stoller's avatar
Leigh Stoller committed
58
    $query_result =
59 60 61
	DBQueryFatal("SELECT * FROM os_info as o ".
		     "$extraclause ".
		     "order by $order");
62 63
}
else {
Leigh Stoller's avatar
Leigh Stoller committed
64 65
    $query_result =
	DBQueryFatal("select distinct o.* from os_info as o ".
66
		     "left join group_membership as g on g.pid=o.pid ".
67 68
		     "where (g.uid='$uid' or o.shared=1) ".
		     "$extraclause ".
69
		     "order by $order");
70 71
}

72 73 74
SUBPAGESTART();
SUBMENUSTART("More Options");
WRITESUBMENUBUTTON("Create an Image Descriptor",
75
		   "newimageid_ez.php3");
76 77 78 79
if ($isadmin) {
    WRITESUBMENUBUTTON("Create an OS Descriptor",
		       "newosid_form.php3");
}
Leigh Stoller's avatar
Leigh Stoller committed
80
WRITESUBMENUBUTTON("Image Descriptor list",
81 82
		   "showimageid_list.php3");
SUBMENUEND();
83

84
echo "Listed below are the OS Descriptors that you may use in your NS file
85 86 87 88 89
      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
Timothy Stack's avatar
Timothy Stack committed
90
      to start your experiment when selecting an OS that is not
91
      already resident. Please be patient.
92 93 94 95 96
      <br>
      More information on how to create your own Images is in the
      <a href='tutorial/tutorial.php3#CustomOS'>Custom OS</a> section of
      the <a href='tutorial/tutorial.php3'>Emulab Tutorial.</a>
      <br>\n";
97

98 99
SUBPAGEEND();

100 101 102 103
if (mysql_num_rows($query_result)) {
    echo "<br>
          <table border=2 cellpadding=0 cellspacing=2 align='center'>\n";
    
104
    echo "<tr>
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
              <th><a href='showosid_list.php3?&sortby=name'>
                  Name</th>
              <th><a href='showosid_list.php3?&sortby=pid'>
                  PID</th>
              <th><a href='showosid_list.php3?&sortby=desc'>
                  Description</th>
          </tr>\n";
    
    while ($row = mysql_fetch_array($query_result)) {
        $osname  = $row[osname];
        $osid    = $row[osid];
        $descrip = stripslashes($row[description]);
        $pid     = $row[pid];
    
        echo "<tr>
                  <td><A href='showosinfo.php3?osid=$osid'>$osname</A></td>
                  <td>$pid</td>
                  <td>$descrip</td>\n";
        echo "</tr>\n";
    }
    echo "</table>\n";
126 127 128 129 130 131 132
}

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