? image_gallery.module_3.patch
Index: contrib/image_gallery/image_gallery.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/image_gallery.module,v
retrieving revision 1.24
diff -u -p -r1.24 image_gallery.module
--- contrib/image_gallery/image_gallery.module	12 Feb 2008 20:36:01 -0000	1.24
+++ contrib/image_gallery/image_gallery.module	12 Feb 2008 20:44:36 -0000
@@ -77,7 +77,12 @@ function image_gallery_admin_settings() 
     '#default_value' => variable_get('image_gallery_node_info', 0),
     '#description' => t("Checking this will display the \"Posted by\" node information on the gallery pages."),
   );
-
+  $form['gallery']['image_gallery_display_description'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display gallery description'),
+    '#default_value' => variable_get('image_gallery_display_description', 0),
+    '#description' => t("Checking this will display the gallery description on the gallery pages."),
+  );
   return system_settings_form($form);
 }
 
@@ -140,7 +145,11 @@ function image_gallery_page($type = NULL
       $galleries[$i]->latest = node_load(array('nid' => $nid));
     }
   }
-
+  // If there isn't a gallery tree, we may still want a gallery object from which to extract a gallery description.
+  // Do so if the admin has chosen to display gallery descriptions.
+  if (count($galleries) == 0 && variable_get('image_gallery_display_description',0) == 1) {
+    $galleries = taxonomy_get_term($tid);
+  }
   $images = array();
   if ($tid) {
     $result = pager_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d ORDER BY n.sticky DESC, n.created DESC"), variable_get('image_images_per_page', 6), 0, db_rewrite_sql("SELECT COUNT(DISTINCT(n.nid)) FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d"), $tid);
@@ -345,7 +354,7 @@ function theme_image_gallery($galleries,
   $size = image_get_sizes(IMAGE_THUMBNAIL);
 
   $content = '';
-  if (count($galleries)) {
+  if (count($galleries) > 1) {
     $content .= '<ul class="galleries">';
     foreach ($galleries as $gallery) {
       $content .= '<li class="clear-block">';
@@ -362,6 +371,11 @@ function theme_image_gallery($galleries,
     }
     $content .= "</ul>\n";
   }
+  // Else there is only one item in the galleries array (the gallery is by itself).
+  // Check admin setting to decide whether to display the description.
+  else if (count($galleries) && variable_get('image_gallery_display_description',0) == 1) {
+    $content .= '<div class="description">'. check_markup($galleries->description) ."</div>\n";
+  }
 
   if (!empty($images)) {
     $content .= '<ul class="images">';
