--- D:\userlink\userlink.module.bak	2006-10-08 22:01:20.437500000 +0200
+++ D:\userlink\userlink.module	2006-10-10 07:33:39.718750000 +0200
@@ -356,7 +356,7 @@
 
   // The link should always set a target window -- we are saving it
   // on a site-wide basis at this point...
-  $atts = array('target' => variable_get('userlink_behavior', '_self'));
+  $atts = array('target' => variable_get('userlink_nodes_targetwindow', '_self'));
   
   if ($teaser) {
     $node->teaser = "<p class=\"userlink-url\">" . l($url, $node->url, $atts) . "</p>" . $node->teaser;
@@ -619,11 +619,20 @@
 function userlink_list($result, $title = NULL) {
   // The link should always set a target window -- we are saving it
   // on a site-wide basis at this point...
-  $atts = array('target' => variable_get('userlink_behavior', '_self'));
+  $atts = array('target' => variable_get('userlink_blocks_targetwindow', '_self'));
   
   while ($node = db_fetch_object($result)) {
     $atts['title'] = $node->url;
-    $items[] = l($node->title, $node->url, $atts);
+    
+	/* check whether to display the node, or go directly to the URL */    
+	if (variable_get('userlink_blocks_linktarget', 'node') == 'node')
+	{
+		$items[] = l($node->title, 'node/'.$node->nid, $atts);
+	}
+	elseif (variable_get('userlink_blocks_linktarget', 'url') == 'url')
+	{
+		$items[] = l($node->title, $node->url, $atts);
+	}
   }
 
   return theme('item_list', $items, $title);
@@ -682,15 +691,34 @@
 
 function userlink_settings()
 {
-  $form['userlink_behavior'] =
+  $form['userlink_nodes'] = array('#type' => 'fieldset', '#title' => t('Node settings'));
+  $form['userlink_nodes']['userlink_nodes_targetwindow'] =
     array('#type' => 'select',
-          '#options' => array('_self' => 'link appears in the same window',
-                              '_blank' => 'link appears in its own target window',
-                              'link-target' => 'link appears in a single target window'),
-          '#title' => t('What happens when a link is clicked'),
-          '#default_value' => variable_get('userlink_behavior', '_self'),
-          '#description' => t("The window where the linked page will appear after it is clicked on a user's page."));
-	
+          '#options' => array('_self' => 'in the same window (_self)',
+                              '_blank' => 'own target window (_blank)',
+                              'link-target' => 'single target window (link-target)'),
+          '#title' => t('Target window for a link in a node'),
+          '#default_value' => variable_get('userlink_nodes_targetwindow', '_blank'),
+          '#description' => t("The window where the linked page will appear after it is clicked on in a node."));
+
+  $form['userlink_blocks'] = array('#type' => 'fieldset', '#title' => t('Block settings'));      
+  $form['userlink_blocks']['userlink_blocks_targetwindow'] =
+    array('#type' => 'select',
+          '#options' => array('_self' => 'in the same window (_self)',
+                              '_blank' => 'own target window (_blank)',
+                              'link-target' => 'single target window (link-target)'),
+          '#title' => t('Target window for a link in a block'),
+          '#default_value' => variable_get('userlink_blocks_targetwindow', '_self'),
+          '#description' => t("The window where the linked page will appear after it is clicked on in a block."));
+
+  $form['userlink_blocks']['userlink_blocks_linktarget'] =
+    array('#type' => 'select',
+          '#options' => array('node' => 'display the node',
+                              'url' => 'go directly to the URL'),
+          '#title' => t('Display the node, or go directly to the URL'),
+          '#default_value' => variable_get('userlink_blocks_linktarget', 'node'),
+          '#description' => t("Whether to display the node, or go directly to the URL after it is clicked on in a block."));
+
   return $form;
 }
 
