Commit 7babbabf authored by Leigh Stoller's avatar Leigh Stoller

Convert a couple more pages. Also play a style file trick so that the

header line looks like its clickable.
parent 06655fcf
......@@ -11,6 +11,10 @@ include("defs.php3");
#
PAGEHEADER("Image List");
# Sorttable.js
echo "<script type='text/javascript' language='javascript'
src='sorttable.js'></script>\n";
#
#
# Only known and logged in users allowed.
......@@ -23,21 +27,7 @@ $isadmin = ISADMIN();
# Admin users can see all ImageIDs, while normal users can only see
# ones in their projects or ones that are globally available.
#
$optargs = OptionalPageArguments("sortby", PAGEARG_STRING,
"creator", PAGEARG_USER);
if (! isset($sortby))
$sortby = "normal";
if (! strcmp($sortby, "normal") ||
! strcmp($sortby, "name"))
$order = "i.imagename";
elseif (! strcmp($sortby, "pid"))
$order = "i.pid";
elseif (! strcmp($sortby, "desc"))
$order = "i.description";
else
$order = "i.imagename";
$optargs = OptionalPageArguments("creator", PAGEARG_USER);
$extraclause = "";
#
......@@ -60,7 +50,7 @@ if (isset($creator)) {
if ($isadmin) {
$query_result = DBQueryFatal("SELECT * FROM images as i ".
"$extraclause ".
"order by $order");
"order by i.imagename");
}
else {
#
......@@ -78,7 +68,7 @@ else {
"left join group_membership as g on g.pid=i.pid ".
"where (g.uid_idx='$uid_idx' or i.global) ".
"$extraclause ".
"order by $order");
"order by i.imagename");
}
SUBPAGESTART();
......@@ -110,17 +100,16 @@ echo "Listed below are the Images that you can load on your nodes with the
SUBPAGEEND();
if (mysql_num_rows($query_result)) {
echo "<table border=2 cellpadding=0 cellspacing=2
echo "<table border=2 cellpadding=0 cellspacing=2 id='showimagelist'
align='center'>\n";
echo "<tr>
<th><a href='showimageid_list.php3?&sortby=name'>
Image</th>
<th><a href='showimageid_list.php3?&sortby=pid'>
PID</th>
<th><a href='showimageid_list.php3?&sortby=desc'>
Description</th>
</tr>\n";
echo "<thead class='sort'>
<tr>
<th>Image</th>
<th>PID</th>
<th>Description</th>
</tr>
</thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$imageid = $row["imageid"];
......@@ -137,6 +126,9 @@ if (mysql_num_rows($query_result)) {
}
echo "</table>\n";
}
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('showimagelist'));
</script>\n";
#
# Standard Testbed Footer
......
......@@ -11,6 +11,10 @@ include("defs.php3");
#
PAGEHEADER("OS Descriptor List");
# Sorttable.js
echo "<script type='text/javascript' language='javascript'
src='sorttable.js'></script>\n";
#
#
# Only known and logged in users allowed.
......@@ -23,21 +27,7 @@ $isadmin = ISADMIN();
# Admin users can see all OSIDs, while normal users can only see
# ones in their projects or ones that are globally available.
#
$optargs = OptionalPageArguments("sortby", PAGEARG_STRING,
"creator", PAGEARG_USER);
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";
$optargs = OptionalPageArguments("creator", PAGEARG_USER);
#
# Allow for creator restriction
......@@ -59,7 +49,7 @@ if ($isadmin) {
$query_result =
DBQueryFatal("SELECT * FROM os_info as o ".
"$extraclause ".
"order by $order");
"order by o.osname");
}
else {
$uid_idx = $this_user->uid_idx();
......@@ -69,7 +59,7 @@ else {
"left join group_membership as g on g.pid=o.pid ".
"where (g.uid_idx='$uid_idx' or o.shared=1) ".
"$extraclause ".
"order by $order");
"order by o.osname");
}
SUBPAGESTART();
......@@ -102,16 +92,16 @@ SUBPAGEEND();
if (mysql_num_rows($query_result)) {
echo "<br>
<table border=2 cellpadding=0 cellspacing=2 align='center'>\n";
<table border=2 cellpadding=0 cellspacing=2
align='center' id='showosidlist'>\n";
echo "<tr>
<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";
echo "<thead class='sort'>
<tr>
<th>Name</th>
<th>PID</th>
<th>Description</th>
</tr>
</thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$osname = $row["osname"];
......@@ -128,6 +118,9 @@ if (mysql_num_rows($query_result)) {
}
echo "</table>\n";
}
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('showosidlist'));
</script>\n";
#
# Standard Testbed Footer
......
......@@ -154,7 +154,7 @@ function GENPLIST ($query_result)
echo "<table width='100%' border=2 id='$tablename'
cellpadding=2 cellspacing=2 align=center>
<thead>
<thead class='sort'>
<tr>\n";
echo "<th>PID</th>\n";
......
......@@ -34,6 +34,13 @@ img.stealth { background-color:#FFF; }
table.topbar { border-bottom: solid 2px #000; }
table.bottombar { border-top: solid 2px #000; }
/* Sortable tables */
thead.sort {
color:#2222BB;
font-weight: bold;
cursor: default;
}
td.pad4 { padding: 4px; }
td.paddedcell { padding-left: 0.5em; padding-right: 0.5em; padding-top: 0.75em; }
td.paddedcell2 { padding: 0.5em; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment