Exemple #1
0
function editPortForObject()
{
    global $sic;
    assertUIntArg('port_id');
    assertUIntArg('port_type_id');
    assertStringArg('reservation_comment', TRUE);
    genericAssertion('l2address', 'l2address0');
    genericAssertion('name', 'string');
    commitUpdatePort($sic['object_id'], $sic['port_id'], $sic['name'], $sic['port_type_id'], $sic['label'], $sic['l2address'], $sic['reservation_comment']);
    if (array_key_exists('cable', $_REQUEST)) {
        commitUpdatePortLink($sic['port_id'], $sic['cable']);
    }
    showFuncMessage(__FUNCTION__, 'OK', array($_REQUEST['name']));
}
function updateCableIdAJAX()
{
    global $sic;
    assertUIntArg('id');
    assertStringArg('text', TRUE);
    $port_info = getPortInfo($sic['id']);
    fixContext(spotEntity('object', $port_info['object_id']));
    assertPermission('object', 'ports', 'editPort');
    if (!$port_info['linked']) {
        throw new RackTablesError('Cant update cable ID: port is not linked');
    }
    if ($port_info['reservation_comment'] !== $sic['text']) {
        commitUpdatePortLink($sic['id'], $sic['text']);
    }
    echo 'OK';
}
function editPortForObject()
{
    setFuncMessages(__FUNCTION__, array('OK' => 6));
    global $sic;
    $port_id = assertUIntArg('port_id');
    commitUpdatePort(getBypassValue(), $port_id, genericAssertion('name', 'string'), assertStringArg('port_type_id'), genericAssertion('label', 'string0'), genericAssertion('l2address', 'l2address0'), assertStringArg('reservation_comment', TRUE));
    if (array_key_exists('cable', $_REQUEST)) {
        commitUpdatePortLink($port_id, $sic['cable']);
    }
    showFuncMessage(__FUNCTION__, 'OK', array($_REQUEST['name']));
}