Index: simplenews.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/simplenews.module,v
retrieving revision 1.210
diff -u -r1.210 simplenews.module
--- simplenews.module	8 May 2009 07:59:20 -0000	1.210
+++ simplenews.module	12 Jun 2009 00:11:59 -0000
@@ -645,6 +645,14 @@
       );
     }
   }
+  elseif ($form_id == 'simplenews_subscription_manager_form') {
+    if (!empty($form['#parameters'][3]) && $form['#parameters'][3] == 'simplenews_block_all') {
+      // Get rid of the fieldset to save screen space.
+      unset($form['subscriptions']['#type']);
+      // Prevent the form from redirecting to the front page.
+      $form['#redirect'] = FALSE;
+    }
+  }
 }
 
 /**
@@ -805,6 +813,10 @@
   switch ($op) {
     case 'list':
       $blocks = array();
+      $blocks['all'] = array(
+        'info' => t('Newsletter: all newsletters'),
+        'cache' => BLOCK_NO_CACHE,
+      );
       foreach (taxonomy_get_tree(variable_get('simplenews_vid', '')) as $newsletter) {
         //TODO: 1. without form -> by role; 2. with form -> user caching with refresh on subscribe/unsubscribe (option as setting) or no caching
         $blocks[$newsletter->tid] = array(
@@ -814,73 +826,93 @@
       }
       return $blocks;
     case 'configure':
-      $form['simplenews_block_'. $delta]['simplenews_block_m_'. $delta] = array(
-        '#type' => 'textfield',
-        '#title' => t('Block message'),
-        '#size' => 60,
-        '#maxlength' => 128,
-        '#default_value' => variable_get('simplenews_block_m_'. $delta, t('Stay informed on our latest news!')),
-      );
-      $form['simplenews_block_'. $delta]['simplenews_block_f_'. $delta] = array(
-        '#type' => 'radios',
-        '#title' => t('Subscription interface'),
-        '#options' => array('1' => t('Subscription form'), '0' => t('Link to form')),
-        '#description' => t("Note: this requires permission 'subscribe to newsletters'."),
-        '#default_value' => variable_get('simplenews_block_f_'. $delta, 1),
-      );
-      $form['simplenews_block_'. $delta]['simplenews_block_l_'. $delta] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Display link to previous issues'),
-        '#return_value' => 1,
-        '#default_value' => variable_get('simplenews_block_l_'. $delta, 1),
-      );
-      $form['simplenews_block_'. $delta]['simplenews_block_i_status_'. $delta] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Display previous issues'),
-        '#return_value' => 1,
-        '#default_value' => variable_get('simplenews_block_i_status_'. $delta, 0),
-      );
-      $form['simplenews_block_'. $delta]['simplenews_block_i_'. $delta] = array(
-        '#type' => 'select',
-        '#title' => t('Number of issues to display'),
-        '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
-        '#default_value' => variable_get('simplenews_block_i_'. $delta, 5),
-      );
-      $form['simplenews_block_'. $delta]['simplenews_block_r_'. $delta] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Display RSS-feed icon'),
-        '#return_value' => 1,
-        '#default_value' => variable_get('simplenews_block_r_'. $delta, 1),
-      );
+      if ($delta != 'all') {
+        $form['simplenews_block_'. $delta]['simplenews_block_m_'. $delta] = array(
+          '#type' => 'textfield',
+          '#title' => t('Block message'),
+          '#size' => 60,
+          '#maxlength' => 128,
+          '#default_value' => variable_get('simplenews_block_m_'. $delta, t('Stay informed on our latest news!')),
+        );
+        $form['simplenews_block_'. $delta]['simplenews_block_f_'. $delta] = array(
+          '#type' => 'radios',
+          '#title' => t('Subscription interface'),
+          '#options' => array('1' => t('Subscription form'), '0' => t('Link to form')),
+          '#description' => t("Note: this requires permission 'subscribe to newsletters'."),
+          '#default_value' => variable_get('simplenews_block_f_'. $delta, 1),
+        );
+        $form['simplenews_block_'. $delta]['simplenews_block_l_'. $delta] = array(
+          '#type' => 'checkbox',
+          '#title' => t('Display link to previous issues'),
+          '#return_value' => 1,
+          '#default_value' => variable_get('simplenews_block_l_'. $delta, 1),
+          '#description' => t("Note: this requires permission 'view links in block'."),
+        );
+        $form['simplenews_block_'. $delta]['simplenews_block_i_status_'. $delta] = array(
+          '#type' => 'checkbox',
+          '#title' => t('Display previous issues'),
+          '#return_value' => 1,
+          '#default_value' => variable_get('simplenews_block_i_status_'. $delta, 0),
+          '#description' => t("Note: this requires permission 'view links in block'."),
+        );
+        $form['simplenews_block_'. $delta]['simplenews_block_i_'. $delta] = array(
+          '#type' => 'select',
+          '#title' => t('Number of issues to display'),
+          '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
+          '#default_value' => variable_get('simplenews_block_i_'. $delta, 5),
+        );
+        $form['simplenews_block_'. $delta]['simplenews_block_r_'. $delta] = array(
+          '#type' => 'checkbox',
+          '#title' => t('Display RSS-feed icon'),
+          '#return_value' => 1,
+          '#default_value' => variable_get('simplenews_block_r_'. $delta, 1),
+          '#description' => t("Note: this requires permission 'view links in block'."),
+        );
+      }
       return $form;
     case 'save':
-      variable_set('simplenews_block_m_'. $delta, $edit['simplenews_block_m_'. $delta]);
-      variable_set('simplenews_block_f_'. $delta, $edit['simplenews_block_f_'. $delta]);
-      variable_set('simplenews_block_l_'. $delta, $edit['simplenews_block_l_'. $delta]);
-      variable_set('simplenews_block_i_status_'. $delta, $edit['simplenews_block_i_status_'. $delta]);
-      variable_set('simplenews_block_i_'. $delta, $edit['simplenews_block_i_'. $delta]);
-      variable_set('simplenews_block_r_'. $delta, $edit['simplenews_block_r_'. $delta]);
+      if ($delta != 'all') {
+        variable_set('simplenews_block_m_'. $delta, $edit['simplenews_block_m_'. $delta]);
+        variable_set('simplenews_block_f_'. $delta, $edit['simplenews_block_f_'. $delta]);
+        variable_set('simplenews_block_l_'. $delta, $edit['simplenews_block_l_'. $delta]);
+        variable_set('simplenews_block_i_status_'. $delta, $edit['simplenews_block_i_status_'. $delta]);
+        variable_set('simplenews_block_i_'. $delta, $edit['simplenews_block_i_'. $delta]);
+        variable_set('simplenews_block_r_'. $delta, $edit['simplenews_block_r_'. $delta]);
+      }
       break;
     case 'view':
       global $language;
 
-      if ($tree = taxonomy_get_tree(variable_get('simplenews_vid', ''))) {
-        // Only display a block if $delta is a valid newsletter term id.
-        foreach ($tree as $taxonomy) {
-          $tids[] = $taxonomy->tid;
-        }
-        if (in_array($delta, $tids)) {
-          // $delta is validated, the block can be displayed.
-          $newsletter = (array) taxonomy_get_term($delta);
-          // Translate newsletter name if required.
-          if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary(variable_get('simplenews_vid', '')) == I18N_TAXONOMY_LOCALIZE) {
-            $newsletter['name'] = tt('taxonomy:term:'. $newsletter['tid'] .':name', $newsletter['name'], $language->language);
+      if ($delta == 'all') {
+        $block = array(
+          'subject' => t('Our newsletters'),
+          'content' => theme('simplenews_block_all'),
+        );
+        return $block;
+      }
+      else {
+        if ($tree = taxonomy_get_tree(variable_get('simplenews_vid', ''))) {
+          // Only display a block if $delta is a valid newsletter term id.
+          foreach ($tree as $taxonomy) {
+            $tids[] = $taxonomy->tid;
+          }
+          if (in_array($delta, $tids)) {
+            // $delta is validated, the block can be displayed.
+            $newsletter = (array) taxonomy_get_term($delta);
+            // Translate newsletter name if required.
+            if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary(variable_get('simplenews_vid', '')) == I18N_TAXONOMY_LOCALIZE) {
+              $newsletter['name'] = tt('taxonomy:term:'. $newsletter['tid'] .':name', $newsletter['name'], $language->language);
+            }
+            $block = array(
+              'subject' => check_plain($newsletter['name']),
+              'content' => theme('simplenews_block', $newsletter['tid']),
+            );
+            return $block;
+          }
+          else {
+            drupal_set_message(t('You have probably changed the newsletter vocabulary. Please redefine the <a href="@blocks">newsletter blocks</a>.', array('@blocks' => url('admin/build/block'))), 'error');
+            return array();
           }
-          $block = array(
-            'subject' => check_plain($newsletter['name']),
-            'content' => theme(array('simplenews_block__'. $newsletter['tid'], 'simplenews_block'), $newsletter['tid']),
-          );
-          return $block;
         }
       }
       break;
@@ -2335,6 +2367,10 @@
       'arguments' => array('tid' => NULL),
       'pattern' => 'simplenews_block__',
     ),
+    'simplenews_block_all' => array(
+      'file' => 'simplenews.subscription.inc',
+      'template' => 'simplenews-block-all',
+    ),
     'simplenews_status' => array(
       'template' => 'simplenews-status',
       'file' => 'simplenews.admin.inc',
@@ -2361,7 +2397,7 @@
 }
 
 /**
- * Process variables to format the simplenews block.
+ * Process variables to format a single newsletter's block.
  *
  * Collect data and apply access restrictions.
  *
@@ -2440,4 +2476,4 @@
   $variables['format'] = $variables['node']->simplenews['s_format'];
   $variables['unsubscribe_text'] = t('Unsubscribe from this newsletter', array(), $variables['language']->language);
   $variables['test_message'] = t('This is a test version of the newsletter.', array(), $variables['language']->language);
-}
+}
\ No newline at end of file
Index: simplenews.subscription.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/simplenews.subscription.inc,v
retrieving revision 1.12
diff -u -r1.12 simplenews.subscription.inc
--- simplenews.subscription.inc	7 Mar 2009 17:14:31 -0000	1.12
+++ simplenews.subscription.inc	12 Jun 2009 00:11:59 -0000
@@ -183,3 +183,15 @@
   $form['#redirect'] = 'admin/content/simplenews/users';
   return $form;
 }
+
+/**
+ * Process variables to format the subscription block for all newsletters.
+ *
+ * Include the subscriptions form in simplenews_confirm_subscription().
+ *
+ * @see simplenews-block-all.tpl.php
+ */
+function template_preprocess_simplenews_block_all(&$variables) {
+  // The third argument makes it possible for hook_form_alter() to recognize this instance of the form.
+  $variables['form'] = drupal_get_form('simplenews_subscription_manager_form', NULL, 'simplenews_block_all');
+}
Index: simplenews-block-all.tpl.php
===================================================================
RCS file: simplenews-block-all.tpl.php
diff -N simplenews-block-all.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ simplenews-block-all.tpl.php	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,19 @@
+<?php
+// $Id$
+
+/**
+ * @file simplenews-block-all.tpl.php
+ * Default theme implementation to display a block with subscription options for all newsletters.
+ * 
+ *
+ * Available variables:
+ * - $form: the rendered form
+ *
+ * @see template_preprocess_simplenews_block_all()
+ */
+?>
+  <p><?php print t('Select the newsletter(s) to which you want to subscribe or unsubscribe.'); ?></p>
+
+  <?php if ($form): ?>
+    <?php print $form; ?>
+  <?php endif; ?>
