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

Marius Gedminas mgedmin@codeworks.lt
Wed, 16 Apr 2003 07:32:59 -0400


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

Modified Files:
	configure.zcml container.pt message.py message_part.pt 
Log Message:
z3checkins:
- separated normal (checkins.html) and sidebar (checkins-sidebar.html) views;
- cleaned up templates a bit;
- introduced view/icon in message views; this will make adding new checkin
  categories easier.


=== Products3/z3checkins/configure.zcml 1.3 => 1.4 ===
--- Products3/z3checkins/configure.zcml:1.3	Tue Apr  8 13:35:10 2003
+++ Products3/z3checkins/configure.zcml	Wed Apr 16 07:32:58 2003
@@ -71,6 +71,14 @@
 
   <browser:page
     for=".interfaces.ICheckinMessage"
+    name="html-sidebar"
+    template="message_part.pt"
+    usage="sidebar"
+    class=".message.CheckinMessageView"
+    permission="zope.View" />
+
+  <browser:page
+    for=".interfaces.ICheckinMessage"
     name="index.html"
     template="message.pt"
     class=".message.CheckinMessageView"
@@ -94,6 +102,14 @@
     for="zope.app.interfaces.container.IContainer"
     name="checkins.html"
     template="container.pt"
+    class=".message.ContainerView"
+    permission="zope.View" />
+
+  <browser:page
+    for="zope.app.interfaces.container.IContainer"
+    name="checkins-sidebar.html"
+    template="container.pt"
+    usage="sidebar"
     class=".message.ContainerView"
     permission="zope.View" />
 


=== Products3/z3checkins/container.pt 1.3 => 1.4 ===
--- Products3/z3checkins/container.pt:1.3	Tue Apr  8 13:35:10 2003
+++ Products3/z3checkins/container.pt	Wed Apr 16 07:32:58 2003
@@ -16,35 +16,39 @@
   img.icon { float: right; padding: 0ex; margin: 2px; border: none; }
 </style>
 </head>
-<body>
+<body tal:define="sidebar usage/sidebar;
+                  target python: sidebar and '_content' or None;
+                  msg_view python: sidebar and '@@html-sidebar' or '@@html'">
 <h1>Zope 3 Checkins</h1>
 
 <div class="toolbar">
-<tal:block tal:replace='structure string:
+<tal:block tal:condition="not: usage/sidebar" tal:replace='structure string:
 <script language="JavaScript" type="text/javascript">
 <!--
 if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
-  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>");
+  url = "${context/@@absolute_url}/@@checkins-sidebar.html";
+  document.write("&lt;a href=\"javascript:window.sidebar.addPanel(&#39;Zope 3 Checkins&#39;, &#39;" + url + "&#39;, &#39;&#39;);\">Add to sidebar&lt;/a>");
 }
 //-->
 </script>
 '/>
-<a target="_content" href="http://mail.zope.org/pipermail/zope3-checkins/">List archives</a>
+<a tal:attributes="target target"
+   href="http://mail.zope.org/pipermail/zope3-checkins/">List archives</a>
 <a href="javascript:window.location.reload()">Refresh</a>
 </div>
 
 <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>
+   tal:attributes="href string:${request/URL}?start=${prev}">Previous 20</a>
 </div>
 
-<div tal:repeat="item view/checkins" tal:replace="structure item/@@html"/>
+<div tal:repeat="item view/checkins" tal:replace="structure item/?msg_view"/>
 
 <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>
+   tal:attributes="href string:${request/URL}?start=${next}">Next 20</a>
 </div>
 
 </body>


=== Products3/z3checkins/message.py 1.5 => 1.6 ===
--- Products3/z3checkins/message.py:1.5	Tue Apr  8 13:35:10 2003
+++ Products3/z3checkins/message.py	Wed Apr 16 07:32:58 2003
@@ -307,10 +307,17 @@
         else:
             return None
 
-    def core(self):
-        """Returns True if this is a checkin to Zope 3 core, False if it is in
-        a different part of the repository."""
-        return self.context.directory.startswith("Zope3")
+    def icon(self):
+        """Returns a mapping describing an icon for this checkin.  The mapping
+        contains 'src', 'alt' and 'title' attributes."""
+        if self.context.directory.startswith("Zope3"):
+            return {'src': '++resource++zope3.png',
+                    'alt': 'Z3',
+                    'title': 'Zope 3 core'}
+        else:
+            return {'src': '++resource++product.png',
+                    'alt': 'Product',
+                    'title': 'Zope 3 product'}
 
     def body(self):
         """Colorizes checkin message body."""


=== Products3/z3checkins/message_part.pt 1.5 => 1.6 ===
--- Products3/z3checkins/message_part.pt:1.5	Tue Apr 15 09:23:16 2003
+++ Products3/z3checkins/message_part.pt	Wed Apr 16 07:32:58 2003
@@ -1,12 +1,12 @@
-<div class="message">
-<img tal:condition="view/core"
-     class="icon" src="++resource++zope3.png" alt="Z3" title="Zope 3 core"/>
-<img tal:condition="not: view/core"
-     class="icon" src="++resource++product.png" alt="Product" title="Zope 3 product"/>
+<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 target="_content" class="title" tal:attributes="href context/@@absolute_url">
+<a class="title" tal:attributes="href context/@@absolute_url; target target">
   <span class="date" tal:content="context/date/@@isodatetime" />:
   <span class="author" tal:content="context/author_name" />
   - <span class="subject" tal:content="context/subject" />