[Zope3-checkins] CVS: Products3/z3checkins - TODO:1.2 container.pt:1.2 message.pt:1.3 message.py:1.4 message_part.pt:1.2

Marius Gedminas mgedmin@codeworks.lt
Thu, 3 Apr 2003 07:49:19 -0500


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

Modified Files:
	TODO container.pt message.pt message.py message_part.pt 
Log Message:
Links for next/previous 20 items in the sidebar.
Message headers are now wrapped.
Got rid of divs inside anchors, active link changes background.


=== Products3/z3checkins/TODO 1.1.1.1 => 1.2 ===
--- Products3/z3checkins/TODO:1.1.1.1	Thu Apr  3 03:19:59 2003
+++ Products3/z3checkins/TODO	Thu Apr  3 07:48:48 2003
@@ -1,7 +1,4 @@
-- Add next/previous links (<link> inside <head>) for messages
-- Show tabs and trailing whitespace (vim-like)
-- Next/prev 20 items in the sidebar
 - Links to the CVS
-- Filter by branch
+- Filter by branch or at least display branches in the sidebar
 - Maybe remember the last-seen message in a cookie
 - Is storing all the messages in a single folder scalable enough?


=== Products3/z3checkins/container.pt 1.1.1.1 => 1.2 ===
--- Products3/z3checkins/container.pt:1.1.1.1	Thu Apr  3 03:19:59 2003
+++ Products3/z3checkins/container.pt	Thu Apr  3 07:48:48 2003
@@ -5,27 +5,46 @@
   * { font-size: small; }
   h1 { font-size: medium; margin-bottom: 0.5ex; }
   div.toolbar { font-size: xx-small; margin-left: 1em; margin-bottom: 1.5em; }
-  div.toolbar > div { width: 100%; }
+  div.toolbar > a { display: block; width: 100%; }
+  div.navigation { margin-top: 1em; }
+  div.navigation > a { display: block; width: 100%; text-align: right; }
   .message { margin-top: 1ex; }
   .description { font-size: small; margin-left: 1em; }
   .author { font-weight: bold; }
+  a.title { display: block; width: 100%; }
+  a:hover { background: #e0e6ff; }
 </style>
 </head>
 <body>
 <h1>Zope 3 Checkins</h1>
+
 <div class="toolbar">
 <tal:block tal:replace='structure string:
 <script language="JavaScript" type="text/javascript">
 <!--
 if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
-  document.write("&lt;div>&lt;a href=\"javascript:window.sidebar.addPanel(&#39;Zope 3 Checkins&#39;, &#39;${context/@@absolute_url}/@@checkins.html&#39;, &#39;&#39;);\">Add to sidebar&lt;/a>&lt;/div>");
+  document.write("&lt;a href=\"javascript:window.sidebar.addPanel(&#39;Zope 3 Checkins&#39;, &#39;${context/@@absolute_url}/@@checkins.html&#39;, &#39;&#39;);\">Add to sidebar&lt;/a>");
 }
 //-->
 </script>
 '/>
-<div><a target="_content" href="http://mail.zope.org/pipermail/zope3-checkins/">List archives</a></div>
-<div><a href="javascript:window.location.reload()">Refresh</a></div>
+<a target="_content" href="http://mail.zope.org/pipermail/zope3-checkins/">List archives</a>
+<a href="javascript:window.location.reload()">Refresh</a>
 </div>
-<div tal:repeat="item view/last_checkins" tal:replace="structure item/@@html"/>
+
+<div class="navigation">
+<a tal:define="prev python:int(request.get('start', '0')) - 20"
+   tal:condition="python: prev >= 0"
+   tal:attributes="href string:${context/@@absolute_url}/@@checkins.html?start=${prev}">Previous 20</a>
+</div>
+
+<div tal:repeat="item view/checkins" tal:replace="structure item/@@html"/>
+
+<div class="navigation">
+<a tal:define="next python:int(request.get('start', '0')) + 20"
+   tal:condition="python: next < view.count()"
+   tal:attributes="href string:${context/@@absolute_url}/@@checkins.html?start=${next}">Next 20</a>
+</div>
+
 </body>
 </html>


=== Products3/z3checkins/message.pt 1.2 => 1.3 ===
--- Products3/z3checkins/message.pt:1.2	Thu Apr  3 07:08:24 2003
+++ Products3/z3checkins/message.pt	Thu Apr  3 07:48:48 2003
@@ -11,6 +11,9 @@
         tal:attributes="href last/@@absolute_url" />
   <style type="text/css">
     body { color: black; background: white; }
+    .headers { margin-bottom: 2em; }
+    .headers p { margin: 0ex; text-indent: -6em; padding-left: 6em;
+                font-family: monospace; }
     .header { font-weight: bold; }
     div.body > pre { margin: 0ex; }
     div.log { border: 1px solid gray; padding: 0.5ex;
@@ -29,11 +32,11 @@
   </style>
 </head>
 <body>
-<pre class="headers">
-<span class="header">From:</span> <span class="value" tal:content="context/author" />
-<span class="header">Date:</span> <span class="value" tal:content="context/date/@@rfc822" />
-<span class="header">Subject:</span> <span class="value" tal:content="string:[Zope3-checkins] CVS: ${context/subject}" />
-</pre>
+<div class="headers">
+<p><span class="header">From:</span> <span class="value" tal:content="context/author" /></p>
+<p><span class="header">Date:</span> <span class="value" tal:content="context/date/@@rfc822" /></p>
+<p><span class="header">Subject:</span> <span class="value" tal:content="string:[Zope3-checkins] CVS: ${context/subject}" /></p>
+</div>
 <div class="body" tal:content="structure view/body" />
 </body>
 </html>


=== Products3/z3checkins/message.py 1.3 => 1.4 ===
--- Products3/z3checkins/message.py:1.3	Thu Apr  3 07:08:24 2003
+++ Products3/z3checkins/message.py	Thu Apr  3 07:48:48 2003
@@ -223,16 +223,25 @@
 class ContainerView:
     """View mixin for locating checkin messages in a container."""
 
-    def last_checkins(self, how_many=20):
-        """Returns a list of the last 'how_many' checkin messages in
-        self.context, newest first.
+    def checkins(self, start=None, size=None):
+        """Returns a list of the last 'size' checkin messages in
+        self.context, newest first, skipping the first 'start' messages.
         """
+        if start is None: start = int(self.request.get('start', 0))
+        if size is None: size = int(self.request.get('size', 20))
         if not hasattr(self, '_archive'):
             self._archive = getAdapter(self.context, ICheckinMessageArchive)
-        items = self._archive[-how_many:]
+        idx = len(self._archive) - start
+        items = self._archive[max(0, idx-size):idx]
         items = removeAllProxies(items) # needed for reverse
         items.reverse()
         return items
+
+    def count(self):
+        """Returns the number of checkin messages in the archive."""
+        if not hasattr(self, '_archive'):
+            self._archive = getAdapter(self.context, ICheckinMessageArchive)
+        return len(self._archive)
 
 
 class CheckinMessageView:


=== Products3/z3checkins/message_part.pt 1.1.1.1 => 1.2 ===
--- Products3/z3checkins/message_part.pt:1.1.1.1	Thu Apr  3 03:19:59 2003
+++ Products3/z3checkins/message_part.pt	Thu Apr  3 07:48:48 2003
@@ -1,8 +1,8 @@
 <div class="message">
-<a target="_content" tal:attributes="href context/@@absolute_url"><div class="title">
+<a target="_content" class="title" tal:attributes="href context/@@absolute_url">
   <span class="date" tal:content="context/date/@@isodatetime" />:
   <span class="author" tal:content="context/author_name" />
   - <span class="subject" tal:content="context/subject" />
-</div></a>
+</a>
 <div class="description" tal:content="context/log_message" />
 </div>