Exemple #1
0
function assertBreedFunction($breed, $command)
{
    global $breedfunc;
    if (!validBreedFunction($breed, $command)) {
        throw new RTGatewayError("unsupported command '{$command}' for breed '{$breed}'");
    }
    return $breedfunc["{$breed}-{$command}-main"];
}
Exemple #2
0
function translateDeviceCommands($object_id, $crq, $vlan_names = NULL)
{
    require_once 'deviceconfig.php';
    $breed = detectDeviceBreed($object_id);
    if (empty($breed)) {
        throw new RTGatewayError("Can not determine device breed");
    }
    if (!validBreedFunction($breed, 'xlatepushq')) {
        throw new RTGatewayError("unsupported command 'xlatepushq' for the breed '{$breed}'");
    }
    global $breedfunc;
    return $breedfunc["{$breed}-xlatepushq-main"]($object_id, $crq, $vlan_names);
}
Exemple #3
0
function switchportInfoJS($object_id)
{
    $available_ops = array('link' => array('op' => 'get_link_status', 'gw' => 'getportstatus'), 'conf' => array('op' => 'get_port_conf', 'gw' => 'get8021q'), 'mac' => array('op' => 'get_mac_list', 'gw' => 'getmaclist'), 'portmac' => array('op' => 'get_port_mac_list', 'gw' => 'getportmaclist'));
    $breed = detectDeviceBreed($object_id);
    $allowed_ops = array();
    foreach ($available_ops as $prefix => $data) {
        if (permitted('object', 'liveports', $data['op']) and validBreedFunction($breed, $data['gw'])) {
            $allowed_ops[] = $prefix;
        }
    }
    // make JS array with allowed items
    $list = '';
    foreach ($allowed_ops as $item) {
        $list .= "'" . addslashes($item) . "', ";
    }
    $list = trim($list, ", ");
    addJS('js/jquery.thumbhover.js');
    addCSS('css/jquery.contextmenu.css');
    addJS('js/jquery.contextmenu.js');
    addJS("enabled_elements = [ {$list} ];", TRUE);
    addJS('js/portinfo.js');
}
Exemple #4
0
function assertBreedFunction($breed, $command)
{
    global $breedfunc;
    if (!validBreedFunction($breed, $command)) {
        throw new RTGatewayError('unsupported command for this breed');
    }
}
function switchportInfoJS($object_id)
{
    $available_ops = array('link' => array('op' => 'get_link_status', 'gw' => 'getportstatus'), 'conf' => array('op' => 'get_port_conf', 'gw' => 'get8021q'), 'mac' => array('op' => 'get_mac_list', 'gw' => 'getmaclist'), 'portmac' => array('op' => 'get_port_mac_list', 'gw' => 'getportmaclist'));
    $breed = detectDeviceBreed($object_id);
    $allowed_ops = array();
    foreach ($available_ops as $prefix => $data) {
        if (permitted('object', 'liveports', $data['op']) and validBreedFunction($breed, $data['gw'])) {
            $allowed_ops[] = $prefix;
        }
    }
    addJS('js/jquery.thumbhover.js');
    addCSS('css/jquery.contextmenu.css');
    addJS('js/jquery.contextmenu.js');
    addJS("enabled_elements = " . json_encode($allowed_ops), TRUE);
    addJS('js/portinfo.js');
}
Exemple #6
0
function trigger_anyDP($command, $constraint)
{
    if (validBreedFunction(detectDeviceBreed(getBypassValue()), $command) and considerConfiguredConstraint(spotEntity('object', getBypassValue()), $constraint)) {
        return 'std';
    }
    return '';
}