[Zope3-checkins] CVS: Products3/z3checkins - TODO:1.6 configure.zcml:1.6 container.pt:1.7 message.py:1.9 message_part.pt:1.7

Marius Gedminas mgedmin@codeworks.lt
Fri, 18 Apr 2003 04:31:06 -0400


Update of /cvs-repository/Products3/z3checkins
In directory cvs.zope.org:/tmp/cvs-serv13826

Modified Files:
	TODO configure.zcml container.pt message.py message_part.pt 
Log Message:
z3checkins:
- Detect several checkins with the same checkin comment and display "Same as
  previous" instead of repeating the comment for all of them except for the
  first one.
- Moved floating icons inside <a>
- Added a TODO item for displaying times in the user's timezone


=== Products3/z3checkins/TODO 1.5 => 1.6 ===
--- Products3/z3checkins/TODO:1.5	Wed Apr 16 18:01:48 2003
+++ Products3/z3checkins/TODO	Fri Apr 18 04:30:35 2003
@@ -2,12 +2,12 @@
 
 - Highlight branch tags in message body
 - Detect URLs in checkin comments and make those into <a> elements
-- Detect several checkins with the same checkin comment and group them in some
-  way (e.g. display <em>(same checkin)</em> instead of repeating the comment)
 - Include all messages sent to zope3-checkins, not just checkin messages
 
 I'm not sure I'll find time for these:
 
+- Show checkin times in the user's timezone instead of server's (this probably
+  needs some configuration page and cookies)
 - Replace newlines with <br/> elements in checkin messages in message_part.pt
 - Shorten descriptions in message_part.pt to first 100 chars (words? sentences?
   lines?)


=== Products3/z3checkins/configure.zcml 1.5 => 1.6 ===
--- Products3/z3checkins/configure.zcml:1.5	Wed Apr 16 18:01:48 2003
+++ Products3/z3checkins/configure.zcml	Fri Apr 18 04:30:35 2003
@@ -84,13 +84,6 @@
     permission="zope.View" />
 
   <browser:page
-    for=".interfaces.ICheckinBookmark"
-    name="html-sidebar"
-    template="bookmark.pt"
-    usage="sidebar"
-    permission="zope.View" />
-
-  <browser:page
     for=".interfaces.ICheckinMessage"
     name="index.html"
     template="message.pt"


=== Products3/z3checkins/container.pt 1.6 => 1.7 ===
--- Products3/z3checkins/container.pt:1.6	Wed Apr 16 18:01:48 2003
+++ Products3/z3checkins/container.pt	Fri Apr 18 04:30:35 2003
@@ -10,6 +10,7 @@
   div.navigation > a { display: block; width: 100%; text-align: right; }
   .message { margin-top: 1ex; }
   .description { font-size: small; margin-left: 1em; }
+  .same { color: gray; margin-top: 0.5ex; }
   .author { font-weight: bold; }
   a.title { display: block; width: 100%; }
   a:hover { background: #e0e6ff; }
@@ -20,7 +21,6 @@
 </head>
 <body tal:define="sidebar usage/sidebar;
                   target python: sidebar and '_content' or None;
-                  msg_view python: sidebar and '@@html-sidebar' or '@@html';
                   dummy view/placeBookmark">
 <h1>Zope 3 Checkins</h1>
 
@@ -50,7 +50,7 @@
    tal:attributes="href string:${request/URL}?start=${prev}">Previous 20</a>
 </div>
 
-<div tal:repeat="item view/checkins" tal:replace="structure item/?msg_view"/>
+<div tal:replace="structure view/renderCheckins" />
 
 <div class="navigation">
 <a tal:define="next python:int(request.get('start', '0')) + 20"


=== Products3/z3checkins/message.py 1.8 => 1.9 ===
--- Products3/z3checkins/message.py:1.8	Fri Apr 18 02:57:48 2003
+++ Products3/z3checkins/message.py	Fri Apr 18 04:30:35 2003
@@ -19,6 +19,7 @@
 from zope.proxy.introspection import removeAllProxies
 from zope.proxy.context import getWrapperContainer
 from zope.app.datetimeutils import parseDatetimetz, DateTimeError
+from zope.component import getView
 
 from interfaces import ICheckinMessage, ICheckinMessageParser, FormatError
 from interfaces import ICheckinMessageArchive, ICheckinBookmark
@@ -316,6 +317,21 @@
         # reverse order to present newest checkins first
         items.reverse()
         return items
+
+    def renderCheckins(self, start=None, size=None):
+        """Returns a list of checkins rendered into HTML.  See `checkins` for
+        description of parameters."""
+        usage = self.index.usage
+        html = []
+        previous_message = None
+        for item in self.checkins(start=start, size=size):
+            same_as_previous = item.log_message == previous_message
+            view = getView(item, 'html', self.request)
+            output = view(template_usage=usage,
+                          same_as_previous=same_as_previous)
+            html.append(output)
+            previous_message = item.log_message
+        return "".join(html)
 
     def count(self):
         """Returns the number of checkin messages in the archive."""


=== Products3/z3checkins/message_part.pt 1.6 => 1.7 ===
--- Products3/z3checkins/message_part.pt:1.6	Wed Apr 16 07:32:58 2003
+++ Products3/z3checkins/message_part.pt	Fri Apr 18 04:30:35 2003
@@ -1,15 +1,19 @@
 <div class="message"
      tal:define="target python: path('usage/sidebar') and '_content' or None">
-<img class="icon"
-     tal:define="icon view/icon"
-     tal:attributes="src icon/src; alt icon/alt; title icon/title" />
-<img tal:condition="context/branch"
-     class="icon" src="++resource++branch.png" alt="Branch"
-     tal:attributes="title string:Branch: ${context/branch}"/>
 <a class="title" tal:attributes="href context/@@absolute_url; target target">
+  <img class="icon"
+       tal:define="icon view/icon"
+       tal:attributes="src icon/src; alt icon/alt; title icon/title" />
+  <img tal:condition="context/branch"
+       class="icon" src="++resource++branch.png" alt="Branch"
+       tal:attributes="title string:Branch: ${context/branch}"/>
   <span class="date" tal:content="context/date/@@isodatetime" />:
   <span class="author" tal:content="context/author_name" />
   - <span class="subject" tal:content="context/subject" />
 </a>
-<div class="description" tal:content="context/log_message" />
+<div class="same description" tal:condition="options/same_as_previous">
+(Same as previous)
+</div>
+<div class="description" tal:condition="not:options/same_as_previous"
+     tal:content="context/log_message" />
 </div>