[Zope3-checkins] CVS: Products3/z3checkins - README:1.3
configure.zcml:1.11 container.pt:1.9 message.py:1.16
rss_container.pt:1.4
Marius Gedminas
marius at pov.lt
Wed Sep 17 09:15:36 EDT 2003
Update of /cvs-repository/Products3/z3checkins
In directory cvs.zope.org:/tmp/cvs-serv27285
Modified Files:
README configure.zcml container.pt message.py rss_container.pt
Log Message:
Z3checkins is now configurable via Dublin Core metadata
=== Products3/z3checkins/README 1.2 => 1.3 ===
--- Products3/z3checkins/README:1.2 Wed Apr 16 18:01:48 2003
+++ Products3/z3checkins/README Wed Sep 17 09:15:35 2003
@@ -7,6 +7,10 @@
rule, and then view the latest checkins in your Mozilla sidebar or any news
aggregator that supports RSS, e.g. Nautilus.
+It is also quite usable for other checkin-tracking mailing lists. However
+since there is no single standard on how the messages should be formatted, so
+your mileage may vary.
+
Installation
------------
@@ -17,10 +21,45 @@
<include package='zopeproducts.z3checkins' />
3. Restart Zope 3.
+4. Create a Folder.
+5. Go to the Introspector tab and mark the folder with
+ zopeproducts.z3checkins.ICheckinsFolder marker interface.
+6. Go to the Metadata tab and set the title and description. The description
+ field is somewhat structured:
+
+ - first paragraph is a description used for checkins.rss view
+ - second paragraph is a URL to the traditional mailing list archive.
+ - third paragraph is a list of icon definitions used for checkins to
+ different parts of the source trees. Each line should contain four
+ fields:
+
+ prefix icon-name alt-text title
+
+ prefix is matched against the beginning of the checkin directory (put
+ longer, more specific prefixes first. * is a catch-all prefix, and
+ should be placed last).
+
+ icon-name is a Zope 3 resource name. z3checkins comes with the following
+ icons: zope3.png, product.png, message.png
+
+ alt-text is a short alternate text
+
+ title is a longer description, usually shown in a tooltip
+
+ Paragraphs are separated by double newlines (\r\n\r\n).
+
+ Use the following description for zope3-checkins at zope.org:
+
+ Latest Zope 3 Checkins
+
+ http://mail.zope.org/pipermail/zope3-checkins/
+
+ Zope3 zope3.png Z3 Zope 3 core
+ * product.png Product Zope 3 product
-Now you can create Zope 3 Checkin Messages in Zope 3 folders. In the rest of
-this document I assume Zope 3 is accessible at http://localhost:8080/ and that
-you upload checkin messages to a folder called 'zope3-checkins'.
+Now you can create Checkin Messages in that folder. In the rest of this
+document I assume Zope 3 is accessible at http://localhost:8080/ and that you
+upload checkin messages to a folder called 'zope3-checkins'.
Upload script
@@ -64,7 +103,7 @@
Use the following URL to access last checkins in RSS format:
- http://localhost:8080/zope3-checkins/@@checkins.rss
+ http://localhost:8080/zope3-checkins/checkins.rss
Good luck,
=== Products3/z3checkins/configure.zcml 1.10 => 1.11 ===
--- Products3/z3checkins/configure.zcml:1.10 Tue Sep 9 18:16:33 2003
+++ Products3/z3checkins/configure.zcml Wed Sep 17 09:15:35 2003
@@ -62,7 +62,7 @@
<browser:addform
name="CheckinMessage"
menu="add_content"
- title="Zope 3 Checkin Message"
+ title="Checkin Message"
schema="zope.app.interfaces.content.file.IFile"
fields="data"
label="Upload a checkin message"
=== Products3/z3checkins/container.pt 1.8 => 1.9 ===
--- Products3/z3checkins/container.pt:1.8 Thu Jun 5 08:21:10 2003
+++ Products3/z3checkins/container.pt Wed Sep 17 09:15:35 2003
@@ -1,6 +1,6 @@
<html>
<head>
-<title>Zope 3 Checkins</title>
+<title tal:content="view/title">Zope 3 Checkins</title>
<style type="text/css">
* { font-size: small; }
h1 { font-size: medium; margin-bottom: 0.5ex; }
@@ -25,7 +25,7 @@
start python:int(request.get('start', '0'));
size python:int(request.get('size', '20'));
opt_size python:(size != 20) and '&size=%d' % size or ''">
-<h1>Zope 3 Checkins</h1>
+<h1 tal:replace="view/title">Zope 3 Checkins</h1>
<div class="toolbar"
tal:define="first_batch python:start <= 0">
@@ -34,12 +34,13 @@
<!--
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
url = "${context/@@absolute_url}/@@checkins-sidebar.html";
- document.write("<a href=\"javascript:window.sidebar.addPanel('Zope 3 Checkins', '" + url + "', '');\">Add to sidebar</a>");
+ document.write("<a href=\"javascript:window.sidebar.addPanel('${view/title}', '" + url + "', '');\">Add to sidebar</a>");
}
//-->
</script>
'/>
-<a tal:attributes="target target"
+<a tal:condition="view/archive_url"
+ tal:attributes="target target; href view/archive_url"
href="http://mail.zope.org/pipermail/zope3-checkins/">List archives</a>
<a tal:condition="first_batch"
href="javascript:window.location.reload()">Refresh</a>
=== Products3/z3checkins/message.py 1.15 => 1.16 ===
--- Products3/z3checkins/message.py:1.15 Tue Sep 9 18:16:33 2003
+++ Products3/z3checkins/message.py Wed Sep 17 09:15:35 2003
@@ -25,6 +25,7 @@
from zope.component import getView
from zope.publisher.browser import BrowserView
from zope.app.pagetemplate import ViewPageTemplateFile
+from zope.app.interfaces.dublincore import IZopeDublinCore
from interfaces import IMessage, ICheckinMessage, IBookmark
from interfaces import IMessageParser, IMessageArchive
@@ -164,8 +165,6 @@
implements(IMessageParser)
- _subject_prefix = '[Zope3-checkins] CVS: '
-
def parse(self, input):
if not hasattr(input, 'readline'):
full_text = str(input)
@@ -304,6 +303,44 @@
max_bookmarks = 5
+ def title(self):
+ """Returns the title of this archive.
+
+ Title is obtained from Dublin Core metadata of the folder. If it is
+ empty, "Zope 3 Checkins" is used.
+ """
+ dc = queryAdapter(self.context, IZopeDublinCore)
+ if dc is not None:
+ title = dc.title
+ else:
+ title = ''
+ return title or "Zope 3 Checkins"
+
+ def description(self):
+ """Returns the description of this archive.
+
+ Description text is obtained from the first paragraph of Dublin Core
+ description of the folder.
+ """
+ dc = queryAdapter(self.context, IZopeDublinCore)
+ if dc is not None:
+ description = dc.description.split('\r\n\r\n')
+ if len(description) > 0:
+ return description[0]
+ return description
+
+ def archive_url(self):
+ """Returns the URL for mailing list archives.
+
+ The URL is obtained from the second paragraph of Dublin Core
+ description of the folder.
+ """
+ dc = queryAdapter(self.context, IZopeDublinCore)
+ if dc is not None:
+ description = dc.description.split('\r\n\r\n')
+ if len(description) > 1:
+ return description[1]
+
def bookmarks(self):
"""Returns a list of bookmarks from a cookie. Each bookmark is
expressed as a datetime object.
@@ -459,7 +496,7 @@
contains 'src', 'alt' and 'title' attributes."""
return {'src': '++resource++message.png',
'alt': 'Message',
- 'title': ''}
+ 'title': 'Email message'}
def body(self):
"""Colorizes message body."""
@@ -476,17 +513,47 @@
class CheckinMessageView(MessageView):
"""View mixin for checkin messages."""
+ _subtrees = None
+ def subtrees(self):
+ """Returns a sequence of tuples (prefix, icon, alt, title).
+
+ (icon, alt, title) are the resource name, alt text and tooltip used
+ for any checkin messages that have directory starting with prefix.
+
+ This information is currently taken from Dublin Core metadata
+ description field, third paragraph. Every line in that paragraph
+ defines a subtree, with all fields separated by spaces or tabs.
+ """
+ if self._subtrees is not None:
+ return self._subtrees
+ self._subtrees = []
+ container = getWrapperContainer(self.context)
+ dc = queryAdapter(container, IZopeDublinCore)
+ if dc is None:
+ return self._subtrees
+ description = dc.description.split('\r\n\r\n')
+ if len(description) < 2:
+ return self._subtrees
+ for line in description[2].splitlines():
+ items = line.split(None, 3)
+ if len(items) < 4:
+ continue
+ if items[0] == '*': # catch-all
+ items[0] = ''
+ self._subtrees.append(items)
+ return self._subtrees
+
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'}
+ for prefix, icon, alt, title in self.subtrees():
+ if self.context.directory.startswith(prefix):
+ return {'src': '++resource++%s' % icon,
+ 'alt': alt,
+ 'title': title}
+ return {'src': '++resource++product.png',
+ 'alt': 'Checkin',
+ 'title': 'Checkin'}
def body(self):
"""Colorizes checkin message body."""
=== Products3/z3checkins/rss_container.pt 1.3 => 1.4 ===
--- Products3/z3checkins/rss_container.pt:1.3 Fri Aug 1 05:43:16 2003
+++ Products3/z3checkins/rss_container.pt Wed Sep 17 09:15:35 2003
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<rss version="2.0" xmlns:tal="http://xml.zope.org/namespaces/tal">
<channel tal:define="webmaster context/webmaster_email | nothing">
- <title>Zope 3 Checkins</title>
- <link tal:content="string:${context/@@absolute_url}/@@checkins.html"></link>
- <description>Latest Zope 3 Checkins</description>
+ <title tal:content="view/title">Zope 3 Checkins</title>
+ <link tal:content="string:${context/@@absolute_url}"></link>
+ <description tal:content="view/description" tal:condition="view/description">Latest Zope 3 Checkins</description>
<language>en-us</language>
<docs>http://backend.userland.com/rss</docs>
- <generator>z3-checkins</generator>
+ <generator>z3checkins</generator>
<webMaster tal:condition="webmaster" tal:content="webmaster" />
<item tal:repeat="item view/checkins" tal:replace="structure item/@@rss" />
</channel>
More information about the Zope3-Checkins
mailing list