--- tagadelic.orig.module	2005-10-27 08:07:40.000000000 -0500
+++ tagadelic.module	2006-01-29 11:00:06.000000000 -0600
@@ -1,5 +1,7 @@
+
 <?php
 // $Id: tagadelic.module,v 1.12.2.2 2005/10/27 13:07:40 ber Exp $
+// modified by vph (01.20.2006)
 
 /**
  * Implementation of hook_help
@@ -23,7 +25,7 @@
   if ($may_cache) {
      $items[] = array('title' => t('tags'),
                       'path' => "tagadelic",
-                      'callback' => 'tagadelic_page_chunk',
+                      'callback' => 'tagadelic_page_all',
                       'access' => user_access('access content'),
                       'type' => MENU_SUGGESTED_ITEM);
      $items[] = array('title' => t('tags'),
@@ -58,9 +60,16 @@
 }
 
 /**
+ * menu callback renders a  page containing all tags in different colors
+ */
+function tagadelic_page_all() {
+  tagadelic_page_chunk(1);
+}
+
+/**
  * menu callback renders a tagadelic page
  */
-function tagadelic_page_chunk() {
+function tagadelic_page_chunk($multiple_color = 0) {
   $vocs = arg(2);
 
   if (is_numeric($vocs)) {
@@ -75,8 +84,21 @@
     }
   }
 
-  $output = theme('tagadelic_weighted',tagadelic_get_weighted_tags($vocs));
-
+  if($multiple_color == 0) {
+    $output = theme('tagadelic_weighted',tagadelic_get_weighted_tags($vocs));
+  }
+  else if (is_array($vocs) && count($vocs) != 0) {
+    $all_tags = array();
+    $color_code = 1;
+    foreach ($vocs as $voc) {
+      $tags = tagadelic_get_weighted_tags(array($voc), 6, 20, $color_code);
+      $all_tags = array_merge($all_tags, $tags);
+      $color_code += 1;
+    }
+    usort($all_tags, "_tagadelic_sort_by_title");
+    $output = theme('tagadelic_weighted', $all_tags);
+  }
+  
   if (!$output) {
     return drupal_not_found();
   }
@@ -159,7 +181,7 @@
  * API that returns an array with weighted tags
  * This is the hard part. People with better ideas are very very welcome to send these to ber@webschuur.com. Distribution is one thing that needs attention.
  */
-function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60) {
+function tagadelic_get_weighted_tags($vids, $steps = 6, $size = 60, $color_code='') {
   if (!is_array($vids) || count($vids) == 0) {
     return array();
   }
@@ -183,6 +205,7 @@
 
   foreach ($tags as $key => $value) {
     $tags[$key]->weight = 1 + floor($steps * ($value->count - $min) / $range);
+    $tags[$key]->color_code = $color_code;
   }
 
   // Sort by title
@@ -190,6 +213,7 @@
   return $tags;
 }
 
+
 /**
  * callback for usort, sort by count
  */
@@ -210,7 +234,7 @@
  */
 function theme_tagadelic_weighted($terms) {
   foreach ($terms as $term) {
-    $output .= l($term->name,"taxonomy/term/$term->tid", array('class'=>"tagadelic level$term->weight")) ." \n";
+    $output .= l($term->name,"taxonomy/term/$term->tid", array('class'=>"tagadelic level$term->weight$term->color_code")) ." \n";
   }
   return $output;
 }
@@ -232,4 +256,4 @@
   }
   return $blocks;
 }
-?>
\ No newline at end of file
+?>
