Савинцев Егор 🚶 (savintsev_egor) wrote in changelog,
Савинцев Егор 🚶
savintsev_egor
changelog

[ljcom] r10101: LJSUP-7758: AntiSpam S2

Committer: esavintcev
LJSUP-7758: AntiSpam S2
U   trunk/bin/upgrading/s2layers/voxhtml/layout.s2
Modified: trunk/bin/upgrading/s2layers/voxhtml/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/voxhtml/layout.s2	2011-02-24 04:10:45 UTC (rev 10100)
+++ trunk/bin/upgrading/s2layers/voxhtml/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
@@ -563,6 +563,9 @@
     property use text_multiform_opt_track;
     property use text_multiform_opt_untrack;
     property use text_comment_frozen;
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 
     property string text_sidebar_tags {
         des = "Text used to link to the Tags page from the sidebar";
@@ -595,6 +598,7 @@
     set text_meta_music = "Music";
     set text_meta_groups = "Groups";
     set text_website_default_name = "Website";
+    
 
 }
 
@@ -1906,6 +1910,7 @@
 }
 
 function EntryPage::print_body() {
+    var Page p = get_page();
     var string skiplinks = "";
 
     var Link forward = $.entry->get_link("nav_next");
@@ -1941,22 +1946,39 @@
             $comments_count = get_plural_phrase($.entry.comments.count, "text_read_comments");
         }
         if ($.entry.comments.count > 0) {
-			if (not $.entry.comments.locked) {
-				$comments_count = """$comments_count — """;
-			} else {
-				$comments_count = """$comments_count""";
-			}
+            if (not $.entry.comments.locked) {
+                $comments_count = """$comments_count — """;
+            } else {
+                $comments_count = """$comments_count""";
+            }
         } else {
             $comments_count = "";
         }
 
+        var string comments_showspam = "";
+        if ($.entry.comments.count > 0 and not $.entry.comments.locked) {
+            if ($p.showspam) {
+                $comments_showspam = """<span class="comments-hidespam"><a href=\"$.entry.permalink_url\">$*text_hidespam</a></span> <span class="emdash">—</span> """;
+            } else {
+                $comments_showspam = """<span class="comments-showspam"><a href=\"$.entry.permalink_url?mode=showspam\">$*text_showspam</a></span> <span class="emdash">—</span> """;
+            }
+        } elseif ($.entry.comments.count > 0) {
+            if ($p.showspam) {
+                $comments_showspam = """<span class="comments-hidespam"><a href=\"$.entry.permalink_url\">$*text_hidespam</a></span> """;
+            } else {
+                $comments_showspam = """<span class="comments-showspam"><a href=\"$.entry.permalink_url?mode=showspam\">$*text_showspam</a></span> """;
+            }
+        } else {
+            $comments_showspam = "";
+        }
+
     """<a id="comments"></a>
 <div id="comments">
           <div class="comments-inner">
             <h2 class="comments-header page-header2">$*text_comments</h2>
             <div class="comments-body">
               <div class="comments-nav">
-                ( $comments_count""";
+                ( $comments_count $comments_showspam""";
 	if (not $.entry.comments.locked) { 
 		$this->print_reply_link({"target" => "topcomment", "linktext" => $*text_post_comment}); 
 	}
@@ -1989,7 +2011,7 @@
 
 """
               <div class="comments-nav">
-                ( $comments_count""";
+                ( $comments_count $comments_showspam""";
 	if (not $.entry.comments.locked) {
 		$this->print_reply_link({"target" => "bottomcomment", "linktext" => $*text_post_comment});
 	}
@@ -2293,6 +2315,7 @@
 }
 
 function EntryPage::print_comment(Comment e) {
+    var Page p = get_page();
     var string barc = "comment-" + ($e.depth % 2 ? "odd" : "even");
     var string screenbarc = "";
     var string borderwidth = "";
@@ -2302,7 +2325,7 @@
     var string indent = ($e.depth - 1) * 25 + "px";
     var string id     = $e.dom_id ? " id=\"$e.dom_id\"" : "";
 
-    if (not $e.full) {
+    if ((not $e.full) or ($e.full and $e.spam and not $p.showspam)) {
         # Collapsed mode
 
         """
@@ -2312,9 +2335,13 @@
             <div class="comment-meta">""";
 
         var string subject = $e.subject != "" ? $e.subject : """<i class="nosubject">$*text_nosubject</i>""";
+        
+        if ($e.spam and not $p.showspam) {
+            print safe """<strong>$*text_spam_comment</strong> <span class="separator">-</span> """;
+        } else {
+             print safe """<a href="$e.permalink_url" class="collapsed-comment-link">$subject</a> <span class="separator">-</span> """;
+        }
 
-        print safe """<a href="$e.permalink_url" class="collapsed-comment-link">$subject</a> <span class="separator">-</span> """;
-
         var string poster = (defined $e.poster ? ""+$e.poster : """<i class="noposter">$*text_poster_anonymous</i>""");
         print safe """$poster <span class="separator">-</span> """;
         print lang_posted_by_date_and_time($e, false, true, true);

Tags: ljcom, s2, savintsev_egor
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments