当前位置: 首页>>代码示例>>PHP>>正文


PHP startPortlet函数代码示例

本文整理汇总了PHP中startPortlet函数的典型用法代码示例。如果您正苦于以下问题:PHP startPortlet函数的具体用法?PHP startPortlet怎么用?PHP startPortlet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了startPortlet函数的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();
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:46,代码来源:liveinterfaces.php

示例2: 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";
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:42,代码来源:ripe.php

示例3: 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();
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:13,代码来源:interface-config.php

示例4: 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";
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:livevlans.php

示例5: 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();
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:15,代码来源:slb2-interface.php

示例6: FingTab

/**
 *
 * Fing tab handler
 *
 */
function FingTab($id)
{
    $can_import = permitted(NULL, NULL, 'importFingData');
    //
    // allocation settings
    //
    // address allocation code, IPv4 networks view
    $aac_left = array('regular' => '', 'virtual' => '<span class="aac-left" title="Loopback">L:</span>', 'shared' => '<span class="aac-left" title="Shared">S:</span>', 'router' => '<span class="aac-left" title="Router">R:</span>', 'point2point' => '<span class="aac-left" title="Point-to-point">P:</span>');
    //
    // header
    //
    global $pageno, $tabno;
    $maxperpage = getConfigVar('IPV4_ADDRS_PER_PAGE');
    $range = spotEntity('ipv4net', $id);
    loadIPAddrList($range);
    echo "<center><h1>{$range['ip']}/{$range['mask']}</h1><h2>{$range['name']}</h2></center>\n";
    //
    // execute fing
    //
    try {
        $known_ips = get_fing_scan($range['ip'], $range['mask']);
        $fing_cfg = get_fing_settings($range['ip'], $range['mask']);
        $fing_gw = $fing_cfg["gateway"];
    } catch (FingException $e) {
        render_fing_error("Could not get network scan via fing:", $e->getMessage());
        return FALSE;
    }
    echo "<table class=objview border=0 width='100%'><tr><td class=pcleft>";
    startPortlet('overlook fing (via: ' . $fing_gw . ')');
    //
    // pagination
    //
    if (isset($_REQUEST['pg'])) {
        $page = $_REQUEST['pg'];
    } else {
        $page = 0;
    }
    $startip = ip4_bin2int($range['ip_bin']);
    $endip = ip4_bin2int(ip_last($range));
    $numpages = 0;
    if ($endip - $startip > $maxperpage) {
        $numpages = ($endip - $startip) / $maxperpage;
        $startip = $startip + $page * $maxperpage;
        $endip = $startip + $maxperpage - 1;
    }
    echo "<center>";
    if ($numpages) {
        echo '<h3>' . ip4_format(ip4_int2bin($startip)) . ' ~ ' . ip4_format(ip4_int2bin($endip)) . '</h3>';
    }
    for ($i = 0; $i < $numpages; $i++) {
        if ($i == $page) {
            echo "<b>{$i}</b> ";
        } else {
            echo "<a href='" . makeHref(array('page' => $pageno, 'tab' => $tabno, 'id' => $id, 'pg' => $i)) . "'>{$i}</a> ";
        }
    }
    echo "</center>";
    if ($can_import) {
        printOpFormIntro('importFingData', array('addrcount' => $endip - $startip + 1));
        $box_counter = 1;
    }
    echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center'>\n";
    echo "<tr><th class='tdleft'>address</th><th class='tdleft'>state</th><th class='tdleft'>current name</th><th class='tdleft'>DNS name</th><th class='tdleft'>MAC</th><th class='tdleft'>Allocation</th>";
    if ($can_import) {
        echo '<th>import</th>';
    }
    echo "</tr>\n";
    //
    // Loop through all IPs
    //
    $cnt_match = $cnt_missing = $cnt_mismatch = $cnt_total = 0;
    for ($ip = $startip; $ip <= $endip; $ip++) {
        $cnt_total++;
        $print_cbox = FALSE;
        $ip_bin = ip4_int2bin($ip);
        $addr = isset($range['addrlist'][$ip_bin]) ? $range['addrlist'][$ip_bin] : array('name' => '', 'reserved' => 'no');
        $straddr = ip4_format($ip_bin);
        list($fing_hostname, $fing_state, $fing_mac_vendor) = get_fing_info($straddr, $known_ips);
        $ip_is_up = strtoupper($fing_state) == "UP" ? TRUE : FALSE;
        if ($can_import) {
            echo "<input type=hidden name=addr_{$cnt_total} value={$straddr}>\n";
            echo "<input type=hidden name=descr_{$cnt_total} value={$fing_hostname}>\n";
            echo "<input type=hidden name=rsvd_{$cnt_total} value={$addr['reserved']}>\n";
        }
        $skip_dns_check = FALSE;
        echo "<tr";
        // Ignore network and broadcast addresses
        if ($ip == $startip && $addr['name'] == 'network' || $ip == $endip && $addr['name'] == 'broadcast') {
            echo " class='trbusy'";
            $skip_dns_check = TRUE;
        } elseif (!$ip_is_up) {
            echo " class='trnull'";
        }
        // set line color depending if we have the name already in the DB
        if (!$skip_dns_check) {
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:fingtab.php

示例7: 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>';
}
开发者ID:xtha,项目名称:salt,代码行数:19,代码来源:interface.php

示例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 "<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();
}
开发者ID:rhysm,项目名称:racktables,代码行数:18,代码来源:interface.php

示例9: 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();
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:18,代码来源:interface.php

示例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>&nbsp;</th><th>Account</th><th>Check ID</th><th></th><th>&nbsp;</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>&nbsp;</th><th>Type</th><th>Label</th><th>Interval</th><th>Reason</th><th>Result</th><th>Unlink</th><th>&nbsp;</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';
                }
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:nodeping.php

示例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} :&nbsp; &nbsp; &nbsp;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&nbsp;&nbsp;</th><th>Port label&nbsp;&nbsp;</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 "&lt;list1&gt;;&lt;list2&gt;;.... where &lt;listx&gt; is<br>";
        print "&lt;start port #&gt;|&lt;port count, use %n for number of ports&gt;|";
        print "&lt;port name, use %u for number&gt;|[&lt;port innerinterface id&gt;-]&lt;port type id&gt;[|&lt;port label, use %u for number&gt;]<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();
    }
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:local_portgenerator.php

示例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>
开发者ID:xtha,项目名称:salt,代码行数:30,代码来源:importtab.php

示例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();
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:21,代码来源:wattage_consumption.php

示例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);
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:63,代码来源:new-ip-range.php

示例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>';
}
开发者ID:ehironymous,项目名称:racktables,代码行数:50,代码来源:popup.php


注:本文中的startPortlet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。