function guifi_domain_access($op, $id)
{
    global $user;
    guifi_log(GUIFILOG_TRACE, 'function guifi_domain_access()', $id);
    guifi_log(GUIFILOG_FULL, 'user='******'nid' => $domain['sid']));
    if ($op == 'create') {
        if (user_access('administer guifi dns') || user_access('create guifi dns')) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
    if ($op == 'update' or $op == 'delete') {
        if (user_access('administer guifi dns') || user_access('edit own guifi dns')) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
}
/**
 * outputs the node information
**/
function guifi_service_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE)
{
    node_prepare($node);
    if ($teaser) {
        return $node;
    }
    if ($block) {
        return $node;
    }
    if ($page) {
        drupal_set_breadcrumb(guifi_zone_ariadna($node->zone_id, 'node/%d/view/services'));
        $node->content['body']['#value'] = theme('box', t('Description'), $node->content['body']['#value']);
        $node->content['body']['#weight'] = 1;
        $service_data = array('#value' => theme('box', t('service information'), theme_guifi_service_data($node, FALSE)), '#weight' => -0);
        if ($node->service_type == 'DNS') {
            $form = drupal_get_form('guifi_domain_create_form', $node);
            $id = $node->id;
            $rows = array();
            $header = array('<h2>' . t('Domain') . '</h2>', array('data' => t('type'), 'style' => 'text-align: left;'), array('data' => t('Scope')));
            $query = db_query("SELECT d.id FROM {guifi_dns_domains} d WHERE sid=%d", $id);
            while ($d = db_fetch_object($query)) {
                $domain = guifi_domain_load($d->id);
                if (guifi_domain_access('update', $domain['id'])) {
                    $edit_domain = l(guifi_img_icon('edit.png'), 'guifi/domain/' . $domain['id'] . '/edit', array('html' => TRUE, 'title' => t('edit domain'), 'attributes' => array('target' => '_blank'))) . '</td><td>' . l(guifi_img_icon('drop.png'), 'guifi/domain/' . $domain['id'] . '/delete', array('html' => TRUE, 'title' => t('delete domain'), 'attributes' => array('target' => '_blank')));
                }
                $rows[] = array('<a href="' . url('guifi/domain/' . $domain[id]) . '">' . $domain['name'] . '</a>', array('data' => $domain['type'], 'style' => 'text-align: left;'), array('data' => $domain['scope']), $edit_domain);
            }
            if (count($rows)) {
                $node->content['data'] = array($service_data, array('#value' => theme('table', $header, $rows) . $form, '#weight' => 1));
            } else {
                $node->content['data'] = array(array('#value' => theme('box', t('service information'), theme_guifi_service_data($node, FALSE)) . $form, '#weight' => -0));
            }
        } else {
            $node->content['data'] = array(array('#value' => theme('box', t('service information'), theme_guifi_service_data($node, FALSE)) . $form, '#weight' => -0));
        }
    }
    return $node;
}