Index: drigg_promotion.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drigg/drigg_promotion/Attic/drigg_promotion.module,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 drigg_promotion.module
--- drigg_promotion.module	18 May 2008 17:40:44 -0000	1.1.2.3
+++ drigg_promotion.module	27 Aug 2008 19:58:39 -0000
@@ -20,7 +20,7 @@
     $items[] = array(
       'path' => 'admin/settings/drigg/drigg_promotion',
       'title' => t('Promotion'),
-      'description' => t('Drigg module\'s preview of embedded content'),
+      'description' => t('Drigg module\'s promotion mode'),
       'callback' => 'drupal_get_form',
       'callback arguments' => array('drigg_promotion_admin_settings'),
       'access' => user_access('administer site configuration'),
@@ -97,6 +97,35 @@
     '#default_value' => variable_get('drigg_promotion_1_threshold', 10),
    );
 
+  if (module_exists('radioactivity')) {
+    $form['auto_promoting'][1]['drigg_promotion_1_radioactivity_decay'] = array(
+      '#type' => 'textfield',
+      '#title' => t('+Radioactivity : Decay profile to use.'),
+      '#size' => 5,
+      '#maxlength' => 5,
+      '#required' => FALSE,
+      '#default_value' => variable_get('drigg_promotion_1_radioactivity_decay', 1),
+    );
+    
+    $form['auto_promoting'][1]['drigg_promotion_1_radioactivity_promote'] = array(
+      '#type' => 'textfield',
+      '#title' => t('+Radioactivity : How much Radioactivity before a story goes to the home page. Linked to the previous setting. You can set 10 votes and radioactivity of 100 before a story goes on homepage.'),
+      '#size' => 5,
+      '#maxlength' => 5,
+      '#required' => FALSE,
+      '#default_value' => variable_get('drigg_promotion_1_radioactivity_promote', 100),
+    );
+
+    $form['auto_promoting'][1]['drigg_promotion_1_radioactivity_promote_alone'] = array(
+      '#type' => 'textfield',
+      '#title' => t('+Radioactivity : How much Radioactivity before a story goes to the home page. This setting works alone. So you can promote a story even if it has not enough votes.'),
+      '#size' => 5,
+      '#maxlength' => 5,
+      '#required' => FALSE,
+      '#default_value' => variable_get('drigg_promotion_1_radioactivity_promote_alone', 1000),
+    );
+  }
+
   return system_settings_form($form);
 }
 
@@ -154,11 +183,34 @@
        $karma = votingapi_get_voting_result($content_type,$v->content_id,$value_type,$tag,$function);
        $karma = $karma->value;
        $threshold=variable_get('drigg_promotion_1_threshold', 10);
+       $promoted=0;
         if($karma + $value >= $threshold ){
-          $m="Karma is $karma, vote is $value, threshold is $threshold, promoting node $v->content_id, vote id: $v->vote_id, and time is ".time()."!";
-          drigg_debug_msg($m);
-          watchdog("DRIGG PROMOTE",$m);
-          drigg_promote_node($v->content_id);
+					if (module_exists('radioactivity')) {
+						$radioactivity=radioactivity_get_energy($v->content_id, variable_get('drigg_promotion_1_radioactivity_decay', 1));
+						if (variable_get('drigg_promotion_1_radioactivity_promote', 100)==0 || $radioactivity[variable_get('drigg_promotion_1_radioactivity_decay', 1)] >= variable_get('drigg_promotion_1_radioactivity_promote', 100)) {
+              $m="Karma is $karma, vote is $value, radioactivity is ".$radioactivity[variable_get('drigg_promotion_1_radioactivity_decay', 1)].", threshold is $threshold, promoting node $v->content_id, vote id: $v->vote_id, and time is ".time()."!";
+              drigg_debug_msg($m);
+              watchdog("DRIGG PROMOTE",$m);
+              drigg_promote_node($v->content_id);
+              $promoted=1;
+						}
+					} else {
+            $m="Karma is $karma, vote is $value, threshold is $threshold, promoting node $v->content_id, vote id: $v->vote_id, and time is ".time()."!";
+            drigg_debug_msg($m);
+            watchdog("DRIGG PROMOTE",$m);
+            drigg_promote_node($v->content_id);
+            $promoted=1;
+          }
+        }
+        if (module_exists('radioactivity')) {
+        	$radioactivity=radioactivity_get_energy($v->content_id, variable_get('drigg_promotion_1_radioactivity_decay', 1));
+          if ($promoted==0 && variable_get('drigg_promotion_1_radioactivity_promote_alone', 1000)==0 && $radioactivity[variable_get('drigg_promotion_1_radioactivity_decay', 1)] >= variable_get('drigg_promotion_1_radioactivity_promote_alone', 1000)) {
+            $m="Karma is $karma, vote is $value, radioactivity is ".$radioactivity[variable_get('drigg_promotion_1_radioactivity_decay', 1)].", threshold is $threshold, promoting node $v->content_id, vote id: $v->vote_id, and time is ".time()."!";
+            drigg_debug_msg($m);
+            watchdog("DRIGG PROMOTE",$m);
+            drigg_promote_node($v->content_id);
+            $promoted=1;
+          }
         }
       }
     }

