diff -P -r -u -F '^function' notepad_4.7/notepad.info notepad/notepad.info
--- notepad_4.7/notepad.info	1970-01-01 02:00:00.000000000 +0200
+++ notepad/notepad.info	2007-04-03 13:37:49.000000000 +0200
@@ -0,0 +1,5 @@
+; $Id$
+name = Notepad
+description = A module for recording simple notes.
+package = "Other"
+version = "5.x-1.x-dev"
diff -P -r -u -F '^function' notepad_4.7/notepad.install notepad/notepad.install
--- notepad_4.7/notepad.install	1970-01-01 02:00:00.000000000 +0200
+++ notepad/notepad.install	2007-04-03 13:39:25.000000000 +0200
@@ -0,0 +1,28 @@
+<?php
+// $Id:$
+
+/**
+ * Implementation of hook_install().
+ */
+function notepad_install() {
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      db_query("CREATE TABLE {notepad_node_metadata} (
+                  vid int(10) NOT NULL default '0',
+                  nid int(10) NOT NULL default '0',
+                  priority tinyint(1) NOT NULL default '0',
+                  PRIMARY KEY (vid),
+                  KEY notepad (nid)
+                ) TYPE=MyISAM;");
+      break;
+  }
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function notepad_uninstall() {
+  db_query('DROP TABLE {notepad_node_metadata}');
+  variable_del('number_of_notes_to_show', 10);
+}
diff -P -r -u -F '^function' notepad_4.7/notepad.module notepad/notepad.module
--- notepad_4.7/notepad.module	2007-04-03 13:49:36.000000000 +0200
+++ notepad/notepad.module	2007-04-03 16:48:54.000000000 +0200
@@ -1,150 +1,190 @@
 <?php
+// $Id:$
 
-/* $Id: notepad.module,v 1.2 2007/02/11 06:18:06 jondoesdrupal Exp $ */
-
-//
-// Basic module functions
-//
-function notepad_help($section='') {
-  $output = '';
-
+/**
+ * notepad.module
+ */
+
+/*****************************************************************************************
+ * Drupal Hooks
+ ****************************************************************************************/
+
+/**
+ * Implementation of hook_help().
+ */
+function notepad_help($section) {
   switch ($section) {
-    case "admin/modules#description":
-      $output = t("A module for recording simple notes.");
-      break;
     case "node/add#notepad":
-      $output = t("Create a new note");
+      return t("Create a new note");
       break;
   }
-
-  return $output;
 }
 
-
+/**
+ * Implementation of hook_perm().
+ * Valid permissions for this module
+ * @return array An array of valid permissions for the onthisdate module
+ */
 function notepad_perm() {
   return array('can use notepad');
 }
 
+/**
+ * Implementation of hook_menu().
+ */
+function notepad_menu($may_cache) {
+  $items = array();
+  if ($may_cache) {
+    $items[] = array(
+      'path'     => 'notepad',
+      'title'    => t('My Notes'),
+      'callback' => 'notepad_summary',
+      'access'   => user_access('can use notepad'),
+      'type'     => MENU_CALLBACK
+    );
+    /*
+    $items[] = array(
+      'path'   => 'node/add/notepad',
+      'title'  => t('note'),
+      'access' => user_access('can use notepad'),
+      'type'   => MENU_NORMAL_ITEM
+    );
+    */
+  }
+  return $items;
+}
 
-function notepad_block($op='list', $delta = 0, $edit = array()) {
+/**
+ * Implementation of hook_block().
+ *
+ * Generate HTML for the products link block
+ * @param op the operation from the URL
+ * @param delta offset
+ * @returns block HTML
+ */
+function notepad_block($op = 'list', $delta = 0, $edit = array()) {
   global $user;
 
-  // listing of blocks, such as on the admin/block page
-  if ($op == "list") {
-     $block[0]["info"] = t('Notepad - your notes');
-     return $block;
-  }
-  else if ($op == 'view') {
-    if ($delta == 0) {
-      // Generate block info - only show if have perms to use module
-      if (user_access('can use notepad')) {
-        $result = db_query("SELECT n.nid, n.title, 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 LIMIT %d", $user->uid, variable_get('number_of_notes_to_show',  10));
-        if (db_num_rows($result) > 0) {
-          $rows = array();
-          while ($row = db_fetch_object($result)) {
-            $rows[] = $row;
+  switch ($op) {
+    case 'list':
+      // listing of blocks, such as on the admin/block page
+      $block[0]["info"] = t('Notepad');
+      return $block;
+      break;
+      
+    case 'view':
+      if ($delta == 0) {
+        // Generate block info - only show if have perms to use module
+        if (user_access('can use notepad')) {
+          $result = db_query("SELECT n.nid, n.title, 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 LIMIT %d", $user->uid, variable_get('number_of_notes_to_show', 10));
+          if (db_num_rows($result) > 0) {
+            $rows = array();
+            while ($row = db_fetch_object($result)) {
+              $rows[] = $row;
+            }
           }
-        }
 
-        // Now define the subject and pass the rows through the themeable helper function
-        $block['subject'] = t('Your Notes');
-        $block['content'] = theme('notepad_block_content', $rows);
-        return $block;
+          // Now define the subject and pass the rows through the themeable helper function
+          $block['subject'] = t('Your Notes');
+          $block['content'] = theme('notepad_block_content', $rows);
+          return $block;
+        }
       }
-    }
-  }
-  else if ($op == 'configure') {
-    if ($delta == 0) {
-      $form['number_of_notes_to_show'] = array('#type' => 'textfield',
-                                               '#title' => t('Number of notes to show'),
-                                               '#size' => 5,
-                                               '#description' => t('The number of results showm in the note block.'),
-                                               '#default_value' => variable_get('number_of_notes_to_show',  10));
-      return $form;
-    }
-  }
-  else if ($op == 'save') {
-    if ($delta == 0) {
-      variable_set('number_of_notes_to_show', $edit['number_of_notes_to_show']);
-    }
+      break;
+      
+    case 'configure':
+      if ($delta == 0) {
+        $form['number_of_notes_to_show'] = array(
+          '#type' => 'textfield',
+          '#title' => t('Number of notes to show'),
+          '#size' => 5,
+          '#description' => t('The number of results showm in the note block.'),
+          '#default_value' => variable_get('number_of_notes_to_show', 10)
+        );
+        return $form;
+      }
+      break;
+      
+    case 'save':
+      if ($delta == 0) {
+        variable_set('number_of_notes_to_show', $edit['number_of_notes_to_show']);
+      }
+      break;
   }
 }
-
-function notepad_menu() {
-  $items = array();
-  $items[] = array('path' => 'notepad',
-                   'title' => t('Your Notes'),
-                   'callback' => 'notepad_summary',
-                   'access' => user_access('can use notepad'),
-                   'type' => MENU_CALLBACK);
-  $items[] = array('path' => 'node/add/notepad',
-                   'title' => t('note'),
-                   'access' => user_access('can use notepad'),
-                   'type' => MENU_NORMAL_ITEM);
-  return $items;
-}
-
-
-//
-// Now the node functions
-//
+ 
+/**
+ * Implementation of hook_node_info().
+ */
 function notepad_node_info() {
-  return array('notepad' => array('name' => t('note'), 'base' => 'notepad'));
   return array(
     'notepad' => array(
-      'name' => t('note'),
-      'module' => 'notepad',
+      'name'        => t('Note'),
+      'module'      => 'notepad',
+      'body_label'  => t('Note'),
       'description' => t("A node for recording simple notes."),
     )
   );
 }
 
+/**
+ * Implementation of hook_form().
+ */
 function notepad_form(&$node) {
+  
   // Title
-  $form['title'] = array('#type' => 'textfield',
-                         '#title' => t('Title'),
-                         '#required' => TRUE, 
-                         '#default_value' => $node->title, 
-                         '#weight' => -5, 
-                         '#description' => t('The title of this note.'));
+  $form['title'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title'),
+    '#required' => TRUE,
+    '#default_value' => $node->title,
+    '#weight' => -5,
+    '#description' => t('The title of this note.')
+  );
 
   // full description / body
-  $form['body_filter']['body'] = array('#type' => 'textarea',
-                                       '#title' => t('Note body'),
-                                       '#default_value' => $node->body,
-                                       '#rows' => 10,
-                                       '#required' => FALSE);
+  $form['body_filter']['body'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Note body'),
+    '#default_value' => $node->body,
+    '#rows' => 10,
+    '#required' => FALSE
+  );
+                                       
   $form['body_filter']['format'] = filter_form($node->format);
 
   // Priority drop down box
   $options = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
-
-  $form['priority'] = array('#type' => 'select',
-                            '#title' => t('Priority'),
-                            '#default_value' => $node->priority,
-                            '#options' => $options,
-                            '#multiple' => FALSE,
-                            '#description' => t('The priority of the note (0 high, 9 low)  - mainly to govern the order in which they are listed.'));
-
+  $form['priority'] = array(
+    '#type'          => 'select',
+    '#title'         => t('Priority'),
+    '#default_value' => $node->priority,
+    '#options'       => $options,
+    '#multiple'      => FALSE,
+    '#description'   => t('The priority of the note (0 high, 9 low)  - mainly to govern the order in which they are listed.'),
+  );
   return $form;
-
-}
-
-function notepad_validate(&$node) {
-   // Just return true for now
-   return TRUE;
-}
-
-function notepad_insert($node) {
-  // Insert the metadata
-  db_query("INSERT INTO {notepad_node_metadata} (nid, vid, priority) VALUES (%d, %d, %d)", $node->nid, $node->vid, $node->priority);
-}
-
-function notepad_delete($node) {
-  // Insert the metadata
-  db_query("DELETE FROM {notepad_node_metadata} WHERE nid = %d", $node->nid);
 }
 
+/**
+ * Implementation of hook_nodeapi().
+ *
+ * "delete": The node is being deleted.
+ * "delete revision": The revision of the node is deleted. You can delete data associated with that revision.
+ * "insert": The node is being created (inserted in the database).
+ * "load": The node is about to be loaded from the database. This hook can be used to load additional data at this time.
+ * "prepare": The node is about to be shown on the add/edit form.
+ * "search result": The node is displayed as a search result. If you want to display extra information with the result, return it.
+ * "print": Prepare a node view for printing. Used for printer-friendly view in book_module
+ * "update": The node is being updated.
+ * "submit": The node passed validation and will soon be saved. Modules may use this to make changes to the node before it is saved to the database.
+ * "update index": The node is being indexed. If you want additional information to be indexed which is not already visible through nodeapi "view", then you should return it here.
+ * "validate": The user has just finished editing the node and is trying to preview or submit it. This hook can be used to check the node data. Errors should be set with form_set_error().
+ * "view": The node content is being assembled before rendering. The module may add elements $node->content prior to rendering. This hook will be called after hook_view(). The format of 4node->content is the same as used by Forms API.
+ * "alter": the $node->content array has been rendered, so the node body or teaser is filtered and now contains HTML. This op should only be used when text substitution, filtering, or other raw text operations are necessary.
+ * "rss item": An RSS feed is generated. The module can return properties to be added to the RSS item generated for this node. See comment_nodeapi() and upload_nodeapi() for examples. The $node passed can also be modified to add or remove contents to the feed item.
+ *
+ */
 function notepad_nodeapi(&$node, $op, $teaser, $page) {
   switch ($op) {
     case 'delete revision':
@@ -154,13 +194,41 @@ function notepad_nodeapi(&$node, $op, $t
   }
 }
 
+/**
+ * Implementation of hook_load().
+ */
 function notepad_load($node) {
   // Look up the node metadata
   $additions  = db_fetch_object(db_query("SELECT priority FROM {notepad_node_metadata} WHERE vid = %d", $node->vid));
-
   return $additions;
 }
 
+/**
+ * Implementation of hook_view().
+ */
+function notepad_view($node, $teaser = FALSE, $page = FALSE) {
+  $node = node_prepare($node, $teaser);
+  return $node;
+}
+
+/**
+ * Implementation of hook_validate().
+ */
+function notepad_validate(&$node) {
+   // Just return true for now
+   return TRUE;
+}
+
+/**
+ * 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);
+}
+
+/**
+ * Implementation of hook_update().
+ */
 function notepad_update($node) {
   // if this is a new node or we're adding a new revision,
   if ($node->revision) {
@@ -171,72 +239,88 @@ function notepad_update($node) {
   }
 }
 
-function notepad_view(&$node, $teaser = FALSE, $page = FALSE) {
-  $node = node_prepare($node, $teaser);
-  $node->body .= notepad_display_node($node);
+/**
+ * Implementation of hook_delete().
+ */
+function notepad_delete($node) {
+  db_query("DELETE FROM {notepad_node_metadata} WHERE nid = %d", $node->nid);
 }
 
+/**
+ * Implementation of hook_access().
+ */
 function notepad_access($op, $node) {
   global $user;
 
-  // Only owner can view a note
-  if ($op == 'view') {
-    if ($user->uid == $node->uid) {
-      return TRUE;
-    }
-  }
-
-  // Can only create notes if have perm
-  if ($op == 'create') {
-    // Only users with permission to do so may create this node type.
-    return user_access('can use notepad');
-  }
-
-  // Can onlu update / delete a note if you're the owner
-  if ($op == 'update' || $op == 'delete') {
-    if ($user->uid == $node->uid) {
-      return TRUE;
-    }
+  switch ($op) {
+    case 'view':
+      // Only owner can view a note
+      if ($user->uid == $node->uid) {
+        return TRUE;
+      }
+      break;
+      
+    case 'create':
+      // Can only create notes if have perm
+      return user_access('can use notepad');
+      break;
+      
+    case 'update':
+      // Can onlu update / delete 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
+      if ($user->uid == $node->uid) {
+        return TRUE;
+      }
+      break;
   }
-
-  // Docs don't say I should need this, but I do....
+  
   return FALSE;
 }
 
-
-//
-// Now the start of any custom page funtions
-//
+/*****************************************************************************************
+ * Menu Callbacks
+ ****************************************************************************************/
+
+/**
+ * 
+ */
 function notepad_summary() {
   global $user;
-
-  // Create a new note
-  $links = l(t('add new note'), 'node/add/notepad');
-
+  
   // 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'));
+  $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'),
+  );
 
   // 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), array('title' => check_plain($row->body)), 'align' => 'left'));
+      $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'),
+      );
     }
   }
   else {
-    $rows [] = array(array('data' => 'None', 'align' => 'center', 'colspan' => '3'));
+    $rows [] = array(array('data' => t('You have no notes'), 'align' => 'center', 'colspan' => '3'));
   }
 
-  $tableattributes = array('width' => '98%');
-
-  $output .= theme('table', $header = NULL, $rows, $tableattributes);
-
+  $output = theme('table', NULL, $rows, array('width' => '98%'));
+  
+  // 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>';
+  $output .= '<p><strong>'. t('Actions') .':</strong> '. $links .'</p>';
 
   // Set the breadcrumb & title
   drupal_set_breadcrumb(array(l(t('Home'), '')));
@@ -246,6 +330,9 @@ function notepad_summary() {
   print theme("page", $output);
 }
 
+/**
+ *
+ */
 function notepad_display_node($node) {
   // Set the breadcrumb
   drupal_set_breadcrumb(array(l(t('Home'), ''), l(t('your notes'), 'notepad')));
@@ -255,8 +342,17 @@ function notepad_display_node($node) {
 
   return $output;
 }
-
-// Notepad theme function for block content
+ 
+/*****************************************************************************************
+ * form functions
+ ****************************************************************************************/
+ 
+ 
+ 
+/*****************************************************************************************
+ * theme functions
+ ****************************************************************************************/
+ 
 function theme_notepad_block_content($rows) {
   $items = array();
   if (count($rows)) {
@@ -277,3 +373,7 @@ function theme_notepad_block_content($ro
 
   return $output;
 }
+ 
+/*****************************************************************************************
+ ****************************************************************************************/
+ 
Only in notepad_4.7/: notepad.mysql
