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

[ljcom] r10436: LJSUP-8563: new thread expander, Unearth...

Committer: mchervonniy
LJSUP-8563: new thread expander, Unearthed
U   trunk/bin/upgrading/s2layers/unearthed/layout.s2
Modified: trunk/bin/upgrading/s2layers/unearthed/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/unearthed/layout.s2	2011-04-26 04:02:03 UTC (rev 10435)
+++ trunk/bin/upgrading/s2layers/unearthed/layout.s2	2011-04-26 04:19:20 UTC (rev 10436)
@@ -1360,8 +1360,51 @@
     }
 
 }
-function EntryPage::print_comment(Comment c)
+
+function EntryPage::print_comments (Comment[] cs) {
+    var Page p = get_page();
+    if (size $cs == 0) { return; }
+    foreach var Comment c ($cs) {
+        $this->print_comment($c);
+        $this->print_comments($c.replies);
+    }
+}
+
+function EntryPage::print_comment (Comment c) {
+    var Page p = get_page();
+    var int indent = ($c.depth - 1) * 25;
+
+    """<div id="$c.dom_id" style="margin-left:${indent}px;">""";
+
+    if ($c.screened and not $c.full and not viewer_is_owner()) {
+        """<strong>$*text_comment_screened</strong>""";
+    } elseif ($c.deleted) {
+        """<strong>$*text_comment_deleted</strong>""";
+    } elseif (($c.spam) and (not $p.showspam) and (size($c.replies) > 0)) {
+        """<strong>$*text_spam_comment</strong>""";
+    } elseif ($c.full) {
+        $this->print_comment_full($c);
+    } else {
+        $this->print_comment_partial($c);
+    }
+
+    "</div>";
+
+    $c->print_reply_container();
+}
+
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
+    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
+    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
+    if ($c.thread_url != "") {
+        $c->print_expand_collapse_links();
+    }
+}
+
+function EntryPage::print_comment_full(Comment c)
 {
+    var Page p = get_page();
     var string class = "";
     if ($c.screened) {
         $class = "CommentBarScreened";
@@ -1416,32 +1459,31 @@
     $c->print_text();
     println """</div>""";
     println """<div style="margin-top: 3px; font-size: smaller; height: 100%;"> """;
-    if ($c.frozen) {
-        println """($*text_comment_frozen) """;
-    } else {
-        "("; 
-        ###$c->print_reply_link({"linktext" => $*text_comment_reply}); 
-        if($c.screened == true) {
-            ### if comment screened - show link for unscreen
-            var Link link; 
-            $link = $c->get_link("unscreen_to_reply");
-            """<a href="$link.url" title="$link.caption">$link.caption</a>"""; 
+    if ((not $c.spam) or ($p.showspam)) {
+        if ($c.frozen) {
+            println """($*text_comment_frozen) """;
         } else {
-            ### showing reply link if comment not screened
-            $c->print_reply_link({ "linktext" => $*text_comment_reply });
+            "("; 
+            ###$c->print_reply_link({"linktext" => $*text_comment_reply}); 
+            if($c.screened == true) {
+                ### if comment screened - show link for unscreen
+                var Link link; 
+                $link = $c->get_link("unscreen_to_reply");
+                """<a href="$link.url" title="$link.caption">$link.caption</a>"""; 
+            } else {
+                ### showing reply link if comment not screened
+                $c->print_reply_link({ "linktext" => $*text_comment_reply });
+            }
+     
+            ") ";
         }
- 
-        ") ";
     }
     if ($c.parent_url != "") { println """(<a href="$c.parent_url">$*text_comment_parent</a>) """; }
-    if ($c.thread_url != "") {
+    if ($c.thread_url != "" and (not $c.spam)) {
         println """(<a href="$c.thread_url">$*text_comment_thread</a>) """;
-        var Link expand_link = $c->get_link("expand_comments");
-        if (defined $expand_link) {
-            "(" + $c->expand_link() + ") ";
-        }
+        $c->print_expand_collapse_links();
     }
-    $c->print_reply_container();
+    # $c->print_reply_container();
     println "</div>";
 }
 

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