[Checkins] SVN: z3c.website/trunk/src/z3c/website/ Added sampledata generator

Roger Ineichen roger at projekt01.ch
Thu May 24 06:49:38 EDT 2007


Log message for revision 75929:
  Added sampledata generator

Changed:
  U   z3c.website/trunk/src/z3c/website/breadcrumb/configure.zcml
  U   z3c.website/trunk/src/z3c/website/browser/member.py
  U   z3c.website/trunk/src/z3c/website/browser/page.py
  U   z3c.website/trunk/src/z3c/website/browser/site.py
  U   z3c.website/trunk/src/z3c/website/configure.zcml
  U   z3c.website/trunk/src/z3c/website/page.py
  U   z3c.website/trunk/src/z3c/website/sample.py
  A   z3c.website/trunk/src/z3c/website/sampledata/
  A   z3c.website/trunk/src/z3c/website/sampledata/README.txt
  A   z3c.website/trunk/src/z3c/website/sampledata/__init__.py
  A   z3c.website/trunk/src/z3c/website/sampledata/configure.zcml
  A   z3c.website/trunk/src/z3c/website/sampledata/content.py
  A   z3c.website/trunk/src/z3c/website/sampledata/sample.py
  A   z3c.website/trunk/src/z3c/website/sampledata/website.py
  U   z3c.website/trunk/src/z3c/website/site.py
  U   z3c.website/trunk/src/z3c/website/skin/demo.css
  U   z3c.website/trunk/src/z3c/website/skin/template.pt
  A   z3c.website/trunk/src/z3c/website/tales.py
  A   z3c.website/trunk/src/z3c/website/tales.zcml

-=-
Modified: z3c.website/trunk/src/z3c/website/breadcrumb/configure.zcml
===================================================================
--- z3c.website/trunk/src/z3c/website/breadcrumb/configure.zcml	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/breadcrumb/configure.zcml	2007-05-24 10:49:38 UTC (rev 75929)
@@ -1,7 +1,16 @@
 <configure
     xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
     i18n_domain="z3c.website">
 
+  <!-- IBreadcrumbs -->
+  <page
+      for="*"
+      name="breadcrumbs"
+      class="z3c.breadcrumb.browser.Breadcrumbs"
+      permission="zope.Public"
+      allowed_interface="z3c.breadcrumb.interfaces.IBreadcrumbs"
+      layer="z3c.website.layer.IWebSiteBrowserLayer"
+      />
 
-
 </configure>

Modified: z3c.website/trunk/src/z3c/website/browser/member.py
===================================================================
--- z3c.website/trunk/src/z3c/website/browser/member.py	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/browser/member.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -183,7 +183,7 @@
             self.context, self.request, self.members, columns=self.columns,
             prefix='members.')
         formatter.widths = [25, 150, 150, 150, 150]
-        #formatter.cssClasses['table'] = 'sorted'
+        #formatter.cssClasses['table'] = 'list'
         return formatter()
 
     @button.buttonAndHandler(u'Edit')

Modified: z3c.website/trunk/src/z3c/website/browser/page.py
===================================================================
--- z3c.website/trunk/src/z3c/website/browser/page.py	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/browser/page.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -88,7 +88,7 @@
         formatter = table.AlternatingRowFormatter(
             self.context, self.request, self.items(), columns=self.columns)
         formatter.widths=[25, 50, 300, 100, 100]
-        formatter.cssClasses['table'] = 'sorted'
+        formatter.cssClasses['table'] = 'list'
         return formatter()
 
     def update(self):

Modified: z3c.website/trunk/src/z3c/website/browser/site.py
===================================================================
--- z3c.website/trunk/src/z3c/website/browser/site.py	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/browser/site.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -84,7 +84,7 @@
         formatter = table.AlternatingRowFormatter(
             self.context, self.request, self.sites(), columns=self.columns)
         formatter.widths=[25, 50, 300, 100, 100]
-        formatter.cssClasses['table'] = 'sorted'
+        formatter.cssClasses['table'] = 'list'
         return formatter()
 
     def update(self):

Modified: z3c.website/trunk/src/z3c/website/configure.zcml
===================================================================
--- z3c.website/trunk/src/z3c/website/configure.zcml	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/configure.zcml	2007-05-24 10:49:38 UTC (rev 75929)
@@ -16,8 +16,11 @@
   <include file="layer.zcml" />
   <include file="page.zcml" />
   <include file="provider.zcml" />
+  <include file="tales.zcml" />
 
+  <include package=".breadcrumb" />
   <include package=".browser" />
+  <include package=".sampledata" />
   <include package=".skin" />
   <include package=".tool" />
 

Modified: z3c.website/trunk/src/z3c/website/page.py
===================================================================
--- z3c.website/trunk/src/z3c/website/page.py	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/page.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -38,6 +38,11 @@
     keyword = FieldProperty(interfaces.IPage['keyword'])
     body = FieldProperty(interfaces.IPage['body'])
 
+    def __init__(self, title=None):
+        super(Page, self).__init__()
+        if title is not None:
+            self.title = title
+
     def __repr__(self):
         return '<%s %r>' % (self.__class__.__name__, self.__name__)
 

Modified: z3c.website/trunk/src/z3c/website/sample.py
===================================================================
--- z3c.website/trunk/src/z3c/website/sample.py	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/sample.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -38,6 +38,11 @@
     keyword = FieldProperty(interfaces.ISamples['keyword'])
     body = FieldProperty(interfaces.ISamples['body'])
 
+    def __init__(self, title=None):
+        super(Samples, self).__init__()
+        if title is not None:
+            self.title = title
+
     def __repr__(self):
         return '<%s %r>' % (self.__class__.__name__, self.__name__)
 

Added: z3c.website/trunk/src/z3c/website/sampledata/README.txt
===================================================================
--- z3c.website/trunk/src/z3c/website/sampledata/README.txt	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/sampledata/README.txt	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,26 @@
+======================
+Sample Data Generation
+======================
+
+Setup the test browser and go to the sampledata.html page.
+
+    >>> from zope.testbrowser.testing import Browser
+    >>> browser = Browser()
+    >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+    >>> browser.handleErrors = False
+
+
+Setup z3c.website
+-----------------
+
+  >>> browser.open('http://localhost/@@managesamples.html')
+  >>> browser.getLink(text='z3c.website.site').click()
+  >>> browser.url
+  'http://localhost/@@generatesample.html?manager=z3c.website'
+
+Now we fill in the form and generate the sample site.
+
+  >>> browser.getControl(name='generator.seed').value = 'sample'
+  >>> browser.getControl(name='z3c.website.site.__name__').value = 'xpo'
+  >>> browser.getControl(name='z3c.website.site.title').value = 'Z3C'
+  >>> browser.getControl('Generate').click()

Added: z3c.website/trunk/src/z3c/website/sampledata/__init__.py
===================================================================
--- z3c.website/trunk/src/z3c/website/sampledata/__init__.py	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/sampledata/__init__.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2007 Projekt01 GmbH and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Resource License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: __init__.py 40 2007-02-21 09:18:28Z roger.ineichen $
+"""
+__docformat__ = "reStructuredText"

Added: z3c.website/trunk/src/z3c/website/sampledata/configure.zcml
===================================================================
--- z3c.website/trunk/src/z3c/website/sampledata/configure.zcml	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/sampledata/configure.zcml	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,40 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    zcml:condition="have devmode">
+
+  <utility
+      factory=".website.WebSite"
+      provides="z3c.sampledata.interfaces.ISampleDataPlugin"
+      name="z3c.website.site"
+      />
+
+  <utility
+      factory=".sample.Z3CSamples"
+      provides="z3c.sampledata.interfaces.ISampleDataPlugin"
+      name="z3c.website.samples"
+      />
+
+  <utility
+      factory=".content.Z3CContentStructure"
+      provides="z3c.sampledata.interfaces.ISampleDataPlugin"
+      name="z3c.website.content"
+      />
+
+  <!-- testing setup -->
+  <SampleManager
+      name="z3c.website">
+    <generator
+        name="z3c.website.site"
+        />
+    <generator
+        name="z3c.website.samples"
+        contextFrom="z3c.website.site"
+        />
+    <generator
+        name="z3c.website.content"
+        contextFrom="z3c.website.site"
+        />
+  </SampleManager>
+
+</configure>

Added: z3c.website/trunk/src/z3c/website/sampledata/content.py
===================================================================
--- z3c.website/trunk/src/z3c/website/sampledata/content.py	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/sampledata/content.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,65 @@
+##############################################################################
+#
+# Copyright (c) 2007 Projekt01 GmbH and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Resource License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: __init__.py 40 2007-02-21 09:18:28Z roger.ineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.schema
+import zope.event
+import zope.lifecycleevent
+from zope.app.component import hooks
+
+from z3c.sampledata.interfaces import ISampleDataPlugin
+from z3c.configurator import configurator
+from z3c.resource.interfaces import IResource
+from z3c.website.i18n import MessageFactory as _
+from z3c.website import interfaces
+from z3c.website import page
+
+
+class Z3CContentStructure(object):
+    zope.interface.implements(ISampleDataPlugin)
+
+    name = 'z3c.website.content'
+    dependencies = ['z3c.website.site']
+    schema = None
+
+    def generate(self, context, param={}, dataSource=None, seed=None):
+
+        # Create a virtual site
+        tutorials = page.Page(u'Tutorials')
+        download = page.Page(u'Download')
+        contact = page.Page(u'Contact')
+
+        # fire created event
+        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(tutorials))
+        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(download))
+        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(contact))
+
+        # Add to the site
+        context[u'tutorials'] = tutorials
+        context[u'download'] = download
+        context[u'contact'] = contact
+        
+        # create resources
+        resource = IResource(tutorials)
+        resource = IResource(download)
+        resource = IResource(contact)
+
+        # And configure the sub folders
+        configurator.configure(tutorials, param)
+        configurator.configure(download, param)
+        configurator.configure(contact, param)

Added: z3c.website/trunk/src/z3c/website/sampledata/sample.py
===================================================================
--- z3c.website/trunk/src/z3c/website/sampledata/sample.py	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/sampledata/sample.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,91 @@
+##############################################################################
+#
+# Copyright (c) 2007 Projekt01 GmbH and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Resource License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: __init__.py 40 2007-02-21 09:18:28Z roger.ineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.schema
+import zope.event
+import zope.lifecycleevent
+from zope.app.component import hooks
+
+from z3c.sampledata.interfaces import ISampleDataPlugin
+from z3c.configurator import configurator
+from z3c.website.i18n import MessageFactory as _
+from z3c.website import interfaces
+from z3c.website import sample
+
+
+# TODO: add more then one site, e.g. 'org' and 'ch'
+class IZ3CSamplesSchema(zope.interface.Interface):
+    """Sample generator for a xpo site."""
+
+    __name__ = zope.schema.TextLine(
+        title=_(u'Object Name'),
+        description=_(u'The name of the samples folder.'),
+        default=u"samples",
+        required=False)
+
+    title = zope.schema.TextLine(
+        title=_(u'Title'),
+        description=_(u'The title of the samples folder.'),
+        default=u"Samples",
+        required=False)
+
+    description = zope.schema.Text(
+        title=_(u'Description'),
+        description=_(u'Description of the content.'),
+        default=u'',
+        missing_value=u'',
+        required=False)
+
+    keyword = zope.schema.Text(
+        title=_(u'Keyword'),
+        description=_(u'Keyword of the content.'),
+        default=u'',
+        missing_value=u'',
+        required=False)
+
+    body = zope.schema.Text(
+        title=_(u'Body'),
+        description=_(u'Body is the main part of the page.'),
+        default=u'',
+        missing_value=u'',
+        required=False)
+
+
+class Z3CSamples(object):
+    zope.interface.implements(ISampleDataPlugin)
+
+    name = 'z3c.website.samples'
+    dependencies = ['z3c.website.site']
+    schema = IZ3CSamplesSchema
+
+    def generate(self, context, param={}, dataSource=None, seed=None):
+
+        # Create a virtual site
+        title = param.get('title', u'Samples')
+        __name__ = param.get('__name__', u'samples')
+        obj = sample.Samples(title)
+        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(obj))
+
+        # Add the site
+        context[__name__] = obj
+
+        # Configure the new site after adding
+        configurator.configure(obj, param)
+
+        return obj
\ No newline at end of file

Added: z3c.website/trunk/src/z3c/website/sampledata/website.py
===================================================================
--- z3c.website/trunk/src/z3c/website/sampledata/website.py	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/sampledata/website.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,106 @@
+##############################################################################
+#
+# Copyright (c) 2007 Projekt01 GmbH and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Resource License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: __init__.py 40 2007-02-21 09:18:28Z roger.ineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.schema
+import zope.event
+import zope.lifecycleevent
+from zope.app.component import hooks
+
+from z3c.sampledata.interfaces import ISampleDataPlugin
+from z3c.configurator import configurator
+from z3c.website.i18n import MessageFactory as _
+from z3c.website import interfaces
+from z3c.website import site
+
+
+class IWebSiteSchema(zope.interface.Interface):
+    """Sample generator for a xpo site."""
+
+    __name__ = zope.schema.TextLine(
+        title=_(u'Object Name'),
+        description=_(u'The name of the website.'),
+        default=u"z3c",
+        required=False)
+
+    title = zope.schema.TextLine(
+        title=_(u'Title'),
+        description=_(u'The title of the website.'),
+        default=u"Z3C",
+        required=False)
+
+    description = zope.schema.Text(
+        title=_(u'Description'),
+        description=_(u'Description of the content.'),
+        default=u'',
+        missing_value=u'',
+        required=False)
+
+    keyword = zope.schema.Text(
+        title=_(u'Keyword'),
+        description=_(u'Keyword of the content.'),
+        default=u'',
+        missing_value=u'',
+        required=False)
+
+    body = zope.schema.Text(
+        title=_(u'Body'),
+        description=_(u'Body is the main part of the page.'),
+        default=u'',
+        missing_value=u'',
+        required=False)
+
+
+class WebSite(object):
+    zope.interface.implements(ISampleDataPlugin)
+
+    name = 'z3c.website.site'
+    dependencies = []
+    schema = IWebSiteSchema
+
+    def generate(self, context, param={}, dataSource={}, seed=None):
+
+        # Create a site
+        __name__ = param.get('__name__', u'z3c')
+        title = param.get('title', u'Z3C')
+        newSite = site.WebSite(title)
+        newSite.description = param.get('description', u'')
+        newSite.keyword = param.get('keyword', u'')
+        newSite.body = param.get('body', u'')
+        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(newSite))
+
+        # Add the site
+        context[__name__] = newSite
+
+        # Make sure the site is set correctly for handling utilities
+        originalSite = hooks.getSite()
+        hooks.setSite(newSite)
+
+        # Configure the new site after adding
+        param['member.login'] = 'Admin'
+        param['member.password'] = u'password'
+        param['member.firstName'] = u'Roger'
+        param['member.lastName'] = u'Ineichen'
+        param['member.phone'] = u'123'
+        param['member.email'] = u'testing at projekt01.com'
+        configurator.configure(newSite, param)
+
+        # Do some cleanup
+        hooks.setSite(originalSite)
+
+        return newSite

Modified: z3c.website/trunk/src/z3c/website/site.py
===================================================================
--- z3c.website/trunk/src/z3c/website/site.py	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/site.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -41,8 +41,6 @@
 
 from z3c.website import interfaces
 from z3c.website import authentication
-from z3c.website import page
-from z3c.website import sample
 
 
 class WebSite(folder.Folder):
@@ -122,48 +120,3 @@
         adminGroup = groups['groups.Administrators']
         adminGroup.setPrincipals(
             adminGroup.principals + (admin.__name__,), check=False)
-
-        # setup info top level folder
-        info = page.Page()
-        info.title = u'Info'
-        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(info))
-        self.context['info'] = info
-        # create resource folder
-        resource = IResource(info)
-        configurator.configure(info, data)
-
-        # setup tutorials top level folder
-        tutorials = page.Page()
-        tutorials.title = u'Tutorials'
-        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(tutorials))
-        self.context['tutorials'] = tutorials
-        # create resource folder
-        resource = IResource(tutorials)
-        configurator.configure(tutorials, data)
-
-        # setup contact top level folder
-        download = page.Page()
-        download.title = u'Download'
-        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(download))
-        self.context['download'] = download
-        # create resource folder
-        resource = IResource(download)
-        configurator.configure(download, data)
-
-        # setup contact top level folder
-        contact = page.Page()
-        contact.title = u'Contact'
-        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(contact))
-        self.context['contact'] = contact
-        # create resource folder
-        resource = IResource(contact)
-        configurator.configure(contact, data)
-
-        # setup samples folder
-        samples = sample.Samples()
-        samples.title = u'Samples'
-        zope.event.notify(zope.lifecycleevent.ObjectCreatedEvent(samples))
-        self.context['samples'] = samples
-        # create resource folder
-        resource = IResource(samples)
-        configurator.configure(samples, data)

Modified: z3c.website/trunk/src/z3c/website/skin/demo.css
===================================================================
--- z3c.website/trunk/src/z3c/website/skin/demo.css	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/skin/demo.css	2007-05-24 10:49:38 UTC (rev 75929)
@@ -224,6 +224,33 @@
     vertical-align: middle;
 }
 
+
+/* [ breadcrumbs ]----------------------------------------------------------- */
+
+div#breadCrumbContainer {
+    height: 24px;
+    line-height: 24px;
+    color: #666666;
+    font-size: 11px;
+    padding-left: 20px;
+}
+
+#breadCrumbContainer a {
+    color: #002B8B;
+    font-weight: bold;
+    text-decoration: none;
+}
+
+#breadCrumbContainer a:hover {
+    font-weight: bold;
+    text-decoration: underline;
+}
+
+#breadCrumbContainer a.selected {
+    font-weight: bold;
+}
+
+
 /*---[ content ]-------------------------------------------------------------*/
 #contentContainer {
 	float: left;

Modified: z3c.website/trunk/src/z3c/website/skin/template.pt
===================================================================
--- z3c.website/trunk/src/z3c/website/skin/template.pt	2007-05-24 10:43:38 UTC (rev 75928)
+++ z3c.website/trunk/src/z3c/website/skin/template.pt	2007-05-24 10:49:38 UTC (rev 75929)
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
       i18n:domain="z3c.website">
 <head>
-<title>z3c.org</title>
+<title tal:content="string:z3c.org: ${context/webapi:title}">z3c.org: title</title>
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <meta http-equiv="cache-control" content="no-cache" />
 <meta http-equiv="pragma" content="no-cache" />
@@ -74,6 +74,16 @@
         </div>
       </div>
     </div>
+    <div id="breadCrumbContainer">
+      <b i18n:translate="">You are here:</b>
+      <tal:block tal:repeat="crumb context/@@breadcrumbs/crumbs">
+        <a href=""
+            tal:content="string:${crumb/name}"
+            tal:attributes="href string:${crumb/url}"
+            >item</a>
+        <tal:block condition="not:repeat/crumb/end">&gt;</tal:block>
+      </tal:block>
+    </div>
     <div id="mainContainer">
       <div id="contentContainer">
         <div id="content">
@@ -87,12 +97,13 @@
           navigation
         </tal:block>
       </div>
-	  <div class="clear" />
+      <div class="clear" />
       <div id="footerContainer">
         <div class="footer">
-          &copy; copyright 2007 by the Zope community and it's members. --- 
-		  <a href="http://www.zope.org" target="_blank">offizial Zope.org Website</a> --- 
-		  <a href="http://www.MouseRunner.com" target="_blank">icons from www.mouserunner.com</a>
+          &copy; copyright 2007 by the Zope community and it's members. ---
+          <a href="http://www.zope.org" target="_blank">offizial Zope.org Website</a>
+          ---
+          <a href="http://www.MouseRunner.com" target="_blank">icons from www.mouserunner.com</a>
         </div>
       </div>
     </div>

Added: z3c.website/trunk/src/z3c/website/tales.py
===================================================================
--- z3c.website/trunk/src/z3c/website/tales.py	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/tales.py	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,69 @@
+###############################################################################
+#
+# Copyright 2006 by refline (Schweiz) AG, CH-5630 Muri
+#
+###############################################################################
+"""``refline`` TALES Namespace implementation
+
+$Id: api.py 1426 2006-11-10 04:05:22Z roger.ineichen $
+"""
+__docformat__ = "reStructuredText"
+import zope.component
+import zope.interface
+import zope.schema
+from zope.security.interfaces import Unauthorized
+from zope.app import zapi
+
+
+class ITitle(zope.interface.Interface):
+    """Provide a title for the page"""
+
+    title = zope.schema.TextLine(
+        title=u'Title',
+        description=u'The title of the IContent object.',
+        required=True)
+
+
+class Title(object):
+    """Generic Title implementation"""
+    zope.component.adapts(zope.interface.Interface)
+    zope.interface.implements(ITitle)
+
+    def __init__(self, context):
+        self.context = context
+
+    @property
+    def title(self):
+        try:
+            title = getattr(self.context, 'title', None)
+        except Unauthorized:
+            title = None
+
+        if title is None:
+            title = zapi.name(self.context)
+
+        return title or u''
+
+
+class IWebSiteTalesAPI(zope.interface.Interface):
+    """Provide a title for the page"""
+
+    page_title = zope.schema.TextLine(
+        title=u'Page title',
+        description=u'The title of the page.',
+        required=True)
+
+
+class WebSiteTalesAPI(object):
+
+    zope.interface.implements(IWebSiteTalesAPI)
+
+    def __init__(self, context):
+        self.context = context
+
+    def setEngine(self, engine):
+        self._engine = engine
+
+    @property
+    def title(self):
+        return ITitle(self.context).title

Added: z3c.website/trunk/src/z3c/website/tales.zcml
===================================================================
--- z3c.website/trunk/src/z3c/website/tales.zcml	                        (rev 0)
+++ z3c.website/trunk/src/z3c/website/tales.zcml	2007-05-24 10:49:38 UTC (rev 75929)
@@ -0,0 +1,15 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope">
+
+  <!-- Generic adapter called ``webapi`` providing a title -->
+  <adapter
+      factory=".tales.Title" />
+
+  <adapter
+      for="*"
+      provides="zope.traversing.interfaces.IPathAdapter"
+      factory=".tales.WebSiteTalesAPI"
+      name="webapi"
+      />
+
+</configure>



More information about the Checkins mailing list