--- radioactivity.original.module	2008-04-26 23:23:57.000000000 +0200
+++ radioactivity.module	2008-04-27 01:59:36.000000000 +0200
@@ -203,6 +203,13 @@ function radioactivity_admin_profile_for
     // defaults for new
     $decay_profile=array('half_life' => 6*3600, 'cut_off_energy' => 0.5,
                          'energy_view' => 1, 'energy_comment_insert' => 0, 'energy_comment_publish' => 0);
+    foreach(node_get_types('types') as $node_type) {
+      $type = $node_type->type;
+
+      $decay_profile['energy_' . $type . '_view'] = 1;
+      $decay_profile['energy_' . $type . '_comment_insert'] = 0;
+      $decay_profile['energy_' . $type . '_comment_publish'] = 0;
+    }
   }
 
   $form['label']=
@@ -238,29 +245,42 @@ function radioactivity_admin_profile_for
   $form['energy']=
     array('#type' => 'fieldset',
           '#tree' => TRUE,
-          '#title' => t('Energy settings'));
-
-  $form['energy']['view']=
-    array('#type' => 'textfield',
-          '#title' => t('Incident energy from view'),
-          '#required' => TRUE,
-          '#description' => t('The amount of energy the node receives per page view.'),
-          '#default_value' => $decay_profile['energy_view']);
-
-  $form['energy']['comment_insert']=
-    array('#type' => 'textfield',
-          '#title' => t('Incident energy from submitted comment'),
-          '#required' => TRUE,
-          '#description' => t('The amount of energy the node receives when a comment is submitted.'),
-          '#default_value' => $decay_profile['energy_comment_insert']);
-
-  $form['energy']['comment_publish']=
-    array('#type' => 'textfield',
-          '#title' => t('Incident energy from published comment'),
-          '#required' => TRUE,
-          '#description' => t('The amount of energy the node receives when a comment is published by a moderator.'),
-          '#default_value' => $decay_profile['energy_comment_publish']);
-
+          '#title' => t('Energy settings'),
+          '#collapsible' => TRUE,
+          '#collapsed' => FALSE);
+
+  foreach(node_get_types('types') as $node_type) {
+    $type = $node_type->type;
+
+    $form['energy'][$type] =
+      array('#type' => 'fieldset',
+            '#tree' => TRUE,
+            '#title' => $node_type->name,
+            '#description' => $node_type->description,
+            '#collapsible' => TRUE,
+            '#collapsed' => TRUE);
+
+    $form['energy'][$type]['view']=
+      array('#type' => 'textfield',
+            '#title' => t('Incident energy from view'),
+            '#required' => TRUE,
+            '#description' => t('The amount of energy the node receives per page view.'),
+            '#default_value' => $decay_profile['energy_' . $type . '_view']);
+
+    $form['energy'][$type]['comment_insert']=
+      array('#type' => 'textfield',
+            '#title' => t('Incident energy from submitted comment'),
+            '#required' => TRUE,
+            '#description' => t('The amount of energy the node receives when a comment is submitted.'),
+            '#default_value' => $decay_profile['energy_' . $type . '_comment_insert']);
+
+    $form['energy'][$type]['comment_publish']=
+      array('#type' => 'textfield',
+            '#title' => t('Incident energy from published comment'),
+            '#required' => TRUE,
+            '#description' => t('The amount of energy the node receives when a comment is published by a moderator.'),
+            '#default_value' => $decay_profile['energy_' . $type . '_comment_publish']);
+  }
   $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save decay profile') );
   $form['buttons']['delete'] = array('#value' => l('Delete profile', 'admin/settings/radioactivity/profile_'.$dpid.'/delete'));;
 
@@ -303,9 +323,13 @@ function radioactivity_admin_profile_for
 
   $decay_profile['cut_off_energy']=(double)$form['cut_off_energy'];
 
-  $decay_profile['energy_view']=(double)$form['energy']['view'];
-  $decay_profile['energy_comment_insert']=(double)$form['energy']['comment_insert'];
-  $decay_profile['energy_comment_publish']=(double)$form['energy']['comment_publish'];
+  foreach(node_get_types('types') as $node_type) {
+    $type = $node_type->type;
+
+    $decay_profile['energy_' . $type . '_view']=(double)$form['energy'][$type]['view'];
+    $decay_profile['energy_' . $type . '_comment_insert']=(double)$form['energy'][$type]['comment_insert'];
+    $decay_profile['energy_' . $type . '_comment_publish']=(double)$form['energy'][$type]['comment_publish'];
+  }
 
   $decay_profiles[$dpid]=$decay_profile;
 
@@ -411,7 +435,9 @@ function radioactivity_add_energy($nid, 
   $db_type=$GLOBALS['db_type'];
 
   foreach (_radioactivity_get_decay_profiles() as $dpid => $decay_profile) {
-    $amount=$decay_profile["energy_".$energy_type];
+    $type = db_result(db_query("SELECT type FROM {node} WHERE nid = '$nid'"));
+
+    $amount=$decay_profile["energy_". $type . '_' . $energy_type];
     if ($amount==0) continue;
 
     switch ($db_type) {
@@ -494,7 +520,7 @@ function radioactivity_user_node_view($n
   if ($passed) {
     db_query("INSERT INTO {radioactivity_clicks} (nid, uid, remote_address, click_timestamp) ".
              "VALUES (%d, %d, '%s', %d)", $nid, $uid, $remote_address, time());
-    return radioactivity_add_energy($nid, 1);
+    return radioactivity_add_energy($nid, 'view');
   } else {
     return FALSE;
   }
@@ -539,7 +565,7 @@ function radioactivity_views_tables() {
   foreach (_radioactivity_get_decay_profiles() as $dpid => $decay_profile) {
     $tables['radioactivity_'.$dpid]=
       array('name' => 'radioactivity',
-            'join' => array('type' => 'inner',
+            'join' => array('type' => 'left',
                             'left' => array('table' => 'node',
                                             'field' => 'nid'),
                             'right' => array('field' => 'nid'),
