Changeset 24

Show
Ignore:
Timestamp:
02/26/07 00:20:14 (23 months ago)
Author:
eevee
Message:

Little bugfixes:
Renamed a few more iterators to have a _rs suffix.
Added a semicolon I forgot. Oops.
Deleted index.tt.old while I was at it.
Fixed: I was still using .size checking on announcement and thread and forum iterators.
Possibly an erroneous pipe on the recent users list on the front page?

Location:
veekun
Files:
1 removed
6 modified

Legend:

Unmodified
Added
Removed
  • veekun/lib/Vee/Controller/Forum.pm

    r23 r24  
    5252    $s->{extra_css}  = 'forum'; 
    5353 
    54     $s->{announcements} = $c->model('DBIC::Threads')->search_announcements; 
    55     $s->{forums}        = $c->model('DBIC::Forums')->search(undef, { prefetch => { lastpost => 'user' } }); 
     54    $s->{announcements_rs} = $c->model('DBIC::Threads')->search_announcements; 
     55    $s->{forums_rs}        = $c->model('DBIC::Forums')->search(undef, { prefetch => { lastpost => 'user' } }); 
    5656 
    5757    $s->{template} = 'forum/index.tt'; 
     
    8080    $s->{crumbs}      = [ '<a href="/forum">Forum Index</a>', '<a href="/forum/'.$forum->id.'">'.$forum->name.'</a>' ]; 
    8181 
    82     $s->{announcements} = $c->model('DBIC::Threads')->search_announcements; 
    83     $s->{forum}         = $forum; 
    84     $s->{threads}       = $forum->search_related('threads', undef, { 
     82    $s->{announcements_rs} = $c->model('DBIC::Threads')->search_announcements; 
     83    $s->{forum}            = $forum; 
     84    $s->{threads_rs}       = $forum->search_related('threads', undef, { 
    8585        order_by => 'FIND_IN_SET("sticky", me.flags) > 0 DESC, lastpost.time DESC', 
    8686        prefetch => { firstpost => 'user', lastpost => 'user' }, 
     
    8989    } ); 
    9090    # TODO: ugly but for now I don't know the best way to clean it up 
    91     $s->{threads} = $s->{threads}->search(\ 'NOT FIND_IN_SET("deleted", me.flags)') unless $c->can_i(override_thread_deleted => $forum->id); 
     91    $s->{threads_rs}       = $s->{threads_rs}->search(\ 'NOT FIND_IN_SET("deleted", me.flags)') unless $c->can_i(override_thread_deleted => $forum->id); 
    9292 
    9393    $s->{template} = 'forum/view.tt'; 
  • veekun/lib/Vee/Controller/Forum/Create.pm

    r23 r24  
    105105            $thread->lastpostid( $last_post->id ); 
    106106            $thread->lasttime( time ); 
    107             $thread->update 
     107            $thread->update; 
    108108 
    109109            return $last_post; 
  • veekun/templates/forum/common.tt

    r23 r24  
    5959<!-- show_announcements: print out the announcement list at the top of a forum page --> 
    6060 
    61 [% BLOCK show_announcements %][%# announcements %] 
    62 [% RETURN UNLESS announcements %] 
     61[% BLOCK show_announcements %][%# announcements_rs %] 
     62[% RETURN UNLESS announcements_rs.first %] 
     63[% CALL announcements_rs.reset %] 
    6364<h2>Announcements</h2> 
    6465[% INCLUDE threads_start -%] 
    65 [% WHILE (t = announcements.next) %] 
     66[% WHILE (t = announcements_rs.next) %] 
    6667[%     INCLUDE threads_each thread=t show_forum=1 %] 
    6768[% END %] 
    6869[% INCLUDE threads_end %] 
    69 <hr/> 
     70<h2>Threads</h2> 
    7071[%+ END %] 
    7172 
  • veekun/templates/forum/index.tt

    r17 r24  
    11[% PROCESS 'forum/common.tt' %] 
    22 
    3 [% INCLUDE show_announcements %] 
     3[% INCLUDE show_announcements announcements_rs=announcements_rs %] 
    44[% forum_flags = BLOCK %] 
    55[%     FOREACH flag IN forum.flags.split(',') %] 
     
    1010[% forum_flags %] 
    1111[% INCLUDE forums_start %] 
    12 [% WHILE (f = forums.next) %] 
    13 [%     NEXT IF f.accessibility == 'hidden' AND NOT c.can_i('override_forum_hidden', f.id) %] 
    14 [%     IF f.flags.match('header') %] 
    15 [%         prev_header = f %] 
    16 [%     ELSE %] 
    17 [%         INCLUDE forums_header title=prev_header.name blurb=prev_header.blurb IF prev_header %] 
    18 [%         INCLUDE forums_each forum=f %] 
     12[% IF NOT forums_rs.first %] 
     13[%     INCLUDE forums_message message='Either no forums exist, or all existing forums are blocked from your view.' %] 
     14[% ELSE %] 
     15[%     CALL forums_rs.reset %] 
     16[%     WHILE (f = forums_rs.next) %] 
     17[%         NEXT IF f.accessibility == 'hidden' AND NOT c.can_i('override_forum_hidden', f.id) %] 
     18[%         IF f.flags.match('header') %] 
     19[%             prev_header = f %] 
     20[%         ELSE %] 
     21[%             INCLUDE forums_header title=prev_header.name blurb=prev_header.blurb IF prev_header %] 
     22[%             INCLUDE forums_each forum=f %] 
     23[%         END %] 
    1924[%     END %] 
    2025[% END %] 
    21 [% INCLUDE forums_message message='Either no forums exist, or all existing forums are blocked from your view.' UNLESS forums.size %] 
    2226[% INCLUDE forums_end %] 
    2327[% forum_flags %] 
  • veekun/templates/forum/view.tt

    r14 r24  
    44[% IF forum.blurb %]<div class="forum-blurb">[% forum.blurb %]</div>[% END %] 
    55[% this_pagelist = pagelist(skip, c.site_opts.page_sizes.threads, forum.threadct, c.uri('Forum', 'forum', forum.id), c.req.params); this_pagelist %] 
    6 [% INCLUDE show_announcements announcements=announcements %] 
     6[% INCLUDE show_announcements announcements_rs=announcements_rs %] 
    77[% forum_flags = BLOCK %] 
    88[%     FOREACH flag IN forum.flags.split(',') %] 
     
    1313[% forum_flags %] 
    1414[% INCLUDE threads_start %] 
    15 [% WHILE (t = threads.next) %] 
    16 [%     INCLUDE threads_each thread=t %] 
     15[% IF NOT threads_rs.first %] 
     16[%     INCLUDE threads_message message='Either no threads exist, or all existing threads are blocked from your view.' %] 
     17[% ELSE %] 
     18[%     CALL threads_rs.reset %] 
     19[%     WHILE (t = threads_rs.next) %] 
     20[%         INCLUDE threads_each thread=t %] 
     21[%     END %] 
    1722[% END %] 
    18 [% INCLUDE threads_message message='Either no threads exist, or all existing threads are blocked from your view.' UNLESS threads.size %] 
    1923[% INCLUDE threads_end %] 
    2024[% forum_flags %] 
  • veekun/templates/index.tt

    r21 r24  
    5050   <p> Recent users: 
    5151[% now = time %] 
     52[% last_user = 0 %] 
    5253[% WHILE (u = recent_users.next) %] 
    5354[%#     IF NOT done_user_sep AND last_user AND last_user.lastactive < now - 600; done_user_set = 1 %] | [%# END %]