Changeset 14
- Timestamp:
- 02/20/07 23:43:38 (3 years ago)
- Location:
- veekun
- Files:
-
- 7 modified
-
lib/Vee/Controller/Forum.pm (modified) (3 diffs)
-
lib/Vee/Schema/Forums.pm (modified) (1 diff)
-
lib/Vee/Utils/Forum.pm (modified) (1 diff)
-
script/base.sql (modified) (1 diff)
-
templates/forum/common.tt (modified) (2 diffs)
-
templates/forum/index.tt (modified) (1 diff)
-
templates/forum/view.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
veekun/lib/Vee/Controller/Forum.pm
r6 r14 48 48 $s->{extra_css } = 'forum'; 49 49 50 $s->{announcements} = [ $c->model('DBIC::Threads')->search_announcements ]; 51 $s->{forums } = [ $c->model('DBIC::Forums')->search(undef, { prefetch => { lastpost => 'user' } }) ]; 50 $s->{announcements} = $c->model('DBIC::Threads')->search_announcements; 51 $s->{forums} = $c->model('DBIC::Forums')->search(undef, { prefetch => { lastpost => 'user' } }); 52 53 $s->{can_see} = sub { Vee::Authorization::has_permission($c, 'override_forum_hidden', shift) }; 52 54 53 55 $s->{template} = 'forum/index.tt'; … … 76 78 $s->{crumbs} = [ '<a href="/forum">Forum Index</a>', '<a href="/forum/'.$forum->id.'">'.$forum->name.'</a>' ]; 77 79 78 $s->{announcements} = [ $c->model('DBIC::Threads')->search_announcements ];80 $s->{announcements} = $c->model('DBIC::Threads')->search_announcements; 79 81 $s->{forum} = $forum; 80 $s->{threads} = [ $forum->search_related('threads', \ 'NOT FIND_IN_SET("deleted", me.flags)', {82 $s->{threads} = $forum->search_related('threads', undef, { 81 83 order_by => 'FIND_IN_SET("sticky", me.flags) > 0 DESC, lastpost.time DESC', 82 84 prefetch => { firstpost => 'user', lastpost => 'user' }, 83 85 offset => $skip, 84 86 rows => $perpage, 85 } ) ]; 87 } ); 88 # ugly but for now I don't know the best way to clean it up 89 $s->{threads} = $s->{threads}->search(\ 'NOT FIND_IN_SET("deleted", me.flags)') unless Vee::Authorization::has_permission($c, 'override_thread_deleted', $forum->id); 86 90 87 91 $s->{template} = 'forum/view.tt'; … … 106 110 or $c->vee_abort('There is no thread with id ', $id, '.'); 107 111 $thread->hitct( $thread->hitct + 1 ); $thread->update; 112 113 if ($thread->flags =~ /deleted/ and not Vee::Authorization::has_permission($c, 'override_thread_deleted', $thread->forum->id)) { 114 $c->vee_abort('This thread has been deleted.'); 115 } 108 116 109 117 my $filter = $c->req->params->{filter}; -
veekun/lib/Vee/Schema/Forums.pm
r1 r14 10 10 __PACKAGE__->load_components("PK::Auto", "Core"); 11 11 __PACKAGE__->table("forums"); 12 __PACKAGE__->add_columns("id", "name", "lastpostid", "threadct", "postct", "flags", " blurb");12 __PACKAGE__->add_columns("id", "name", "lastpostid", "threadct", "postct", "flags", "accessibility", "blurb"); 13 13 __PACKAGE__->set_primary_key("id"); 14 14 __PACKAGE__->add_unique_constraint(["id"], undef); -
veekun/lib/Vee/Utils/Forum.pm
r1 r14 33 33 } 34 34 35 =head2 can_ post35 =head2 can_thread 36 36 37 37 Returns true if the current user can create threads in the given forum, false -
veekun/script/base.sql
r9 r14 59 59 threadct int(10) unsigned NOT NULL default '0', 60 60 postct int(10) unsigned NOT NULL default '0', 61 flags set('locked','readonly','header','hidden') NOT NULL default '', 61 flags set('header') default NULL, 62 accessibility enum('normal','locked','archive','hidden') NOT NULL default 'normal', 62 63 blurb varchar(255) NOT NULL default '', 63 64 PRIMARY KEY (id) -
veekun/templates/forum/common.tt
r13 r14 60 60 61 61 [% BLOCK show_announcements %][%# announcements %] 62 [% RETURN UNLESS announcements AND announcements.size%]62 [% RETURN UNLESS announcements %] 63 63 <h2>Announcements</h2> 64 64 [% INCLUDE threads_start -%] 65 [% FOREACH t IN announcements%]65 [% WHILE (t = announcements.next) %] 66 66 [% INCLUDE threads_each thread=t show_forum=1 %] 67 67 [% END %] … … 179 179 [%# last_thread = sql.thread_info(last_post.threadid) -%] 180 180 <tr><td class="forum-icon"> 181 <!-- TODO: something should go here. --> 181 [% UNLESS forum.accessibility == 'normal' %]<img src="/images/icons/[% forum.accessibility %].png" alt="[% forum.accessibility %]" title="[% forum.accessibility %]"/>[% END %] 182 182 </td><td class="forum-name"> 183 183 <a href="/forum/[% forum.id %]" class="forum-link"> 184 <div class="forum-title"> 185 [% FOREACH flag IN ForumFlagArray %] 186 [% NEXT UNLESS forum.flags.match(flag.name) %] 187 <img src="/images/icons/[% flag.name %].png" alt="[% flag.name %]" title="[% flag.name %]: [% flag.blurb %]" class="forum-icon"/> 188 [% END %] 189 [% forum.name %] 190 </div> 184 <div class="forum-title">[% forum.name %]</div> 191 185 [% IF forum.blurb %] 192 186 <div class="forum-info">[% forum.blurb %]</div> -
veekun/templates/forum/index.tt
r1 r14 10 10 [% forum_flags %] 11 11 [% INCLUDE forums_start %] 12 [% FOREACH f IN forums%]13 [% NEXT UNLESS f%]12 [% WHILE (f = forums.next) %] 13 [% NEXT IF f.accessibility == 'hidden' AND NOT can_see(f.id) %] 14 14 [% IF f.flags.match('header') %] 15 [% INCLUDE forums_header title=f.name blurb=f.blurb%]15 [% prev_header = f %] 16 16 [% ELSE %] 17 [% INCLUDE forums_header title=prev_header.name blurb=prev_header.blurb IF prev_header %] 17 18 [% INCLUDE forums_each forum=f %] 18 19 [% END %] -
veekun/templates/forum/view.tt
r5 r14 13 13 [% forum_flags %] 14 14 [% INCLUDE threads_start %] 15 [% FOREACH t IN threads%]15 [% WHILE (t = threads.next) %] 16 16 [% INCLUDE threads_each thread=t %] 17 17 [% END %]
