]> www.wagner.pp.ru Git - oss/stilllife.git/commitdiff
Fixed problem with substitution of message link
authorVictor Wagner <vitus@wagner.pp.ru>
Tue, 1 Apr 2008 10:17:58 +0000 (10:17 +0000)
committerVictor Wagner <vitus@wagner.pp.ru>
Tue, 1 Apr 2008 10:17:58 +0000 (10:17 +0000)
forum/forum

index d2ae68623d1e6def113126e65dd7a280feba3108..e73f98af81a9aef22cafb80c16275fd66918ca7f 100755 (executable)
@@ -1095,7 +1095,7 @@ sub reply {
                show_error($forum,"В шаблоне сообщения отсутствует якорь для ссылок на него");
        # подставляем mlink
        substinfo($newmsg,[_tag=>"a","class"=>"mlink"],
-               href=>$cgi->path_info."#id");
+               href=>$cgi->path_info."#$id");
        # подставляем mparent
        my $parent_id=$cgi->param("id");
        if ($parent_id) {
@@ -1151,8 +1151,13 @@ sub record_as_recent {
                        $msglist->attr("style",$style);
                        $msglist->look_down(class=>"message")->replace_with($msg);
                } else {
-                       my $prev = $msglist->look_down("class"=>"message");
-                       $prev->preinsert($msg); 
+                       my @msgs = $msglist->look_down("class"=>"message");
+                       if (@msgs > $forum->{replies_per_page}) {
+                               for (my $i=$#msgs;$i>=$forum->{replies_per_page};$i--) {
+                                       $msgs[$i]->delete;
+                               }
+                       }       
+                       $msgs[0]->preinsert($msg);      
                }
        }
        savetree($forum->{forumroot}."/recent.html",$tree,$lockfd);