Index: acidfree.module
===================================================================
--- acidfree.module	(revision 477)
+++ acidfree.module	(working copy)
@@ -313,7 +313,7 @@
         case 'admin/help#acidfree':
             return t('<p>Because Acidfree is more than simply a storage and viewing module, it requires some depenencies for the album management.  First, it requires the Filemanager module.  Until the Filemanager gets patched to have the exended API that Acidfree requires, Acidfree will ship with a patch for the Filemanager.  Second, it requires some form of image manipulation.  Drupal provides a frontend to the GD library that can do what is required.  Or, if you would rather use ImageMagick or libmagick (php-imagick module), set that up (copy the image.*.inc files to the includes directory) and select it.  Finally, if you want lossless rotations for your images, you will require jpegtran or exiftran.</p><p>For video thumbnailing, there are three options.  You can choose a static image for all your videos (no thumbnail), upload your own thumbnail (user thumbnail) or have mplayer thumbnail them automatically for you.  If you choose the first option, you will be asked to give the dimensions of the video so it can be displayed correctly in the \'full\' view.  With option two, be sure to upload a thumbnail that is the same dimensions as the actual video (grab a frame from the video, do not resize it.)  The third option obviously implies that you have mplayer and all the win32 codecs installed on your <b>server</b> and that you are allowed to exec other programs (i.e., not running in safe mode.).  ');
         case 'admin/settings/acidfree':
-            return t('Change these settings to however you like.  You are w00t, afterall.');
+            return t('These settings affect all Acidfree albums and displays.  However, some items can be overridden on a per-album or per-image basis.');
         case 'admin/content/types/acidfree':
             return t("The common attributes that Acidfree will have are: 'Sticky at top of lists', which allows the albums to be sorted before the other media types (image, video, etc.) in the various album views;  and *not* 'Promoted to front page' because that would make all the albums show up at the top of the front page, which is probably not desirable.");
         default:
@@ -373,7 +373,7 @@
         $items[] = array('path' => 'admin/settings/acidfree',
                 'title' => t('Acidfree settings'),
                 'callback' => 'drupal_get_form',
-                'callback arguments' => array('acidfree_admin_settings'),
+                'callback arguments' => array('acidfree_settings'),
                 'description' => t('Site-wide Acidfree settings.'),
                 'access' => user_access('administer site configuration'),
                 'type' => MENU_NORMAL_ITEM,
@@ -587,6 +587,57 @@
     }
 }
 
+function _acidfree_sort_by_type($a, $b) {
+    if ($a['#af_type'] < $b['#af_type']) {
+        return -1;
+    } else if ($a['#af_type'] > $b['#af_type']) {
+        return 1;
+    }
+    if ($a['#field_name'] < $b['#field_name']) {
+        return -1;
+    } else if ($a['#field_name'] < $b['#field_name']) {
+        return 1;
+    }
+    return 0;
+}
+
+function theme_acidfree_settings_fields(&$form) {
+    global $acidfree_types;
+    $last_type = '';
+    $rows = array();
+    uasort($form, '_acidfree_sort_by_type');
+    foreach (element_children($form) as $i) {
+        $field = &$form[$i];
+        // type header
+        $type = $field['#af_type'];
+        if ($type != $last_type) {
+            if ($type == 'common') {
+                $tname = t('Common');
+            } else if ($type == 'acidfree') {
+                $tname = $acidfree_types['album']->name;
+            } else {
+                $tname = $acidfree_types[$type]->name;
+            }
+            $type_title = t('@type fields', array('@type' => drupal_ucfirst($tname)));
+            $rows[] = array(array('data' => $type_title, 'class' => 'region', 'colspan' => 2));
+            $last_type = $type;
+        }
+        $title = $field['#field_name'];
+        $row = array(
+                $title,
+                drupal_render($field),
+            );
+        $rows[] = $row;
+    }
+
+    // Finish table
+    $header = array(t('Field'), t('Region'));
+    $output = theme('table', $header, $rows, array('id' => 'blocks'));
+    $output .= drupal_render($form);
+
+    return $output;
+}
+
 function acidfree_settings_submit($form, &$edit) {
     if ($edit['acidfree_order_force']) {
         db_query("UPDATE {acidfree_album} SET order_by = '<default>'");
@@ -613,7 +664,7 @@
 /**
  * Implementation of hook_settings
  */
-function acidfree_admin_settings() {
+function acidfree_settings() {
     $form = array();
     $form['#validate'] = array('acidfree_settings_validate' => array());
     $form['#submit'] = array('acidfree_settings_submit' => array());
@@ -710,6 +761,23 @@
     if (function_exists('_class_video_manipulation_options'))
         $form = array_merge($form, acidfree_call('_class_video_manipulation_options'));
 
+    $form['album_contents'] = array(
+            '#type' => 'fieldset',
+            '#title' => t('Album Contents'),
+        );
+    $form['album_contents']['acidfree_content_fields_all'] = array(
+            '#title' => t('Show all fields available in "Album Contents" view'),
+            '#type' => 'checkbox',
+            '#default_value' => variable_get('acidfree_content_fields_all', true),
+        );
+    $form['album_contents']['fields']['#type'] = 'fieldset';
+    $form['album_contents']['fields']['#title'] = t('Fields to show');
+    $form['album_contents']['fields']['#collapsible'] = true;
+    $form['album_contents']['fields']['#collapsed'] = variable_get('acidfree_content_fields_all', true);
+    $form['album_contents']['fields']['#description'] = t('The album contents view gets very cluttered.  To remedy this, you may pick and choose which field elements appear on the form and what column they appear in.  The form will render with two columns and you may put any item in either column.');
+    $form['album_contents']['fields']['acidfree_content_fields'] = _album_contents_available_fields();
+    drupal_set_title(t('Acidfree settings'));
+
     return system_settings_form($form);
 }
 
Index: class_album.inc
===================================================================
--- class_album.inc	(revision 472)
+++ class_album.inc	(working copy)
@@ -65,6 +65,122 @@
     return $thumb;
 }
 
+function _album_content_fields() {
+    return variable_get('acidfree_content_fields', array(
+            'title' => '2',
+            'body' => '2',
+            'taxonomy' => '1',
+            'thumb' => '1',
+            'rotate' => '1',
+        )
+    );
+}
+
+function _album_contents_field_number($field_name) {
+    $fields = _album_content_fields();
+    return $fields[$field_name];
+}
+
+function _album_contents_available_fields() {
+    // get a node
+    $node = new stdClass();
+    $node->nid = 1;
+    $node->created = time() - 100;
+    $form_alter_mods = module_implements('form_alter');
+    $keys = array();
+    $types = array('acidfree', 'image', 'video');
+    foreach ($types as $type) {
+        $node->type = $type;
+        $f = node_form($node, $param);
+        unset($f['submit']);
+        unset($f['preview']);
+        unset($f['delete']);
+        foreach ($form_alter_mods as $module) {
+            $function = $module .'_form_alter';
+            $form_id = $node->type.'_node_form';
+            $function($form_id, $f);
+        }
+        // hack for video's body_filter
+        if ($node->type == 'video') {
+            $f['body'] = $f['body_filter']['body'];
+            $f['filter'] = $f['body_filter']['filter'];
+            unset($f['body_filter']['body']);
+            unset($f['body_filter']['filter']);
+        }
+        $form[$type] = $f;
+        $kids[$type] = element_children($f);
+    }
+    $kids['common'] = array_intersect(
+            $kids['acidfree'],
+            $kids['image'],
+            $kids['video']
+        );
+    foreach ($kids['common'] as $k) {
+        $form['common'][$k] = $form['acidfree'][$k];
+    }
+    foreach ($types as $type) {
+        $kids[$type] = array_diff($kids[$type], $kids['common']);
+    }
+
+    // check all the fields
+    $acidfree_content_fields = _album_content_fields();
+    $acidfree_content_fields_all = variable_get('acidfree_content_fields_all', true);
+    $fields = array(
+            '#type' => 'item',
+            '#tree' => true,
+            '#theme' => 'acidfree_settings_fields',
+        );
+    $types[] = 'common';
+    $unwanted = array('body_filter', 'thumb');
+    foreach ($types as $type) {
+        foreach ($kids[$type] as $k) {
+            if (in_array($k, $unwanted)) {
+                continue;
+            }
+            if ($form[$type][$k]['#type'] != 'hidden' && $form[$type][$k]['#type'] != 'value') {
+                if (!isset($form[$type][$k]['#title'])) {
+                    $title = drupal_ucfirst($k);
+                } else {
+                    $title = $form[$type][$k]['#title'];
+                }
+                $fields[$k] = array(
+                        '#af_type' => $type,
+                        '#field_name' => $title,
+                        '#type' => 'select',
+                        '#options' => array(
+                                0 => t('not shown'),
+                                1 => t('left column'),
+                                2 => t('right column'),
+                            ),
+                        '#default_value' => $acidfree_content_fields[$k],
+                    );
+            }
+        }
+    }
+    // return an array of form elements
+    return $fields;
+}
+
+/*
+ * Prune out items that are not to be shown
+ * on the album contents form (for simplicity sake)
+ */
+function _album_contents_prune_item(&$form) {
+    $fields = _album_content_fields();
+    $show_all = variable_get('acidfree_content_fields_all', true);
+    $skip = array('checked', 'thumb');
+    foreach (element_children($form) as $k) {
+        if (in_array($k, $skip)) {
+            continue;
+        }
+        if (!$show_all && !$fields[$k]) {
+            if ($form[$k]['#type'] != 'hidden' && $form[$k]['#type'] != 'value') {
+                unset($form[$k]);
+            }
+        }
+    }
+}
+
 /* recursively flatten an array tree, so that all
  * that is left is $k => $v for $v is a leaf
  */
@@ -185,15 +301,29 @@
         }
         $row[] = Array( 'data' => $cell,
                 'class' => 'album-cell');
-        unset($cell);
-        $cell .= drupal_render($form['nodes'][$child]['title']);
-        $cell .= drupal_render($form['nodes'][$child]['term']['name']);
-        $cell .= drupal_render($form['nodes'][$child]['body']);
-        $cell .= drupal_render($form['nodes'][$child]['term']['description']);
-        $cell .= drupal_render($form['nodes'][$child]['parent']);
-        $row[] = Array('data' => $cell, 'class' => 'album-cell');
-        $cell = drupal_render($form['nodes'][$child]);
-        $row[] = Array('data' => $cell, 'class' => 'album-cell');
+        foreach (array(1, 2) as $col) {
+            unset($cell);
+            foreach (array_filter(element_children($form['nodes'][$child]),
+                    create_function('$v', 
+                        'return _album_contents_field_number($v) == '.$col.';'
+                    )
+                ) as $ck) {
+                $cell .= drupal_render($form['nodes'][$child][$ck]);
+            }
+            $row[] = Array('data' => $cell, 'class' => 'album-cell');
+        }
+        if (variable_get('acidfree_content_fields_all', true)) {
+            $rows[] = Array('data' => $row);
+            unset($row);
+            $extra['extras'] = array('#type' => 'fieldset', '#title' => t('Other fields'), '#collapsible' => true, '#collapsed' => true);
+            $extra['extras']['fields'] = array('#value' => drupal_render($form['nodes'][$child]));
+            $cell = drupal_render($extra['extras']);
+            $row[] = Array('data' => $cell, 'class' => 'album-cell', 'colspan' => 4);
+        } else {
+            $cell = drupal_render($form['nodes'][$child]);
+            $row[] = Array('data' => $cell, 'class' => 'album-cell');
+            $rows[] = Array('data' => $row);
+        }
         $rows[] = Array('data' => $row);
         unset($row);
     }
@@ -284,11 +414,19 @@
             $form_id = $child->type.'_node_form';
             $function($form_id, $form['nodes'][$i]);
         }
+        // hack to make video behave properly
+        if ($child->type == 'video') {
+            $form['nodes'][$i]['body'] = $form['nodes'][$i]['body_filter']['body'];
+            $form['nodes'][$i]['filter'] = $form['nodes'][$i]['body_filter']['filter'];
+            unset($form['nodes'][$i]['body_filter']['body']);
+            unset($form['nodes'][$i]['body_filter']['filter']);
+        }
         if (isset($form['nodes'][$i]['comment_settings'])) {
             $form['nodes'][$i]['comment_settings']['comment']['#parents'] = array('nodes', "$i", 'comment');
         }
         //dump_msg($form['nodes'][$i]);
         unset($form['nodes'][$i]['type']);
+        _album_contents_prune_item($form['nodes'][$i]);
         $i++;
         continue;
     }
