moteleds.php3 2.52 KB
Newer Older
1 2
<?php
#
3
# Copyright (c) 2004-2013 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
23 24 25 26 27 28 29 30
#

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

#
# Make sure they are logged in
#
31 32 33
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
34 35 36

#
# Verify page arguments.
37 38
#
$reqargs = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT);
39

40 41 42
# Need these below
$pid = $experiment->pid();
$eid = $experiment->eid();
43

44 45 46 47 48 49 50 51 52
#
# Define a stripped-down view of the web interface - less clutter
#
$view = array(
    'hide_banner' => 1,
    'hide_sidebar' => 1,
    'hide_copyright' => 1
);

53 54 55
#
# Standard Testbed Header now that we have the pid/eid okay.
#
56
PAGEHEADER("Mote LEDs ($pid/$eid)",$view);
57 58 59 60

#
# Make sure they have permission to view this experiment
#
61 62
if (!$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment $eid!", 1);
63 64 65 66 67 68
}

#
# Get a list of all nodes in this experiment of type 'garcia' or 'stargate'
#
$query_result =
Timothy Stack's avatar
Timothy Stack committed
69 70 71 72 73 74 75
    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");

76
if (mysql_num_rows($query_result) == 0) {
77
   echo "<h3>No nodes to display in this experiment!</h3>\n";
78 79
}
else {
80 81
    echo "<table align=center cellpadding=2 border=1>
	  <tr><th>Mote</th><th>Phys Name</th><th>LEDs</th>\n";
82
    while ($row = mysql_fetch_array($query_result)) {
83 84 85 86 87
	$vname = $row["vname"];
	$pnode = $row["phys_nodeid"];
	
	echo "<tr><th>$vname</th>";
	echo "<td>$pnode</td><td>";
88
	SHOWBLINKENLICHTEN($uid,
89
			   $_COOKIE[$TBAUTHCOOKIE],
90
			   CreateURL("ledpipe", $pnode));
91 92 93 94 95 96 97 98
    }
    echo "</table>\n";

}

#
# Standard Testbed Footer
# 
99
PAGEFOOTER($view);
100 101

?>