Changeset 5
- Timestamp:
- 02/15/07 23:23:25 (3 years ago)
- Location:
- veekun
- Files:
-
- 8 modified
-
lib/Vee/Controller/Forum.pm (modified) (5 diffs)
-
lib/Vee/Controller/Index.pm (modified) (1 diff)
-
lib/Vee/Controller/Shoutbox.pm (modified) (1 diff)
-
lib/Vee/Controller/Users.pm (modified) (3 diffs)
-
site_options.yml (modified) (1 diff)
-
templates/forum/thread/view.tt (modified) (2 diffs)
-
templates/forum/view.tt (modified) (2 diffs)
-
templates/shoutbox.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
veekun/lib/Vee/Controller/Forum.pm
r1 r5 67 67 or $c->vee_abort('There is no forum with id ' . $c->vee_cleanse($id) . '. You may have followed an old link, or might be playing with URLs.'); 68 68 69 $s->{page_title } = $forum->name . ' - Forums'; 69 my $skip = $c->req->params->{skip} || 0; 70 my $perpage = $c->site_opts->{page_sizes}{threads}; 71 72 $s->{page_title} = $forum->name . ' - Forums'; 70 73 $s->{page_header} = $forum->name; 71 $s->{link_name }= 'forum';72 $s->{extra_css }= 'forum';73 $s->{crumbs }= [ '<a href="/forum">Forum Index</a>', '<a href="/forum/'.$forum->id.'">'.$forum->name.'</a>' ];74 $s->{link_name} = 'forum'; 75 $s->{extra_css} = 'forum'; 76 $s->{crumbs} = [ '<a href="/forum">Forum Index</a>', '<a href="/forum/'.$forum->id.'">'.$forum->name.'</a>' ]; 74 77 75 78 $s->{announcements} = [ $c->model('DBIC::Threads')->search_announcements ]; 76 $s->{forum } = $forum; 77 $s->{threads } = [ $forum->search_related('threads', \ 'NOT FIND_IN_SET("deleted", me.flags)', { order_by => 'FIND_IN_SET("sticky", me.flags) > 0 DESC, lastpost.time DESC', prefetch => { firstpost => 'user', lastpost => 'user' } }) ]; 79 $s->{forum} = $forum; 80 $s->{threads} = [ $forum->search_related('threads', \ 'NOT FIND_IN_SET("deleted", me.flags)', { 81 order_by => 'FIND_IN_SET("sticky", me.flags) > 0 DESC, lastpost.time DESC', 82 prefetch => { firstpost => 'user', lastpost => 'user' }, 83 offset => $skip, 84 rows => $perpage, 85 } ) ]; 78 86 79 87 $s->{template} = 'forum/view.tt'; … … 113 121 } 114 122 115 my $perpage = $c->site_opts->{p erpage_posts};123 my $perpage = $c->site_opts->{page_sizes}{posts}; 116 124 my $lastpage = ($skip + $perpage >= $thread->postct); 117 #my @posts = $c->model('DBIC::Posts')->search({ threadid => $id, ( $filter_user ? ( userid => $filter_user->id ) : () ) }, { order_by => 'me.time ASC', prefetch => [ 'user', { lastedit => 'user' } ], page => $skip / $perpage, rows => $perpage } );118 125 my @posts = $c->model('DBIC::Posts')->search( 119 126 { 'me.threadid' => $id, ( $filter_user ? ( 'me.userid' => $filter_user->id ) : () ) }, … … 141 148 $s->{postbar_color} = sub { Vee::Utils::hsv2rgb(shift, 192, 192) }; # Remove after making global 142 149 143 # probably don't want announcements here? not in template anyway144 #$s->{announcements} = [ $c->model('DBIC::Threads')->search_announcements ];145 150 $s->{forum} = $thread->forum; 146 151 $s->{thread} = $thread; … … 150 155 # $s->{can_post = !$sess->test_post($thread, $thread->forumid), 151 156 $s->{skip} = $skip; 152 $s->{perpage} = $perpage;153 157 $s->{filter} = $filter; 154 158 … … 174 178 ], 175 179 }); 176 my $perpage = $c->site_opts->{p erpage_posts};180 my $perpage = $c->site_opts->{page_sizes}{posts}; 177 181 my $skip = $offset - $offset % $perpage; 178 182 $c->res->redirect( $c->uri('Forum', 'thread', $post->threadid, ($skip ? { skip => $skip } : ()) ) . "#p$id" ); -
veekun/lib/Vee/Controller/Index.pm
r1 r5 41 41 42 42 # TODO: omit deleted postses: by thread or post or what? 43 my $news_forum = $c->model('DBIC::Forums')->find( $c->site_opts->{index_news_forum} ); 44 $s->{recent_news } = [ $news_forum->threads( undef, { prefetch => 'firstpost', order_by => 'me.id DESC', rows => $c->site_opts->{index_news_count} } ) ]; 45 $s->{recent_shouts} = [ $c->model('DBIC::Shoutbox')->search( undef, { order_by => 'me.time DESC', rows => $c->site_opts->{index_shout_count} } ) ]; 46 $s->{recent_art } = [ $c->model('DBIC::Gallery')->search( undef, { order_by => 'me.time DESC', rows => $c->site_opts->{index_gallery_count} } ) ]; 43 my $news_forum = $c->model('DBIC::Forums')->find( $c->site_opts->{special_forums}{news} ); 44 my $page_sizes = $c->site_opts->{page_sizes}; 45 $s->{recent_news } = [ $news_forum->threads( undef, { prefetch => 'firstpost', order_by => 'me.id DESC', rows => $page_sizes->{news} } ) ]; 46 $s->{recent_shouts} = [ $c->model('DBIC::Shoutbox')->search( undef, { order_by => 'me.time DESC', rows => $page_sizes->{shoutbox} } ) ]; 47 $s->{recent_art } = [ $c->model('DBIC::Gallery')->search( undef, { order_by => 'me.time DESC', rows => $page_sizes->{gallery} } ) ]; 47 48 $s->{recent_posts } = [ $c->model('DBIC::Threads')->search( undef, { 48 49 order_by => 'lastpost.time DESC', 49 rows => $ c->site_opts->{index_posts_count},50 rows => $page_sizes->{forum}, 50 51 prefetch => { 'lastpost' => 'user' } 51 52 } ) ]; 52 53 53 54 $s->{recent_users } = [ $c->model('DBIC::Users')->search( 54 { lastactive => { '>', time - $c->site_opts->{ stat_user_activetime} } },55 { lastactive => { '>', time - $c->site_opts->{user_activity_timeout} } }, 55 56 { order_by => 'me.lastactive DESC' } 56 57 ) ]; -
veekun/lib/Vee/Controller/Shoutbox.pm
r1 r5 42 42 order_by => 'time DESC', 43 43 prefetch => ['user'], 44 rows => $c->site_opts->{ shoutbox_page},44 rows => $c->site_opts->{page_sizes}{shoutbox}, 45 45 offset => $skip, 46 46 } -
veekun/lib/Vee/Controller/Users.pm
r1 r5 189 189 190 190 my @recent_users = $c->model('DBIC::Users')->search( 191 { lastactive => { '>', time - $c->site_opts->{ stat_user_activetime} } },191 { lastactive => { '>', time - $c->site_opts->{user_activity_timeout} } }, 192 192 { order_by => 'me.lastactive DESC' } 193 193 ); … … 199 199 # TODO: these are probably completely unnecessary 200 200 201 $s->{postrank } = sub { Vee::Utils::postrank(shift, $c->site_opts->{post ranks}) };201 $s->{postrank } = sub { Vee::Utils::postrank(shift, $c->site_opts->{post_ranks}) }; 202 202 $s->{postwidth } = \&Vee::Utils::post_width; 203 203 $s->{postbar_color} = sub { Vee::Utils::hsv2rgb(shift, 192, 192) }; … … 226 226 227 227 # TODO: these are probably completely unnecessary 228 $s->{postrank} = sub { Vee::Utils::postrank(shift, $c->site_opts->{post ranks}) };228 $s->{postrank} = sub { Vee::Utils::postrank(shift, $c->site_opts->{post_ranks}) }; 229 229 $s->{postwidth} = \&Vee::Utils::post_width; 230 230 $s->{postbar_color} = sub { Vee::Utils::hsv2rgb(shift, 192, 192) }; -
veekun/site_options.yml
r1 r5 43 43 # news link 44 44 45 # Numbers of certain thingies to show per page. 46 page_sizes: 47 index: 48 # Boxes on the index page 49 shoutbox: 10 50 news: 5 51 gallery: 10 52 forum: 20 53 users: 10 54 posts: 20 55 shoutbox: 50 56 threads: 30 57 users: 50 45 58 46 index_news_forum: 1 47 index_news_count: 5 48 index_shout_count: 10 49 index_gallery_count: 10 50 index_posts_count: 20 59 # Forum ids of some forums used for non-forum purposes. 60 special_forums: 61 news: 1 51 62 52 shoutbox_page: 50 63 # Number of seconds before a user is considered inactive 64 user_activity_timeout: 900 53 65 54 userlist_page: 10 55 56 stat_user_activetime: 900 57 58 perpage_posts: 20 59 perpage_threads: 30 60 66 # Number of posts => rank you get 61 67 postranks: 62 68 0: Uninterested -
veekun/templates/forum/thread/view.tt
r1 r5 4 4 [% IF thread.blurb %]<div class="forum-blurb">[% thread.blurb %]</div>[% END %] 5 5 <div class="forum-postct">[% thread.postct %] post[% 's' IF thread.postct != 1 %], [% thread.hitct %] view[% 's' IF thread.hitct != 1 %]</div> 6 [% pagelist(skip, perpage, thread.postct, c.uri('Forum', 'thread', thread.id), c.req.params)%]6 [% this_pagelist = pagelist(skip, c.site_opts.page_sizes.posts, thread.postct, c.uri('Forum', 'thread', thread.id), c.req.params); this_pagelist %] 7 7 [% INCLUDE posts_start %] 8 8 [% FOREACH p IN posts %] … … 43 43 </div> 44 44 [% END %] 45 [% page_list %]45 [% this_pagelist %] 46 46 47 47 [% IF can_post(thread) %] -
veekun/templates/forum/view.tt
r1 r5 1 [% PROCESS 'common.tt' %] 1 2 [% PROCESS 'forum/common.tt' %] 2 3 3 4 [% IF forum.blurb %]<div class="forum-blurb">[% forum.blurb %]</div>[% END %] 5 [% this_pagelist = pagelist(skip, c.site_opts.page_sizes.threads, forum.threadct, c.uri('Forum', 'forum', forum.id), c.req.params); this_pagelist %] 4 6 [% INCLUDE show_announcements announcements=announcements %] 5 7 [% forum_flags = BLOCK %] … … 17 19 [% INCLUDE threads_end %] 18 20 [% forum_flags %] 21 [% this_pagelist %] 19 22 20 23 <h1>Create a new thread</h1> -
veekun/templates/shoutbox.tt
r1 r5 7 7 8 8 <p class="total center">[% shout_total %] shoutbox comments total</p> 9 [% pagelist(skip, c.site_opts.shoutbox_page, shout_total, '/shoutbox', {}) %] 10 11 <!-- hay vee throw in some IPs and stuff I dunno? --> 9 [% pagelist(skip, c.site_opts.page_sizes.shoutbox, shout_total, '/shoutbox', {}) %] 12 10 13 11 [% can_nuke = has_permission('shoutbox_nuke') %]
