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

[ljcom] r10399: LJSUP-8551: new thread expander

Committer: mchervonniy
LJSUP-8551: new thread expander
U   trunk/bin/upgrading/s2layers/voxhtml/layout.s2
Modified: trunk/bin/upgrading/s2layers/voxhtml/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/voxhtml/layout.s2	2011-04-19 09:30:19 UTC (rev 10398)
+++ trunk/bin/upgrading/s2layers/voxhtml/layout.s2	2011-04-19 09:45:11 UTC (rev 10399)
@@ -2000,11 +2000,12 @@
         $.comment_pages->print();
     }
 
-    foreach var Comment c ($.comments) {
-        """<div id="expand$c.talkid" style="margin-left: 0px">""";
-        $this->print_comment($c);
-        """</div>""";
-    }
+    #foreach var Comment c ($.comments) {
+    #    """<div id="expand$c.talkid" style="margin-left: 0px">""";
+    #    $this->print_comment($c);
+    #    """</div>""";
+    #}
+        $this->print_comments($.comments);
 
     if(not $.comment_pages.all_subitems_displayed) {
         $.comment_pages->print();
@@ -2320,9 +2321,83 @@
     return false;
 }
 
-function EntryPage::print_comment(Comment e) {
+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;
+
+    var string indent = ($c.depth - 1) * 25 + "px";
+    var string id     = $c.dom_id ? " id=\"$c.dom_id\"" : "";
+
+    if ($c.screened and not $c.full and not viewer_is_owner()) {
+        """<div $id style="margin-left: $indent"><strong>$*text_comment_screened</strong></div>""";
+    } elseif ($c.deleted) {
+        """<strong><div $id style="margin-left: $indent">$*text_comment_deleted</strong></div>""";
+    } elseif (($c.spam) and (not $p.showspam) and (size($c.replies) > 0)) {
+        """<strong><div $id style="margin-left: $indent">$*text_spam_comment</strong></div>""";
+    } elseif ($c.full) {
+        $this->print_comment_full($c);
+    } else {
+        $this->print_comment_partial($c);
+    }
+    $c->print_reply_container();
+}
+
+function EntryPage::print_comment_partial (Comment e) {
+    var Page p = get_page();
     var string barc = "comment-" + ($e.depth % 2 ? "odd" : "even");
+    var string indent = ($e.depth - 1) * 25 + "px";
+    var string id     = $e.dom_id ? " id=\"$e.dom_id\"" : "";
+
+     """
+     <a name='$e.anchor'></a>
+     <div $id style="margin-left: $indent">
+       <div class="collapsed-comment comment-inner">
+         <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> """;
+     }
+ 
+     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);
+ 
+     #var Link expand_link = $e->get_link("expand_comments");
+     #if ($e.thread_url != "" and defined $expand_link) {
+     #      " " + $e->expand_link({ "class" => "collapsed-comment-link" });
+     #}
+        $e->print_expand_collapse_links();
+ 
+     """
+         </div>
+       </div>
+     </div>\n""";
+ 
+     #if (size($e.replies) > 0) {
+     #    foreach var Comment c ($e.replies) {
+     #        $this->print_comment($c);
+     #    }
+     #}
+}
+
+
+function EntryPage::print_comment_full(Comment e) {
+    var Page p = get_page();
+    var string barc = "comment-" + ($e.depth % 2 ? "odd" : "even");
     var string screenbarc = "";
     var string borderwidth = "";
     if ($e.screened) {
@@ -2331,47 +2406,47 @@
     var string indent = ($e.depth - 1) * 25 + "px";
     var string id     = $e.dom_id ? " id=\"$e.dom_id\"" : "";
 
-    if ((not $e.full) or ($e.full and $e.spam and not $p.showspam)) {
-        # Collapsed mode
+#     if ((not $e.full) or ($e.full and $e.spam and not $p.showspam)) {
+#         # Collapsed mode
+# 
+#         """
+#         <a name='$e.anchor'></a>
+#         <div $id style="margin-left: $indent">
+#           <div class="collapsed-comment comment-inner">
+#             <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> """;
+#         }
+# 
+#         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);
+# 
+#         var Link expand_link = $e->get_link("expand_comments");
+#         if ($e.thread_url != "" and defined $expand_link) {
+# 	      " " + $e->expand_link({ "class" => "collapsed-comment-link" });
+#         }
+# 
+#         """
+#             </div>
+#           </div>
+#         </div>\n""";
+# 
+#         if (size($e.replies) > 0) {
+#             foreach var Comment c ($e.replies) {
+#                 $this->print_comment($c);
+#             }
+#         }
+# 
+# 
+#         return;
+#     }
 
-        """
-        <a name='$e.anchor'></a>
-        <div $id style="margin-left: $indent">
-          <div class="collapsed-comment comment-inner">
-            <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> """;
-        }
-
-        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);
-
-        var Link expand_link = $e->get_link("expand_comments");
-        if ($e.thread_url != "" and defined $expand_link) {
-	      " " + $e->expand_link({ "class" => "collapsed-comment-link" });
-        }
-
-        """
-            </div>
-          </div>
-        </div>\n""";
-
-        if (size($e.replies) > 0) {
-            foreach var Comment c ($e.replies) {
-                $this->print_comment($c);
-            }
-        }
-
-
-        return;
-    }
-
     """<a name='$e.anchor'></a>
        <div$id style="margin-left: $indent;$screenbarc">
        <div class="comment-inner $barc comment">
@@ -2428,10 +2503,11 @@
     if ($e.parent_url) { print """ $sep <a href="$e.parent_url">$*text_comment_parent</a>"""; }
     if ($e.thread_url) {
         print """ $sep <a href="$e.thread_url">$*text_comment_thread</a>""";
-        var Link expand_link = $e->get_link("expand_comments");
-        if (defined $expand_link) {
-            " $sep " + $e->expand_link();
-        }
+        #var Link expand_link = $e->get_link("expand_comments");
+        #if (defined $expand_link) {
+        #    " $sep " + $e->expand_link();
+        #}
+        $e->print_expand_collapse_links();
     }
 
     $e->print_linkbar();
@@ -2446,11 +2522,11 @@
         $e->print_reply_container({"class" => "quickreply"});
     }
 
-    if (size($e.replies) > 0) {
-        foreach var Comment c ($e.replies) {
-            $this->print_comment($c);
-        }
-    }
+    #if (size($e.replies) > 0) {
+    #    foreach var Comment c ($e.replies) {
+    #        $this->print_comment($c);
+    #    }
+    #}
 }
 
 

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