Commit 6cce939f authored by Leigh Stoller's avatar Leigh Stoller

More sorttable stuff ... everyone loves a sortable table.

parent 056ca783
......@@ -1234,7 +1234,8 @@ function ShowExperimentList_internal($templates_only,
<h3>$title ".
($templates_only ? "Template Instances" : "Experiments") . "</h3>
</center>
<table align=center border=1 cellpadding=2 cellspacing=2>\n";
<table align=center border=1 cellpadding=2
id='explist' cellspacing=2>\n";
if ($nopid) {
$pidrow="";
......@@ -1242,13 +1243,14 @@ function ShowExperimentList_internal($templates_only,
$pidrow="\n<th>PID</th>";
}
echo "<thead class='sort'>";
echo "<tr>$pidrow
<th>EID</th>
<th>State</th>
<th align=center>Nodes [1]</th>
<th align=center>Hours Idle [2]</th>
<th>Description</th>
</tr>\n";
</tr></thead>\n";
$idlemark = "<b>*</b>";
$stalemark = "<b>?</b>";
......@@ -1312,6 +1314,9 @@ function ShowExperimentList_internal($templates_only,
}
echo "</ol></font></td></tr></table>\n";
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('explist'));
</script>\n";
}
}
......
......@@ -962,8 +962,10 @@ class Group
echo "<h3>Group Members</h3>\n";
echo "</center>
<table align=center border=1 cellpadding=1 cellspacing=2>\n";
<table align=center border=1 cellpadding=1
id='userlist' cellspacing=2>\n";
echo "<thead class='sort'>";
echo "<tr>
<th>Name</th>\n";
if (! $projgrp) {
......@@ -974,7 +976,7 @@ class Group
if ($showdel) {
echo "<th>Remove</th>\n";
}
echo "</tr>\n";
echo "</tr></thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$uid_idx = $row["uid_idx"];
......@@ -1012,6 +1014,9 @@ class Group
echo "</tr>\n";
}
echo "</table>\n";
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('userlist'));
</script>\n";
}
function ShowStats() {
......
......@@ -664,6 +664,8 @@ function PAGEBEGINNING( $title, $nobanner = 0, $nocontent = 0,
}
echo "<script type='text/javascript' language='javascript'
src='${BASEPATH}/emulab_sup.js'></script>\n";
echo "<script type='text/javascript' language='javascript'
src='${BASEPATH}/sorttable.js'></script>\n";
if (! $nobanner ) {
#
......
......@@ -435,8 +435,9 @@ foreach($freetypes as $key => $value) {
echo "</table>\n";
SUBMENUEND_2B();
echo "<table border=2 cellpadding=2 cellspacing=2>\n";
echo "<table border=2 cellpadding=2 cellspacing=2 id='nodelist'>\n";
echo "<thead class='sort'>";
echo "<tr>
<th align=center>ID</th>\n";
......@@ -445,7 +446,7 @@ if ($showvnames) {
}
echo " <th align=center>Type (Class)</th>
<th align=center>Up?</th>\n";
<th align=center class='sorttable_nosort'>Up?</th>\n";
if ($isadmin) {
echo "<th align=center>PID</th>
......@@ -464,7 +465,7 @@ if (!strcmp($showtype, "widearea")) {
<th align=center>Location</th>";
}
echo "</tr>\n";
echo "</tr></thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$node_id = $row["node_id"];
......@@ -562,6 +563,9 @@ while ($row = mysql_fetch_array($query_result)) {
}
echo "</table>\n";
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('nodelist'));
</script>\n";
SUBPAGEEND();
#
......
......@@ -821,12 +821,13 @@ class Project
$groups = $this->SubGroups();
echo "<h3>Project Groups</h3>\n";
echo "<table align=center border=1>\n";
echo "<table id='grouplist' align=center border=1>\n";
echo "<thead class='sort'>";
echo "<tr>
<th>GID</th>
<th>Description</th>
<th>Leader</th>
</tr>\n";
</tr></thead>\n";
foreach ($groups as $group) {
$gid = $group->gid();
......@@ -844,6 +845,10 @@ class Project
</tr>\n";
}
echo "</table>\n";
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('grouplist'));
</script>\n";
}
function ShowStats() {
......
......@@ -11,10 +11,6 @@ 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.
......
......@@ -11,10 +11,6 @@ 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.
......
......@@ -11,10 +11,6 @@ include("defs.php3");
#
PAGEHEADER("Project Information List");
# Sorttable.js
echo "<script type='text/javascript' language='javascript'
src='sorttable.js'></script>\n";
#
# Only known and logged in users can do this.
#
......
......@@ -158,7 +158,6 @@ function SHOWNODES($pid, $eid, $sortby, $showclass) {
if (mysql_num_rows($query_result)) {
echo "
<script type='text/javascript' language='javascript' src='sorttable.js'></script>
<center>
<br>
<a href=" . $_SERVER["REQUEST_URI"] . "#reserved_nodes>
......
......@@ -30,15 +30,11 @@ if (! $isadmin) {
# Verify Page Arguments.
#
$optargs = OptionalPageArguments("showtype", PAGEARG_STRING,
"sortby", PAGEARG_STRING,
"searchfor", PAGEARG_STRING);
if (!isset($showtype)) {
$showtype='loggedin';
}
if (!isset($sortby)) {
$sortby = "uid";
}
if (!isset($searchfor)) {
$searchfor = "";
}
......@@ -62,7 +58,6 @@ echo "<form action=showuser_list.php3 method=post>
size=20
maxlength=50>
<input type=hidden name=showtype value=\"$showtype\">
<input type=hidden name=sortby value=\"$sortby\">
<b><input type=submit name=search value=Search></b>\n";
echo "<br><br>\n";
......@@ -121,18 +116,6 @@ else {
$showtag = "";
}
if (! strcmp($sortby, "name"))
$order = "u.usr_name";
elseif (! strcmp($sortby, "uid"))
$order = "u.uid";
elseif (! strcmp($sortby, "widle"))
$order = "webidle DESC";
elseif (! strcmp($sortby, "uidle"))
$order = "usersidle DESC";
else {
$order = "u.uid";
}
$query_result =
DBQueryFatal("SELECT " . ($dorecent ? "distinct" : "") . " u.*, ".
" IF(ll.weblogin_last, ".
......@@ -145,7 +128,7 @@ $query_result =
"left join userslastlogin as ull on u.uid=ull.uid ".
"left join user_stats as ll on u.unix_uid=ll.uid_idx ".
"$where ".
"order by $order");
"order by u.uid");
if (($count = mysql_num_rows($query_result)) == 0) {
USERERROR("There are no users!", 1);
......@@ -176,31 +159,25 @@ while ($row = mysql_fetch_array($projmemb_result)) {
$projmemb_array[$uid][] = $foo;
}
echo "<table width=\"100%\" border=2 cellpadding=1 cellspacing=2
align='center'>\n";
echo "<table width=\"100%\" border=2 cellpadding=1 cellspacing=2
id='userlist' align='center'>\n";
echo "<thead class='sort'>";
echo "<tr>
<th>&nbsp</th>
<th><a href='showuser_list.php3?showtype=$showtype&sortby=uid".
"&searchfor=$searchfor'>
UID</a></th>
<th><a href='showuser_list.php3?showtype=$showtype&sortby=name".
"&searchfor=$searchfor'>
Name</a></th>
<th>UID</th>
<th>Name</th>
<th>Projects</th>\n";
if (! strcmp($showtype, "inactive")) {
echo "<th>Status</th>\n";
}
echo " <th><a href='showuser_list.php3?showtype=$showtype&sortby=widle".
"&searchfor=$searchfor'>
Web<br>Idle</a></th>
<th><a href='showuser_list.php3?showtype=$showtype&sortby=uidle".
"&searchfor=$searchfor'>
Users<br>Idle</a></th>\n";
echo " <th>Web<br>Idle</th>
<th>Users<br>Idle</th>\n";
echo "</tr>\n";
echo "</thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$thisuid = $row["uid"];
......@@ -269,6 +246,10 @@ while ($row = mysql_fetch_array($query_result)) {
}
echo "</table>\n";
echo "<script type='text/javascript' language='javascript'>
sorttable.makeSortable(getObjbyName('userlist'));
</script>\n";
#
# Standard Testbed Footer
#
......
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