moteleds.php3 1.85 KB
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2004, 2005, 2006, 2007 University of Utah and the Flux Group.
5 6 7 8 9 10 11 12 13
# All rights reserved.
#

include("defs.php3");
include("showstuff.php3");

#
# Make sure they are logged in
#
14 15 16
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
17 18 19

#
# Verify page arguments.
20 21
#
$reqargs = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT);
22

23 24 25
# Need these below
$pid = $experiment->pid();
$eid = $experiment->eid();
26

27 28 29 30 31 32 33 34 35
#
# Define a stripped-down view of the web interface - less clutter
#
$view = array(
    'hide_banner' => 1,
    'hide_sidebar' => 1,
    'hide_copyright' => 1
);

36 37 38
#
# Standard Testbed Header now that we have the pid/eid okay.
#
39
PAGEHEADER("Mote LEDs ($pid/$eid)",$view);
40 41 42 43

#
# Make sure they have permission to view this experiment
#
44 45
if (!$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment $eid!", 1);
46 47 48 49 50 51
}

#
# Get a list of all nodes in this experiment of type 'garcia' or 'stargate'
#
$query_result =
52 53 54 55 56 57 58
    DBQueryFatal("select r.vname,n.phys_nodeid ".
		 "from reserved as r ".
		 "left join nodes as n on r.node_id=n.node_id ".
		 "left join node_types as t on n.type=t.type ".
		 "where r.pid='$pid' and r.eid='$eid' and t.class='mote' ".
		 "order by r.vname");

59
if (mysql_num_rows($query_result) == 0) {
60
   echo "<h3>No nodes to display in this experiment!</h3>\n";
61 62
}
else {
63 64
    echo "<table align=center cellpadding=2 border=1>
	  <tr><th>Mote</th><th>Phys Name</th><th>LEDs</th>\n";
65
    while ($row = mysql_fetch_array($query_result)) {
66 67 68 69 70
	$vname = $row["vname"];
	$pnode = $row["phys_nodeid"];
	
	echo "<tr><th>$vname</th>";
	echo "<td>$pnode</td><td>";
71
	SHOWBLINKENLICHTEN($uid,
72
			   $HTTP_COOKIE_VARS[$TBAUTHCOOKIE],
73
			   CreateURL("ledpipe", $pnode));
74 75 76 77 78 79 80 81
    }
    echo "</table>\n";

}

#
# Standard Testbed Footer
# 
82
PAGEFOOTER($view);
83 84

?>