Update of /cvs/scoop/scoop/lib/Scoop/Stories
In directory sodium.sabren.com:/tmp/cvs-serv5844/lib/Scoop/Stories

Modified Files:
	Elements.pm Views.pm 
Log Message:

New flexible user preferences stuff.

-janra



Index: Elements.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Elements.pm,v
retrieving revision 1.114
retrieving revision 1.115
diff -C2 -d -r1.114 -r1.115
*** Elements.pm	30 Jul 2004 08:12:57 -0000	1.114
--- Elements.pm	4 Aug 2004 21:49:48 -0000	1.115
***************
*** 117,123 ****
  	
  	# are topics enabled, and does the user want to see topic images?
! 	if ($S->{UI}->{VARS}->{'use_topics'} && 
! 	    (($S->{UID} == -1 && $S->{UI}->{VARS}->{topic_images_default}) || 
! 		($S->{UID} != -1 && $S->{prefs}->{show_topic} ne 'No'))) {
  		$topic = $S->get_topic($story->{tid});
  	} else {
--- 117,123 ----
  	
  	# are topics enabled, and does the user want to see topic images?
! 	if ($S->var('use_topics') && 
! 	    (($S->{UID} == -1 && $S->{PREF_ITEMS}->{show_topic}->{default_value} eq 'on') || 
! 		($S->{UID} != -1 && (($S->pref('show_topic') eq 'on') )))) {
  		$topic = $S->get_topic($story->{tid});
  	} else {
***************
*** 261,266 ****
  		push(@where, $args->{-where}) if ($args->{-where});
  
  		my $offset = (($page * $maxstories) - $maxstories) if $page;
- 
  		my $from = qq|stories s LEFT JOIN $db_name u ON s.aid = u.uid|;
  		
--- 261,266 ----
  		push(@where, $args->{-where}) if ($args->{-where});
  
+ 		my $maxstories = $S->pref('maxstories');
  		my $offset = (($page * $maxstories) - $maxstories) if $page;
  		my $from = qq|stories s LEFT JOIN $db_name u ON s.aid = u.uid|;
  		
***************
*** 425,428 ****
--- 425,429 ----
  		$sec_where .= ' ' . $excl_sect_sql_wAND;
  
+ 		my $maxstories = $S->pref('maxstories');
  		my $offset = (($page * $maxstories) - $maxstories) if $page;
  		if ($S->{UI}->{VARS}->{allow_story_hide}) {
***************
*** 639,643 ****
  sub recent_topics {
  	my $S = shift;
! 	my $images = $S->{UI}->{VARS}->{imagedir}.$S->{UI}->{VARS}->{topics};
  	my ($rv, $sth) = $S->db_select({
  		WHAT => 'tid, sid',
--- 640,644 ----
  sub recent_topics {
  	my $S = shift;
! 	my $images = '%%imagedir%%%%topics%%';
  	my ($rv, $sth) = $S->db_select({
  		WHAT => 'tid, sid',

Index: Views.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Stories/Views.pm,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** Views.pm	30 Jul 2004 08:12:57 -0000	1.66
--- Views.pm	4 Aug 2004 21:49:48 -0000	1.67
***************
*** 68,72 ****
  		$prev_page =~ s/%%LINK%%/%%rootdir%%\/$pre_link\/$pp/g;
  	}
! 	if (@{$stories} && @{$stories} == $S->{UI}->{VARS}->{maxstories}) {
  		$next_page = $S->{UI}->{BLOCKS}->{next_page_link};
  		$next_page =~ s/%%LINK%%/%%rootdir%%\/$pre_link\/$np/g;
--- 68,72 ----
  		$prev_page =~ s/%%LINK%%/%%rootdir%%\/$pre_link\/$pp/g;
  	}
! 	if (@{$stories} && @{$stories} == $S->pref('maxstories')) {
  		$next_page = $S->{UI}->{BLOCKS}->{next_page_link};
  		$next_page =~ s/%%LINK%%/%%rootdir%%\/$pre_link\/$np/g;
***************
*** 263,267 ****
  	my $limit;
  	my $get_num = $num + 1;
! 	my $displayed = $S->{UI}->{VARS}->{maxstories} + $S->{UI}->{VARS}->{maxtitles};
  	my $offset = ($num * ($page - 1)) + $displayed;
  	my $date_format;
--- 263,267 ----
  	my $limit;
  	my $get_num = $num + 1;
! 	my $displayed = $S->pref('maxstories') + $S->pref('maxtitles');
  	my $offset = ($num * ($page - 1)) + $displayed;
  	my $date_format;