Changeset 4331

Show
Ignore:
Timestamp:
06/17/06 16:32:58 (3 years ago)
Author:
morris
Message:

Fix a ton of regression outfall from new linear thread view

Add [s]strikethru/s

Make thread-list three rows

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • animanga/trunk/lib/Animanga.pm

    r4329 r4331  
    338338                my $now = $self->time(); 
    339339                 
    340                 if($self->user("time")) { 
     340                if($self->user("currenttime")) { 
    341341                        # update session 
    342342                        $self->update("sessions", { 
  • animanga/trunk/lib/Animanga/Data.pm

    r4329 r4331  
    138138                pid                     => -1 
    139139        }); 
     140} 
     141 
     142 
     143sub updateSequenceInThreadWithCid { 
     144        my($self, $cid) = @_; 
     145         
     146        $self->recursivelyUpdateSequenceInThreadWithCid($cid, $cid, 1, 0, 0, 0, $self->var("commentsperpage"), $self->constant("statusposted")); 
     147} 
     148 
     149 
     150sub recursivelyUpdateSequenceInThreadWithCid { 
     151        my($self, $cid, $tid, $page, $level, $count, $postedcount, $perpage, $writestatus) = @_; 
     152 
     153        if($postedcount > 0 && $postedcount % $perpage == 0) { 
     154                $page++; 
     155        } 
     156 
     157        $count++; 
     158        $postedcount++ if $writestatus == $self->constant("statusposted"); 
     159 
     160        $self->update("comments", { 
     161                tid                     => $tid, 
     162                page            => $page, 
     163                level           => $level, 
     164                sequence        => $count 
     165        }, { 
     166                cid                     => $cid 
     167        }); 
     168 
     169        my $data = $self->selectAll("cid, writestatus", "comments", { pid => $cid }); 
     170 
     171        $level++; 
     172 
     173        foreach (@$data) { 
     174                ($page, $count, $postedcount) = $self->recursivelyUpdateSequenceInThreadWithCid($_->{"cid"}, $tid, $page, $level, $count, $postedcount, $perpage, $_->{"writestatus"}); 
     175        } 
     176 
     177        $level--; 
     178 
     179        return ($page, $count, $postedcount); 
    140180} 
    141181 
     
    481521 
    482522 
     523sub firstNewCommentReplyInThreadWithTid { 
     524        my($self, $tid) = @_; 
     525 
     526        $tid = $self->quote($tid); 
     527        my $lasttime = $self->quote($self->user("lasttime")); 
     528 
     529        return $self->selectHashref("comments.cid, comments.time, users.uid, users.nick", "comments LEFT JOIN users ON comments.uid = users.uid", "comments.tid = $tid AND comments.time > $lasttime ORDER BY comments.time LIMIT 1"); 
     530} 
     531 
     532 
    483533sub sendMessageToUser { 
    484534        my($self, $from_uid, $to_uid, $subject, $message, $no_receipt) = @_; 
     
    556606        my $now = $self->time(); 
    557607        my $ip = $self->remoteHost(); 
    558         my $level; 
    559         my $sequence; 
     608        my $level = 0; 
     609        my $sequence = 1; 
     610        my $page = 1; 
    560611 
    561612        if($pid == -1) { 
     
    564615                $writestatus    = $self->constant("statusposted"); 
    565616                $replycount             = 0; 
    566                 $sequence               = 1; 
    567                 $level                  = 0; 
    568617        } else { 
    569618                my $parent_subject; 
    570619 
    571                 ($aid, $type, $writestatus, $locked, $parent_subject, $level, $sequence) = $self->select("aid, type, writestatus, locked, subject, level, sequence", "comments", { cid => $pid }); 
    572  
    573                 if($tid) { 
    574                         $sequence = $self->select("MAX(sequence)", "comments", { tid => $tid }); 
    575                 } else { 
    576                         $sequence = 0; 
    577                 } 
     620                ($aid, $type, $writestatus, $locked, $parent_subject) = $self->select("aid, type, writestatus, locked, subject", "comments", { cid => $pid }); 
    578621 
    579622                unless($subject) { 
     
    587630                $tid ||= -1; 
    588631                $replycount = -1; 
    589                 $level++; 
    590                 $sequence++; 
    591632        } 
    592633 
     
    607648                ip              => $ip, 
    608649                writestatus     => $writestatus, 
     650                latest          => $now, 
    609651                locked          => $locked, 
    610652                replycount      => $replycount, 
    611653                level                   => $level, 
    612654                sequence                => $sequence, 
     655                page                    => $page, 
    613656        }); 
    614657 
     
    626669 
    627670        # update user commentcount 
    628         my $commentcount = $self->user("commentcount"); 
    629         $commentcount++; 
    630  
    631         $self->update("users", { 
    632                 commentcount    => $commentcount, 
    633                 commenttime             => $now, 
    634         }, { 
    635                 uid                             => $uid 
    636         }); 
     671        if($writestatus == $self->constant("statusposted")) { 
     672                my $commentcount = $self->user("commentcount"); 
     673                $commentcount++; 
     674 
     675                $self->update("users", { 
     676                        commentcount    => $commentcount, 
     677                        commenttime             => $now, 
     678                }, { 
     679                        uid                             => $uid 
     680                }); 
     681        } 
    637682 
    638683        # update attached comment/thread count 
    639684        if($type == $self->constant("typeforum")) { 
    640                 if($pid == -1 ) { 
    641                         $self->update("forums", { 
    642                                 -threadcount    => "threadcount + 1", 
    643                                 -commentcount   => "commentcount + 1", 
    644                                 commenttime             => $now, 
    645                         }, { 
    646                                 fid                             => $aid 
    647                         }); 
    648                 } else { 
    649                         $self->update("forums", { 
    650                                 -commentcount   => "commentcount + 1", 
    651                                 commenttime             => $now, 
    652                         }, { 
    653                                 fid                             => $aid 
    654                         }); 
    655                 } 
    656  
    657                 if($tid == -1) { 
    658                         $self->update("comments", { 
    659                                 tid             => $cid, 
    660                         }, { 
    661                                 cid                     => $cid 
    662                         }); 
     685                if($writestatus == $self->constant("statusposted")) { 
     686                        if($pid == -1 ) { 
     687                                $self->update("forums", { 
     688                                        -threadcount    => "threadcount + 1", 
     689                                        -commentcount   => "commentcount + 1", 
     690                                        commenttime             => $now, 
     691                                }, { 
     692                                        fid                             => $aid 
     693                                }); 
     694                        } else { 
     695                                $self->update("forums", { 
     696                                        -commentcount   => "commentcount + 1", 
     697                                        commenttime             => $now, 
     698                                }, { 
     699                                        fid                             => $aid 
     700                                }); 
     701                        } 
     702                } 
     703 
     704                if($tid > 0) { 
     705                        if($writestatus == $self->constant("statusposted")) { 
     706                                $self->update("comments", { 
     707                                        lid             => $cid, 
     708                                        latest          => $now, 
     709                                        -replycount             => "replycount + 1", 
     710                                }, { 
     711                                        cid                     => $tid 
     712                                }); 
     713                        } 
     714                } 
     715 
     716                if($tid > 0) { 
     717                        $self->updateSequenceInThreadWithCid($tid); 
    663718                } else { 
    664719                        $self->update("comments", { 
    665                                 lid             => $cid, 
    666                                 latest          => $now, 
    667                                 -replycount             => "replycount + 1", 
     720                                tid                                     => $cid 
    668721                        }, { 
    669                                 cid                    => $tid 
     722                                cid                                    => $cid 
    670723                        }); 
    671  
    672                         $self->update("comments", { 
    673                                 -sequence       => "sequence + 1", 
    674                         }, "tid = '$tid' AND sequence >= '$sequence' AND cid != '$cid'"); 
    675724                } 
    676725        } 
    677726        elsif($type == $self->constant("typestory")) { 
    678                 $self->update("stories", { 
    679                         -storycommentcount  => "storycommentcount + 1", 
    680                         storycommenttime        => $now, 
    681                 }, {  
    682                         fid                     => $aid 
    683                 }); 
     727                if($writestatus == $self->constant("statusposted")) { 
     728                        $self->update("stories", { 
     729                                -storycommentcount  => "storycommentcount + 1", 
     730                                storycommenttime        => $now, 
     731                        }, {  
     732                                fid                     => $aid 
     733                        }); 
     734                } 
    684735        } 
    685736 
    686737        $self->endTransaction(); 
     738 
     739        return $cid; 
    687740} 
    688741 
  • animanga/trunk/lib/Animanga/Data/MySQL.pm

    r4329 r4331  
    286286 
    287287 
     288sub commentReplyWithCid { 
     289        my($self, $cid) = @_; 
     290         
     291        my $writestatus; 
     292 
     293        if($self->user("designation") == $self->constant("usernormal")) { 
     294                $writestatus = "AND comments.writestatus = '" . $self->constant("statusposted") . "'"; 
     295        } 
     296 
     297        $cid = $self->quote($cid); 
     298 
     299        return $self->selectHashref(<<SELECT, <<FROM, <<WHERE); 
     300        comments.cid, comments.time, users.uid, users.nick 
     301SELECT 
     302 
     303        comments 
     304        LEFT JOIN users ON comments.uid = users.uid 
     305FROM 
     306 
     307        comments.cid    = $cid 
     308        $writestatus 
     309WHERE 
     310} 
     311 
     312 
    288313sub commentsWithPid { 
    289314        my($self, $pid, $text) = @_; 
     
    445470WHERE 
    446471 
    447         ORDER BY comments.sticky DESC,comments.latest DESC 
     472        ORDER BY comments.sticky DESC,comments.latest DESC,comments.time DESC 
    448473        LIMIT $offset,$count 
    449474OTHER 
  • animanga/trunk/lib/Animanga/Display.pm

    r4329 r4331  
    172172                } 
    173173 
    174                 if($_->{"style"} == $commentnested) { 
    175                         $_->{"comment"} = $self->parseAnimangaTags($_->{"comment"}, $_->{"uid"}) if $_->{"comment"}; 
    176                         $_->{"signature"} = $self->parseAnimangaTags($_->{"signature"}, $_->{"uid"}) if $_->{"signature"}; 
    177                 } 
     174                $_->{"comment"} = $self->parseAnimangaTags($_->{"comment"}, $_->{"uid"}) if $_->{"comment"}; 
     175                $_->{"signature"} = $self->parseAnimangaTags($_->{"signature"}, $_->{"uid"}) if $_->{"signature"}; 
    178176 
    179177                $comments[0] = $_; 
     
    227225                } 
    228226  
    229                 if($_->{"style"} == $commentnested) { 
    230                         $_->{"comment"} = $self->parseAnimangaTags($_->{"comment"}, $_->{"uid"}) if $_->{"comment"}; 
    231                         $_->{"signature"} = $self->parseAnimangaTags($_->{"signature"}, $_->{"uid"}) if $_->{"signature"}; 
    232                 } 
     227                $_->{"comment"} = $self->parseAnimangaTags($_->{"comment"}, $_->{"uid"}) if $_->{"comment"}; 
     228                $_->{"signature"} = $self->parseAnimangaTags($_->{"signature"}, $_->{"uid"}) if $_->{"signature"}; 
    233229 
    234230                $comments[0] = $_; 
     
    252248         
    253249        foreach (@$data) { 
    254                 $_->{"reply"} = $self->commentWithCid($_->{"lid"}) unless $_->{"lid"} == $_->{"cid"}; 
     250                $_->{"latest"} = $self->commentReplyWithCid($_->{"lid"}) unless $_->{"lid"} == $_->{"cid"}; 
     251                $_->{"new"} = $self->firstNewCommentReplyInThreadWithTid($_->{"tid"}); 
    255252                $_->{"pages"} = POSIX::ceil(($_->{"replycount"} + 1) / $self->var("commentsperpage")); 
    256253        } 
  • animanga/trunk/lib/Animanga/Utility.pm

    r4061 r4331  
    290290        $text =~ s|\[CODE\](.+?)\[/CODE\]|Animanga::Filters::code($1)|ieg; 
    291291 
    292         # [I], [B], [U] 
     292        # [I], [B], [U], [S] 
    293293        $text =~ s|\[I\](.+?)\[/I\]|<i>$1</i>|ig; 
    294294        $text =~ s|\[B\](.+?)\[/B\]|<b>$1</b>|ig; 
    295295        $text =~ s|\[U\](.+?)\[/U\]|<u>$1</u>|ig; 
     296        $text =~ s|\[S\](.+?)\[/S\]|<del>$1</del>|ig; 
    296297 
    297298        return $text; 
  • animanga/trunk/scripts/www/comments.pl

    r4329 r4331  
    310310 
    311311        # submit comment 
    312         $a->postComment($pid, $aid, $type, $subject, $comment, $tid) unless $diff && $diff < 10; 
     312        my $cid = $a->postComment($pid, $aid, $type, $subject, $comment, $tid) unless $diff && $diff < 10; 
    313313         
    314314        # redirect to results 
    315315        if($type == $a->constant("typeforum") && $supercid != -1) { 
    316                 $a->redirect("comments.pl?cid=$supercid"); 
     316                $a->redirect("comments.pl?cid=$supercid;reply=$cid#$cid"); 
    317317        } else { 
    318318                $a->redirect($a->attachedLink($aid, $type)); 
     
    354354        # redirect to results 
    355355        if($type == $a->constant("typeforum")) { 
    356                 $a->redirect("comments.pl?cid=$supercid"); 
     356                $a->redirect("comments.pl?cid=$supercid;reply=$cid#$cid"); 
    357357        } else { 
    358358                $a->redirect($a->attachedLink($aid, $type)); 
  • animanga/trunk/scripts/www/users.pl

    r4329 r4331  
    558558        my $now = $a->time(); 
    559559 
    560         $a->update("sessions", { last => $now }, { uid => $uid }); 
     560        $a->update("sessions", { lasttime => $now }, { uid => $uid }); 
    561561        $a->update("messages", { new => 0 }, { touid => $uid }); 
    562562 
  • animanga/trunk/templates/sensei/users-edit

    r3941 r4331  
    2525<tr> 
    2626<td class="left">Senast</td> 
    27 <td><? page.user.time filter formattedtime ?></td> 
     27<td><? page.user.currenttime filter formattedtime ?></td> 
    2828</tr> 
    2929 
  • animanga/trunk/templates/www/box-list

    r4329 r4331  
    1414<? include new time = item.unixtime ?> <a href="articles.pl?sid=<? item.sid ?>"><? item.title ?></a> 
    1515<? elsif item.type == constants.boxcomment ?> 
    16 <? include new time = item.unixtime ?> <a href="comments.pl?<? if item.cid == item.tid ?>tid<? else ?>cid<? end ?>=<? item.cid ?>"><? item.subject ?></a> 
     16<? include new time = item.unixtime ?> <a href="comments.pl?cid=<? item.cid ?>"><? item.subject ?></a> 
    1717<? elsif item.type == constants.boxforum ?> 
    1818<? include new time = item.unixcommenttime ?> <a href="forum.pl?fid=<? item.fid ?>"><? item.forum ?></a> 
  • animanga/trunk/templates/www/comments

    r4329 r4331  
    3737<input type="hidden" name="aid" value="<? page.comment.aid ?>" /> 
    3838<input type="hidden" name="pid" value="<? page.comment.cid ?>" /> 
    39 <? if page.comment.pid == -1 ?> 
    4039<input type="hidden" name="tid" value="<? page.comment.tid ?>" /> 
    41 <? end ?> 
    4240<input type="hidden" name="type" value="<? page.comment.type ?>" /> 
    4341 
  • animanga/trunk/templates/www/faq

    r2773 r4331  
    3434 
    3535<li><b>[U]</b>understruken stil<b>[/U]</b></li> 
    36 Blir <U>understruken stil</U>. 
     36Blir <u>understruken stil</u>. 
     37 
     38<br /> 
     39<br /> 
     40 
     41<li><b>[S]</b>genomstruken stil<b>[/S]</b></li> 
     42Blir <del>genomstruken stil</del>. 
    3743 
    3844<br /> 
  • animanga/trunk/templates/www/thread-list

    r4329 r4331  
    66<? end ?> 
    77 
    8 <? if comment.reply.uid == 1 ?> 
    9         <? replybyline = comment.reply.nick ?> 
    10 <? else ?> 
    11         <? replybyline = "<a href=\"users.pl?uid=$comment.reply.uid\">$comment.reply.nick</a>" ?> 
     8<? if comment.latest ?> 
     9        <? if comment.latest.uid == 1 ?> 
     10                <? latestbyline = comment.latest.nick ?> 
     11        <? else ?> 
     12                <? latestbyline = "<a href=\"users.pl?uid=$comment.latest.uid\">$comment.latest.nick</a>" ?> 
     13        <? end ?> 
     14<? end ?> 
     15 
     16<? if comment.new ?> 
     17        <? if comment.new.uid == 1 ?> 
     18                <? newbyline = comment.new.nick ?> 
     19        <? else ?> 
     20                <? newbyline = "<a href=\"$urls.www/users.pl?uid=$comment.new.uid\">$comment.new.nick</a>" ?> 
     21        <? end ?> 
    1222<? end ?> 
    1323 
    1424<div class="thread"> 
    1525<? include new time = comment.unixlatest ?> <? if comment.locked ?><b>[låst]</b><? end ?><? if comment.sticky ?><b>[klistrad]</b><? end ?> <a href="comments.pl?cid=<? comment.cid ?>"><? comment.subject ?></a> 
    16  
    17 <? pages = undef ?> 
    1826 
    1927<? if comment.pages > 1 ?> 
     
    3442                <? end ?> 
    3543        <? end ?> 
     44 
     45        (<? pages ?>) 
    3646<? end ?> 
    3747 
    38 <? if pages ?> 
    39         (<? pages ?>) 
    40 <? end ?> 
     48(<a href="<? urls.www ?>/comments.pl?cid=<? comment.cid ?>;overview=1">Översikt</a>) 
     49 
    4150<br /> 
    4251 
    43 <? comment.replycount ?> <? comment.replycount filter answerstring ?>, av <? byline ?><? if comment.replycount == 0 || !comment.reply ?>, <? comment.time filter formattedtime ?><? else ?>, <a href="comments.pl?cid=<? comment.cid ?>;reply=<? comment.reply.cid ?>#<? comment.reply.cid ?>">senaste</a> av <? replybyline ?>, <? comment.reply.time filter formattedtime ?><? end ?> 
     52<? comment.replycount ?> <? comment.replycount filter answerstring ?>, av <? byline ?>, skapad <? comment.time filter formattedtime ?><br /> 
     53<? if comment.latest ?><a href="comments.pl?cid=<? comment.cid ?>;reply=<? comment.latest.cid ?>#<? comment.latest.cid ?>">Senaste</a> av <? latestbyline ?>, postad <? comment.latest.time filter formattedtime ?><? if comment.new ?>, <a href="<? urls.www ?>/comments.pl?cid=<? comment.cid ?>;reply=<? comment.new.cid ?>#<? comment.new.cid ?>">första olästa</a> av <? newbyline ?><? end ?><? end ?> 
    4454</div> 
    4555<? end ?>