uid();
$isadmin = ISADMIN();
#
# Verify Page Arguments.
#
$optargs = OptionalPageArguments("showtype", PAGEARG_STRING);
$showtypes = array();
if (!isset($showtype)) {
$showtypes[] = "cm";
$showtypes[] = "sa";
$showtypes[] = "ch";
}
else {
if (! ($showtype == "sa"|| $showtype == "cm" || $showtype == "ch")) {
USERERROR("Improper argument: showtype=$showtype", 1);
}
$showtypes[] = $showtype;
}
#
# Standard Testbed Header
#
PAGEHEADER("Geni Slice List");
if (! $isadmin) {
USERERROR("You do not have permission to view Geni slice list!", 1);
}
foreach ($showtypes as $type) {
$slicelist = GeniSlice::AllSlices($type);
$which = ($type == "cm" ? "Component Manager" :
($type == "sa" ? "Slice Authority" : "Clearing House"));
if (!$slicelist || !count($slicelist))
continue;
# The form attributes:
$table = array('#id' => $type,
'#title' => $which);
$rows = array();
foreach ($slicelist as $slice) {
$slice_idx = $slice->idx();
$slice_hrn = $slice->hrn();
$url = CreateURL("showslice", "showtype", $type,
"slice_idx", $slice_idx);
$href = "$slice_hrn";
$experiment = Experiment::LookupByUUID($slice->uuid());
if ($experiment) {
$eid = $experiment->eid();
$expurl = CreateURL("showexp", $experiment);
$href = "$href ($eid)";
}
$rows[$slice_idx] = array($slice_idx => $href);
}
list ($html, $button) = TableRender($table, $rows);
echo $html;
}
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>