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

[ljcom] r10443: LJSUP-8563: new thread expander, Tranqui...

Committer: mchervonniy
LJSUP-8563: new thread expander, Tranquility II
U   trunk/bin/upgrading/s2layers/tranquilityii/layout.s2
Modified: trunk/bin/upgrading/s2layers/tranquilityii/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/tranquilityii/layout.s2	2011-04-26 07:59:52 UTC (rev 10442)
+++ trunk/bin/upgrading/s2layers/tranquilityii/layout.s2	2011-04-26 10:20:37 UTC (rev 10443)
@@ -1289,12 +1289,56 @@
     }
 }
 
+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;">""";
+    """<a name="$c.anchor"></a>""";
+
+    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 (not $c.can_marked_as_spam) and (size($c.replies) > 0)) {
+        """<strong>$*text_spam_comment</strong>""";
+    } elseif ($c.full) {
+        $this->print_comment_full($c);
+    } else {
+        $this->print_comment_partial($c);
+    }
+
+    $c->print_reply_container();
+
+    """</div>""";
+}
+
+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";
+    var Link expand_link = $c->get_link("expand_comments");
+    if ($c.thread_url != "" and defined $expand_link) {
+        $c->print_expand_collapse_links();
+    }
+}
+
 # -------------------------------
 # print comment
 # -------------------------------
-function EntryPage::print_comment ( Comment c )
+function EntryPage::print_comment_full ( Comment c )
 {
+    var Page p = get_page();
     var string comment_class = "";
     if ( $c.screened ) {
         $comment_class = "ind-comment-screened";
@@ -1360,7 +1404,7 @@
             var Link link; 
             $link = $c->get_link("unscreen_to_reply");
             """<a href="$link.url" title="$link.caption">$link.caption</a>"""; 
-        } else {
+        } elseif ((not $c.spam) or ($p.showspam)) {
             ### showing reply link if comment not screened
 if (not $.entry.comments.locked) {
 			$c->print_reply_link({ "linktext" => $*text_comment_reply });
@@ -1369,25 +1413,20 @@
 
         
         if ( $c.parent_url != "" ) {
-if (not $.entry.comments.locked) {
-			print safe " | ";
-}
-			print safe "<a href=\"$c.parent_url\" title=\"$*text_comment_parent\">$*text_comment_parent</a>";
-		}
-        if ( $c.thread_url != "" ) {
-if (not $.entry.comments.locked) {
-			print safe " | ";
-} elseif ($c.parent_url != "") {
-			print safe " | ";
-}
-            print safe "<a href=\"$c.thread_url\" title=\"$*text_comment_thread\">$*text_comment_thread</a>";
-            var Link expand_link = $c->get_link("expand_comments");
-            if (defined $expand_link) {
-                " | " + $c->expand_link();
+            if (not $.entry.comments.locked) {
+                print safe " | ";
             }
+            print safe "<a href=\"$c.parent_url\" title=\"$*text_comment_parent\">$*text_comment_parent</a>";
         }
+        if (($c.thread_url != "") and (not $c.spam)) {
+            if ((not $.entry.comments.locked) or ($c.parent_url != "")) {
+                print safe " | ";
+            }
+            print safe "<a href=\"$c.thread_url\" title=\"$*text_comment_thread\">$*text_comment_thread</a>";
+            $c->print_expand_collapse_links();
+        }
         print "</h4>";
-                $c->print_reply_container();
+                # $c->print_reply_container();
     print "</div>\n\n";
 }
 

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