function linkmgmt_renderObjectLinks($object_id) { $object = spotEntity('object', $object_id); $object['attr'] = getAttrValues($object_id); /* get ports */ /* calls getObjectPortsAndLinks */ amplifyCell($object); //$ports = getObjectPortsAndLinks($object_id); $ports = $object['ports']; /* reindex array so key starts at 0 */ $ports = array_values($ports); /* URL param handling */ if (isset($_GET['allports'])) { $allports = $_GET['allports']; } else { $allports = FALSE; } if (isset($_GET['allback'])) { $allback = $_GET['allback']; } else { $allback = FALSE; } echo '<table><tr>'; if ($allports) { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allports', '0', '0')) . '">Hide Ports without link</a></td>'; } else { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allports', '1', '0')) . '">Show All Ports</a></td>'; } echo '<td width=200><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'PortLinkDialog', 'linktype' => 'back', 'byname' => '1'))) . '","name","height=700,width=800,scrollbars=yes");><a>Link Object Ports by Name</a></span></td>'; if ($allback) { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allback', '0', '0')) . '">Collapse Backend Links on same Object</a></td>'; } else { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allback', '1', '0')) . '">Expand Backend Links on same Object</a></td>'; } /* Graphviz map */ echo '<td width=100><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'map', 'usemap' => 1))) . '","name","height=800,width=800,scrollbars=yes");><a>Object Map</a></span></td>'; /* cytoscape map */ echo '<td width=100><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'cytoscapemap'))) . '","name","height=800,width=800,scrollbars=yes");><a>Cytoscape Object Map</a></span></td>'; /* Help */ echo '<td width=200><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'Help'))) . '","name","height=400,width=500");><a>Help</a></span></td>'; if (isset($_REQUEST['hl_port_id'])) { $hl_port_id = $_REQUEST['hl_port_id']; } else { $hl_port_id = NULL; } echo '</tr></table>'; echo '<br><br><table id=renderobjectlinks0>'; /* switch display order depending on backend links */ $first = portlist::hasbackend($object_id); $rowcount = 0; foreach ($ports as $key => $port) { $lc = new lm_linkchain($port['id']); if ($allports || $lc->linkcount > 0) { if ($port['id'] == $hl_port_id) { $rowbgcolor = lm_linkchain::HL_PORT_BGCOLOR; } else { $rowbgcolor = $rowcount % 2 ? lm_linkchain::ALTERNATE_ROW_BGCOLOR : "#ffffff"; } echo $lc->getchainlabeltrstart($rowbgcolor) . $lc->getchainrow($allback, $rowbgcolor) . "</tr>"; $rowcount++; } } echo "</table>"; }
function linkmgmt_renderObjectLinks($object_id) { $object = spotEntity('object', $object_id); $object['attr'] = getAttrValues($object_id); /* get ports */ /* calls getObjectPortsAndLinks */ amplifyCell($object); //$ports = getObjectPortsAndLinks($object_id); $ports = $object['ports']; /* reindex array so key starts at 0 */ $ports = array_values($ports); /* URL param handling */ if (isset($_GET['allports'])) { $allports = $_GET['allports']; } else { $allports = FALSE; } if (isset($_GET['allback'])) { $allback = $_GET['allback']; } else { $allback = FALSE; } echo '<table><tr>'; if ($allports) { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allports', '0', '0')) . '">Hide Ports without link</a></td>'; } else { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allports', '1', '0')) . '">Show All Ports</a></td>'; } echo '<td width=200><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'PortLinkDialog', 'linktype' => 'back', 'byname' => '1'))) . '","name","height=700,width=800,scrollbars=yes");><a>Link Object Ports by Name</a></span></td>'; if ($allback) { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allback', '0', '0')) . '">Collapse Backend Links on same Object</a></td>'; } else { echo '<td width=200><a href="' . makeHref(portlist::urlparams('allback', '1', '0')) . '">Expand Backend Links on same Object</a></td>'; } /* Graphviz map */ echo '<td width=100><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'map', 'usemap' => 1))) . '","name","height=800,width=800,scrollbars=yes");><a>Object Map</a></span></td>'; /* Help */ echo '<td width=200><span onclick=window.open("' . makeHrefProcess(portlist::urlparamsarray(array('op' => 'Help'))) . '","name","height=400,width=500");><a>Help</a></span></td>'; if (isset($_REQUEST['hl_port_id'])) { $hl_port_id = $_REQUEST['hl_port_id']; } else { $hl_port_id = NULL; } echo '</tr></table>'; echo '<br><br><table id=renderobjectlinks0>'; /* switch display order depending on backend links */ $first = portlist::hasbackend($object_id); $rowcount = 0; foreach ($ports as $key => $port) { $plist = new portlist($port, $object_id, $allports, $allback); //echo "<td><img src=\"index.php?module=redirect&page=object&tab=linkmgmt&op=map&object_id=$object_id&port_id=${port['id']}&allports=$allports\" ></td>"; if ($plist->printportlistrow($first, $hl_port_id, $rowcount % 2 ? portlist::ALTERNATE_ROW_BGCOLOR : "#ffffff")) { $rowcount++; } } echo "</table>"; }