--- relativity.module	2007-02-21 10:26:21.000000000 +0100
+++ relativity_new.module	2007-02-21 10:22:25.000000000 +0100
@@ -12,6 +12,14 @@ if (module_exists('views')) {
   include_once('relativity_views.inc');
 }
 
+
+/**
+ * Implementation of hook_perm()
+ */
+function relativity_perm() {
+  return array('create child');
+}
+
 /**
  * Generates an array of named nodes keyed by node type.
  * With no args, returns relativity node types
@@ -625,6 +633,27 @@ function relativity_display_settings() {
       '#maxlength' => 4,	
       '#default_value' => variable_get('relativity_'.$type.'_children_weight', 11),
     );
+    
+    $group['node_'.$type.'_options']['relativity_'.$type.'_show_parents_link'] = array(
+      '#type' => 'radios',
+      '#title' => t('Show parent nodes link'),	
+      '#default_value' => variable_get('relativity_'.$type.'_show_parents_link', 1),	
+      '#options' => array(t('no'), t('yes')),
+    );
+    
+    $group['node_'.$type.'_options']['relativity_'.$type.'_show_children_link'] = array(
+      '#type' => 'radios',
+      '#title' => t('Show child nodes link'),	
+      '#default_value' => variable_get('relativity_'.$type.'_show_children_link', 1),	
+      '#options' => array(t('no'), t('yes')),
+    );
+    
+    $group['node_'.$type.'_options']['relativity_'.$type.'_show_link_operations'] = array(
+      '#type' => 'radios',
+      '#title' => t('Show link operations'),	
+      '#default_value' => variable_get('relativity_'.$type.'_show_link_operations', 1),	
+      '#options' => array(t('no'), t('yes')),
+    );
 
 
     $render_opts = array(
@@ -663,6 +692,7 @@ function relativity_block($op = 'list', 
       $blocks[0]['info'] = t('Node relativity: ancestors');
       $blocks[1]['info'] = t('Node relativity: children');
       $blocks[2]['info'] = t('Node relativity: parent');
+      $blocks[3]['info'] = t('Node relativity: links');
       return $blocks;
 
     case 'configure':
@@ -778,6 +808,15 @@ function relativity_block($op = 'list', 
                                );
               }
               break;
+            case 3:
+              $types = variable_get('relativity_type_'. $node->type, FALSE);
+              $content = theme('relativity_links', $types, $node, 'view'); 
+              if ($content) {
+                $block = array('subject' => t('Node relativity links'),
+                               'content' => $content,
+                               );
+              }
+              break;
           }
         }
       }  
@@ -1089,14 +1128,14 @@ function relativity_nodeapi(&$node, $op,
         }
       }
 
-      if ($w = variable_get('relativity_'.$node->type.'_parents_weight', 10)) {
+      if ($w = variable_get('relativity_'.$node->type.'_parents_weight', 10) && variable_get('relativity_'.$node->type.'_show_parents_link', 1)) {
         $node->content['relativity_parents'] = array(
           '#value' => theme('relativity_show_parents', $node),
           '#weight' => $w,
         );
       }
 
-      if ($w = variable_get('relativity_'.$node->type.'_children_weight', 11)) {
+      if ($w = variable_get('relativity_'.$node->type.'_children_weight', 11) && variable_get('relativity_'.$node->type.'_show_children_link', 1)) {
         $node->content['relativity_children'] = array(
           '#value' => theme('relativity_show_children', $node),
           '#weight' => $w,
@@ -1104,7 +1143,7 @@ function relativity_nodeapi(&$node, $op,
       }
 
       // output links to attach allowed children types and remove existing children
-      if ($types = variable_get('relativity_type_'. $node->type, FALSE)) {
+      if ($types = variable_get('relativity_type_'. $node->type, FALSE) && variable_get('relativity_'.$node->type.'_show_link_operations', 1)) {
         $node->content['relativity_operations'] = array(
           '#value' => theme('relativity_links', $types, $node, 'view'),
           '#weight' => 20,
@@ -1389,7 +1428,7 @@ function theme_relativity_links($types, 
 
       // only offer to let user create new child if user has 'create' access 
       // and common child relationship isn't required
-      if ($may_create && node_access('update', $parent)) {
+      if ($may_create && (node_access('update', $parent) || user_access('create child'))) {
         $output .= l(t('create new !type', array('!type'=>$type_name)), "node/add/$type/parent/$parent_nid");
       }
 
