Index: mysite.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/mysite.module,v
retrieving revision 1.63
diff -u -r1.63 mysite.module
--- mysite.module	12 Sep 2007 01:33:15 -0000	1.63
+++ mysite.module	12 Sep 2007 07:23:47 -0000
@@ -346,11 +346,12 @@
       if (is_array($types)) {
         foreach ($types as $type) {
           $check = module_invoke('mysite_type', $type, FALSE);
-          if (function_exists('mysite_type_'. $type .'_settings') && is_array($check)) {
+          if (function_exists('mysite_type_'. $type .'_title') && is_array($check)) {
             $items[] = array('path' => 'admin/settings/mysite/type/'. $type,
             'title' => t('@type', array('@type' => ucwords($type))),
             'description' => t('Settings for the @type plugin', array('@type' => ucwords($type))),            
-            'callback' => 'mysite_type_'. $type .'_settings',       
+            'callback' => 'mysite_type_settings',
+            'callback arguments' => array($type),     
             'type' => MENU_LOCAL_TASK,
             'access' => $admin,            
             'weight' => 0);
@@ -3437,4 +3438,93 @@
 function theme_mysite_no_options($owner, $option) {
   $output = '<p>'. t('@name, there is no @option content available to add to your collection.', array('@name' => $owner->name, '@option' => $option)) .'</p>';
   return $output;
+}
+
+/**
+ * Admin settings form for each content type. Presents configuration options for visible settings.
+ * @ingroup mysite
+ */
+function mysite_type_settings_form($type){
+	$default_settings = module_invoke('mysite_type', $type, FALSE);
+	$form = array();
+	$form['type'] = array(
+	'#type' => 'value',
+	'#value' => $type
+	);
+	$form['mysite_type_default_settings'] = array(
+	'#type' => 'fieldset',
+	'#title' => t('Basic @type Settings', array('@type' => ucwords($type))),
+	'#collapsible' => TRUE
+	);
+	$form['mysite_type_default_settings']['mysite_type_'. $type .'-prefix'] = array(
+	'#type' => 'textfield',
+	'#size' => 40,
+	'#maxlength' => 40,
+	'#title' => t('Prefix'),
+	'#default_value' => t($default_settings['prefix']),
+	);
+	$form['mysite_type_default_settings']['mysite_type_'. $type .'-suffix'] = array(
+	'#type' => 'textfield',
+	'#size' => 40,
+	'#maxlength' => 40,
+	'#title' => t('Suffix'),
+	'#default_value' => t($default_settings['suffix']),
+	);
+	$form['mysite_type_default_settings']['mysite_type_'. $type .'-label'] = array(
+	'#type' => 'textfield',
+	'#size' => 40,
+	'#maxlength' => 40,
+	'#title' => t('Label'),
+	'#required' => TRUE,
+	'#default_value' => t($default_settings['label']),
+	);
+	$form['mysite_type_default_settings']['mysite_type_'. $type .'-link_target'] = array(
+	'#type' => 'select',
+	'#title' => t('Link target'),
+	'#description' => t(''),
+	'#options' => array('_self' => t('Self'), '_blank' => t('Blank'), '_parent' => t('Parent'), '_top' => t('Top')),
+	'#default_value' => $default_settings['link_target']
+	);
+	return  system_settings_form($form);
+}
+
+/**
+ * Form submit funtion.
+ * @ingroup mysite
+ */
+function mysite_type_settings_form_submit($form_id, $form_values){
+	$type = $form_values['type'];
+	if ($form_values['op'] == t('Save configuration'))
+	{
+		$values = array();
+		foreach ($form_values as $key => $value)
+		{
+			$setting = explode('-', $key);
+			if ($setting[0] == 'mysite_type_' . $type)
+			{
+				$values[$setting[1]] = $value;
+			}
+		}
+		variable_set('mysite_basic_' . $type . '_settings', $values);
+		drupal_set_message(t('The configuration options have been saved.'));
+	}
+	elseif ($form_values['op'] == t('Reset to defaults'))
+	{
+		variable_del('mysite_basic_' . $type . '_settings');
+		drupal_set_message(t('The configuration options have been reset to their default values.'));
+	}
+	cache_clear_all();
+}
+
+/**
+ * Menu callback; presents forms with configuration options for each cotent type.
+ * @ingroup mysite
+ */
+function mysite_type_settings($type){
+	$output = drupal_get_form('mysite_type_settings_form', $type);
+	if (function_exists('mysite_type_' . $type . '_settings'))
+	{
+		$output .= call_user_func('mysite_type_' . $type . '_settings');
+	}
+	return  $output;
 }
\ No newline at end of file
Index: plugins/types/aggregator.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/aggregator.inc,v
retrieving revision 1.14
diff -u -r1.14 aggregator.inc
--- plugins/types/aggregator.inc	19 Aug 2007 20:02:57 -0000	1.14
+++ plugins/types/aggregator.inc	12 Sep 2007 07:18:03 -0000
@@ -27,6 +27,8 @@
       'help' => t('Some web feeds are combined into categories. You can add an entire category of feeds to your personal page.'),
       'search' => TRUE
     );
+	$basic_settings = variable_get('mysite_basic_aggregator_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_aggregator_options();
     }
@@ -105,11 +107,12 @@
     $result = db_query_range($sql, $feed->cid, 0, variable_get('mysite_elements', 5));
     $items = array();
     $i = 0;
+    $type = mysite_type_aggregator(FALSE);
     while ($obj = db_fetch_object($result)) {
       $sql = "SELECT fid, title AS feedtitle FROM {aggregator_feed} WHERE fid = %d";
       $source = db_fetch_object(db_query($sql, $obj->fid));
       $items[$i]['type'] = 'aggregator';
-      $items[$i]['link'] = l($obj->title, $obj->link);
+      $items[$i]['link'] = l($obj->title, $obj->link, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($obj->title);
       $items[$i]['date'] = $obj->timestamp;
       $items[$i]['uid'] = NULL;
Index: plugins/types/blog.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/blog.inc,v
retrieving revision 1.20
diff -u -r1.20 blog.inc
--- plugins/types/blog.inc	26 Aug 2007 19:38:51 -0000	1.20
+++ plugins/types/blog.inc	12 Sep 2007 07:18:13 -0000
@@ -27,6 +27,8 @@
       'help' => t('You can choose blog postings by specific users. Type a user name in the search box, or choose from the list of active bloggers.'),
       'search' => TRUE
     );
+	$basic_settings = variable_get('mysite_basic_blog_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_blog_options();
     }
@@ -114,10 +116,11 @@
       );
     $items = array();
     $i = 0;
+    $type = mysite_type_blog(FALSE);
     while ($nid = db_fetch_object($result)) {
       $node = node_load($nid->nid);
       $items[$i]['type'] = $node->type;
-      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid);
+      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($node->title);
       $items[$i]['subtitle'] = NULL; 
       $items[$i]['date'] = $node->changed;
Index: plugins/types/book.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/book.inc,v
retrieving revision 1.16
diff -u -r1.16 book.inc
--- plugins/types/book.inc	19 Aug 2007 20:02:57 -0000	1.16
+++ plugins/types/book.inc	12 Sep 2007 07:18:20 -0000
@@ -27,6 +27,8 @@
       'help' => t('You can track new pages for individual books. Type a book name in the search box, or choose from the list provided.'),
       'search' => TRUE
     );
+	$basic_settings = variable_get('mysite_basic_book_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_book_options();
     }
@@ -86,10 +88,11 @@
       );
     $items = array();
     $i = 0;
+    $type = mysite_type_book(FALSE);
     while ($nid = db_fetch_object($result)) {
       $node = node_load($nid->nid);
       $items[$i]['type'] = $node->type;
-      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid);
+      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($node->title);
       $items[$i]['subtitle'] = NULL; 
       $items[$i]['date'] = $node->changed;
Index: plugins/types/comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/comment.inc,v
retrieving revision 1.4
diff -u -r1.4 comment.inc
--- plugins/types/comment.inc	23 Aug 2007 00:39:06 -0000	1.4
+++ plugins/types/comment.inc	12 Sep 2007 07:18:57 -0000
@@ -27,6 +27,8 @@
       'help' => t('You can choose comments attached to specific posts. Search the list of active posts or browse from the list below.'),
       'search' => TRUE
     );
+	$basic_settings = variable_get('mysite_basic_comment_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_comment_options();
     }
@@ -88,9 +90,10 @@
       );
     $items = array();
     $i = 0;
+    $type = mysite_type_comment(FALSE);
     while ($comment= db_fetch_object($result)) {
       $items[$i]['type'] = 'comment';
-      $items[$i]['link'] = l($comment->subject, 'node/'. $comment->nid, array(), NULL, "comment-$comment->cid");
+      $items[$i]['link'] = l($comment->subject, 'node/'. $comment->nid, array('target' => $type['link_target']), array(), NULL, "comment-$comment->cid");
       $items[$i]['title'] = check_plain($comment->title);
       $items[$i]['subtitle'] = NULL; 
       $items[$i]['date'] = $comment->timestamp;
Index: plugins/types/droplet.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/droplet.inc,v
retrieving revision 1.18
diff -u -r1.18 droplet.inc
--- plugins/types/droplet.inc	1 Sep 2007 21:18:33 -0000	1.18
+++ plugins/types/droplet.inc	12 Sep 2007 07:04:23 -0000
@@ -26,6 +26,8 @@
     'help' => t('Droplets are helpful tools that you can add to your personal page.  Search by name or select from the list provided.'),
     'search' => TRUE,
   );
+  $basic_settings = variable_get('mysite_basic_droplet_settings', array());
+  $type = array_merge($type, $basic_settings);
   if ($get_options) {
     $type['options'] = mysite_type_droplet_options();
   }
Index: plugins/types/feed.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/feed.inc,v
retrieving revision 1.21
diff -u -r1.21 feed.inc
--- plugins/types/feed.inc	10 Sep 2007 16:47:51 -0000	1.21
+++ plugins/types/feed.inc	12 Sep 2007 07:19:11 -0000
@@ -27,6 +27,8 @@
       'help' => t('Web feeds from other sites can be added to your personal page. Use the search box, or select from the list provided.'),
       'search' => TRUE
     );
+	$basic_settings = variable_get('mysite_basic_feed_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_feed_options();
     }
@@ -160,9 +162,10 @@
     $result = db_query_range($sql, $feed->fid, 0, variable_get('mysite_elements', 5));
     $items = array();
     $i = 0;
+    $type = mysite_type_feed(FALSE);
     while ($obj = db_fetch_object($result)) {
       $items[$i]['type'] = 'feed';
-      $items[$i]['link'] = l($obj->title, $obj->link);
+      $items[$i]['link'] = l($obj->title, $obj->link, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($obj->title);
       $items[$i]['subtitle'] = NULL; 
       $items[$i]['date'] = $obj->timestamp;
Index: plugins/types/forum.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/forum.inc,v
retrieving revision 1.14
diff -u -r1.14 forum.inc
--- plugins/types/forum.inc	19 Aug 2007 20:02:57 -0000	1.14
+++ plugins/types/forum.inc	12 Sep 2007 07:19:19 -0000
@@ -22,6 +22,8 @@
       'help' => t('You can track posts within a forum. Type a keyword to search for matching forum topics, or select from the list provided.'),
       'search' => TRUE
     );
+    $basic_settings = variable_get('mysite_basic_forum_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_forum_options();
     }
@@ -118,11 +120,12 @@
       );
     $items = array();
     $i = 0;
+    $type = mysite_type_forum(FALSE);
     while ($nid = db_fetch_object($result)) {
       $node = node_load($nid->nid);
       $term = taxonomy_get_term($nid->tid);
       $items[$i]['type'] = $node->type;
-      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid);
+      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($node->title);
       if (count($term_list) > 1) {
         $items[$i]['subtitle'] = l(mysite_type_forum_title($term->tid, $term->name), 'forum/'. $term->tid);
Index: plugins/types/node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/node.inc,v
retrieving revision 1.9
diff -u -r1.9 node.inc
--- plugins/types/node.inc	19 Aug 2007 20:02:57 -0000	1.9
+++ plugins/types/node.inc	12 Sep 2007 07:19:26 -0000
@@ -22,6 +22,8 @@
       'help' => t('You can add recent posts by type to your personal page. Choose from the list of available content types.'),
       'search' => FALSE
     );
+	$basic_settings = variable_get('mysite_basic_node_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_node_options();
     }
@@ -115,10 +117,11 @@
       );
     $items = array();
     $i = 0;
+    $type = mysite_type_node(FALSE);
     while ($nid = db_fetch_object($result)) {
       $node = node_load($nid->nid);
       $items[$i]['type'] = $node->type;
-      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid);
+      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($node->title);
       $items[$i]['subtitle'] = NULL; 
       $items[$i]['date'] = $node->changed;
Index: plugins/types/popular.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/popular.inc,v
retrieving revision 1.4
diff -u -r1.4 popular.inc
--- plugins/types/popular.inc	30 Jun 2007 21:32:09 -0000	1.4
+++ plugins/types/popular.inc	12 Sep 2007 07:06:31 -0000
@@ -22,6 +22,8 @@
     'help' => t('Browse the list of the 100 most popular items on personal user pages.'),
     'search' => FALSE
   );
+  $basic_settings = variable_get('mysite_basic_popular_settings', array());
+  $type = array_merge($type, $basic_settings);
   if ($get_options) {
     $type['options'] = mysite_type_popular_options();
   }
Index: plugins/types/post.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/post.inc,v
retrieving revision 1.2
diff -u -r1.2 post.inc
--- plugins/types/post.inc	23 Aug 2007 00:39:06 -0000	1.2
+++ plugins/types/post.inc	12 Sep 2007 07:35:28 -0000
@@ -1,305 +1,615 @@
-<?php
-// $Id: post.inc,v 1.2 2007/08/23 00:39:06 agentken Exp $
-
-/**
-* @file
-* Allows users to add individual nodes to a MySite collection.
-* Original code by heebiejeebieclub.  http://drupal.org/node/165324
-*/
-
-/**
-* Implements mysite_type_hook().
-*
-* Node module must be enabled for this plugin to register.
-*
-*/
-function mysite_type_post($get_options = TRUE) {
-  if (module_exists('node')) {
-    $type = array(
-      'name' => t('Post'),
-      'description' => t('<b>Posts</b>: A specific, published post.'),
-      'include' => 'post',
-      'prefix' => t(''),
-      'suffix' => t(''),
-      'category' => t('Content'),
-      'weight' => 0,
-      'form' => FALSE,
-      'label' => t('Add Post'),
-      'help' => t('You can add individual posts to your page. Search the list of active posts or browse from the list provided.'),
-      'search' => TRUE
-    );
-    if ($get_options) {
-      $type['options'] = mysite_type_post_options();
-    }
-    return $type;
-  }
-}
-
-/**
-* Implements mysite_type_hook_active().
-*/
-function mysite_type_post_active($type) {
-  // some users must be allowed to view content, otherwise, give a configuration message
-  $result = db_query("SELECT perm FROM {permission}");
-  $check = '';
-  $br = '';
-  $message = '';
-  while ($perms = db_fetch_object($result)) {
-    $check .= $perms->perm;
-  }
-  if (stristr($check, 'access content')) {
-    $value = TRUE;
-  }
-  else {
-    $value = FALSE;
-    $message = l(t('No users have permission to access site content'), 'admin/user/access');
-    $br = '<br />';
-  }
-  return array($type => $value, 'message' => $message);
-}
-
-/**
-* Implements mysite_type_hook_options().
-*/
-function mysite_type_post_options() {
-  $options = array();
-  // construct the IN clause needed for node types
-  $in = mysite_type_post_in();
-  // we are dealing with nodes, so node_access requires db_rewrite_sql here. See http://drupal.org/node/135378.
-  $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 ORDER BY n.title");
-  if (!empty($in)) {
-    $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 AND n.type IN $in ORDER BY n.title");
-  }
-  $result = db_query($sql);
-  $nodes = array();
-  while ($item = db_fetch_object($result)) {
-    $nodes[] = $item;
-  }
-  foreach ($nodes as $key => $value) {
-    $options['name'][] = mysite_type_post_title($value->nid, $value->title);
-    $options['type_id'][] = $value->nid;
-    $options['type'][] = 'post';
-    $icon = mysite_get_icon('post', $value->nid);
-    $options['icon'][] = $icon;
-  }
-  return $options;
-}
-
-/**
-* Implements mysite_type_hook_data().
-*/
-function mysite_type_post_data($type_id = NULL, $settings = NULL) {
-  if (!empty($type_id)) {
-    $data = array(
-      'base' => 'node/'. $type_id,
-      'xml' => ''
-    );
-    $items = array();
-    $i = 0;
-    $node = node_load($type_id);
-    $items[$i]['type'] = $node->type;
-    $items[$i]['link'] = l($node->title, 'node/'. $node->nid);
-    $items[$i]['title'] = check_plain($node->title);
-    $items[$i]['subtitle'] = NULL;
-    $items[$i]['date'] = $node->changed;
-    $items[$i]['uid'] = $node->uid;
-    $items[$i]['author'] = check_plain($node->name);
-    $items[$i]['teaser'] = mysite_teaser($node);
-    $items[$i]['nid'] = $node->nid;
-    $data['items'] = $items;
-    return $data;
-  }
-  drupal_set_message(t('Could not find post data'), 'error');
-  return;
-}
-
-/**
-* Implements mysite_type_hook_title().
-*/
-function mysite_type_post_title($type_id = NULL, $title = NULL) {
-  if (!empty($type_id)) {
-    if (is_null($title)) {
-      $node = node_load($type_id);
-      $title = $node->title;
-    }
-    $type = mysite_type_post(FALSE);
-    $title = $type['prefix'] .' '. $title .' '. $type['suffix'];
-    $title = trim(rtrim($title));
-    return $title;
-  }
-  drupal_set_message(t('Could not find post title'), 'error');
-  return;
-}
-
-/**
-* Implements mysite_type_hook_block_node().
-*/
-function mysite_type_post_block_node($nid = NULL, $type = NULL) {
-  global $user;
-  $types = variable_get('mysite_post_settings', array(1));
-  if ($types[0] == 1 || in_array($type, $types)) {  
-    $data = array();
-    $data['uid'] = $user->uid;
-    $data['type'] = 'post';
-    $data['type_id'] = $nid;
-    $data['title'] = mysite_type_post_title($nid);
-    $content = mysite_block_handler($data);
-    return $content;
-  }  
-}
-
-/**
-* Implements mysite_type_hook_search().
-*
-* @ingroup forms
-*/
-function mysite_type_post_search($uid = NULL) {
-  if (!is_null($uid)) {
-    $output .= drupal_get_form('mysite_type_post_search_form', $uid);
-    return $output;
-  }
-}
-
-/**
-* FormsAPI for mysite_type_post_search()
-*
-* @ingroup forms
-*/
-function mysite_type_post_search_form($uid) {
-  $form['add_post']['post_title'] = array('#type' => 'textfield',
-    '#title' => t('Post title'),
-    '#maxlength' => 64,
-    '#size' => 40,
-    '#description' => t('The title of the post you wish to add.'),
-    '#required' => TRUE,
-    '#autocomplete_path' => 'autocomplete/mysite/post'
-  );
-  $form['add_post']['uid'] = array('#type' => 'hidden', '#value' => $uid);
-  $form['add_post']['type'] = array('#type' => 'hidden', '#value' => 'post');
-  $form['add_post']['submit'] = array('#type' => 'submit', '#value' => t('Add Post'));
-  return $form;
-}
-
-/**
-* Implements mysite_type_hook_search_form_submit().
-*
-* @ingroup forms
-*/
-function mysite_type_post_search_form_submit($form_id, $form_values) {
-  // construct the IN clause needed for node types
-  $in = mysite_type_post_in();
-  // we use LIKE here in case JavaScript autocomplete support doesn't work.
-  // or in case the user doesn't autocomplete the form
-  $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1");
-  if (!empty($in)) {
-    $sql = db_rewrite_sql("SELECT n.id, n.title FROM {node} WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1 AND n.type IN $in");  
-  }
-  $result = db_query($sql, $form_values['post_title']);
-  $count = 0;
-  while ($node = db_fetch_object($result)) {
-    $data[$count]['uid'] = $form_values['uid'];
-    $data[$count]['type'] = $form_values['type'];
-    $data[$count]['type_id'] = $node->nid;
-    $data[$count]['title'] = mysite_type_post_title($node->nid, $node->title);
-    $data[$count]['description'] = $node->title;
-    $count++;
-  }
-  // pass the $data to the universal handler
-  mysite_search_handler($data, 'post');
-  return;
-}
-
-/**
-* Implements mysite_type_hook_autocomplete().
-*
-* @ingroup forms
-*/
-function mysite_type_post_autocomplete($string) {
-  $matches = array();
-  // construct the IN clause needed for node types  
-  $in = mysite_type_post_in();  
-  $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1");
-  if (!empty($in)) {
-    $sql = db_rewrite_sql("SELECT n.id, n.title FROM {node} WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1 AND n.type IN $in");  
-  }  
-  $result = db_query_range($sql, $string, 0, 10);
-  while ($node = db_fetch_object($result)) {
-    $matches[$node->title] = check_plain($node->title);
-  }
-  return $matches;
-}
-
-/**
-* Implements mysite_type_hook_clear().
-*/
-function mysite_type_post_clear($type) {
-  // fetch all the active records of this type and see if they really exist in the proper table
-  $sql = "SELECT mid, uid, type_id, title FROM {mysite_data} WHERE type = '%s'";
-  $result = db_query($sql, $type);
-  $data = array();
-  while ($item = db_fetch_array($result)) {
-    $sql = "SELECT nid FROM {node} WHERE nid = %d AND status = 1";
-    $check = db_fetch_object(db_query($sql, $item['type_id']));
-    if (empty($check->nid)) {
-      $data[$item['mid']] = $item;
-    }
-  }
-  return $data;
-}
-
- /**
- * Implements mysite_type_hook_settings().
- */ 
-function mysite_type_post_settings() {
-  mysite_check_settings('post');
-  $default = variable_get('mysite_post_settings', array());
-  // if this variable is saved as blank, then a 0 => 1 value is present
-  unset($default[0]);
-  // get the content types
-  $types = node_get_types();
-  ksort($types);
-  $options = array();
-  foreach ($types as $key => $value) {
-    $options[$key] = "<b>$value->name</b>: ". $value->description;
-  }
-  $output = drupal_get_form('mysite_type_post_settings_form', $default, $types, $options);
-  return $output;
-}
-
-/**
- * FormsAPI for mysite_type_node_settings
- *
- * @ingroup forms
- */
-function mysite_type_post_settings_form($default, $types, $options) {
-  $form['mysite_post_settings'] = array(
-    '#type' => 'checkboxes',
-    '#title' => t('Allowed content types'),
-    '#prefix' => t('<h3>Content types</h3><p>Enabling the options below will allow users to add specific posts to their MySite page.</p><p><em>If no options are selected, then all node types will be available.</em></p>'),
-    '#default_value' => $default,
-    '#options' => $options,
-    '#required' => FALSE,
-    '#description' => t('Select the content types that users may select for their MySite page.')
-  ); 
-  return system_settings_form($form);     
-}
-
-/**
- * Helper function for constructing proper IN clause for node types.
- *
- * @return
- * NULL or a formatted ('one', 'two', 'three') string
- * @ingroup plugins
- */
-function mysite_type_post_in() {
-  // we have to get the allowed options and compare them to the stored options
-  $default = variable_get('mysite_post_settings', array(1));
-  // if all are selected, then array(0 => 1), so skip this routine
-  if ($default[0] == 1) {
-    return NULL;
-  }
-  // if this variable is saved as blank, then a 0 => 1 value is present
-  $content = array_flip($default);
-  unset($content[0]);  
-  return "('". implode("','", $content) ."')";
+<?php
+
+// $Id: post.inc,v 1.2 2007/08/23 00:39:06 agentken Exp $
+
+
+
+/**
+
+* @file
+
+* Allows users to add individual nodes to a MySite collection.
+
+* Original code by heebiejeebieclub.  http://drupal.org/node/165324
+
+*/
+
+
+
+/**
+
+* Implements mysite_type_hook().
+
+*
+
+* Node module must be enabled for this plugin to register.
+
+*
+
+*/
+
+function mysite_type_post($get_options = TRUE) {
+
+  if (module_exists('node')) {
+
+    $type = array(
+
+      'name' => t('Post'),
+
+      'description' => t('<b>Posts</b>: A specific, published post.'),
+
+      'include' => 'post',
+
+      'prefix' => t(''),
+
+      'suffix' => t(''),
+
+      'category' => t('Content'),
+
+      'weight' => 0,
+
+      'form' => FALSE,
+
+      'label' => t('Add Post'),
+
+      'help' => t('You can add individual posts to your page. Search the list of active posts or browse from the list provided.'),
+
+      'search' => TRUE
+
+    );
+    
+	$basic_settings = variable_get('mysite_basic_post_settings', array());
+	
+	$type = array_merge($type, $basic_settings);
+	
+    if ($get_options) {
+
+      $type['options'] = mysite_type_post_options();
+
+    }
+
+    return $type;
+
+  }
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_active().
+
+*/
+
+function mysite_type_post_active($type) {
+
+  // some users must be allowed to view content, otherwise, give a configuration message
+
+  $result = db_query("SELECT perm FROM {permission}");
+
+  $check = '';
+
+  $br = '';
+
+  $message = '';
+
+  while ($perms = db_fetch_object($result)) {
+
+    $check .= $perms->perm;
+
+  }
+
+  if (stristr($check, 'access content')) {
+
+    $value = TRUE;
+
+  }
+
+  else {
+
+    $value = FALSE;
+
+    $message = l(t('No users have permission to access site content'), 'admin/user/access');
+
+    $br = '<br />';
+
+  }
+
+  return array($type => $value, 'message' => $message);
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_options().
+
+*/
+
+function mysite_type_post_options() {
+
+  $options = array();
+
+  // construct the IN clause needed for node types
+
+  $in = mysite_type_post_in();
+
+  // we are dealing with nodes, so node_access requires db_rewrite_sql here. See http://drupal.org/node/135378.
+
+  $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 ORDER BY n.title");
+
+  if (!empty($in)) {
+
+    $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.status = 1 AND n.type IN $in ORDER BY n.title");
+
+  }
+
+  $result = db_query($sql);
+
+  $nodes = array();
+
+  while ($item = db_fetch_object($result)) {
+
+    $nodes[] = $item;
+
+  }
+
+  foreach ($nodes as $key => $value) {
+
+    $options['name'][] = mysite_type_post_title($value->nid, $value->title);
+
+    $options['type_id'][] = $value->nid;
+
+    $options['type'][] = 'post';
+
+    $icon = mysite_get_icon('post', $value->nid);
+
+    $options['icon'][] = $icon;
+
+  }
+
+  return $options;
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_data().
+
+*/
+
+function mysite_type_post_data($type_id = NULL, $settings = NULL) {
+
+  if (!empty($type_id)) {
+
+    $data = array(
+
+      'base' => 'node/'. $type_id,
+
+      'xml' => ''
+
+    );
+
+    $items = array();
+
+    $i = 0;
+
+    $type = mysite_type_post(FALSE);
+    
+    $node = node_load($type_id);
+
+    $items[$i]['type'] = $node->type;
+
+    $items[$i]['link'] = l($node->title, 'node/'. $node->nid, array('target' => $type['link_target']));
+
+    $items[$i]['title'] = check_plain($node->title);
+
+    $items[$i]['subtitle'] = NULL;
+
+    $items[$i]['date'] = $node->changed;
+
+    $items[$i]['uid'] = $node->uid;
+
+    $items[$i]['author'] = check_plain($node->name);
+
+    $items[$i]['teaser'] = mysite_teaser($node);
+
+    $items[$i]['nid'] = $node->nid;
+
+    $data['items'] = $items;
+
+    return $data;
+
+  }
+
+  drupal_set_message(t('Could not find post data'), 'error');
+
+  return;
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_title().
+
+*/
+
+function mysite_type_post_title($type_id = NULL, $title = NULL) {
+
+  if (!empty($type_id)) {
+
+    if (is_null($title)) {
+
+      $node = node_load($type_id);
+
+      $title = $node->title;
+
+    }
+
+    $type = mysite_type_post(FALSE);
+
+    $title = $type['prefix'] .' '. $title .' '. $type['suffix'];
+
+    $title = trim(rtrim($title));
+
+    return $title;
+
+  }
+
+  drupal_set_message(t('Could not find post title'), 'error');
+
+  return;
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_block_node().
+
+*/
+
+function mysite_type_post_block_node($nid = NULL, $type = NULL) {
+
+  global $user;
+
+  $types = variable_get('mysite_post_settings', array(1));
+
+  if ($types[0] == 1 || in_array($type, $types)) {  
+
+    $data = array();
+
+    $data['uid'] = $user->uid;
+
+    $data['type'] = 'post';
+
+    $data['type_id'] = $nid;
+
+    $data['title'] = mysite_type_post_title($nid);
+
+    $content = mysite_block_handler($data);
+
+    return $content;
+
+  }  
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_search().
+
+*
+
+* @ingroup forms
+
+*/
+
+function mysite_type_post_search($uid = NULL) {
+
+  if (!is_null($uid)) {
+
+    $output .= drupal_get_form('mysite_type_post_search_form', $uid);
+
+    return $output;
+
+  }
+
+}
+
+
+
+/**
+
+* FormsAPI for mysite_type_post_search()
+
+*
+
+* @ingroup forms
+
+*/
+
+function mysite_type_post_search_form($uid) {
+
+  $form['add_post']['post_title'] = array('#type' => 'textfield',
+
+    '#title' => t('Post title'),
+
+    '#maxlength' => 64,
+
+    '#size' => 40,
+
+    '#description' => t('The title of the post you wish to add.'),
+
+    '#required' => TRUE,
+
+    '#autocomplete_path' => 'autocomplete/mysite/post'
+
+  );
+
+  $form['add_post']['uid'] = array('#type' => 'hidden', '#value' => $uid);
+
+  $form['add_post']['type'] = array('#type' => 'hidden', '#value' => 'post');
+
+  $form['add_post']['submit'] = array('#type' => 'submit', '#value' => t('Add Post'));
+
+  return $form;
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_search_form_submit().
+
+*
+
+* @ingroup forms
+
+*/
+
+function mysite_type_post_search_form_submit($form_id, $form_values) {
+
+  // construct the IN clause needed for node types
+
+  $in = mysite_type_post_in();
+
+  // we use LIKE here in case JavaScript autocomplete support doesn't work.
+
+  // or in case the user doesn't autocomplete the form
+
+  $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1");
+
+  if (!empty($in)) {
+
+    $sql = db_rewrite_sql("SELECT n.id, n.title FROM {node} WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1 AND n.type IN $in");  
+
+  }
+
+  $result = db_query($sql, $form_values['post_title']);
+
+  $count = 0;
+
+  while ($node = db_fetch_object($result)) {
+
+    $data[$count]['uid'] = $form_values['uid'];
+
+    $data[$count]['type'] = $form_values['type'];
+
+    $data[$count]['type_id'] = $node->nid;
+
+    $data[$count]['title'] = mysite_type_post_title($node->nid, $node->title);
+
+    $data[$count]['description'] = $node->title;
+
+    $count++;
+
+  }
+
+  // pass the $data to the universal handler
+
+  mysite_search_handler($data, 'post');
+
+  return;
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_autocomplete().
+
+*
+
+* @ingroup forms
+
+*/
+
+function mysite_type_post_autocomplete($string) {
+
+  $matches = array();
+
+  // construct the IN clause needed for node types  
+
+  $in = mysite_type_post_in();  
+
+  $sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1");
+
+  if (!empty($in)) {
+
+    $sql = db_rewrite_sql("SELECT n.id, n.title FROM {node} WHERE LOWER(n.title) LIKE LOWER('%s%%') AND n.status = 1 AND n.type IN $in");  
+
+  }  
+
+  $result = db_query_range($sql, $string, 0, 10);
+
+  while ($node = db_fetch_object($result)) {
+
+    $matches[$node->title] = check_plain($node->title);
+
+  }
+
+  return $matches;
+
+}
+
+
+
+/**
+
+* Implements mysite_type_hook_clear().
+
+*/
+
+function mysite_type_post_clear($type) {
+
+  // fetch all the active records of this type and see if they really exist in the proper table
+
+  $sql = "SELECT mid, uid, type_id, title FROM {mysite_data} WHERE type = '%s'";
+
+  $result = db_query($sql, $type);
+
+  $data = array();
+
+  while ($item = db_fetch_array($result)) {
+
+    $sql = "SELECT nid FROM {node} WHERE nid = %d AND status = 1";
+
+    $check = db_fetch_object(db_query($sql, $item['type_id']));
+
+    if (empty($check->nid)) {
+
+      $data[$item['mid']] = $item;
+
+    }
+
+  }
+
+  return $data;
+
+}
+
+
+
+ /**
+
+ * Implements mysite_type_hook_settings().
+
+ */ 
+
+function mysite_type_post_settings() {
+
+  mysite_check_settings('post');
+
+  $default = variable_get('mysite_post_settings', array());
+
+  // if this variable is saved as blank, then a 0 => 1 value is present
+
+  unset($default[0]);
+
+  // get the content types
+
+  $types = node_get_types();
+
+  ksort($types);
+
+  $options = array();
+
+  foreach ($types as $key => $value) {
+
+    $options[$key] = "<b>$value->name</b>: ". $value->description;
+
+  }
+
+  $output = drupal_get_form('mysite_type_post_settings_form', $default, $types, $options);
+
+  return $output;
+
+}
+
+
+
+/**
+
+ * FormsAPI for mysite_type_node_settings
+
+ *
+
+ * @ingroup forms
+
+ */
+
+function mysite_type_post_settings_form($default, $types, $options) {
+
+  $form['mysite_post_settings'] = array(
+
+    '#type' => 'checkboxes',
+
+    '#title' => t('Allowed content types'),
+
+    '#prefix' => t('<h3>Content types</h3><p>Enabling the options below will allow users to add specific posts to their MySite page.</p><p><em>If no options are selected, then all node types will be available.</em></p>'),
+
+    '#default_value' => $default,
+
+    '#options' => $options,
+
+    '#required' => FALSE,
+
+    '#description' => t('Select the content types that users may select for their MySite page.')
+
+  ); 
+
+  return system_settings_form($form);     
+
+}
+
+
+
+/**
+
+ * Helper function for constructing proper IN clause for node types.
+
+ *
+
+ * @return
+
+ * NULL or a formatted ('one', 'two', 'three') string
+
+ * @ingroup plugins
+
+ */
+
+function mysite_type_post_in() {
+
+  // we have to get the allowed options and compare them to the stored options
+
+  $default = variable_get('mysite_post_settings', array(1));
+
+  // if all are selected, then array(0 => 1), so skip this routine
+
+  if ($default[0] == 1) {
+
+    return NULL;
+
+  }
+
+  // if this variable is saved as blank, then a 0 => 1 value is present
+
+  $content = array_flip($default);
+
+  unset($content[0]);  
+
+  return "('". implode("','", $content) ."')";
+
 }
\ No newline at end of file
Index: plugins/types/profile.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/profile.inc,v
retrieving revision 1.11
diff -u -r1.11 profile.inc
--- plugins/types/profile.inc	19 Aug 2007 20:02:57 -0000	1.11
+++ plugins/types/profile.inc	12 Sep 2007 07:19:38 -0000
@@ -29,6 +29,8 @@
     'help' => t('You may add your profile to your personal page.'),
     'search' => FALSE
   );
+  $basic_settings = variable_get('mysite_basic_profile_settings', array());
+  $type = array_merge($type, $basic_settings);
   if ($get_options) {
     $type['options'] = mysite_type_profile_options();
   }
@@ -129,8 +131,9 @@
     );
   $items = array();
   $i = 0;
+  $type = mysite_type_profile(FALSE);
   $items[$i]['type'] = 'profile';
-  $items[$i]['link'] = l($profile->name, 'user/'. $profile->uid);
+  $items[$i]['link'] = l($profile->name, 'user/'. $profile->uid, array('target' => $type['link_target']));
   $items[$i]['title'] = mysite_type_profile_title($profile->uid, $profile->name);
   $items[$i]['subtitle'] = NULL;
   $items[$i]['date'] = NULL;
Index: plugins/types/term.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/term.inc,v
retrieving revision 1.20
diff -u -r1.20 term.inc
--- plugins/types/term.inc	23 Aug 2007 00:39:06 -0000	1.20
+++ plugins/types/term.inc	12 Sep 2007 07:19:45 -0000
@@ -22,6 +22,8 @@
       'help' => t('You can track content by category. Type a keyword in the search box to find the matching category, or choose from the list provided.'),
       'search' => TRUE
     );
+	$basic_settings = variable_get('mysite_basic_term_settings', array());
+	$type = array_merge($type, $basic_settings);
     if ($get_options) {
       $type['options'] = mysite_type_term_options();
     }
@@ -120,10 +122,11 @@
     $i = 0;
     // we can't use node_view() here, because aggregator doesn't use nodes
     // and we need the same data structure for all content
+    $type = mysite_type_term(FALSE);
     while ($nid = db_fetch_object($result)) {
       $node = node_load($nid->nid);
       $items[$i]['type'] = $node->type;
-      $items[$i]['link'] = l($node->title, 'node/'. $node->nid);
+      $items[$i]['link'] = l($node->title, 'node/'. $node->nid, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($node->title);
       $items[$i]['subtitle'] = NULL;    
       $items[$i]['date'] = $node->changed;
Index: plugins/types/user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mysite/plugins/types/user.inc,v
retrieving revision 1.11
diff -u -r1.11 user.inc
--- plugins/types/user.inc	23 Aug 2007 00:39:06 -0000	1.11
+++ plugins/types/user.inc	12 Sep 2007 07:19:51 -0000
@@ -21,6 +21,8 @@
     'help' => t('You can choose to track postings by specific users. Type a user name in the search box, or choose from the list of active contributors.'),
     'search' => TRUE
   );
+  $basic_settings = variable_get('mysite_basic_user_settings', array());
+  $type = array_merge($type, $basic_settings);
   if ($get_options) {
     $type['options'] = mysite_type_user_options();
   }
@@ -114,10 +116,11 @@
       );
     $items = array();
     $i = 0;
+    $type = mysite_type_user(FALSE);
     while ($nid = db_fetch_object($result)) {
       $node = node_load($nid->nid);
       $items[$i]['type'] = $node->type;
-      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid);
+      $items[$i]['link'] = l($node->title, 'node/'. $nid->nid, array('target' => $type['link_target']));
       $items[$i]['title'] = check_plain($node->title);
       $items[$i]['subtitle'] = node_get_types('name', $node->type); 
       $items[$i]['date'] = $node->changed;
