diff --git a/includes/groupcontent.inc b/includes/groupcontent.inc index 24edd195d66af067e18a928f836dcaa978552f58..b4da4e2bdc875eee7488fb6171eb0bd228af5d9a 100644 --- a/includes/groupcontent.inc +++ b/includes/groupcontent.inc @@ -146,7 +146,7 @@ function og_panels_ct_render_callback_faces($conf, $panel_args, $context) { $block->subject = t('Group Faces'); if ($node) { - $block->content = og_list_users_faces_page($node->nid, $conf['row_count']); + $block->content = og_list_users_faces_page($node->nid, $conf['column_count'], $conf['row_count'], $conf['pager_id']); $block->delta = $node->nid; } else { @@ -158,10 +158,22 @@ function og_panels_ct_render_callback_faces($conf, $panel_args, $context) { } function og_panels_content_types_addedit_callback_faces($id, $panel_args, $conf = NULL) { - $form['row_count'] = array( + $form['column_count'] = array( '#type' => 'textfield', '#title' => t('Number of pictures per row'), - '#default_value' => isset($conf['row_count']) ? $conf['row_count'] : 5, + '#default_value' => isset($conf['column_count']) ? $conf['column_count'] : 5, + '#size' => 5, + ); + $form['row_count'] = array( + '#type' => 'textfield', + '#title' => t('Maximum number of rows per page'), + '#default_value' => isset($conf['row_count']) ? $conf['row_count'] : 10, + '#size' => 5, + ); + $form['pager_id'] = array( + '#type' => 'textfield', + '#title' => t('Pager ID'), + '#default_value' => isset($conf['pager_id']) ? $conf['pager_id'] : 0, '#size' => 5, ); return $form; @@ -206,8 +218,11 @@ function og_panels_content_types_validate_callback_subscribers($form, $form_valu } function og_panels_content_types_validate_callback_faces($form, $form_values) { + if (!is_numeric($form_values['column_count'])) { + form_error($form['column_count'], t('Number of pictures per row must be an integer.')); + } if (!is_numeric($form_values['row_count'])) { - form_error($form['row_count'], t('Number of faces must be an integer.')); + form_error($form['row_count'], t('Maximum number of rows per page must be an integer.')); } } diff --git a/og.css b/og.css index 7df8b5dbb953703026d50af7a25237df91db7a48..c9ff7ba22508d42b4803da910f6df8f08e06175c 100644 --- a/og.css +++ b/og.css @@ -34,7 +34,11 @@ table.og-picture-grid td { text-align: center; width: 20%; padding: 7px 0 7px 0; - border-bottom: 1px dotted; + border-top: #CCCCCC 1px dotted; +} + +table.og-picture-grid td.first { + border-top: none; } td.og-picture-grid-item { diff --git a/og.module b/og.module index d27b18c872e5e381207d58c4ae7aa03c53f2eedc..70db500728ad08d131929213ac88d27cedfa57ea 100644 --- a/og.module +++ b/og.module @@ -968,29 +968,35 @@ function og_list_users_page($gid) { return $output; } -function og_list_users_faces_page($gid, $row_count = 5) { +function og_list_users_faces_page($gid, $column_count = 5, $row_count = 10, $pager_id = 0) { + $max_per_page = $row_count * $column_count; $sql = og_list_users_sql(0, 0, 'ou.is_admin DESC, u.picture DESC, u.name ASC'); - /* list group admins first, pending members second, regular members last. Alphabetize within each of these categories */ - $result = pager_query($sql, 100, "faces_$gid", NULL, $gid); - $output = theme('og_picture_grid', $result, $row_count); - $output .= theme('pager', "faces_$gid", 100); + /* list group admins first, members with pics second, regular members last. Alphabetize within each of these categories */ + $result = pager_query($sql, $max_per_page, $pager_id, NULL, $gid); + $output = theme('og_picture_grid', $result, $column_count); + $output .= theme('pager', NULL, $max_per_page, $pager_id); return $output; } // from views_bonus: grid.inc -function theme_og_picture_grid($result, $row_count = 5) { +function theme_og_picture_grid($result, $column_count = 5) { $content = ''; $count = 0; - $total = count($users); + $total = db_num_rows($result); while ($user = db_fetch_object($result)) { + $classes = 'og-picture-grid-item'; + if ($count < $column_count) { + $classes .= ' first'; + } + $item = ''; - if ($count % $row_count == 0) { + if ($count % $column_count == 0) { $content .= ''; } $picture = theme('user_picture', $user); $name = theme('username', $user); $group_role = $user->is_admin ? t('admin') : ' '; - $content .= "\n"; $count++; - if ($count % $row_count == 0 || $count == $total) { + if ($count % $column_count == 0 || $count == $total) { $content .= ''; } }
$picture
$name
"; + $content .= "
$picture
$name
"; if ($user->is_admin) { $txt = t('admin'); $content .= "
$txt
"; @@ -998,7 +1004,7 @@ function theme_og_picture_grid($result, $row_count = 5) { $content .= "