Index: panelsblock.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/panelsblock/panelsblock.module,v
retrieving revision 1.1
diff -u -r1.1 panelsblock.module
--- panelsblock.module	24 Apr 2007 20:45:02 -0000	1.1
+++ panelsblock.module	18 May 2007 21:26:04 -0000
@@ -2,7 +2,7 @@
 // $Id: panelsblock.module,v 1.1 2007/04/24 20:45:02 nedjo Exp $
 
 // Panels layout area used for blocks.
-define('PANELSBLOCK_AREA', 'left');
+define('PANELSBLOCK_DEFAULT_AREA', 'left');
 
 /**
  * @file
@@ -27,6 +27,13 @@
       '#description' => t('Select whether you wish to make this panels page available as a block Note that only the !area area will be displayed.', array('!area' => PANELSBLOCK_AREA)),
       '#default_value' => $blocks[$form['did']['#value']] && $blocks[$form['did']['#value']]['expose'] ? $blocks[$form['did']['#value']]['expose'] : 0,
     );
+    $form['panelsblock']['expose_area'] = array(
+      '#type' => 'select',
+      '#title' => t('Display area'),
+      '#default_value' => $blocks[$form['did']['#value']] && $blocks[$form['did']['#value']]['area'] ? $blocks[$form['did']['#value']]['area'] : '',
+      '#options' => panelsblock_get_areas($form['layout']['#value']),
+      '#description' => t('Select the area that will be displayed.'),
+    );
     $form['panelsblock']['expose_style'] = array(
       '#type' => 'radios',
       '#title' => t('Display style'),
@@ -68,6 +75,7 @@
   $blocks[$form_values['did']] = array(
     'expose' => $form_values['expose_block'],
     'style' => $form_values['expose_style'],
+    'area' => $form_values['expose_area'],
   );
   variable_set('panelsblock', $blocks);
 }
@@ -84,19 +92,24 @@
   $layouts = panels_get_layouts();
   $layout = $layouts[$panels->layout];
   $layout['css_id'] = $panels->css_id;
-  
+
   if (!$layout) {
     watchdog('panels', t('Unable to find requested layout %s', array('%s' => check_plain($panels->layout))));
     return MENU_NOT_FOUND;
   }
 
+  $blocks = variable_get('panelsblock', array());
+
   panels_is_panels_page(TRUE);
   $content_types = panels_get_content_types();
   $content = array();
   panelsblock_load_content_types();
+
+  $display_area = !empty($blocks[$did]['area']) ? $blocks[$did]['area'] : PANELSBLOCK_DEFAULT_AREA;
+
   foreach ($panels->content as $location => $list) {
     foreach ($list as $area) {
-      if ($area->area == PANELSBLOCK_AREA) {
+      if ($area->area == $display_area) {
         $function = $content_types[$area->type]['callback'] .'_block';
         if (function_exists($function)) {
           $content[] = $function($area->configuration);
@@ -104,7 +117,7 @@
       }
     }
   }
-  $blocks = variable_get('panelsblock', array());
+
   $theme_function = 'panelsblock_block_'. ($blocks[$did] ? $blocks[$did]['style'] : 'default');
   return array(
     'subject' => $panels->title ? $panels->title : '',
@@ -125,6 +138,14 @@
 }
 
 /**
+ * Given a panel layout, return its content areas.
+ */
+function panelsblock_get_areas($layout) {
+  $layouts = panels_get_layouts();
+  return $layouts[$layout]['content areas'];
+}
+
+/**
  * Default presentation of block.
  */
 function theme_panelsblock_block_default($did, $content) {
