Пример #1
0
function renderEditVlan($vlan_ck)
{
    global $vtoptions;
    $vlan = getVLANInfo($vlan_ck);
    startPortlet('Modify');
    printOpFormIntro('upd');
    // static attributes
    echo '<table border=0 cellspacing=0 cellpadding=2 align=center>';
    echo '<tr><th class=tdright>Name:</th><td class=tdleft>' . "<input type=text size=40 name=vlan_descr value='{$vlan['vlan_descr']}'>" . '</td></tr>';
    echo '<tr><th class=tdright>Type:</th><td class=tdleft>' . getSelect($vtoptions, array('name' => 'vlan_type', 'tabindex' => 102), $vlan['vlan_prop']) . '</td></tr>';
    echo '</table>';
    echo '<p>';
    echo '<input type="hidden" name="vdom_id" value="' . htmlspecialchars($vlan['domain_id'], ENT_QUOTES) . '">';
    echo '<input type="hidden" name="vlan_id" value="' . htmlspecialchars($vlan['vlan_id'], ENT_QUOTES) . '">';
    printImageHREF('SAVE', 'Update VLAN', TRUE);
    echo '</form><p>';
    // get configured ports count
    $portc = 0;
    foreach (getVLANConfiguredPorts($vlan_ck) as $subarray) {
        $portc += count($subarray);
    }
    $clear_line = '';
    $delete_line = '';
    if ($portc) {
        $clear_line .= '<p>';
        $clear_line .= getOpLink(array('op' => 'clear'), 'remove', 'clear', "remove this VLAN from {$portc} ports") . ' this VLAN from ' . mkA("{$portc} ports", 'vlan', $vlan_ck);
    }
    $reason = '';
    if ($vlan['vlan_id'] == VLAN_DFL_ID) {
        $reason = "You can not delete default VLAN";
    } elseif ($portc) {
        $reason = "Can not delete: {$portc} ports configured";
    }
    if (!empty($reason)) {
        echo getOpLink(NULL, 'delete VLAN', 'nodestroy', $reason);
    } else {
        echo getOpLink(array('op' => 'del', 'vlan_ck' => $vlan_ck), 'delete VLAN', 'destroy');
    }
    echo $clear_line;
    finishPortlet();
}
Пример #2
0
function trigger_vlan_ipv6net()
{
    $vlan_info = getVLANInfo($_REQUEST['vlan_ck']);
    return count($vlan_info['ipv6nets']) ? 'std' : 'attn';
}
Пример #3
0
Файл: api.php Проект: xtha/salt
     $domain = getDomainVLANs($_REQUEST['domain_id']);
     if (!$domain) {
         throw new EntityNotFoundException('domain_id', $_REQUEST['domain_id']);
     }
     sendAPIResponse($domain);
     break;
     // get info for one VLAN
     //    UI equivalent: /index.php?page=
     //    UI handler: ()
 // get info for one VLAN
 //    UI equivalent: /index.php?page=
 //    UI handler: ()
 case 'get_vlan':
     require_once 'inc/init.php';
     assertStringArg('vlan_ck', TRUE);
     sendAPIResponse(getVLANInfo($_REQUEST['vlan_ck']));
     break;
     // get overall rackspace status
     //    UI equivalent: /index.php?page=rackspace
     //    UI handler: renderRackspace()
 // get overall rackspace status
 //    UI equivalent: /index.php?page=rackspace
 //    UI handler: renderRackspace()
 case 'get_rackspace':
     require_once 'inc/init.php';
     // taken straight from interface.php::renderRackspace()
     $found_racks = array();
     $rows = array();
     $rackCount = 0;
     foreach (getAllRows() as $row_id => $rowInfo) {
         $rackList = listCells('rack', $row_id);
Пример #4
0
function trigger_vlan_ipv6net()
{
    $vlan_info = getVLANInfo(getBypassValue());
    return count($vlan_info['ipv6nets']) ? 'std' : 'attn';
}