Description:
This displays the list of older stories on the site. Depending on the page its on, it will show all older stories, just older stories from the section you're viewing, or just older stories from the front page.
Box Code:
my $section = $S->{CGI}->param('section') || 'front';
my $stories = [];
if ($section eq 'front') {
$stories = $S->getstories({-type => 'titlesonly', -displaystatus => '0'});
} elsif ($section eq '__all__') {
$stories = $S->getstories({-type => 'titlesonly', -section => '!Diary'});
} else {
$stories = $S->getstories({-type => 'titlesonly', -section => $section});
}
my $box_content;
my $date = undef;
foreach my $story (@{$stories}) {
if (($story->{ftime} ne $date) || !$date) {
$date = $story->{ftime};
$box_content .= qq|
<P>
<B>$story->{ftime}</B>|;
}
$box_content .= qq|
<BR>%%dot%% <A CLASS="light" HREF="%%rootdir%%/story/$story->{sid}">$story->{title}</A> ($story->{commentcount} comments)|;
if ($S->have_perm('story_list')) {
$box_content .= qq| [<A CLASS="light" HREF="%%rootdir%%/admin/story/$story->{sid}">edit</A>]|;
}
}
my $offset = $S->{UI}->{VARS}->{maxstories} + $#{$stories};
my $search_url = qq{%%rootdir%%/?op=search;offset=$offset};
$search_url .= ';section='.$section if ($section ne 'front');
$box_content .= qq|
<P>
<A CLASS="light" HREF="$search_url">Older Stories...</A>
</P>|;
my $return = {content => "%%smallfont%%$box_content%%smallfont_end%%"};
if ($section ne 'front' && $section ne '__all__') {
$return->{title} = $S->{SECTION_DATA}->{$section}->{title};
} elsif ($section eq '__all__') {
$return->{title} = 'All Stories';
}
return $return;
|