Index: forward.module
===================================================================
--- forward.module	(revision 47)
+++ forward.module	(working copy)
@@ -118,6 +118,13 @@
     '#default_value' => variable_get('forward_link_title', 'Email this !type'),
     '#description' => t('Set the text of the link.  Use !type as a place holder for the node\'s content type or \'page\' depending on the setting above.'),
   );
+  $form['forward_options']['forward_display_nodes'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show Forward on nodes'),
+    '#return_value' => 1,
+    '#default_value' => variable_get('forward_display_nodes', TRUE),
+    '#description' => t('If checked, the link/form will appear on nodes'),
+  );
   $form['forward_options']['forward_display_teasers'] = array(
     '#type' => 'checkbox',
     '#title' => t('Show Forward on teasers'),
@@ -871,17 +878,20 @@
  * Generate links for pages
  */
 function forward_link($type, $node=0, $teaser=0) {
-  if ('comment' == $type && !variable_get('forward_display_comments', FALSE)) {
+  if (('comment' == $type && !variable_get('forward_display_comments', FALSE))
+    ||('node' == $type && (!variable_get('forward_display_nodes', TRUE) && !$teaser))) {
     return;
   }
+  
+  if ((($type == 'node' && variable_get('forward_display_'. $node->type, '1')) || $type == 'comment')
+    && user_access('access forward') && variable_get('forward_form_type', 'link') == 'link') {
+    $links = array();
+    // FIXME $type could not be 'system' due to condition above
+    //    if (($type == 'system')) {
+    //      // URL, page title, func called for page content, arg, 1 = don't disp menu
+    //      menu('forward', t('Email this page'), 'forward_page', 1, 1);
+    //    }
 
-  if (($type == 'node' || $type == 'comment') && user_access('access forward') && (variable_get('forward_form_type', 'link') == 'link') && variable_get('forward_display_'. $node->type, '1')) {
-    $links=array();
-    if (($type == 'system')) {
-      // URL, page title, func called for page content, arg, 1 = don't disp menu
-      menu('forward', t(variable_get('forward_link_title', 'Email this !type'), array('!type' => 'page')), 'forward_page', 1, 1);
-    }
-
     // This var is set in the settings section under the admin/modules/forward section
     // It shows 'email this $nodetype' or 'email this page'
     if (variable_get('forward_link_type', 0)) {
@@ -1087,46 +1097,88 @@
   switch ($op) {
     case 'list':
       $blocks[0]['info'] = t('Most Emailed');
+      $blocks[1]['info'] = t('Forward');
       return $blocks;
     case 'configure':
-      $block_options = array(
-        /*'today' => t('Most Emailed Today'),
-        'week' => t('Most Emailed This Week'),*/
-        'allTime' => t('Most Emailed of All Time'),
-        'recent' => t('Most Recently Emailed')
-      );
-      $output = forward_block_formbody($block_options);
-      return $output;
+      switch ($delta) {
+        case 0:
+          $block_options = array(
+            /*'today' => t('Most Emailed Today'),
+            'week' => t('Most Emailed This Week'),*/
+            'allTime' => t('Most Emailed of All Time'),
+            'recent' => t('Most Recently Emailed')
+          );
+          $output = forward_block_formbody($block_options);
+          return $output;
+      }
+      break;
     case 'save':
-      variable_set('forward_block_type', $form_state['values']['forward_block_type']);
+      switch ($delta) {
+        case 0:
+          variable_set('forward_block_type', $form_state['values']['forward_block_type']);
+          break;
+      }
       break;
     case 'view':
-      if (user_access('access content')) {
-        switch (variable_get('forward_block_type', 'allTime')) {
-          /*case 'today':
-            $pastday = time()-(24 * 60 * 60);
-            $query="SELECT n.nid, n.title, count(*) AS cnt FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type='sent' AND n.status=1 AND timestamp > ". $pastday .' GROUP BY n.nid, n.title ORDER BY cnt DESC';
-            $block['subject'] = t("Today's Most Emailed");
-            $block['content'] = node_title_list(db_query_range($query, 0, 5));
-            break;
-          case 'week':
-            $pastweek = time()-(7 * 24 * 60 * 60);
-            $query="SELECT n.nid, n.title, count(*) AS cnt FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type='sent' AND n.status=1 AND timestamp > ". $pastweek .' GROUP BY n.nid, n.title ORDER BY cnt DESC';
-            $block['subject'] = t("This Week's Most Emailed");
-            $block['content'] = node_title_list(db_query_range($query, 0, 5));
-            break;*/
-          case 'allTime':
-            $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid WHERE forward_count > 0 ORDER BY f.forward_count DESC";
-            $block['subject'] = t("Most Emailed");
-            $block['content'] = node_title_list(db_query_range($query, 0, 5));
-            break;
-          case 'recent':
-            $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.last_forward_timestamp DESC";
-            $block['subject'] = t("Most Recently Emailed");
-            $block['content'] = node_title_list(db_query_range($query, 0, 5));
-            break;
-        }
-        return $block;
+      switch ($delta) {
+        case 0:
+          if (user_access('access content')) {
+            switch (variable_get('forward_block_type', 'allTime')) {
+              /*case 'today':
+                $pastday = time()-(24 * 60 * 60);
+                $query="SELECT n.nid, n.title, count(*) AS cnt FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type='sent' AND n.status=1 AND timestamp > ". $pastday .' GROUP BY n.nid, n.title ORDER BY cnt DESC';
+                $block['subject'] = t("Today's Most Emailed");
+                $block['content'] = node_title_list(db_query_range($query, 0, 5));
+                break;
+              case 'week':
+                $pastweek = time()-(7 * 24 * 60 * 60);
+                $query="SELECT n.nid, n.title, count(*) AS cnt FROM {forward_log} s LEFT JOIN {node} n ON s.nid = n.nid WHERE s.type='sent' AND n.status=1 AND timestamp > ". $pastweek .' GROUP BY n.nid, n.title ORDER BY cnt DESC';
+                $block['subject'] = t("This Week's Most Emailed");
+                $block['content'] = node_title_list(db_query_range($query, 0, 5));
+                break;*/
+              case 'allTime':
+                $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid WHERE forward_count > 0 ORDER BY f.forward_count DESC";
+                $block['subject'] = t("Most Emailed");
+                $block['content'] = node_title_list(db_query_range($query, 0, 5));
+                break;
+              case 'recent':
+                $query="SELECT n.nid, n.title, f.* FROM {forward_statistics} f LEFT JOIN {node} n ON f.nid = n.nid ORDER BY f.last_forward_timestamp DESC";
+                $block['subject'] = t("Most Recently Emailed");
+                $block['content'] = node_title_list(db_query_range($query, 0, 5));
+                break;
+            }
+            return $block;
+          }
+          break;
+        case 1:
+          if (user_access('access forward')) {
+            drupal_add_css(drupal_get_path('module', 'forward') .'/forward.css');
+            $title = t('Email this !type', array('!type' => t('page')));
+            $html = FALSE;
+            switch (variable_get('forward_link_style', 0)) {
+              case 1:
+                $img = drupal_get_path('module', 'forward') .'/forward.gif';
+                $title = theme('image', $img, $title, '', array('class' => 'forward-icon'));
+                $html = TRUE;
+                break;
+              case 2:
+                $img = drupal_get_path('module', 'forward') .'/forward.gif';
+                $title = theme('image', $img, $title, '', array('class' => 'forward-icon forward-icon-margin')) . $title;
+                $html = TRUE;
+                break;
+            }
+            $path = $_GET['q'];
+            $link = l($title, 'forward', array(
+              'title'      => $title,
+              'html'       => $html,
+              'attributes' => array('title' => t('Forward this page to a friend'), 'class' => 'forward-page'),
+              'query'      => 'path='. $path,
+            ));
+            return array(
+              'subject' => t('Forward'),
+              'content' => $link,
+            );
+          }
       }
   }
 }
