Максим Червонный (fiskus_boulder) wrote in changelog,
Максим Червонный
fiskus_boulder
changelog

[ljcom] r10102: LJSUP-7758: antispam buttons, and hided ...

Committer: mchervonniy
LJSUP-7758: antispam buttons, and hided spam comments
U   trunk/bin/upgrading/s2layers/3column/layout.s2
U   trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2
U   trunk/bin/upgrading/s2layers/boxer/layout.s2
U   trunk/bin/upgrading/s2layers/component/layout.s2
U   trunk/bin/upgrading/s2layers/cuteness/layout.s2
U   trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2
U   trunk/bin/upgrading/s2layers/gradient/layout.s2
Modified: trunk/bin/upgrading/s2layers/3column/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/3column/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/3column/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -191,6 +191,9 @@
                                  cols = 25;
                                  string_mode = "html"; }
     set blurb_text= "";
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 }
 
 propgroup customcss {
@@ -531,8 +534,13 @@
 
 function EntryPage::print_comments(Comment[] cs) {
     if (size $cs == 0) { return; }
+    var Page p = get_page();
     foreach var Comment c ($cs) {
-        if ($c.full) {
+        if ($c.spam and not $p.showspam and (size $c.replies) > 0) {
+            """<div class="comment_wrapper"><div class="entrytext"><strong>$*text_spam_comment</strong></div></div>""";
+        } elseif ($c.spam and not $p.showspam and (size $c.replies) < 1) {
+            # spam comment w/o children
+        } elseif ($c.full) {
             $this->print_comment($c);
         } else {
             $this->print_comment_partial($c);
@@ -540,7 +548,6 @@
     }
 }
 
-
 function EntryPage::print_comment(Comment c) {
     var string datetime;
     $datetime = $c->time_display("long", "");
@@ -688,6 +695,7 @@
     """</div>""";
 }
 function Page::print_entry (Entry e)  {
+    var Page p = get_page();
         # Print an anchor
     print """<a name="item""" + $e.itemid + """\"></a>""";
         # Get the right time and date of the post
@@ -788,6 +796,21 @@
     """;
 
     $e.comments->print();
+
+    var string comments_showspam = "";
+    if ($e.comments.count > 0 and not $e.comments.locked) {
+        if ($p.showspam) {
+            $comments_showspam = """<a href="$e.permalink_url"><img src="$*SITEROOT/img/style/3column/spam.png" alt="$*text_hidespam"/></a>""";
+        } else {
+            $comments_showspam = """<a href="$e.permalink_url?mode=showspam"><img src="$*SITEROOT/img/style/3column/unspam.png" alt="$*text_showspam"/></a>""";
+        }
+    } else {
+        $comments_showspam = "";
+    }
+
+    if ($p.view == "entry") {
+        print safe """$comments_showspam""";
+    }
     print safe """<a href="$e.permalink_url" title="$*t_perma"><img src="$*i_perma" border="0" alt="$*t_perma" title="$*t_perma" /></a>""";
     var string{} my_captions = {"edit_entry" => "$*i_edit", "mem_add" => "$*i_mem", "edit_tags" => "$*i_tags", "watch_comments" => "$*i_tracknew", "unwatch_comments" => "$*i_untracknew", "tell_friend" => "$*i_tellafriend", "flag" => "$*i_flag"};
     var Link link;

Modified: trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/anovelconundrum/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -138,6 +138,9 @@
         des = "Alternative text for dingbar images";
         noui = 1;
     }
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 }
 
 propgroup customcss {
@@ -733,11 +736,23 @@
         if ($.comments.maxcomments) {
             "Maximum Comments Reached";
         } else {
-          ###  "<a href=\"$.comments.post_url\">Leave a Comment</a>";
-if (not $.comments.locked) {
-          $p->print_reply_link({"target" => "bottomcomment", "linktext" => $*text_post_comment});
-}
+            ###  "<a href=\"$.comments.post_url\">Leave a Comment</a>";
+            if (not $.comments.locked) {
+                $p->print_reply_link({"target" => "bottomcomment", "linktext" => $*text_post_comment});
+            }
         }
+
+        # spam link
+        var string comments_showspam = "";
+        if ($.comments.count > 0 and not $.comments.locked) {
+            if ($p.showspam) {
+                $comments_showspam = """ <a href="$.permalink_url">$*text_hidespam</a> """;
+            } else {
+                $comments_showspam = """ <a href="$.permalink_url?mode=showspam">$*text_showspam</a> """;
+            }
+        }
+        print safe """ &middot; $comments_showspam""";
+
 if (not $.comments.locked) {
         " &middot; ";
 }
@@ -1055,6 +1070,7 @@
 
 function EntryPage::print_comments(Comment[] cs) {
     if (size $cs == 0) { return; }
+    var Page p = get_page();
     foreach var Comment c ($cs) {
         if($c.depth==1) {
             "</td></tr></table>";
@@ -1064,7 +1080,11 @@
             "<table align='center' cellspacing='0' border='0' cellpadding='0'><tr><td>";
         }
         var int indent = ($c.depth - 1) * 21;
-        if ($c.full) {
+        if ($c.spam and not $p.showspam and (size $c.replies) > 0) {
+            """<div class="ljcmt_full" id="$c.dom_id" style='margin-left: ${indent}pt;'>\n<div class="bodybox" style="margin-top:13pt;"><strong>$*text_spam_comment</strong></div>""";
+        } elseif ($c.spam and not $p.showspam and (size $c.replies) < 1) {
+            # spam comment w/o children
+        } elseif ($c.full) {
             """<div class="ljcmt_full" id="$c.dom_id" style='margin-left: ${indent}pt;'>\n""";
             $this->print_comment($c);
         } else {

Modified: trunk/bin/upgrading/s2layers/boxer/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/boxer/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/boxer/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -228,6 +228,9 @@
         des = "Links Divider";
         note = "This appears between each link to separate them.";
     }
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 }
 
 propgroup customcss {
@@ -921,6 +924,19 @@
                                                 "</span>";
                     }
 
+                    # spam link
+                    var string comments_showspam = "";
+                    if ($e.comments.count > 0 and not $e.comments.locked) {
+                        if ($p.showspam) {
+                            $comments_showspam = """ <span class="icon"><a href="$e.permalink_url"><img src="$*SITEROOT/img/btn_unspam.gif" align="middle" border="0" alt="$*text_hidespam" /></a></span> """;
+                        } else {
+                            $comments_showspam = """ <span class="icon"><a href="$e.permalink_url?mode=showspam"><img src="$*SITEROOT/img/btn_spam.gif" align="middle" border="0" alt="$*text_showspam" /></a></span> """;
+                        }
+                    }
+                    if ($p.view == "entry") {
+                        print safe """$comments_showspam""";
+                    }
+
                     var string{} link_image = {
                         "edit_entry" => $*edit,
                         "edit_tags" => $*tags,
@@ -1180,8 +1196,14 @@
 
 function EntryPage::print_comments (Comment[] cs) {
     if (size $cs == 0) { return; }
+    var Page p = get_page();
     foreach var Comment c ($cs) {
-        if ($c.full) {
+        if ($c.spam and not $p.showspam and (size $c.replies) > 0) {
+            var int sidewidth = 122 + ($c.depth - 1) * 25;
+            print """ <a name="t$c.talkid"></a><table class="new" id="$c.dom_id" width="$*page_width" cellpadding="0" cellspacing="0"><tr><td style="background:#2F382E;" width="$sidewidth"></td><td width="2"></td><td class="entry"><div class="entrycontent"><strong>$*text_spam_comment</strong></div></td></tr></table> """;
+        } elseif ($c.spam and not $p.showspam and (size $c.replies) < 1) {
+            # spam comment w/o children
+        } elseif ($c.full) {
             $this->print_comment($c);
         } else {
             $this->print_comment_partial($c);

Modified: trunk/bin/upgrading/s2layers/component/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/component/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/component/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -328,7 +328,9 @@
     property use text_meta_location;
     property use text_meta_groups;
     property use text_permalink;
-
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 }
 set free_text_text = "about this journal";
 set calendar_text = "calendar";
@@ -2202,6 +2204,20 @@
         "                <div class=\"entryComments\">";
                             $e.comments->print();
                             $p->print_reply_container({"target" => "topcomment"});
+                            var string comments_showspam = "";
+                            if ($e.comments.count > 0 and not $e.comments.locked) {
+                                if ($p.showspam) {
+                                    $comments_showspam = """<a href="$e.permalink_url">$*text_hidespam</a>""";
+                                } else {
+                                    $comments_showspam = """<a href="$e.permalink_url?mode=showspam">$*text_showspam</a>""";
+                                }
+                            } else {
+                                $comments_showspam = "";
+                            }
+
+                            if ($p.view == "entry") {
+                                print safe " or $comments_showspam";
+                            }
                         """</div>
                         </td>
                         <td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
@@ -2775,6 +2791,7 @@
 # called from entry page.  loops through entries and runs EntryPage::print_comment
 function EntryPage::print_comments (Comment[] cs) {
     if (size $cs == 0) { return; }
+    var Page p = get_page();
     var bool first = true;
     foreach var Comment c ($cs) {
         if($c.depth == 1) {
@@ -2784,7 +2801,12 @@
                 $first = false;
             }
         }
-        if ($c.full) {
+        if ($c.spam and not $p.showspam and (size $c.replies) > 0) {
+            var int margin = ($c.depth - 1) * 25;
+            print "<div style=\"margin:3px 0 3px " + $margin + "px;border:1px solid #D6D6D6;\" class=\"entry\"><strong>$*text_spam_comment</strong></div>";
+        } elseif ($c.spam and not $p.showspam and (size $c.replies) < 1) {
+            # spam comment w/o children
+        } elseif ($c.full) {
             $this->print_comment($c);
         } else {
             $this->print_comment_partial($c);

Modified: trunk/bin/upgrading/s2layers/cuteness/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/cuteness/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/cuteness/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -184,6 +184,8 @@
         property string text_comment_viewall { des = "Text for view all comments"; }
         property string text_links_header { des = "Sidebar links header text"; }
         property string text_links_spacer { des = "String to act as links list spacer";}
+        property use text_showspam;
+        property use text_hidespam;
 }
 
 
@@ -1378,6 +1380,20 @@
 
                 print "<h4>";
                 print safe get_permalink($e.permalink_url);
+                    var string comments_showspam = "";
+                    if ($e.comments.count > 0 and not $e.comments.locked) {
+                        if ($p.showspam) {
+                            $comments_showspam = """<a href="$e.permalink_url">$*text_hidespam</a>""";
+                        } else {
+                            $comments_showspam = """<a href="$e.permalink_url?mode=showspam">$*text_showspam</a>""";
+                        }
+                    } else {
+                        $comments_showspam = "";
+                    }
+
+                    if ($p.view == "entry") {
+                        print safe " | $comments_showspam | ";
+                    }
                 if ( $p.view != "entry" and $p.view != "reply" ) {
                         print " | ";
                         $e.comments->print();

Modified: trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/flexiblesquares/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -439,6 +439,9 @@
     property use text_skiplinks_forward;
     set text_skiplinks_back = "go earlier";
     set text_skiplinks_forward = "go later";
+    property use text_showspam;
+    property use text_hidespam;
+    property use text_spam_comment;
 }
 
 ### SIDEBAR
@@ -2062,6 +2065,7 @@
 
 function EntryPage::print_body()
 {
+    var Page p = get_page();
     $this->print_entry($.entry);
 
     if ($.entry->viewer_sees_ebox()) {
@@ -2095,6 +2099,23 @@
     } 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 = "";
+    }
 
     if ($.entry.comments.enabled)
     {
@@ -2104,7 +2125,7 @@
             <center>""";
              $.comment_pages->print();
             """
-            <b>( $comments_count""";
+            <b>( $comments_count $comments_showspam""";
 			if (not $.entry.comments.locked) {
             	$this->print_reply_link({"target" => "topcomment", "linktext" => "Post a new comment"});
 			}
@@ -2123,7 +2144,7 @@
         $this->print_multiform_end();
             """
             <center>
-            <b>( $comments_count""";
+            <b>( $comments_count $comments_showspam""";
 			if (not $.entry.comments.locked) {
             	$this->print_reply_link({"target" => "topcomment", "linktext" => "Post a new comment"});
 			}
@@ -2148,6 +2169,7 @@
 
 function EntryPage::print_comments( Comment[] comments )
 {
+    var Page p = get_page();
     if ( size $comments == 0 )
     {
         return;
@@ -2169,8 +2191,16 @@
 
         """<a name="$c.anchor"></a>""";
         """<div class="commentbox$partialcomment" id="$c.dom_id" style="margin-$*userpic_position: ${indent}px">\n""";
-        if ( $c.full )
+        if ($c.spam and not $p.showspam and (size $c.replies) > 0)
         {
+            """<strong>$*text_spam_comment</strong>""";
+        }
+        elseif ($c.spam and not $p.showspam and (size $c.replies) < 1)
+        {
+            # spam comment w/o children
+        }
+        elseif ( $c.full )
+        {
             $this->print_comment( $c );
         }
         else

Modified: trunk/bin/upgrading/s2layers/gradient/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/gradient/layout.s2	2011-02-24 04:53:21 UTC (rev 10101)
+++ trunk/bin/upgrading/s2layers/gradient/layout.s2	2011-02-24 07:31:25 UTC (rev 10102)
@@ -360,6 +360,8 @@
    set text_multiform_des = "Alter selected comments:";
    set text_multiform_btn = "Submit";
    set text_tags_description = "Topics List";
+   property use text_showspam;
+   property use text_hidespam;
 }
 
 propgroup header = "Header";
@@ -1449,6 +1451,7 @@
 }
 
 function Page::print_entry (Entry e){
+   var Page p = get_page();
    lay_content_box_top();
    $this->lay_entrymeta($e);
    $e->print_text();
@@ -1476,6 +1479,17 @@
          $link->print_raw();
       }
    }
+
+   var string comments_showspam = "";
+   if ($e.comments.count > 0 and not $e.comments.locked) {
+      if ($p.showspam) {
+         $comments_showspam = """<a href=\"$e.permalink_url\">$*text_hidespam</a></span> """;
+      } else {
+         $comments_showspam = """<a href=\"$e.permalink_url?mode=showspam\">$*text_showspam</a></span> """;
+      }
+   }
+   if ($p.view == "entry") {print safe "$comments_showspam $*comment_link_divider ";}
+
    $e.comments->print();
    """</div>""";
    lay_content_box_bottom();

Tags: fiskus_boulder, ljcom, s2
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