diff -P -r -u -F '^function' notepad_old/notepad.install notepad/notepad.install
--- notepad_old/notepad.install	2007-04-03 13:39:25.000000000 +0200
+++ notepad/notepad.install	2007-04-05 17:33:06.000000000 +0200
@@ -12,8 +12,16 @@ function notepad_install() {
                   vid int(10) NOT NULL default '0',
                   nid int(10) NOT NULL default '0',
                   priority tinyint(1) NOT NULL default '0',
+                  personal TINYINT(1) NOT NULL DEFAULT '0',
                   PRIMARY KEY (vid),
-                  KEY notepad (nid)
+                  KEY notepad (nid, personal)
+                ) TYPE=MyISAM;");
+      db_query("CREATE TABLE {notepad_nodes} (
+                  nid int(10) NOT NULL default '0',
+                  node_id int(10) NOT NULL default '0'
+                  node_type varchar(32) NOT NULL,
+                  uid int(11) NOT NULL DEFAULT '0',
+                  KEY notepad_nodes (nid, node_id, uid)
                 ) TYPE=MyISAM;");
       break;
   }
@@ -24,5 +32,6 @@ function notepad_install() {
  */
 function notepad_uninstall() {
   db_query('DROP TABLE {notepad_node_metadata}');
+  db_query('DROP TABLE {notepad_nodes}');
   variable_del('number_of_notes_to_show', 10);
 }
diff -P -r -u -F '^function' notepad_old/notepad.module notepad/notepad.module
--- notepad_old/notepad.module	2007-04-03 16:48:54.000000000 +0200
+++ notepad/notepad.module	2007-04-11 14:10:59.000000000 +0200
@@ -39,17 +39,87 @@ function notepad_menu($may_cache) {
       'path'     => 'notepad',
       'title'    => t('My Notes'),
       'callback' => 'notepad_summary',
+      'callback arguments' => array('user'),
       'access'   => user_access('can use notepad'),
-      'type'     => MENU_CALLBACK
+      'type'     => MENU_NORMAL_ITEM,
+      'weight'   => 0,
     );
-    /*
     $items[] = array(
-      'path'   => 'node/add/notepad',
-      'title'  => t('note'),
-      'access' => user_access('can use notepad'),
-      'type'   => MENU_NORMAL_ITEM
+      'path'     => 'notepad/list',
+      'title'    => t('My Notes'),
+      'access'   => user_access('can use notepad'),
+      'type'     => MENU_DEFAULT_LOCAL_TASK,
+    );
+    $items[] = array(
+      'path'     => 'notepad/list/user',
+      'title'    => t('My Personal Notes'),
+      'callback' => 'notepad_summary',
+      'callback arguments' => array('user'),
+      'access'   => user_access('can use notepad'),
+      'type'     => MENU_LOCAL_TASK,
+      'weight'   => 1,
+    );
+    $items[] = array(
+      'path'     => 'notepad/list/content',
+      'title'    => t('Content Notes'),
+      'callback' => 'notepad_summary',
+      'callback arguments' => array('content'),
+      'access'   => user_access('can use notepad'),
+      'type'     => MENU_LOCAL_TASK,
+      'weight'   => 2,
+    );
+    $items[] = array(
+      'path'     => 'notepad/add',
+      'title'    => t('Add'),
+      'callback' => 'notepad_summary',
+      'callback arguments' => array('add'),
+      'access'   => user_access('can use notepad'),
+      'type'     => MENU_LOCAL_TASK,
+      'weight'   => 2,
     );
-    */
+    $items[] = array(
+      'path'        => 'admin/settings/notepad',
+      'title'       => t('Notepad'),
+      'description' => t('Choose the node types that can have notes.'),
+      'callback'    => 'drupal_get_form',
+      'callback arguments' => array('notepad_settings'),
+      'access'      => user_access('administer content types'),
+      'type'        => MENU_NORMAL_ITEM,
+    );
+  }
+  else {
+    if (arg(0) == 'node' && is_numeric(arg(1)) && user_access('can use notepad')) {
+      $nid = arg(1);
+      $sql = 'SELECT type FROM {node} WHERE nid=%d';
+      $type = db_result(db_query($sql, $nid));
+      $node_types = variable_get('notepad_node_types', array());
+      if (isset($node_types[$type])) {
+        $items[] = array(
+          'path'     => 'node/'. arg(1) .'/notepad',
+          'title'    => t('Notepad'),
+          'callback' => 'notepad_node',
+          'callback arguments' => array($nid),
+          'access'   => user_access('can use notepad'),
+          'type'     => MENU_LOCAL_TASK,
+          'weight'   => 2
+        );
+        $items[] = array(
+          'path'     => 'node/'. arg(1) .'/notepad/list',
+          'title'    => t('List'),
+          'access'   => user_access('can use notepad'),
+          'type'     => MENU_DEFAULT_LOCAL_TASK,
+        );
+        $items[] = array(
+          'path'     => 'node/'. arg(1) .'/notepad/add',
+          'title'    => t('Add'),
+          'callback' => 'notepad_node',
+          'callback arguments' => array($nid, 'add'),
+          'access'   => user_access('can use notepad'),
+          'type'     => MENU_LOCAL_TASK,
+          'weight'   => 2
+        );
+      }
+    }
   }
   return $items;
 }
@@ -85,7 +155,7 @@ function notepad_block($op = 'list', $de
           }
 
           // Now define the subject and pass the rows through the themeable helper function
-          $block['subject'] = t('Your Notes');
+          $block['subject'] = t('My Notes');
           $block['content'] = theme('notepad_block_content', $rows);
           return $block;
         }
@@ -131,7 +201,6 @@ function notepad_node_info() {
  * Implementation of hook_form().
  */
 function notepad_form(&$node) {
-  
   // Title
   $form['title'] = array(
     '#type' => 'textfield',
@@ -163,6 +232,11 @@ function notepad_form(&$node) {
     '#multiple'      => FALSE,
     '#description'   => t('The priority of the note (0 high, 9 low)  - mainly to govern the order in which they are listed.'),
   );
+  
+  $related_nid = arg(3);
+  $related_nid = (is_numeric($related_nid) ? $related_nid : 0);
+  $form['related_nid'] = array('#type' => 'hidden', '#value' => $related_nid);
+  
   return $form;
 }
 
@@ -223,7 +297,14 @@ function notepad_validate(&$node) {
  * Implementation of hook_insert().
  */
 function notepad_insert($node) {
-  db_query("INSERT INTO {notepad_node_metadata} (vid, nid, priority) VALUES (%d, %d, %d)", $node->vid, $node->nid, $node->priority);
+  $personal = ($node->related_nid ? 0 : 1);
+  db_query("INSERT INTO {notepad_node_metadata} (vid, nid, priority, personal) VALUES (%d, %d, %d, %d)", $node->vid, $node->nid, $node->priority, $personal);
+  if ($node->related_nid) {
+    global $user;
+    
+    $related_node = node_load($node->related_nid);
+    db_query("INSERT INTO {notepad_nodes} (nid, node_id, node_type, uid) VALUES (%d, %d, '%s', %d)", $node->related_nid, $node->nid, $related_node->type, $user->uid);
+  }
 }
 
 /**
@@ -244,6 +325,7 @@ function notepad_update($node) {
  */
 function notepad_delete($node) {
   db_query("DELETE FROM {notepad_node_metadata} WHERE nid = %d", $node->nid);
+  db_query("DELETE FROM {notepad_nodes} WHERE nid = %d OR node_id = %d", $node->nid, $node->nid);
 }
 
 /**
@@ -266,14 +348,14 @@ function notepad_access($op, $node) {
       break;
       
     case 'update':
-      // Can onlu update / delete a note if you're the owner
+      // Can only update a note if you're the owner
       if ($user->uid == $node->uid) {
         return TRUE;
       }
       break;
       
     case 'delete':
-      // Can onlu update / delete a note if you're the owner
+      // Can only delete a note if you're the owner
       if ($user->uid == $node->uid) {
         return TRUE;
       }
@@ -283,6 +365,25 @@ function notepad_access($op, $node) {
   return FALSE;
 }
 
+/**
+ * Implementation of hook_link().
+ */
+function notepad_link($type, $node = NULL, $teaser = FALSE) {
+  $links = array();
+  if (!is_null($node)) {
+    $notepad_node_types = variable_get('notepad_node_types', array());
+    if (isset($notepad_node_types[$node->type])) {
+      $node_types = node_get_types('names');
+      $links['notepad'] = array(
+        'title' => t('Add Note'),
+        'href' => 'node/add/nodepad/'. $node->nid,
+        'attributes' => array('title' => t('Add a new note to this '. $node_types[$node->type])),
+      );
+    }
+  }
+  return $links;
+}
+
 /*****************************************************************************************
  * Menu Callbacks
  ****************************************************************************************/
@@ -290,41 +391,115 @@ function notepad_access($op, $node) {
 /**
  * 
  */
-function notepad_summary() {
+function notepad_summary($op = 'user') {
   global $user;
   
-  // Header
-  $rows [] = array(
-    array('data' => '<strong>'. t('Pri') .'</strong>', 'width' => '20', 'align' => 'center'),
-    array('data' => '<strong>'. t('Created') .'</strong>', 'width' => '150', 'align' => 'center'),
-    array('data' => '<strong>'. t('Title') .'</strong>', 'align' => 'left'),
-  );
+  if ($op == 'add') {
+    drupal_goto('node/add/notepad');
+  }
+  
+  switch ($op) {
+    case 'user':
+      // Headers
+      $header = array(
+        t('Priority'),
+      );
+    
+      $sql = "SELECT n.nid, n.title, n.created, n.changed, m.priority FROM {node} n INNER JOIN {notepad_node_metadata} m ON n.vid=m.vid WHERE n.uid = %d AND m.personal = 1 ORDER BY m.priority, n.changed DESC";
+      break;
+      
+    case 'content':
+      drupal_set_title(t('My Content Notes'));
 
-  // Now a table of the results
-  $result = db_query("SELECT n.nid, n.title, n.created, r.body, m.priority FROM {node} n LEFT JOIN {node_revisions} r ON n.vid = r.vid LEFT JOIN {notepad_node_metadata} m ON n.vid = m.vid WHERE n.type = 'notepad' AND n.uid = %d ORDER BY m.priority ASC", $user->uid);
-  if (db_num_rows($result) > 0) {
-    while ($row = db_fetch_object($result)) {
-      $rows [] = array(
-        array('data' => $row->priority, 'align' => 'center'),
-        array('data' => format_date($row->created, 'small'), 'align' => 'center'),
-        array('data' => l(check_plain($row->title),'node/' . $row->nid), 'title' => check_plain($row->title), 'align' => 'left'),
+      // Headers
+      $header = array(
+        t('Type'),
+        t('Notes'),
       );
+      
+      $sql = "SELECT COUNT(*) as note_count, n.nid, n.title, n.created, n.changed, n.uid, s.node_type FROM {node} n INNER JOIN {notepad_nodes} s ON n.nid=s.nid WHERE s.uid = %d GROUP BY n.nid ORDER BY n.changed DESC";
+      break;
+  }
+  
+  $header[] = t('Title');
+  $header[] = t('Created');
+  $header[] = t('Last Updated');
+  
+  $rows = array();
+  $result = db_query($sql, $user->uid);
+  while ($row = db_fetch_object($result)) {
+    $data = array();
+    if ($op == 'content') {
+      $data[] = $row->node_type;
+      $data[] = $row->note_count;
+      $path = 'node/' . $row->nid .'/notepad';
     }
+    else {
+      $data[] = $row->priority;
+      $path = 'node/' . $row->nid;
+    }
+    
+    $data[] = array('data' => l(check_plain($row->title), $path), 'title' => check_plain($row->title), 'align' => 'left');
+    $data[] = format_date($row->created, 'small');
+    $data[] = t('!time ago', array('!time' => format_interval(time() - $row->changed)));
+
+    $rows[] = $data;
   }
-  else {
-    $rows [] = array(array('data' => t('You have no notes'), 'align' => 'center', 'colspan' => '3'));
+  
+  if (!$rows) {
+    $rows [] = array(array('data' => t('Sorry, no notes'), 'align' => 'center', 'colspan' => '4'));
+  }
+
+  // build table output
+  $output = theme('table', $header, $rows, array('width' => '98%'));
+
+  // Show the page
+  print theme("page", $output);
+}
+
+/**
+ *
+ */
+function notepad_node($nid, $op = '') {
+  global $user;
+
+  if ($op == 'add') {
+    drupal_goto('node/add/notepad/'. $nid, 'destination=node/'. $nid .'/notepad');
   }
 
-  $output = theme('table', NULL, $rows, array('width' => '98%'));
+  // get all node types for display
+  $node_types = node_get_types('names');
+  
+  // Set node title
+  $node = node_load($nid);
+  drupal_set_title($node->title);
   
-  // Create a new note link
-  $links = l(t('add new note'), 'node/add/notepad');
-  // Create the output - start with some links
-  $output .= '<p><strong>'. t('Actions') .':</strong> '. $links .'</p>';
+  // Headers
+  $header = array(
+    t('Priority'),
+    t('Title'),
+    t('Created'),
+    t('Last Updated'),
+  );
 
-  // Set the breadcrumb & title
-  drupal_set_breadcrumb(array(l(t('Home'), '')));
-  drupal_set_title(t('Your Notes'));
+  // Now a table of the results
+  $rows = array();
+  $result = db_query("SELECT n.nid, n.title, n.created, n.changed, s.node_type, m.priority FROM node n INNER JOIN {notepad_nodes} s ON n.nid=s.node_id INNER JOIN {notepad_node_metadata} m ON m.nid=s.node_id WHERE s.nid = %d AND n.uid = %d ORDER BY m.priority, n.created DESC", $nid, $user->uid);
+  while ($row = db_fetch_object($result)) {
+    $rows [] = array(
+      $row->priority,
+      array('data' => l(check_plain($row->title),'node/' . $row->nid), 'title' => check_plain($row->title), 'align' => 'left'),
+      format_date($row->created, 'small'),
+      t('!time ago', array('!time' => format_interval(time() - $row->changed))),
+    );
+  }
+
+  if (!$rows) {
+    $rows [] = array(array('data' => t('Sorry, no notes'), 'align' => 'center', 'colspan' => '4'));
+  }
+
+  // build table output
+  $output = theme('table', $header, $rows, array('width' => '98%'));
 
   // Show the page
   print theme("page", $output);
@@ -342,6 +517,28 @@ function notepad_display_node($node) {
 
   return $output;
 }
+
+/**
+ *
+ */
+function notepad_settings() {
+  $output = '';
+
+  $node_types = node_get_types('names');
+  unset($node_types['notepad']);
+  $size = (count($node_types) <= 4 ? count($node_types) : 4);
+  $form['notepad_node_types'] = array(
+    '#type'          => 'select',
+    '#title'         => t('Node types'),
+    '#default_value' => variable_get('notepad_node_types', array()),
+    '#options'       => $node_types,
+    '#multiple'      => TRUE,
+    '#size'          => $size,
+    '#description'   => t("Select the node types that can have notes.")
+  );
+
+  return system_settings_form($form);
+}
  
 /*****************************************************************************************
  * form functions
@@ -356,21 +553,19 @@ function notepad_display_node($node) {
 function theme_notepad_block_content($rows) {
   $items = array();
   if (count($rows)) {
+  
+    // Add the links to the header
+    $links[] = array('title' => t('My Notes'), 'href' => 'notepad');
+    $links[] = array('title' => t('add new note'), 'href' => 'node/add/notepad');
+    //$output .= '<div align="center">:: '. l(t('add new note'), 'node/add/notepad') .' ::</div>';
+    $output = theme('links', $links, array('class' => 'links inline'));
+  
     foreach ($rows as $row) {
-      $items[] = '<strong>' . $row->priority . ' : </strong>' . l($row->title, 'node/'. $row->nid, array('title' => check_plain($row->body)));
+      $items[] = l($row->title, 'node/'. $row->nid, array('title' => check_plain($row->body)));
     }
+    // Now render the list using theme_item_list
+    $output .= theme('item_list', $items, NULL, 'ul');
   }
-  else {
-    $items [] = '<p align="center">None</p>';
-  }
-
-  // Now render the list using theme_item_list
-  $output = theme('item_list', $items, NULL, 'ul');
-
-  // Add the links to the footer
-  $output .= '<div align="center">:: '. l(t('view all notes'), 'notepad') .' ::</div>';
-  $output .= '<div align="center">:: '. l(t('add new note'), 'node/add/notepad') .' ::</div>';
-
   return $output;
 }
  
