本文整理汇总了PHP中amplifyCell函数的典型用法代码示例。如果您正苦于以下问题:PHP amplifyCell函数的具体用法?PHP amplifyCell怎么用?PHP amplifyCell使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了amplifyCell函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trigger_autoports
function trigger_autoports()
{
$object = spotEntity('object', getBypassValue());
amplifyCell($object);
if (count($object['ports'])) {
return '';
}
return count(getAutoPorts($object['objtype_id'])) ? 'attn' : '';
}
示例2: formatPortLinkHints
function formatPortLinkHints($object_id)
{
$result = array();
$linkStatus = queryDevice($object_id, 'getportstatus');
foreach ($linkStatus as $portname => $link_info) {
$link_info = $linkStatus[$portname];
switch ($link_info['status']) {
case 'up':
$img_filename = 'link-up.png';
break;
case 'down':
$img_filename = 'link-down.png';
break;
case 'disabled':
$img_filename = 'link-disabled.png';
break;
}
$hidden_lines = array();
$hidden_lines[] = $portname . ': ' . $link_info['status'];
if (isset($link_info['speed'])) {
$hidden_lines[] = 'Speed: ' . $link_info['speed'];
}
if (isset($link_info['duplex'])) {
$hidden_lines[] = 'Duplex: ' . $link_info['duplex'];
}
if (count($hidden_lines)) {
$result[$portname]['popup'] = implode('<br>', $hidden_lines);
}
$visible_part = "<img width=16 height=16 src='?module=chrome&uri=pix/{$img_filename}'>";
$result[$portname]['inline'] = $visible_part;
}
// put empty pictures for not-found ports
$object = spotEntity('object', $object_id);
amplifyCell($object);
foreach ($object['ports'] as $port) {
if (!isset($result[$port['name']])) {
$result[$port['name']]['inline'] = "<img width=16 height=16 src='?module=chrome&uri=pix/1x1t.gif'>";
}
}
return $result;
}
示例3: initRackTablesObject
function initRackTablesObject($rackDatas)
{
// zabbix host data
$params = array('output' => 'extend');
$result = doPost('host.get', $params);
$hosts = isset($result['result']) ? $result['result'] : array();
$objectDatas = array();
foreach ($hosts as $host) {
$object_type_id = 4;
$object_name = isset($host['host']) ? $host['host'] : "";
$object_label = "";
$object_asset_no = "";
$taglist = array();
$has_problems = $host['status'] == 0 ? 'no' : 'yes';
$object_id = commitAddObject($object_name, $object_label, $object_type_id, $object_asset_no, $taglist);
usePreparedUpdateBlade('Object', array('has_problems' => $has_problems), array('id' => $object_id));
$objectDatas[$host['hostid']] = $object_id;
// set hostgroup
$params = array('output' => array('name'), 'hostids' => array($host['hostid']));
$result = doPost('hostgroup.get', $params);
$hostgroups = isset($result['result']) ? $result['result'] : array();
$rack_ids = array();
$_REQUEST = array();
foreach ($hostgroups as $hostgroup) {
if (isset($rackDatas[$hostgroup['name']])) {
$rack = $rackDatas[$hostgroup['name']];
amplifyCell($rack);
array_push($rack_ids, $rack['id']);
$height = $rack['height'];
for ($i = 0; $i < 3; $i++) {
for ($j = $height; $j > 0; $j--) {
if ($rack[$j][$i]['state'] == 'F') {
# state == "T" : mounted
$_REQUEST['atom_' . $rack['id'] . "_{$j}" . "_{$i}"] = 'on';
break 2;
}
}
}
}
}
$_REQUEST['object_id'] = $object_id;
$_REQUEST['rackmulti'] = $rack_ids;
$object = spotEntity('object', $object_id);
$changecnt = 0;
// Get a list of rack ids which are parents of the object
$parentRacks = reduceSubarraysToColumn(getParents($object, 'rack'), 'id');
$workingRacksData = array();
foreach ($_REQUEST['rackmulti'] as $cand_id) {
if (!isset($workingRacksData[$cand_id])) {
$rackData = spotEntity('rack', $cand_id);
amplifyCell($rackData);
$workingRacksData[$cand_id] = $rackData;
} else {
$rackData = $workingRacksData[$cand_id];
}
$is_ro = !rackModificationPermitted($rackData, 'updateObjectAllocation', FALSE);
// It's zero-U mounted to this rack on the form, but not in the DB. Mount it.
if (isset($_REQUEST["zerou_{$cand_id}"]) && !in_array($cand_id, $parentRacks)) {
if ($is_ro) {
continue;
}
$changecnt++;
commitLinkEntities('rack', $cand_id, 'object', $object_id);
}
// It's not zero-U mounted to this rack on the form, but it is in the DB. Unmount it.
if (!isset($_REQUEST["zerou_{$cand_id}"]) && in_array($cand_id, $parentRacks)) {
if ($is_ro) {
continue;
}
$changecnt++;
commitUnlinkEntities('rack', $cand_id, 'object', $object_id);
}
}
foreach ($workingRacksData as &$rd) {
applyObjectMountMask($rd, $object_id);
}
$oldMolecule = getMoleculeForObject($object_id);
foreach ($workingRacksData as $rack_id => $rackData) {
$is_ro = !rackModificationPermitted($rackData, 'updateObjectAllocation', FALSE);
if ($is_ro || !processGridForm($rackData, 'F', 'T', $object_id)) {
continue;
}
$changecnt++;
// Reload our working copy after form processing.
$rackData = spotEntity('rack', $cand_id);
amplifyCell($rackData);
applyObjectMountMask($rackData, $object_id);
$workingRacksData[$rack_id] = $rackData;
}
if ($changecnt) {
// Log a record.
$newMolecule = getMoleculeForObject($object_id);
global $remote_username, $sic;
usePreparedInsertBlade('MountOperation', array('object_id' => $object_id, 'old_molecule_id' => count($oldMolecule) ? createMolecule($oldMolecule) : NULL, 'new_molecule_id' => count($newMolecule) ? createMolecule($newMolecule) : NULL, 'user_name' => $remote_username, 'comment' => empty($sic['comment']) ? NULL : $sic['comment']));
}
// set IP
$params = array('output' => 'extend', 'hostids' => $host['hostid']);
$result = doPost('hostinterface.get', $params);
$hostinterfaces = isset($result['result']) ? $result['result'] : array();
foreach ($hostinterfaces as $interface) {
//.........这里部分代码省略.........
示例4: renderDiscoveredNeighbors
function renderDiscoveredNeighbors($object_id)
{
global $tabno;
$opcode_by_tabno = array('livecdp' => 'getcdpstatus', 'livelldp' => 'getlldpstatus');
try {
$neighbors = queryDevice($object_id, $opcode_by_tabno[$tabno]);
$neighbors = sortPortList($neighbors);
} catch (RTGatewayError $e) {
showError($e->getMessage());
return;
}
$mydevice = spotEntity('object', $object_id);
amplifyCell($mydevice);
// reindex by port name
$myports = array();
foreach ($mydevice['ports'] as $port) {
if (mb_strlen($port['name'])) {
$myports[$port['name']][] = $port;
}
}
// scroll to selected port
if (isset($_REQUEST['hl_port_id'])) {
assertUIntArg('hl_port_id');
$hl_port_id = intval($_REQUEST['hl_port_id']);
addAutoScrollScript("port-{$hl_port_id}");
}
switchportInfoJS($object_id);
// load JS code to make portnames interactive
printOpFormIntro('importDPData');
echo '<br><table cellspacing=0 cellpadding=5 align=center class=widetable>';
echo '<tr><th colspan=2>local port</th><th></th><th>remote device</th><th colspan=2>remote port</th><th><input type="checkbox" checked id="cb-toggle"></th></tr>';
$inputno = 0;
foreach ($neighbors as $local_port => $remote_list) {
$initial_row = TRUE;
// if port has multiple neighbors, the first table row is initial
// array of local ports with the name specified by DP
$local_ports = isset($myports[$local_port]) ? $myports[$local_port] : array();
foreach ($remote_list as $dp_neighbor) {
$error_message = NULL;
$link_matches = FALSE;
$portinfo_local = NULL;
$portinfo_remote = NULL;
$variants = array();
do {
// once-cyle fake loop used only to break out of it
if (!empty($local_ports)) {
$portinfo_local = $local_ports[0];
}
// find remote object by DP information
$dp_remote_object_id = searchByMgmtHostname($dp_neighbor['device']);
if (!$dp_remote_object_id) {
$dp_remote_object_id = lookupEntityByString('object', $dp_neighbor['device']);
}
if (!$dp_remote_object_id) {
$error_message = "No such neighbor <i>{$dp_neighbor['device']}</i>";
break;
}
$dp_remote_object = spotEntity('object', $dp_remote_object_id);
amplifyCell($dp_remote_object);
$dp_neighbor['port'] = shortenIfName($dp_neighbor['port'], NULL, $dp_remote_object['id']);
// get list of ports that have name matching CDP portname
$remote_ports = array();
// list of remote (by DP info) ports
foreach ($dp_remote_object['ports'] as $port) {
if ($port['name'] == $dp_neighbor['port']) {
$portinfo_remote = $port;
$remote_ports[] = $port;
}
}
// check if ports with such names exist on devices
if (empty($local_ports)) {
$error_message = "No such local port <i>{$local_port}</i>";
break;
}
if (empty($remote_ports)) {
$error_message = "No such port on " . formatPortLink($dp_remote_object['id'], $dp_remote_object['name'], NULL, NULL);
break;
}
// determine match or mismatch of local link
foreach ($local_ports as $portinfo_local) {
if ($portinfo_local['remote_id']) {
if ($portinfo_local['remote_object_id'] == $dp_remote_object_id and $portinfo_local['remote_name'] == $dp_neighbor['port']) {
// set $portinfo_remote to corresponding remote port
foreach ($remote_ports as $portinfo_remote) {
if ($portinfo_remote['id'] == $portinfo_local['remote_id']) {
break;
}
}
$link_matches = TRUE;
unset($error_message);
} elseif ($portinfo_local['remote_object_id'] != $dp_remote_object_id) {
$error_message = "Remote device mismatch - port linked to " . formatLinkedPort($portinfo_local);
} else {
// ($portinfo_local['remote_name'] != $dp_neighbor['port'])
$error_message = "Remote port mismatch - port linked to " . formatPortLink($portinfo_local['remote_object_id'], NULL, $portinfo_local['remote_id'], $portinfo_local['remote_name']);
}
break 2;
}
}
// no local links found, try to search for remote links
//.........这里部分代码省略.........
示例5: renderSLBFormAJAX
function renderSLBFormAJAX()
{
global $pageno, $tabno;
parse_str(assertStringArg('form'), $orig_request);
parse_str(ltrim(assertStringArg('action'), '?'), $action);
$pageno = $action['page'];
$tabno = $action['tab'];
printOpFormIntro($action['op'], $orig_request);
$realm_list = array_diff(array('ipvs', 'object', 'ipv4rspool'), array($pageno));
echo '<table align=center><tr class="tdleft">';
foreach ($realm_list as $realm) {
switch ($realm) {
case 'object':
$slb_cell = spotEntity('object', $orig_request['object_id']);
break;
case 'ipv4rspool':
$slb_cell = spotEntity('ipv4rspool', $orig_request['rspool_id']);
break;
case 'ipvs':
$slb_cell = spotEntity('ipvs', $orig_request['vs_id']);
break;
}
echo '<td>';
renderSLBEntityCell($slb_cell);
echo '</td>';
}
$vsinfo = spotEntity('ipvs', $orig_request['vs_id']);
amplifyCell($vsinfo);
echo '<td><ul style="list-style: none">';
foreach ($vsinfo['ports'] as $port) {
$key = $port['proto'] . '-' . $port['vport'];
echo '<li><label><input type=checkbox name="enabled_ports[]" value="' . htmlspecialchars($key, ENT_QUOTES) . '" checked>' . formatVSPort($port) . '</label></li>';
}
echo '</ul></td>';
echo '<td><ul style="list-style: none">';
foreach ($vsinfo['vips'] as $vip) {
$key = ip_format($vip['vip']);
echo '<li><label><input type=checkbox name="enabled_vips[]" value="' . htmlspecialchars($key, ENT_QUOTES) . '" checked>' . $key . '</label></li>';
}
echo '</ul></td>';
echo '<td>';
printImageHREF('ADD', 'Configure LB', TRUE);
echo '</td>';
echo '</tr></table>';
echo '</form>';
}
示例6: printRackThumbImage
function printRackThumbImage($rack_id, $scale = 1)
{
$rackData = spotEntity('rack', $rack_id);
amplifyCell($rackData);
global $rtwidth;
$offset[0] = 3;
$offset[1] = 3 + $rtwidth[0];
$offset[2] = 3 + $rtwidth[0] + $rtwidth[1];
$totalheight = 3 + 3 + $rackData['height'] * 2;
$totalwidth = $offset[2] + $rtwidth[2] + 3;
$img = createTrueColorOrThrow('rack_php_gd_error', $totalwidth, $totalheight);
# It was measured, that caching palette in an array is faster, than
# calling colorFromHex() multiple times. It matters, when user's
# browser is trying to fetch many minirack images in parallel.
$color = array('F' => colorFromHex($img, '8fbfbf'), 'A' => colorFromHex($img, 'bfbfbf'), 'U' => colorFromHex($img, 'bf8f8f'), 'T' => colorFromHex($img, '408080'), 'Th' => colorFromHex($img, '80ffff'), 'Tw' => colorFromHex($img, '804040'), 'Thw' => colorFromHex($img, 'ff8080'), 'black' => colorFromHex($img, '000000'), 'gray' => colorFromHex($img, 'c0c0c0'));
$border_color = $rackData['has_problems'] == 'yes' ? $color['Thw'] : $color['gray'];
imagerectangle($img, 0, 0, $totalwidth - 1, $totalheight - 1, $color['black']);
imagerectangle($img, 1, 1, $totalwidth - 2, $totalheight - 2, $border_color);
imagerectangle($img, 2, 2, $totalwidth - 3, $totalheight - 3, $color['black']);
for ($unit_no = 1; $unit_no <= $rackData['height']; $unit_no++) {
for ($locidx = 0; $locidx < 3; $locidx++) {
$colorcode = $rackData[$unit_no][$locidx]['state'];
if (isset($rackData[$unit_no][$locidx]['hl'])) {
$colorcode = $colorcode . $rackData[$unit_no][$locidx]['hl'];
}
imagerectangle($img, $offset[$locidx], 3 + ($rackData['height'] - $unit_no) * 2, $offset[$locidx] + $rtwidth[$locidx] - 1, 3 + ($rackData['height'] - $unit_no) * 2 + 1, $color[$colorcode]);
}
}
if ($scale > 1) {
$resized = imagecreate($totalwidth * $scale, $totalheight * $scale);
imagecopyresized($resized, $img, 0, 0, 0, 0, $totalwidth * $scale, $totalheight * $scale, $totalwidth, $totalheight);
imagedestroy($img);
$img = $resized;
}
imagepng($img);
imagedestroy($img);
}
示例7: redirectUser
redirectUser($_SERVER['SCRIPT_NAME'] . "?method=get_depot");
break;
// get all objects
// UI equivalent: /index.php?page=depot&tab=default
// UI handler: renderDepot()
// get all objects
// UI equivalent: /index.php?page=depot&tab=default
// UI handler: renderDepot()
case 'get_depot':
require_once 'inc/init.php';
$cellfilter = getCellFilter();
$objects = filterCellList(listCells('object'), $cellfilter['expression']);
// get details if requested
if (isset($_REQUEST['include_attrs'])) {
foreach ($objects as $object_id => $object) {
amplifyCell($object);
// return the attributes in an array keyed on 'name', unless otherwise requested
$key_attrs_on = 'name';
if (isset($_REQUEST['key_attrs_on'])) {
$key_attrs_on = $_REQUEST['key_attrs_on'];
}
$attrs = array();
foreach (getAttrValues($object_id) as $record) {
// check that the key exists for this record
if (!isset($record[$key_attrs_on])) {
throw new InvalidRequestArgException('key_attrs_on', $_REQUEST['key_attrs_on'], 'requested keying value not set for all attributes');
}
if (strlen($record['value'])) {
$attrs[$record[$key_attrs_on]] = $record;
}
}
示例8: getVSIDsByGroup
function getVSIDsByGroup($group_id)
{
$ret = array();
$vsinfo = spotEntity('ipvs', $group_id);
amplifyCell($vsinfo);
if (count($vsinfo['vips'])) {
$ips = reduceSubarraysToColumn($vsinfo['vips'], 'vip');
$qm = questionMarks(count($ips));
$result = usePreparedSelectBlade("SELECT id FROM IPv4VS WHERE vip IN ({$qm}) ORDER BY vip", $ips);
$ret = array_merge($ret, $result->fetchAll(PDO::FETCH_COLUMN, 0));
unset($result);
}
$bin_marks = array();
foreach ($vsinfo['ports'] as $port) {
if ($port['proto'] == 'MARK') {
$bin_marks[] = pack('N', $port['vport']);
}
}
if (count($bin_marks)) {
$qm = questionMarks(count($bin_marks));
$result = usePreparedSelectBlade("SELECT id FROM IPv4VS WHERE proto = 'MARK' AND vip IN ({$qm}) ORDER BY vip", $bin_marks);
$ret = array_merge($ret, $result->fetchAll(PDO::FETCH_COLUMN, 0));
}
return $ret;
}
示例9: linkmgmt_renderObjectLinks
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>";
}
示例10: renderVLANMembership
function renderVLANMembership($object_id)
{
try {
$data = getSwitchVLANs($object_id);
} catch (RTGatewayError $re) {
showWarning('Device configuration unavailable:<br>' . $re->getMessage());
return;
}
list($vlanlist, $portlist, $maclist) = $data;
$vlanpermissions = array();
foreach ($portlist as $port) {
if (array_key_exists($port['vlanid'], $vlanpermissions)) {
continue;
}
$vlanpermissions[$port['vlanid']] = array();
foreach (array_keys($vlanlist) as $to) {
if (permitted(NULL, NULL, 'setPortVLAN', array(array('tag' => '$fromvlan_' . $port['vlanid']), array('tag' => '$vlan_' . $port['vlanid']))) and permitted(NULL, NULL, 'setPortVLAN', array(array('tag' => '$tovlan_' . $to), array('tag' => '$vlan_' . $to)))) {
$vlanpermissions[$port['vlanid']][] = $to;
}
}
}
if (isset($_REQUEST['hl_port_id'])) {
assertUIntArg('hl_port_id');
$hl_port_id = intval($_REQUEST['hl_port_id']);
$object = spotEntity('object', $object_id);
amplifyCell($object);
foreach ($object['ports'] as $port) {
if (mb_strlen($port['name']) && $port['id'] == $hl_port_id) {
$hl_port_name = $port['name'];
break;
}
}
}
echo '<table border=0 width="100%"><tr><td colspan=3>';
startPortlet('Current status');
echo "<table class=widetable cellspacing=3 cellpadding=5 align=center width='100%'><tr>";
printOpFormIntro('setPortVLAN');
$portcount = count($portlist);
echo "<input type=hidden name=portcount value=" . $portcount . ">\n";
$portno = 0;
$ports_per_row = 12;
foreach ($portlist as $port) {
// Don't let wide forms break our fancy pages.
if ($portno % $ports_per_row == 0) {
if ($portno > 0) {
echo "</tr>\n";
}
echo "<tr><th>" . ($portno + 1) . "-" . ($portno + $ports_per_row > $portcount ? $portcount : $portno + $ports_per_row) . "</th>";
}
$td_class = 'port_';
if ($port['status'] == 'notconnect') {
$td_class .= 'notconnect';
} elseif ($port['status'] == 'disabled') {
$td_class .= 'disabled';
} elseif ($port['status'] != 'connected') {
$td_class .= 'unknown';
} elseif (!isset($maclist[$port['portname']])) {
$td_class .= 'connected_none';
} else {
$maccount = 0;
foreach ($maclist[$port['portname']] as $vlanid => $addrs) {
$maccount += count($addrs);
}
if ($maccount == 1) {
$td_class .= 'connected_single';
} else {
$td_class .= 'connected_multi';
}
}
if (isset($hl_port_name) and strcasecmp($hl_port_name, $port['portname']) == 0) {
$td_class .= (strlen($td_class) ? ' ' : '') . 'border_highlight';
}
echo "<td class='{$td_class}'>" . $port['portname'] . '<br>';
echo "<input type=hidden name=portname_{$portno} value=" . $port['portname'] . '>';
if ($port['vlanid'] == 'trunk') {
echo "<input type=hidden name=vlanid_{$portno} value='trunk'>";
echo "<select disabled multiple='multiple' size=1><option>TRUNK</option></select>";
} elseif ($port['vlanid'] == 'routed') {
echo "<input type=hidden name=vlanid_{$portno} value='routed'>";
echo "<select disabled multiple='multiple' size=1><option>ROUTED</option></select>";
} elseif (!array_key_exists($port['vlanid'], $vlanpermissions) or !count($vlanpermissions[$port['vlanid']])) {
echo "<input type=hidden name=vlanid_{$portno} value={$port['vlanid']}>";
echo "<select disabled name=vlanid_{$portno}>";
echo "<option value={$port['vlanid']} selected>{$port['vlanid']}</option>";
echo "</select>";
} else {
echo "<select name=vlanid_{$portno}>";
// A port may belong to a VLAN, which is absent from the VLAN table, this is normal.
// We must be able to render its SELECT properly at least.
$in_table = FALSE;
foreach ($vlanpermissions[$port['vlanid']] as $v) {
echo "<option value={$v}";
if ($v == $port['vlanid']) {
echo ' selected';
$in_table = TRUE;
}
echo ">{$v}</option>\n";
}
if (!$in_table) {
echo "<option value={$port['vlanid']} selected>{$port['vlanid']}</option>\n";
//.........这里部分代码省略.........
示例11: snmpgeneric_list
//.........这里部分代码省略.........
}
if (isset($attr['key']) && isset($object['attr'][$attr_id]['key'])) {
if ($attr['key'] == $object['attr'][$attr_id]['key']) {
$attr['uncheck'] = 'Current = new key';
}
}
$value = $attr['value'];
$val_key = isset($object['attr'][$attr_id]['key']) ? ' (' . $object['attr'][$attr_id]['key'] . ')' : '';
$comment = '';
if (isset($attr['comment'])) {
if (!empty($attr['comment'])) {
$comment = $attr['comment'];
}
}
if (isset($attr['uncheck'])) {
$checked = '';
$comment .= ', ' . $attr['uncheck'];
} else {
$checked = ' checked="checked"';
}
$updateattrcheckbox = '<b style="background-color:#00ff00">' . '<input style="background-color:#00ff00" class="attribute" type="checkbox" name="updateattr[' . $attr_id . ']" value="' . $value . '"' . $checked . '></b>';
$comment = trim($comment, ', ');
echo "<tr><td>{$updateattrcheckbox}</td><td title=\"id: {$attr_id}\">" . $object['attr'][$attr_id]['name'] . '</td><td style="background-color:#d8d8d8">' . $object['attr'][$attr_id]['value'] . $val_key . '</td><td>' . $value . '</td>' . '<td style="color:#888888">' . $comment . '</td></tr>';
}
}
unset($attr_id);
echo '</table>';
$object['breed'] = sg_detectDeviceBreedByObject($sysObjectID);
if (!empty($object['breed'])) {
echo "Found Breed: " . $object['breed'] . "<br>";
}
/* ports */
/* get ports */
amplifyCell($object);
/* set array key to lowercase port name */
foreach ($object['ports'] as $key => $values) {
$object['ports'][strtolower(shortenIfName($values['name'], $object['breed']))] = $values;
unset($object['ports'][$key]);
}
$newporttypeoptions = getNewPortTypeOptions();
// sg_var_dump_html($sysObjectID['port']);
if (!empty($sysObjectID['port'])) {
echo '<br>Vendor / Device specific ports<br>';
echo '<table><tr><th><input type="checkbox" id="moreport" checked="checked" onclick="setchecked(this.id)"></th><th>ifName</th><th>porttypeid</th></tr>';
foreach ($sysObjectID['port'] as $name => $port) {
if (array_key_exists(strtolower($name), $object['ports'])) {
$disableport = TRUE;
} else {
$disableport = FALSE;
}
$comment = '';
if (isset($port['comment'])) {
if (!empty($port['comment'])) {
$comment = $port['comment'];
}
}
if (isset($port['uncheck'])) {
$checked = '';
$comment .= ', ' . $port['uncheck'];
} else {
$checked = ' checked="checked"';
}
$portcreatecheckbox = '<b style="background-color:' . ($disableport ? '#ff0000' : '#00ff00') . '"><input style="background-color:' . ($disableport ? '#ff0000' : '#00ff00') . '" class="moreport" type="checkbox" name="portcreate[' . $name . ']" value="' . $name . '"' . ($disableport ? ' disabled="disbaled"' : $checked) . '></b>';
$formfield = '<input type="hidden" name="ifName[' . $name . ']" value="' . $name . '">';
echo "<tr>{$formfield}<td>{$portcreatecheckbox}</td><td>{$name}</td>";
if (isset($port['disabled'])) {
示例12: updateObjectAllocation
function updateObjectAllocation()
{
global $remote_username, $sic;
if (!isset($_REQUEST['got_atoms'])) {
unset($_GET['page']);
unset($_GET['tab']);
unset($_GET['op']);
unset($_POST['page']);
unset($_POST['tab']);
unset($_POST['op']);
return buildRedirectURL(NULL, NULL, $_REQUEST);
}
$object_id = getBypassValue();
$rf1 = $_REQUEST['rfid'];
if (isset($_REQUEST['rfid'])) {
// $rf1 = 1000000;//$_REQUEST['rfid'];
$result = usePreparedSelectBlade("SELECT object_id FROM objecttorf WHERE rf_id = ?", array($rf1));
$row = $result->fetch(PDO::FETCH_ASSOC);
if (isset($row)) {
$object_id = $row['object_id'];
}
//получить значение из базы где rf1=njvenj
//showError ('Permission deniedddddddd, "' . $object_id . '" left unchanged');
}
$changecnt = 0;
// Get a list of all of this object's parents,
// then trim the list to only include parents that are racks
$objectParents = getEntityRelatives('parents', 'object', $object_id);
$parentRacks = array();
foreach ($objectParents as $parentData) {
if ($parentData['entity_type'] == 'rack') {
$parentRacks[] = $parentData['entity_id'];
}
}
$workingRacksData = array();
foreach ($_REQUEST['rackmulti'] as $cand_id) {
if (!isset($workingRacksData[$cand_id])) {
$rackData = spotEntity('rack', $cand_id);
amplifyCell($rackData);
$workingRacksData[$cand_id] = $rackData;
}
// It's zero-U mounted to this rack on the form, but not in the DB. Mount it.
if (isset($_REQUEST["zerou_{$cand_id}"]) && !in_array($cand_id, $parentRacks)) {
$changecnt++;
commitLinkEntities('rack', $cand_id, 'object', $object_id);
}
// It's not zero-U mounted to this rack on the form, but it is in the DB. Unmount it.
if (!isset($_REQUEST["zerou_{$cand_id}"]) && in_array($cand_id, $parentRacks)) {
$changecnt++;
commitUnlinkEntities('rack', $cand_id, 'object', $object_id);
}
}
foreach ($workingRacksData as &$rd) {
applyObjectMountMask($rd, $object_id);
}
$oldMolecule = getMoleculeForObject($object_id);
foreach ($workingRacksData as $rack_id => $rackData) {
if (!processGridForm($rackData, 'F', 'T', $object_id)) {
continue;
}
$changecnt++;
// Reload our working copy after form processing.
$rackData = spotEntity('rack', $cand_id);
amplifyCell($rackData);
applyObjectMountMask($rackData, $object_id);
$workingRacksData[$rack_id] = $rackData;
}
if ($changecnt) {
// Log a record.
$newMolecule = getMoleculeForObject($object_id);
usePreparedInsertBlade('MountOperation', array('object_id' => $object_id, 'old_molecule_id' => count($oldMolecule) ? createMolecule($oldMolecule) : NULL, 'new_molecule_id' => count($newMolecule) ? createMolecule($newMolecule) : NULL, 'user_name' => $remote_username, 'comment' => empty($sic['comment']) ? NULL : $sic['comment']));
}
showFuncMessage(__FUNCTION__, 'OK', array($changecnt));
}
示例13: renderReducedRack
function renderReducedRack($rack_id, $hl_obj_id = 0)
{
$rackData = spotEntity('rack', $rack_id);
amplifyCell($rackData);
markAllSpans($rackData);
if ($hl_obj_id > 0) {
highlightObject($rackData, $hl_obj_id);
}
// markupObjectProblems ($rackData); // Function removed in 0.20.5
echo "<center><table border=0><tr valign=middle>";
echo '<td><h2>' . mkA($rackData['name'], 'rack', $rackData['id']) . '</h2></td>';
echo "</h2></td></tr></table>\n";
echo "<table class=rackphg border=0 cellspacing=0 cellpadding=1>\n";
echo "<tr><th width='10%'> </th><th width='20%'>Front</th>";
echo "<th width='50%'>Interior</th><th width='20%'>Back</th></tr>\n";
for ($i = $rackData['height']; $i > 0; $i--) {
echo "<tr><td>" . inverseRackUnit($i, $rackData) . "</td>";
for ($locidx = 0; $locidx < 3; $locidx++) {
if (isset($rackData[$i][$locidx]['skipped'])) {
continue;
}
$state = $rackData[$i][$locidx]['state'];
echo "<td class='atom state_{$state}";
if (isset($rackData[$i][$locidx]['hl'])) {
echo $rackData[$i][$locidx]['hl'];
}
echo "'";
if (isset($rackData[$i][$locidx]['colspan'])) {
echo ' colspan=' . $rackData[$i][$locidx]['colspan'];
}
if (isset($rackData[$i][$locidx]['rowspan'])) {
echo ' rowspan=' . $rackData[$i][$locidx]['rowspan'];
}
echo ">";
switch ($state) {
case 'T':
printObjectDetailsForRenderRack($rackData[$i][$locidx]['object_id']);
// TODO set background color based on the tag
$o = spotEntity('object', $rackData[$i][$locidx]['object_id']);
while (list($key, $val) = each($o['etags'])) {
echo "<div style='font: 8px Verdana,sans-serif; text-decoration:none; color=black'>";
echo $val['tag'];
echo "</div>";
break;
}
break;
case 'A':
echo '<div title="This rackspace does not exist"> </div>';
break;
case 'F':
echo '<div title="Free rackspace"> </div>';
break;
case 'U':
echo '<div title="Problematic rackspace, you CAN\'T mount here"> </div>';
break;
default:
echo '<div title="No data"> </div>';
break;
}
echo '</td>';
}
echo "</tr>\n";
}
echo "</table>\n";
// Get a list of all of objects Zero-U mounted to this rack
$zeroUObjects = getEntityRelatives('children', 'rack', $rack_id);
if (count($zeroUObjects) > 0) {
echo "<br><table width='75%' class=rack border=0 cellspacing=0 cellpadding=1>\n";
echo "<tr><th>Zero-U:</th></tr>\n";
foreach ($zeroUObjects as $zeroUObject) {
$state = $zeroUObject['entity_id'] == $hl_obj_id ? 'Th' : 'T';
echo "<tr><td class='atom state_{$state}'>";
printObjectDetailsForRenderRack($zeroUObject['entity_id']);
echo "</td></tr>\n";
}
echo "</table>\n";
}
echo "</center>\n";
}
示例14: _add
function _add($gv, $object_id, $port_id = NULL)
{
global $lm_multilink_port_types;
if ($port_id !== NULL) {
if (isset($this->ports[$port_id])) {
return;
}
}
if ($this->back != 'front' || $port_id === NULL || $this->allports) {
$front = $this->_getObjectPortsAndLinks($object_id, 'front', $port_id, $this->allports);
} else {
$front = array();
}
if ($this->back != 'back' || $port_id === NULL || $this->allports) {
$backend = $this->_getObjectPortsAndLinks($object_id, 'back', $port_id, $this->allports);
} else {
$backend = array();
}
$ports = array_merge($front, $backend);
/* used only for Graphviz ...
* !! numeric ids cause Image_Graphviz problems on nested clusters !!
*/
$cluster_id = "c{$object_id}";
if (empty($ports)) {
/* needed because of gv_image empty cluster bug (invalid foreach argument) */
$gv->addNode("dummy{$cluster_id}", array('label' => '', 'fontsize' => 0, 'size' => 0, 'width' => 0, 'height' => 0, 'shape' => 'point', 'style' => 'invis'), $cluster_id);
/* show objects without ports */
if ($object_id === NULL) {
return;
}
}
$object = NULL;
if ($object_id !== NULL) {
if (!isset($gv->graph['clusters'][$cluster_id]) && !isset($gv->graph['subgraphs'][$cluster_id])) {
$object = spotEntity('object', $object_id);
// ip addresses
amplifyCell($object);
$object['portip'] = array();
foreach ($object['ipv4'] as $ipv4) {
$object['portip'][$ipv4['osif']] = $ipv4['addrinfo']['ip'];
}
// $object['attr'] = getAttrValues($object_id);
$clusterattr = array();
$this->_getcolor('cluster', 'default', $this->alpha, $clusterattr, 'color');
$this->_getcolor('cluster', 'default', $this->alpha, $clusterattr, 'fontcolor');
if ($this->object_id == $object_id) {
$clusterattr['rank'] = 'source';
$this->_getcolor('cluster', 'current', $this->alpha, $clusterattr, 'color');
$this->_getcolor('cluster', 'current', $this->alpha, $clusterattr, 'fontcolor');
}
$clustertitle = "{$object['dname']}";
$text = "{$object['dname']}";
$clusterattr['tooltip'] = $clustertitle;
unset($_GET['module']);
// makeHrefProcess adds this
unset($_GET['port_id']);
unset($_GET['remote_id']);
$_GET['object_id'] = $object_id;
//$_GET['hl'] = 'o';
$clusterattr['URL'] = $this->_makeHrefProcess($_GET);
//has_problems
if ($object['has_problems'] != 'no') {
$clusterattr['style'] = 'filled';
$this->_getcolor('cluster', 'problem', $this->alpha, $clusterattr, 'fillcolor');
}
if (!empty($object['container_name'])) {
$clustertitle .= "<BR/>{$object['container_name']}";
$text .= "\n{$object['container_name']}";
}
if ($object['rack_id']) {
$rack = spotEntity('rack', $object['rack_id']);
if (!empty($rack['row_name']) || !empty($rack['name'])) {
$clustertitle .= "<BR/>{$rack['row_name']} / {$rack['name']}";
$text .= "\n{$rack['row_name']} / {$rack['name']}";
}
}
$embedin = $object['container_id'];
if (empty($embedin)) {
$embedin = 'default';
} else {
$embedin = "c{$embedin}";
/* see cluster_id */
/* add container / cluster if not already exists */
$this->_add($gv, $object['container_id'], NULL);
}
$clusterattr['id'] = "{$object_id}----";
/* used for js context menu */
$gv->addCluster($cluster_id, $clustertitle, $clusterattr, $embedin);
}
/* isset cluster_id */
}
/* object_id !== NULL */
foreach ($ports as $key => $port) {
$this->back = $port['linktype'];
if (!isset($this->ports[$port['id']])) {
$nodelabel = htmlspecialchars("{$port['name']}");
$text = $nodelabel;
if ($port['iif_id'] != '1') {
$nodelabel .= "<BR/><FONT POINT-SIZE=\"8\">{$port['iif_name']}</FONT>";
$text .= "\n" . $port['iif_name'];
//.........这里部分代码省略.........
示例15: cloneVST
function cloneVST()
{
assertUIntArg('mutex_rev', TRUE);
assertUIntArg('from_id');
$src_vst = spotEntity('vst', $_REQUEST['from_id']);
amplifyCell($src_vst);
commitUpdateVSTRules(getBypassValue(), $_REQUEST['mutex_rev'], $src_vst['rules']);
return showFuncMessage(__FUNCTION__, 'OK');
}