}
}
-// This is a popular helper.
-function getObjectInfo ($object_id = 0, $set_dname = TRUE)
-{
- $query =
- "select RackObject.id as id, RackObject.name as name, label, barcode, dict_value as objtype_name, asset_no, dict_key as objtype_id, has_problems, comment from " .
- "RackObject inner join Dictionary on objtype_id = dict_key join Chapter on Chapter.id = Dictionary.chapter_id " .
- "where RackObject.id = '${object_id}' and Chapter.name = 'RackObjectType'";
- $result = useSelectBlade ($query, __FUNCTION__);
- if (($ret = $result->fetch (PDO::FETCH_ASSOC)) == NULL)
- {
- showError ('Query succeeded, but returned no data', __FUNCTION__);
- return NULL;
- }
- $result->closeCursor();
- // It's safe now to run subsequent queries.
- if ($set_dname)
- $ret['dname'] = displayedName ($ret);
- return $ret;
-}
-
function getPortTypes ()
{
return readChapter ('PortType');
// only call displayedName() when necessary
if (empty ($ret[$tmpkey]['remote_object_name']) and !empty ($ret[$tmpkey]['remote_object_id']))
{
- $oi = getObjectInfo ($ret[$tmpkey]['remote_object_id']);
+ $oi = spotEntity ('object', $ret[$tmpkey]['remote_object_id']);
$ret[$tmpkey]['remote_object_name'] = $oi['dname'];
}
}
switch ($state)
{
case 'T':
- $objectData = getObjectInfo ($rackData[$i][$locidx]['object_id']);
+ $objectData = spotEntity ('object', $rackData[$i][$locidx]['object_id']);
if (!empty ($objectData['asset_no']))
$prefix = "<div title='${objectData['asset_no']}";
else
function renderEditObjectForm ($object_id)
{
global $pageno;
- $object = getObjectInfo ($object_id);
+ $object = spotEntity ('object', $object_id);
if ($object == NULL)
{
- showError ('getObjectInfo() failed', __FUNCTION__);
+ showError ('Error retrieving data', __FUNCTION__);
return;
}
startPortlet ();
function renderRackObject ($object_id)
{
global $nextorder, $aac;
- $info = getObjectInfo ($object_id);
+ $info = spotEntity ('object', $object_id);
+ // FIXME: employ amplifyCell() instead of calling loader functions directly
+ #amplifyCell ($info);
if ($info == NULL)
{
- showError ('getObjectInfo() failed', __FUNCTION__);
+ showError ('Error loading data', __FUNCTION__);
return;
}
// Main layout starts.
function renderRackSpaceForObject ($object_id)
{
$is_update = isset ($_REQUEST['rackmulti'][0]);
- $info = getObjectInfo ($object_id);
+ $info = spotEntity ('object', $object_id);
if ($info == NULL)
{
- showError ('getObjectInfo() failed', __FUNCTION__);
+ showError ('Error loading data', __FUNCTION__);
return;
}
// Always process occupied racks plus racks chosen by user. First get racks with
foreach (array_keys ($vipdata['lblist']) as $lb_object_id)
if (!in_array ($lb_object_id, $lblist))
{
- $oi = getObjectInfo ($lb_object_id);
+ $oi = spotEntity ('object', $lb_object_id);
$lbdname[$lb_object_id] = $oi['dname'];
$lblist[] = $lb_object_id;
}
echo "</td></tr></form>";
}
- $info = getObjectInfo ($object_id);
$forwards = getNATv4ForObject ($object_id);
$alloclist = getObjectIPv4Allocations ($object_id);
echo "<center><h2>locally performed NAT</h2></center>";
global $nextorder;
echo "<table class=widetable border=0 cellpadding=10 cellspacing=0 align=center>\n";
echo "<tr><th>Object</th><th>RS pools configured</th></tr>";
- $oicache = array();
$order = 'odd';
foreach (getLBList() as $object_id => $poolcount)
{
- if (!isset ($oicache[$object_id]))
- $oicache[$object_id] = getObjectInfo ($object_id);
+ $oi = spotEntity ('object', $object_id);
echo "<tr valign=top class=row_${order}><td><a href='".makeHref(array('page'=>'object', 'object_id'=>$object_id))."'>";
- echo $oicache[$object_id]['dname'] . '</a></td>';
+ echo $oi['dname'] . '</a></td>';
echo "<td>${poolcount}</td></tr>";
$order = $nextorder[$order];
}
function renderAutoPortsForm ($object_id)
{
- $info = getObjectInfo ($object_id);
+ $info = spotEntity ('object', $object_id);
$ptlist = readChapter ('PortType');
echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center'>\n";
echo "<caption>The following ports can be quickly added:</caption>";
function renderLBCell ($object_id)
{
global $root;
- $oi = getObjectInfo ($object_id);
+ $oi = spotEntity ('object', $object_id);
echo "<table class=slbcell><tr><td>";
echo "<a href='${root}?page=object&object_id=${object_id}'>${oi['dname']}</a>";
echo "</td></tr><tr><td>";
printImageHREF ('LB');
- echo "</td></tr><tr><td><small>";
- echo serializeTags (loadEntityTags ('object', $object_id));
- echo "</small></td></tr></table>";
+ echo "</td></tr><tr><td>";
+ if (count ($oi['etags']))
+ echo '<small>' . serializeTags ($oi['etags']) . '</small>';
+ echo "</td></tr></table>";
}
function renderRouterCell ($dottedquad, $ifname, $object_id, $object_dname)
);
case 'object':
assertUIntArg ('object_id', __FUNCTION__);
- $object = getObjectInfo ($_REQUEST['object_id']);
+ $object = spotEntity ('object', $_REQUEST['object_id']);
if ($object == NULL)
return array
(