function requireMandatoryAttrGeneric($listsrc, $attr_id, $newval) { $object_id = getBypassValue(); $attrs = getAttrValues($object_id); if (array_key_exists($attr_id, $attrs) && considerGivenConstraint(spotEntity('object', $object_id), $listsrc) && !mb_strlen($newval)) { showError('Mandatory attribute "' . $attrs[$attr_id]['name'] . '" not set'); stopOpPropagation(); } return ''; }
function formatAttributeValue($record) { if ('date' == $record['type']) { return datetimestrFromTimestamp($record['value']); } if (!isset($record['key'])) { if ($record['id'] == 3) { // FQDN attribute foreach (getMgmtProtosConfig() as $proto => $filter) { try { if (considerGivenConstraint(NULL, $filter)) { $blank = preg_match('/^https?$/', $proto) ? 'target=_blank' : ''; return "<a {$blank} title='Open {$proto} session' class='mgmt-link' href='" . $proto . '://' . $record['a_value'] . "'>{$record['a_value']}</a>"; } } catch (RackTablesError $e) { // syntax error in $filter continue; } } } return isset($record['href']) ? "<a href=\"" . $record['href'] . "\">{$record['a_value']}</a>" : $record['a_value']; } $href = makeHref(array('page' => 'depot', 'tab' => 'default', 'andor' => 'and', 'cfe' => '{$attr_' . $record['id'] . '_' . $record['key'] . '}')); $result = "<a href='{$href}'>" . $record['a_value'] . "</a>"; if (isset($record['href'])) { $result .= " <a class='img-link' href='{$record['href']}'>" . getImageHREF('html', 'vendor's info page') . "</a>"; } return $result; }