Index: og.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/og/og.module,v retrieving revision 1.298.2.115 diff -u -p -r1.298.2.115 og.module --- og.module 19 Dec 2007 05:13:58 -0000 1.298.2.115 +++ og.module 24 Dec 2007 01:25:42 -0000 @@ -1052,26 +1052,53 @@ function og_view_group(&$node, $teaser = unset($node->content['body']); $node->content['og_mission'] = array('#value' => theme('og_mission', $node), '#weight' => -3); - $view = views_get_view(variable_get('og_home_page_view', 'og_ghp_ron')); - $views_available = variable_get('views_defaults', array()); - if ($views_available[$view->name] == "disabled") { - // do nothing. assume the group node type handles homepage, or theme layer - i.e. node-.tpl.php + + if (variable_get('og_home_page_type','') == 'panels' && module_exists('panels') && $panels = panels_load_panels(variable_get('og_home_page_panel',''))) { + $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 drupal_not_found(); + } + + panels_is_panels_page(TRUE); + $content_types = panels_get_content_types(); + + foreach ($panels->content as $location => $list) { + foreach ($list as $area) { + $function = $content_types[$area->type]['callback']; + if (function_exists($function)) { + $content[$area->area] .= $function($area->configuration); + } + } + } + $output = panels_get_layout($layout, $content); + $node->content['panel'] = array('#value' => $output, '#weight' => 9); } else { - $view->url = 'node'; - $args[] = $node->nid; - // TODO: use own callback for feeds - if (arg(2) == 'feed') { - $view->description = $node->og_description; - $args[] = 'feed'; - } - $built = views_build_view('embed', $view, $args, $view->use_pager, $view->nodes_per_page); - if ($GLOBALS['current_view']->num_rows || $view->page_empty) { - $node->content['view'] = array('#value' => $built); + $view = views_get_view(variable_get('og_home_page_view', 'og_ghp_ron')); + $views_available = variable_get('views_defaults', array()); + if ($views_available[$view->name] == "disabled") { + // do nothing. assume the group node type handles homepage, or theme layer - i.e. node-.tpl.php } else { - // use this default empty text unless overridden by View (which is a usually not a good idea. this text is smart) - og_home_empty($node); + $view->url = 'node'; + $args[] = $node->nid; + // TODO: use own callback for feeds + if (arg(2) == 'feed') { + $view->description = $node->og_description; + $args[] = 'feed'; + } + $built = views_build_view('embed', $view, $args, $view->use_pager, $view->nodes_per_page); + if ($GLOBALS['current_view']->num_rows || $view->page_empty) { + $node->content['view'] = array('#value' => $built); + } + else { + // use this default empty text unless overridden by View (which is a usually not a good idea. this text is smart) + og_home_empty($node); + } } drupal_set_title(filter_xss_admin(views_get_title($view, 'page'))); } @@ -2499,8 +2526,16 @@ function og_admin_settings() { $form['og_settings']['node_form']['og_omitted'] = array('#type' => 'select', '#title' => t('Omitted content types'), '#default_value' => variable_get('og_omitted', array()), '#options' => $non_group_type_options, '#description' => t('Select any node types which should not participate in the Audience targetting system. Node types which are designated as group home page node types (see below) will be automatically excluded.'), '#multiple' => TRUE); $form['og_settings']['home'] = array('#type' => 'fieldset', '#title' => t('Group home page'), '#collapsible' => TRUE, '#collapsed' => TRUE); + if (module_exists('panels')) { + $options = $options = array('' => t('Views'), 'panels' => t('Panels')); + } + $form['og_settings']['home']['og_home_page_type'] = array('#type' => 'radios', '#title' => t('Presentation style'), '#options' => $options, '#default_value' => variable_get('og_home_page_type', ''), '#description' => t('Select wheather to use views or panels for displaying OG content')); $options = og_get_available_views(); - $form['og_settings']['home']['og_home_page_view'] = array('#type' => 'radios', '#title' => t('Presentation style'), '#options' => $options, '#default_value' => variable_get('og_home_page_view', 'og_ghp_ron'), '#description' => t('Pick a View for your group home page. Only Views whose names start with og_ghp_ are eligible. The View determines the layout of your home page. You may alter the presentation using usual the !theme. Also see the Theme section of the !README.', array('!README' => og_readme(), '!theme' => l(t('usual Views themeing techniques'), 'http://drupal.org/node/42597')))); + $form['og_settings']['home']['og_home_page_view'] = array('#type' => 'radios', '#title' => t('Presentation view'), '#options' => $options, '#default_value' => variable_get('og_home_page_view', 'og_ghp_ron'), '#description' => t('Pick a View for your group home page. Only Views whose names start with og_ghp_ are eligible. The View determines the layout of your home page. You may alter the presentation using usual the !theme. Also see the Theme section of the !README.', array('!README' => og_readme(), '!theme' => l(t('usual Views themeing techniques'), 'http://drupal.org/node/42597')))); + if (module_exists('panels')) { + $options = og_get_available_panels(); + $form['og_settings']['home']['og_home_page_panel'] = array('#type' => 'radios', '#title' => t('Presentation panel'), '#options' => $options, '#default_value' => variable_get('og_home_page_panel', ''), '#description' => t('Pick a Panel for your group home page. You can use panels arguments to pass the node ID through to any views on the panel, and then configure an OG views argument in each view to display nodes for the current group.')); + } $form['og_settings']['home']['og_node_types'] = array('#type' => 'select', '#title' => t('Group home page node types'), '#default_value' => variable_get('og_node_types', array('og')), '#options' => $all_node_type_options, '#required' => TRUE, '#description' => t("Required. Select the node types which act as group home pages. Usually, you will want to !create called group for this purpose.", array('!create' => l(t('create a simple node type'), 'admin/content/types'))), '#multiple' => TRUE); $form['og_settings']['email'] = array('#type' => 'fieldset', '#title' => t('Email settings'), '#collapsible' => TRUE, '#collapsed' => TRUE); @@ -2559,6 +2594,15 @@ function og_get_available_views() { return $views; } +function og_get_available_panels() { + $options = array(); + $result = db_query("SELECT * FROM {panels_info} ORDER BY title"); + while ($panels = db_fetch_object($result)) { + $options[$panels->did] = check_plain($panels->title); + } + return $options; +} + // TODO: maybe use a custom theme('mark') here? function theme_og_format_subscriber_status($group) { if (!$group['is_active']) {