function renderNetVLAN($cell)
{
    if (empty($cell['8021q'])) {
        return;
    }
    $links = array();
    foreach ($cell['8021q'] as $vi) {
        $vlan_info = getVlanRow("{$vi['domain_id']}-{$vi['vlan_id']}");
        $links[] = formatVLANAsShortLink($vlan_info);
    }
    $noun = count($cell['8021q']) > 1 ? 'VLANs' : 'VLAN';
    echo "<div class='vlan'><strong><small>{$noun}</small> " . implode(', ', $links) . '</strong></div>';
}
예제 #2
0
function renderVLANDomain($vdom_id)
{
    global $nextorder;
    $mydomain = getVLANDomain($vdom_id);
    echo '<table border=0 class=objectview cellspacing=0 cellpadding=0>';
    echo '<tr><td colspan=2 align=center><h1>' . stringForTD($mydomain['description']);
    echo '</h1></td></tr>';
    echo "<tr><td class=pcleft width='50%'>";
    if (!count($mydomain['switchlist'])) {
        startPortlet('no orders');
    } else {
        startPortlet('orders (' . count($mydomain['switchlist']) . ')');
        echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>';
        echo '<tr><th>switch</th><th>template</th><th>status</th></tr>';
        $order = 'odd';
        $vstlist = getVSTOptions();
        global $dqtitle;
        foreach ($mydomain['switchlist'] as $switchinfo) {
            echo "<tr class=row_{$order}><td>";
            renderCell(spotEntity('object', $switchinfo['object_id']));
            echo '</td><td class=tdleft>';
            echo $vstlist[$switchinfo['template_id']];
            echo '</td><td>';
            $qcode = detectVLANSwitchQueue(getVLANSwitchInfo($switchinfo['object_id']));
            printImageHREF("DQUEUE {$qcode}", $dqtitle[$qcode]);
            echo '</td></tr>';
            $order = $nextorder[$order];
        }
        echo '</table>';
    }
    finishPortlet();
    echo '</td><td class=pcright>';
    $domain_options = getVLANDomainOptions();
    $myvlans = array();
    foreach (array_merge(array($vdom_id), getDomainGroupMembers($vdom_id)) as $domain_id) {
        foreach (getDomainVLANs($domain_id, TRUE) as $vlan_id => $vlan_info) {
            $vlan_info['domain_id'] = $domain_id;
            $vlan_info['domain_descr'] = $domain_options[$domain_id];
            $myvlans[$vlan_id][$domain_id] = $vlan_info;
        }
    }
    ksort($myvlans, SORT_NUMERIC);
    if (!count($myvlans)) {
        startPortlet('no VLANs');
    } else {
        startPortlet('VLANs (' . count($myvlans) . ')');
        $order = 'odd';
        global $vtdecoder;
        echo '<table class=cooltable align=center border=0 cellpadding=5 cellspacing=0>';
        echo '<tr><th>VLAN ID</th><th><span title="propagation flag">P</span></th><th>';
        printImageHREF('net', 'IPv4 networks linked');
        echo '</th><th>ports</th><th>description</th></tr>';
        foreach ($myvlans as $vlan_id => $vlan_list) {
            foreach ($vlan_list as $domain_id => $vlan_info) {
                echo "<tr class=row_{$order}>";
                echo '<td class=tdright>' . (count($vlan_list) > 1 ? stringForLabel($domain_options[$domain_id]) . ' ' : '') . formatVLANAsShortLink($vlan_info) . '</td>';
                echo '<td>' . $vtdecoder[$vlan_info['vlan_type']] . '</td>';
                echo '<td class=tdright>' . ($vlan_info['netc'] ? $vlan_info['netc'] : '&nbsp;') . '</td>';
                echo '<td class=tdright>' . ($vlan_info['portc'] ? $vlan_info['portc'] : '&nbsp;') . '</td>';
                echo '<td class=tdleft>' . stringForLabel($vlan_info['vlan_descr']) . '</td></tr>';
            }
            $order = $nextorder[$order];
        }
        echo '</table>';
    }
    finishPortlet();
    echo '</td></tr></table>';
}