/**
* Show paged view of full list of shouts.
*/
function shoutbox_page_view() {
drupal_add_css(drupal_get_path('module', 'shoutbox') .'/shoutbox.css');
drupal_add_js('misc/jquery.form.js');
drupal_add_js(drupal_get_path('module', 'shoutbox') .'/shoutbox-form.js', 'module');
// Output the existing shoutbox posts.
$show_amount = 30;
$shoutbox_ascending = variable_get('shoutbox_ascending', FALSE);
$shoutbox_posts_data = _shoutbox_display_posts($show_amount, TRUE, TRUE);
// Output the shoutbox form.
if (_shoutbox_user_access('post shouts') || _shoutbox_user_access('post shouts without approval')) {
$output .= drupal_get_form('shoutbox_add_form');
}
else {
$output .= theme('shoutbox_post_forbidden');
}
$default_nick = t('Your Name/Nick');
$default_msg = t('Enter Message');
$default_url = t('Your Website URL');
// Variable needed by javascript code.
$js_settings = array(
'showAmount' => $show_amount,
// Convert to milliseconds.
'refreshDelay' => (1000 * variable_get('shoutbox_refresh', 0)),
'ascending' => $shoutbox_ascending,
'shownAmount' => $shoutbox_posts_data['count'],
'defaultNick' => $default_nick,
'defaultMsg' => $default_msg,
'defaultUrl' => $default_url,
'refreshPath' => url('shoutbox/js/view'),
);
drupal_add_js(array('shoutbox' => $js_settings), 'setting');
//$output .= theme('table', array(), $shoutbox_posts_data['rows']);
$output .= theme('shoutbox_page', $shoutbox_posts_data['output'], $title);
$output .= theme('pager', NULL, 20, 0);
return $output;
}
Comments
Comment #1
disterics commentedThanks. Would be nice to get it in a patch file.
Comment #2
mstef commentednever issued a patch before so i'm not sure how to do it. just replace the given function with the one above. also, there is no admin setting for the amount of items displayed on the page (see $show_amount).
Comment #3
4strO commentedWhatever number i chose for $show_amount, after the javascript refresh it take the number define in admin setting to display items
Comment #4
mstef commentedHmm maybe you need to change the 20 in the theme_pager to $show_amount...
I threw this together really fast...
Try changing
$output .= theme('pager', NULL, 20, 0);
to
$output .= theme('pager', NULL, $show_amount, 0);
...
It would make sense to add an admin setting that we can just load into $show_amount
Comment #5
mstef commentedI can't duplicate your problem. Even without my changes in #4 - it works fine. 30 items (granted there are at least 30 items in the system).
Comment #6
culfin commentedHi mikestefff,
how can I include your snippet in my page?
Thanks,
Andreas
Comment #7
mstef commentedI changed the icons and edited the CSS a bit - so check that out...
(see attached)
Comment #8
culfin commentedThanks, this looks great :-)
Comment #9
mstef commentedSome of the styling was specific for a theme I've been working on so you can do with it whatever you want..
Comment #10
vitalblue commented