[Zope-PTK] Patch to make discussion threads appear in content display

Dan L. Pierson dan@sol.control.com
Tue, 9 May 2000 15:19:06 -0400 (EDT)


I've been playing with the discussion threads in the PTK.  One of the
first things that disturbed me is that nothing very visible happens
when items are replied to.  As a first cut, I decided to make links to 
replies appear at the end of each item that has them.

A patch to do that follows.  I planned to submit this via the tracker
but couldn't figure out how to login to it, even though I was
currently logged into the Zope site.  Also, the patch adds two files
to the subdirectory 'dtml'.  I've appended these separately -- is
there any way to convince cvs diff to include new files in the diff?

Comments?

? dtml/showThreads.dtml
? dtml/viewThreadsAtBottom.dtml
Index: Discussions.py
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/Discussions.py,v
retrieving revision 1.4
diff -c -r1.4 Discussions.py
*** Discussions.py	2000/04/09 13:12:17	1.4
--- Discussions.py	2000/05/09 19:46:22
***************
*** 19,24 ****
--- 19,26 ----
          )
  
      threadView = HTMLFile('dtml/threadView',globals())
+     showThreads = HTMLFile('dtml/showThreads', globals())
+     viewThreadsAtBottom = HTMLFile('dtml/viewThreadsAtBottom', globals())
      replyForm = HTMLFile('dtml/replyForm', globals())
      replyPreview = HTMLFile('dtml/replyPreview', globals())
      
Index: dtml/discussionView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/discussionView.dtml,v
retrieving revision 1.1
diff -c -r1.1 discussionView.dtml
*** discussionView.dtml	2000/04/04 22:18:39	1.1
--- discussionView.dtml	2000/05/09 19:46:22
***************
*** 4,7 ****
--- 4,9 ----
  
  <dtml-var cooked_text>
  
+ <dtml-var viewThreadsAtBottom>
+ 
  <dtml-var standard_html_footer>
Index: dtml/documentView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/documentView.dtml,v
retrieving revision 1.1
diff -c -r1.1 documentView.dtml
*** documentView.dtml	2000/03/09 16:37:20	1.1
--- documentView.dtml	2000/05/09 19:46:22
***************
*** 4,7 ****
--- 4,9 ----
  
  <dtml-var cooked_text>
  
+ <dtml-var viewThreadsAtBottom>
+ 
  <dtml-var standard_html_footer>
Index: dtml/fileView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/fileView.dtml,v
retrieving revision 1.1
diff -c -r1.1 fileView.dtml
*** fileView.dtml	2000/03/08 15:34:03	1.1
--- fileView.dtml	2000/05/09 19:46:22
***************
*** 10,13 ****
  
  <a href="download">Download &dtml-title;</a>
  
! <dtml-var standard_html_footer>
\ No newline at end of file
--- 10,16 ----
  
  <a href="download">Download &dtml-title;</a>
  
! <dtml-var viewThreadsAtBottom>
! 
! <dtml-var standard_html_footer>
! 
Index: dtml/imageView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/imageView.dtml,v
retrieving revision 1.1
diff -c -r1.1 imageView.dtml
*** imageView.dtml	2000/03/16 03:20:47	1.1
--- imageView.dtml	2000/05/09 19:46:22
***************
*** 2,5 ****
--- 2,7 ----
  
  <dtml-var tag>
  
+ <dtml-var viewThreadsAtBottom>
+ 
  <dtml-var standard_html_footer>
Index: dtml/linkView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/linkView.dtml,v
retrieving revision 1.1
diff -c -r1.1 linkView.dtml
*** linkView.dtml	2000/03/09 16:37:20	1.1
--- linkView.dtml	2000/05/09 19:46:22
***************
*** 8,11 ****
--- 8,13 ----
  
  <dtml-var cooked_text>
  
+ <dtml-var viewThreadsAtBottom>
+ 
  <dtml-var standard_html_footer>
Index: dtml/newsView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/newsView.dtml,v
retrieving revision 1.1
diff -c -r1.1 newsView.dtml
*** newsView.dtml	2000/03/09 16:37:20	1.1
--- newsView.dtml	2000/05/09 19:46:22
***************
*** 4,7 ****
--- 4,9 ----
  
  <dtml-var cooked_text>
  
+ <dtml-var viewThreadsAtBottom>
+ 
  <dtml-var standard_html_footer>
Index: dtml/threadView.dtml
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/dtml/threadView.dtml,v
retrieving revision 1.1
diff -c -r1.1 threadView.dtml
*** threadView.dtml	2000/04/04 22:18:39	1.1
--- threadView.dtml	2000/05/09 19:46:22
***************
*** 2,21 ****
  
  <h3>&dtml-title;</h3>
  
! <dtml-if "_.hasattr(this(), 'parentsInThread') and parentsInThread(1)">
!  Above in thread:
!  <dtml-if "_.len(this().parentsInThread()) > 5">... :</dtml-if>
!  <dtml-in "parentsInThread(5)">
!   <a href="&dtml-absolute_url;">&dtml-title;</a>
!   <dtml-unless sequence-end>:</dtml-unless>
!  </dtml-in>
! </dtml-if>
! 
! <dtml-tree branches="getReplies">
!  <a href="&dtml-absolute_url;"><img border=0 src="<dtml-var SCRIPT_NAME><dtml-var icon>"></a>
!  <a href="&dtml-absolute_url;">&dtml-title;</a>,
!  by <dtml-var Creator>
!  on <dtml-var Date fmt="Date">
! </dtml-tree>
  
  <dtml-var standard_html_footer>
--- 2,7 ----
  
  <h3>&dtml-title;</h3>
  
! <dtml-var showThreads>
  
  <dtml-var standard_html_footer>


=============== showThreads.dtml ==================================
<dtml-if "_.hasattr(this(), 'parentsInThread') and parentsInThread(1)">
 Above in thread:
 <dtml-if "_.len(this().parentsInThread()) > 5">... :</dtml-if>
 <dtml-in "parentsInThread(5)">
  <a href="&dtml-absolute_url;">&dtml-title;</a>
  <dtml-unless sequence-end>:</dtml-unless>
 </dtml-in>
</dtml-if>

<dtml-tree branches="getReplies">
 <a href="&dtml-absolute_url;"><img border=0 src="<dtml-var SCRIPT_NAME><dtml-var icon>"></a>
 <a href="&dtml-absolute_url;">&dtml-title;</a>,
 by <dtml-var Creator>
 on <dtml-var Date fmt="Date">
</dtml-tree>

=============== viewThreadsAtBottom.dtml ==========================
<dtml-if "getReplyResults()">
  <p>Comments:</p>

  <dtml-var showThreads>
</dtml-if>