本文整理汇总了PHP中finishPortlet函数的典型用法代码示例。如果您正苦于以下问题:PHP finishPortlet函数的具体用法?PHP finishPortlet怎么用?PHP finishPortlet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了finishPortlet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInterfacesStats
function renderInterfacesStats($object_id)
{
global $nextorder;
global $port_use_age;
addCSS("/* Live Interfaces */\n\t\t.text_green { color: #00cc00; }\n\t\t.text_yellow { color: #ff9900; }\n\t\t.text_red { color: #ff0000; }", TRUE);
startPortlet('Interfaces statistics');
//get data: show version
try {
$uptime = queryDevice($object_id, 'getuptime');
} catch (RackTablesError $e) {
}
echo "<table width='100%'><tr>";
if (permitted(NULL, NULL, 'get_link_status')) {
//get data: show interfaces
try {
$interfaces = queryDevice($object_id, 'getinterfaces');
} catch (RackTablesError $e) {
}
if (!empty($interfaces)) {
$last_reboot = time_convert($uptime);
echo "<td";
echo $last_reboot < $port_use_age ? " class='text_red'>" : $last_reboot > 262080 ? " class='text_green'>" : ">";
echo $uptime . "</tr>";
echo "<table width='80%' class='widetable' cellspacing=0 cellpadding='5px' align='center'><tr><th>Port<th>Link status<th>Last input<th>Last clear<th>Input packets<th>Output packets<th>Description</tr>";
$order = 'even';
foreach ($interfaces as $pn => $int) {
echo "<tr class='row_{$order}'>";
$order = $nextorder[$order];
echo '<td>' . $pn . '<td';
echo $int['status'] == "connected" ? " class='text_green'>" : ">";
echo $int['status'] . '<td';
echo time_convert($int['last']) > $port_use_age ? " class='text_yellow'>" : ">";
echo $int['last'] . '<td';
echo time_convert($int['clear']) > 0 ? time_convert($int['clear']) < $port_use_age ? " class='text_red'>" : ">" : ">";
echo $int['clear'];
echo '<td>' . $int['in_pkts'];
echo '<td>' . $int['out_pkts'];
echo '<td>' . $int['desc'];
echo '</tr>';
}
echo "</table></td>";
}
}
echo "</td></tr></table>";
finishPortlet();
}
示例2: renderMuninConfig
function renderMuninConfig()
{
$servers = getMuninServers();
startPortlet('Munin servers (' . count($servers) . ')');
echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>';
echo '<tr><th>base URL</th><th>graph(s)</th></tr>';
foreach ($servers as $server) {
echo '<tr align=left valign=top><td>' . stringForTD($server['base_url']) . '</td>';
echo "<td class=tdright>{$server['num_graphs']}</td></tr>";
}
echo '</table>';
finishPortlet();
}
示例3: renderVLANMembership
//.........这里部分代码省略.........
$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";
}
echo "</select>";
}
$portno++;
echo "</td>";
}
echo "</tr><tr><td colspan=" . ($ports_per_row + 1) . "><input type=submit value='Save changes'></form></td></tr></table>";
finishPortlet();
echo '</td></tr><tr><td class=pcleft>';
startPortlet('VLAN table');
echo '<table class=cooltable cellspacing=0 cellpadding=5 align=center width="100%">';
echo "<tr><th>ID</th><th>Description</th></tr>";
$order = 'even';
global $nextorder;
foreach ($vlanlist as $id => $descr) {
echo "<tr class=row_{$order}><td class=tdright>{$id}</td><td class=tdleft>{$descr}</td></tr>";
$order = $nextorder[$order];
}
echo '</table>';
finishPortlet();
echo '</td><td class=pcright>';
startPortlet('Color legend');
echo '<table>';
echo "<tr><th>port state</th><th>color code</th></tr>";
echo "<tr><td>not connected</td><td class=port_notconnect>SAMPLE</td></tr>";
echo "<tr><td>disabled</td><td class=port_disabled>SAMPLE</td></tr>";
echo "<tr><td>unknown</td><td class=port_unknown>SAMPLE</td></tr>";
echo "<tr><td>connected with none MAC addresses active</td><td class=port_connected_none>SAMPLE</td></tr>";
echo "<tr><td>connected with 1 MAC addresses active</td><td class=port_connected_single>SAMPLE</td></tr>";
echo "<tr><td>connected with 1+ MAC addresses active</td><td class=port_connected_multi>SAMPLE</td></tr>";
echo '</table>';
finishPortlet();
echo '</td><td class=pcright>';
if (count($maclist)) {
startPortlet('MAC address table');
echo '<table border=0 class=cooltable align=center cellspacing=0 cellpadding=5>';
echo "<tr><th>Port</th><th>VLAN ID</th><th>MAC address</th></tr>\n";
$order = 'even';
foreach ($maclist as $portname => $portdata) {
foreach ($portdata as $vlanid => $addrgroup) {
foreach ($addrgroup as $addr) {
echo "<tr class=row_{$order}><td class=tdleft>{$portname}</td><td class=tdleft>{$vlanid}</td>";
echo "<td class=tdleft>{$addr}</td></tr>\n";
$order = $nextorder[$order];
}
}
}
echo '</table>';
finishPortlet();
}
// End of main table.
echo '</td></tr></table>';
}
示例4: renderNewVSGForm
function renderNewVSGForm()
{
startPortlet('Add new VS group');
printOpFormIntro('add');
echo '<table border=0 cellpadding=5 cellspacing=0 align=center>';
echo '<tr valign=bottom><th>Name:</th><td class="tdleft">';
echo '<input type=text name=name></td></tr>';
echo '<tr><th>Tags:</th><td class="tdleft">';
printTagsPicker();
echo '</td></tr>';
echo '</table>';
printImageHREF('CREATE', 'create virtual service', TRUE);
echo '</form>';
finishPortlet();
}
示例5: FingTab
//.........这里部分代码省略.........
$cnt_mismatch++;
}
}
//IP
echo "><td class='tdleft";
if (isset($range['addrlist'][$ip_bin]['class']) and strlen($range['addrlist'][$ip_bin]['class'])) {
echo ' ' . $range['addrlist'][$ip_bin]['class'];
}
echo "'><a href='" . makeHref(array('page' => 'ipaddress', 'ip' => $straddr)) . "'>{$straddr}</a></td>";
//other columns
if ($skip_dns_check) {
echo "<td class='tdleft'> </td>";
} else {
if (!$ip_is_up) {
echo "<td class='tdleft'>" . $fing_state . "</td>";
} else {
echo "<td class='tdleft'><div class='strong'>" . $fing_state . "</div></td>";
}
}
echo "<td class=tdleft>{$addr['name']}</td>";
echo "<td class='tdleft'>" . $fing_hostname . "</td>";
echo "<td class='tdleft'>" . $fing_mac_vendor . "</td>";
//allocation
echo "<td>";
$delim = '';
if ($addr['reserved'] == 'yes') {
echo "<strong>RESERVED</strong> ";
$delim = '; ';
}
foreach ($addr['allocs'] as $ref) {
echo $delim . $aac_left[$ref['type']];
echo makeIPAllocLink($ip_bin, $ref, TRUE);
$delim = '; ';
}
if ($delim != '') {
$delim = '<br>';
}
foreach ($addr['vslist'] as $vs_id) {
$vs = spotEntity('ipv4vs', $vs_id);
echo $delim . mkA("{$vs['name']}:{$vs['vport']}/{$vs['proto']}", 'ipv4vs', $vs['id']) . '→';
$delim = '<br>';
}
foreach ($addr['vsglist'] as $vs_id) {
$vs = spotEntity('ipvs', $vs_id);
echo $delim . mkA($vs['name'], 'ipvs', $vs['id']) . '→';
$delim = '<br>';
}
foreach ($addr['rsplist'] as $rsp_id) {
$rsp = spotEntity('ipv4rspool', $rsp_id);
echo "{$delim}→" . mkA($rsp['name'], 'ipv4rspool', $rsp['id']);
$delim = '<br>';
}
echo "</td>";
// import column
if ($can_import) {
echo '<td>';
if ($print_cbox) {
echo "<input type=checkbox name=import_{$cnt_total} id=atom_1_" . $box_counter++ . "_1>";
} else {
echo ' ';
}
echo '</td>';
}
echo "</tr>";
}
if ($can_import && $box_counter > 1) {
echo '<tr><td colspan=4 align=center><input type=submit value="Import selected records"></td><td colspan=2 align=right>';
addJS('js/racktables.js');
echo --$box_counter ? "<a href='javascript:;' onclick=\"toggleColumnOfAtoms(1, 1, {$box_counter})\">(toggle selection)</a>" : ' ';
echo '</td></tr>';
}
echo "</table>";
if ($can_import) {
echo '</form>';
}
finishPortlet();
echo "</td><td class=pcright>";
//
// PING Statistics
//
startPortlet('ping stats');
$cnt_ping_up = get_fing_up_count($known_ips);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
echo "<tr class=trok><th class=tdright>Replied to Ping</th><td class=tdleft>{$cnt_ping_up}</td></tr>\n";
echo "<tr class=trwarning><th class=tdright>No Response</th><td class=tdleft>" . ($cnt_total - $cnt_ping_up) . "</td></tr>\n";
echo "</table>\n";
finishPortlet();
//
// DNS Statistics
//
startPortlet('dns stats');
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
echo "<tr class=trok><th class=tdright>Exact matches:</th><td class=tdleft>{$cnt_match}</td></tr>\n";
echo "<tr class=trwarning><th class=tdright>Missing from DB/DNS:</th><td class=tdleft>{$cnt_missing}</td></tr>\n";
if ($cnt_mismatch) {
echo "<tr class=trerror><th class=tdright>Mismatches:</th><td class=tdleft>{$cnt_mismatch}</td></tr>\n";
}
echo "</table>\n";
finishPortlet();
}
示例6: renderPatchCableConfiguration
function renderPatchCableConfiguration()
{
global $nextorder;
echo '<table class=objview border=0 width="100%"><tr><td class=pcleft>';
startPortlet('Connectors');
renderSimpleTableWithOriginViewer(getPatchCableConnectorList(), array('header' => 'Connector', 'key' => 'id', 'value' => 'connector', 'width' => 32));
finishPortlet();
startPortlet('Connector compatibility');
renderTwoColumnCompatTableViewer(getPatchCableConnectorCompat(), array('header' => 'Cable type', 'key' => 'pctype_id', 'value' => 'pctype', 'width' => 64), array('header' => 'Connector', 'key' => 'connector_id', 'value' => 'connector', 'width' => 32));
finishPortlet();
echo '</td><td class=pcright>';
startPortlet('Cable types');
renderSimpleTableWithOriginViewer(getPatchCableTypeList(), array('header' => 'Cable type', 'key' => 'id', 'value' => 'pctype', 'width' => 64));
finishPortlet();
startPortlet('Cable types and port outer interfaces');
renderTwoColumnCompatTableViewer(getPatchCableOIFCompat(), array('header' => 'Cable type', 'key' => 'pctype_id', 'value' => 'pctype', 'width' => 64), array('header' => 'Outer interface', 'key' => 'oif_id', 'value' => 'oif_name', 'width' => 48));
finishPortlet();
echo '</td></tr></table>';
}
示例7: renderEditUCSForm
function renderEditUCSForm()
{
startPortlet('UCS Actions');
printOpFormIntro('autoPopulateUCS');
echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>';
echo "<tr><th class=tdright><label for=ucs_login>Login:</label></th>";
echo "<td class=tdleft colspan=2><input type=text name=ucs_login id=ucs_login></td></tr>\n";
echo "<tr><th class=tdright><label for=ucs_password>Password:</label></th>";
echo "<td class=tdleft colspan=2><input type=password name=ucs_password id=ucs_password></td></tr>\n";
echo "<tr><th colspan=3><input type=checkbox name=use_terminal_settings id=use_terminal_settings>";
echo "<label for=use_terminal_settings>Use Credentials from terminal_settings()</label></th></tr>\n";
echo "<tr><th class=tdright>Actions:</th><td class=tdleft>";
printImageHREF('DQUEUE sync_ready', 'Auto-populate UCS', TRUE);
echo '</td><td class=tdright>';
echo "<a href='" . makeHrefProcess(array('op' => 'cleanupUCS', 'object_id' => getBypassValue())) . "' onclick=\"javascript:return confirm('Are you sure you want to cleanup UCS Domain?')\">" . getImageHREF('CLEAR', 'Clean-up UCS domain') . "</a>";
echo "</td></tr></table></form>\n";
finishPortlet();
}
示例8: renderEditUCSForm
function renderEditUCSForm()
{
startPortlet('UCS Actions');
printOpFormIntro('autoPopulateUCS');
echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>';
echo "<tr><th class=tdright><label for=ucs_login>Login:</label></th>";
echo "<td class=tdleft colspan=2><input type=text name=ucs_login id=ucs_login></td></tr>\n";
echo "<tr><th class=tdright><label for=ucs_password>Password:</label></th>";
echo "<td class=tdleft colspan=2><input type=password name=ucs_password id=ucs_password></td></tr>\n";
echo "<tr><th colspan=3><input type=checkbox name=use_terminal_settings id=use_terminal_settings>";
echo "<label for=use_terminal_settings>Use Credentials from terminal_settings()</label></th></tr>\n";
echo "<tr><th class=tdright>Actions:</th><td class=tdleft>";
printImageHREF('DQUEUE sync_ready', 'Auto-populate UCS', TRUE);
echo '</td><td class=tdright>';
echo getOpLink(array('op' => 'cleanupUCS'), '', 'CLEAR', 'Clean-up UCS domain', 'need-confirmation');
echo "</td></tr></table></form>\n";
finishPortlet();
}
示例9: ripeTab
function ripeTab($id)
{
$ripe_db = "http://rest.db.ripe.net/search.xml?source=ripe&query-string=";
assertUIntArg('id');
$net = spotEntity('ipv4net', $id);
loadIPAddrList($net);
$startip = ip4_bin2int($net['ip_bin']);
$endip = ip4_bin2int(ip_last($net));
// Get Data from RIPE
$ripe_inetnum_str = ip4_format(ip4_int2bin($startip)) . ' - ' . ip4_format(ip4_int2bin($endip));
$ripe_query = $ripe_db . ip4_format(ip4_int2bin($startip));
$ripe_result_str = file_get_contents($ripe_query, false, NULL);
$ripe_result = simplexml_load_string($ripe_result_str);
// Check inetnum object
$ripe_inetnum_check = "/whois-resources/objects/object[@type='inetnum']/attributes/attribute[@name='inetnum'][@value='{$ripe_inetnum_str}']";
$ripe_inetnum = $ripe_result->xpath($ripe_inetnum_check);
if (empty($ripe_inetnum)) {
echo "<div class=trerror><center><h1>{$net['ip']}/{$net['mask']}</h1><h2>{$net['name']}</h2></center></div>\n";
} else {
$ripe_netname_check = "/whois-resources/objects/object[@type='inetnum']/attributes/attribute[@name='netname']";
$ripe_netname = $ripe_result->xpath($ripe_netname_check);
$netname = trim($ripe_netname[0]['value']);
if (strcmp($netname, $net['name']) != 0) {
echo "<div class=trwarning><center><h1>{$net['ip']}/{$net['mask']}</h1><h2>{$net['name']}</h2></center></div><div><center>";
} else {
echo "<div class=trok><center><h1>{$net['ip']}/{$net['mask']}</h1><h2>{$net['name']}</h2></center></div><div><center>";
}
printOpFormIntro('importRipeData', array('ripe_query' => $ripe_query, 'net_id' => $id, 'net_name' => $netname));
echo "<input type=submit value='Import RIPE records in to comments'></center></div>";
echo "</form>";
}
// echo '<em>'.$ripe_query.'</em>';
echo "<table border=0 width='100%'><tr><td class=pcleft>";
$filedir = realpath(dirname(__FILE__));
$ripe_xsl = simplexml_load_file($filedir . '/ripe_html.xsl');
startPortlet("RIPE Information Datatbase<br>{$ripe_inetnum_str}");
$proc = new XSLTProcessor();
$proc->importStyleSheet($ripe_xsl);
echo '<div class=commentblock>' . trim($proc->transformToXML($ripe_result)) . '</div>';
finishPortlet();
echo "</td></tr></table>\n";
}
示例10: renderNodePingChecks
function renderNodePingChecks($object_id)
{
$accounts = getNodePingAccounts();
$account_options = array();
foreach ($accounts as $account) {
$account_options[$account['id']] = $account['name'];
}
startPortlet('Add new check');
echo "<table cellspacing=0 cellpadding=5 align='center'>\n";
echo "<tr><th> </th><th>Account</th><th>Check ID</th><th></th><th> </th></tr>\n";
printOpFormIntro('add');
echo '<tr><td>';
printImageHREF('add', 'add check', TRUE);
echo '</td><td>' . getSelect($account_options, array('name' => 'account_id'));
echo '</td><td><input type=text size=25 name=np_check_id tabindex=101></td><td>';
printImageHREF('add', 'add check', TRUE);
echo "</td></tr></form></table>\n";
finishPortlet();
$checks = getUnlinkedNodePingChecks($object_id);
if (count($checks) > 0) {
$check_options = array();
foreach ($checks as $check) {
$check_options[$check['id']] = sprintf("%s - %s", $check['label'], $check['type']);
}
startPortlet('Link existing check (' . count($checks) . ')');
echo "<table cellspacing=0 cellpadding=5 align='center'>\n";
printOpFormIntro('link');
echo '<tr><td>' . getSelect($check_options, array('name' => 'check_id'));
echo '</td><td class=tdleft>';
printImageHREF('ATTACH', 'Link check', TRUE);
echo "</td></tr></form></table>\n";
finishPortlet();
}
addJs(<<<END
function toggleVisibility(tbodyId) {
\t\$("#" + tbodyId).toggle();
}
END
, TRUE);
$checks = getNodePingChecks($object_id);
startPortlet('NodePing checks (' . count($checks) . ')');
if (count($checks)) {
echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n";
echo "<tr><th> </th><th>Type</th><th>Label</th><th>Interval</th><th>Reason</th><th>Result</th><th>Unlink</th><th> </th></tr>\n";
$token = '';
foreach ($checks as $check) {
printOpFormIntro('upd', array('check_id' => $check['check_id']));
echo '<tr><td><a href="' . makeHrefProcess(array('op' => 'del', 'check_id' => $check['check_id'])) . '">';
echo getImageHREF('delete', 'Unlink and delete this check') . '</a></td>';
echo "<td><a href=\"#\" onclick=\"toggleVisibility('{$check['check_id']}');\">{$check['type']}</a></td>";
echo "<td>{$check['label']}</td>";
echo "<td>{$check['check_interval']}</td>";
// re-use a nodeping object if it already exists and is using the same token as this check
if ($check['token'] != $token) {
$nodeping = new NodePingClient(array('token' => $check['token']));
}
$token = $check['token'];
$np_result_raw = $nodeping->result->get(array('id' => $check['np_check_id'], 'limit' => 5, 'clean' => true));
if (isset($np_result_raw['error'])) {
echo "<td colspan=5>Error: {$check_status_raw['error']}</td>";
} else {
$np_result = $np_result_raw[0];
if ($np_result['su']) {
$reason = '';
$result_str = 'PASS';
$result_class = 'msg_success';
} else {
$reason = $np_result['sc'];
$result_str = 'FAIL';
$result_class = 'msg_error';
}
echo "<td>{$reason}</td>";
echo "<td><span class='{$result_class}'>{$result_str}</span></td>";
}
echo '<td class=center><a href="' . makeHrefProcess(array('op' => 'unlink', 'link_id' => $check['link_id'])) . '">';
echo getImageHREF('cut', 'Unlink this check') . '</a></td>';
echo '<td class=tdleft>';
printImageHREF('save', 'Save changes', TRUE);
echo "</td></tr>\n";
echo "<tbody id='{$check['check_id']}' style='display:none;'><tr><td colspan=8>";
echo '<table cellspacing=0 cellpadding=5 align=left>';
// override the td styling so it doesn't have a border
echo '<tr><th>Account</th><td align=left style="border-top: 0px;">' . getSelect($account_options, array('name' => 'account_id'), $check['account_id']) . '</td></tr>';
echo '<tr><th>Check ID</th><td align=left style="border-top: 0px;"><input type=text size=25 name=np_check_id value="' . $check['np_check_id'] . '"></td></tr>';
echo "<tr><th>Target</th><td align=left style=\"border-top:0px; word-wrap:break-word; max-width:250px;\">{$check['target']}</td></tr>";
echo '</table></form>';
echo '<table cellspacing=0 cellpadding=5 align=right>';
echo '<tr><th colspan=5>Last 5 Results</th></tr>';
echo '<tr><th>Time</th><th>Loc</th><th>Run Time</th><th>Response</th><th>Result</th></tr>';
foreach ($np_result_raw as $np_row) {
// time is reported in miliseconds, so trim off the last 3 digits
printf('<tr><td>%s</td>', date('H:i:s A', substr($np_row['s'], 0, -3)));
printf('<td>%s</td>', strtoupper($np_row['l'][$np_row['s']]));
if ($np_row['su']) {
$result_str = 'PASS';
$result_class = 'msg_success';
} else {
$result_str = 'FAIL';
$result_class = 'msg_error';
}
//.........这里部分代码省略.........
示例11: localfunc_PortGenerator
function localfunc_PortGenerator()
{
global $errorText, $lookFor, $portList, $genText, $valueConfiguration, $searchIt;
assertUIntArg('object_id', __FUNCTION__);
$object = spotEntity('object', $_REQUEST['object_id']);
startPortlet("Port generator");
print "<center><br>";
if (!localverify_PortGenerator($object)) {
//
// Autoport configuration did not work. Show this and show the error
//
print "{$lookFor} : Error\n";
if (isset($errorText)) {
print $errorText;
}
} else {
//
// Show the list of ports that will be generated and provide a link to actually do so
//
print "<a href='" . makeHrefProcess(array('op' => 'addports', 'page' => 'object', 'object_id' => $object['id'], 'tab' => 'ports')) . "'>Generate the ports for <b>{$object['name']}</b> as listed below NOW</a><br>\n";
print $genText . "<p>";
print "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>";
print "<tr><th>Port name </th><th>Port label </th><th>Port type</th></tr>\n";
foreach ($portList as $aPort) {
print "<tr><td>{$aPort['name']}</td><td>{$aPort['label']}</td><td>{$aPort['port_name']}</td></tr>\n";
}
print "</table>";
}
print "<br></center>";
finishPortlet();
//
// Check whether the user is allowed to do an update of the port configurator
//
// if you do not want this, make sure you add a
// deny {$op_updateportgenerator}
// for the apprioriate groups (or any allow first and deny for the rest
//
if (permitted('object', 'portgenerator', null, array(array('tag' => '$op_updateportgenerator')))) {
startPortlet("Update autoport configuration");
//
// Description of the config rules
//
print "<center>";
print $genText . "<p>\n";
print "<b>USAGE</b><br><br>";
print "<list1>;<list2>;.... where <listx> is<br>";
print "<start port #>|<port count, use %n for number of ports>|";
print "<port name, use %u for number>|[<port innerinterface id>-]<port type id>[|<port label, use %u for number>]<br><br>";
print "<b>EXAMPLE (for Force10 S4810)</b><br><br>0|48|%u|9-1084|TenGigabitEthernet0/%u;48|4|%u|10-1588|FortyGigE0/48;52|4|%u|10-1588|FortyGigE0/52;56|4|%u|10-1588|FortyGigE0/56;60|4|%u|10-1588|FortyGigE0/60;1|1|RS-232|29|Serial port;1|1|Ethernet|24|ManagementEthernet0/%u;1|2|AC%u|16<br><br>";
print "<b>EXPLANATION (for AC-in ports)</b><br><br> <b>1</b> = starting number,\n <b>2</b> = number of generated ports, \n <b>AC%u</b> = will begin with <b>starting number</b> and create up to the <b>number of generated ports</b>, \n <b>16</b> = the value displayed on the chart below <b>in bold</b> (Notice: Default innerinterface ID is 1 /hardwired/, so the realy value is <b>1-16</b>)<br><br>";
//explains example
print "<b>PLEASE NOTE</b><br><br> If you do not add the port that is selected <b>(dictionary value)</b> to the default list in the <b>Ports</b> Tab, \n you will get a <b>foriegn key violation</b> error. \n You must go to the <b>Configuration</b> area on the main page, go to <b>Enable port types</b>\n and hit the <b>Edit</b> tab to place the selected port in either <b>GBIC</b>, <b>hardwired</b>, or any other configuration \n on the page so that the error is not recieved.<br><br><br>";
//Very important to have a sucessful implementation of port generator
//
// The form that can update the configuration
// On top of the table of ports avialabe instead of beneath it
//
printOpFormIntro('updateportgenerator', array('yId' => $searchIt));
print "<b>Autoport Configuration:</b><br><br><input type='text' style='width:100%; font-size: 16px' name='yConfig' value='";
if ($valueConfiguration) {
print $valueConfiguration[0];
}
print "'><br><br>\n";
print "<input type='submit' name='autoportconfig' value='";
if ($valueConfiguration) {
print "Update";
} else {
print "Create";
}
print "'>\n";
print "</form>\n";
print "</center><br>";
print "<table border='2' rules=all>\n<tr class=row_odd>";
$isfirst = true;
$i = 0;
//
// List all available port types with their dictionary key
//
$q = "SELECT IF(iif_id,CONCAT(i.id,'-',o.id),o.id) as ID , IF(iif_id,CONCAT(i.iif_name,' => ',o.oif_name),o.oif_name) as name FROM PortOuterInterface o left join PortInterfaceCompat c on o.id = c.oif_id left join PortInnerInterface i on c.iif_id = i.id order by i.id,o.id";
$result = usePreparedSelectBlade($q);
//Changed for new configeration in versions after 0.17.x
if ($result == NULL) {
print_r($dbxlink->errorInfo());
die;
}
while ($row4 = $result->fetch(PDO::FETCH_NUM)) {
if (!$isfirst && $i % 10 == 0) {
print "</td></tr>\n<tr class=" . ($i % 4 == 0 ? "row_odd" : "row_even") . ">";
} else {
$isfirst = false;
}
print "<td><b>{$row4[0]}</b><br>";
//seperated values to make them easier to read
print "{$row4[1]}\n</td>";
$i++;
}
print "</td>\n";
print "</tr></table>\n";
finishPortlet();
}
//.........这里部分代码省略.........
示例12: finishPortlet
<pre id="debugmsg" style="display: none;">
<?php
//print_r($_SESSION);
?>
---
<?php
//print_r($taglist);
?>
</pre>
</div>
<?php
finishPortlet();
?>
</div>
<br clear='both'>
<?php
startPortlet();
echo "XenVMImport by Tyler Montgomery <br>";
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round($finish - $start, 4);
echo 'Page generated in ' . $total_time . ' seconds.';
finishPortlet();
?>
</div>
示例13: renderPortletWattConsumption
function renderPortletWattConsumption($info)
{
$rackTotalWattage = 0;
$rackData = spotEntity('rack', $info['id']);
amplifyCell($rackData);
$objectChildren = getEntityRelatives('children', 'object', $objectData['id']);
foreach ($rackData['mountedObjects'] as $object) {
$objectData = spotEntity('object', $object);
amplifyCell($objectData);
foreach (getAttrValues($objectData['id']) as $record) {
if ($record['name'] == 'Wattage consumption') {
$rackTotalWattage += $record['value'];
}
}
}
startPortlet('Wattage Consumption');
echo "<table border=0 cellspacing=5 align='center'><tr>";
echo "<td>The total for attribute Wattage consuption is: <b>{$rackTotalWattage}</b></td>\n";
echo "</tr></table>\n";
finishPortlet();
}
示例14: renderSearchNewIP4Range
function renderSearchNewIP4Range()
{
global $pTable;
// prepare $cellfilter
$cellfilter = getCellFilter();
if ($cellfilter['is_empty'] || !isset($_REQUEST['cfp'])) {
if (defined('SPARE_SEARCH_PREDICATE') && isset($pTable[SPARE_SEARCH_PREDICATE])) {
$_REQUEST['cfp'] = array(SPARE_SEARCH_PREDICATE);
$cellfilter = getCellFilter();
}
}
$mask = NULL;
if (!empty($_REQUEST['pref_len'])) {
$mask = intval($_REQUEST['pref_len']);
}
$nets = array();
foreach (filterCellList(listCells('ipv4net'), $cellfilter['expression']) as $net) {
if (!isset($mask)) {
$nets[] = $net;
} elseif ($net['mask'] <= $mask) {
$is_aggregate = FALSE;
foreach ($net['atags'] as $atag) {
if ($atag['tag'] == '$aggregate') {
$is_aggregate = TRUE;
} elseif (preg_match('/^\\$spare_(\\d+)$/', $atag['tag'], $m) && $mask >= $m[1]) {
$nets[] = $net;
continue 2;
}
}
if (!$is_aggregate) {
$nets[] = $net;
}
}
}
$filter = getOutputOf('renderCellFilterPortlet', $cellfilter, 'ipv4net', $nets);
echo '<table width="100%"><tr valign=top>';
echo '<td>';
startPortlet("Results (" . count($nets) . ")");
echo '<ul class="spare-nets">';
foreach ($nets as $net) {
echo '<li>';
renderNetCellForAlloc($net, $mask);
echo '</li>';
}
echo '</ul>';
finishPortlet();
echo '</td>';
echo '<td width="33%">';
echo preg_replace_callback('/(<form[^<>]*>)/', 'generatePrefixLengthInput', $filter);
echo '</td>';
echo '</tr></table>';
addCSS(<<<END
ul.spare-nets {
\tlist-style: none;
\tpadding: 0px;
}
ul.spare-nets li {
\tmargin: 5px 0px;
}
END
, TRUE);
}
示例15: renderPopupPortSelector
function renderPopupPortSelector()
{
assertUIntArg('port');
$port_id = $_REQUEST['port'];
$port_info = getPortInfo($port_id);
$in_rack = isCheckSet('in_rack');
// fill port filter structure
$filter = array('racks' => array(), 'objects' => '', 'ports' => '');
if (isset($_REQUEST['filter-obj'])) {
$filter['objects'] = trim($_REQUEST['filter-obj']);
}
if (isset($_REQUEST['filter-port'])) {
$filter['ports'] = trim($_REQUEST['filter-port']);
}
if ($in_rack) {
$object = spotEntity('object', $port_info['object_id']);
if ($object['rack_id']) {
$filter['racks'] = getProximateRacks($object['rack_id'], getConfigVar('PROXIMITY_RANGE'));
}
}
$spare_ports = array();
if (!empty($filter['racks']) || !empty($filter['objects']) || !empty($filter['ports'])) {
$spare_ports = findSparePorts($port_info, $filter);
}
// display search form
echo 'Link ' . formatPort($port_info) . ' to...';
echo '<form method=GET>';
startPortlet('Port list filter');
echo '<input type=hidden name="module" value="popup">';
echo '<input type=hidden name="helper" value="portlist">';
echo '<input type=hidden name="port" value="' . $port_id . '">';
echo '<table align="center" valign="bottom"><tr>';
echo '<td class="tdleft"><label>Object name:<br><input type=text size=8 name="filter-obj" value="' . htmlspecialchars($filter['objects'], ENT_QUOTES) . '"></label></td>';
echo '<td class="tdleft"><label>Port name:<br><input type=text size=6 name="filter-port" value="' . htmlspecialchars($filter['ports'], ENT_QUOTES) . '"></label></td>';
echo '<td class="tdleft" valign="bottom"><label><input type=checkbox name="in_rack"' . ($in_rack ? ' checked' : '') . '>Nearest racks</label></td>';
echo '<td valign="bottom"><input type=submit value="show ports"></td>';
echo '</tr></table>';
finishPortlet();
// display results
startPortlet('Compatible spare ports');
if (empty($spare_ports)) {
echo '(nothing found)';
} else {
echo getSelect($spare_ports, array('name' => 'remote_port', 'size' => getConfigVar('MAXSELSIZE')), NULL, FALSE);
echo "<p>Cable ID: <input type=text id=cable name=cable>";
echo "<p><input type='submit' value='Link' name='do_link'>";
}
finishPortlet();
echo '</form>';
}