Index: node-nodeblock-default.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodeblock/node-nodeblock-default.tpl.php,v
retrieving revision 1.1
diff -u -p -r1.1 node-nodeblock-default.tpl.php
--- node-nodeblock-default.tpl.php	1 Apr 2009 03:12:10 -0000	1.1
+++ node-nodeblock-default.tpl.php	11 Dec 2010 17:37:16 -0000
@@ -14,27 +14,36 @@
  * - $nodeblock: Flag for the nodeblock context.
  */
 ?>
-<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">
+<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
 
-<?php print $picture ?>
+  <?php print $user_picture; ?>
 
-<?php if (!$page && !$nodeblock): ?>
-  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
-<?php endif; ?>
+  <?php print render($title_prefix); ?>
+  <?php if (!$page && !$nodeblock): ?>
+    <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
+  <?php endif; ?>
+  <?php print render($title_suffix); ?>
 
-  <div class="meta">
-  <?php if ($submitted): ?>
-    <span class="submitted"><?php print $submitted ?></span>
+  <?php if ($display_submitted): ?>
+    <div class="submitted">
+      <?php
+        print t('Submitted by !username on !datetime',
+          array('!username' => $name, '!datetime' => $date));
+      ?>
+    </div>
   <?php endif; ?>
 
-  <?php if ($terms): ?>
-    <div class="terms terms-inline"><?php print $terms ?></div>
-  <?php endif;?>
+  <div class="content"<?php print $content_attributes; ?>>
+    <?php
+      // We hide the comments and links now so that we can render them later.
+      hide($content['comments']);
+      hide($content['links']);
+      print render($content);
+    ?>
   </div>
 
-  <div class="content">
-    <?php print $content ?>
-  </div>
+  <?php print render($content['links']); ?>
+
+  <?php print render($content['comments']); ?>
 
-  <?php print $links; ?>
-</div>
\ No newline at end of file
+</div>
Index: nodeblock.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodeblock/nodeblock.info,v
retrieving revision 1.4
diff -u -p -r1.4 nodeblock.info
--- nodeblock.info	17 Sep 2008 22:05:35 -0000	1.4
+++ nodeblock.info	11 Dec 2010 17:37:16 -0000
@@ -1,4 +1,4 @@
 ; $Id: nodeblock.info,v 1.4 2008/09/17 22:05:35 rz Exp $
 name = Nodeblock
 description = Enables use of specified node types as custom blocks.
-core = 6.x
\ No newline at end of file
+core = 7.x
Index: nodeblock.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodeblock/nodeblock.module,v
retrieving revision 1.15
diff -u -p -r1.15 nodeblock.module
--- nodeblock.module	6 Jan 2010 16:46:58 -0000	1.15
+++ nodeblock.module	11 Dec 2010 17:37:16 -0000
@@ -7,6 +7,18 @@
  */
 
 /**
+ * hook_theme
+ */
+function nodeblock_theme($existing, $type, $theme, $path) {
+  return array(
+    'node__nodeblock__default' => array(
+      'render element' => 'elements',
+      'template' => 'node-nodeblock-default',
+    ),
+  );
+}
+
+/**
  * Utility function to tell whether a type is enabled as a node block
  */
 function nodeblock_type_enabled($type) {
@@ -21,7 +33,7 @@ function nodeblock_type_enabled($type) {
  */
 function nodeblock_form_alter(&$form, $form_state, $form_id) {
   // content type settings form
-  if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
+  if ($form_id == 'node_type_form') {
     $form['workflow']['nodeblock'] = array(
       '#type' => 'radios',
       '#title' => t('Available as block'),
@@ -51,102 +63,129 @@ function nodeblock_form_alter(&$form, $f
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * hook_node_delete
  */
-function nodeblock_nodeapi(&$node, $op, $teaser, $page) {
-  // do nothing if not enabled
+function nodeblock_node_delete() {
   if (!nodeblock_type_enabled($node)) {
     return;
   }
 
-  switch ($op) {
-    case 'load':
-      $tnid = $node->tnid ? $node->tnid : $node->nid;
-      return array('nodeblock_translation_fallback' => variable_get('nodeblock_translation_fallback_'. $tnid, 1));
-
-    case 'insert':
-    case 'update':
-      drupal_set_message(t('The block you just created is now available on the <a href="!url">block configuration page</a>.', array('!url' => url('admin/build/block'))));
-
-      // set the translation fallback variable if set.
-      if (isset($node->nodeblock['translation_fallback'])) {
-        $tnid = $node->tnid ? $node->tnid : $node->nid;
-        variable_set('nodeblock_translation_fallback_'. $tnid, $node->nodeblock['translation_fallback']);
-      }
-      _block_rehash();
-      break;
+  if (isset($node->nodeblock['translation_fallback'])) {
+    $tnid = $node->tnid ? $node->tnid : $node->nid;
+    variable_del('nodeblock_translation_fallback_'. $tnid);
+  }
+  _block_rehash();
+}
+/**
+ * hook_node_update
+ */
+function nodeblock_node_update($node) {
+  _nodeblock_insert_update($node);
+}
 
-    case 'delete':
-      _block_rehash();
-      break;
+/**
+ * hook_node_insert
+ */
+function nodeblock_node_insert($node) {
+  _nodeblock_insert_update($node);
+}
+
+/**
+ * consolidation of node insert/update code since behavior should be the same
+ */
+function _nodeblock_insert_update($node) {
+  if (!nodeblock_type_enabled($node)) {
+    return;
+  }
+
+  if ($node->status) {
+    drupal_set_message(t('The block you just created is now available on the <a href="!url">block configuration page</a>.', array('!url' => url('admin/structure/block'))));
+  }
+
+  // set the translation fallback variable if set.
+  if (isset($node->nodeblock['translation_fallback'])) {
+    $tnid = $node->tnid ? $node->tnid : $node->nid;
+    variable_set('nodeblock_translation_fallback_'. $tnid, $node->nodeblock['translation_fallback']);
   }
+  _block_rehash();
 }
 
 /**
- * Implementation of hook_block().
+ * hook_block_info
  */
-function nodeblock_block($op = 'list', $delta = 0, $edit = array()) {
-  $types = node_get_types();
-  if ($op == 'list') {
-    foreach ($types as $type) {
-      if (nodeblock_type_enabled($type)) {
-        // Fetch all nodes of this type, excluding translations.
-        $result = db_query("SELECT nid, title FROM {node} WHERE type = '%s' AND status = 1 AND (nid = tnid OR tnid = 0)", $type->type);
-        while ($node = db_fetch_object($result)) {
-          $blocks[$node->nid] = array('info' => $node->title .' (nodeblock)');
-        }
+function nodeblock_block_info() {
+  $blocks = array();
+  $types = node_type_get_types();
+  foreach ($types as $type) {
+    if (nodeblock_type_enabled($type)) {
+      // Fetch all nodes of this type, excluding translations.
+      $result = db_query("SELECT nid, title FROM {node} WHERE type = :type AND status = 1 AND (nid = tnid OR tnid = 0)", array(':type' => $type->type));
+      foreach ($result as $node) {
+        $blocks[$node->nid] = array('info' => $node->title .' (nodeblock)');
       }
     }
-    return $blocks;
-  }
-  elseif ($op == 'configure') {
-    $defaults = variable_get('nodeblock_block_' . $delta, array('teaser' => 0, 'links' => 1));
-    $form['teaser'] = array(
-      '#title' => t('Show only node teaser'),
-      '#type' => 'checkbox',
-      '#default_value' => $defaults['teaser'],
-    );
-    $form['links'] = array(
-      '#type' => 'checkbox',
-      '#default_value' => $defaults['links'],
-      '#title' => t('Include node links for "add comment", "read more" etc.'),
-    );
-    return $form;
   }
-  else if ($op == 'save') {
-    variable_set('nodeblock_block_' . $delta, array('teaser' => $edit['teaser'], 'links' => $edit['links']));
+  return $blocks;
+}
+
+/**
+ * hook_block_view
+ */
+function nodeblock_block_view($delta = '') {
+  $node = node_load($delta);
+  if (!node_access('view', $node)) {
+    return;
   }
-  elseif ($op == 'view') {
-    $node = node_load($delta);
-    if (!node_access('view', $node)) {
-      return;
-    }
-    $nodeblock_display = variable_get('nodeblock_block_' . $delta, array('teaser' => 0, 'links' => 1));
+  $nodeblock_display = variable_get('nodeblock_block_' . $delta, array('teaser' => 0, 'links' => 1));
 
-    // if the node type is translatable, try to load the node with the appropriate
-    // language from the translation set.
-    if (module_exists('translation') && translation_supported_type($node->type)) {
-      global $language;
-      $translations = translation_node_get_translations($node->tnid);
-      if ($translations[$language->language]) {
-        $node = node_load($translations[$language->language]->nid);
-      }
-      elseif (!$node->nodeblock_translation_fallback) {
-        // if no translation was found, and not using the fallback option
-        // return nothing, so the block doesn't display.
-        return;
-      }
-      // otherwise we just use the main node
+  // if the node type is translatable, try to load the node with the appropriate
+  // language from the translation set.
+  if (module_exists('translation') && translation_supported_type($node->type)) {
+    global $language;
+    $translations = translation_node_get_translations($node->tnid);
+    if ($translations[$language->language]) {
+      $node = node_load($translations[$language->language]->nid);
+    }
+    elseif (!$node->nodeblock_translation_fallback) {
+      // if no translation was found, and not using the fallback option
+      // return nothing, so the block doesn't display.
+      return;
     }
+    // otherwise we just use the main node
+  }
 
-    // Set a flag so that themes have more context.
-    $node->nodeblock = TRUE;
+  // Set a flag so that themes have more context.
+  $node->nodeblock = TRUE;
     
-    $block['subject'] = check_plain($node->title);
-    $block['content'] = node_view($node, $nodeblock_display['teaser'], TRUE, $nodeblock_display['links']);
+  $block['subject'] = check_plain($node->title);
+  $block['content'] = node_view($node, $nodeblock_display['teaser'], TRUE, $nodeblock_display['links']);
 
-    return $block;
-  }
+  return $block;
+}
+
+/**
+ * hook_block_configure
+ */
+function nodeblock_block_configure($delta = '') {
+  $defaults = variable_get('nodeblock_block_' . $delta, array('teaser' => 0, 'links' => 1));
+  $form['teaser'] = array(
+    '#title' => t('Show only node teaser'),
+    '#type' => 'checkbox',
+    '#default_value' => $defaults['teaser'],
+  );
+  $form['links'] = array(
+    '#type' => 'checkbox',
+    '#default_value' => $defaults['links'],
+    '#title' => t('Include node links for "add comment", "read more" etc.'),
+  );
+  return $form;
+}
+
+/**
+ * hook_block_save
+ */
+function nodeblock_block_save($delta = '', $edit = array()) {
+  variable_set('nodeblock_block_' . $delta, array('teaser' => $edit['teaser'], 'links' => $edit['links']));
 }
 
 /**
@@ -173,7 +212,7 @@ function nodeblock_link($type, $node = N
     if (user_access('administer blocks')) {
       $links['nodeblock_configure'] = array(
         'title' => t('Configure'),
-        'href' => 'admin/build/block/configure/nodeblock/'. $node->nid,
+        'href' => 'admin/structure/block/configure/nodeblock/'. $node->nid,
         'query' => drupal_get_destination(),
       );
     }
@@ -191,20 +230,8 @@ function nodeblock_link($type, $node = N
  * templates, but a higher priority than a generic node.tpl.php.
  */
 function nodeblock_preprocess_node(&$variables) {
-  if ($variables['node']->nodeblock) {
-    array_unshift($variables['template_files'], 'node-nodeblock-default');
+  if (isset($variables['node']->nodeblock)) {
+    array_unshift($variables['theme_hook_suggestions'], 'node__nodeblock__default');
   }
 }
 
-/**
- * Implementation of hook_theme_registry_alter().
- *
- * Add nodeblock path to the 'theme paths' for the 'node' hook.  This allows us
- * to use node-nodeblock-default.tpl.php from the module directory. Note that 
- * the path is "unshifted" onto the theme paths array. This puts the module path
- * before the modules/node path, but since neither of these modules implements
- * the same templates, there is not problem.
- */
-function nodeblock_theme_registry_alter(&$registry) {
-  array_unshift($registry['node']['theme paths'], drupal_get_path('module', 'nodeblock'));
-}
