Commit info for scoop/lib/Scoop/Stories:
Modified Files:
Elements.pm Submit.pm Views.pm
Log Message:
Missed a couple of files out, which I put in CURRENT, but missed from stable. This just tidies everything up.
--hulver.
Index: Elements.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Elements.pm,v
retrieving revision 1.110
retrieving revision 1.111
diff -r1.110 -r1.111
130c130
< if ($topic->{tid} =~ /^diary_\d+$/) {
---
> if ($story->{section} eq 'Diary') {
138c138
< $topic_img = qq|$topic_link<IMG SRC="%%imagedir%%%%topics%%/$topic->{image}" WIDTH="$topic->{width}" HEIGHT="$topic->{height}" ALT="$topic->{alttext}" ALIGN="right" BORDER=0>$t_link_end
---
> $topic_img = qq|$topic_link<IMG SRC="%%imagedir%%%%topics%%/$topic->{image}" WIDTH="$topic->{width}" HEIGHT="$topic->{height}" ALT="$topic->{alttext}" TITLE="$topic->{alttext}" ALIGN="right" BORDER=0>$t_link_end
227c227,230
< my $section = $S->{CGI}->param('section');
---
> my $user = $args->{'-user'};
>
> my $section = $args->{'-section'};
> $section = $S->{CGI}->param('section') unless ($section);
272a276
> my $count = $maxstories;
274c278,321
<
---
> while (my $story = $sth->fetchrow_hashref) {
> #warn "In Elements, getting commentcount for $story->{sid}\n";
> $story->{commentcount} = $S->_commentcount($story->{sid});
> $story->{archived} = 0;
> push (@{$return_stories}, $story);
> $count --;
> }
> if ($S->{HAVE_ARCHIVE} && ($count > 0) && ( !exists($args->{'-sid'}))) {
> $sth->finish();
> ($rv, $sth) = $S->db_select({
> DEBUG => 0,
> ARCHIVE => 0,
> WHAT => qq|count(sid)|,
> FROM => q{stories},
> WHERE => join(" AND ", @where),
> ORDER_BY => q{time desc},
> LIMIT => $limit
> });
>
> my $maxoffset = $sth->fetchrow;
> $sth->finish();
> my $newoffset = $offset - $maxoffset + ($maxstories - $count);
> $limit = $newoffset ? "$newoffset, $count" : "$count";
> ($rv, $sth) = $S->db_select({
> ARCHIVE => 1,
> DEBUG => 0,
> WHAT => qq|sid, tid, aid, title, dept, $date_format AS ftime, introtext, bodytext, section, displaystatus|,
> FROM => 'stories',
> WHERE => join(" AND ", @where),
> ORDER_BY => 'time desc',
> LIMIT => $limit
> });
>
> while (my $story = $sth->fetchrow_hashref) {
> #warn "In Elements, getting commentcount for $story->{sid}\n";
> $story->{commentcount} = $S->_commentcount($story->{sid});
> $story->{archived} = 1;
> push (@{$return_stories}, $story);
> }
> }
> $sth->finish;
>
> return $return_stories;
>
344d390
< # my $section = $S->{CGI}->param('section');
348,349d393
< my $ad_section = $S->{UI}->{VARS}->{ad_story_section} || 'advertisements';
< my $no_ad_stories = ( $S->{UI}->{VARS}->{ads_in_everything_sec} ? '' : qq|AND section != '$ad_section' | );
363c407
< $sec_where = qq|AND section != 'Diary' $no_ad_stories $ex_sec|;
---
> $sec_where = qq|$ex_sec|;
366,367d409
< # my $sec_where = ($section ne '__all__') ? qq|AND section = '$section' | : qq|AND section != 'Diary' $no_ad_stories|;
<
368a411,414
> if ($user) {
> my $tmp_uid = $S->get_uid_from_nick($user);
> $sec_where .= qq|AND aid = '$tmp_uid' |;
> }
374c420,429
<
---
> if ($S->{UI}->{VARS}->{allow_story_hide}) {
> ($rv, $sth) = $S->db_select({
> ARCHIVE => 0,
> DEBUG => 1,
> WHAT => qq|s.sid as sid, tid, aid, u.nickname AS nick, title, dept, $date_format AS ftime, introtext, bodytext, section, displaystatus|,
> FROM => "(stories s LEFT OUTER JOIN viewed_stories v on s.sid = v.sid and v.uid = $S->{UID}) LEFT JOIN users u ON s.aid = u.uid",
> WHERE => qq|(displaystatus >= 0) and (v.hide < 1 or v.hide is null) $sec_where|,
> ORDER_BY => 'time desc',
> LIMIT => $limit });
> } else {
382,383c437,438
< LIMIT => $limit
< });
---
> LIMIT => $limit });
> };
425a481,483
> $sth->finish;
>
> return $return_stories;
428,431c486,488
< if ($type ne 'section') {
< unless ($rv) {
< return [];
< }
---
> unless ($rv) {
> return [];
> }
433,439c490,494
< while (my $story = $sth->fetchrow_hashref) {
< #warn "In Elements, getting commentcount for $story->{sid}\n";
< $story->{commentcount} = $S->_commentcount($story->{sid});
< $story->{archived} = $S->_check_archivestatus($story->{sid});
< push (@{$return_stories}, $story);
< }
< #warn "Leaving.\n";
---
> while (my $story = $sth->fetchrow_hashref) {
> #warn "In Elements, getting commentcount for $story->{sid}\n";
> $story->{commentcount} = $S->_commentcount($story->{sid});
> $story->{archived} = $S->_check_archivestatus($story->{sid});
> push (@{$return_stories}, $story);
440a496
> #warn "Leaving.\n";
489,490c545,550
< # If we are looking at diaries, show the next and previous diaries
< if ($S->_get_story_section($sid) eq 'Diary')
---
> # If section is an section in the story_nav_bar_sections var
> # then only display stories from that section, otherwise
> # only display stories that are not in any of those sections
> my $sections = $S->{UI}->{VARS}->{'story_nav_bar_sections'} . ',';
> my $section = $S->_get_story_section($sid);
> if ($sections =~ /$section/)
492c552,553
< $excl_sect_sql .= ' AND section = "Diary"';
---
> $section = $S->dbh->quote($section);
> $excl_sect_sql .= qq|AND section = $section|;
494c555,560
< $excl_sect_sql .= ' AND section != "Diary"';
---
> my @section_list = split /,\s*/, $sections;
> foreach $section (@section_list) {
> next unless (exists $S->{SECTION_DATA}->{$section});
> $section = $S->dbh->quote($section);
> $excl_sect_sql .= qq|AND section != $section|;
> }
497,500d562
<
< my $ad_story_section = $S->{UI}->{VARS}->{ad_story_section} || 'advertisements';
< $ad_story_section = $S->dbh->quote($ad_story_section);
<
506c568
< WHERE => qq|time < "$story->{time}" AND displaystatus >= 0 AND section != $ad_story_section $excl_sect_sql|,
---
> WHERE => qq|time < "$story->{time}" AND displaystatus >= 0 $excl_sect_sql|,
521c583
< WHERE => qq|time > "$story->{time}" AND displaystatus >= 0 AND section != $ad_story_section $excl_sect_sql|,
---
> WHERE => qq|time > "$story->{time}" AND displaystatus >= 0 $excl_sect_sql|,
Index: Submit.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Submit.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -r1.16 -r1.17
40,44d39
< if ($section eq 'Diary') {
< $topic = 'diary_'.$S->{UID};
< $params->{tid} = 'diary_'.$S->{UID};
< }
<
Index: Views.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Views.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -r1.63 -r1.64
8a9,10
> my $user = $S->{CGI}->param('user');
> my $topic = $S->{CGI}->param('topic');
14d15
< my $topic = $S->{CGI}->param('user');
20a22
> $story_params->{-user} = $user if ($user ne '');
37a40,44
> if ($user) {
> my $uid = $S->get_uid_from_nick($user);
> return qq|<b>%%norm_font%%Sorry, I can't seem to find that user.%%norm_font_end%%</b>| unless ($uid);
> }
>
53,56c60,61
< if ($section eq 'Diary' && $topic) {
< my $uid = $topic;
< $uid =~ s/diary_//;
< $pre_link = "user/uid:$uid/diary";
---
> if ($section eq 'Diary' && $user) {
> $pre_link = "user/$user/diary";
89c94
< $edit = qq|[<A HREF="%%rootdir%%/admin/story/$story->{sid}">edit</A>]|;
---
> $edit = qq|[<A CLASS="light" HREF="%%rootdir%%/admin/story/$story->{sid}">edit</A>]|;
98c103
< my $more .= qq|<A HREF="%%rootdir%%/story/$story->{sid}">$text</A> | unless
---
> my $more .= qq|<A CLASS="light" HREF="%%rootdir%%/story/$story->{sid}">$text</A> | unless
289c294
< <B>$i) <A HREF="%%rootdir%%/story/$story->{sid}">$story->{title}</A></B> by $story->{nick}, $story->{commentcount} comments<BR>
---
> <B>$i) <A CLASS="light" HREF="%%rootdir%%/story/$story->{sid}">$story->{title}</A></B> by $story->{nick}, $story->{commentcount} comments<BR>
310c315
< $content .= qq|< <A HREF="%%rootdir%%/?op=$op;page=$last_page">Last $num</A>|;
---
> $content .= qq|< <A CLASS="light" HREF="%%rootdir%%/?op=$op;page=$last_page">Last $num</A>|;
319c324
< <A HREF="%%rootdir%%/?op=$op;page=$next_page">Next $num</A> >%%norm_font_end%%|;
---
> <A CLASS="light" HREF="%%rootdir%%/?op=$op;page=$next_page">Next $num</A> >%%norm_font_end%%|;