Update of /cvs/scoop/scoop/lib/Scoop/Stories
In directory lithium.sabren.com:/tmp/cvs-serv14235/lib/Scoop/Stories
Modified Files:
Elements.pm Views.pm
Log Message:
Bug 165: Tag categories.
-janra
Index: Elements.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Elements.pm,v
retrieving revision 1.123
retrieving revision 1.124
diff -C2 -d -r1.123 -r1.124
*** Elements.pm 26 May 2005 09:37:16 -0000 1.123
--- Elements.pm 10 Sep 2005 01:13:45 -0000 1.124
***************
*** 192,195 ****
--- 192,200 ----
}
+ my $tags;
+ if ($S->var('use_tags')) {
+ $tags = $S->tag_display($story->{sid});
+ }
+
my $page = $S->{UI}->{BLOCKS}->{story_summary};
#warn "Page is:\n--------------------------------\n$page\n\n";
***************
*** 209,213 ****
$page =~ s/%%tid%%/$story->{tid}/g;
$page =~ s/%%new%%/$is_new/g;
!
if( $add_readmore ) {
my ($more, $stats, $section_link) = $S->story_links( $story );
--- 214,219 ----
$page =~ s/%%tid%%/$story->{tid}/g;
$page =~ s/%%new%%/$is_new/g;
! $page =~ s/%%tags%%/$tags/g;
!
if( $add_readmore ) {
my ($more, $stats, $section_link) = $S->story_links( $story );
***************
*** 743,746 ****
--- 749,758 ----
}
+ # add WHERE info for tags
+ if ($params->{tag}) {
+ $where .= qq| AND t.tag = | . $S->dbh->quote($params->{'tag'});
+ $from .= qq| LEFT JOIN story_tags t ON (s.sid = t.sid)|;
+ }
+
$where .= $params->{where} if $params->{where};
$from .= " " . $params->{from} if $params->{from};
Index: Views.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Views.pm,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** Views.pm 10 Feb 2005 23:08:50 -0000 1.70
--- Views.pm 10 Sep 2005 01:13:45 -0000 1.71
***************
*** 7,35 ****
my $S = shift;
my $story_type = shift;
! my $user = $S->{CGI}->param('user');
! my $topic = $S->{CGI}->param('topic');
# Added to allow the use of this to create specialty index
# pages based on factors like posting time, or whatever
! my $where_additions = shift;
! my $from_additions = shift;
! my $spage = $S->{CGI}->param('page') || 1;
! my $op = $S->{CGI}->param('op');
! my $section = $S->{CGI}->param('section');
! my $disp = $S->{CGI}->param('displaystatus');
!
! my $story_params = {-type => $story_type};
! $story_params->{-topic} = $topic if ($topic ne '');
! $story_params->{-user} = $user if ($user ne '');
! $story_params->{-page} = $spage if $spage;
! $story_params->{-where} = $where_additions if $where_additions;
! $story_params->{-from} = $from_additions if $from_additions;
- my $params;
$params->{topic} = $topic if $topic;
$params->{user} = $user if $user;
$params->{page} = $spage if $spage;
- $params->{where} = $where_additions if $where_additions;
- $params->{from} = $from_additions if $from_additions;
if ( $story_type eq 'main' ) {
$params->{displaystatus} = $disp || '0';
--- 7,27 ----
my $S = shift;
my $story_type = shift;
! my $user = $S->cgi->param('user');
! my $topic = $S->cgi->param('topic');
! my $params; # The important stuff args are stored here
# Added to allow the use of this to create specialty index
# pages based on factors like posting time, or whatever
! $params->{where} = shift;
! $params->{from} =shift;
! my $spage = $S->cgi->param('page') || 1;
! my $op = $S->cgi->param('op');
! my $section = $S->cgi->param('section');
! my $disp = $S->cgi->param('displaystatus');
! my $tag = $S->cgi->param('tag');
$params->{topic} = $topic if $topic;
$params->{user} = $user if $user;
$params->{page} = $spage if $spage;
if ( $story_type eq 'main' ) {
$params->{displaystatus} = $disp || '0';
***************
*** 37,40 ****
--- 29,35 ----
$params->{displaystatus} = $disp || [0,1];
$params->{section} = $section;
+ } elsif ($story_type eq 'tag' ) {
+ $params->{displaystatus} = $disp || [0,1];
+ $params->{tag} = $tag;
}
***************
*** 59,65 ****
my $sids = $S->get_sids($params);
my $stories = $S->story_data($sids);
- # my $stories = $S->getstories($story_params);
- my $page;
foreach my $story (@{$stories}) {
$page .= $S->story_summary($story);
--- 54,59 ----
my $sids = $S->get_sids($params);
my $stories = $S->story_data($sids);
+ my $page;
foreach my $story (@{$stories}) {
$page .= $S->story_summary($story);
***************
*** 76,81 ****
if ($section eq 'Diary' && $user) {
$pre_link = "user/$user/diary";
}
!
my $change_page = $S->{UI}->{BLOCKS}->{next_previous_links};
my ($prev_page, $next_page);
--- 70,77 ----
if ($section eq 'Diary' && $user) {
$pre_link = "user/$user/diary";
+ } elsif ($op eq 'tag') {
+ $pre_link = "tag/$tag";
}
!
my $change_page = $S->{UI}->{BLOCKS}->{next_previous_links};
my ($prev_page, $next_page);