Commit 016af599 authored by Leigh Stoller's avatar Leigh Stoller

Better cross linking of slices to experiments.

parent 2fd5107a
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006-2009 University of Utah and the Flux Group.
# Copyright (c) 2006-2010 University of Utah and the Flux Group.
# All rights reserved.
#
#
......@@ -1078,17 +1078,44 @@ class Experiment
echo " </td>
</tr>\n";
}
if (!$short && ISADMIN() && $this->geniflags()) {
$slice = GeniSlice::Lookup("geni-cm", $uuid);
if ($slice) {
$slice_hrn = $slice->hrn();
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "cm");
if (!$short && ISADMIN()) {
if ($this->geniflags()) {
$slice = GeniSlice::Lookup("geni-cm", $uuid);
echo "<tr>
<td>Geni Slice: </td>
if ($slice) {
$slice_hrn = $slice->hrn();
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "cm");
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\"><a href='$url'>$slice_hrn</a></td>
</tr>\n";
}
}
else {
$slice = GeniSlice::LookupByExperiment("geni-sa", $this);
if ($slice) {
$slice_hrn = $slice->hrn();
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "sa");
echo "<tr>
<td>Geni Slice (SA): </td>
<td class=\"left\"><a href='$url'>$slice_hrn</a></td>
</tr>\n";
$slice = GeniSlice::Lookup("geni-cm", $slice_hrn);
if ($slice) {
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "cm");
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\"><a href='$url'>$slice_hrn</a></td>
</tr>\n";
}
}
}
}
echo "</table>\n";
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006-2009 University of Utah and the Flux Group.
# Copyright (c) 2006-2010 University of Utah and the Flux Group.
# All rights reserved.
#
#
......@@ -10,7 +10,7 @@ function GetDBLink($authority)
if ($authority == "cm")
$authority = "geni-cm";
if ($authority == "sa")
if ($authority == "sa" || $authority == "geni-sa")
$authority = "geni";
if ($authority == "ch")
......@@ -140,6 +140,26 @@ class GeniSlice
return $result;
}
function LookupByExperiment($authority, $experiment) {
$dblink = GetDBLink($authority);
$exptidx = $experiment->idx();
if (! $dblink) {
return null;
}
$query_result =
DBQueryFatal("select idx from geni_slices ".
"where exptidx=$exptidx",
$dblink);
if (! ($query_result && mysql_num_rows($query_result))) {
return null;
}
$row = mysql_fetch_row($query_result);
$idx = $row[0];
return GeniSlice::Lookup($authority, $idx);
}
function GetManifest() {
$slice_uuid = $this->uuid();
......
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