Index: donations_thermometer.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/donations_thermometer/donations_thermometer.module,v
retrieving revision 1.2
diff -u -p -r1.2 donations_thermometer.module
--- donations_thermometer.module	13 May 2010 13:11:56 -0000	1.2
+++ donations_thermometer.module	13 May 2010 14:59:43 -0000
@@ -36,6 +36,17 @@ function donations_thermometer_perm() {
   return array('administer progress bar');
 } // function onthisdate_perm()
 
+/**
+ * Implementation of hook_theme().
+ */
+function donations_thermometer_theme($existing, $type, $theme, $path) {
+  return array(
+    'donations_thermometer' => array(
+      'arguments' => array('amount' => NULL, 'target' => NULL, 'currency' => NULL, 'size' => NULL),
+    ),
+  );
+}
+
 function donations_thermometer_block($op='list', $delta=0) {
   // listing of blocks, such as on the admin/block page
   if ($op == "list") {
@@ -43,34 +54,33 @@ function donations_thermometer_block($op
     return $block;
   } 
   else if ($op == 'view') {
-
-    // set up the block
-    drupal_add_js(drupal_get_path('module', 'donations_thermometer') .'/donations_thermometer.js');
-    drupal_add_css(drupal_get_path('module', 'donations_thermometer') .'/donations_thermometer.css');
-
-
-
-
     $amount = variable_get('donations_thermometer_amount', 50);
     $target = variable_get('donations_thermometer_target', 100);
-    $percent = ($amount/$target)*100;
     $currency = variable_get('donations_thermometer_currency', '$');
     $size = variable_get('donations_thermometer_size', 'large');
 
     $block['subject'] = 'Donations Thermometer';
-    $block['content'] = '
-    <style>.gauge-' . $size . ' .current-value {height:'. $percent .'%;}
-</style>
-    <div class="donations_thermometer">
+    $block['content'] = theme('donations_thermometer', $amount, $target, $currency, $size);
+
+    return $block;
+  }
+}
+
+/**
+ * Theme a donations thermometer.
+ */
+function theme_donations_thermometer($amount, $target, $currency, $size = 'large') {
+  drupal_add_js(drupal_get_path('module', 'donations_thermometer') .'/donations_thermometer.js');
+  drupal_add_css(drupal_get_path('module', 'donations_thermometer') .'/donations_thermometer.css');
+  
+  $percent = ($amount/$target)*100;
+  return '<div class="donations_thermometer">
     <div class="gauge-' . $size . '">
-    <div class="current-value" id="campaign-progress-current">
+    <div class="current-value" id="campaign-progress-current" style="height:'. $percent .'%;">
     <p>'. $percent .'% </p>
     </div>
     </div>
-    <p><span class="donations_thermometer-label"> Current Amount:</span><span class="donations_thermometer-amount"> '. $currency . $amount .'</span></p><p><span class="donations_thermometer-label">Target:</span><span class="donations_thermometer-amount"> '. $currency . $target
-    .'</span></div>';//$block_content;
-    return $block;
-  }
+    <p><span class="donations_thermometer-label"> Current Amount:</span><span class="donations_thermometer-amount"> '. $currency . $amount .'</span></p><p><span class="donations_thermometer-label">Target:</span><span class="donations_thermometer-amount"> '. $currency . $target .'</span></p></div>';
 }
 
 function donations_thermometer_admin() {
