Committer: esavintcev
LJSUP-7758: AntiSpam S2U trunk/bin/upgrading/s2layers/sixhtml/layout.s2
Modified: trunk/bin/upgrading/s2layers/sixhtml/layout.s2 =================================================================== --- trunk/bin/upgrading/s2layers/sixhtml/layout.s2 2011-02-24 10:30:32 UTC (rev 18399) +++ trunk/bin/upgrading/s2layers/sixhtml/layout.s2 2011-02-24 10:43:22 UTC (rev 18400) @@ -173,6 +173,9 @@ noui = 1; } set text_comments = "Comments"; + property use text_showspam; + property use text_hidespam; + property use text_spam_comment; } propgroup customcss { @@ -991,14 +994,19 @@ function EntryPage::print_comment(Comment e) { - if (not $e.full) { + var Page p = get_page(); + if ((not $e.full) or ($e.full and $e.spam and not $p.showspam)) { # Collapsed mode "<div class='comment collapsed-comment'"+($e.dom_id ? " id='$e.dom_id'" : "")+">\n"; "<div class='comment-footer'>"; - var string subject = $e.subject; - if ($subject == "") { $subject = $*text_nosubject; } - "<a href='$e.permalink_url' class='collapsed-comment-link'>$subject</a> <span class='separator'>-</span> "; + if ($e.spam and not $p.showspam) { + """$*text_spam_comment <span class='separator'>-</span> """; + } else { + var string subject = $e.subject; + if ($subject == "") { $subject = $*text_nosubject; } + "<a href='$e.permalink_url' class='collapsed-comment-link'>$subject</a> <span class='separator'>-</span> "; + } print safe lang_posted_by($e.poster, $e.poster); " <span class='separator'>-</span> "; print lang_posted_date_and_time($e, $e.time, true, true); var Link expand_link = $e->get_link("expand_comments"); @@ -1121,6 +1129,7 @@ } function Page::print_entry(Entry e) { + var Page p = get_page(); "<div class='entry'" + ($e.dom_id ? " id='$e.dom_id'" : "") + ">\n"; var bool showtime = $*opt_showtime; @@ -1165,10 +1174,21 @@ } "<a class='permalink' href='$e.permalink_url'>$*text_permalink</a>"; - + if ($e.comments.show_postlink) { " $sep "; $e.comments->print_postlink(); } - if ($e.comments.show_readlink) { " $sep "; $e.comments->print_readlink(); } + if ($e.comments.show_readlink) { + " $sep "; $e.comments->print_readlink(); + if ($p.view == "entry") { + if ($p.showspam) { + print safe """ $sep <a href=\"$e.comments.read_spam_url\">$*text_hidespam</a>"""; + } else { + print safe """ $sep <a href=\"$e.comments.read_spam_url\">$*text_showspam</a>"""; + } + } + } + + $e->print_linkbar(); "</p>"; "</div>\n";