Committer: esavintcev
LJSUP-7758: AntiSpam S2U trunk/bin/upgrading/s2layers/opal/layout.s2
Modified: trunk/bin/upgrading/s2layers/opal/layout.s2 =================================================================== --- trunk/bin/upgrading/s2layers/opal/layout.s2 2011-02-24 11:12:38 UTC (rev 10118) +++ trunk/bin/upgrading/s2layers/opal/layout.s2 2011-02-24 11:34:46 UTC (rev 10119) @@ -154,6 +154,9 @@ set free_text_text = ""; set text_back = "Back"; set text_forward = "Forward"; + property use text_showspam; + property use text_hidespam; + property use text_spam_comment; } propgroup customcss { @@ -1031,10 +1034,18 @@ function CommentInfo::print() { + var Page p = get_page(); if ($.enabled) { $this->print_postlink(); if ($.count > 0 or $.screened) { $this->print_readlink(); + if ($p.view == "entry") { + if ($p.showspam) { + print safe """<a href=\"$.read_spam_url\"> $*text_hidespam </a>"""; + } else { + print safe """<a href=\"$.read_spam_url\"> $*text_showspam </a>"""; + } + } } } } @@ -1139,9 +1150,26 @@ } function EntryPage::print_comments(Comment[] cs) { + var Page p = get_page(); if (size $cs == 0) { return; } foreach var Comment c ($cs) { - if ($c.full) { + if ($c.spam and not $p.showspam) { + var string indent = ($c.depth - 1) * 25 + "px"; + """<div id='$c.dom_id' style='margin-left: $indent;'><a name='$c.anchor'></a><div class="entry">$*text_spam_comment</div></div>"""; + if ((size $c.replies) > 0 and $c.replies[0].full == false) { + """<div style="margin-top: 5px; margin-bottom: 5px; clear: both;">\n"""; + $this->print_comments($c.replies); + "</div>\n"; + } + """ + <div class="backtop"><a href="#top">back to top</a></div> + + """; + if ((size $c.replies) > 0 and $c.replies[0].full == true) { + $this->print_comments($c.replies); + } + } + elseif ($c.full) { $this->print_comment($c); } else { $this->print_comment_partial($c);