? .svn
? FusionCharts
? fusioncharts-integration-487596-1.patch
? fusioncharts-integration-487596-4.patch
? fusioncharts-remove_br-486190-0.patch
? contrib/.svn
? contrib/fusioncharts_system/.svn
? contrib/fusioncharts_webform/.svn
? fusioncharts_cck/.svn
? fusioncharts_node/.svn
? fusioncharts_test/.svn
Index: fusioncharts.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fusioncharts/fusioncharts.info,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 fusioncharts.info
--- fusioncharts.info	16 Dec 2008 07:33:43 -0000	1.2.2.1
+++ fusioncharts.info	10 Jun 2009 15:51:47 -0000
@@ -1,4 +1,4 @@
 name = Fusion Charts
 core = 6.x
 package = Fusion Charts
-description = Integration with Fusion Charts Free.
+description = Integration with Fusion Charts.
Index: fusioncharts.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fusioncharts/fusioncharts.install,v
retrieving revision 1.5.2.3
diff -u -p -r1.5.2.3 fusioncharts.install
--- fusioncharts.install	5 Mar 2009 08:03:39 -0000	1.5.2.3
+++ fusioncharts.install	10 Jun 2009 15:51:47 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: fusioncharts.install,v 1.5.2.3 2009/03/05 08:03:39 aaron1234nz Exp $ 
+// $Id: fusioncharts.install,v 1.5.2.3 2009/03/05 08:03:39 aaron1234nz Exp $
 
 /**
  * @file
@@ -9,7 +9,7 @@
 /**
  * Implementation of hook_install().
  */
-function fusioncharts_install() {    
+function fusioncharts_install() {
 
 }
 
@@ -17,8 +17,11 @@ function fusioncharts_install() {    
  * Implementation of hook_uninstall().
  */
 function fusioncharts_uninstall() {
-  //these are historical
+  // Current variables.
+  variable_del('fusionchart_package');
+
+  // These are historical.
   variable_del('fusioncharts');
   variable_del('fusioncharts-defset');
   variable_del('fusioncharts-defattr');
-}
\ No newline at end of file
+}
Index: fusioncharts.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fusioncharts/fusioncharts.module,v
retrieving revision 1.14.2.11
diff -u -p -r1.14.2.11 fusioncharts.module
--- fusioncharts.module	21 Apr 2009 10:19:23 -0000	1.14.2.11
+++ fusioncharts.module	10 Jun 2009 15:51:47 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: fusioncharts.module,v 1.14.2.11 2009/04/21 10:19:23 aaron1234nz Exp $ 
+// $Id: fusioncharts.module,v 1.14.2.11 2009/04/21 10:19:23 aaron1234nz Exp $
 /**
  * @file
  * Provides integration between the Fusion Charts free package and Drupal
@@ -11,7 +11,7 @@
  * Is an object of settings.  See API.txt for further instructions.
  */
 
-//Create a new element type for grid-based data
+// Create a new element type for grid-based data.
 include_once(drupal_get_path('module', 'fusioncharts') .'/matrix.inc');
 
 /**
@@ -22,7 +22,7 @@ function fusioncharts_menu() {
     'page callback' => 'fusioncharts_data_jscallback',
     'type' => MENU_CALLBACK,
     'access arguments' => array('access content'),
-  ); 
+  );
   return $items;
 }
 
@@ -35,7 +35,6 @@ function fusioncharts_menu() {
  * @param array $args Any further arguments recieved by the function.  These arguments will be passed to the callback function. optional
  * @return the XML data to draw the chart
  */
-
 function fusioncharts_data() {
   $args = func_get_args();
   $jsid = array_shift($args);
@@ -47,7 +46,7 @@ function fusioncharts_data() {
     $callbackfn = strtolower($param);
     $callback_data = call_user_func($callbackfn .'_fusionchart_callback', $args);
   }
-  
+
   if (isset($callback_data->query)) {
     $data = fusioncharts_prepare_data_query($callback_data);
   }
@@ -55,7 +54,7 @@ function fusioncharts_data() {
     $data = $callback_data->data;
   }
   $data = (array)$data;
-  
+
   //populate some colors into attributes if none are set
   if (!isset($callback_data->attributes['color'])) {
     $attributes  = fusioncharts_settings('fusioncharts-defattr');
@@ -66,8 +65,8 @@ function fusioncharts_data() {
       }
     }
   }
-  
-  $str_xml = "\n<graph";
+
+  $str_xml = "<graph";
   foreach ((array)$callback_data->settings as $key => $value) {
     if ($value === '') { //exclude unset keys
     }
@@ -75,7 +74,7 @@ function fusioncharts_data() {
       $str_xml .= " ". $key ."='". fusioncharts_entities($value) ."'";
     }
   }
-  $str_xml .= ">\n";
+  $str_xml .= ">";
   //build the data structure
   switch ($callback_data->chart_type) {
     case 'Column 3D':
@@ -89,7 +88,7 @@ function fusioncharts_data() {
     case 'Funnel Chart':
       $str_xml .= _fusioncharts_data_single($data, $callback_data->attributes, $jsid);
       break;
-      
+
     case 'Multi-series Column 2D':
     case 'Multi-series Column 3D':
     case 'Multi-series Line 2D':
@@ -101,38 +100,73 @@ function fusioncharts_data() {
     case 'Stacked Area 2D':
       $str_xml .= _fusioncharts_data_multi($data, $callback_data->attributes, $jsid);
       break;
-      
+
     case 'Multi-series Column 2D + Line - Dual Y Axis':
     case 'Multi-series Column 3D + Line - Dual Y Axis':
       $str_xml .= _fusioncharts_data_combination($data, $callback_data->attributes, $jsid);
       break;
-      
+
     case 'Candlestick Chart':
       break;
-           
+
     case 'Gantt Chart':
       break;
   }
   if (isset($callback_data->attributes['trendline'])) {
-    $str_xml .= "<trendlines>\n";
+    $str_xml .= "<trendlines>";
     if (is_array($callback_data->attributes['trendline'][0])) {
       foreach ($callback_data->attributes['trendline'] as $line) {
         $attrs = '';
         foreach ($line as $atrib => $value) {
           $attrs .= "$atrib='$value'";
         }
-        $str_xml .= "<line $attrs />\n";
+        $str_xml .= "<line $attrs />";
       }
     }
     else {
       foreach ($callback_data->attributes['trendline'] as $atrib => $value) {
         $attrs .= "$atrib='$value' ";
       }
-      $str_xml .= "<line $attrs />\n";
+      $str_xml .= "<line $attrs />";
+    }
+    $str_xml .= "</trendlines>";
+  }
+
+  // FusionCharts commercial package has extra settings for styles, see the
+  // documentation at http://www.fusioncharts.com/docs/.
+  //
+  // Examples of the input data expected:
+  //   attributes['styles']['definition'][0]['name'] = 'myBevel';
+  //   attributes['styles']['application'][0]['toObject'] = 'tooltip';
+  if (isset($callback_data->attributes['styles'])) {
+    $str_xml .= "<styles>";
+    if (is_array($callback_data->attributes['styles']['definition'])) {
+      $str_xml .= "<definition>";
+      foreach ($callback_data->attributes['styles']['definition'] as $style_def) {
+        $attrs = '';
+        foreach ($style_def as $key => $val) {
+          $attrs .= "$key='$val'";
+        }
+        $str_xml .= "<style $attrs />";
+      }
+      $str_xml .= "</definition>";
+    }
+
+    if (is_array($callback_data->attributes['styles']['application'])) {
+      $str_xml .= "<application>";
+      foreach ($callback_data->attributes['styles']['application'] as $style_def) {
+        $attrs = '';
+        foreach ($style_def as $key => $val) {
+          $attrs .= "$key='$val'";
+        }
+        $str_xml .= "<apply $attrs />";
+      }
+      $str_xml .= "</application>";
     }
-    $str_xml .= "</trendlines>\n";
+    $str_xml .= "</styles>";
   }
-  $str_xml .= "</graph>\n";
+  $str_xml .= "</graph>";
+
   $callback_data->xml = $str_xml;
   return $callback_data;
 }
@@ -183,7 +217,7 @@ function fusioncharts_prepare_data_query
         $i++;
       }
       break;
-  
+
     case 'Multi-series Column 2D':
     case 'Multi-series Column 3D':
     case 'Multi-series Line 2D':
@@ -200,7 +234,7 @@ function fusioncharts_prepare_data_query
         $i++;
       }
       break;
-  
+
     case 'Multi-series Column 2D + Line - Dual Y Axis':
     case 'Multi-series Column 3D + Line - Dual Y Axis':
       while ($row = db_fetch_object($result)) {
@@ -211,7 +245,7 @@ function fusioncharts_prepare_data_query
         $i++;
       }
       break;
-  
+
     case 'Candlestick Chart':
       //probably too complex for a simple query
       break;
@@ -219,7 +253,7 @@ function fusioncharts_prepare_data_query
     case 'Gantt Chart':
       //probably too complex for a simple query
       break;
-  }     
+  }
   return (array)$data;
 }
 
@@ -230,18 +264,18 @@ function fusioncharts_prepare_data_query
  * @param array $data Data to be converted to XML
  * @param array $attributes See api.txt for details
  * @param string $jsid javascript id
- * @return string XML 
+ * @return string XML
  */
 function _fusioncharts_data_single($data, $attributes = array(), $jsid = NULL) {
   //validate and reform the data as necessary
   //for single series charts the validation needed is:
   // * that the value column is numeric
   // * that there is a value for each series
-  
+
   foreach ($data as $column) {
     if ($column[0] != '' && is_numeric($column[1])) {
       $clean_data[] = $column;
-    } 
+    }
     elseif ($column[0] != '' && !is_numeric($column[1])) {
       drupal_set_message(t('Data row @row did not validate.  Please check it', array('@row' => $column[0])));
     }
@@ -269,7 +303,7 @@ function _fusioncharts_data_single($data
     if (isset($attributes['showName'][$column[0]])) {
       $showname = "showName='{$attributes['showName'][$column[0]]}'";
     }
-    $str_xml .= "<set name='". fusioncharts_entities(trim($column[0])) ."' value='{$column[1]}' $color $link $hovertext $alpha $showname />\n";
+    $str_xml .= "<set name='". fusioncharts_entities(trim($column[0])) ."' value='{$column[1]}' $color $link $hovertext $alpha $showname />";
     $c++;
   }
   return $str_xml;
@@ -281,7 +315,7 @@ function _fusioncharts_data_single($data
  * @param array $data Data to be converted to XML
  * @param array $attributes See api.txt for details
  * @param string $jsid javascript id
- * @return string XML 
+ * @return string XML
  */
 function _fusioncharts_data_multi($data, $attributes = array(), $jsid=NULL) {
   //validate and reform the data as necessary
@@ -319,7 +353,7 @@ function _fusioncharts_data_multi($data,
       $categories[] = $column[1];
       $value[] = $column[2];
     }
-    $str_xml .= "<categories>\n";
+    $str_xml .= "<categories>";
     $category = array_unique($categories);
     if (end($category) == '') {
       array_pop($category);
@@ -327,31 +361,31 @@ function _fusioncharts_data_multi($data,
     $category_count = count($category);
     $total_results = count($value);
     foreach ($category as $this_category) {
-      $str_xml .= "<category name='". fusioncharts_entities(trim($this_category)) ."' />\n";
+      $str_xml .= "<category name='". fusioncharts_entities(trim($this_category)) ."' />";
     }
-    $str_xml .= "</categories>\n"; 
+    $str_xml .= "</categories>";
     for ($i=0; $i<$total_results; $i+=$category_count) {
       if ($series[$i] != '') {
         if (isset($attributes['color'][$c])) {
           $color = "color='{$attributes['color'][$c]}'";
         }
-        $str_xml .= "<dataset seriesName='". fusioncharts_entities(trim($series[$i])) ."' $color>\n";
+        $str_xml .= "<dataset seriesName='". fusioncharts_entities(trim($series[$i])) ."' $color>";
         for ($j=$i; $j<($i+$category_count); $j++) {
           unset($link);
           if ($value[$j] != '') {
             if (isset($attributes['callback'])) {
               $link = "link='JavaScript:fusioncharts_clickbar(&quot;$jsid&quot;, &quot;{$attributes['callback']}&quot;, &quot;{$series[$j]}&quot;, &quot;{$categories[$j]}&quot;)'";
-            }            
+            }
             if (is_string($attributes['link'][$series[$j]])) {
               $link = "link='". urlencode($attributes['link'][$series[$j]]) ."'";
             }
             elseif (isset($attributes['link'][$series[$j]][$categories[$j]])) {
               $link = "link='". urlencode($attributes['link'][$series[$j]][$categories[$j]]) ."'";
             }
-            $str_xml .= "<set value='{$value[$j]}' $link />\n";
+            $str_xml .= "<set value='{$value[$j]}' $link />";
           }
         }
-      $str_xml .= "</dataset>\n";
+      $str_xml .= "</dataset>";
       $c++;
       }
     }
@@ -365,7 +399,7 @@ function _fusioncharts_data_multi($data,
  * @param array $data Data to be converted to XML
  * @param array $attributes See api.txt for details
  * @param string $jsid javascript id
- * @return string XML 
+ * @return string XML
  */
 function _fusioncharts_data_combination($data, $attributes = array(), $jsid=NULL) {
   //validate and reform the data as necessary
@@ -421,7 +455,7 @@ function _fusioncharts_data_combination(
       $axis[] = $column[2];
       $value[] = $column[3];
     }
-    $str_xml .= "<categories>\n";
+    $str_xml .= "<categories>";
     $categories = array_unique($categories);
     if (end($categories) == '') {
       array_pop($categories);
@@ -430,15 +464,15 @@ function _fusioncharts_data_combination(
     $dataset_count = count(array_unique($category));
     $total_results = count($value);
     foreach ($categories as $this_category) {
-      $str_xml .= "<category name='". fusioncharts_entities(trim($this_category)) ."' />\n";
+      $str_xml .= "<category name='". fusioncharts_entities(trim($this_category)) ."' />";
     }
-    $str_xml .= "</categories>\n"; 
+    $str_xml .= "</categories>";
     for ($i=0; $i<$total_results; $i+=$dataset_count) {
       if ($series[$i] != '') {
         if (isset($attributes['color'][$c])) {
           $color = "color='{$attributes['color'][$c]}'";
         }
-        $str_xml .= "<dataset seriesName='". fusioncharts_entities(trim($series[$i])) ."' $color parentYAxis='$axis[$i]'>\n";
+        $str_xml .= "<dataset seriesName='". fusioncharts_entities(trim($series[$i])) ."' $color parentYAxis='$axis[$i]'>";
         for ($j=$i; $j<($i+$category_count); $j++) {
           if ($value[$j] != '') {
           unset($link);
@@ -451,10 +485,10 @@ function _fusioncharts_data_combination(
             elseif (isset($attributes['link'][$series[$j]][$categories[$j]])) {
               $link = "link='". urlencode($attributes['link'][$series[$j]][$categories[$j]]) ."'";
             }
-            $str_xml .= "<set value='{$value[$j]}' $link />\n";
+            $str_xml .= "<set value='{$value[$j]}' $link />";
           }
         }
-      $str_xml .= "</dataset>\n";
+      $str_xml .= "</dataset>";
       $c++;
       }
     }
@@ -462,24 +496,105 @@ function _fusioncharts_data_combination(
 }
 
 /**
+ * Return installed FusionCharts package (free or commercial).
+ *
+ * @param bool $reset
+ *  Whether to force a rescan.
+ * @return string
+ *  'free' or 'commercial' depending on package found.
+ */
+function _fusionchart_get_package($reset = FALSE) {
+  $current_package = variable_get('fusionchart_package', FALSE);
+
+  if ($current_package === FALSE || $reset === TRUE) {
+    // Detect whether the user has the free or commercial Fusionchart SWF files.
+    $swf_commercial = glob(drupal_get_path('module', 'fusioncharts') .'/FusionCharts/Charts/*.swf');
+    $swf_free = glob(drupal_get_path('module', 'fusioncharts') .'/FusionChartsFree/Charts/*.swf');
+
+    // Prefer the commercial by choosing it first (in case both are found).
+    if (!empty($swf_commercial)) {
+      $current_package = 'commercial';
+    }
+    else if (!empty($swf_free)) {
+      $current_package = 'free';
+    }
+    else {
+      $current_package = FALSE;
+    }
+    variable_set('fusionchart_package', $current_package);
+  }
+
+  return $current_package;
+}
+
+/**
+ * Helper that includes the Fusion Charts libraries and returns the flash source.
+ *
+ * @param string $folder
+ *  either 'FusionChartsFree' or 'FusionCharts'
+ * @param string $chart
+ *  the chart filename, or FALSE if error.
+ */
+function _fusionchart_get_flash_source($folder, $chart) {
+  // Check that the fusioncharts library was included properly.
+  include_once(drupal_get_path('module', 'fusioncharts') ."/$folder/Code/PHP/Includes/FusionCharts.php");
+  if (!function_exists('renderChart')) {
+    return FALSE;
+  }
+
+  $flashsource = base_path() . drupal_get_path('module', 'fusioncharts') ."/$folder/Charts/". $chart;
+  drupal_add_js(drupal_get_path('module', 'fusioncharts') ."/$folder/JSClass/FusionCharts.js", 'module');
+  drupal_add_js(drupal_get_path('module', 'fusioncharts') .'/fusioncharts.js', 'module');
+
+  return $flashsource;
+}
+
+/**
  * Chart rendering function
- * This is the core function to Fusion Charts.  It handles all of rendering actions.  This function should be the one that is called to initiate a chart
+ * This is the core function to Fusion Charts.  It handles all of rendering actions.
+ * This function should be the one that is called to initiate a chart.
  *
  * @param string $param The callback function or an object containing the data
  * @param string $jsid Name to be used for the id attribute in the DOM (used for javascript manipulation) optional
  * @param array $args Any further parameters that get passed to the callback function (in the case of $param being a callback function)  optional
  * @return string the HTML to render the chart
  */
-function theme_fusionchart($param, $jsid = NULL, $args = array()) {  
-  static $fusioncharts_id; //incremental ID of each chart (static in case there is more then one chart on a page)
+function theme_fusionchart($param, $jsid = NULL, $args = array()) {
+  // Incremental ID of each chart (static in case there is more then one chart on a page)
+  static $fusioncharts_id;
   if (!isset($fusioncharts_id)) {
     $fusioncharts_id = 1;
   }
   if (!isset($jsid)) {
     $jsid = "DrupalFusionChart_". $fusioncharts_id++;
   }
-  $fc_data = fusioncharts_data($jsid, $param, $args);
-  
+
+  $package = _fusionchart_get_package();
+  if ($package == 'commercial') {
+    return theme('fusionchart_commercial', $param, $jsid, $args);
+  }
+  else if ($package == 'free') {
+    return theme('fusionchart_free', $param, $jsid, $args);
+  }
+  else {
+    return t('Please install the Fusion Charts package from
+      InfoSoft as per instructions in README.txt. If you have already installed
+      it, please visit the <a href="@url">status report</a> to rescan the folders.',
+      array('@url' => url('admin/reports/status'))
+    );
+  }
+}
+
+/**
+ * Rendering chart using Free Fusion Charts package. This should not be called directly
+ *  by the user. Rather call theme('fusionchart').
+ *
+ * @param string $param The callback function or an object containing the data
+ * @param string $jsid Name to be used for the id attribute in the DOM (used for javascript manipulation) optional
+ * @param array $args Any further parameters that get passed to the callback function (in the case of $param being a callback function)  optional
+ * @return string the HTML to render the chart
+ */
+function theme_fusionchart_free($param, $jsid = NULL, $args = array()) {
   $chart_file = array(
     'Column 3D' => 'FCF_Column3D.swf',
     'Column 2D' => 'FCF_Column2D.swf',
@@ -504,22 +619,69 @@ function theme_fusionchart($param, $jsid
     'Funnel Chart' => 'FCF_Funnel.swf',
     'Gantt Chart' => 'FCF_Gantt.swf'
   );
+  $fc_data = fusioncharts_data($jsid, $param, $args);
+  $flashsource = _fusionchart_get_flash_source('FusionChartsFree', $chart_file[$fc_data->chart_type]);
 
-  include_once(drupal_get_path('module', 'fusioncharts') ."/FusionChartsFree/Code/PHP/Includes/FusionCharts.php");
-  //check that the fusioncharts free package was installed
-  if (!function_exists('renderChart')) {
-    return t('Please install the Fusion Charts Free package from InfoSoft as per instructions in the readme.');
+  if ($flashsource === FALSE) {
+    return t('Please install the Fusion Charts package from
+      InfoSoft as per instructions in README.txt. If you have already installed
+      it, please visit the <a href="@url">status report</a> to rescan the folders.',
+      array('@url' => url('admin/reports/status'))
+    );
+  }
+  else {
+    return renderChartHTML($flashsource, "", $fc_data->xml, $jsid, $fc_data->width, $fc_data->height);
+  }
+}
+
+/**
+ * Render chart using Commercial Fusion Charts package. This should
+ *  not be called directly by the user. Rather call theme('fusionchart').
+ *
+ * @param string $param The callback function or an object containing the data
+ * @param string $jsid Name to be used for the id attribute in the DOM (used for javascript manipulation) optional
+ * @param array $args Any further parameters that get passed to the callback function (in the case of $param being a callback function)  optional
+ * @return string the HTML to render the chart
+ */
+function theme_fusionchart_commercial($param, $jsid = NULL, $args = array()) {
+  $chart_file = array(
+    'Column 3D' => 'Column3D.swf',
+    'Column 2D' => 'Column2D.swf',
+    'Line 2D' => 'Line.swf',
+    'Area 2D' => 'Area2D.swf',
+    'Bar 2D' => 'Bar2D.swf',
+    'Pie 2D' => 'Pie2D.swf',
+    'Pie 3D' => 'Pie3D.swf',
+    'Doughnut 2D' => 'Doughnut2D.swf',
+    'Multi-series Column 2D' => 'MSColumn2D.swf',
+    'Multi-series Column 3D' => 'MSColumn3D.swf',
+    'Multi-series Line 2D' => 'MSLine.swf',
+    'Multi-series Bar 2D' => 'MSBar2D.swf',
+    'Stacked Column 3D' => 'StackedColumn3D.swf',
+    'Stacked Column 2D' => 'StackedColumn2D.swf',
+    'Stacked Bar 2D' => 'StackedBar2D.swf',
+    'Stacked Area 2D' => 'StackedArea2D.swf',
+    'Multi-series Column 3D + Line - Dual Y Axis' => 'MSColumn3DLineDY.swf',
+  );
+  $fc_data = fusioncharts_data($jsid, $param, $args);
+  $flashsource = _fusionchart_get_flash_source('FusionCharts', $chart_file[$fc_data->chart_type]);
+
+  if ($flashsource === FALSE) {
+    return t('Please install the Fusion Charts package from
+      InfoSoft as per instructions in README.txt. If you have already installed
+      it, please visit the <a href="@url">status report</a> to rescan the folders.',
+      array('@url' => url('admin/reports/status'))
+    );
+  }
+  else {
+    return renderChart($flashsource, "", $fc_data->xml, $jsid, $fc_data->width, $fc_data->height, FALSE, TRUE);
   }
-  $flashsource = base_path() . drupal_get_path('module', 'fusioncharts') ."/FusionChartsFree/Charts/". $chart_file[$fc_data->chart_type];
-  drupal_add_js(drupal_get_path('module', 'fusioncharts') .'/FusionChartsFree/JSClass/FusionCharts.js', 'module');
-  drupal_add_js(drupal_get_path('module', 'fusioncharts') .'/fusioncharts.js', 'module');
-  return renderChartHTML($flashsource, "", $fc_data->xml, $jsid, $fc_data->width, $fc_data->height);  
 }
 
 /**
  * Backwards compatability function
  */
-function fusioncharts_render($param, $jsid = NULL, $args = array()) {  
+function fusioncharts_render($param, $jsid = NULL, $args = array()) {
   return theme('fusionchart', $param, $jsid, $args);
 }
 
@@ -531,6 +693,12 @@ function fusioncharts_theme($existing, $
     'fusionchart' => array(
       'arguments' => array($param, $jsid = NULL, $args = array()),
     ),
+    'fusionchart_free' => array(
+      'arguments' => array($param, $jsid = NULL, $args = array()),
+    ),
+    'fusionchart_commercial' => array(
+      'arguments' => array($param, $jsid = NULL, $args = array()),
+    ),
     'fusioncharts_matrix_table_form' => array(
       'arguments' => array($form = array()),
     ),
@@ -548,7 +716,7 @@ function fusioncharts_theme($existing, $
  */
 function fusioncharts_settings($type) {
   switch ($type) {
-    case 'fusioncharts': 
+    case 'fusioncharts':
       return array(
         'Single Series Charts' => array(
           'Column 3D' => 'Column 3D',
@@ -629,7 +797,7 @@ function fusioncharts_settings($type) {
         'showAlternateVGridColor' => '0',
         'alternateVGridColor' => '#000000',
       );
-      
+
       case 'fusioncharts-defattr':
         return array(
           'color' => array(
@@ -649,23 +817,28 @@ function fusioncharts_settings($type) {
         );
     }
 }
- 
+
 /**
  * Implementation of hook_requirements().
  */
 function fusioncharts_requirements($phase) {
   $requirements = array();
   if ($phase == 'runtime') {
-    // Fusionchart SWF files
-    $swf = glob(drupal_get_path('module', 'fusioncharts') .'/FusionChartsFree/Charts/*.swf');
-    if (!empty($swf)) {
+    // Check the installed package, force a rescan in case user has switched.
+    $package = _fusionchart_get_package(TRUE);
+
+    if ($package == 'commercial') {
       $requirements['fusioncharts']['severity'] = REQUIREMENT_OK;
-      $requirements['fusioncharts']['value'] = t('The FusionCharts SWF files found.');
+      $requirements['fusioncharts']['value'] = t('The FusionCharts commercial SWF files found.');
+    }
+    else if ($package == 'free') {
+      $requirements['fusioncharts']['severity'] = REQUIREMENT_OK;
+      $requirements['fusioncharts']['value'] = t('The FusionCharts free SWF files found.');
     }
     else {
       $requirements['fusioncharts']['severity'] = REQUIREMENT_ERROR;
       $requirements['fusioncharts']['value'] = t('The FusionCharts SWF files not found.');
-      $requirements['fusioncharts']['description'] = t('Please download these files from <a href="@url">http://www.fusioncharts.com/free</a> and copy them into the fusioncharts module directory as per instructions in the readme.txt file.', array('@url' => 'http://www.fusioncharts.com/free'));
+      $requirements['fusioncharts']['description'] = t('Please download the free FusionCharts package from <a href="@url">http://www.fusioncharts.com/free</a> or the commercial Fusion Charts from <a href="@url_paidfor">http://www.fusioncharts.com</a> and copy them into the fusioncharts module directory as per instructions in the README.txt file.', array('@url' => 'http://www.fusioncharts.com/free', '@url_paidfor' => 'http://www.fusioncharts.com/'));
     }
     $requirements['fusioncharts']['title'] = t('FusionCharts');
   }
@@ -695,7 +868,7 @@ if (!function_exists('ahah_render')) {
     $form = form_builder($_POST['form_id'], $form, $form_state);
     // Render the new output.
     $new_form = $form[$name];
-    return drupal_render($new_form); 
+    return drupal_render($new_form);
   }
 }
 
@@ -710,4 +883,4 @@ function fusioncharts_entities($string) 
   $entities = array("%25", "%26", "%27", "%3A", "%2F", "%40");
   $string = htmlentities($string, ENT_QUOTES, 'UTF-8');
   return str_replace($original, $entities, $string);
-}
\ No newline at end of file
+}
